diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 94ed36bbda..0000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster -ARG VARIANT=1.20-bullseye -FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} - -# [Optional] If your requirements rarely change, uncomment this section to add them to the image. -# COPY requirements.txt /tmp/pip-tmp/ -# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ -# && rm -rf /tmp/pip-tmp - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - - - diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 75a2faa492..0000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,30 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/python-3-postgres -// Update the VARIANT arg in docker-compose.yml to pick a Python version -{ - "name": "sqlc", - "build": { - "dockerfile": "Dockerfile" - }, - - "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], - - // Set *default* container specific settings.json values on container create. - "settings": { - "go.toolsManagement.checkForUpdates": "local", - "go.useLanguageServer": true, - "go.gopath": "/go", - "go.goroot": "/usr/local/go" - }, - - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "golang.Go", - ], - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [5000, 5432], - - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode" -} diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 4ded0ee603..0c55395fc3 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -1,6 +1,6 @@ name: Bug Report description: File a bug report -labels: [bug, triage] +labels: [bug] body: - type: dropdown id: version @@ -9,14 +9,14 @@ body: description: What version of sqlc are you running? If you don't know, run `sqlc version`. multiple: false options: - - 1.22.0 - - 1.21.0 - - 1.20.0 - - 1.19.1 - - 1.19.0 - - 1.18.0 - - 1.17.2 - - 1.16.0 + - 1.31.1 + - 1.31.0 + - 1.30.0 + - 1.29.0 + - 1.28.0 + - 1.27.0 + - 1.26.0 + - 1.25.0 - Other validations: required: true diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index 97c36f512d..b3dd5b0a09 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -1,6 +1,6 @@ name: Feature Request description: Request a new feature or a change to an existing feature -labels: [enhancement, triage] +labels: [enhancement] body: - type: textarea id: feature diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f278157e42..e40df8c88a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,9 +1,21 @@ version: 2 updates: + # The examples module replaces github.com/sqlc-dev/sqlc with ../, so it has + # to carry the same versions as the root module. Listing the directories + # together lets each group update them in a single pull request. - package-ecosystem: "gomod" - directory: "/" + directories: + - "/" + - "/examples" + - "/internal/goldeneye" + - "/internal/endtoend/testdata" schedule: interval: "daily" + groups: + production-dependencies: + dependency-type: "production" + development-dependencies: + dependency-type: "development" - package-ecosystem: "docker" directory: "/" schedule: @@ -12,12 +24,4 @@ updates: directory: "/" schedule: interval: "daily" - - package-ecosystem: "pip" - directory: "/docs" - schedule: - interval: "daily" - ignore: - # sphinx-rtd-theme does not support the latest versions of docutils and - # sphinx - - dependency-name: "docutils" - - dependency-name: "sphinx" + diff --git a/.github/workflows/buf.yml b/.github/workflows/buf.yml index 05507b05ba..c77e9b459d 100644 --- a/.github/workflows/buf.yml +++ b/.github/workflows/buf.yml @@ -1,9 +1,18 @@ name: buf -on: pull_request +on: + pull_request: + paths-ignore: + - 'docs/**' jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - uses: bufbuild/buf-setup-action@v1 + with: + # buf-setup-action resolves the release download URL through the + # GitHub API. Without a token that request is anonymous and shares + # a rate limit with every other job on the runner's IP, so setup + # intermittently fails with "API rate limit exceeded". + github_token: ${{ github.token }} - uses: bufbuild/buf-lint-action@v1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..ae66e40a5f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +name: build +on: + workflow_dispatch: +jobs: + build: + strategy: + matrix: + os: [ubuntu-24.04, macos-14, windows-2022] + name: build ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.26.5' + - name: install ./... + run: go build ./... + env: + CGO_ENABLED: "0" diff --git a/.github/workflows/ci-kotlin.yml b/.github/workflows/ci-kotlin.yml index c88a9815e6..177787bf7e 100644 --- a/.github/workflows/ci-kotlin.yml +++ b/.github/workflows/ci-kotlin.yml @@ -3,50 +3,29 @@ on: push: branches: - main + paths-ignore: + - 'docs/**' pull_request: + paths-ignore: + - 'docs/**' jobs: - build: + if: false name: test runs-on: ubuntu-latest - - services: - postgres: - image: postgres:11 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: postgres - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - mysql: - image: mysql:8 - env: - MYSQL_ROOT_PASSWORD: mysecretpassword - MYSQL_DATABASE: mysql - ports: - - 3306:3306 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 with: - distribution: 'adopt' - java-version: '11' - - uses: eskatos/gradle-command-action@v2 - env: - PG_USER: postgres - PG_HOST: localhost - PG_DATABASE: postgres - PG_PASSWORD: postgres - PG_PORT: ${{ job.services.postgres.ports['5432'] }} - MYSQL_DATABASE: mysql - MYSQL_HOST: localhost - MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} - MYSQL_ROOT_PASSWORD: mysecretpassword + go-version: '1.26.5' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v7 with: - build-root-directory: examples/kotlin - wrapper-directory: examples/kotlin - arguments: test --scan + repository: sqlc-dev/sqlc-gen-kotlin + path: kotlin + - run: make test + working-directory: kotlin + - run: sqlc diff + working-directory: kotlin/examples + diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 0edb94092a..47328c7b71 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -3,42 +3,28 @@ on: push: branches: - main + paths-ignore: + - 'docs/**' pull_request: + paths-ignore: + - 'docs/**' jobs: - build: + if: false name: test runs-on: ubuntu-latest - - services: - postgres: - image: postgres:11 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: postgres - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 with: - python-version: 3.9 - - name: Install python dependencies - working-directory: ./examples/python - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - - name: Test python code - working-directory: ./examples/python - env: - PG_USER: postgres - PG_HOST: localhost - PG_DATABASE: postgres - PG_PASSWORD: postgres - PG_PORT: ${{ job.services.postgres.ports['5432'] }} - run: | - pytest src/tests + go-version: '1.26.5' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v7 + with: + repository: sqlc-dev/sqlc-gen-python + path: python + - run: make test + working-directory: python + - run: sqlc diff + working-directory: python/examples diff --git a/.github/workflows/ci-typescript.yml b/.github/workflows/ci-typescript.yml new file mode 100644 index 0000000000..e5aac81fca --- /dev/null +++ b/.github/workflows/ci-typescript.yml @@ -0,0 +1,30 @@ +name: typescript +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + pull_request: + paths-ignore: + - 'docs/**' +jobs: + build: + if: false + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.26.5' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v7 + with: + repository: sqlc-dev/sqlc-gen-typescript + path: typescript + # v0.1.3 + ref: daaf539092421adc15f6c3164279a3470716b560 + - run: sqlc diff + working-directory: typescript/examples diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8bccb6bfc..289cdf4cb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,47 +5,33 @@ on: - main pull_request: jobs: - windows-build: - if: ${{ github.ref == 'refs/heads/main' }} - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - # wasmtime can't be built with 12.2 - - run: choco install mingw --version 11.2.0.07112021 --allow-downgrade - - uses: actions/setup-go@v4 - with: - go-version: '1.21.3' - - run: go build ./... - - darwin-build: - if: ${{ github.ref == 'refs/heads/main' }} - runs-on: macos-latest + build: + strategy: + matrix: + goos: [darwin, linux, windows] + goarch: [amd64, arm64] + name: build ${{ matrix.goos }}/${{ matrix.goarch }} + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 with: - go-version: '1.21.3' + go-version: '1.26.5' - run: go build ./... + env: + CGO_ENABLED: "0" + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} - build: - name: test - runs-on: ubuntu-latest - - services: - mysql: - image: "mysql/mysql-server:8.0" - env: - MYSQL_DATABASE: mysql - MYSQL_ROOT_HOST: '%' - MYSQL_ROOT_PASSWORD: mysecretpassword - ports: - - 3306:3306 - + # sqlc's own tests: the end-to-end suite needs PostgreSQL and MySQL, which + # sqlc-test-setup installs on the runner. + test: + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 with: - go-version: '1.21.3' + go-version: '1.26.5' - name: install gotestsum run: go install gotest.tools/gotestsum@latest @@ -53,38 +39,71 @@ jobs: - name: install sqlc-gen-test run: go install github.com/sqlc-dev/sqlc-gen-test@v0.1.0 + - name: install test-json-process-plugin + run: go install ./scripts/test-json-process-plugin/ + - name: install ./... run: go install ./... + env: + CGO_ENABLED: "0" + + # A module of its own, so cgo stays on for the DuckDB driver the + # DuckDB golden imports. + - name: build internal/endtoend + run: go build ./... + working-directory: internal/endtoend/testdata + + - name: install databases + run: go run ./cmd/sqlc-test-setup install postgresql mysql + + - name: start databases + run: go run ./cmd/sqlc-test-setup start postgresql mysql - name: test ./... - run: gotestsum --junitfile junit.xml -- --tags=examples ./... + run: gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m -failfast ./... env: - MYSQL_DATABASE: mysql - MYSQL_HOST: localhost - MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} - MYSQL_ROOT_PASSWORD: mysecretpassword CI_SQLC_PROJECT_ID: ${{ secrets.CI_SQLC_PROJECT_ID }} CI_SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }} SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }} + POSTGRESQL_SERVER_URI: "postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable" + MYSQL_SERVER_URI: "root:mysecretpassword@tcp(127.0.0.1:3306)/mysql?multiStatements=true&parseTime=true" + CGO_ENABLED: "0" - - name: build internal/endtoend - run: go build ./... - working-directory: internal/endtoend/testdata + # The examples run generated code against every database sqlc supports. + # They are a module of their own, so their drivers are not dependencies + # of sqlc, and cgo stays on for the DuckDB driver. sqlc-test-setup + # installs and starts every database on the runner. + examples: + runs-on: ubuntu-24.04 + timeout-minutes: 45 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version: '1.26.5' + cache-dependency-path: | + go.sum + examples/go.sum - - name: report - if: false - run: ./scripts/report.sh + - name: install databases + run: go run ./cmd/sqlc-test-setup install + + - name: start databases + run: go run ./cmd/sqlc-test-setup start + + - name: test examples + run: go test --tags=examples -timeout 20m ./... + working-directory: examples env: - BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }} + POSTGRESQL_SERVER_URI: "postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable" + MYSQL_SERVER_URI: "root:mysecretpassword@tcp(127.0.0.1:3306)/mysql?multiStatements=true&parseTime=true" + CLICKHOUSE_SERVER_URI: "clickhouse://default:mysecretpassword@127.0.0.1:9000" + MSSQL_SERVER_URI: "sqlserver://sa:Mysecretpassword1!@127.0.0.1:1433?encrypt=disable" + SPANNER_SERVER_URI: "localhost:15000" vuln_check: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 - with: - go-version: '1.21.3' - - run: go install golang.org/x/vuln/cmd/govulncheck@latest - - run: govulncheck ./... + - uses: golang/govulncheck-action@v1 diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index d2bac940dd..169b1dc00b 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -1,13 +1,13 @@ -name: sqlc-pg-gen +name: gen on: workflow_dispatch: jobs: - gen: - name: sqlc-pg-gen - runs-on: ubuntu-22.04 + postgresql: + name: generate postgresql dialect + runs-on: ubuntu-24.04 services: postgres: - image: postgres:15.0-alpine + image: postgres:16 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -17,22 +17,176 @@ jobs: # needed because the postgres container does not provide a healthcheck options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 with: - go-version: '1.21.3' - - run: go build -o sqlc-pg-gen ./internal/tools/sqlc-pg-gen - - run: mkdir -p gen/contrib - - run: ./sqlc-pg-gen gen + go-version-file: internal/goldeneye/go.mod + check-latest: true + - run: go run ./cmd/goldeneye generate postgresql + working-directory: internal/goldeneye env: - PG_USER: postgres - PG_HOST: localhost - PG_DATABASE: postgres - PG_PASSWORD: postgres - PG_PORT: ${{ job.services.postgres.ports['5432'] }} + POSTGRESQL_SERVER_URI: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports['5432'] }}/postgres?sslmode=disable - name: Save results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v7 with: - name: sqlc-pg-gen-results - path: gen + name: dialect-postgresql + path: internal/engine/postgresql/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/postgresql && git diff --exit-code --stat -- internal/engine/postgresql + mysql: + name: generate mysql dialect + runs-on: ubuntu-24.04 + services: + mysql: + image: mysql:26.7 + env: + MYSQL_ROOT_PASSWORD: mysecretpassword + ports: + - 3306:3306 + options: --health-cmd "mysqladmin ping -h 127.0.0.1 -pmysecretpassword" --health-interval 10s --health-timeout 5s --health-retries 5 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + - run: go run ./cmd/goldeneye generate mysql + working-directory: internal/goldeneye + env: + MYSQL_SERVER_URI: root:mysecretpassword@tcp(localhost:${{ job.services.mysql.ports['3306'] }})/mysql + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-mysql + path: internal/engine/dolphin/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/dolphin && git diff --exit-code --stat -- internal/engine/dolphin + + clickhouse: + name: generate clickhouse dialect + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + - run: go run ./cmd/goldeneye install clickhouse + working-directory: internal/goldeneye + - run: go run ./cmd/goldeneye generate clickhouse + working-directory: internal/goldeneye + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-clickhouse + path: internal/engine/clickhouse/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/clickhouse && git diff --exit-code --stat -- internal/engine/clickhouse + + sqlite: + name: generate sqlite dialect + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + - run: go run ./cmd/goldeneye install sqlite + working-directory: internal/goldeneye + - run: go run ./cmd/goldeneye generate sqlite + working-directory: internal/goldeneye + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-sqlite + path: internal/engine/sqlite/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/sqlite && git diff --exit-code --stat -- internal/engine/sqlite + + mssql: + name: generate mssql dialect + runs-on: ubuntu-24.04 + services: + mssql: + image: mcr.microsoft.com/mssql/server:2025-latest + env: + ACCEPT_EULA: Y + MSSQL_SA_PASSWORD: Mysecretpassword1! + ports: + - 1433:1433 + options: --health-cmd "/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P 'Mysecretpassword1!' -Q 'SELECT 1'" --health-interval 10s --health-timeout 5s --health-retries 10 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + - run: go run ./cmd/goldeneye generate mssql + working-directory: internal/goldeneye + env: + MSSQL_SERVER_URI: sqlserver://sa:Mysecretpassword1!@localhost:${{ job.services.mssql.ports['1433'] }}?encrypt=disable + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-mssql + path: internal/engine/mssql/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/mssql && git diff --exit-code --stat -- internal/engine/mssql + + spanner: + name: generate googlesql dialect + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + # Spanner Omni is run the way its quickstart runs it, on the host + # network, since a service container cannot be given a command. + - name: Start Spanner Omni + run: | + docker run -d --name spanneromni --network host us-docker.pkg.dev/spanner-omni/images/spanner-omni:2026.r2.1-beta start-single-server + for i in $(seq 1 60); do + if docker exec spanneromni /google/spanner/bin/spanner databases list >/dev/null 2>&1; then exit 0; fi + sleep 5 + done + docker logs spanneromni + exit 1 + - run: go run ./cmd/goldeneye generate spanner + working-directory: internal/goldeneye + env: + SPANNER_SERVER_URI: localhost:15000 + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-googlesql + path: internal/engine/googlesql/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/googlesql && git diff --exit-code --stat -- internal/engine/googlesql + + duckdb: + name: generate duckdb dialect + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + # The current build of DuckDB's v2.0 preview channel, until 2.0 is + # released: a later build than the dialect was generated from shows up + # as a difference. + - run: go run ./cmd/goldeneye install duckdb + working-directory: internal/goldeneye + - run: go run ./cmd/goldeneye generate duckdb + working-directory: internal/goldeneye + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-duckdb + path: internal/engine/duckdb/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/duckdb && git diff --exit-code --stat -- internal/engine/duckdb diff --git a/.readthedocs.yaml b/.readthedocs.yaml deleted file mode 100644 index 9712e405d1..0000000000 --- a/.readthedocs.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# .readthedocs.yaml -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -# Set the version of Python and other tools you might need -build: - os: ubuntu-22.04 - tools: - python: "3.11" - -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: docs/conf.py - -# We recommend specifying your dependencies to enable reproducible builds: -# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html -python: - install: - - requirements: docs/requirements.txt diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000000..e0ac33cb9e --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,356 @@ +# Claude Code Development Guide for sqlc + +This document provides essential information for working with the sqlc codebase, including testing, development workflow, and code structure. + +## Quick Start + +### Prerequisites + +- **Go 1.26.4+** - Required for building and testing +- **Docker & Docker Compose** - Required for integration tests with databases (local development) +- **Git** - For version control + +## Database Setup with sqlc-test-setup + +The `sqlc-test-setup` tool (`cmd/sqlc-test-setup/`) automates installing and starting PostgreSQL, MySQL, ClickHouse, SQL Server and Spanner Omni for tests. Both commands are idempotent and safe to re-run, and take the databases to act on as arguments (`postgresql`, `mysql`, `clickhouse`, `mssql`, `spanner`); with none named they act on all five. + +### Install databases + +```bash +go run ./cmd/sqlc-test-setup install +``` + +This will: +- Configure the apt proxy (if `http_proxy` is set, e.g. in Claude Code remote environments) +- Install PostgreSQL via apt +- Download and install MySQL 26.7 from Oracle's deb bundle +- Download the ClickHouse 25.8 release into the user cache, where goldeneye caches it too +- Install SQL Server 2025 from Microsoft's apt repository and run its setup, accepting the EULA on your behalf (Ubuntu 22.04 and 24.04 only) +- Download the Spanner Omni standalone server release into the user cache (linux/amd64 only) +- Resolve all dependencies automatically +- Skip anything already installed + +### Start databases + +```bash +go run ./cmd/sqlc-test-setup start +``` + +This will: +- Start PostgreSQL and configure password auth (`postgres`/`postgres`) +- Start MySQL via `mysqld_safe` and set root password (`mysecretpassword`) +- Start a ClickHouse server in the background on localhost, with the default user's password `mysecretpassword` +- Start SQL Server through systemd, or in the background where there is no systemd, with the sa password `Mysecretpassword1!` +- Start a Spanner Omni single server in the background, serving plaintext gRPC on port 15000 +- Verify the connections +- Skip steps that are already done (running services, existing config) + +Connection URIs after start: +- PostgreSQL: `postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable` +- MySQL: `root:mysecretpassword@tcp(127.0.0.1:3306)/mysql` +- ClickHouse: `clickhouse://default:mysecretpassword@127.0.0.1:9000` (`CLICKHOUSE_SERVER_URI`) +- SQL Server: `sqlserver://sa:Mysecretpassword1!@127.0.0.1:1433?encrypt=disable` (`MSSQL_SERVER_URI`) +- Spanner Omni: `localhost:15000` (`SPANNER_SERVER_URI`) + +The examples' tests for ClickHouse, SQL Server and Spanner read those variables and skip when unset. `docker-compose.yml` runs the same databases for anyone who prefers containers. + +### Run tests + +```bash +# Full test suite (requires databases running) +go test --tags=examples -timeout 20m ./... +``` + +## Running Tests + +### Basic Unit Tests (No Database Required) + +```bash +go test ./... +``` + +### Full Test Suite with Docker (Local Development) + +```bash +docker compose up -d +go test --tags=examples -timeout 20m ./... +``` + +### Full Test Suite without Docker (Remote / CI) + +```bash +go run ./cmd/sqlc-test-setup install +go run ./cmd/sqlc-test-setup start +go test --tags=examples -timeout 20m ./... +``` + +### Running Specific Tests + +```bash +# Test a specific package +go test ./internal/config + +# Run with verbose output +go test -v ./internal/config + +# Run a specific test function +go test -v ./internal/config -run TestConfig + +# Run with race detector (recommended for concurrency changes) +go test -race ./internal/config +``` + +## Testing Strategy + +**Cover new work with end-to-end tests, not unit tests.** A change to the +compiler, an engine, the analysis core or codegen is exercised by running sqlc +the way a user does — a schema, a query file and a committed golden output — +so the test says what sqlc produces rather than what an internal function +returns. Internal APIs move around; the SQL that goes in and the output that +comes out is the contract worth pinning down. + +Adding coverage means adding a directory under `/internal/endtoend/testdata/`, +not a `*_test.go` next to the code. Reach for a unit test only when the +behavior genuinely cannot be reached through the CLI, and say why in the test. + +Some `*_test.go` files predate this and remain; they are not a precedent for +new ones. + +### End-to-End Tests + +- **Location:** `/internal/endtoend/` +- **Requirements:** `--tags=examples` flag and running databases +- **Tests:** + - `TestExamples` - Main end-to-end tests + - `TestReplay` - Replay tests + - `TestFormat` - Code formatting tests + - `TestJsonSchema` - JSON schema validation + - `TestExamplesVet` - Static analysis tests + +A case is a directory holding the inputs and the expected output. `exec.json` +names the command and its arguments — omit it and the case runs `generate`, +comparing the generated files against the ones committed alongside; give it +`{"command": "analyze", "args": [...]}` and the case compares the command's +stdout against `stdout.json` (or `stdout.txt` for a command that does not +print JSON). A case that is expected to fail commits its `stderr.txt`. Regenerate a golden by running the command in its directory and +writing the output back over the committed file. + +`TestReplay` runs the whole corpus once per *context*. `base` runs each case as +committed and `managed-db` reruns it against a live database, so a context can +change the config a case is generated with and the experiments it is generated +under. A case restricts itself to some of them with `"contexts": [...]` in its +`exec.json`, and commits per-context expected errors as `stderr/.txt`. +There is only one set of committed golden files, so every context is expected +to generate identical code. + +The `core` context generates every case through the analysis core +(`SQLCEXPERIMENT=coreanalyzer`). The two paths still disagree, so it is opt-in +and needs no database: + +```bash +SQLC_TEST_CORE=1 go test ./internal/endtoend -run 'TestReplay/core' +``` + +Go aborts a test binary on panic, so a case that panics the core analyzer ends +the run early. Run a subset to get past one (`-run 'TestReplay/core/^select'`). + +### Dialect Checks + +The dialect seeds under `/internal/engine//dialect/` are generated +from a live database by `/internal/goldeneye`, a nested module, and its tests +verify the committed files against one byte for byte. The same module checks +the `analyze_*` cases under `/internal/endtoend/testdata/` against what the +database itself reports for them, so a `fixture.sql` next to a case's schema +gives the queries rows to run against. ClickHouse, DuckDB, MySQL, SQLite, +SQL Server and Spanner have the check today; engines whose database is not +available skip. + +```bash +cd internal/goldeneye +go run ./cmd/goldeneye install clickhouse # download the pinned clickhouse binary once +go run ./cmd/goldeneye install duckdb # download the current DuckDB 2.0 preview build once +go run ./cmd/goldeneye install sqlite # build the pinned sqlite3 shells once; needs a C compiler +POSTGRESQL_SERVER_URI="postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable" \ +MYSQL_SERVER_URI="root:mysecretpassword@tcp(127.0.0.1:3306)/mysql" \ +MSSQL_SERVER_URI="sqlserver://sa:Mysecretpassword1!@127.0.0.1:1433?encrypt=disable" \ +SPANNER_SERVER_URI="localhost:15000" go test ./... +go run ./cmd/goldeneye generate postgresql # rewrite the files after a change +``` + +The checks are not part of CI. The `gen` workflow +(`.github/workflows/gen.yml`) generates the files on demand and uploads +them as an artifact. + +### Example Tests + +- **Location:** `/examples/` directory, a Go module of its own so the + drivers the examples run against are not dependencies of sqlc, and so + cgo stays on for the DuckDB driver +- **Requirements:** Tagged with "examples", requires live databases; run + with `cd examples && go test --tags=examples ./...` +- **Databases:** PostgreSQL, MySQL, SQLite, ClickHouse, DuckDB, Spanner and + SQL Server examples; each skips when its server is not named + +## Database Services + +The `docker-compose.yml` provides test databases: + +- **PostgreSQL 16** - Port 5432 + - User: `postgres` + - Password: `mysecretpassword` + - Database: `postgres` + +- **MySQL 26.7** - Port 3306 + - User: `root` + - Password: `mysecretpassword` + - Database: `dinotest` + +## Makefile Targets + +```bash +make test # Basic unit tests only +make test-examples # Tests with examples tag +make build-endtoend # Build end-to-end test data +make test-ci # Full CI suite (examples + endtoend + vet) +make vet # Run go vet +make start # Start database containers +``` + +## CI/CD Configuration + +### GitHub Actions Workflow + +- **File:** `.github/workflows/ci.yml` +- **Go Version:** 1.26.4 +- **Jobs:** `build` cross-compiles sqlc with cgo off; `test` runs sqlc's own tests; `examples` runs the examples module against every database; `vuln_check` runs `govulncheck` +- **Database Setup:** `sqlc-test-setup` (not Docker) installs and starts the databases directly on the runner: PostgreSQL and MySQL for `test`, and all five for `examples` +- **Test Command:** `gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m ./...` in `test`, and `go test --tags=examples ./...` under `examples/` in `examples` +- **Additional Checks:** `govulncheck` for vulnerability scanning + +## Development Workflow + +### Building Development Versions + +```bash +# Build main sqlc binary for development +go build -o ~/go/bin/sqlc-dev ./cmd/sqlc + +# Build JSON plugin (required for some tests) +go build -o ~/go/bin/sqlc-gen-json ./cmd/sqlc-gen-json +``` + +### Environment Variables for Tests + +You can override database connections via environment variables: + +```bash +POSTGRESQL_SERVER_URI="postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" +MYSQL_SERVER_URI="root:mysecretpassword@tcp(127.0.0.1:3306)/mysql?multiStatements=true&parseTime=true" +``` + +## Code Structure + +### Key Directories + +- `/cmd/` - Main binaries (sqlc, sqlc-gen-json, sqlc-test-setup) +- `/internal/cmd/` - Command implementations (vet, generate, etc.) +- `/internal/engine/` - Database engine implementations + - `/postgresql/` - PostgreSQL parser and converter + - `/dolphin/` - MySQL parser (uses TiDB parser) + - `/sqlite/` - SQLite parser + - `/duckdb/` - DuckDB 2.0 parser (uses darkwing, the pure Go port of + DuckDB's PEG parser) + - `/dialect/` - The engine's type system and standard library, as + JSONL read by `/internal/core/seed`; the generated parts come from + `/internal/goldeneye` +- `/internal/goldeneye/` - Nested module that generates the dialect seeds + under `/internal/engine//dialect/` from a live database, checks + the committed ones against it, and checks the analyze cases under + `/internal/endtoend/testdata/` against what the database reports, one + package per engine; see its README +- `/internal/core/` - The analysis core: catalog, analyzer and dialect seeds +- `/internal/compiler/` - Query compilation logic +- `/internal/codegen/` - Code generation for different languages +- `/internal/config/` - Configuration file parsing +- `/internal/endtoend/` - End-to-end tests +- `/internal/sqltest/` - Test database setup (Docker, native, local detection) +- `/examples/` - Example projects for testing + +### Important Files + +- `/Makefile` - Build and test targets +- `/docker-compose.yml` - Database services for testing +- `/.github/workflows/ci.yml` - CI configuration + +## Common Issues & Solutions + +### Network Connectivity Issues + +If you see errors about `storage.googleapis.com`, the Go proxy may be unreachable. Use `GOPROXY=direct go mod download` to fetch modules directly from source. + +### Test Timeouts + +End-to-end tests can take a while. Use longer timeouts: +```bash +go test -timeout 20m --tags=examples ./... +``` + +### Race Conditions + +Always run tests with the race detector when working on concurrent code: +```bash +go test -race ./... +``` + +### Database Connection Failures + +If using Docker: +```bash +docker compose ps +docker compose up -d +``` + +If using sqlc-test-setup: +```bash +go run ./cmd/sqlc-test-setup start +``` + +## Tips for Contributors + +1. **Run tests before committing:** `go test --tags=examples -timeout 20m ./...` +2. **Cover new behavior end to end:** Add a case under `/internal/endtoend/testdata/` +3. **Check for race conditions:** Use `-race` flag when testing concurrent code +4. **Iterate on one case:** `go test ./internal/endtoend -run 'TestReplay/base/'` +5. **Read existing cases:** `/internal/endtoend/testdata/` has one per feature + +## Git Workflow + +### Branch Naming + +- Feature branches should start with `claude/` for Claude Code work +- Branch names should be descriptive and end with the session ID + +### Committing Changes + +```bash +git add +git commit -m "Brief description of changes" +git push -u origin +``` + +### Rebasing + +```bash +git checkout main +git pull origin main +git checkout +git rebase main +git push --force-with-lease origin +``` + +## Resources + +- **Main Documentation:** `/docs/` +- **Development Guide:** `/docs/guides/development.md` +- **CI Configuration:** `/.github/workflows/ci.yml` +- **Docker Compose:** `/docker-compose.yml` diff --git a/Dockerfile b/Dockerfile index 160fc2a163..581f230654 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # STEP 1: Build sqlc -FROM golang:1.21.3 AS builder +FROM golang:1.27.2 AS builder COPY . /workspace WORKDIR /workspace @@ -13,7 +13,7 @@ ENV VERSION=$version RUN go run scripts/release.go -docker # STEP 2: Build a tiny image -FROM scratch +FROM gcr.io/distroless/base-debian12 COPY --from=builder /workspace/sqlc /workspace/sqlc ENTRYPOINT ["/workspace/sqlc"] diff --git a/LICENSE b/LICENSE index 335c6d24e1..4d86f4d24d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Kyle Conroy +Copyright (c) 2024 Riza, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 3cd60dc97f..b3f9874d36 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build build-endtoend test test-ci test-examples test-endtoend regen start psql mysqlsh proto +.PHONY: build build-endtoend test test-ci test-examples test-endtoend test-goldeneye start psql mysqlsh proto build: go build ./... @@ -9,31 +9,39 @@ install: test: go test ./... +test-managed: + MYSQL_SERVER_URI="invalid" POSTGRESQL_SERVER_URI="postgres://postgres:mysecretpassword@localhost:5432/postgres" go test -v ./... + vet: go vet ./... + cd ./examples && go vet --tags=examples ./... test-examples: go test --tags=examples ./... + cd ./examples && go test --tags=examples ./... build-endtoend: cd ./internal/endtoend/testdata && go build ./... test-ci: test-examples build-endtoend vet -regen: sqlc-dev sqlc-gen-json - go run ./scripts/regenerate/ - sqlc-dev: go build -o ~/bin/sqlc-dev ./cmd/sqlc/ -sqlc-pg-gen: - go build -o ~/bin/sqlc-pg-gen ./internal/tools/sqlc-pg-gen +goldeneye: + cd ./internal/goldeneye && go build -o ~/bin/goldeneye ./cmd/goldeneye + +test-goldeneye: + cd ./internal/goldeneye && go test ./... sqlc-gen-json: go build -o ~/bin/sqlc-gen-json ./cmd/sqlc-gen-json +test-json-process-plugin: + go build -o ~/bin/test-json-process-plugin ./scripts/test-json-process-plugin/ + start: - docker-compose up -d + docker compose up -d fmt: go fmt ./... diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000000..780aa2d516 --- /dev/null +++ b/NOTICE @@ -0,0 +1,48 @@ +This distribution of sqlc includes software licensed under the Apache +License, Version 2.0, from projects that ship a NOTICE file. As required +by section 4(d) of that license, their attribution notices are reproduced +below. + +================================================================================ +github.com/tetratelabs/wazero +================================================================================ + +wazero +Copyright 2020-2023 wazero authors + +================================================================================ +google.golang.org/grpc +================================================================================ + +Copyright 2014 gRPC authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +================================================================================ +gopkg.in/yaml.v3 +go.yaml.in/yaml/v3 +================================================================================ + +Copyright 2011-2016 Canonical Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md index 8eb75da8db..ba06efa55c 100644 --- a/README.md +++ b/README.md @@ -20,23 +20,40 @@ Check out [an interactive example](https://play.sqlc.dev/) to see it in action, - [Downloads](https://downloads.sqlc.dev/) - [Community](https://discord.gg/EcXzGe5SEs) -## Sponsors - -sqlc development is funded by our [generous -sponsors](https://github.com/sponsors/kyleconroy), including the following -companies: +## Supported languages -- [Context](https://context.app) -- [ngrok](https://ngrok.com) -- [RStudio](https://www.rstudio.com/) -- [時雨堂](https://shiguredo.jp/) +- [sqlc-gen-go](https://github.com/sqlc-dev/sqlc-gen-go) +- [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) +- [sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) +- [sqlc-gen-typescript](https://github.com/sqlc-dev/sqlc-gen-typescript) -If you use sqlc at your company, please consider [becoming a -sponsor](https://github.com/sponsors/kyleconroy) today. +Additional languages can be added via [plugins](https://docs.sqlc.dev/en/latest/reference/language-support.html#community-language-support). -Sponsors receive priority support via the sqlc Slack organization. - -## Acknowledgements +## Sponsors -sqlc was inspired by [PugSQL](https://pugsql.org/) and -[HugSQL](https://www.hugsql.org/). +Development is possible thanks to our sponsors. If you would like to support sqlc, +please consider [sponsoring on GitHub](https://github.com/sponsors/kyleconroy). + +

+ Coder.com + Mint.fun + Mux.com +

+ +

+ Cyberax - + NaNuNaNu - + Stumble - + WestfalNamur - + alecthomas - + cameronnewman - + danielbprice - + davherrmann - + dvob - + gilcrest - + gzuidhof - + jeffreylo - + mmcloughlin - + ryohei1216 - + sgielen +

diff --git a/buf.gen.yaml b/buf.gen.yaml index 63146b4ee3..3acdb97914 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,10 +1,12 @@ version: v1 managed: enabled: true + go_package_prefix: + default: "github.com/sqlc-dev/sqlc/internal" plugins: - plugin: buf.build/protocolbuffers/go:v1.30.0 out: internal opt: paths=source_relative - - plugin: buf.build/community/planetscale-vtprotobuf:v0.4.0 + - plugin: buf.build/grpc/go:v1.3.0 out: internal opt: paths=source_relative diff --git a/buf.yaml b/buf.yaml deleted file mode 100644 index d622cfa1b9..0000000000 --- a/buf.yaml +++ /dev/null @@ -1,8 +0,0 @@ -version: v1 -name: buf.build/sqlc/sqlc -breaking: - use: - - FILE -lint: - use: - - DEFAULT diff --git a/cmd/sqlc-gen-json/main.go b/cmd/sqlc-gen-json/main.go index 421a14e06d..05c804d082 100644 --- a/cmd/sqlc-gen-json/main.go +++ b/cmd/sqlc-gen-json/main.go @@ -9,6 +9,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/codegen/json" "github.com/sqlc-dev/sqlc/internal/plugin" + "google.golang.org/protobuf/proto" ) func main() { @@ -19,19 +20,19 @@ func main() { } func run() error { - var req plugin.CodeGenRequest + var req plugin.GenerateRequest reqBlob, err := io.ReadAll(os.Stdin) if err != nil { return err } - if err := req.UnmarshalVT(reqBlob); err != nil { + if err := proto.Unmarshal(reqBlob, &req); err != nil { return err } resp, err := json.Generate(context.Background(), &req) if err != nil { return err } - respBlob, err := resp.MarshalVT() + respBlob, err := proto.Marshal(resp) if err != nil { return err } diff --git a/cmd/sqlc-test-setup/clickhouse.go b/cmd/sqlc-test-setup/clickhouse.go new file mode 100644 index 0000000000..8fc86b0ccc --- /dev/null +++ b/cmd/sqlc-test-setup/clickhouse.go @@ -0,0 +1,295 @@ +package main + +import ( + "archive/tar" + "compress/gzip" + "crypto/sha512" + "encoding/hex" + "errors" + "fmt" + "io" + "log" + "net" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "time" +) + +const ( + // clickhouseVersion is the ClickHouse release to install. It is the + // release internal/goldeneye generates the dialect from, and the binary + // is cached where goldeneye caches it, so the two share one download. + clickhouseVersion = "25.8.2.29" + + // clickhousePassword is the password the default user is given: the + // one docker-compose.yml and CI use. + clickhousePassword = "mysecretpassword" + + clickhouseTCPPort = "9000" + clickhouseHTTPPort = "8123" +) + +// clickhouseAsset is one downloadable build of ClickHouse: a +// clickhouse-common-static tarball holding the binary at usr/bin/clickhouse, +// with the SHA-512 ClickHouse publishes next to it. +type clickhouseAsset struct { + URL string + SHA512 string +} + +var clickhouseAssets = map[string]clickhouseAsset{ + "linux/amd64": { + URL: "https://github.com/ClickHouse/ClickHouse/releases/download/v" + clickhouseVersion + "-lts/clickhouse-common-static-" + clickhouseVersion + "-amd64.tgz", + SHA512: "6ff0aa1ffac6e564970174422ecde0d645cdb96812247a6e544d39cad6d78a514265f90a2bc7b4bad49903cea96eddd16a415a45b2aeaf9164461be76331bdee", + }, + "linux/arm64": { + URL: "https://github.com/ClickHouse/ClickHouse/releases/download/v" + clickhouseVersion + "-lts/clickhouse-common-static-" + clickhouseVersion + "-arm64.tgz", + SHA512: "68204ca4d4e472790f808ee376251fae82e58066a31f35a40d15d442ce5988d697f18a1208d28b8bb8e2dfad4b20b7fcb5107e2178472abcd97251b8de7f058e", + }, +} + +// clickhouseDir is where the release is cached, and the server's +// configuration and data are kept under it. +func clickhouseDir() (string, error) { + cache, err := os.UserCacheDir() + if err != nil { + return "", err + } + return filepath.Join(cache, "sqlc-clickhouse", clickhouseVersion), nil +} + +func clickhouseBinary(dir string) string { + return filepath.Join(dir, "clickhouse") +} + +// installClickHouse downloads the ClickHouse release for this platform and +// unpacks its binary into the cache, checking the download against the +// pinned SHA-512. It is a no-op when the binary is already there, and +// skips platforms the release is not published for. +func installClickHouse() error { + log.Printf("--- Installing ClickHouse %s ---", clickhouseVersion) + + platform := runtime.GOOS + "/" + runtime.GOARCH + asset, ok := clickhouseAssets[platform] + if !ok { + log.Printf("clickhouse is not published for %s, skipping", platform) + return nil + } + + dir, err := clickhouseDir() + if err != nil { + return err + } + binary := clickhouseBinary(dir) + if _, err := os.Stat(binary); err == nil { + log.Printf("clickhouse %s is already installed at %s", clickhouseVersion, binary) + return nil + } + if err := os.MkdirAll(dir, 0o755); err != nil { + return err + } + + archive := filepath.Join(dir, "clickhouse.tgz") + log.Printf("downloading %s", asset.URL) + if err := downloadFile(archive, asset.URL); err != nil { + return fmt.Errorf("downloading clickhouse: %w", err) + } + defer os.Remove(archive) + + sum, err := sha512File(archive) + if err != nil { + return err + } + if sum != asset.SHA512 { + return fmt.Errorf("clickhouse download has SHA-512 %s, want %s", sum, asset.SHA512) + } + + log.Printf("unpacking the binary into %s", binary) + if err := extractClickHouse(archive, binary); err != nil { + return fmt.Errorf("unpacking clickhouse: %w", err) + } + return nil +} + +// extractClickHouse copies usr/bin/clickhouse out of the release tarball. +func extractClickHouse(archive, binary string) error { + f, err := os.Open(archive) + if err != nil { + return err + } + defer f.Close() + gz, err := gzip.NewReader(f) + if err != nil { + return err + } + tr := tar.NewReader(gz) + for { + hdr, err := tr.Next() + if errors.Is(err, io.EOF) { + return errors.New("tarball does not contain usr/bin/clickhouse") + } + if err != nil { + return err + } + if hdr.Typeflag != tar.TypeReg || !strings.HasSuffix(hdr.Name, "/usr/bin/clickhouse") { + continue + } + tmp, err := os.CreateTemp(filepath.Dir(binary), "clickhouse-*.partial") + if err != nil { + return err + } + if _, err := io.Copy(tmp, tr); err != nil { + tmp.Close() + os.Remove(tmp.Name()) + return err + } + if err := tmp.Close(); err != nil { + os.Remove(tmp.Name()) + return err + } + if err := os.Chmod(tmp.Name(), 0o755); err != nil { + os.Remove(tmp.Name()) + return err + } + return os.Rename(tmp.Name(), binary) + } +} + +// sha512File computes the SHA-512 hash of a file and returns the hex string. +func sha512File(path string) (string, error) { + f, err := os.Open(path) + if err != nil { + return "", err + } + defer f.Close() + h := sha512.New() + if _, err := io.Copy(h, f); err != nil { + return "", err + } + return hex.EncodeToString(h.Sum(nil)), nil +} + +// clickhouseConfig is the server's configuration: it listens on localhost +// only, keeps its data next to the configuration, and takes its users from +// users.xml beside it. +const clickhouseConfig = ` + + warning + 1 + + ./data/ + ` + clickhouseTCPPort + ` + ` + clickhouseHTTPPort + ` + 127.0.0.1 + users.xml + + + users.xml + + + +` + +// clickhouseUsers gives the default user a password. Without one the +// server restricts the user to localhost, which is fine here, but the +// tests, docker-compose.yml and CI all connect with the same password. +const clickhouseUsers = ` + + + + + + + + + ` + clickhousePassword + ` + + ::/0 + + default + default + + + +` + +// startClickHouse starts a ClickHouse server in the background, serving +// on localhost, and waits until it answers a query. It is a no-op when a +// server already does, and skips platforms the release is not installed +// on. +func startClickHouse() error { + log.Println("--- Starting ClickHouse ---") + + dir, err := clickhouseDir() + if err != nil { + return err + } + binary := clickhouseBinary(dir) + if _, err := os.Stat(binary); err != nil { + if _, ok := clickhouseAssets[runtime.GOOS+"/"+runtime.GOARCH]; !ok { + log.Printf("clickhouse is not published for %s/%s, skipping", runtime.GOOS, runtime.GOARCH) + return nil + } + return fmt.Errorf("clickhouse is not installed: run `sqlc-test-setup install clickhouse` first") + } + + if clickhouseReady(binary) { + log.Println("clickhouse is already running and accepting connections") + return nil + } + + server := filepath.Join(dir, "server") + if err := os.MkdirAll(filepath.Join(server, "data"), 0o755); err != nil { + return err + } + if err := os.WriteFile(filepath.Join(server, "config.xml"), []byte(clickhouseConfig), 0o644); err != nil { + return err + } + if err := os.WriteFile(filepath.Join(server, "users.xml"), []byte(clickhouseUsers), 0o644); err != nil { + return err + } + logFile, err := os.Create(filepath.Join(server, "server.log")) + if err != nil { + return err + } + defer logFile.Close() + + cmd := exec.Command(binary, "server", "--config-file="+filepath.Join(server, "config.xml")) + cmd.Dir = server + cmd.Stdout = logFile + cmd.Stderr = logFile + cmd.SysProcAttr = detachedProcess() + log.Printf("starting %s server in %s", binary, server) + if err := cmd.Start(); err != nil { + return fmt.Errorf("starting clickhouse: %w", err) + } + if err := cmd.Process.Release(); err != nil { + return err + } + + log.Println("waiting for clickhouse to accept connections") + deadline := time.Now().Add(2 * time.Minute) + for time.Now().Before(deadline) { + if clickhouseReady(binary) { + log.Println("clickhouse is accepting connections") + return nil + } + time.Sleep(time.Second) + } + return fmt.Errorf("clickhouse did not start in time (see %s)", logFile.Name()) +} + +// clickhouseReady reports whether a server answers on the TCP port with +// the expected password. +func clickhouseReady(binary string) bool { + conn, err := net.DialTimeout("tcp", "127.0.0.1:"+clickhouseTCPPort, time.Second) + if err != nil { + return false + } + conn.Close() + return exec.Command(binary, "client", "--host", "127.0.0.1", "--port", clickhouseTCPPort, + "--password", clickhousePassword, "-q", "SELECT 1").Run() == nil +} diff --git a/cmd/sqlc-test-setup/detach_other.go b/cmd/sqlc-test-setup/detach_other.go new file mode 100644 index 0000000000..f2cf139d88 --- /dev/null +++ b/cmd/sqlc-test-setup/detach_other.go @@ -0,0 +1,9 @@ +//go:build !unix + +package main + +import "syscall" + +func detachedProcess() *syscall.SysProcAttr { + return nil +} diff --git a/cmd/sqlc-test-setup/detach_unix.go b/cmd/sqlc-test-setup/detach_unix.go new file mode 100644 index 0000000000..3fd7943f19 --- /dev/null +++ b/cmd/sqlc-test-setup/detach_unix.go @@ -0,0 +1,11 @@ +//go:build unix + +package main + +import "syscall" + +// detachedProcess puts a child in a session of its own, so it outlives +// this process and is not stopped by the signals this process gets. +func detachedProcess() *syscall.SysProcAttr { + return &syscall.SysProcAttr{Setsid: true} +} diff --git a/cmd/sqlc-test-setup/ipv6_linux.go b/cmd/sqlc-test-setup/ipv6_linux.go new file mode 100644 index 0000000000..1877a123e5 --- /dev/null +++ b/cmd/sqlc-test-setup/ipv6_linux.go @@ -0,0 +1,21 @@ +//go:build linux + +package main + +import ( + "errors" + "syscall" +) + +// kernelLacksIPv6 reports whether the kernel was built without IPv6, so +// that opening an AF_INET6 socket fails with EAFNOSUPPORT. Some sandboxes +// run such kernels, Claude Code's remote environments among them. Any other +// outcome, including another error, leaves Spanner Omni to run as it is. +func kernelLacksIPv6() bool { + fd, err := syscall.Socket(syscall.AF_INET6, syscall.SOCK_STREAM, 0) + if err == nil { + syscall.Close(fd) + return false + } + return errors.Is(err, syscall.EAFNOSUPPORT) +} diff --git a/cmd/sqlc-test-setup/ipv6_other.go b/cmd/sqlc-test-setup/ipv6_other.go new file mode 100644 index 0000000000..4c6cf5f570 --- /dev/null +++ b/cmd/sqlc-test-setup/ipv6_other.go @@ -0,0 +1,8 @@ +//go:build !linux + +package main + +// kernelLacksIPv6 is false off Linux, where Spanner Omni is not published. +func kernelLacksIPv6() bool { + return false +} diff --git a/cmd/sqlc-test-setup/main.go b/cmd/sqlc-test-setup/main.go new file mode 100644 index 0000000000..30c0280ac2 --- /dev/null +++ b/cmd/sqlc-test-setup/main.go @@ -0,0 +1,1135 @@ +package main + +import ( + "archive/tar" + "compress/gzip" + "context" + "crypto/sha256" + "encoding/hex" + "fmt" + "io" + "log" + "net/http" + "os" + "os/exec" + "path/filepath" + "runtime" + "strconv" + "strings" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/protobuf/encoding/protowire" +) + +const ( + // pgVersion is the PostgreSQL version to install. + pgVersion = "18.2.0" + + // omniVersion is the Spanner Omni release to install, from its + // standalone server binaries. + omniVersion = "2026.r2.1-beta" + + // omniPort is the gRPC port a Spanner Omni single server listens on. + omniPort = "15000" + + // omniInstance is the instance a Spanner Omni single server provides. + omniInstance = "projects/default/instances/default" +) + +// omniBinary contains the download information for a Spanner Omni server +// release, published at https://storage.googleapis.com/spanner-omni/ and +// documented at https://docs.cloud.google.com/spanner-omni/download. +type omniBinary struct { + URL string + SHA256 string +} + +// omniBinaries maps "/" to the server download. Only linux +// x86_64 is published; the other platforms skip Spanner Omni. +var omniBinaries = map[string]omniBinary{ + "linux/amd64": { + URL: "https://storage.googleapis.com/spanner-omni/" + omniVersion + "/spanner-omni-server-" + omniVersion + "-linux-x86_64.tar.gz", + SHA256: "792ffc772d5fff8ade56a8f336993d671d22794fe9f7e88e38a6609c65e16d90", + }, +} + +// pgBinary contains the download information for a PostgreSQL binary release. +type pgBinary struct { + URL string + SHA256 string +} + +// pgBinaries maps "/" to the corresponding binary download info. +var pgBinaries = map[string]pgBinary{ + "linux/amd64": { + URL: "https://github.com/theseus-rs/postgresql-binaries/releases/download/" + pgVersion + "/postgresql-" + pgVersion + "-x86_64-unknown-linux-gnu.tar.gz", + SHA256: "cc2674e1641aa2a62b478971a22c131a768eb783f313e6a3385888f58a604074", + }, + "linux/arm64": { + URL: "https://github.com/theseus-rs/postgresql-binaries/releases/download/" + pgVersion + "/postgresql-" + pgVersion + "-aarch64-unknown-linux-gnu.tar.gz", + SHA256: "8b415a11c7a5484e5fbf7a57fca71554d2d1d7acd34faf066606d2fee1261854", + }, +} + +func main() { + log.SetFlags(log.Ltime) + log.SetPrefix("[sqlc-test-setup] ") + + if len(os.Args) < 2 { + fmt.Fprintln(os.Stderr, usage) + os.Exit(1) + } + + services, err := selectServices(os.Args[2:]) + if err != nil { + fmt.Fprintf(os.Stderr, "%s\n%s\n", err, usage) + os.Exit(1) + } + + switch os.Args[1] { + case "install": + if err := runInstall(services); err != nil { + log.Fatalf("install failed: %s", err) + } + case "start": + if err := runStart(services); err != nil { + log.Fatalf("start failed: %s", err) + } + default: + fmt.Fprintf(os.Stderr, "unknown command: %s\n%s\n", os.Args[1], usage) + os.Exit(1) + } +} + +const usage = "usage: sqlc-test-setup [postgresql|mysql|clickhouse|mssql|spanner ...]" + +// allServices is every database the tool knows, in the order they are +// installed and started. +var allServices = []string{"postgresql", "mysql", "clickhouse", "mssql", "spanner"} + +// selectServices reads the databases named on the command line, or every +// database when none is named. +func selectServices(args []string) (map[string]bool, error) { + selected := map[string]bool{} + if len(args) == 0 { + for _, name := range allServices { + selected[name] = true + } + return selected, nil + } + for _, arg := range args { + known := false + for _, name := range allServices { + if arg == name { + known = true + } + } + if !known { + return nil, fmt.Errorf("unknown database: %s", arg) + } + selected[arg] = true + } + return selected, nil +} + +// run executes a command with verbose logging, streaming output to stderr. +func run(name string, args ...string) error { + log.Printf("exec: %s %s", name, strings.Join(args, " ")) + cmd := exec.Command(name, args...) + cmd.Stdout = os.Stderr + cmd.Stderr = os.Stderr + cmd.Stdin = os.Stdin + return cmd.Run() +} + +// runOutput executes a command and returns its combined output. +func runOutput(name string, args ...string) (string, error) { + log.Printf("exec: %s %s", name, strings.Join(args, " ")) + cmd := exec.Command(name, args...) + out, err := cmd.CombinedOutput() + return string(out), err +} + +// commandExists checks if a binary is available in PATH. +func commandExists(name string) bool { + _, err := exec.LookPath(name) + return err == nil +} + +// The MySQL release the tests run against. Everything that names a MySQL +// version — the docker-compose service, the goldeneye dialect generator and +// its gen workflow — is pinned to the same release. +const ( + mysqlMajor = 26 + mysqlVersion = "26.7.0" +) + +// isMySQLVersionOK checks if the mysqld --version output indicates the +// pinned major release or a later one. +// Example version string: "/usr/sbin/mysqld Ver 8.0.44-0ubuntu0.24.04.2 ..." +func isMySQLVersionOK(versionOutput string) bool { + // Look for "Ver X.Y.Z" pattern + fields := strings.Fields(versionOutput) + for i, f := range fields { + if strings.EqualFold(f, "Ver") && i+1 < len(fields) { + ver := strings.Split(fields[i+1], ".") + if len(ver) > 0 { + major, err := strconv.Atoi(ver[0]) + if err != nil { + return false + } + return major >= mysqlMajor + } + } + } + return false +} + +// pgBaseDir returns the sqlc-specific directory where PostgreSQL is installed, +// using the user's cache directory (~/.cache/sqlc/postgresql on Linux). +func pgBaseDir() string { + cacheDir, err := os.UserCacheDir() + if err != nil { + cacheDir = filepath.Join(os.Getenv("HOME"), ".cache") + } + return filepath.Join(cacheDir, "sqlc", "postgresql") +} + +// pgBinDir returns the path to the PostgreSQL bin directory. +func pgBinDir() string { + return filepath.Join(pgBaseDir(), "bin") +} + +// pgDataDir returns the path to the PostgreSQL data directory. +func pgDataDir() string { + return filepath.Join(pgBaseDir(), "data") +} + +// pgBin returns the full path to a PostgreSQL binary. +func pgBin(name string) string { + return filepath.Join(pgBinDir(), name) +} + +// ---- install ---- + +func runInstall(services map[string]bool) error { + log.Println("=== Installing databases for test setup ===") + + if services["postgresql"] || services["mysql"] || services["mssql"] { + if err := installAptProxy(); err != nil { + return fmt.Errorf("configuring apt proxy: %w", err) + } + } + + if services["postgresql"] { + if err := installPostgreSQL(); err != nil { + return fmt.Errorf("installing postgresql: %w", err) + } + } + + if services["mysql"] { + if err := installMySQL(); err != nil { + return fmt.Errorf("installing mysql: %w", err) + } + } + + if services["clickhouse"] { + if err := installClickHouse(); err != nil { + return fmt.Errorf("installing clickhouse: %w", err) + } + } + + if services["mssql"] { + if err := installMSSQL(); err != nil { + return fmt.Errorf("installing sql server: %w", err) + } + } + + if services["spanner"] { + if err := installSpannerOmni(); err != nil { + return fmt.Errorf("installing spanner omni: %w", err) + } + } + + log.Println("=== Install complete ===") + return nil +} + +func installAptProxy() error { + proxy := os.Getenv("http_proxy") + if proxy == "" { + log.Println("http_proxy is not set, skipping apt proxy configuration") + return nil + } + + const confPath = "/etc/apt/apt.conf.d/99proxy" + if _, err := os.Stat(confPath); err == nil { + log.Printf("apt proxy config already exists at %s, skipping", confPath) + return nil + } + + log.Printf("configuring apt proxy to use %s", proxy) + proxyConf := fmt.Sprintf("Acquire::http::Proxy \"%s\";", proxy) + cmd := fmt.Sprintf("echo '%s' | sudo tee /etc/apt/apt.conf.d/99proxy", proxyConf) + return run("bash", "-c", cmd) +} + +func installPostgreSQL() error { + log.Println("--- Installing PostgreSQL ---") + + // Install runtime dependencies needed by PostgreSQL extensions (e.g. + // uuid-ossp requires libossp-uuid16). + if err := installPgDeps(); err != nil { + return fmt.Errorf("installing postgresql dependencies: %w", err) + } + + // Check if already installed in our directory + if _, err := os.Stat(pgBin("postgres")); err == nil { + out, err := runOutput(pgBin("postgres"), "--version") + if err == nil { + log.Printf("postgresql is already installed: %s", strings.TrimSpace(out)) + log.Println("skipping postgresql installation") + return nil + } + } + + platform := runtime.GOOS + "/" + runtime.GOARCH + bin, ok := pgBinaries[platform] + if !ok { + return fmt.Errorf("unsupported platform: %s (supported: %s)", platform, supportedPlatforms()) + } + + // Download to a temp file + tarball := filepath.Join(os.TempDir(), fmt.Sprintf("postgresql-%s.tar.gz", pgVersion)) + + if _, err := os.Stat(tarball); err != nil { + log.Printf("downloading PostgreSQL %s from %s", pgVersion, bin.URL) + if err := downloadFile(tarball, bin.URL); err != nil { + os.Remove(tarball) + return fmt.Errorf("downloading postgresql: %w", err) + } + } else { + log.Printf("postgresql tarball already downloaded at %s", tarball) + } + + // Verify SHA256 checksum + log.Printf("verifying SHA256 checksum") + actualHash, err := sha256File(tarball) + if err != nil { + return fmt.Errorf("computing sha256: %w", err) + } + if actualHash != bin.SHA256 { + os.Remove(tarball) + return fmt.Errorf("SHA256 mismatch: expected %s, got %s", bin.SHA256, actualHash) + } + log.Printf("SHA256 checksum verified: %s", actualHash) + + baseDir := pgBaseDir() + + // Create the base directory in the user cache + if err := os.MkdirAll(baseDir, 0o755); err != nil { + return fmt.Errorf("creating %s: %w", baseDir, err) + } + + // Extract the tarball - it contains a top-level directory like + // postgresql-18.2.0-x86_64-unknown-linux-gnu/ with bin/, lib/, share/ inside. + // We strip that top-level directory and extract directly into the base dir. + log.Printf("extracting postgresql to %s", baseDir) + if err := run("tar", "-xzf", tarball, "-C", baseDir, "--strip-components=1"); err != nil { + return fmt.Errorf("extracting postgresql: %w", err) + } + + // Verify the binary works + out, err := runOutput(pgBin("postgres"), "--version") + if err != nil { + return fmt.Errorf("postgres --version failed after install: %w", err) + } + log.Printf("postgresql installed successfully: %s", strings.TrimSpace(out)) + return nil +} + +// installPgDeps installs shared libraries required by PostgreSQL extensions at +// runtime (e.g. libossp-uuid16 for uuid-ossp). +func installPgDeps() error { + log.Println("installing postgresql runtime dependencies") + if err := run("sudo", "apt-get", "install", "-y", "--no-install-recommends", "libossp-uuid16"); err != nil { + return fmt.Errorf("apt-get install libossp-uuid16: %w", err) + } + return nil +} + +// supportedPlatforms returns a comma-separated list of supported platforms. +func supportedPlatforms() string { + platforms := make([]string, 0, len(pgBinaries)) + for p := range pgBinaries { + platforms = append(platforms, p) + } + return strings.Join(platforms, ", ") +} + +// downloadClient fetches the releases. Its timeout covers the whole +// download, so a stalled one fails rather than hanging the run. +var downloadClient = &http.Client{Timeout: 15 * time.Minute} + +// downloadFile downloads a URL to a local file path. +func downloadFile(filepath string, url string) error { + resp, err := downloadClient.Get(url) + if err != nil { + return err + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("HTTP %d: %s", resp.StatusCode, resp.Status) + } + + out, err := os.Create(filepath) + if err != nil { + return err + } + defer out.Close() + + _, err = io.Copy(out, resp.Body) + return err +} + +// sha256File computes the SHA256 hash of a file and returns the hex string. +func sha256File(path string) (string, error) { + f, err := os.Open(path) + if err != nil { + return "", err + } + defer f.Close() + + h := sha256.New() + if _, err := io.Copy(h, f); err != nil { + return "", err + } + return hex.EncodeToString(h.Sum(nil)), nil +} + +func installMySQL() error { + log.Printf("--- Installing MySQL %s ---", mysqlVersion) + + if commandExists("mysqld") { + out, err := runOutput("mysqld", "--version") + if err == nil { + version := strings.TrimSpace(out) + log.Printf("mysql is already installed: %s", version) + if isMySQLVersionOK(version) { + log.Printf("mysql version is %d+, skipping installation", mysqlMajor) + return nil + } + log.Printf("mysql version is too old, upgrading to MySQL %s", mysqlVersion) + // Stop existing MySQL before upgrading + _ = exec.Command("sudo", "service", "mysql", "stop").Run() + _ = exec.Command("sudo", "pkill", "-f", "mysqld").Run() + time.Sleep(2 * time.Second) + // Remove old MySQL packages to avoid conflicts + log.Println("removing old mysql packages") + _ = run("sudo", "apt-get", "remove", "-y", "mysql-server", "mysql-client", "mysql-common", + "mysql-server-core-*", "mysql-client-core-*") + // Clear old data directory so the new release can initialize fresh + log.Println("clearing old mysql data directory") + _ = run("sudo", "rm", "-rf", "/var/lib/mysql") + _ = run("sudo", "mkdir", "-p", "/var/lib/mysql") + _ = run("sudo", "chown", "mysql:mysql", "/var/lib/mysql") + } + } + + major, minor, _ := strings.Cut(mysqlVersion, ".") + minor, _, _ = strings.Cut(minor, ".") + bundleURL := fmt.Sprintf("https://dev.mysql.com/get/Downloads/MySQL-%s.%s/mysql-server_%s-1ubuntu24.04_amd64.deb-bundle.tar", major, minor, mysqlVersion) + bundleTar := fmt.Sprintf("/tmp/mysql-server-%s-bundle.tar", mysqlVersion) + extractDir := "/tmp/mysql-server-" + mysqlVersion + + if _, err := os.Stat(bundleTar); err != nil { + log.Printf("downloading MySQL %s bundle from %s", mysqlVersion, bundleURL) + if err := run("curl", "-L", "-o", bundleTar, bundleURL); err != nil { + return fmt.Errorf("downloading mysql bundle: %w", err) + } + } else { + log.Printf("mysql bundle already downloaded at %s, skipping download", bundleTar) + } + + log.Printf("extracting bundle to %s", extractDir) + if err := os.MkdirAll(extractDir, 0o755); err != nil { + return fmt.Errorf("creating extract dir: %w", err) + } + if err := run("tar", "-xf", bundleTar, "-C", extractDir); err != nil { + return fmt.Errorf("extracting mysql bundle: %w", err) + } + + // Install packages in dependency order using dpkg. + // Some packages may fail due to missing dependencies, which is expected. + // We fix them all at the end with apt-get install -f. + packages := []string{ + "mysql-common_*.deb", + "mysql-community-client-plugins_*.deb", + "mysql-community-client-core_*.deb", + "mysql-community-client_*.deb", + "mysql-client_*.deb", + "mysql-community-server-core_*.deb", + "mysql-community-server_*.deb", + "mysql-server_*.deb", + } + + for _, pkg := range packages { + log.Printf("installing %s (dependency errors will be fixed afterwards)", pkg) + cmd := fmt.Sprintf("sudo dpkg -i %s/%s", extractDir, pkg) + if err := run("bash", "-c", cmd); err != nil { + log.Printf("dpkg reported errors for %s (will fix with apt-get install -f)", pkg) + } + } + + log.Println("fixing missing dependencies with apt-get install -f") + if err := run("sudo", "apt-get", "install", "-f", "-y"); err != nil { + return fmt.Errorf("apt-get install -f: %w", err) + } + + log.Printf("mysql %s installed successfully", mysqlVersion) + return nil +} + +// ---- start ---- + +func runStart(services map[string]bool) error { + log.Println("=== Starting databases ===") + + if services["postgresql"] { + if err := startPostgreSQL(); err != nil { + return fmt.Errorf("starting postgresql: %w", err) + } + } + + if services["mysql"] { + if err := startMySQL(); err != nil { + return fmt.Errorf("starting mysql: %w", err) + } + } + + if services["clickhouse"] { + if err := startClickHouse(); err != nil { + return fmt.Errorf("starting clickhouse: %w", err) + } + } + + if services["mssql"] { + if err := startMSSQL(); err != nil { + return fmt.Errorf("starting sql server: %w", err) + } + } + + if services["spanner"] { + if err := startSpannerOmni(); err != nil { + return fmt.Errorf("starting spanner omni: %w", err) + } + } + + log.Println("=== Databases are running and configured ===") + if services["postgresql"] { + log.Println("PostgreSQL: postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable") + } + if services["mysql"] { + log.Println("MySQL: root:mysecretpassword@tcp(127.0.0.1:3306)/mysql") + } + if services["clickhouse"] { + log.Println("ClickHouse: clickhouse://default:" + clickhousePassword + "@127.0.0.1:" + clickhouseTCPPort) + } + if services["mssql"] { + log.Println("SQL Server: sqlserver://sa:" + mssqlSAPassword + "@127.0.0.1:" + mssqlPort + "?encrypt=disable") + } + if services["spanner"] { + log.Println("Spanner Omni: localhost:" + omniPort) + } + return nil +} + +// omniDir is where the Spanner Omni release is unpacked: the bin directory +// holds the spanner launcher and spanner_server, and data holds what a +// started server writes. +func omniDir() (string, error) { + cache, err := os.UserCacheDir() + if err != nil { + return "", err + } + return filepath.Join(cache, "sqlc-spanner-omni", omniVersion), nil +} + +// omniRelease is the directory the release is unpacked into. It is moved +// into place whole once unpacked, so it holds the whole release or is +// missing. +func omniRelease(dir string) string { + return filepath.Join(dir, "release") +} + +func omniLauncher(dir string) string { + return filepath.Join(omniRelease(dir), "google", "spanner", "bin", "spanner") +} + +// installSpannerOmni downloads the Spanner Omni server release into the +// cache and unpacks it, checking the download against the pinned SHA-256. +// It is a no-op when the release is already unpacked, and skips platforms +// the server is not published for. +func installSpannerOmni() error { + log.Printf("--- Installing Spanner Omni %s ---", omniVersion) + + platform := runtime.GOOS + "/" + runtime.GOARCH + bin, ok := omniBinaries[platform] + if !ok { + log.Printf("spanner omni is not published for %s, skipping", platform) + return nil + } + + dir, err := omniDir() + if err != nil { + return err + } + if _, err := os.Stat(omniLauncher(dir)); err == nil { + log.Printf("spanner omni %s is already installed in %s", omniVersion, dir) + return nil + } + if err := os.MkdirAll(dir, 0o755); err != nil { + return err + } + + archive := filepath.Join(dir, "server.tar.gz") + log.Printf("downloading %s", bin.URL) + if err := downloadFile(archive, bin.URL); err != nil { + return fmt.Errorf("downloading spanner omni: %w", err) + } + defer os.Remove(archive) + + sum, err := sha256File(archive) + if err != nil { + return err + } + if sum != bin.SHA256 { + return fmt.Errorf("spanner omni download has SHA-256 %s, want %s", sum, bin.SHA256) + } + + // The release is unpacked beside where it goes and moved into place + // once whole, so an interrupted unpack leaves nothing that looks + // installed. + tmp, err := os.MkdirTemp(dir, "release-") + if err != nil { + return err + } + defer os.RemoveAll(tmp) + if err := os.Chmod(tmp, 0o755); err != nil { + return err + } + log.Printf("unpacking into %s", omniRelease(dir)) + if err := extractTarGz(archive, tmp); err != nil { + return fmt.Errorf("unpacking spanner omni: %w", err) + } + if _, err := os.Stat(filepath.Join(tmp, "google", "spanner", "bin", "spanner")); err != nil { + return fmt.Errorf("spanner omni release does not hold google/spanner/bin/spanner") + } + if err := os.RemoveAll(omniRelease(dir)); err != nil { + return err + } + return os.Rename(tmp, omniRelease(dir)) +} + +// extractTarGz unpacks a gzipped tar archive into dir, refusing entries +// that would land outside it. +func extractTarGz(archive, dir string) error { + f, err := os.Open(archive) + if err != nil { + return err + } + defer f.Close() + gz, err := gzip.NewReader(f) + if err != nil { + return err + } + defer gz.Close() + + root, err := os.OpenRoot(dir) + if err != nil { + return err + } + defer root.Close() + + tr := tar.NewReader(gz) + for { + hdr, err := tr.Next() + if err == io.EOF { + return nil + } + if err != nil { + return err + } + name := filepath.Clean(hdr.Name) + if !filepath.IsLocal(name) { + return fmt.Errorf("archive entry %q is outside the release", hdr.Name) + } + mode := hdr.FileInfo().Mode().Perm() + switch hdr.Typeflag { + case tar.TypeDir: + if err := root.MkdirAll(name, 0o755); err != nil { + return err + } + case tar.TypeReg: + if err := root.MkdirAll(filepath.Dir(name), 0o755); err != nil { + return err + } + out, err := root.OpenFile(name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode) + if err != nil { + return err + } + _, err = io.Copy(out, tr) + if cerr := out.Close(); err == nil { + err = cerr + } + if err != nil { + return err + } + case tar.TypeSymlink: + target := filepath.Join(filepath.Dir(name), hdr.Linkname) + if filepath.IsAbs(hdr.Linkname) || !filepath.IsLocal(target) { + return fmt.Errorf("archive link %q points outside the release", hdr.Name) + } + if err := root.MkdirAll(filepath.Dir(name), 0o755); err != nil { + return err + } + if err := root.Symlink(hdr.Linkname, name); err != nil { + return err + } + default: + return fmt.Errorf("archive entry %q has unsupported type %q", hdr.Name, hdr.Typeflag) + } + } +} + +// startSpannerOmni starts a Spanner Omni single server in the background, +// serving plaintext gRPC on omniPort, and waits until it serves its +// default instance. It is a no-op when a server already does, and skips +// platforms the server is not installed on. +func startSpannerOmni() error { + log.Println("--- Starting Spanner Omni ---") + + if omniReady() { + log.Println("spanner omni is already running and serving its default instance") + return nil + } + + dir, err := omniDir() + if err != nil { + return err + } + launcher := omniLauncher(dir) + if _, err := os.Stat(launcher); err != nil { + if _, ok := omniBinaries[runtime.GOOS+"/"+runtime.GOARCH]; !ok { + log.Printf("spanner omni is not published for %s/%s, skipping", runtime.GOOS, runtime.GOARCH) + return nil + } + return fmt.Errorf("spanner omni is not installed: run `sqlc-test-setup install` first") + } + + data := filepath.Join(dir, "data") + if err := os.MkdirAll(data, 0o755); err != nil { + return err + } + logFile, err := os.Create(filepath.Join(dir, "server.log")) + if err != nil { + return err + } + defer logFile.Close() + + env, err := omniEnv(dir) + if err != nil { + return err + } + + // The launcher supervises the server processes for as long as it runs, + // so it is detached from this process and left running. + cmd := exec.Command(launcher, "start-single-server", "--base-dir", data) + cmd.Env = env + cmd.Stdout = logFile + cmd.Stderr = logFile + cmd.SysProcAttr = detachedProcess() + log.Printf("starting %s start-single-server --base-dir %s", launcher, data) + if err := cmd.Start(); err != nil { + return fmt.Errorf("starting spanner omni: %w", err) + } + if err := cmd.Process.Release(); err != nil { + return err + } + + log.Println("waiting for spanner omni to serve its default instance") + if err := waitForSpannerOmni(3 * time.Minute); err != nil { + return fmt.Errorf("spanner omni did not start in time (see %s): %w", logFile.Name(), err) + } + log.Println("spanner omni is serving its default instance") + return nil +} + +// omniReady reports whether a Spanner Omni server on omniPort serves its +// default instance, the one the examples create their databases in. A +// port that accepts connections is not enough: the server opens it before +// the instance exists, and something else could hold it. +func omniReady() bool { + return omniListDatabases() == nil +} + +// omniListDatabases calls the database admin service's ListDatabases on +// the default instance. The request is a single string field, so it is +// encoded by hand and the response is not decoded, which keeps the Spanner +// client libraries out of this module. +func omniListDatabases() error { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + conn, err := grpc.NewClient("127.0.0.1:"+omniPort, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + return err + } + defer conn.Close() + // ListDatabasesRequest{parent: omniInstance}: field 1, a string. + req := protowire.AppendString(protowire.AppendTag(nil, 1, protowire.BytesType), omniInstance) + var resp []byte + return conn.Invoke(ctx, "/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases", &req, &resp, grpc.ForceCodec(rawCodec{})) +} + +// rawCodec passes messages to and from gRPC as the bytes they encode to. +type rawCodec struct{} + +func (rawCodec) Marshal(v any) ([]byte, error) { + b, ok := v.(*[]byte) + if !ok { + return nil, fmt.Errorf("rawCodec: cannot marshal %T", v) + } + return *b, nil +} + +func (rawCodec) Unmarshal(data []byte, v any) error { + b, ok := v.(*[]byte) + if !ok { + return fmt.Errorf("rawCodec: cannot unmarshal into %T", v) + } + *b = append((*b)[:0], data...) + return nil +} + +func (rawCodec) Name() string { return "raw" } + +// waitForSpannerOmni polls until the server serves its default instance or +// the timeout expires. +func waitForSpannerOmni(timeout time.Duration) error { + deadline := time.Now().Add(timeout) + err := omniListDatabases() + for err != nil && time.Now().Before(deadline) { + time.Sleep(time.Second) + err = omniListDatabases() + } + if err != nil { + return fmt.Errorf("timed out after %s waiting for spanner omni: %w", timeout, err) + } + return nil +} + +func startPostgreSQL() error { + log.Println("--- Starting PostgreSQL ---") + + dataDir := pgDataDir() + logFile := filepath.Join(pgBaseDir(), "postgresql.log") + + // Check if already running + if pgIsReady() { + log.Println("postgresql is already running and accepting connections") + return nil + } + + // Initialize data directory if needed + if _, err := os.Stat(filepath.Join(dataDir, "PG_VERSION")); os.IsNotExist(err) { + log.Println("initializing postgresql data directory") + if err := os.MkdirAll(dataDir, 0o700); err != nil { + return fmt.Errorf("creating data directory: %w", err) + } + if err := run(pgBin("initdb"), + "-D", dataDir, + "--username=postgres", + "--auth=trust", + ); err != nil { + return fmt.Errorf("initdb: %w", err) + } + + // Configure pg_hba.conf for md5 password authentication on TCP + hbaPath := filepath.Join(dataDir, "pg_hba.conf") + if err := configurePgHBA(hbaPath); err != nil { + return fmt.Errorf("configuring pg_hba.conf: %w", err) + } + + // Configure postgresql.conf to listen on localhost + confPath := filepath.Join(dataDir, "postgresql.conf") + if err := appendToFile(confPath, + "\n# sqlc-test-setup configuration\n"+ + "listen_addresses = '127.0.0.1'\n"+ + "port = 5432\n", + ); err != nil { + return fmt.Errorf("configuring postgresql.conf: %w", err) + } + } else { + log.Println("postgresql data directory already initialized") + } + + // Start PostgreSQL using pg_ctl + log.Println("starting postgresql") + if err := run(pgBin("pg_ctl"), + "-D", dataDir, + "-l", logFile, + "-o", fmt.Sprintf("-k %s", dataDir), + "start", + ); err != nil { + return fmt.Errorf("pg_ctl start: %w", err) + } + + // Wait for PostgreSQL to be ready + log.Println("waiting for postgresql to accept connections") + if err := waitForPostgreSQL(30 * time.Second); err != nil { + return fmt.Errorf("postgresql did not start in time: %w", err) + } + + // Set the postgres user password + log.Println("setting password for postgres user") + if err := run(pgBin("psql"), + "-h", "127.0.0.1", + "-U", "postgres", + "-c", "ALTER USER postgres PASSWORD 'postgres';", + ); err != nil { + return fmt.Errorf("setting postgres password: %w", err) + } + + // Update pg_hba.conf to require md5 auth now that password is set + hbaPath := filepath.Join(dataDir, "pg_hba.conf") + if err := configurePgHBAWithMD5(hbaPath); err != nil { + return fmt.Errorf("updating pg_hba.conf for md5: %w", err) + } + + // Reload configuration + log.Println("reloading postgresql configuration") + if err := run(pgBin("pg_ctl"), "-D", dataDir, "reload"); err != nil { + return fmt.Errorf("pg_ctl reload: %w", err) + } + + // Verify connection with password + log.Println("verifying postgresql connection") + cmd := exec.Command(pgBin("psql"), + "-h", "127.0.0.1", + "-U", "postgres", + "-c", "SELECT 1;", + ) + cmd.Env = append(os.Environ(), "PGPASSWORD=postgres") + cmd.Stdout = os.Stderr + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + return fmt.Errorf("postgresql connection test failed: %w", err) + } + + log.Println("postgresql is running and configured") + return nil +} + +// configurePgHBA writes a pg_hba.conf that allows trust auth initially (for +// setting the password), then we switch to md5. +func configurePgHBA(hbaPath string) error { + content := `# pg_hba.conf - generated by sqlc-test-setup +# TYPE DATABASE USER ADDRESS METHOD +local all all trust +host all all 127.0.0.1/32 trust +host all all ::1/128 trust +` + return os.WriteFile(hbaPath, []byte(content), 0o600) +} + +// configurePgHBAWithMD5 rewrites pg_hba.conf to use md5 for TCP connections. +func configurePgHBAWithMD5(hbaPath string) error { + content := `# pg_hba.conf - generated by sqlc-test-setup +# TYPE DATABASE USER ADDRESS METHOD +local all all trust +host all all 127.0.0.1/32 md5 +host all all ::1/128 md5 +` + return os.WriteFile(hbaPath, []byte(content), 0o600) +} + +// appendToFile appends text to a file. +func appendToFile(path, text string) error { + f, err := os.OpenFile(path, os.O_APPEND|os.O_WRONLY, 0o644) + if err != nil { + return err + } + defer f.Close() + _, err = f.WriteString(text) + return err +} + +// pgIsReady checks if PostgreSQL is running and accepting connections. +func pgIsReady() bool { + cmd := exec.Command(pgBin("pg_isready"), "-h", "127.0.0.1", "-p", "5432") + return cmd.Run() == nil +} + +// waitForPostgreSQL polls until PostgreSQL accepts connections or times out. +func waitForPostgreSQL(timeout time.Duration) error { + deadline := time.Now().Add(timeout) + for time.Now().Before(deadline) { + if pgIsReady() { + return nil + } + time.Sleep(500 * time.Millisecond) + } + return fmt.Errorf("timed out after %s waiting for postgresql", timeout) +} + +func startMySQL() error { + log.Println("--- Starting MySQL ---") + + // Check if MySQL is already running and accessible with the expected password + if mysqlReady() { + log.Println("mysql is already running and accepting connections") + return verifyMySQL() + } + + // Stop any existing MySQL service that might be running (e.g. pre-installed + // on GitHub Actions runners) to avoid port conflicts. + log.Println("stopping any existing mysql service") + _ = exec.Command("sudo", "service", "mysql", "stop").Run() + _ = exec.Command("sudo", "mysqladmin", "shutdown").Run() + // Give MySQL time to fully shut down + time.Sleep(2 * time.Second) + + if err := ensureMySQLDirs(); err != nil { + return err + } + + // Check if data directory already exists and has been initialized + needsPasswordReset := false + if mysqlInitialized() { + log.Println("mysql data directory already initialized, skipping initialization") + // Existing data dir may have an unknown root password (e.g. pre-installed + // MySQL on GitHub Actions). We'll need to use --skip-grant-tables to reset it. + needsPasswordReset = true + } else { + log.Println("initializing mysql data directory") + if err := run("sudo", "mysqld", "--initialize-insecure", "--user=mysql"); err != nil { + return fmt.Errorf("mysqld --initialize-insecure: %w", err) + } + } + + if needsPasswordReset { + // Start with --skip-grant-tables to reset the unknown root password. + if err := startMySQLDaemon("--skip-grant-tables"); err != nil { + return err + } + + log.Println("resetting root password via --skip-grant-tables") + resetSQL := "FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'mysecretpassword';" + if err := run("mysql", "-u", "root", "-e", resetSQL); err != nil { + return fmt.Errorf("resetting mysql root password: %w", err) + } + + // Restart without --skip-grant-tables + log.Println("restarting mysql normally") + if err := run("sudo", "mysqladmin", "-u", "root", "-pmysecretpassword", "shutdown"); err != nil { + // If mysqladmin fails, try killing the process directly + _ = run("sudo", "pkill", "-f", "mysqld") + } + time.Sleep(2 * time.Second) + + if err := startMySQLDaemon(); err != nil { + return err + } + } else { + // Fresh initialization — start normally and set password + if err := startMySQLDaemon(); err != nil { + return err + } + + log.Println("setting mysql root password") + alterSQL := "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'mysecretpassword'; FLUSH PRIVILEGES;" + if err := run("mysql", "-u", "root", "-e", alterSQL); err != nil { + return fmt.Errorf("setting mysql root password: %w", err) + } + } + + return verifyMySQL() +} + +// ensureMySQLDirs creates the directories MySQL needs at runtime. +func ensureMySQLDirs() error { + if err := run("sudo", "mkdir", "-p", "/var/run/mysqld"); err != nil { + return fmt.Errorf("creating /var/run/mysqld: %w", err) + } + if err := run("sudo", "chown", "mysql:mysql", "/var/run/mysqld"); err != nil { + return fmt.Errorf("chowning /var/run/mysqld: %w", err) + } + return nil +} + +// startMySQLDaemon starts mysqld_safe in the background and waits for it to +// accept connections. Extra args (e.g. "--skip-grant-tables") are appended. +func startMySQLDaemon(extraArgs ...string) error { + args := append([]string{"mysqld_safe", "--user=mysql"}, extraArgs...) + log.Printf("starting mysql via mysqld_safe %v", extraArgs) + cmd := exec.Command("sudo", args...) + cmd.Stdout = os.Stderr + cmd.Stderr = os.Stderr + if err := cmd.Start(); err != nil { + return fmt.Errorf("starting mysqld_safe: %w", err) + } + + log.Println("waiting for mysql to accept connections") + if err := waitForMySQL(30 * time.Second); err != nil { + return fmt.Errorf("mysql did not start in time: %w", err) + } + log.Println("mysql is accepting connections") + return nil +} + +// mysqlReady checks if MySQL is running and accepting connections with the expected password. +func mysqlReady() bool { + err := exec.Command("mysqladmin", "-h", "127.0.0.1", "-u", "root", "-pmysecretpassword", "ping").Run() + return err == nil +} + +// waitForMySQL polls until MySQL accepts connections or the timeout expires. +func waitForMySQL(timeout time.Duration) error { + deadline := time.Now().Add(timeout) + for time.Now().Before(deadline) { + // Try connecting without password (fresh) or with password (already configured) + if exec.Command("mysqladmin", "-u", "root", "ping").Run() == nil { + return nil + } + if exec.Command("mysqladmin", "-h", "127.0.0.1", "-u", "root", "-pmysecretpassword", "ping").Run() == nil { + return nil + } + time.Sleep(500 * time.Millisecond) + } + return fmt.Errorf("timed out after %s waiting for mysql", timeout) +} + +func verifyMySQL() error { + log.Println("verifying mysql connection") + if err := run("mysql", "-h", "127.0.0.1", "-u", "root", "-pmysecretpassword", "-e", "SELECT VERSION();"); err != nil { + return fmt.Errorf("mysql connection test failed: %w", err) + } + log.Println("mysql is running and configured") + return nil +} + +// mysqlInitialized checks if the MySQL data directory has been initialized. +// We use sudo ls because /var/lib/mysql is typically only readable by the +// mysql user, so filepath.Glob from a non-root process would silently fail. +func mysqlInitialized() bool { + out, err := exec.Command("sudo", "ls", "/var/lib/mysql").CombinedOutput() + if err != nil { + return false + } + // If the directory has any contents, consider it initialized. + // mysqld --initialize-insecure requires an empty directory. + return strings.TrimSpace(string(out)) != "" +} diff --git a/cmd/sqlc-test-setup/mssql.go b/cmd/sqlc-test-setup/mssql.go new file mode 100644 index 0000000000..132aa5461d --- /dev/null +++ b/cmd/sqlc-test-setup/mssql.go @@ -0,0 +1,276 @@ +package main + +import ( + "fmt" + "log" + "net" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "time" +) + +const ( + // mssqlRelease is the SQL Server release installed from Microsoft's + // apt repository, the one internal/goldeneye generates the dialect + // from. + mssqlRelease = "2025" + + // mssqlSAPassword is the sa password the server is set up with: the + // one docker-compose.yml and CI use. + mssqlSAPassword = "Mysecretpassword1!" + + mssqlPort = "1433" + mssqlServer = "/opt/mssql/bin/sqlservr" + mssqlConf = "/opt/mssql/bin/mssql-conf" + mssqlLog = "/var/opt/mssql/log/errorlog" +) + +// mssqlUbuntuReleases lists the Ubuntu releases Microsoft publishes SQL +// Server packages for. +var mssqlUbuntuReleases = map[string]bool{"22.04": true, "24.04": true} + +// installMSSQL installs SQL Server from Microsoft's apt repository and +// runs its setup non-interactively, accepting the EULA on the user's +// behalf. It is a no-op when the server is already installed and set up, +// reruns only the setup when an earlier install stopped before it +// finished, and skips platforms the packages are not published for: +// Ubuntu 22.04 and 24.04 on amd64 and arm64. +func installMSSQL() error { + log.Printf("--- Installing SQL Server %s ---", mssqlRelease) + + if _, err := os.Stat(mssqlServer); err == nil { + if mssqlConfigured() { + log.Printf("sql server is already installed at %s", mssqlServer) + return nil + } + log.Printf("sql server is installed at %s but not set up", mssqlServer) + return setupMSSQL() + } + + ubuntu, err := mssqlSupported() + if err != nil { + log.Printf("skipping: %s", err) + return nil + } + + tmp, err := os.MkdirTemp("", "sqlc-mssql-") + if err != nil { + return err + } + defer os.RemoveAll(tmp) + + key := filepath.Join(tmp, "microsoft.asc") + log.Println("adding microsoft's package signing key") + if err := downloadFile(key, "https://packages.microsoft.com/keys/microsoft.asc"); err != nil { + return fmt.Errorf("downloading the signing key: %w", err) + } + if err := run("sudo", "gpg", "--dearmor", "--yes", "-o", "/usr/share/keyrings/microsoft-prod.gpg", key); err != nil { + return fmt.Errorf("installing the signing key: %w", err) + } + + list := filepath.Join(tmp, "mssql-server.list") + listURL := "https://packages.microsoft.com/config/ubuntu/" + ubuntu + "/mssql-server-" + mssqlRelease + ".list" + log.Printf("adding the apt repository from %s", listURL) + if err := downloadFile(list, listURL); err != nil { + return fmt.Errorf("downloading the repository list: %w", err) + } + if err := run("sudo", "cp", list, "/etc/apt/sources.list.d/mssql-server-"+mssqlRelease+".list"); err != nil { + return err + } + + if err := run("sudo", "apt-get", "update"); err != nil { + return fmt.Errorf("apt-get update: %w", err) + } + log.Println("installing mssql-server") + if err := run("sudo", "env", "DEBIAN_FRONTEND=noninteractive", "apt-get", "install", "-y", "mssql-server"); err != nil { + return fmt.Errorf("apt-get install mssql-server: %w", err) + } + + return setupMSSQL() +} + +// setupMSSQL runs mssql-conf setup, which accepts the EULA, sets the sa +// password and writes the server's configuration, then starts the service +// through systemd. Where there is no systemd that last step fails, and the +// configuration it wrote is what install needs, since start brings the +// server up. Anywhere else a failure is setup's own. +func setupMSSQL() error { + log.Println("running mssql-conf setup") + cmd := exec.Command("sudo", "env", "ACCEPT_EULA=Y", "MSSQL_PID=Developer", "MSSQL_SA_PASSWORD="+mssqlSAPassword, + mssqlConf, "-n", "setup", "accept-eula") + cmd.Stdout = os.Stderr + cmd.Stderr = os.Stderr + cmd.Stdin = os.Stdin + // The command line carries the sa password, so it is not logged the + // way run logs one. + log.Printf("exec: sudo env ACCEPT_EULA=Y MSSQL_PID=Developer MSSQL_SA_PASSWORD=... %s -n setup accept-eula", mssqlConf) + err := cmd.Run() + if err == nil { + return nil + } + if systemdRunning() || !mssqlConfigured() { + return fmt.Errorf("mssql-conf setup: %w", err) + } + log.Printf("mssql-conf setup wrote the configuration but could not start the service without systemd (%s); start will", err) + return nil +} + +// mssqlConfigured reports whether mssql-conf setup has written the +// server's configuration. /var/opt/mssql is readable by the mssql user +// only, so the check goes through sudo rather than a stat as this user. +func mssqlConfigured() bool { + return exec.Command("sudo", "test", "-f", "/var/opt/mssql/mssql.conf").Run() == nil +} + +// mssqlSupported reports whether Microsoft publishes SQL Server packages +// for this machine, returning its Ubuntu release, and otherwise why not. +func mssqlSupported() (string, error) { + ubuntu, err := ubuntuRelease() + if err != nil { + return "", fmt.Errorf("sql server packages are published for Ubuntu only: %w", err) + } + if runtime.GOOS != "linux" || (runtime.GOARCH != "amd64" && runtime.GOARCH != "arm64") || !mssqlUbuntuReleases[ubuntu] { + return "", fmt.Errorf("sql server packages are not published for Ubuntu %s on %s/%s", ubuntu, runtime.GOOS, runtime.GOARCH) + } + return ubuntu, nil +} + +// ubuntuRelease reads the Ubuntu release from /etc/os-release. +func ubuntuRelease() (string, error) { + data, err := os.ReadFile("/etc/os-release") + if err != nil { + return "", err + } + var id, version string + for _, line := range strings.Split(string(data), "\n") { + key, value, ok := strings.Cut(line, "=") + if !ok { + continue + } + value = strings.Trim(value, `"`) + switch key { + case "ID": + id = value + case "VERSION_ID": + version = value + } + } + if id != "ubuntu" { + return "", fmt.Errorf("this is %s, not ubuntu", id) + } + return version, nil +} + +// startMSSQL starts SQL Server and waits until it is ready for client +// connections: through systemd where it runs, otherwise by running the +// server in the background as its own user. When the server is already +// listening it only waits for it to be ready, and it skips machines the +// server is not installed on. +func startMSSQL() error { + log.Println("--- Starting SQL Server ---") + + if mssqlListening() { + // A server this machine does not run, such as the one + // docker-compose.yml starts, has no log here to wait on. + if _, err := os.Stat(mssqlServer); err != nil { + log.Println("sql server is already running and accepting connections") + return nil + } + // mssql-conf setup starts the service through systemd, so the + // server can be listening while it still recovers its databases. + log.Println("sql server is already running") + return waitForMSSQL() + } + if _, err := os.Stat(mssqlServer); err != nil { + if _, err := mssqlSupported(); err != nil { + log.Printf("sql server is not installed here, skipping: %s", err) + return nil + } + return fmt.Errorf("sql server is not installed: run `sqlc-test-setup install mssql` first") + } + + if systemdRunning() { + log.Println("starting mssql-server through systemd") + if err := run("sudo", "systemctl", "start", "mssql-server"); err != nil { + return fmt.Errorf("systemctl start mssql-server: %w", err) + } + } else { + // The server's own log is mssqlLog; what it prints goes to a file + // of its own rather than this process's output, which a detached + // process would otherwise hold open. + cache, err := os.UserCacheDir() + if err != nil { + return err + } + dir := filepath.Join(cache, "sqlc-mssql") + if err := os.MkdirAll(dir, 0o755); err != nil { + return err + } + logFile, err := os.Create(filepath.Join(dir, "sqlservr.log")) + if err != nil { + return err + } + defer logFile.Close() + + log.Printf("starting %s in the background", mssqlServer) + cmd := exec.Command("sudo", "-u", "mssql", "env", "ACCEPT_EULA=Y", "MSSQL_SA_PASSWORD="+mssqlSAPassword, mssqlServer) + cmd.Stdout = logFile + cmd.Stderr = logFile + cmd.SysProcAttr = detachedProcess() + if err := cmd.Start(); err != nil { + return fmt.Errorf("starting sqlservr: %w", err) + } + if err := cmd.Process.Release(); err != nil { + return err + } + } + + return waitForMSSQL() +} + +// waitForMSSQL polls until the server listens and its log says it is ready +// for client connections, or three minutes pass. +func waitForMSSQL() error { + log.Println("waiting for sql server to accept connections") + deadline := time.Now().Add(3 * time.Minute) + for time.Now().Before(deadline) { + if mssqlListening() && mssqlReadyForClients() { + log.Println("sql server is accepting connections") + return nil + } + time.Sleep(2 * time.Second) + } + return fmt.Errorf("sql server did not start in time (see %s)", mssqlLog) +} + +// systemdRunning reports whether systemd is the init system here, so a +// service can be started through it. +func systemdRunning() bool { + out, err := exec.Command("systemctl", "is-system-running").Output() + state := strings.TrimSpace(string(out)) + if err != nil && state == "" { + return false + } + return state != "offline" && state != "unknown" +} + +// mssqlListening reports whether something accepts connections on the SQL +// Server port. +func mssqlListening() bool { + conn, err := net.DialTimeout("tcp", "127.0.0.1:"+mssqlPort, time.Second) + if err != nil { + return false + } + conn.Close() + return true +} + +// mssqlReadyForClients reports whether the server's log says it is ready +// for client connections, which comes a moment after it starts listening. +// The log is readable by the mssql user only, so it is read through sudo. +func mssqlReadyForClients() bool { + return exec.Command("sudo", "grep", "-q", "ready for client connections", mssqlLog).Run() == nil +} diff --git a/cmd/sqlc-test-setup/omni_ipv6.go b/cmd/sqlc-test-setup/omni_ipv6.go new file mode 100644 index 0000000000..44c053654a --- /dev/null +++ b/cmd/sqlc-test-setup/omni_ipv6.go @@ -0,0 +1,56 @@ +package main + +import ( + _ "embed" + "fmt" + "log" + "os" + "path/filepath" +) + +// v6to4Source is an LD_PRELOAD library that runs a program's IPv6 sockets +// over IPv4; see the comment at the top of the file. +// +//go:embed v6to4/v6to4.c +var v6to4Source []byte + +// omniEnv is the environment Spanner Omni is started with. On a kernel with +// IPv6 it is this process's own. On one without, Omni's services abort at +// startup, as they open IPv6 sockets and have no flag to stop it ("Failed +// to create socket with ::socket ... Address family not supported by +// protocol" in their logs), so the v6to4 library is built into dir and +// preloaded into every Omni process, which inherit the environment from the +// launcher. +func omniEnv(dir string) ([]string, error) { + env := os.Environ() + if !kernelLacksIPv6() { + return env, nil + } + log.Println("the kernel has no IPv6, which spanner omni needs: preloading v6to4 to run its IPv6 sockets over IPv4") + lib, err := buildV6to4(dir) + if err != nil { + return nil, fmt.Errorf("building v6to4 for a kernel without IPv6: %w", err) + } + return append(env, "LD_PRELOAD="+lib), nil +} + +// buildV6to4 compiles the v6to4 library into dir with the system's C +// compiler and returns its path. +func buildV6to4(dir string) (string, error) { + if !commandExists("cc") { + return "", fmt.Errorf("no C compiler (cc) is installed") + } + src := filepath.Join(dir, "v6to4.c") + if err := os.WriteFile(src, v6to4Source, 0o644); err != nil { + return "", err + } + lib := filepath.Join(dir, "libv6to4.so") + // No fortified functions or stack protector, so the library needs no + // glibc symbol newer than the 2.27 Omni ships with. + err := run("cc", "-O2", "-shared", "-fPIC", "-fno-stack-protector", + "-U_FORTIFY_SOURCE", "-D_FORTIFY_SOURCE=0", "-o", lib, src) + if err != nil { + return "", err + } + return lib, nil +} diff --git a/cmd/sqlc-test-setup/v6to4/v6to4.c b/cmd/sqlc-test-setup/v6to4/v6to4.c new file mode 100644 index 0000000000..87b2163669 --- /dev/null +++ b/cmd/sqlc-test-setup/v6to4/v6to4.c @@ -0,0 +1,194 @@ +// v6to4 is an LD_PRELOAD library that lets a program which insists on IPv6 +// sockets run on a kernel built without IPv6, where socket(AF_INET6, ...) +// fails with EAFNOSUPPORT. sqlc-test-setup preloads it into Spanner Omni on +// such kernels only, since Omni's services open IPv6 sockets and abort when +// they cannot; see omni_ipv6.go. +// +// An AF_INET6 socket is created as an AF_INET one and remembered. Addresses +// passed in are rewritten from sockaddr_in6 to sockaddr_in (:: to 0.0.0.0, +// ::1 to 127.0.0.1, ::ffff:a.b.c.d to a.b.c.d), and addresses handed back +// are rewritten the other way, so the program goes on seeing IPv6. An +// address with no IPv4 equivalent fails with EADDRNOTAVAIL. +// +// Omni runs on its own glibc 2.27, so the library calls the kernel through +// syscall() rather than looking up the real functions, and must not need a +// glibc symbol newer than that: build it without _FORTIFY_SOURCE or the +// stack protector. +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#define MAXFD 65536 +static unsigned char fake[MAXFD]; + +static int isfake(int fd) { return fd >= 0 && fd < MAXFD && fake[fd]; } +static void mark(int fd, int v) { if (fd >= 0 && fd < MAXFD) fake[fd] = v; } + +// to4 rewrites a sockaddr_in6 as a sockaddr_in in out; it returns the length to +// pass on, or -1 when the address has no IPv4 equivalent. +static socklen_t to4(const struct sockaddr *a, socklen_t len, struct sockaddr_in *out) { + const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *)a; + static const unsigned char any[16] = {0}; + static const unsigned char lo[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}; + memset(out, 0, sizeof *out); + out->sin_family = AF_INET; + out->sin_port = s6->sin6_port; + const unsigned char *b = s6->sin6_addr.s6_addr; + if (memcmp(b, any, 16) == 0) out->sin_addr.s_addr = htonl(INADDR_ANY); + else if (memcmp(b, lo, 16) == 0) out->sin_addr.s_addr = htonl(INADDR_LOOPBACK); + else if (memcmp(b, any, 10) == 0 && b[10] == 0xff && b[11] == 0xff) memcpy(&out->sin_addr, b + 12, 4); + else return (socklen_t)-1; + (void)len; + return sizeof *out; +} + +// to6 rewrites the sockaddr_in the kernel wrote into a v4-mapped sockaddr_in6. +static void to6(struct sockaddr *a, socklen_t *len, socklen_t cap) { + if (!a || !len || *len < sizeof(struct sockaddr_in) || a->sa_family != AF_INET) return; + struct sockaddr_in s4; + memcpy(&s4, a, sizeof s4); + struct sockaddr_in6 s6; + memset(&s6, 0, sizeof s6); + s6.sin6_family = AF_INET6; + s6.sin6_port = s4.sin_port; + if (s4.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) s6.sin6_addr.s6_addr[15] = 1; + else if (s4.sin_addr.s_addr != htonl(INADDR_ANY)) { + s6.sin6_addr.s6_addr[10] = 0xff; + s6.sin6_addr.s6_addr[11] = 0xff; + memcpy(s6.sin6_addr.s6_addr + 12, &s4.sin_addr, 4); + } + memcpy(a, &s6, cap < sizeof s6 ? cap : sizeof s6); + *len = sizeof s6; +} + +int socket(int domain, int type, int protocol) { + int fake6 = domain == AF_INET6; + int fd = syscall(SYS_socket, fake6 ? AF_INET : domain, type, protocol); + if (fd >= 0) mark(fd, fake6); + return fd; +} + +int close(int fd) { + mark(fd, 0); + return syscall(SYS_close, fd); +} + +#define WITH4(fd, addr, len, call4, call) \ + if ((addr) && (addr)->sa_family == AF_INET6 && isfake(fd)) { \ + struct sockaddr_in s4; \ + socklen_t l4 = to4((addr), (len), &s4); \ + if (l4 == (socklen_t)-1) { errno = EADDRNOTAVAIL; return -1; } \ + return call4; \ + } \ + return call; + +int bind(int fd, const struct sockaddr *addr, socklen_t len) { + WITH4(fd, addr, len, syscall(SYS_bind, fd, &s4, l4), syscall(SYS_bind, fd, addr, len)) +} + +int connect(int fd, const struct sockaddr *addr, socklen_t len) { + WITH4(fd, addr, len, syscall(SYS_connect, fd, &s4, l4), syscall(SYS_connect, fd, addr, len)) +} + +ssize_t sendto(int fd, const void *buf, size_t n, int flags, const struct sockaddr *addr, socklen_t len) { + WITH4(fd, addr, len, syscall(SYS_sendto, fd, buf, n, flags, &s4, l4), + syscall(SYS_sendto, fd, buf, n, flags, addr, len)) +} + +ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) { + if (msg && msg->msg_name && isfake(fd) && ((struct sockaddr *)msg->msg_name)->sa_family == AF_INET6) { + struct sockaddr_in s4; + socklen_t l4 = to4(msg->msg_name, msg->msg_namelen, &s4); + if (l4 == (socklen_t)-1) { errno = EADDRNOTAVAIL; return -1; } + struct msghdr m = *msg; + m.msg_name = &s4; + m.msg_namelen = l4; + return syscall(SYS_sendmsg, fd, &m, flags); + } + return syscall(SYS_sendmsg, fd, msg, flags); +} + +#define BACK6(fd, ret, addr, lenp) \ + do { \ + if ((ret) >= 0 && isfake(fd) && (addr) && (lenp)) to6((addr), (lenp), cap); \ + } while (0) + +int getsockname(int fd, struct sockaddr *addr, socklen_t *len) { + socklen_t cap = len ? *len : 0; + struct sockaddr_in6 tmp; socklen_t tl = sizeof tmp; + if (!isfake(fd)) return syscall(SYS_getsockname, fd, addr, len); + int r = syscall(SYS_getsockname, fd, &tmp, &tl); + if (r < 0) return r; + to6((struct sockaddr *)&tmp, &tl, sizeof tmp); + memcpy(addr, &tmp, cap < tl ? cap : tl); + *len = tl; + return r; +} + +int getpeername(int fd, struct sockaddr *addr, socklen_t *len) { + socklen_t cap = len ? *len : 0; + struct sockaddr_in6 tmp; socklen_t tl = sizeof tmp; + if (!isfake(fd)) return syscall(SYS_getpeername, fd, addr, len); + int r = syscall(SYS_getpeername, fd, &tmp, &tl); + if (r < 0) return r; + to6((struct sockaddr *)&tmp, &tl, sizeof tmp); + memcpy(addr, &tmp, cap < tl ? cap : tl); + *len = tl; + return r; +} + +static int acc(int fd, struct sockaddr *addr, socklen_t *len, int flags) { + if (!isfake(fd)) return syscall(SYS_accept4, fd, addr, len, flags); + struct sockaddr_in6 tmp; socklen_t tl = sizeof tmp; + int r = syscall(SYS_accept4, fd, &tmp, &tl, flags); + if (r < 0) return r; + mark(r, 1); + if (addr && len) { + socklen_t cap = *len; + to6((struct sockaddr *)&tmp, &tl, sizeof tmp); + memcpy(addr, &tmp, cap < tl ? cap : tl); + *len = tl; + } + return r; +} +int accept(int fd, struct sockaddr *addr, socklen_t *len) { return acc(fd, addr, len, 0); } +int accept4(int fd, struct sockaddr *addr, socklen_t *len, int flags) { return acc(fd, addr, len, flags); } + +ssize_t recvfrom(int fd, void *buf, size_t n, int flags, struct sockaddr *addr, socklen_t *len) { + socklen_t cap = len ? *len : 0; + ssize_t r = syscall(SYS_recvfrom, fd, buf, n, flags, addr, len); + BACK6(fd, r, addr, len); + return r; +} + +ssize_t recvmsg(int fd, struct msghdr *msg, int flags) { + socklen_t cap = msg ? msg->msg_namelen : 0; + ssize_t r = syscall(SYS_recvmsg, fd, msg, flags); + if (r >= 0 && msg && msg->msg_name) BACK6(fd, r, (struct sockaddr *)msg->msg_name, &msg->msg_namelen); + return r; +} + +int setsockopt(int fd, int level, int name, const void *val, socklen_t len) { + if (isfake(fd) && level == IPPROTO_IPV6) { + if (name == IPV6_TCLASS) return syscall(SYS_setsockopt, fd, IPPROTO_IP, IP_TOS, val, len); + return 0; // IPV6_V6ONLY and the rest have no IPv4 meaning + } + return syscall(SYS_setsockopt, fd, level, name, val, len); +} + +int getsockopt(int fd, int level, int name, void *val, socklen_t *len) { + if (isfake(fd) && level == SOL_SOCKET && name == SO_DOMAIN && val && len && *len >= sizeof(int)) { + *(int *)val = AF_INET6; + *len = sizeof(int); + return 0; + } + if (isfake(fd) && level == IPPROTO_IPV6) { + if (val && len && *len >= sizeof(int)) { *(int *)val = 0; *len = sizeof(int); } + return 0; + } + return syscall(SYS_getsockopt, fd, level, name, val, len); +} diff --git a/devenv.lock b/devenv.lock index 6f61ce9a07..ff48a49f12 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,10 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1693830477, - "narHash": "sha256-6j1oNRpjGseDbgg6mJ9H3gmX5U+VAubOLV+iFL9WW30=", + "lastModified": 1742659231, "owner": "cachix", "repo": "devenv", - "rev": "f839f486b98609f3477c0410b31a6f831b390d48", + "rev": "c651cb04013be972767aaecb3e9a98fc930d080e", "type": "github" }, "original": { @@ -20,11 +19,10 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1733328505, "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -33,24 +31,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -59,11 +39,10 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -74,11 +53,10 @@ }, "nixpkgs": { "locked": { - "lastModified": 1693844670, - "narHash": "sha256-t69F2nBB8DNQUWHD809oJZJVE+23XBrth4QZuVd6IE0=", + "lastModified": 1742707865, "owner": "NixOS", "repo": "nixpkgs", - "rev": "3c15feef7770eb5500a4b8792623e2d6f598c9c1", + "rev": "dd613136ee91f67e5dba3f3f41ac99ae89c5406b", "type": "github" }, "original": { @@ -88,38 +66,19 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils", "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" + ] }, "locked": { - "lastModified": 1692274144, - "narHash": "sha256-BxTQuRUANQ81u8DJznQyPmRsg63t4Yc+0kcyq6OLz8s=", + "lastModified": 1742649964, "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "7e3517c03d46159fdbf8c0e5c97f82d5d4b0c8fa", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", "type": "github" }, "original": { @@ -134,21 +93,6 @@ "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/devenv.nix b/devenv.nix index 572e83e198..8a25b78d5a 100644 --- a/devenv.nix +++ b/devenv.nix @@ -4,7 +4,7 @@ # https://devenv.sh/packages/ packages = [ pkgs.buf - pkgs.go_1_21 + pkgs.go_1_24 pkgs.git pkgs.git-cliff pkgs.govulncheck diff --git a/docker-compose.yml b/docker-compose.yml index 07540c873b..787efcd8b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,29 +1,17 @@ version: "3.8" services: mysql: - image: "mysql/mysql-server:8.0" + image: "mysql:26.7" ports: - "3306:3306" restart: always environment: - MYSQL_DATABASE: mysql + MYSQL_DATABASE: dinotest MYSQL_ROOT_PASSWORD: mysecretpassword MYSQL_ROOT_HOST: '%' - mysql5: - image: "mysql/mysql-server:5.7" - ports: - - "3305:3306" - restart: always - environment: - MYSQL_DATABASE: mysql - MYSQL_ROOT_PASSWORD: mysecretpassword - MYSQL_ROOT_HOST: '%' - profiles: - - mysql - postgresql: - image: "postgres:15" + image: "postgres:16" ports: - "5432:5432" restart: always @@ -32,50 +20,29 @@ services: POSTGRES_PASSWORD: mysecretpassword POSTGRES_USER: postgres - postgresql14: - image: "postgres:14" - ports: - - "5414:5432" - restart: always - environment: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: mysecretpassword - POSTGRES_USER: postgres - profiles: - - postgres - - postgresql13: - image: "postgres:13" + clickhouse: + image: "clickhouse/clickhouse-server:25.8" ports: - - "5413:5432" + - "8123:8123" + - "9000:9000" restart: always environment: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: mysecretpassword - POSTGRES_USER: postgres - profiles: - - postgres + CLICKHOUSE_PASSWORD: mysecretpassword - postgresql12: - image: "postgres:12" + mssql: + image: "mcr.microsoft.com/mssql/server:2025-latest" ports: - - "5412:5432" + - "1433:1433" restart: always environment: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: mysecretpassword - POSTGRES_USER: postgres - profiles: - - postgres + ACCEPT_EULA: "Y" + MSSQL_SA_PASSWORD: "Mysecretpassword1!" - postgresql11: - image: "postgres:11" - ports: - - "5411:5432" + # Spanner Omni, the downloadable Spanner, serves plaintext gRPC on port + # 15000 and its console on 15026; its quickstart runs it on the host + # network. + spanner: + image: "us-docker.pkg.dev/spanner-omni/images/spanner-omni:2026.r2.1-beta" + command: start-single-server + network_mode: host restart: always - environment: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: mysecretpassword - POSTGRES_USER: postgres - profiles: - - postgres \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 541c08d37b..0000000000 --- a/docs/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -VENVDIR = _venv -BINDIR = $(VENVDIR)/bin -SPHINXBUILD = $(BINDIR)/sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: $(SPHINXBUILD) - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -$(SPHINXBUILD): $(VENVDIR) - $(VENVDIR)/bin/pip install -r requirements.txt - -$(VENVDIR): - python3 -m venv $(VENVDIR) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/_static/customize.css b/docs/_static/customize.css deleted file mode 100644 index b0882f2a05..0000000000 --- a/docs/_static/customize.css +++ /dev/null @@ -1,17 +0,0 @@ -.wy-side-nav-search img { - padding: 5px 60px !important; -} - -#banner { - text-align: center; - background: #2980b9; - border: 1px solid rgb(52, 49, 49); - color: #F0F0F4; - padding: 10px; - margin-bottom: 1.618em; -} - -#banner > div > a { - color: #F0F0F4; - text-decoration: underline; -} \ No newline at end of file diff --git a/docs/_static/favicon.png b/docs/_static/favicon.png deleted file mode 100644 index 17d8419a6c..0000000000 Binary files a/docs/_static/favicon.png and /dev/null differ diff --git a/docs/_static/logo.png b/docs/_static/logo.png deleted file mode 100644 index dd8a887094..0000000000 Binary files a/docs/_static/logo.png and /dev/null differ diff --git a/docs/_templates/breadcrumbs.html b/docs/_templates/breadcrumbs.html deleted file mode 100644 index 29a555c4b8..0000000000 --- a/docs/_templates/breadcrumbs.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "!breadcrumbs.html" %} - -{% block breadcrumbs %} -{% if show_banner %} - -{% endif %} -{{ super() }} -{% endblock %} \ No newline at end of file diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html deleted file mode 100644 index c83e9b28a4..0000000000 --- a/docs/_templates/layout.html +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "!layout.html" %} - -{% block extrahead %} - -{{ super() }} -{% endblock %} \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 6773d2d93b..0000000000 --- a/docs/conf.py +++ /dev/null @@ -1,78 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) -import sphinx_rtd_theme - -# -- Project information ----------------------------------------------------- - -project = 'sqlc' -copyright = '2023, Riza, Inc.' -author = 'Riza, Inc.' - -# The full version, including alpha/beta/rc tags -release = '1.22.0' - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'myst_parser', - 'sphinx_rtd_theme', - "sphinx_favicon", -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', '_venv', 'Thumbs.db', '.DS_Store'] - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -html_logo = "_static/logo.png" -html_theme_options = { - 'logo_only': True, -} - -html_context = { - 'show_banner': 'SHOW_LAUNCH_BANNER' in os.environ, -} - -def setup(app): - app.add_css_file('customize.css') - -favicons = [ - "favicon.png", -] - -myst_enable_extensions = [ - "attrs_inline", - "colon_fence", -] \ No newline at end of file diff --git a/docs/guides/development.md b/docs/guides/development.md index 5140f086eb..ae5ece2fa6 100644 --- a/docs/guides/development.md +++ b/docs/guides/development.md @@ -8,23 +8,29 @@ For local development, install `sqlc` under an alias. We suggest `sqlc-dev`. go build -o ~/go/bin/sqlc-dev ./cmd/sqlc ``` +Install `sqlc-gen-json` to avoid test failure. + +``` +go build -o ~/go/bin/sqlc-gen-json ./cmd/sqlc-gen-json +``` + ## Running Tests ``` go test ./... ``` -To run the tests in the examples folder, use the `examples` tag. +To run the tests in the examples folder, which is a module of its own, use the `examples` tag from inside it. ``` -go test --tags=examples ./... +cd examples && go test --tags=examples ./... ``` These tests require locally-running database instances. Run these databases using [Docker Compose](https://docs.docker.com/compose/). ``` -docker-compose up -d +docker compose up -d ``` The tests use the following environment variables to connect to the @@ -53,16 +59,3 @@ MYSQL_USER root MYSQL_ROOT_PASSWORD mysecretpassword MYSQL_DATABASE dinotest ``` - -## Regenerate expected test output - -If you need to update a large number of expected test output in the -`internal/endtoend/testdata` directory, run the `regenerate` script. - -``` -go build -o ~/go/bin/sqlc-dev ./cmd/sqlc -go run scripts/regenerate/main.go -``` - -Note that this uses the `sqlc-dev` binary, not `sqlc` so make sure you have an -up to date `sqlc-dev` binary. diff --git a/docs/guides/migrating-off-hosted-managed-databases.md b/docs/guides/migrating-off-hosted-managed-databases.md new file mode 100644 index 0000000000..7951a1cdc1 --- /dev/null +++ b/docs/guides/migrating-off-hosted-managed-databases.md @@ -0,0 +1,71 @@ +# Migrating off hosted managed databases + +Starting in sqlc 1.27.0, [managed databases](../howto/managed-databases.md) will require a database server URI in the configuration file. + +This guide walks you through migrating to a locally running database server. + +## Run a database server locally + +There are many options for running a database server locally, but this guide +will use [Docker Compose](https://docs.docker.com/compose/), as it can support +both MySQL and PostgreSQL. + +If you're using macOS and PostgreSQL, [Postgres.app](https://postgresapp.com/) is also a good option. + +For MySQL, create a `docker-compose.yml` file with the following contents: + +```yaml +version: "3.8" +services: + mysql: + image: "mysql/mysql-server:8.0" + ports: + - "3306:3306" + restart: always + environment: + MYSQL_DATABASE: dinotest + MYSQL_ROOT_PASSWORD: mysecretpassword + MYSQL_ROOT_HOST: '%' +``` + +For PostgreSQL, create a `docker-compose.yml` file with the following contents: + +```yaml +version: "3.8" +services: + postgresql: + image: "postgres:16" + ports: + - "5432:5432" + restart: always + environment: + POSTGRES_DB: postgres + POSTGRES_PASSWORD: mysecretpassword + POSTGRES_USER: postgres +``` + +```sh +docker compose up -d +``` + +## Upgrade sqlc + +You must be running sqlc v1.31.1 or greater to have access to the `servers` +configuration. + +## Add servers to configuration + +```diff +version: '2' +cloud: + project: '' ++ servers: ++ - name: mysql ++ uri: mysql://localhost:3306 ++ - name: postgres ++ uri: postgres://localhost:5432/postgres?sslmode=disable +``` + +## Re-generate the code + +Run `sqlc generate`. A database with the `sqlc_managed_` prefix will be automatically created and used for query analysis. diff --git a/docs/guides/migrating-to-sqlc-gen-kotlin.md b/docs/guides/migrating-to-sqlc-gen-kotlin.md index 2c39e1c4c4..17660aaad4 100644 --- a/docs/guides/migrating-to-sqlc-gen-kotlin.md +++ b/docs/guides/migrating-to-sqlc-gen-kotlin.md @@ -33,7 +33,7 @@ already. Add the following configuration for the plugin: ```yaml version: "2" plugins: - name: "kt" +- name: "kt" wasm: url: "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.0.0.wasm" sha256: "7620dc5d462de41fdc90e2011232c842117b416c98fd5c163d27c5738431a45c" diff --git a/docs/guides/plugins.md b/docs/guides/plugins.md index 0a97a2b776..b229f91732 100644 --- a/docs/guides/plugins.md +++ b/docs/guides/plugins.md @@ -72,6 +72,8 @@ For a complete working example see the following files: - A process-based plugin that serializes the CodeGenRequest to JSON - [process_plugin_sqlc_gen_json](https://github.com/sqlc-dev/sqlc/tree/main/internal/endtoend/testdata/process_plugin_sqlc_gen_json) - An example project showing how to use a process-based plugin +- [process_plugin_sqlc_gen_json](https://github.com/sqlc-dev/sqlc/tree/main/internal/endtoend/testdata/process_plugin_format_json/) + - An example project showing how to use a process-based plugin using json ## Environment variables @@ -99,4 +101,4 @@ plugins: ``` A variable named `SQLC_VERSION` is always included in the plugin's -environment, set to the version of the `sqlc` executable invoking it. \ No newline at end of file +environment, set to the version of the `sqlc` executable invoking it. diff --git a/docs/guides/using-go-and-pgx.md b/docs/guides/using-go-and-pgx.md new file mode 100644 index 0000000000..c5b9db7cc5 --- /dev/null +++ b/docs/guides/using-go-and-pgx.md @@ -0,0 +1,125 @@ +# Using Go and pgx + +> [!NOTE] +> `pgx/v5` is supported starting from v1.18.0. + +pgx is a pure Go driver and toolkit for PostgreSQL. It's become the default +PostgreSQL package for many Gophers since lib/pq was put into maintenance mode. + +## Getting started + +To start generating code that uses pgx, set the `sql_package` field in +your `sqlc.yaml` configuration file. Valid options are `pgx/v4` or +`pgx/v5` + +```yaml +version: "2" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "query.sql" + gen: + go: + package: "db" + sql_package: "pgx/v5" + out: "db" +``` + +If you don't have an existing sqlc project on hand, create a directory with the +configuration file above and the following `query.sql` file. + +```sql +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; +``` + +Generating the code will now give you pgx-compatible database access methods. + +```bash +sqlc generate +``` + +## Generated code walkthrough + +The generated code is very similar to the code generated when using +`lib/pq`. However, instead of using `database/sql`, the code uses +pgx types directly. + +```go +package main + +import ( + "context" + "fmt" + "os" + + "github.com/jackc/pgx/v5" + + "example.com/sqlc-tutorial/db" +) + +func main() { + // urlExample := "postgres://username:password@localhost:5432/database_name" + conn, err := pgx.Connect(context.Background(), os.Getenv("DATABASE_URL")) + if err != nil { + fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err) + os.Exit(1) + } + defer conn.Close(context.Background()) + + q := db.New(conn) + + author, err := q.GetAuthor(context.Background(), 1) + if err != nil { + fmt.Fprintf(os.Stderr, "GetAuthor failed: %v\n", err) + os.Exit(1) + } + + fmt.Println(author.Name) +} +``` + +> [!NOTE] +> For production applications, consider using pgxpool for connection pooling: +> +> ```go +> import ( +> "github.com/jackc/pgx/v5/pgxpool" +> "example.com/sqlc-tutorial/db" +> ) +> +> func main() { +> pool, err := pgxpool.New(context.Background(), os.Getenv("DATABASE_URL")) +> if err != nil { +> fmt.Fprintf(os.Stderr, "Unable to create connection pool: %v\n", err) +> os.Exit(1) +> } +> defer pool.Close() +> +> q := db.New(pool) +> // Use q the same way as with single connections +> } +> ``` diff --git a/docs/guides/using-go-and-pgx.rst b/docs/guides/using-go-and-pgx.rst deleted file mode 100644 index 636434d3af..0000000000 --- a/docs/guides/using-go-and-pgx.rst +++ /dev/null @@ -1,111 +0,0 @@ -================ -Using Go and pgx -================ - -.. note:: - :code:`pgx/v5` is supported starting from v1.18.0. - - -pgx is a pure Go driver and toolkit for PostgreSQL. It's become the default -PostgreSQL package for many Gophers since lib/pq was put into maintenance mode. - -^^^^^^^^^^^^^^^ -Getting started -^^^^^^^^^^^^^^^ - -To start generating code that uses pgx, set the :code:`sql_package` field in -your :code:`sqlc.yaml` configuration file. Valid options are :code:`pgx/v4` or -:code:`pgx/v5` - -.. code-block:: yaml - - version: "2" - sql: - - engine: "postgresql" - queries: "query.sql" - schema: "query.sql" - gen: - go: - package: "db" - sql_package: "pgx/v5" - out: "db" - -If you don't have an existing sqlc project on hand, create a directory with the -configuration file above and the following :code:`query.sql` file. - -.. code-block:: sql - - CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text - ); - - -- name: GetAuthor :one - SELECT * FROM authors - WHERE id = $1 LIMIT 1; - - -- name: ListAuthors :many - SELECT * FROM authors - ORDER BY name; - - -- name: CreateAuthor :one - INSERT INTO authors ( - name, bio - ) VALUES ( - $1, $2 - ) - RETURNING *; - - -- name: DeleteAuthor :exec - DELETE FROM authors - WHERE id = $1; - - -Generating the code will now give you pgx-compatible database access methods. - -.. code-block:: bash - - sqlc generate - -^^^^^^^^^^^^^^^^^^^^^^^^^^ -Generated code walkthrough -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The generated code is very similar to the code generated when using -:code:`lib/pq`. However, instead of using :code:`database/sql`, the code uses -pgx types directly. - -.. code-block:: go - - package main - - import ( - "context" - "fmt" - "os" - - "github.com/jackc/pgx/v5" - - "example.com/sqlc-tutorial/db" - ) - - func main() { - // urlExample := "postgres://username:password@localhost:5432/database_name" - conn, err := pgx.Connect(context.Background(), os.Getenv("DATABASE_URL")) - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err) - os.Exit(1) - } - defer conn.Close(context.Background()) - - q := db.New(conn) - - author, err := q.GetAuthor(context.Background(), 1) - if err != nil { - fmt.Fprintf(os.Stderr, "GetAuthor failed: %v\n", err) - os.Exit(1) - } - - fmt.Println(author.Name) - } diff --git a/docs/howto/analyze.md b/docs/howto/analyze.md new file mode 100644 index 0000000000..09784d2217 --- /dev/null +++ b/docs/howto/analyze.md @@ -0,0 +1,129 @@ +# `analyze` - Analyzing query result types + +> [!NOTE] +> `analyze` is in beta. Its flags and JSON output may change in a +> future release, and the types it reports can differ from the ones +> `generate` produces. + +`sqlc analyze` analyzes a query against a schema and prints the inferred result +columns and parameters as a single JSON document. + +Unlike [`generate`](generate.md), this command does not require a configuration +file and does not connect to a database. It uses sqlc's native static analysis +to infer types directly from the provided schema. + +Every dialect is analyzed by the same engine-neutral analysis core: the schema +is loaded into a catalog seeded with the dialect's types, operators and +functions, and each query is resolved against it. `generate` still uses each +engine's own analysis path, so the two can report a type differently — most +visibly, `analyze` reports type names as the catalog stores them, in lower +case. + +## Usage + +```sh +sqlc analyze --dialect --schema [query-file] +``` + +The query is read from the given file, or from standard input when no file is +provided. The schema is always read from the `--schema` file. + +## Flags + +- `--dialect`, `-d` - The SQL dialect to use. One of `postgresql`, `mysql`, + `sqlite`, `clickhouse`, `googlesql`, `mssql`, or `duckdb`. Required. +- `--schema`, `-s` - Path to the schema (DDL) file. Required. +- `--ast` - Include each statement's AST in the output. Defaults to `false`. + +## Examples + +Given a schema in `schema.sql`: + +```sql +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); +``` + +and a query in `query.sql`: + +```sql +-- name: GetAuthor :one +SELECT * FROM authors WHERE id = $1; +``` + +Running: + +```sh +sqlc analyze --dialect postgresql --schema schema.sql query.sql +``` + +reports the result columns and parameters: + +```json +[ + { + "name": "GetAuthor", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "authors" + }, + { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + } + ] + } +] +``` + +A column's `type` is written as a call expression: a `name` applied to +`args`, each of which carries an optional `label` and exactly one of `type`, +`int`, `bool`, `string` or `ident`, with `nullable` set at whatever depth it +applies. A `numeric(10,2)` column is `numeric` applied to `10` and `2`; an +array of text is `array` applied to `text`, and an array of arrays nests +one `array` per dimension; a `Map(String, Nullable(UInt8))` in ClickHouse is +`map` applied to `string` and a nullable `uint8`; a `STRUCT` in +GoogleSQL is `struct` applied to an `int64` labelled `a`; the `MAX` of SQL +Server's `nvarchar(max)` is the identifier `max`. + +Types are reported the way the engine itself stores and reports them rather +than the way the schema spelled them: PostgreSQL's `int` and `bigserial` are +`integer` and `bigint`, as `format_type` prints them; MySQL's `BOOLEAN` is +`tinyint(1)`; ClickHouse's `Decimal32(4)` is `decimal(9, 4)`; DuckDB's +`TEXT` is `varchar`; SQL Server's `FLOAT(24)` is `real`. SQLite, which +keeps a declared type as written, is reported as written. + +Pass `--ast` to also include each statement's parsed AST under an `ast` key. It +has the same shape as the output of [`parse`](parse.md), with every node tagged +by type. diff --git a/docs/howto/ci-cd.md b/docs/howto/ci-cd.md index 7368811001..8dc81c685b 100644 --- a/docs/howto/ci-cd.md +++ b/docs/howto/ci-cd.md @@ -1,12 +1,13 @@ # Using sqlc in CI/CD If your project has more than a single developer, we suggest running `sqlc` as -part of your CI/CD pipeline. The two subcommands you'll want to run are `diff` and `vet`. +part of your CI/CD pipeline. The four subcommands you'll want to run are `diff`, +`vet`, `verify` and `push` -`sqlc diff` ensures that your generated code is up to date. New developers to a project may -forget to run `sqlc generate` after adding a query or updating a schema. They also might -edit generated code. `sqlc diff` will catch both errors by comparing the expected output -from `sqlc generate` to what's on disk. +`sqlc diff` ensures that your generated code is up to date. New developers to a +project may forget to run `sqlc generate` after adding a query or updating a +schema. They also might edit generated code. `sqlc diff` will catch both errors +by comparing the expected output from `sqlc generate` to what's on disk. ```diff % sqlc diff @@ -26,11 +27,21 @@ helpful in catching anti-patterns before they make it into production. Please see the [vet](vet.md) documentation for a complete guide to adding lint rules for your project. +`sqlc verify` ensures that schema changes do not break production. Existing +queries are checked against new schema changes for correctness. Please see the +[verify](verify.md) documentation for a complete guide. + + +`sqlc push` pushes your database schema, queries and configuration to sqlc +Cloud. These archives are used by `verify` to catch breaking changes to your +database schema. Learn more about uploading projects [here](push.md) + ## General setup -Install `sqlc` using the [suggested instructions](../overview/install). +Install `sqlc` using the [suggested instructions](../overview/install.md). -Create two steps in your pipeline, one for `sqlc diff`and one for `sqlc vet`. +Create three steps in your pipeline for `sqlc diff`, `sqlc vet`, and `sqlc +verify`. Run `sqlc push` after merge on your `main` branch. ## GitHub Actions @@ -39,10 +50,6 @@ GitHub Action to install `sqlc`. The action uses the built-in [tool-cache](https://github.com/actions/toolkit/blob/main/packages/tool-cache/README.md) to speed up the installation process. -## GitHub Workflows - -We suggest running `diff`, `vet` and `upload` as part of your workflow. - ### diff The following GitHub Workflow configuration runs `sqlc diff` on every push. @@ -57,13 +64,13 @@ jobs: - uses: actions/checkout@v3 - uses: sqlc-dev/setup-sqlc@v3 with: - sqlc-version: '1.22.0' + sqlc-version: '1.31.1' - run: sqlc diff ``` ### vet -The following GitHub Workflow configuration runs [`sqlc vet`](vet.md) on every push. +The following GitHub Workflow configuration runs [sqlc vet](vet.md) on every push. You can use `sqlc vet` without a database connection, but you'll need one if your `sqlc` configuration references the built-in `sqlc/db-prepare` lint rule. @@ -73,51 +80,80 @@ on: [push] jobs: vet: runs-on: ubuntu-latest - services: - postgres: - image: "postgres:15" - env: - POSTGRES_DB: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_USER: postgres - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - env: - PG_PORT: ${{ job.services.postgres.ports['5432'] }} - steps: - uses: actions/checkout@v3 - uses: sqlc-dev/setup-sqlc@v3 with: - sqlc-version: '1.22.0' - # Connect and migrate your database here. This is an example which runs - # commands from a `schema.sql` file. - - run: psql -h localhost -U postgres -p $PG_PORT -d postgres -f schema.sql - env: - PGPASSWORD: postgres + sqlc-version: '1.31.1' + # Start a PostgreSQL server + - uses: sqlc-dev/action-setup-postgres@master + with: + postgres-version: "16" + id: postgres - run: sqlc vet + env: + POSTGRESQL_SERVER_URI: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable + ``` -### upload +### push + +> [!NOTE] +> Pushing a project is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today. -The following GitHub Workflow configuration runs [`sqlc upload`](upload.md) on -every push to `main`. +The following GitHub Workflow configuration runs [sqlc push](push.md) on +every push to `main`. Create an auth token via the +[dashboard](https://dashboard.sqlc.dev). ```yaml name: sqlc on: [push] jobs: - upload: + push: runs-on: ubuntu-latest if: ${{ github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 - uses: sqlc-dev/setup-sqlc@v3 with: - sqlc-version: '1.22.0' - - run: sqlc upload + sqlc-version: '1.31.1' + - run: sqlc push + env: + SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }} +``` + +### verify + +> [!NOTE] +> Verify database migrations is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today. + +```yaml +name: sqlc +on: [push] +jobs: + verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: sqlc-dev/setup-sqlc@v3 + with: + sqlc-version: '1.31.1' + - uses: sqlc-dev/action-setup-postgres@master + with: + postgres-version: "16" + id: postgres + - run: sqlc verify + env: + POSTGRESQL_SERVER_URI: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable + SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }} + push: + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/main' }} + steps: + - uses: sqlc-dev/setup-sqlc@v3 + with: + sqlc-version: '1.31.1' + - run: sqlc push env: SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }} -``` \ No newline at end of file +`````` diff --git a/docs/howto/ddl.md b/docs/howto/ddl.md index 4e9d36d855..2d51af7fad 100644 --- a/docs/howto/ddl.md +++ b/docs/howto/ddl.md @@ -69,75 +69,84 @@ type Post struct { } ``` -### goose +### dbmate ```sql --- +goose Up -CREATE TABLE post ( - id int NOT NULL, - title text, - body text, - PRIMARY KEY(id) -); +-- migrate:up +CREATE TABLE foo (bar INT NOT NULL); --- +goose Down -DROP TABLE post; +-- migrate:down +DROP TABLE foo; ``` ```go package db -type Post struct { - ID int - Title sql.NullString - Body sql.NullString +type Foo struct { + Bar int32 } ``` -### sql-migrate +### golang-migrate -```sql --- +migrate Up --- SQL in section 'Up' is executed when this migration is applied -CREATE TABLE people (id int); +**Warning:** +[golang-migrate interprets](https://github.com/golang-migrate/migrate/blob/master/MIGRATIONS.md#migration-filename-format) +migration filenames numerically. However, sqlc parses migration files in +lexicographic order. If you choose to have sqlc enumerate your migration files, +make sure their numeric ordering matches their lexicographic ordering to avoid +unexpected behavior. This can be done by prepending enough zeroes to the +migration filenames. +This doesn't work as intended. --- +migrate Down --- SQL section 'Down' is executed when this migration is rolled back -DROP TABLE people; +``` +1_initial.up.sql +... +9_foo.up.sql +# this migration file will be parsed BEFORE 9_foo +10_bar.up.sql ``` -```go -package db +This worked as intended. -type People struct { - ID int32 -} +``` +001_initial.up.sql +... +009_foo.up.sql +010_bar.up.sql ``` -### tern +In `20060102.up.sql`: ```sql -CREATE TABLE comment (id int NOT NULL, text text NOT NULL); ----- create above / drop below ---- -DROP TABLE comment; +CREATE TABLE post ( + id int NOT NULL, + title text, + body text, + PRIMARY KEY(id) +); +``` + +In `20060102.down.sql`: + +```sql +DROP TABLE post; ``` ```go package db -type Comment struct { - ID int32 - Text string +type Post struct { + ID int + Title sql.NullString + Body sql.NullString } ``` -### golang-migrate +### goose **Warning:** -[golang-migrate interprets](https://github.com/golang-migrate/migrate/blob/master/MIGRATIONS.md#migration-filename-format) -migration filenames numerically. However, sqlc parses migration files in -lexicographic order. If you choose to have sqlc enumerate your migration files, +sqlc parses migration files in lexicographic order. **If you are using numeric filenames for migrations in Goose and you choose to have sqlc enumerate your migration files**, make sure their numeric ordering matches their lexicographic ordering to avoid unexpected behavior. This can be done by prepending enough zeroes to the migration filenames. @@ -145,36 +154,32 @@ migration filenames. This doesn't work as intended. ``` -1_initial.up.sql +1_initial.sql ... -9_foo.up.sql +9_foo.sql # this migration file will be parsed BEFORE 9_foo -10_bar.up.sql +10_bar.sql ``` This worked as intended. ``` -001_initial.up.sql +001_initial.sql ... -009_foo.up.sql -010_bar.up.sql +009_foo.sql +010_bar.sql ``` -In `20060102.up.sql`: - ```sql +-- +goose Up CREATE TABLE post ( id int NOT NULL, title text, body text, PRIMARY KEY(id) ); -``` - -In `20060102.down.sql`: -```sql +-- +goose Down DROP TABLE post; ``` @@ -188,20 +193,40 @@ type Post struct { } ``` -### dbmate +### sql-migrate ```sql --- migrate:up -CREATE TABLE foo (bar INT NOT NULL); +-- +migrate Up +-- SQL in section 'Up' is executed when this migration is applied +CREATE TABLE people (id int); --- migrate:down -DROP TABLE foo; + +-- +migrate Down +-- SQL section 'Down' is executed when this migration is rolled back +DROP TABLE people; ``` ```go package db -type Foo struct { - Bar int32 +type People struct { + ID int32 +} +``` + +### tern + +```sql +CREATE TABLE comment (id int NOT NULL, text text NOT NULL); +---- create above / drop below ---- +DROP TABLE comment; +``` + +```go +package db + +type Comment struct { + ID int32 + Text string } ``` diff --git a/docs/howto/delete.md b/docs/howto/delete.md index 68d22a2e46..4dc0d61694 100644 --- a/docs/howto/delete.md +++ b/docs/howto/delete.md @@ -5,11 +5,22 @@ CREATE TABLE authors ( id SERIAL PRIMARY KEY, bio text NOT NULL ); +``` + +The parameter syntax varies by database engine: +**PostgreSQL:** +```sql -- name: DeleteAuthor :exec DELETE FROM authors WHERE id = $1; ``` +**MySQL and SQLite:** +```sql +-- name: DeleteAuthor :exec +DELETE FROM authors WHERE id = ?; +``` + ```go package db @@ -19,7 +30,7 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) } func New(db DBTX) *Queries { diff --git a/docs/howto/embedding.md b/docs/howto/embedding.md index 125386135b..d9e95ba392 100644 --- a/docs/howto/embedding.md +++ b/docs/howto/embedding.md @@ -1,4 +1,4 @@ -#### Embedding structs +# Embedding structs Embedding allows you to reuse existing model structs in more queries, resulting in less manual serialization work. First, imagine we have the following schema @@ -26,7 +26,7 @@ Here's how we'd usually do that: SELECT students.*, test_scores.* FROM students JOIN test_scores ON test_scores.student_id = students.id -WHERE students.id = ?; +WHERE students.id = $1; ``` When using Go, sqlc will produce a struct like this: @@ -50,7 +50,7 @@ flattened list of columns. SELECT sqlc.embed(students), sqlc.embed(test_scores) FROM students JOIN test_scores ON test_scores.student_id = students.id -WHERE students.id = ?; +WHERE students.id = $1; ``` ``` diff --git a/docs/howto/fmt.md b/docs/howto/fmt.md new file mode 100644 index 0000000000..5501d1564c --- /dev/null +++ b/docs/howto/fmt.md @@ -0,0 +1,74 @@ +# `fmt` - Formatting queries + +> [!NOTE] +> `fmt` is in beta. It rewrites your query files in place, so commit +> or back them up first. The formatting it produces may change in a +> future release. + +`sqlc fmt` rewrites the query files referenced by your configuration file in a +canonical format. Each query is parsed with the engine's parser and printed +back from the syntax tree, so formatting never depends on how the query was +written — only on what it means. PostgreSQL, MySQL and SQLite are supported; +query files for other engines are left unchanged. + +Like `gofmt`, the formatter does not impose a maximum line width. A statement +written on a single line stays on a single line, and a statement the author +broke across lines keeps its breaks: the printer notices which clause +boundaries (`FROM`, `WHERE`, `ORDER BY`, ...) and list boundaries the author +broke at and preserves them, normalizing indentation and spacing around them. + +Comments inside a statement are formatted along with it: each comment is +anchored to the code around it by source position and printed back there — +a comment trailing a select-list item stays with that item, a comment above +a clause stays above its keyword — and a comment that runs to the end of its +line breaks the statement open around it. Any statement that cannot be +proven to survive formatting unchanged is left exactly as written. + +## Usage + +```sh +sqlc fmt [--diff] +``` + +Without flags, the query files are rewritten in place. With `--diff`, the +changes are printed to standard output instead and no files are modified. + +## Examples + +Given this query file: + +```sql +-- name: GetAuthor :one +select id,name , bio +from authors +where id = ? limit 1; + +-- name: SearchAuthors :many +SELECT id, -- the primary key + name, bio, created_at FROM authors WHERE name LIKE ? AND bio IS NOT NULL AND id > ? AND created_at > ? AND name <> ? ORDER BY name; +``` + +running `sqlc fmt` rewrites it to: + +```sql +-- name: GetAuthor :one +SELECT id, name, bio +FROM authors +WHERE id = ? +LIMIT 1; + +-- name: SearchAuthors :many +SELECT + id, -- the primary key + name, + bio, + created_at +FROM authors +WHERE name LIKE ? AND bio IS NOT NULL AND id > ? AND created_at > ? AND name <> ? +ORDER BY name; +``` + +`GetAuthor` keeps the line breaks its author wrote; had it been written on +one line, it would stay on one line. In `SearchAuthors`, the line comment +cannot share a line with the code after it, so the statement breaks open +around it, while the `WHERE` chain — written on one line — stays on one. diff --git a/docs/howto/generate.md b/docs/howto/generate.md new file mode 100644 index 0000000000..288fb1a7d4 --- /dev/null +++ b/docs/howto/generate.md @@ -0,0 +1,76 @@ +# `generate` - Generating code + +`sqlc generate` parses SQL, analyzes the results, and outputs code. Your schema and queries are stored in separate SQL files. The paths to these files live in a `sqlc.yaml` configuration file. + +```yaml +version: "2" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + gen: + go: + package: "tutorial" + out: "tutorial" + sql_package: "pgx/v5" +``` + +We've written extensive docs on [retrieving](select.md), [inserting](insert.md), +[updating](update.md), and [deleting](delete.md) rows. + +By default, sqlc runs its analysis using a built-in query analysis engine. While fast, this engine can't handle some complex queries and type-inference. + +You can configure sqlc to use a database connection for enhanced analysis using metadata from that database. + +The database-backed analyzer currently supports PostgreSQL, with [MySQL](https://github.com/sqlc-dev/sqlc/issues/2902) and [SQLite](https://github.com/sqlc-dev/sqlc/issues/2903) +support planned in the future. + +## Enhanced analysis with managed databases + +With [managed databases](managed-databases.md) configured, `generate` will automatically create a hosted ephemeral database with your +schema and use that database to improve its query analysis. And sqlc will cache its analysis locally +on a per-query basis to speed up future `generate` runs. This saves you the trouble of running and maintaining a database with +an up-to-date schema. Here's a minimal working configuration: + +```yaml +version: "2" +servers: +- engine: postgresql + uri: "postgres://locahost:5432/postgres?sslmode=disable" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + database: + managed: true + gen: + go: + out: "db" + sql_package: "pgx/v5" +``` + +## Enhanced analysis using your own database + +You can opt-in to database-backed analysis using your own database, by providing a `uri` in your sqlc +[database](../reference/config.md#database) configuration. + +The `uri` string can contain references to environment variables using the `${...}` +syntax. In the following example, the connection string will have the value of +the `PG_PASSWORD` environment variable set as its password. + +```yaml +version: "2" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + database: + uri: "postgres://postgres:${PG_PASSWORD}@localhost:5432/postgres" + gen: + go: + out: "db" + sql_package: "pgx/v5" +``` + +Databases configured with a `uri` must have an up-to-date schema for query analysis to work correctly, and `sqlc` does not apply schema migrations your database. Use your migration tool of choice to create the necessary +tables and objects before running `sqlc generate`. diff --git a/docs/howto/insert.md b/docs/howto/insert.md index ae892998ec..1129a46810 100644 --- a/docs/howto/insert.md +++ b/docs/howto/insert.md @@ -5,11 +5,22 @@ CREATE TABLE authors ( id SERIAL PRIMARY KEY, bio text NOT NULL ); +``` + +The parameter syntax varies by database engine: +**PostgreSQL:** +```sql -- name: CreateAuthor :exec INSERT INTO authors (bio) VALUES ($1); ``` +**MySQL and SQLite:** +```sql +-- name: CreateAuthor :exec +INSERT INTO authors (bio) VALUES (?); +``` + ```go package db @@ -19,7 +30,7 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) } func New(db DBTX) *Queries { @@ -51,7 +62,10 @@ CREATE TABLE authors ( name text NOT NULL, bio text ); +``` +**PostgreSQL:** +```sql -- name: CreateAuthor :one INSERT INTO authors ( name, bio @@ -69,6 +83,27 @@ INSERT INTO authors ( RETURNING id; ``` +**SQLite (with RETURNING support):** +```sql +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +) +RETURNING *; + +-- name: CreateAuthorAndReturnId :one +INSERT INTO authors ( + name, bio +) VALUES ( + ?, ? +) +RETURNING id; +``` + +Note: MySQL does not support the `RETURNING` clause. Use `:execresult` instead to get the last insert ID. + ```go package db diff --git a/docs/howto/managed-databases.md b/docs/howto/managed-databases.md index 87c301738f..6b208164a2 100644 --- a/docs/howto/managed-databases.md +++ b/docs/howto/managed-databases.md @@ -1,32 +1,31 @@ # Managed databases -```{note} -Managed databases are powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today. -``` - *Added in v1.22.0* -`sqlc` can create and maintain hosted databases for your project. These -databases are immediately useful for linting queries with [`sqlc vet`](vet.md) -if your lint rules require a connection to a running database. PostgreSQL -support is available today, with MySQL on the way. +`sqlc` can automatically create read-only databases to power query analysis, +linting and verification. These databases are immediately useful for powering +sqlc's database-connected query analyzer, an opt-in feature that improves upon +sqlc's built-in query analysis engine. PostgreSQL support is available today, +with MySQL on the way. + +Once configured, `sqlc` will also use managed databases when linting queries +with [`sqlc vet`](vet.md) in cases where your lint rules require a connection +to a running database. -This feature is under active development, and we're interested in supporting -other use-cases. Beyond linting queries, you can use sqlc managed databases -in your tests to quickly stand up a database per test suite or even per test, -providing a real, isolated database for a test run. No cleanup required. +Managed databases are under active development, and we're interested in +supporting other use-cases. ## Configuring managed databases -To configure `sqlc` to use a managed database, remove the `uri` key from your +To configure `sqlc` to use managed databases, remove the `uri` key from your `database` configuration and replace it with the `managed` key set to `true`. -Set the `project` key in your `cloud` configuration to the value of your -project ID, obtained via the [dashboard](https://dashboard.sqlc.dev). +Access to a running database server is required. Add a connection string to the `servers` mapping. ```yaml version: '2' -cloud: - project: '' +servers: +- engine: postgresql + uri: "postgres://localhost:5432/postgres?sslmode=disable" sql: - schema: schema.sql queries: query.sql @@ -35,29 +34,62 @@ sql: managed: true ``` -## Authentication +An environment variable can also be used via the `${}` syntax. -`sqlc` expects to find a valid auth token in the value of the `SQLC_AUTH_TOKEN` -environment variable. You can create an auth token via the [dashboard](https://dashboard.sqlc.dev). +```yaml +version: '2' +servers: +- engine: postgresql + uri: ${DATABASE_URI} +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + database: + managed: true +``` -```shell -export SQLC_AUTH_TOKEN=sqlc_xxxxxxxx +## Improving codegen + +Without a database connection, sqlc does its best to parse, analyze and compile your queries just using +the schema you pass it and what it knows about the various database engines it supports. In many cases +this works just fine, but for more advanced queries sqlc might not have enough information to produce good code. + +With managed databases configured, `sqlc generate` will automatically create a hosted ephemeral database with your +schema and use that database to improve its query analysis. And sqlc will cache its analysis locally +on a per-query basis to speed up future codegen runs. Here's a minimal working configuration: + +```yaml +version: '2' +servers: +- engine: postgresql + uri: "postgres://localhost:5432/postgres?sslmode=disable" +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + database: + managed: true + gen: + go: + out: "db" ``` ## Linting queries -With managed databases configured, `sqlc vet` will create a database with your -package's schema and use that database when running lint rules that require a -database connection, e.g. any [rule relying on `EXPLAIN ...` output](vet.md#rules-using-explain-output). +With managed databases configured, `sqlc vet` will automatically create a hosted ephemeral database with your +schema and use that database when running lint rules that require a +database connection, e.g. any [rule relying on `EXPLAIN ...` output](vet.md#rules-using-explain--output). -If you don't yet have any vet rules, the [built-in sqlc/db-prepare rule](vet.md#sqlc-db-prepare) +If you don't yet have any vet rules, the [built-in sqlc/db-prepare rule](vet.md#sqlcdb-prepare) is a good place to start. It prepares each of your queries against the database to ensure the query is valid. Here's a minimal working configuration: ```yaml version: '2' -cloud: - project: '' +servers: +- engine: postgresql + uri: "postgres://localhost:5432/postgres?sslmode=disable" sql: - schema: schema.sql queries: query.sql diff --git a/docs/howto/named_parameters.md b/docs/howto/named_parameters.md index c4643bd8e3..b09b969429 100644 --- a/docs/howto/named_parameters.md +++ b/docs/howto/named_parameters.md @@ -1,6 +1,6 @@ # Naming parameters -sqlc tried to generate good names for positional parameters, but sometimes it +sqlc tries to generate good names for positional parameters, but sometimes it lacks enough context. The following SQL generates parameters with less than ideal names: @@ -46,6 +46,9 @@ type UpdateAuthorNameParams struct { If the `sqlc.arg()` syntax is too verbose for your taste, you can use the `@` operator as a shortcut. +> [!NOTE] +> The `@` operator as a shortcut for `sqlc.arg()` is not supported in MySQL. + ```sql -- name: UpsertAuthorName :one UPDATE author diff --git a/docs/howto/overrides.md b/docs/howto/overrides.md index baa9163c4d..b525994bbf 100644 --- a/docs/howto/overrides.md +++ b/docs/howto/overrides.md @@ -1,12 +1,21 @@ # Overriding types -The default mapping of PostgreSQL/MySQL types to Go types only uses packages outside -the standard library when it must. +> [!NOTE] +> Type overrides and field renaming are only fully-supported for Go. -For example, the `uuid` PostgreSQL type is mapped to `github.com/google/uuid`. -If a different Go package for UUIDs is required, specify the package in the -`overrides` array. In this case, I'm going to use the `github.com/gofrs/uuid` -instead. +In many cases it's useful to tell `sqlc` explicitly what Go type you want it to +use for a query input or output. For instance, by default when you use +`pgx/v5`, `sqlc` will map a PostgreSQL UUID type to `UUID` from `github.com/jackc/pgx/pgtype`. +But you may want `sqlc` to use `UUID` from `github.com/google/uuid` instead. + +To tell `sqlc` to use a different Go type, add an entry to the `overrides` list in your +configuration. + +`sqlc` offers two kinds of Go type overrides: +* `db_type` overrides, which override the Go type for a specific database type. +* `column` overrides, which override the Go type for a column or columns by name. + +Here's an example including one of each kind: ```yaml version: "2" @@ -17,34 +26,58 @@ sql: gen: go: package: "authors" - out: "postgresql" + out: "db" + sql_package: "pgx/v5" overrides: - db_type: "uuid" - go_type: "github.com/gofrs/uuid.UUID" + nullable: true + go_type: + import: "github.com/google/uuid" + type: "UUID" + - column: "users.birthday" + go_type: "time.Time" ``` -Each mapping of the `overrides` collection has the following keys: +> [!TIP] +> A single `db_type` override configuration applies to either nullable or non-nullable +> columns, but not both. If you want the same Go type to override regardless of +> nullability, you'll need to configure two overrides: one with `nullable: true` and one without. + +## The `overrides` list + +Each element in the `overrides` list has the following keys: - `db_type`: - - The PostgreSQL or MySQL type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use the pg_catalog prefixed names where available. Can't be used if the `column` key is defined. + - A database type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use pg_catalog-prefixed names where available. `db_type` and `column` are mutually exclusive. - `column`: - - In case the type overriding should be done on specific a column of a table instead of a type. `column` should be of the form `table.column` but you can be even more specific by specifying `schema.table.column` or `catalog.schema.table.column`. Can't be used if the `db_type` key is defined. + - A column name to override. The value should be of the form `table.column` but you can also specify `schema.table.column` or `catalog.schema.table.column`. `column` and `db_type` are mutually exclusive. - `go_type`: - - A fully qualified name to a Go type to use in the generated code. + - The fully-qualified name of a Go type to use in generated code. This is usually a string but can also be [a map](#the-go_type-map) for more complex configurations. - `go_struct_tag`: - - A reflect-style struct tag to use in the generated code, e.g. `a:"b" x:"y,z"`. - If you want general json/db tags for all fields, use `emit_db_tags` and/or `emit_json_tags` instead. + - A reflect-style struct tag to use in generated code, e.g. `a:"b" x:"y,z"`. + If you want `json` or `db` tags for all fields, configure `emit_json_tags` or `emit_db_tags` instead. +- `unsigned`: + - If `true`, sqlc will apply this override when a numeric column is unsigned. + Note that this only applies to `db_type` overrides and has no effect on `column` overrides. + Defaults to `false`. - `nullable`: - - If `true`, use this type when a column is nullable. Defaults to `false`. + - If `true`, sqlc will apply this override when a column is nullable. + Otherwise `sqlc` will apply this override when a column is non-nullable. + Note that this only applies to `db_type` overrides and has no effect on `column` overrides. + Defaults to `false`. + +> [!TIP] +> A single `db_type` override configuration applies to either nullable or non-nullable +> columns, but not both. If you want the same Go type to override regardless of nullability, you'll +> need to configure two overrides: one with `nullable: true` and one without. -Note that a single `db_type` override configuration applies to either nullable or non-nullable -columns, but not both. If you want a single `go_type` to override in both cases, you'll -need to specify two overrides. +> [!NOTE] +> When generating code, `column` override configurations take precedence over `db_type` configurations. -When generating code, entries using the `column` key will always have preference over -entries using the `db_type` key in order to generate the struct. +### The `go_type` map -For more complicated import paths, the `go_type` can also be an object with the following keys: +Some overrides may require more detailed configuration. If necessary, `go_type` +can be a map with the following keys: - `import`: - The import path for the package where the type is defined. @@ -53,9 +86,9 @@ For more complicated import paths, the `go_type` can also be an object with the - `type`: - The type name itself, without any package prefix. - `pointer`: - - If set to `true`, generated code will use pointers to the type rather than the type itself. + - If `true`, generated code will use a pointer to the type rather than the type itself. - `slice`: - - If set to `true`, generated code will use a slice of the type rather than the type itself. + - If `true`, generated code will use a slice of the type rather than the type itself. An example: @@ -66,9 +99,10 @@ sql: queries: "postgresql/query.sql" engine: "postgresql" gen: - go: + go: package: "authors" - out: "postgresql" + out: "db" + sql_package: "pgx/v5" overrides: - db_type: "uuid" go_type: @@ -76,4 +110,75 @@ sql: package: "b" type: "MyType" pointer: true -``` \ No newline at end of file +``` + +## Global overrides + +To override types in all packages that `sqlc` generates, add an override +configuration to the top-level `overrides` section of your `sqlc` config: + +```yaml +version: "2" +overrides: + go: + overrides: + - db_type: "pg_catalog.timestamptz" + nullable: true + engine: "postgresql" + go_type: + import: "gopkg.in/guregu/null.v4" + package: "null" + type: "Time" +sql: +- schema: "service1/schema.sql" + queries: "service1/query.sql" + engine: "postgresql" + gen: + go: + package: "service1" + out: "service1" +- schema: "service2/schema.sql" + queries: "service2/query.sql" + engine: "postgresql" + gen: + go: + package: "service2" + out: "service2" +``` + +Using this configuration, whenever there is a nullable `timestamp with time zone` +column in a Postgres table, `sqlc` will generate Go code using `null.Time`. + +Note that the mapping for global type overrides has a field called `engine` that +is absent in per-package type overrides. This field is only used when there are +multiple `sql` sections using different engines. If you're only generating code +for a single database engine you can omit it. + +#### Version 1 configuration + +If you are using the older version 1 of the `sqlc` configuration format, override +configurations themselves are unchanged but are nested differently. + +Per-package configurations are nested under the `overrides` key within an item +in the `packages` list: + +```yaml +version: "1" +packages: + - name: "db" + path: "internal/db" + queries: "./sql/query/" + schema: "./sql/schema/" + engine: "postgresql" + overrides: [...] +``` + +And global configurations are nested under the top-level `overrides` key: + +```yaml +version: "1" +packages: [...] +overrides: + - db_type: "uuid" + go_type: "github.com/gofrs/uuid.UUID" +``` diff --git a/docs/howto/parse.md b/docs/howto/parse.md new file mode 100644 index 0000000000..d46d35f394 --- /dev/null +++ b/docs/howto/parse.md @@ -0,0 +1,111 @@ +# `parse` - Parsing SQL into an AST + +> [!NOTE] +> `parse` is in beta. Its flags and the shape of the JSON AST it +> prints may change in a future release. + +`sqlc parse` parses SQL from a file or standard input and prints the abstract +syntax tree (AST) as a single JSON document. It does not require a configuration +file or a database connection. + +Each statement is reported with its sqlc query name and command (when the +statement carries a [`-- name:`](../reference/query-annotations.md) annotation) +alongside its AST. + +## Usage + +```sh +sqlc parse --dialect [file] +``` + +The SQL is read from the given file, or from standard input when no file is +provided. + +## Flags + +- `--dialect`, `-d` - The SQL dialect to use. One of `postgresql`, `mysql`, + `sqlite`, `clickhouse`, `googlesql`, `mssql`, or `duckdb`. Required. + +## Examples + +Parse a query file: + +```sh +sqlc parse --dialect postgresql query.sql +``` + +Parse SQL piped via standard input: + +```sh +echo "SELECT 1;" | sqlc parse --dialect mysql +``` + +The output is a JSON array with one object per statement: + +```json +[ + { + "name": "GetAuthor", + "cmd": ":one", + "ast": { + "tag": "RawStmt", + "stmt": { + "...": "..." + }, + "stmt_location": 0, + "stmt_len": 42 + } + } +] +``` + +Statements without a `-- name:` annotation (for example schema DDL) omit the +`name` and `cmd` fields. Field names are `snake_case` versions of the AST node +field names. + +## Node types + +Every node in the AST carries a `tag` naming its type. Some nodes have no +fields of their own, so without it a star, a null literal and an untranslated +clause would all print as `{}`. + +```json +"val": { + "tag": "ColumnRef", + "name": "", + "fields": { + "tag": "List", + "items": [ + { + "tag": "A_Star" + } + ] + }, + "location": 93 +} +``` + +A `tag` of `TODO` marks a clause the dialect's converter does not translate +yet. It means the clause was parsed but is not represented in the AST, not that +the clause was absent from the query. + +## Absent fields + +A field the statement does not use is left out rather than printed as `null`. +An `A_Const` carrying an integer reports only what it has: + +```json +"val": { + "tag": "A_Const", + "val": { + "tag": "Integer", + "ival": 1 + }, + "location": 30 +} +``` + +Only absent fields — and empty lists, which engines construct differently for +the same SQL — are omitted. A zero keeps its place, because zero is a value the +parser can find: `stmt_location` is 0 for the first statement in a file, and +`LIMIT 0` parses to an `ival` of 0. diff --git a/docs/howto/prepared_query.md b/docs/howto/prepared_query.md index c6eff3e722..83e62b5929 100644 --- a/docs/howto/prepared_query.md +++ b/docs/howto/prepared_query.md @@ -35,7 +35,7 @@ type Record struct { type DBTX interface { PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -51,7 +51,7 @@ func Prepare(ctx context.Context, db DBTX) (*Queries, error) { return &q, nil } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) diff --git a/docs/howto/push.md b/docs/howto/push.md new file mode 100644 index 0000000000..0da4e074c6 --- /dev/null +++ b/docs/howto/push.md @@ -0,0 +1,70 @@ +# `push` - Uploading projects + +> [!NOTE] +> `push` is powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today. + +*Added in v1.24.0* + +We've renamed the `upload` sub-command to `push`. We've also changed the data sent along in a push request. Upload used to include the configuration file, migrations, queries, and all generated code. Push drops the generated code in favor of including the [plugin.GenerateRequest](https://buf.build/sqlc/sqlc/docs/main:plugin#plugin.GenerateRequest), which is the protocol buffer message we pass to codegen plugins. + +## Add configuration + +After creating a project, add the project ID to your sqlc configuration file. + +```yaml +version: "2" +cloud: + project: "" +``` + +You'll also need to create an auth token and make it available via the +`SQLC_AUTH_TOKEN` environment variable. + +```shell +export SQLC_AUTH_TOKEN=sqlc_xxxxxxxx +``` + +## Dry run + +You can see what's included when uploading your project by using using the +`--dry-run` flag: + +```shell +$ sqlc push --dry-run +2023/11/21 10:39:51 INFO config file=sqlc.yaml bytes=912 +2023/11/21 10:39:51 INFO codegen_request queryset=app file=codegen_request.pb +2023/11/21 10:39:51 INFO schema queryset=app file=migrations/00001_initial.sql bytes=3033 +2023/11/21 10:39:51 INFO query queryset=app file=queries/app.sql bytes=1150 +``` + +The output is the files `sqlc` would have sent without the `--dry-run` flag. + +## Push + +Once you're ready to push, remove the `--dry-run` flag. + +```shell +$ sqlc push +``` + +### Tags + +You can provide tags to associate with a push, primarily as a convenient reference when using `sqlc verify` with the `against` argument. + +Tags only refer to a single push, so if you pass an existing tag to `push` it will overwrite the previous reference. + +```shell +$ sqlc push --tag main +``` + +### Annotations + +Annotations are added to each push request. By default, we include these environment variables (if they are present). + +``` +GITHUB_REPOSITORY +GITHUB_REF +GITHUB_REF_NAME +GITHUB_REF_TYPE +GITHUB_SHA +``` diff --git a/docs/howto/query_count.md b/docs/howto/query_count.md index 857d5f0530..687d98a9c2 100644 --- a/docs/howto/query_count.md +++ b/docs/howto/query_count.md @@ -24,8 +24,8 @@ import ( ) type DBTX interface { - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/docs/howto/rename.md b/docs/howto/rename.md index f2d03e6cba..47ee05cf7e 100644 --- a/docs/howto/rename.md +++ b/docs/howto/rename.md @@ -30,7 +30,10 @@ sql: ## Tables -The output structs associated with tables can also be renamed. By default, the struct name will be the singular version of the table name. For example, the `authors` table will generate an `Author` struct. +The output structs associated with tables can also be renamed. By default, +the struct name will be the singular version of the table name. For example, +the `authors` table will generate an `Author` struct and the `book_publishers` +table will generate a `BookPublisher` struct. ```sql CREATE TABLE authors ( @@ -38,6 +41,11 @@ CREATE TABLE authors ( name text NOT NULL, bio text ); + +CREATE TABLE book_publishers ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL +); ``` ```go @@ -52,9 +60,17 @@ type Author struct { Name string Bio sql.NullString } + +type Publisher struct { + ID int64 + Name string +} ``` -To rename this struct, you must use the generated struct name. In this example, that would be `author`. Use the `rename` map to change the name of this struct to `Writer` (note the uppercase `W`). +To rename these structs, you must use the generated struct name. In this +example, that would be `author` and `book_publisher`. Use the `rename` map to +change the name of these struct to `Writer` and `BookPublisher` (note the +camel-casing and the underscore for multi-worded tables). ```yaml version: '1' @@ -65,6 +81,20 @@ packages: queries: query.sql rename: author: Writer + book_publisher: Publisher +``` + +```yaml +version: "2" +sql: + - engine: postgresql + queries: query.sql + schema: query.sql +overrides: + go: + rename: + author: Writer + book_publisher: Publisher ``` ```go @@ -79,9 +109,14 @@ type Writer struct { Name string Bio sql.NullString } + +type Publisher struct { + ID int64 + Name string +} ``` ## Limitations Rename mappings apply to an entire package. Therefore, a column named `foo` and -a table name `foo` can't be renamed different values. \ No newline at end of file +a table name `foo` can't map to different rename values. diff --git a/docs/howto/select.md b/docs/howto/select.md index cea3900b68..998a1348f8 100644 --- a/docs/howto/select.md +++ b/docs/howto/select.md @@ -8,8 +8,12 @@ CREATE TABLE authors ( bio text NOT NULL, birth_year int NOT NULL ); +``` +The parameter syntax varies by database engine: +**PostgreSQL:** +```sql -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1; @@ -19,6 +23,17 @@ SELECT * FROM authors ORDER BY id; ``` +**MySQL and SQLite:** +```sql +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ?; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY id; +``` + A few new pieces of code are generated beyond the `Author` struct. An interface for the underlying database is generated. The `*sql.DB` and `*sql.Tx` types satisfy this interface. @@ -54,8 +69,8 @@ type Author struct { } type DBTX interface { - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -125,7 +140,7 @@ SELECT bio, birth_year FROM authors WHERE id = $1; ``` -When selecting a single column, only that value that returned. The `GetBioForAuthor` +When selecting a single column, only that value is returned. The `GetBioForAuthor` method takes a single `int` as an argument and returns a `string` and an `error`. @@ -146,7 +161,7 @@ import ( ) type DBTX interface { - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -228,8 +243,8 @@ type Author struct { } type DBTX interface { - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -319,10 +334,10 @@ type Author struct { } type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -346,7 +361,7 @@ WHERE id IN (/*SLICE:ids*/?) func (q *Queries) ListAuthorsByIDs(ctx context.Context, ids []int64) ([]Author, error) { sql := listAuthorsByIDs - var queryParams []interface{} + var queryParams []any if len(ids) == 0 { return nil, fmt.Errorf("slice ids must have at least one element") } diff --git a/docs/howto/structs.md b/docs/howto/structs.md index caec740830..c0b203df97 100644 --- a/docs/howto/structs.md +++ b/docs/howto/structs.md @@ -50,4 +50,4 @@ type Author struct { ## More control -See the Type Overrides section of the Configuration File docs for fine-grained control over struct field types and tags. +See the guide to [Overriding types](./overrides.md) for fine-grained control over struct field types and tags. diff --git a/docs/howto/transactions.md b/docs/howto/transactions.md index bc93ebd661..b80aee7558 100644 --- a/docs/howto/transactions.md +++ b/docs/howto/transactions.md @@ -32,10 +32,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -57,6 +57,7 @@ func (q *Queries) WithTx(tx *sql.Tx) *Queries { You'd use it like this: ```go +// Using `github/lib/pq` as the driver. func bumpCounter(ctx context.Context, db *sql.DB, queries *tutorial.Queries, id int32) error { tx, err := db.Begin() if err != nil { @@ -76,4 +77,25 @@ func bumpCounter(ctx context.Context, db *sql.DB, queries *tutorial.Queries, id } return tx.Commit() } + +// Using `github.com/jackc/pgx/v5` as the driver. +func bumpCounter(ctx context.Context, db *pgx.Conn, queries *tutorial.Queries, id int32) error { + tx, err := db.Begin(ctx) + if err != nil { + return err + } + defer tx.Rollback(ctx) + qtx := queries.WithTx(tx) + r, err := qtx.GetRecord(ctx, id) + if err != nil { + return err + } + if err := qtx.UpdateRecord(ctx, tutorial.UpdateRecordParams{ + ID: r.ID, + Counter: r.Counter + 1, + }); err != nil { + return err + } + return tx.Commit(ctx) +} ``` \ No newline at end of file diff --git a/docs/howto/update.md b/docs/howto/update.md index 3abb99ba23..52b4ac1150 100644 --- a/docs/howto/update.md +++ b/docs/howto/update.md @@ -12,11 +12,20 @@ CREATE TABLE authors ( If your query has a single parameter, your Go method will also have a single parameter. +The parameter syntax varies by database engine: + +**PostgreSQL:** ```sql -- name: UpdateAuthorBios :exec UPDATE authors SET bio = $1; ``` +**MySQL and SQLite:** +```sql +-- name: UpdateAuthorBios :exec +UPDATE authors SET bio = ?; +``` + ```go package db @@ -26,7 +35,7 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) } func New(db DBTX) *Queries { @@ -52,12 +61,22 @@ func (q *Queries) UpdateAuthorBios(ctx context.Context, bio string) error { If your query has more than one parameter, your Go method will accept a `Params` struct. +**PostgreSQL:** ```sql -- name: UpdateAuthor :exec UPDATE authors SET bio = $2 WHERE id = $1; ``` +**MySQL and SQLite:** +```sql +-- name: UpdateAuthor :exec +UPDATE authors SET bio = ? +WHERE id = ?; +``` + +Note: For MySQL and SQLite, parameters are bound in the order they appear in the query, regardless of the order in the function signature. + ```go package db @@ -67,7 +86,7 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) } func New(db DBTX) *Queries { diff --git a/docs/howto/upload.md b/docs/howto/upload.md deleted file mode 100644 index e432df4556..0000000000 --- a/docs/howto/upload.md +++ /dev/null @@ -1,50 +0,0 @@ -# Uploading projects - -```{note} -Project uploads are powered by [sqlc Cloud](https://dashboard.sqlc.dev). Sign up for [free](https://dashboard.sqlc.dev) today. -``` - -*Added in v1.22.0* - -Uploading an archive of your project ensures that future releases of sqlc do not -break your code. Similar to Rust's [crater](https://github.com/rust-lang/crater) -project, uploaded archives are tested against development releases of sqlc to -verify correctness. - -## Add configuration - -After creating a project, add the project ID to your sqlc configuration file. - -```yaml -version: "2" -cloud: - project: "" -``` - -You'll also need to create an auth token and make it available via the -`SQLC_AUTH_TOKEN` environment variable. - -```shell -export SQLC_AUTH_TOKEN=sqlc_xxxxxxxx -``` - -## Dry run - -You can see what's included when uploading your project by using using the -`--dry-run` flag: - -```shell -sqlc upload --dry-run -``` - -The output is the request `sqlc` would have sent without the `--dry-run` flag. - -## Upload - -Once you're ready to upload, remove the `--dry-run` flag. - -```shell -sqlc upload -``` - -By uploading your project, you're making sqlc more stable and reliable. Thanks! diff --git a/docs/howto/verify.md b/docs/howto/verify.md new file mode 100644 index 0000000000..62da44013d --- /dev/null +++ b/docs/howto/verify.md @@ -0,0 +1,105 @@ +# `verify` - Verifying schema changes + +*Added in v1.24.0* + +Schema updates and poorly-written queries often bring down production databases. That’s bad. + +Out of the box, `sqlc generate` catches some of these issues. Running `sqlc vet` with the `sqlc/db-prepare` rule catches more subtle problems. But there is a large class of issues that sqlc can’t prevent by looking at current schema and queries alone. + +For instance, when a schema change is proposed, existing queries and code running in production might fail when the schema change is applied. Enter `sqlc verify`, which analyzes existing queries against new schema changes and errors if there are any issues. + +Let's look at an example. Assume you have these two tables in production. + +```sql +CREATE TABLE users ( + id UUID PRIMARY KEY +); + +CREATE TABLE user_actions ( + id UUID PRIMARY KEY, + user_id UUID NOT NULL, + action TEXT, + created_at TIMESTAMP +); +``` + +Your application contains the following query to join user actions against the users table. + +```sql +-- name: GetUserActions :many +SELECT * FROM users u +JOIN user_actions ua ON u.id = ua.user_id +ORDER BY created_at; +``` + +So far, so good. Then assume you propose this schema change: + +```sql +ALTER TABLE users ADD COLUMN created_at TIMESTAMP; +``` + +Running `sqlc generate` fails with this change, returning a `column reference "created_at" is ambiguous` error. You update your query to fix the issue. + +```sql +-- name: GetUserActions :many +SELECT * FROM users u +JOIN user_actions ua ON u.id = ua.user_id +ORDER BY u.created_at; +``` + +While that change fixes the issue, there's a production outage waiting to happen. When the schema change is applied, the existing `GetUserActions` query will begin to fail. The correct way to fix this is to deploy the updated query before applying the schema migration. + +It ensures migrations are safe to deploy by sending your current schema and queries to sqlc cloud. There, we run the queries for your latest push against your new schema changes. This check catches backwards incompatible schema changes for existing queries. + +Here `sqlc verify` alerts you to the fact that ORDER BY "created_at" is ambiguous. + +```sh +$ sqlc verify +FAIL: app query.sql + +=== Failed +=== FAIL: app query.sql GetUserActions + ERROR: column reference "created_at" is ambiguous (SQLSTATE 42702) +``` + +By the way, this scenario isn't made up! It happened to us a few weeks ago. We've been happily testing early versions of `verify` for the last two weeks and haven't had any issues since. + +This type of verification is only the start. If your application is deployed on-prem by your customers, `verify` could tell you if it's safe for your customers to rollback to an older version of your app, even after schema migrations have been run. + +Using `verify` requires that you push your queries and schema when you tag a release of your application. We run it on every push to main, as we continuously deploy those commits. + +## Authentication + +`sqlc` expects to find a valid auth token in the value of the `SQLC_AUTH_TOKEN` +environment variable. You can create an auth token via the [dashboard](https://dashboard.sqlc.dev). + +```shell +export SQLC_AUTH_TOKEN=sqlc_xxxxxxxx +``` + +## Expected workflow + +Using `sqlc verify` requires pushing your queries and schema to sqlc Cloud. When +you release a new version of your application, you should push your schema and +queries as well. For example, we run `sqlc push` after any change has been +merged into our `main` branch on Github, as we deploy every commit to +production. + +```shell +$ sqlc push --tag main +``` + +Locally or in pull requests, run `sqlc verify` to check that existing queries +continue to work with your current database schema. + +```shell +$ sqlc verify --against main +``` + +## Picking a tag + +Without an `against` argument, `verify` will run its analysis of the provided schema using your most-recently pushed queries. We suggest using the `against` argument to explicitly select a set of queries for comparison. + +```shell +$ sqlc verify --against [tag] +``` diff --git a/docs/howto/vet.md b/docs/howto/vet.md index 1b3d075076..3909c616e8 100644 --- a/docs/howto/vet.md +++ b/docs/howto/vet.md @@ -1,18 +1,19 @@ -# Linting queries +# `vet` - Linting queries *Added in v1.19.0* `sqlc vet` runs queries through a set of lint rules. -Rules are defined in the `sqlc` [configuration](../reference/config) file. They consist -of a name, message, and a [Common Expression Language (CEL)](https://github.com/google/cel-spec) -expression. Expressions are evaluated using [cel-go](https://github.com/google/cel-go). -If an expression evaluates to `true`, `sqlc vet` will report an error using the given message. +Rules are defined in the `sqlc` [configuration](../reference/config.md) file. They +consist of a name, message, and a [Common Expression Language +(CEL)](https://github.com/google/cel-spec) expression. Expressions are evaluated +using [cel-go](https://github.com/cel-expr/cel-go). If an expression evaluates to +`true`, `sqlc vet` will report an error using the given message. ## Defining lint rules -Each lint rule's CEL expression has access to information from your sqlc configuration and queries -via variables defined in the following proto messages. +Each lint rule's CEL expression has access to information from your sqlc +configuration and queries via variables defined in the following proto messages. ```proto message Config @@ -42,12 +43,12 @@ message Parameter ``` In addition to this basic information, when you have a PostgreSQL or MySQL -[database connection configured](../reference/config.html#database) +[database connection configured](../reference/config.md#database) each CEL expression has access to the output from running `EXPLAIN ...` on your query via the `postgresql.explain` and `mysql.explain` variables. This output is quite complex and depends on the structure of your query but sqlc attempts to parse and provide as much information as it can. See -[Rules using `EXPLAIN ...` output](#rules-using-explain-output) for more information. +[Rules using `EXPLAIN ...` output](#rules-using-explain--output) for more information. Here are a few example rules just using the basic configuration and query information available to the CEL expression environment. While these examples are simplistic, they give you a flavor @@ -94,7 +95,7 @@ rules: The CEL expression environment has two variables containing `EXPLAIN ...` output, `postgresql.explain` and `mysql.explain`. `sqlc` only populates the variable associated with your configured database engine, and only when you have a -[database connection configured](../reference/config.html#database). +[database connection configured](../reference/config.md#database). For the `postgresql` engine, `sqlc` runs @@ -162,22 +163,27 @@ rules: rule: "!has(postgresql.explain)" # A dummy rule to trigger explain ``` -Please note that `sqlc` does not manage or migrate your database. Use your -migration tool of choice to create the necessary database tables and objects -before running `sqlc vet` with rules that depend on `EXPLAIN ...` output. +Please note that databases configured with a `uri` must have an up-to-date +schema for `vet` to work correctly, and `sqlc` does not apply schema migrations +to your database. Use your migration tool of choice to create the necessary +tables and objects before running `sqlc vet` with rules that depend on +`EXPLAIN ...` output. + +Alternatively, configure [managed databases](managed-databases.md) to have +`sqlc` create hosted ephemeral databases with the correct schema automatically. ## Built-in rules ### sqlc/db-prepare -When a [database](../reference/config.html#database) connection is configured, you can +When a [database](../reference/config.md#database) connection is configured, you can run the built-in `sqlc/db-prepare` rule. This rule will attempt to prepare each of your queries against the connected database and report any failures. ```yaml version: 2 sql: - - schema: "query.sql" + - schema: "schema.sql" queries: "query.sql" engine: "postgresql" gen: @@ -190,17 +196,39 @@ sql: - sqlc/db-prepare ``` +Please note that databases configured with a `uri` must have an up-to-date +schema for `vet` to work correctly, and `sqlc` does not apply schema migrations +to your database. Use your migration tool of choice to create the necessary +tables and objects before running `sqlc vet` with the `sqlc/db-prepare` rule. + +Alternatively, configure [managed databases](managed-databases.md) to have +`sqlc` create hosted ephemeral databases with the correct schema automatically. + +```yaml +version: 2 +cloud: + project: "" +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + database: + managed: true + rules: + - sqlc/db-prepare +``` + To see this in action, check out the [authors example](https://github.com/sqlc-dev/sqlc/blob/main/examples/authors/sqlc.yaml). -Please note that `sqlc` does not manage or migrate your database. Use your -migration tool of choice to create the necessary database tables and objects -before running `sqlc vet` with the `sqlc/db-prepare` rule. - ## Running lint rules When you add the name of a defined rule to the rules list -for a [sql package](https://docs.sqlc.dev/en/stable/reference/config.html#sql), +for a [sql package](../reference/config.md#sql), `sqlc vet` will evaluate that rule against every query in the package. In the example below, two rules are defined but only one is enabled. @@ -231,11 +259,28 @@ rules: ### Opting-out of lint rules For any query, you can tell `sqlc vet` not to evaluate lint rules using the -`@sqlc-vet-disable` query annotation. +`@sqlc-vet-disable` query annotation. The annotation accepts a list of rules to ignore. + +```sql +/* name: GetAuthor :one */ +/* @sqlc-vet-disable sqlc/db-prepare no-pg */ +SELECT * FROM authors +WHERE id = ? LIMIT 1; +``` +The rules can also be split across lines. +```sql +/* name: GetAuthor :one */ +/* @sqlc-vet-disable sqlc/db-prepare */ +/* @sqlc-vet-disable no-pg */ +SELECT * FROM authors +WHERE id = ? LIMIT 1; +``` + +To skip all rules for a query, you can provide the `@sqlc-vet-disable` annotation without any parameters. ```sql /* name: GetAuthor :one */ /* @sqlc-vet-disable */ SELECT * FROM authors WHERE id = ? LIMIT 1; -``` \ No newline at end of file +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000000..4b7f203033 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,22 @@ +# sqlc Documentation + +> And lo, the Great One looked down upon the people and proclaimed: +> "SQL is actually pretty great" + +sqlc generates **fully type-safe idiomatic Go code** from SQL. Here's how it +works: + +1. You write SQL queries +2. You run sqlc to generate Go code that presents type-safe interfaces to those + queries +3. You write application code that calls the methods sqlc generated + +Seriously, it's that easy. You don't have to write any boilerplate SQL querying +code ever again. + +## Getting started + +- [Installing sqlc](overview/install.md) +- [Getting started with MySQL](tutorials/getting-started-mysql.md) +- [Getting started with PostgreSQL](tutorials/getting-started-postgresql.md) +- [Getting started with SQLite](tutorials/getting-started-sqlite.md) diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 566d87d84f..0000000000 --- a/docs/index.rst +++ /dev/null @@ -1,87 +0,0 @@ -.. sqlc documentation master file, created by - sphinx-quickstart on Mon Feb 1 23:18:36 2021. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -sqlc Documentation -================== - - And lo, the Great One looked down upon the people and proclaimed: - "SQL is actually pretty great" - -sqlc generates **fully type-safe idiomatic Go code** from SQL. Here's how it -works: - -1. You write SQL queries -2. You run sqlc to generate Go code that presents type-safe interfaces to those - queries -3. You write application code that calls the methods sqlc generated - -Seriously, it's that easy. You don't have to write any boilerplate SQL querying -code ever again. - -.. toctree:: - :maxdepth: 2 - :caption: Overview - :hidden: - - overview/install.md - -.. toctree:: - :maxdepth: 2 - :caption: Tutorials - :hidden: - - tutorials/getting-started-mysql.md - tutorials/getting-started-postgresql.md - tutorials/getting-started-sqlite.md - -.. toctree:: - :maxdepth: 2 - :caption: How-to Guides - :hidden: - - howto/select.md - howto/query_count.md - howto/insert.md - howto/update.md - howto/delete.md - - howto/prepared_query.md - howto/transactions.md - howto/named_parameters.md - - howto/ddl.md - howto/structs.md - howto/embedding.md - howto/overrides.md - howto/rename.md - - howto/vet.md - howto/managed-databases.md - howto/ci-cd.md - howto/upload.md - -.. toctree:: - :maxdepth: 3 - :caption: Reference - :hidden: - - reference/changelog.md - reference/cli.md - reference/config.md - reference/datatypes.md - reference/environment-variables.md - reference/language-support.rst - reference/macros.md - reference/query-annotations.md - -.. toctree:: - :maxdepth: 2 - :caption: Conceptual Guides - :hidden: - - guides/using-go-and-pgx.rst - guides/development.md - guides/plugins.md - guides/privacy.md diff --git a/docs/overview/install.md b/docs/overview/install.md index 86113b0423..1ab41e9d2c 100644 --- a/docs/overview/install.md +++ b/docs/overview/install.md @@ -14,20 +14,14 @@ brew install sqlc sudo snap install sqlc ``` -## go install +## go install -### Go >= 1.17: +Installing recent versions of sqlc requires Go 1.21+. ``` go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest ``` -### Go < 1.17: - -``` -go get github.com/sqlc-dev/sqlc/cmd/sqlc -``` - ## Docker ``` @@ -48,10 +42,10 @@ docker run --rm -v "%cd%:/src" -w /src sqlc/sqlc generate ## Downloads -Get pre-built binaries for *v1.22.0*: +Get pre-built binaries for *v1.31.1*: -- [Linux](https://downloads.sqlc.dev/sqlc_1.22.0_linux_amd64.tar.gz) -- [macOS](https://downloads.sqlc.dev/sqlc_1.22.0_darwin_amd64.zip) -- [Windows](https://downloads.sqlc.dev/sqlc_1.22.0_windows_amd64.zip) +- [Linux](https://downloads.sqlc.dev/sqlc_1.31.1_linux_amd64.tar.gz) +- [macOS](https://downloads.sqlc.dev/sqlc_1.31.1_darwin_amd64.zip) +- [Windows](https://downloads.sqlc.dev/sqlc_1.31.1_windows_amd64.zip) See [downloads.sqlc.dev](https://downloads.sqlc.dev/) for older versions. diff --git a/docs/reference/changelog.md b/docs/reference/changelog.md index 20faa79db7..af42c037fb 100644 --- a/docs/reference/changelog.md +++ b/docs/reference/changelog.md @@ -1,6 +1,740 @@ # Changelog All notable changes to this project will be documented in this file. +(v1-31-1)= +## [1.31.1](https://github.com/sqlc-dev/sqlc/releases/tag/v1.31.1) +Released 2026-04-22 + +### Bug Fixes + +- Remove go.mod replace directive that breaks `go install ...@latest` (#4401) +- Downgrade github.com/ncruces/go-sqlite3 to v0.32.0 (#4400) + +### Build + +- (deps) Bump github.com/jackc/pgx/v5 (#4398) + +(v1-31-0)= +## [1.31.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.31.0) +Released 2026-04-19 + +### Bug Fixes + +- Strip psql meta-commands from schema files (#4390) +- Emit pointers for nullable enum columns when `emit_pointers_for_null_types` is set (#4388) +- Map xid8 to pgtype.Uint64 for pgx/v5 (#4387) +- Rename `:one` return variable when it conflicts with a parameter (#4383) +- Coerce SQLite JSONB output regardless of type casing (#4385) +- Dedupe `sqlc.arg` parameters wrapped in a type cast for MySQL (#4384) +- Preserve MySQL optimizer hints in generated query text (#4382) +- Catch invalid `ON CONFLICT DO UPDATE` column references (#4366) +- Replace manual loop with `copy()` builtin (#4166) +- (native) Make MySQL connection check immediate on first attempt (#4254) + +### Documentation + +- Add link to community python plugin (#4157) +- Add Claude Code remote environment setup instructions (#4246) +- Add sqlc-gen-sqlx to community language support (#4371) +- Add GitHub Topic to the plugins page (#4258) + +### Features + +- (sqlfile) Add `sqlfile.Split` (#4146) +- (sqlite) Add database analyzer using ncruces/go-sqlite3 (#4199) +- (ast) Implement comprehensive SQL AST formatting (#4205) +- (mysql) Improve AST formatting and add DELETE JOIN support (#4206) +- (sqlite) Add SQLite support to format tests (#4207) +- (expander) Add star expander for `SELECT *` and `RETURNING *` (PostgreSQL, MySQL, SQLite) (#4203) +- Add `SQLCEXPERIMENT` environment variable for experimental features (#4228) +- Add native database support for e2e tests without Docker (#4236) +- (postgresql) Add analyzerv2 experiment for database-only analysis (#4237) +- Graduate parsecmd experiment (#4253) +- Add parse subcommand with AST JSON output (#4240) +- Add ClickHouse support to `sqlc parse` (#4267) +- Add `sqlc-test-setup` command for database test environment setup (#4304) + +### Refactor + +- (ast) Rename Formatter interface to Dialect (#4208) + +### Build + +- Upgrade Go toolchain to 1.26.2 (#4378) +- Upgrade Go version to 1.26.0 (#4312) +- Remove github.com/jackc/pgx/v4 dependency (#4379) +- Upgrade github.com/pingcap/tidb/pkg/parser (#4389) +- Install PostgreSQL from theseus-rs/postgresql-binaries instead of apt (#4310) +- Skip CI/RTD builds when the change is irrelevant (#4381) +- (deps) 35 dependabot bumps (collapsed from individual entries) + +(v1-30-0)= +## [1.30.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.30.0) +Released 2025-09-01 + +### Bug Fixes + +- (compiler/mysql) Prevent panic in convertSetOprSelectList() (#4042) +- Range subselect alias pointer dereference (#3711) +- (codegen/golang) Don't omit enums used as arrays (#4058) +- (codegen/golang) Handle `go_struct_tag` for `db_type` overrides (#4055) +- (engine/dolphin) Remove references to deprecated `pcast.ChangeStmt` (#4057) +- Normalize identifier usage for table names (#4045) +- (engine/sqlite) Fix parsing of INSERT DEFAULT VALUES syntax (#4010) + +### Documentation + +- Fix parameter syntax inconsistency for MySQL and SQLite (#4036) +- Use correct configuration to generate the given output for JSON type override (#4049) +- Clean up and add to docs regarding type overrides (#4060) +- Try a different admonition format (#4061) +- Use the correct admonition format (#4062) +- Add multi-worded table example for renaming (#4067) + +### Features + +- (docs) Add link to Gleam/parrot (#4038) +- (engine/dolphin) Implement MATCH_AGAINST conversion in SQL AST (#1192, #3091) (#4070) +- (engine/sqlite) Coerce jsonb columns to json before returning to Go code (#3968) + +### Testing + +- (endtoend) Skip process_plugin_sqlc_gen_json (#4075) +- (endtoend) Use Docker to start database servers (#4076) + +### Build + +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3941) +- (deps) Bump packaging (#3940) +- (deps) Bump golang from 1.24.2 to 1.24.4 (#3983) +- (deps) Bump golang from 1.24.4 to 1.24.5 (#4014) +- (deps) Bump urllib3 from 2.4.0 to 2.5.0 in /docs (#3994) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3989) +- (deps) Bump the production-dependencies group across 1 directory with 4 updates (#4027) +- (deps) Bump modernc.org/sqlite (#4032) +- (deps) Bump the production-dependencies group across 1 directory with 4 updates (#4018) +- (deps) Bump certifi in /docs in the production-dependencies group (#4041) +- (deps) Bump google.golang.org/protobuf (#4043) +- (deps) Bump actions/checkout from 4 to 5 (#4059) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#4071) +- (deps) Bump requests in /docs in the production-dependencies group (#4068) +- Upgrade to Go 1.25 (#4074) +- (deps) Bump golang from 1.24.5 to 1.25.0 (#4063) +- (deps) Bump github.com/google/cel-go (#4080) + +(v1-29-0)= +## [1.29.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.29.0) +Released 2025-04-14 + +### Bug Fixes + +- (docs) Correct spelling and grammar (#3645) +- (dbmanager) Use correct SQL to drop databases (#3640) +- (compiler) Don't crash on WHERE x IN (... UNION ...) (#3652) +- (golang) Escape q field name (#3647) +- Postgresql alter materialized view is not registered to statements (#3728) +- Do not close wazero module on error (#3758) (#3759) +- (pgx) Do not wrap nil error (#3913) +- (migrations) Normalize case for migration statement for all cases (#3919) + +### Documentation + +- Add missing documentation about copyfrom (#3583) +- Add sqlc-gen-from-template (#3601) +- Add changelog for 1.28.0 (#3797) +- Add PHP DBAL plugin (#3813) +- Fix PostGIS function name (#3829) +- Add Zig plugin (#3824) +- Add link to tandemdude/sqlc-gen-java (#3819) + +### Features + +- (docs) How-to use transactions with pgx (#3557) +- (quickdb) Remove unused func (#3576) +- (vet) Allow selective disabling of rules per query (#3620) +- (dolphin) Upgrade to latest TiDB parser (#3733) +- (mysql) Add a test for VECTOR column type (#3734) +- (cli) Bump version from 1.27.0 to 1.28.0 (#3798) +- (codegen/golang) Add an option to wrap query errors that includes query name (#3876) + +### Miscellaneous Tasks + +- Remove the triage label (#3527) +- Upgrade to Go 1.22.8 to silence vulncheck (#3646) +- Update sqlc-gen-java supported engines (#3843) + +### Build + +- (deps) Bump myst-parser (#3530) +- (deps) Bump golang from 1.22.5 to 1.22.6 (#3532) +- (deps) Bump modernc.org/sqlite (#3537) +- (deps) Bump the production-dependencies group across 1 directory with 4 updates (#3566) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3565) +- (deps) Bump golang from 1.22.6 to 1.23.0 (#3546) +- (deps) Bump golang from 1.23.0 to 1.23.1 (#3586) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3644) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3642) +- (deps) Bump sphinx-rtd-theme (#3648) +- (deps) Bump pyparsing (#3653) +- (deps) Bump markupsafe (#3666) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3707) +- (deps) Bump golang from 1.23.2 to 1.23.3 (#3691) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3721) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3731) +- (deps) Bump certifi in /docs in the production-dependencies group (#3748) +- (deps) Bump golang.org/x/crypto from 0.27.0 to 0.31.0 (#3740) +- (deps) Bump golang from 1.23.3 to 1.23.4 (#3735) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3749) +- (deps) Bump the production-dependencies group with 2 updates (#3753) +- (deps) Bump the production-dependencies group across 1 directory with 3 updates (#3764) +- (deps) Bump the production-dependencies group (#3761) +- (deps) Bump jinja2 from 3.1.4 to 3.1.5 in /docs (#3762) +- (deps) Bump google.golang.org/protobuf (#3776) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3777) +- (deps) Bump google.golang.org/grpc (#3784) +- (deps) Bump golang from 1.23.4 to 1.23.5 (#3791) +- (deps) Bump the production-dependencies group with 2 updates (#3789) +- Upgrade to Go 1.23.5 (#3795) +- (deps) Bump golang.org/x/net from 0.30.0 to 0.33.0 (#3796) +- (deps) Bump golang from 1.23.5 to 1.23.6 (#3822) +- Use govulncheck action (#3831) +- (deps) Bump the production-dependencies group across 1 directory with 3 updates (#3817) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3826) +- (deps) Bump golang from 1.23.6 to 1.24.0 (#3842) +- (deps) Bump myst-parser (#3841) +- (deps) Bump modernc.org/sqlite (#3846) +- (deps) Bump golang from 1.24.0 to 1.24.1 (#3870) +- (deps) Bump jinja2 in /docs in the production-dependencies group (#3872) +- Upgrade to wazero@v1.9.0 (#3887) +- Upgrade to Go 1.24.1 (#3892) +- Upgrade to latest version of MySQL parser (#3893) +- (deps) Bump pyparsing (#3890) +- (deps) Bump golang.org/x/net from 0.33.0 to 0.37.0 (#3894) +- (deps) Bump the production-dependencies group across 1 directory with 8 updates (#3896) +- (deps) Bump github.com/jackc/pgx/v5 (#3898) +- (deps) Bump the production-dependencies group (#3899) +- (deps) Bump modernc.org/sqlite (#3905) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3914) +- (deps) Bump urllib3 in /docs in the production-dependencies group (#3926) +- (deps) Bump golang from 1.24.1 to 1.24.2 (#3915) +- (deps) Bump the production-dependencies group across 1 directory with 3 updates (#3923) +- (deps) Upgrade github.com/wasilibs/go-pgquery (#3927) + +(v1-28-0)= +## [1.28.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.28.0) +Released 2025-01-20 + +### Features + +- (mysql) Add a test for VECTOR column type (#3734) +- (quickdb) Remove unused func (#3576) +- (vet) Allow selective disabling of rules per query (#3620) +- (dolphin) Upgrade to latest TiDB parser (#3733) + +### Bug Fixes + +- (dbmanager) Use correct SQL to drop databases (#3640) +- (compiler) Don't crash on WHERE x IN (... UNION ...) (#3652) +- (golang) Escape q field name (#3647) +- Postgresql alter materialized view is not registered to statements (#3728) +- Do not close wazero module on error (#3758) (#3759) + +### Documentation + +- How-to use transactions with pgx (#3557) +- Add missing documentation about copyfrom (#3583) +- Add sqlc-gen-from-template (#3601) +- Correct spelling and grammar (#3645) + +### Miscellaneous Tasks + +- Remove the triage label (#3527) +- Upgrade to Go 1.22.8 to silence vulncheck (#3646) + +### Build + +- (deps) Bump myst-parser (#3530) +- (deps) Bump golang from 1.22.5 to 1.22.6 (#3532) +- (deps) Bump modernc.org/sqlite (#3537) +- (deps) Bump the production-dependencies group across 1 directory with 4 updates (#3566) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3565) +- (deps) Bump golang from 1.22.6 to 1.23.0 (#3546) +- (deps) Bump golang from 1.23.0 to 1.23.1 (#3586) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3644) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3642) +- (deps) Bump sphinx-rtd-theme (#3648) +- (deps) Bump pyparsing (#3653) +- (deps) Bump markupsafe (#3666) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3707) +- (deps) Bump golang from 1.23.2 to 1.23.3 (#3691) +- (deps) Bump the production-dependencies group across 1 directory with 5 updates (#3721) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3731) +- (deps) Bump certifi in /docs in the production-dependencies group (#3748) +- (deps) Bump golang.org/x/crypto from 0.27.0 to 0.31.0 (#3740) +- (deps) Bump golang from 1.23.3 to 1.23.4 (#3735) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3749) +- (deps) Bump the production-dependencies group with 2 updates (#3753) +- (deps) Bump the production-dependencies group across 1 directory with 3 updates (#3764) +- (deps) Bump the production-dependencies group (#3761) +- (deps) Bump jinja2 from 3.1.4 to 3.1.5 in /docs (#3762) +- (deps) Bump google.golang.org/protobuf (#3776) +- (deps) Bump the production-dependencies group across 1 directory with 2 updates (#3777) +- (deps) Bump google.golang.org/grpc (#3784) +- (deps) Bump golang from 1.23.4 to 1.23.5 (#3791) +- (deps) Bump the production-dependencies group with 2 updates (#3789) +- Upgrade to Go 1.23.5 (#3795) + +(v1-27-0)= +## [1.27.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.27.0) +Released 2024-08-05 + +### Bug Fixes + +- (dbmanager) Add leading slash to db uri path rewrite (#3493) +- (verify) Include database engine in request (#3522) + +### Features + +- (golang) Add initialisms configuration (#3308) +- (compiler) Support subqueries in the FROM clause (second coming) (#3310) +- Managed databases with any accessible server (#3421) +- (vet) Use new dbmanager client (#3423) +- (verify) Update verify to work with managed databases (#3425) + +### Documentation + +- Fix typo in config (#3358) +- Resolve a typo in configuration keys (#3349) +- Add sponsorship information to README (#3413) +- Update the language-support to include C# (#3408) +- Add migration guide for hosted managed databases (#3417) +- Fix readme links (#3424) +- Update the managed db and verify documentation (#3426) +- Add sponsor image (#3428) +- Add Ruby as supported language (#3487) +- Update migrating-to-sqlc-gen-kotlin.md (#3454) +- Fix typo in comment (#3316) +- Fix deprecated build tag format (#3361) + +### Testing + +- (endtoend) Re-use databases when possible (#3315) +- Enabled MySQL database (#3318) +- Remove internal/sqltest/hosted package (#3521) + +(v1-26-0)= +## [1.26.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.26.0) +Released 2024-03-28 + +### Release notes + +This release is mainly a bug fix release. It also includes an [important security fix](https://github.com/sqlc-dev/sqlc/issues/3194) for users using output plugins. + +### Changes + +#### Bug Fixes + +- (docker) Use distroless base image instead of scratch (#3111) +- (generate) Ensure files are created inside output directory (#3195) +- (mysql) BREAKING: Use `int16` for MySQL `SMALLINT` and `YEAR` (#3106) +- (mysql) BREAKING: Use `int8` for MySQL TINYINT (#3298) +- (mysql) Variables not resolving in ORDER BY statements (#3115) +- (opts) Validate SQL package and driver options (#3241) +- (postgres/batch) Ignore query_parameter_limit for batches +- (scripts) Remove deprecated test output regeneration script (#3105) +- (sqlite) Correctly skip unknown statements (#3239) + +#### Documentation + +- (postgres) Add instructions for PostGIS/GEOS (#3182) +- Improve details on TEXT (#3247) + +#### Features + +- (generate) Avoid generating empty Go imports (#3135) +- (mysql) Add NEXTVAL() to the MySQL catalog (#3147) +- (mysql) Support json.RawMessage for LOAD DATA INFILE (#3099) + +#### Build + +- (deps) Bump github.com/jackc/pgx/v5 to 5.5.5 (#3259) +- (deps) Bump modernc.org/sqlite to 1.29.5 (#3200) +- (deps) Bump github.com/go-sql-driver/mysql to 1.8.0 (#3257) +- (deps) Bump github.com/tetratelabs/wazero to 1.7.0 (#3096) +- (deps) Bump github.com/pganalyze/pg_query_go to v5 (#3096) + + +(v1-25-0)= +## [1.25.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.25.0) +Released 2024-01-03 + +### Release notes + +#### Add tags to push and verify + +You can add tags when [pushing](../howto/push.md) schema and queries to [sqlc Cloud](https://dashboard.sqlc.dev). Tags operate like git tags, meaning you can overwrite previously-pushed tag values. We suggest tagging pushes to associate them with something relevant from your environment, e.g. a git tag or branch name. + +``` +$ sqlc push --tag v1.0.0 +``` + +Once you've created a tag, you can refer to it when [verifying](../howto/verify.md) changes, allowing you +to compare the existing schema against a known set of previous queries. + +``` +$ sqlc verify --against v1.0.0 +``` + +#### C-ya, `cgo` + +Over the last month, we've switched out a few different modules to remove our reliance on [cgo](https://go.dev/blog/cgo). Previously, we needed cgo for three separate functions: + +- Parsing PostgreSQL queries with [pganalyze/pg_query_go](https://github.com/pganalyze/pg_query_go) +- Running SQLite databases with [mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) +- Executing WASM / WASI code with [bytecodealliance/wasmtime-go](https://github.com/bytecodealliance/wasmtime-go) + +With the help of the community, we found cgo-free alternatives for each module: + +- Parsing PostgreSQL queries, now using [wasilibs/go-pgquery](https://github.com/wasilibs/go-pgquery) +- Running SQLite databases, now using [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) +- Executing WASM / WASI code, now using [tetratelabs/wazero](https://github.com/tetratelabs/wazero) + +For the first time, Windows users can enjoy full PostgreSQL support without using [WSL](https://learn.microsoft.com/en-us/windows/wsl/about). It's a Christmas miracle! + +If you run into any issues with the updated dependencies, please [open an issue](https://github.com/sqlc-dev/sqlc/issues). + +### Changes + +#### Bug Fixes + +- (codegen) Wrong yaml annotation in go codegen options for output_querier_file_name (#3006) +- (codegen) Use derived ArrayDims instead of deprecated attndims (#3032) +- (codegen) Take the maximum array dimensions (#3034) +- (compiler) Skip analysis of queries without a `name` annotation (#3072) +- (codegen/golang) Don't import `"strings"` for `sqlc.slice()` with pgx (#3073) + +### Documentation + +- Add name to query set configuration (#3011) +- Add a sidebar link for `push`, add Go plugin link (#3023) +- Update banner for sqlc-gen-typescript (#3036) +- Add strict_order_by in doc (#3044) +- Re-order the migration tools list (#3064) + +### Features + +- (analyzer) Return zero values when encountering unexpected ast nodes (#3069) +- (codegen/go) add omit_sqlc_version to Go code generation (#3019) +- (codgen/go) Add `emit_sql_as_comment` option to Go code plugin (#2735) +- (plugins) Use wazero instead of wasmtime (#3042) +- (push) Add tag support (#3074) +- (sqlite) Support emit_pointers_for_null_types (#3026) + +### Testing + +- (endtoend) Enable for more build targets (#3041) +- (endtoend) Run MySQL and PostgreSQL locally on the runner (#3095) +- (typescript) Test against sqlc-gen-typescript (#3046) +- Add tests for omit_sqlc_version (#3020) +- Split schema and query for test (#3094) + +### Build + +- (deps) Bump idna from 3.4 to 3.6 in /docs (#3010) +- (deps) Bump sphinx-rtd-theme from 1.3.0 to 2.0.0 in /docs (#3016) +- (deps) Bump golang from 1.21.4 to 1.21.5 (#3043) +- (deps) Bump actions/setup-go from 4 to 5 (#3047) +- (deps) Bump github.com/jackc/pgx/v5 from 5.5.0 to 5.5.1 (#3050) +- (deps) Upgrade to latest version of github.com/wasilibs/go-pgquery (#3052) +- (deps) Bump google.golang.org/grpc from 1.59.0 to 1.60.0 (#3053) +- (deps) Bump babel from 2.13.1 to 2.14.0 in /docs (#3055) +- (deps) Bump actions/upload-artifact from 3 to 4 (#3061) +- (deps) Bump modernc.org/sqlite from 1.27.0 to 1.28.0 (#3062) +- (deps) Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#3068) +- (deps) Bump google.golang.org/grpc from 1.60.0 to 1.60.1 (#3070) +- (deps) Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 (#3079) +- (deps) Bump github.com/tetratelabs/wazero from 1.5.0 to 1.6.0 (#3096) +- (sqlite) Update to antlr 4.13.1 (#3086) +- (sqlite) Disable modernc for WASM (#3048) +- (sqlite) Switch from mattn/go-sqlite3 to modernc.org/sqlite (#3040) + +(v1-24-0)= +## [1.24.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.24.0) +Released 2023-11-22 + +### Release notes + +#### Verifying database schema changes + +Schema updates and poorly-written queries often bring down production databases. That’s bad. + +Out of the box, `sqlc generate` catches some of these issues. Running `sqlc vet` with the `sqlc/db-prepare` rule catches more subtle problems. But there is a large class of issues that sqlc can’t prevent by looking at current schema and queries alone. + +For instance, when a schema change is proposed, existing queries and code running in production might fail when the schema change is applied. Enter `sqlc verify`, which analyzes existing queries against new schema changes and errors if there are any issues. + +Let's look at an example. Assume you have these two tables in production. + +```sql +CREATE TABLE users ( + id UUID PRIMARY KEY +); + +CREATE TABLE user_actions ( + id UUID PRIMARY KEY, + user_id UUID NOT NULL, + action TEXT, + created_at TIMESTAMP +); +``` + +Your application contains the following query to join user actions against the users table. + +```sql +-- name: GetUserActions :many +SELECT * FROM users u +JOIN user_actions ua ON u.id = ua.user_id +ORDER BY created_at; +``` + +So far, so good. Then assume you propose this schema change: + +```sql +ALTER TABLE users ADD COLUMN created_at TIMESTAMP; +``` + +Running `sqlc generate` fails with this change, returning a `column reference "created_at" is ambiguous` error. You update your query to fix the issue. + +```sql +-- name: GetUserActions :many +SELECT * FROM users u +JOIN user_actions ua ON u.id = ua.user_id +ORDER BY u.created_at; +``` + +While that change fixes the issue, there's a production outage waiting to happen. When the schema change is applied, the existing `GetUserActions` query will begin to fail. The correct way to fix this is to deploy the updated query before applying the schema migration. + +It ensures migrations are safe to deploy by sending your current schema and queries to sqlc cloud. There, we run the queries for your latest push against your new schema changes. This check catches backwards incompatible schema changes for existing queries. + +Here `sqlc verify` alerts you to the fact that ORDER BY "created_at" is ambiguous. + +```sh +$ sqlc verify +FAIL: app query.sql + +=== Failed +=== FAIL: app query.sql GetUserActions + ERROR: column reference "created_at" is ambiguous (SQLSTATE 42702) +``` + +By the way, this scenario isn't made up! It happened to us a few weeks ago. We've been happily testing early versions of `verify` for the last two weeks and haven't had any issues since. + +This type of verification is only the start. If your application is deployed on-prem by your customers, `verify` could tell you if it's safe for your customers to rollback to an older version of your app, even after schema migrations have been run. + +#### Rename `upload` command to `push` + +We've renamed the `upload` sub-command to `push`. We changed the data sent along in a push request. Upload used to include the configuration file, migrations, queries, and all generated code. Push drops the generated code in favor of including the [plugin.GenerateRequest](https://buf.build/sqlc/sqlc/docs/main:plugin#plugin.GenerateRequest), which is the protocol buffer message we pass to codegen plugins. + +We also add annotations to each push. By default, we include these environment variables if they are present: + +``` +GITHUB_REPOSITORY +GITHUB_REF +GITHUB_REF_NAME +GITHUB_REF_TYPE +GITHUB_SHA +``` + +Like upload, `push` should be run when you tag a release of your application. We run it on every push to main, as we continuously deploy those commits. + +#### MySQL support in `createdb` + +The `createdb` command, added in the last release, now supports MySQL. If you have a cloud project configured, you can use `sqlc createdb` to spin up a new ephemeral database with your schema and print its connection string to standard output. This is useful for integrating with other tools. Read more in the [managed databases](../howto/managed-databases.md) documentation. + +#### Plugin interface refactor + +This release includes a refactored plugin interface to better support future functionality. Plugins now support different methods via a gRPC service interface, allowing plugins to support different functionality in a backwards-compatible way. + +By using gRPC interfaces, we can even (theoretically) support [remote plugins](https://github.com/sqlc-dev/sqlc/pull/2938), but that's something for another day. + +### Changes + +#### Bug Fixes + +- (engine/sqlite) Support CASE expr (#2926) +- (engine/sqlite) Support -> and ->> operators (#2927) +- (vet) Add a nil pointer check to prevent db/prepare panic (#2934) +- (compiler) Prevent panic when compiler is nil (#2942) +- (codegen/golang) Move more Go-specific config validation into the plugin (#2951) +- (compiler) No panic on full-qualified column names (#2956) +- (docs) Better discussion of type override nuances (#2972) +- (codegen) Never generate return structs for :exec (#2976) +- (generate) Update help text for generate to be more generic (#2981) +- (generate) Return an error instead of generating duplicate Go names (#2962) +- (codegen/golang) Pull opts into its own package (#2920) +- (config) Make some struct and field names less confusing (#2922) + +#### Features + +- (codegen) Remove Go specific overrides from codegen proto (#2929) +- (plugin) Use gRPC interface for codegen plugin communication (#2930) +- (plugin) Calculate SHA256 if it does not exist (#2935) +- (sqlc-gen-go) Add script to mirror code to sqlc-gen-go (#2952) +- (createdb) Add support for MySQL (#2980) +- (verify) Add new command to verify queries and migrations (#2986) + +#### Testing + +- (ci) New workflow for sqlc-gen-python (#2936) +- (ci) Rely on go.mod to determine which Go version to use (#2971) +- (tests) Add glob pattern tests to sqlpath.Glob (#2995) +- (examples) Use hosted MySQL databases for tests (#2982) +- (docs) Clean up a little, update LICENSE and README (#2941) + +#### Build + +- (deps) Bump babel from 2.13.0 to 2.13.1 in /docs (#2911) +- (deps) Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#2944) +- (deps) Bump github.com/mattn/go-sqlite3 from 1.14.17 to 1.14.18 (#2945) +- (deps) Bump golang.org/x/sync from 0.4.0 to 0.5.0 (#2946) +- (deps) Bump github.com/jackc/pgx/v5 from 5.4.3 to 5.5.0 (#2947) +- (deps) Change github.com/pingcap/tidb/parser to github.com/pingcap/tidb/pkg/parser +- (deps) Bump github.com/google/cel-go from 0.18.1 to 0.18.2 (#2969) +- (deps) Bump urllib3 from 2.0.7 to 2.1.0 in /docs (#2975) +- (buf) Change root of Buf module (#2987) +- (deps) Bump certifi from 2023.7.22 to 2023.11.17 in /docs (#2993) +- (ci) Bump Go version from 1.21.3 to 1.21.4 in workflows and Dockerfile (#2961) + +(v1-23-0)= +## [1.23.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.23.0) +Released 2023-10-24 + +### Release notes + +#### Database-backed query analysis + +With a [database connection](config.md#database) configured, `sqlc generate` +will gather metadata from that database to support its query analysis. +Turning this on resolves a [large number of +issues](https://github.com/sqlc-dev/sqlc/issues?q=is%3Aissue+label%3Aanalyzer) +in the backlog related to type inference and more complex queries. The easiest +way to try it out is with [managed databases](../howto/managed-databases.md). + +The database-backed analyzer currently supports PostgreSQL, with [MySQL](https://github.com/sqlc-dev/sqlc/issues/2902) and [SQLite](https://github.com/sqlc-dev/sqlc/issues/2903) +support planned in the future. + +#### New `createdb` command + +When you have a cloud project configured, you can use the new `sqlc createdb` +command to spin up a new ephemeral database with your schema and print its +connection string to standard output. This is useful for integrating with other +tools. Read more in the [managed +databases](../howto/managed-databases.md) documentation. + +#### Support for pgvector + +If you're using [pgvector](https://github.com/pgvector/pgvector), say goodbye to custom overrides! sqlc now generates code using [pgvector-go](https://github.com/pgvector/pgvector-go#pgx) as long as you're using `pgx`. The pgvector extension is also available in [managed databases](../howto/managed-databases.md). + +#### Go build tags + +With the new `emit_build_tags` configuration parameter you can set build tags +for sqlc to add at the top of generated source files. + +### Changes + +#### Bug Fixes + +- (codegen) Correct column names in :copyfrom (#2838) +- (compiler) Search SELECT and UPDATE the same way (#2841) +- (dolphin) Support more UNIONs for MySQL (#2843) +- (compiler) Account for parameters without parents (#2844) +- (postgresql) Remove temporary pool config (#2851) +- (golang) Escape reserved keywords (#2849) +- (mysql) Handle simplified CASE statements (#2852) +- (engine/dolphin) Support enum in ALTER definition (#2680) +- (mysql) Add, drop, rename and change enum values (#2853) +- (config) Validate `database` config in all cases (#2856) +- (compiler) Use correct func signature for `CommentSyntax` on windows (#2867) +- (codegen/go) Prevent filtering of embedded struct fields (#2868) +- (compiler) Support functions with OUT params (#2865) +- (compiler) Pull in array information from analyzer (#2864) +- (analyzer) Error on unexpanded star expression (#2882) +- (vet) Remove rollback statements from DDL (#2895) + +#### Documentation + +- Add stable anchors to changelog (#2784) +- Fix typo in v1.22.0 changelog (#2796) +- Add sqlc upload to CI / CD guide (#2797) +- Fix broken link, add clarity to plugins doc (#2813) +- Add clarity and reference to JSON tags (#2819) +- Replace form with dashboard link (#2840) +- (examples) Update examples to use pgx/v5 (#2863) +- Use docker compose v2 and update MYSQL_DATABASE env var (#2870) +- Update getting started guides, use pgx for Postgres guide (#2891) +- Use managed databases in PostgreSQL getting started guide (#2892) +- Update managed databases doc to discuss codegen (#2897) +- Add managed dbs to CI/CD and vet guides (#2896) +- Document database-backed query analyzer (#2904) + +#### Features + +- (codegen) Support setting Go build tags (#2012) (#2807) +- (generate) Reorder codegen handlers to prefer plugins (#2814) +- (devenv) Add vscode settings.json with auto newline (#2834) +- (cmd) Support sqlc.yml configuration file (#2828) +- (analyzer) Analyze queries using a running PostgreSQL database (#2805) +- (sql/ast) Render AST to SQL (#2815) +- (codegen) Include plugin information (#2846) +- (postgresql) Add ALTER VIEW ... SET SCHEMA (#2855) +- (compiler) Parse query parameter metadata from comments (#2850) +- (postgresql) Support system columns on tables (#2871) +- (compiler) Support LEFT JOIN on aliased table (#2873) +- Improve messaging for common cloud config and rpc errors (#2885) +- Abort compiler when rpc fails as unauthenticated (#2887) +- (codegen) Add support for pgvector and pgvector-go (#2888) +- (analyzer) Cache query analysis (#2889) +- (createdb) Create ephemeral databases (#2894) +- (debug) Add databases=managed debug option (#2898) +- (config) Remove managed database validation (#2901) + +#### Miscellaneous Tasks + +- (endtoend) Fix test output for do tests (#2782) + +#### Refactor + +- (codegen) Remove golang and json settings from plugin proto (#2822) +- (codegen) Removed deprecated code and improved speed (#2899) + +#### Testing + +- (endtoend) Split shema and queries (#2803) +- Fix a few incorrect testcases (#2804) +- (analyzer) Add more database analyzer test cases (#2854) +- Add more analyzer test cases (#2866) +- Add more test cases for new analyzer (#2879) +- (endtoend) Enabled managed-db tests in CI (#2883) +- Enabled pgvector tests for managed dbs (#2893) + +#### Build + +- (deps) Bump packaging from 23.1 to 23.2 in /docs (#2791) +- (deps) Bump urllib3 from 2.0.5 to 2.0.6 in /docs (#2798) +- (deps) Bump babel from 2.12.1 to 2.13.0 in /docs (#2799) +- (deps) Bump golang.org/x/sync from 0.3.0 to 0.4.0 (#2810) +- (deps) Bump golang from 1.21.1 to 1.21.2 (#2811) +- (deps) Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 (#2826) +- (deps) Bump golang from 1.21.2 to 1.21.3 (#2824) +- (deps) Bump google.golang.org/grpc from 1.58.2 to 1.58.3 (#2825) +- (deps) Bump golang.org/x/net from 0.12.0 to 0.17.0 (#2836) +- (deps) Bump urllib3 from 2.0.6 to 2.0.7 in /docs (#2872) +- (deps) Bump google.golang.org/grpc from 1.58.3 to 1.59.0 (#2876) +- (deps) Upgrade wasmtime-go from 13.0.0 to 14.0.0 (#2900) + +#### Ci + +- Bump go version in workflows (#2835) + (v1-22-0)= ## [1.22.0](https://github.com/sqlc-dev/sqlc/releases/tag/v1.22.0) @@ -99,7 +833,7 @@ full list. #### Plugin access to environment variables -If you're authoring a [sqlc plugin](../guides/plugins.html), you can now configure +If you're authoring a [sqlc plugin](../guides/plugins.md), you can now configure sqlc to pass your plugin the values of specific environment variables. For example, if your plugin @@ -251,7 +985,7 @@ rules: !(postgresql.explain.plan.plans.all(p, has(p.index_name) || p.plans.all(p, has(p.index_name)))) ``` -The expression environment has two variables containing `EXPLAIN ...` output, `postgresql.explain` and `mysql.explain`. `sqlc` only populates the variable associated with your configured database engine, and only when you have a [database connection configured](../reference/config.html#database). +The expression environment has two variables containing `EXPLAIN ...` output, `postgresql.explain` and `mysql.explain`. `sqlc` only populates the variable associated with your configured database engine, and only when you have a [database connection configured](../reference/config.md#database). For the `postgresql` engine, `sqlc` runs @@ -474,7 +1208,7 @@ Released 2023-07-06 Rules are defined in the `sqlc` [configuration](config.md) file. They consist of a name, message, and a [Common Expression Language (CEL)](https://github.com/google/cel-spec) -expression. Expressions are evaluated using [cel-go](https://github.com/google/cel-go). +expression. Expressions are evaluated using [cel-go](https://github.com/cel-expr/cel-go). If an expression evaluates to `true`, an error is reported using the given message. While these examples are simplistic, they give you a flavor of the types of @@ -520,7 +1254,7 @@ rules: database server. We'll expand this functionality over time, but for now it powers the `sqlc/db-prepare` built-in rule. -When a [database](config.html#database) is configured, the +When a [database](config.md#database) is configured, the `sqlc/db-preapre` rule will attempt to prepare each of your queries against the connected database and report any failures. diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 427379c0f5..286467a816 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -1,17 +1,22 @@ # CLI -``` +```sh Usage: sqlc [command] Available Commands: + analyze Analyze a query against a schema and output the result columns and parameters compile Statically check SQL for syntax and type errors completion Generate the autocompletion script for the specified shell + createdb Create an ephemeral database diff Compare the generated files to the existing files - generate Generate Go code from SQL + fmt Format SQL queries + generate Generate source code from SQL help Help about any command init Create an empty sqlc.yaml settings file - upload Upload the schema, queries, and configuration for this project + parse Parse SQL and output the AST as JSON + push Push the schema, queries, and configuration for this project + verify Verify schema, queries, and configuration for this project version Print the sqlc version number vet Vet examines queries @@ -19,7 +24,6 @@ Flags: -f, --file string specify an alternate config file (default: sqlc.yaml) -h, --help help for sqlc --no-database disable database connections (default: false) - --no-remote disable remote execution (default: false) Use "sqlc [command] --help" for more information about a command. -``` \ No newline at end of file +``` diff --git a/docs/reference/config.md b/docs/reference/config.md index c0ba543503..15fdb7cfd4 100644 --- a/docs/reference/config.md +++ b/docs/reference/config.md @@ -7,6 +7,8 @@ file must be in the directory where the `sqlc` command is run. ```yaml version: "2" +cloud: + project: "" sql: - schema: "postgresql/schema.sql" queries: "postgresql/query.sql" @@ -16,7 +18,7 @@ sql: package: "authors" out: "postgresql" database: - uri: "postgresql://postgres:postgres@localhost:5432/postgres" + managed: true rules: - sqlc/db-prepare - schema: "mysql/schema.sql" @@ -32,6 +34,8 @@ sql: Each mapping in the `sql` collection has the following keys: +- `name`: + - An human-friendly identifier for this query set. Optional. - `engine`: - One of `postgresql`, `mysql` or `sqlite`. - `schema`: @@ -46,8 +50,12 @@ Each mapping in the `sql` collection has the following keys: - A mapping to configure database connections. See [database](#database) for the supported keys. - `rules`: - A collection of rule names to run via `sqlc vet`. See [rules](#rules) for configuration options. +- `analyzer`: + - A mapping to configure query analysis. See [analyzer](#analyzer) for the supported keys. - `strict_function_checks` - If true, return an error if a called SQL function does not exist. Defaults to `false`. +- `strict_order_by` + - If true, return an error if a order by column is ambiguous. Defaults to `true`. ### codegen @@ -85,6 +93,8 @@ sql: The `database` mapping supports the following keys: +- `managed`: + - If true, connect to a [managed database](../howto/managed-databases.md). Defaults to `false`. - `uri`: - Database connection URI @@ -105,7 +115,14 @@ sql: package: authors out: postgresql ``` - + +### analyzer + +The `analyzer` mapping supports the following keys: + +- `database`: + - If false, do not use the configured database for query analysis. Defaults to `true`. + ### gen The `gen` mapping supports the following keys: @@ -118,6 +135,8 @@ The `gen` mapping supports the following keys: - Output directory for generated code. - `sql_package`: - Either `pgx/v4`, `pgx/v5` or `database/sql`. Defaults to `database/sql`. +- `sql_driver`: + - Either `github.com/jackc/pgx/v4`, `github.com/jackc/pgx/v5`, `github.com/lib/pq` or `github.com/go-sql-driver/mysql`. No defaults. Required if query annotation `:copyfrom` is used. - `emit_db_tags`: - If true, add DB tags to generated structs. Defaults to `false`. - `emit_prepared_queries`: @@ -139,15 +158,21 @@ The `gen` mapping supports the following keys: - `emit_methods_with_db_argument`: - If true, generated methods will accept a DBTX argument instead of storing a DBTX on the `*Queries` struct. Defaults to `false`. - `emit_pointers_for_null_types`: - - If true and `sql_package` is set to `pgx/v4` or `pgx/v5`, generated types for nullable columns are emitted as pointers (ie. `*string`) instead of `database/sql` null types (ie. `NullString`). Defaults to `false`. + - If true, generated types for nullable columns are emitted as pointers (ie. `*string`) instead of `database/sql` null types (ie. `NullString`). Currently only supported for PostgreSQL if `sql_package` is `pgx/v4` or `pgx/v5`, and for SQLite. Defaults to `false`. Nullable enum columns also follow this setting unless `emit_pointers_for_null_enum_types` is set. +- `emit_pointers_for_null_enum_types`: + - Overrides `emit_pointers_for_null_types` for nullable enum columns only. When `true`, nullable enum columns are emitted as pointers (ie. `*UserRole`). When `false`, nullable enum columns use the generated `NullUserRole` wrapper struct even if `emit_pointers_for_null_types` is true. Set this to `false` to keep the pre-v1.31 behavior when upgrading. Only applies to PostgreSQL with `sql_package` `pgx/v4` or `pgx/v5`. - `emit_enum_valid_method`: - If true, generate a Valid method on enum types, indicating whether a string is a valid enum value. - `emit_all_enum_values`: - If true, emit a function per enum type that returns all valid enum values. +- `emit_sql_as_comment`: + - If true, emits the SQL statement as a code-block comment above the generated function, appending to any existing comments. Defaults to `false`. - `build_tags`: - If set, add a `//go:build ` directive at the beginning of each generated Go file. +- `initialisms`: + - An array of [initialisms](https://google.github.io/styleguide/go/decisions.html#initialisms) to upper-case. For example, `app_id` becomes `AppID`. Defaults to `["id"]`. - `json_tags_id_uppercase`: - If true, "Id" in json tags will be uppercase. If false, will be camelcase. Defaults to `false` - `json_tags_case_style`: @@ -171,40 +196,15 @@ The `gen` mapping supports the following keys: - `rename`: - Customize the name of generated struct fields. See [Renaming fields](../howto/rename.md) for usage information. - `overrides`: - - It is a collection of definitions that dictates which types are used to map a database types. + - A collection of configurations to override sqlc's default Go type choices. See [Overriding types](../howto/overrides.md) for usage information. -##### `overrides` +##### overrides -See [Overriding types](../howto/overrides.md) for in-depth guide to using type overrides. Each mapping of the `overrides` collection has the following keys: - -- `db_type`: - - The PostgreSQL or MySQL type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use the pg_catalog prefixed names where available. Can't be used if the `column` key is defined. -- `column`: - - In case the type overriding should be done on specific a column of a table instead of a type. `column` should be of the form `table.column` but you can be even more specific by specifying `schema.table.column` or `catalog.schema.table.column`. Can't be used if the `db_type` key is defined. -- `go_type`: - - A fully qualified name to a Go type to use in the generated code. -- `go_struct_tag`: - - A reflect-style struct tag to use in the generated code, e.g. `a:"b" x:"y,z"`. - If you want general json/db tags for all fields, use `emit_db_tags` and/or `emit_json_tags` instead. -- `nullable`: - - If `true`, use this type when a column is nullable. Defaults to `false`. - -For more complicated import paths, the `go_type` can also be an object with the following keys: - -- `import`: - - The import path for the package where the type is defined. -- `package`: - - The package name where the type is defined. This should only be necessary when your import path doesn't end with the desired package name. -- `type`: - - The type name itself, without any package prefix. -- `pointer`: - - If set to `true`, generated code will use pointers to the type rather than the type itself. -- `slice`: - - If set to `true`, generated code will use a slice of the type rather than the type itself. +See [Overriding types](../howto/overrides.md) for an in-depth guide to using type overrides. #### kotlin -> Removed in v1.17.0 and replaced by the [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-kotlin) to switch. +> Removed in v1.17.0 and replaced by the [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-kotlin.md) to switch. - `package`: - The package name to use for the generated code. @@ -215,7 +215,7 @@ For more complicated import paths, the `go_type` can also be an object with the #### python -> Removed in v1.17.0 and replaced by the [sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-python) to switch. +> Removed in v1.17.0 and replaced by the [sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-python.md) to switch. - `package`: - The package name to use for the generated code. @@ -250,6 +250,8 @@ Each mapping in the `plugins` collection has the following keys: - `process`: A mapping with a single `cmd` key - `cmd`: - The executable to call when using this plugin + - `format`: + - The format expected. Supports `json` and `protobuf` formats. Defaults to `protobuf`. - `wasm`: A mapping with a two keys `url` and `sha256` - `url`: - The URL to fetch the WASM file. Supports the `https://` or `file://` schemes. @@ -318,7 +320,7 @@ rules: query.cmd == "exec" ``` -### global overrides +### Global overrides Sometimes, the same configuration must be done across various specifications of code generation. Then a global definition for type overriding and field @@ -331,7 +333,7 @@ overrides: rename: id: "Identifier" overrides: - - db_type: "timestamptz" + - db_type: "pg_catalog.timestamptz" nullable: true engine: "postgresql" go_type: @@ -343,7 +345,7 @@ sql: queries: "postgresql/query.sql" engine: "postgresql" gen: - go: + go: package: "authors" out: "postgresql" - schema: "mysql/schema.sql" @@ -418,6 +420,8 @@ Each mapping in the `packages` collection has the following keys: - Either `postgresql` or `mysql`. Defaults to `postgresql`. - `sql_package`: - Either `pgx/v4`, `pgx/v5` or `database/sql`. Defaults to `database/sql`. +- `overrides`: + - A list of type override configurations. See the [Overriding types](../howto/overrides.md) guide for details. - `emit_db_tags`: - If true, add DB tags to generated structs. Defaults to `false`. - `emit_prepared_queries`: @@ -439,7 +443,9 @@ Each mapping in the `packages` collection has the following keys: - `emit_methods_with_db_argument`: - If true, generated methods will accept a DBTX argument instead of storing a DBTX on the `*Queries` struct. Defaults to `false`. - `emit_pointers_for_null_types`: - - If true and `sql_package` is set to `pgx/v4` or `pgx/v5`, generated types for nullable columns are emitted as pointers (ie. `*string`) instead of `database/sql` null types (ie. `NullString`). Defaults to `false`. + - If true and `sql_package` is set to `pgx/v4` or `pgx/v5`, generated types for nullable columns are emitted as pointers (ie. `*string`) instead of `database/sql` null types (ie. `NullString`). Defaults to `false`. Nullable enum columns also follow this setting unless `emit_pointers_for_null_enum_types` is set. +- `emit_pointers_for_null_enum_types`: + - Overrides `emit_pointers_for_null_types` for nullable enum columns only. When `true`, nullable enum columns are emitted as pointers (ie. `*UserRole`). When `false`, nullable enum columns use the generated `NullUserRole` wrapper struct even if `emit_pointers_for_null_types` is true. Set this to `false` to keep the pre-v1.31 behavior when upgrading. Only applies to PostgreSQL with `sql_package` `pgx/v4` or `pgx/v5`. - `emit_enum_valid_method`: - If true, generate a Valid method on enum types, indicating whether a string is a valid enum value. @@ -469,78 +475,7 @@ Each mapping in the `packages` collection has the following keys: ### overrides -The default mapping of PostgreSQL/MySQL types to Go types only uses packages outside -the standard library when it must. - -For example, the `uuid` PostgreSQL type is mapped to `github.com/google/uuid`. -If a different Go package for UUIDs is required, specify the package in the -`overrides` array. In this case, I'm going to use the `github.com/gofrs/uuid` -instead. - -```yaml -version: "1" -packages: [...] -overrides: - - go_type: "github.com/gofrs/uuid.UUID" - db_type: "uuid" -``` - -Each override document has the following keys: - -- `db_type`: - - The PostgreSQL or MySQL type to override. Find the full list of supported types in [postgresql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/postgresql_type.go#L12) or [mysql_type.go](https://github.com/sqlc-dev/sqlc/blob/main/internal/codegen/golang/mysql_type.go#L12). Note that for Postgres you must use the pg_catalog prefixed names where available. -- `go_type`: - - A fully qualified name to a Go type to use in the generated code. -- `go_struct_tag`: - - A reflect-style struct tag to use in the generated code, e.g. `a:"b" x:"y,z"`. - If you want general json/db tags for all fields, use `emit_db_tags` and/or `emit_json_tags` instead. -- `nullable`: - - If true, use this type when a column is nullable. Defaults to `false`. - -Note that a single `db_type` override configuration applies to either nullable or non-nullable -columns, but not both. If you want a single `go_type` to override in both cases, you'll -need to specify two overrides. - -For more complicated import paths, the `go_type` can also be an object. - -```yaml -version: "1" -packages: [...] -overrides: - - db_type: "uuid" - go_type: - import: "a/b/v2" - package: "b" - type: "MyType" -``` - -#### Per-Column Type Overrides - -Sometimes you would like to override the Go type used in model or query generation for -a specific field of a table and not on a type basis as described in the previous section. - -This may be configured by specifying the `column` property in the override definition. `column` -should be of the form `table.column` but you can be even more specific by specifying `schema.table.column` -or `catalog.schema.table.column`. - -```yaml -version: "1" -packages: [...] -overrides: - - column: "authors.id" - go_type: "github.com/segmentio/ksuid.KSUID" -``` - -#### Package Level Overrides - -Overrides can be configured globally, as demonstrated in the previous sections, or they can be configured per-package which -scopes the override behavior to just a single package: - -```yaml -version: "1" -packages: - - overrides: [...] -``` +See the version 1 configuration section of the [Overriding types](../howto/overrides.md#version-1-configuration) guide for details. ### rename diff --git a/docs/reference/datatypes.md b/docs/reference/datatypes.md index 80b35bbfe6..651e1c0d37 100644 --- a/docs/reference/datatypes.md +++ b/docs/reference/datatypes.md @@ -4,7 +4,7 @@ database types to Go types. Choices for more complex types are described below. If you're unsatisfied with the default, you can override any type using the -[overrides list](./config.html#type-overriding) in your `sqlc` config file. +[overrides list](config.md#overrides) in your `sqlc` config file. ## Arrays @@ -27,12 +27,16 @@ type Place struct { } ``` -## Dates and Time +## Dates and times -All PostgreSQL time and date types are returned as `time.Time` structs. For +All date and time types are returned as `time.Time` structs. For null time or date values, the `NullTime` type from `database/sql` is used. + The `pgx/v5` sql package uses the appropriate pgx types. +For MySQL users relying on `github.com/go-sql-driver/mysql`, ensure that +`parseTime=true` is added to your database connection string. + ```sql CREATE TABLE authors ( id SERIAL PRIMARY KEY, @@ -58,7 +62,7 @@ type Author struct { ## Enums -PostgreSQL [enums](https://www.postgresql.org/docs/current/arrays.html) are +PostgreSQL [enums](https://www.postgresql.org/docs/current/datatype-enum.html) are mapped to an aliased string type. ```sql @@ -118,8 +122,8 @@ type Author struct { ## UUIDs -The Go standard library does not come with a `uuid` package. For UUID support, -sqlc uses the excellent `github.com/google/uuid` package. The pgx/v5 sql package uses `pgtype.UUID`. +For UUID support, sqlc uses the `github.com/google/uuid` package by default. +The pgx/v5 sql package uses `pgtype.UUID`. ```sql CREATE TABLE records ( @@ -139,7 +143,73 @@ type Author struct { } ``` -For MySQL, there is no native `uuid` data type. When using `UUID_TO_BIN` to store a `UUID()`, the underlying field type is `BINARY(16)` which by default sqlc would interpret this to `sql.NullString`. To have sqlc automatically convert these fields to a `uuid.UUID` type, use an overide on the column storing the `uuid`. +### Using the standard library uuid package + +Go 1.27 added a [`uuid`](https://pkg.go.dev/uuid) package to the standard +library. sqlc will use this package by default in a future release. Until +then, use it today with type overrides +(see [Overriding types](../howto/overrides.md) for details). + +Two overrides are required: one for non-nullable columns and one for nullable +columns. The standard library does not include a `NullUUID` type, so nullable +columns map to `*uuid.UUID` instead. + +```yaml +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "db" + out: "db" + sql_package: "pgx/v5" + overrides: + - db_type: "uuid" + go_type: "uuid.UUID" + - db_type: "uuid" + nullable: true + go_type: + import: "uuid" + type: "UUID" + pointer: true +``` + +With this configuration, a table with both nullable and non-nullable `uuid` +columns: + +```sql +CREATE TABLE records ( + id uuid PRIMARY KEY, + external_id uuid +); +``` + +generates: + +```go +package db + +import ( + "uuid" +) + +type Record struct { + ID uuid.UUID + ExternalID *uuid.UUID +} +``` + +These overrides work with both the `pgx/v5` and `database/sql` sql packages. +pgx supports any type whose underlying type is `[16]byte`, and as of Go 1.27 +`database/sql` converts `uuid.UUID` values in both directions: parameters are +bound via `driver.DefaultParameterConverter` and results are scanned into +`uuid.UUID` and `*uuid.UUID` destinations, with `nil` representing `NULL`. + +For MySQL, there is no native `uuid` data type. When using `UUID_TO_BIN` to store a `UUID()`, the underlying field type is `BINARY(16)` which by default sqlc would map to `sql.NullString`. To have sqlc automatically convert these fields to a `uuid.UUID` type, use an overide on the column storing the `uuid` +(see [Overriding types](../howto/overrides.md) for details). + ```json { "overrides": [ @@ -154,8 +224,9 @@ For MySQL, there is no native `uuid` data type. When using `UUID_TO_BIN` to stor ## JSON By default, sqlc will generate the `[]byte`, `pgtype.JSON` or `json.RawMessage` for JSON column type. -But if you use the `pgx/v5` sql package then you can specify a some struct instead of default type. -The `pgx` implementation will marshall/unmarshall the struct automatically. +But if you use the `pgx/v5` sql package then you can specify a struct instead of the default type +(see [Overriding types](../howto/overrides.md) for details). +The `pgx` implementation will marshal/unmarshal the struct automatically. ```go package dto @@ -179,9 +250,10 @@ CREATE TABLE books ( { "column": "books.data", "go_type": { - "import":"example/db", + "import":"example.com/db", "package": "dto", - "type":"BookData" + "type":"BookData", + "pointer": true } } ] @@ -200,12 +272,83 @@ type Book struct { } ``` +## TEXT + +In PostgreSQL, when you have a column with the TEXT type, sqlc will map it to a Go string by default. This default mapping applies to `TEXT` columns that are not nullable. However, for nullable `TEXT` columns, sqlc maps them to `pgtype.Text` when using the pgx/v5 driver. This distinction is crucial for developers looking to handle null values appropriately in their Go applications. + +To accommodate nullable strings and map them to `*string` in Go, you can use the `emit_pointers_for_null_types` option in your sqlc configuration. This option ensures that nullable SQL columns are represented as pointer types in Go, allowing for a clear distinction between null and non-null values. Another way to do this is by passing the option `pointer: true` when you are overriding the `TEXT` datatype in your sqlc config file (see [Overriding types](../howto/overrides.md) for details). + ## Geometry ### PostGIS +#### Using `github.com/twpayne/go-geos` (pgx/v5 only) + +sqlc can be configured to use the [geos](https://github.com/twpayne/go-geos) +package for working with PostGIS geometry types in [GEOS](https://libgeos.org/). + +There are three steps: + +1. Configure sqlc to use `*github.com/twpayne/go-geos.Geom` for geometry types (see [Overriding types](../howto/overrides.md) for details). +2. Call `github.com/twpayne/pgx-geos.Register` on each + `*github.com/jackc/pgx/v5.Conn`. +3. Annotate your SQL with `::geometry` typecasts, if needed. + +```sql +-- Multipolygons in British National Grid (epsg:27700) +create table shapes( + id serial, + name varchar, + geom geometry(Multipolygon, 27700) +); + +-- name: GetCentroids :many +SELECT id, name, ST_Centroid(geom)::geometry FROM shapes; +``` + +```json +{ + "version": 2, + "gen": { + "go": { + "overrides": [ + { + "db_type": "geometry", + "go_type": { + "import": "github.com/twpayne/go-geos", + "package": "geos", + "pointer": true, + "type": "Geom" + }, + "nullable": true + } + ] + } + } +} +``` + +```go +import ( + "github.com/twpayne/go-geos" + pgxgeos "github.com/twpayne/pgx-geos" +) + +// ... + +config.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error { + if err := pgxgeos.Register(ctx, conn, geos.NewContext()); err != nil { + return err + } + return nil +} +``` + + +#### Using `github.com/twpayne/go-geom` + sqlc can be configured to use the [geom](https://github.com/twpayne/go-geom) -package for working with PostGIS geometry types. +package for working with PostGIS geometry types. See [Overriding types](../howto/overrides.md) for more information. ```sql -- Multipolygons in British National Grid (epsg:27700) @@ -234,12 +377,12 @@ SELECT * FROM shapes; { "db_type": "geometry", "go_type": "github.com/twpayne/go-geom.MultiPolygon" - }, - { + }, + { "db_type": "geometry", - "go_type": "github.com/twpayne/go-geom.MultiPolygon", - "null": true - } + "go_type": "github.com/twpayne/go-geom.MultiPolygon", + "nullable": true + } ] } -``` \ No newline at end of file +``` diff --git a/docs/reference/environment-variables.md b/docs/reference/environment-variables.md index 185807168c..dde6b40812 100644 --- a/docs/reference/environment-variables.md +++ b/docs/reference/environment-variables.md @@ -1,12 +1,54 @@ # Environment variables +## SQLCEXPERIMENT + +The `SQLCEXPERIMENT` variable controls experimental features within sqlc. It is +a comma-separated list of experiment names. This is modeled after Go's +[GOEXPERIMENT](https://pkg.go.dev/internal/goexperiment) environment variable. + +Experiment names can be prefixed with `no` to explicitly disable them. + +``` +SQLCEXPERIMENT=foo,bar # enable foo and bar experiments +SQLCEXPERIMENT=nofoo # explicitly disable foo experiment +SQLCEXPERIMENT=foo,nobar # enable foo, disable bar +``` + +The following experiments are defined: + +### coreanalyzer + +Routes `sqlc generate` through the core catalog and analyzer instead of each +engine's own analysis path. This is the same analysis used by `sqlc analyze`, +and the only analysis path for the ClickHouse and GoogleSQL engines. + +``` +SQLCEXPERIMENT=coreanalyzer +``` + ## SQLCCACHE The `SQLCCACHE` environment variable dictates where `sqlc` will store cached -WASM-based plugins and modules. By default `sqlc` follows the [XDG Base -Directory +data. By default `sqlc` follows the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). +The cache is designed after Bazel's local disk cache and has three parts: + +- `cas/` — a content-addressable store holding blobs (query analysis + results, WASM plugin binaries, compiled WASM machine code) keyed by the + SHA-256 hash of their contents. A remotely fetched plugin's address is + exactly the checksum declared in the configuration file, so it is loaded + directly by that address. +- `ac/` — an action cache mapping the digest of a unit of cacheable work and + its inputs (analyzing a query against a schema, compiling a WASM module to + machine code) to the CAS digests of its outputs. +- `exec/` — per-action directories where cached output trees are + materialized for tools that read them from disk, such as the + [wazero](https://wazero.io) runtime's compilation cache. + +The entire directory is safe to delete at any time; sqlc will rebuild it as +needed. + ## SQLCDEBUG The `SQLCDEBUG` variable controls debugging variables within the runtime. It is diff --git a/docs/reference/language-support.md b/docs/reference/language-support.md new file mode 100644 index 0000000000..02670ef54e --- /dev/null +++ b/docs/reference/language-support.md @@ -0,0 +1,45 @@ +# Database and language support + +| Language | Plugin | MySQL | PostgreSQL | SQLite | ClickHouse | DuckDB | Spanner | SQL Server | +| ---------- | ---------------------------------------------------------------------- | ------ | ---------- | ------ | ---------- | ------ | ------- | ---------- | +| Go | (built-in) | Stable | Stable | Beta | Beta | Beta | Beta | Beta | +| Go | [sqlc-gen-go](https://github.com/sqlc-dev/sqlc-gen-go) | Stable | Stable | Beta | N/A | N/A | N/A | N/A | +| Kotlin | [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) | Beta | Beta | N/A | N/A | N/A | N/A | N/A | +| Python | [sqlc-gen-python](https://github.com/sqlc-dev/sqlc-gen-python) | Beta | Beta | N/A | N/A | N/A | N/A | N/A | +| TypeScript | [sqlc-gen-typescript](https://github.com/sqlc-dev/sqlc-gen-typescript) | Beta | Beta | N/A | N/A | N/A | N/A | N/A | + +The built-in Go generator targets `database/sql` for ClickHouse, DuckDB, +Spanner and SQL Server, with the types their drivers hand back: +[clickhouse-go](https://github.com/ClickHouse/clickhouse-go), +[duckdb-go](https://github.com/duckdb/duckdb-go), +[go-sql-spanner](https://github.com/googleapis/go-sql-spanner) and +[go-mssqldb](https://github.com/microsoft/go-mssqldb). DuckDB enums and SQL +Server alias types are not yet resolved and come out as `any`; ClickHouse +enums are strings. A DuckDB JSON column comes out as `any`, holding the value +the driver decodes the document into, and a JSON parameter is passed as its +text. + +## Community language support + +New languages can be added via [plugins](../guides/plugins.md). + +| Language | Plugin | MySQL | PostgreSQL | SQLite | +| -------- | ------------------------------------------------------------------------------------- | ------ | ---------- | ------ | +| C# | [DaredevilOSS/sqlc-gen-csharp](https://github.com/DaredevilOSS/sqlc-gen-csharp) | Stable | Stable | Stable | +| F# | [kaashyapan/sqlc-gen-fsharp](https://github.com/kaashyapan/sqlc-gen-fsharp) | N/A | Beta | Beta | +| Java | [tandemdude/sqlc-gen-java](https://github.com/tandemdude/sqlc-gen-java) | Beta | Beta | N/A | +| PHP | [lcarilla/sqlc-plugin-php-dbal](https://github.com/lcarilla/sqlc-plugin-php-dbal) | Beta | N/A | N/A | +| Ruby | [DaredevilOSS/sqlc-gen-ruby](https://github.com/DaredevilOSS/sqlc-gen-ruby) | Beta | Beta | Beta | +| Zig | [tinyzimmer/sqlc-gen-zig](https://github.com/tinyzimmer/sqlc-gen-zig) | N/A | Beta | Beta | +| Python | [rayakame/sqlc-gen-better-python](https://github.com/rayakame/sqlc-gen-better-python) | Beta | Stable | Stable | +| Rust | [mathematic-inc/sqlc-gen-sqlx](https://github.com/mathematic-inc/sqlc-gen-sqlx) | N/A | Beta | N/A | +| \[Any\] | [fdietze/sqlc-gen-from-template](https://github.com/fdietze/sqlc-gen-from-template) | Stable | Stable | Stable | + +Plugins developed by our Community can also be found using our +[github topic](https://github.com/topics/sqlc-plugin). + +## Community projects + +| Language | Project | MySQL | PostgreSQL | SQLite | +| -------- | ----------------------------------------------------------------- | ------ | ---------- | ------ | +| Gleam | [daniellionel01/parrot](https://github.com/daniellionel01/parrot) | Stable | Stable | Stable | diff --git a/docs/reference/language-support.rst b/docs/reference/language-support.rst deleted file mode 100644 index 37a4e192b6..0000000000 --- a/docs/reference/language-support.rst +++ /dev/null @@ -1,29 +0,0 @@ -Database and language support -############################# - -======== =================== ============ ============ =============== -Language Plugin MySQL PostgreSQL SQLite -======== =================== ============ ============ =============== -Go (built-in) Stable Stable Beta -Kotlin `sqlc-gen-kotlin`_ Beta Beta Not implemented -Python `sqlc-gen-python`_ Beta Beta Not implemented -======== =================== ============ ============ =============== - -Community language support -************************** - -======== ============================== =============== ============ =============== -Language Plugin MySQL PostgreSQL SQLite -======== ============================== =============== ============ =============== -F# `kaashyapan/sqlc-gen-fsharp`_ Not implemented Beta Beta -======== ============================== =============== ============ =============== - -.. _kaashyapan/sqlc-gen-fsharp: https://github.com/kaashyapan/sqlc-gen-fsharp -.. _sqlc-gen-kotlin: https://github.com/sqlc-dev/sqlc-gen-kotlin -.. _sqlc-gen-python: https://github.com/sqlc-dev/sqlc-gen-python - -Future language support -************************ - -- `C# `_ -- `TypeScript `_ diff --git a/docs/reference/macros.md b/docs/reference/macros.md index 7c8bc67842..54d44ed5c9 100644 --- a/docs/reference/macros.md +++ b/docs/reference/macros.md @@ -20,7 +20,7 @@ FROM authors WHERE lower(name) = ?; ``` -See more examples in [Naming parameters](../howto/named_parameters). +See more examples in [Naming parameters](../howto/named_parameters.md). ## `sqlc.embed` @@ -72,7 +72,7 @@ func (q *Queries) GetStudentAndScore(ctx context.Context, id int64) (GetStudentA } ``` -See a full example in [Embedding structs](../howto/embedding). +See a full example in [Embedding structs](../howto/embedding.md). ## `sqlc.narg` @@ -92,7 +92,7 @@ FROM authors WHERE LOWER(name) = ?; ``` -See more examples in [Naming parameters](../howto/named_parameters). +See more examples in [Naming parameters](../howto/named_parameters.md). ## `sqlc.slice` @@ -116,4 +116,4 @@ Since the `/*SLICE:ages*/` placeholder is dynamically replaced on a per-query basis, this macro can't be used with prepared statements. See a full example in [Passing a slice as a parameter to a -query](../howto/select.html#mysql-and-sqlite). \ No newline at end of file +query](../howto/select.md#mysql-and-sqlite). diff --git a/docs/reference/query-annotations.md b/docs/reference/query-annotations.md index 0045f49fa7..4fabe05aae 100644 --- a/docs/reference/query-annotations.md +++ b/docs/reference/query-annotations.md @@ -222,3 +222,9 @@ func (b *CreateBookBatchResults) Close() error { //... } ``` + +## `:copyfrom` + +__NOTE: This command is driver and package specific, see [how to insert](../howto/insert.md#using-copyfrom) + +This command is used to insert rows a lot faster than sequential inserts. diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 3a2b3a1b21..0000000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,27 +0,0 @@ -alabaster==0.7.13 -Babel==2.13.0 -certifi==2023.7.22 -chardet==5.2.0 -commonmark==0.9.1 -docutils==0.18.1 -idna==3.4 -imagesize==1.4.1 -Jinja2==3.1.2 -MarkupSafe==2.1.3 -myst-parser==2.0.0 -packaging==23.2 -Pygments==2.16.1 -pyparsing==3.1.1 -pytz==2023.3.post1 -requests==2.31.0 -snowballstemmer==2.2.0 -Sphinx==6.2.1 -sphinx-favicon==1.0.1 -sphinx-rtd-theme==1.3.0 -sphinxcontrib-applehelp==1.0.7 -sphinxcontrib-devhelp==1.0.5 -sphinxcontrib-serializinghtml==1.1.9 -sphinxcontrib-htmlhelp==2.0.4 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.6 -urllib3==2.0.6 diff --git a/docs/toc.yaml b/docs/toc.yaml new file mode 100644 index 0000000000..464fe334de --- /dev/null +++ b/docs/toc.yaml @@ -0,0 +1,72 @@ +# Navigation for the sqlc documentation site. +# +# Every page in docs/ must appear exactly once, either in a section or in +# the unlisted set. Unlisted pages are published but do not appear in the +# sidebar. + +index: index.md + +sections: + - title: Overview + pages: + - overview/install.md + + - title: Tutorials + pages: + - tutorials/getting-started-mysql.md + - tutorials/getting-started-postgresql.md + - tutorials/getting-started-sqlite.md + + - title: Commands + pages: + - howto/analyze.md + - howto/fmt.md + - howto/generate.md + - howto/parse.md + - howto/push.md + - howto/verify.md + - howto/vet.md + + - title: How-to Guides + pages: + - howto/select.md + - howto/query_count.md + - howto/insert.md + - howto/update.md + - howto/delete.md + - howto/prepared_query.md + - howto/transactions.md + - howto/named_parameters.md + - howto/ddl.md + - howto/structs.md + - howto/embedding.md + - howto/overrides.md + - howto/rename.md + + - title: sqlc Cloud + pages: + - howto/managed-databases.md + + - title: Reference + pages: + - reference/changelog.md + - reference/cli.md + - reference/config.md + - reference/datatypes.md + - reference/environment-variables.md + - reference/language-support.md + - reference/macros.md + - reference/query-annotations.md + + - title: Conceptual Guides + pages: + - howto/ci-cd.md + - guides/using-go-and-pgx.md + - guides/plugins.md + - guides/development.md + - guides/privacy.md + +unlisted: + - guides/migrating-off-hosted-managed-databases.md + - guides/migrating-to-sqlc-gen-kotlin.md + - guides/migrating-to-sqlc-gen-python.md diff --git a/docs/tutorials/getting-started-mysql.md b/docs/tutorials/getting-started-mysql.md index 4fa55d713c..25e7d6182c 100644 --- a/docs/tutorials/getting-started-mysql.md +++ b/docs/tutorials/getting-started-mysql.md @@ -3,9 +3,18 @@ This tutorial assumes that the latest version of sqlc is [installed](../overview/install.md) and ready to use. +We'll generate Go code here, but other +[language plugins](../reference/language-support.md) are available. You'll +naturally need the Go toolchain if you want to build and run a program with the +code sqlc generates, but sqlc itself has no dependencies. + +At the end, you'll push your SQL queries to [sqlc Cloud](https://dashboard.sqlc.dev/) for further insights and analysis. + +## Setting up + Create a new directory called `sqlc-tutorial` and open it up. -Initialize a new Go module named `tutorial.sql.dev/app` +Initialize a new Go module named `tutorial.sqlc.dev/app` ```shell go mod init tutorial.sqlc.dev/app @@ -16,7 +25,7 @@ directory. In our new directory, create a file named `sqlc.yaml` with the following contents: ```yaml -version: 2 +version: "2" sql: - engine: "mysql" queries: "query.sql" @@ -27,8 +36,11 @@ sql: out: "tutorial" ``` -sqlc needs to know your database schema and queries. In the same directory, -create a file named `schema.sql` with the following contents: +## Schema and queries + +sqlc needs to know your database schema and queries in order to generate code. +In the same directory, create a file named `schema.sql` with the following +content: ```sql CREATE TABLE authors ( @@ -61,13 +73,17 @@ DELETE FROM authors WHERE id = ?; ``` -You are now ready to generate code. Run the `generate` command. You shouldn't see any errors or output. +## Generating code + +You are now ready to generate code. You shouldn't see any output when you run +the `generate` subcommand, unless something goes wrong: ```shell sqlc generate ``` -You should now have a `tutorial` package containing three files. +You should now have a `tutorial` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: ``` ├── go.mod @@ -80,7 +96,10 @@ You should now have a `tutorial` package containing three files. └── query.sql.go ``` -You can use your newly generated queries in `app.go`. +## Using generated code + +You can use your newly-generated `tutorial` package from any Go program. +Create a file named `tutorial.go` and add the following contents: ```go package main @@ -91,9 +110,9 @@ import ( "log" "reflect" - "tutorial.sqlc.dev/app/tutorial" - _ "github.com/go-sql-driver/mysql" + + "tutorial.sqlc.dev/app/tutorial" ) func run() error { @@ -146,17 +165,57 @@ func main() { } ``` -Before the code will compile, you'll need to add the Go MySQL driver. +Before this code will compile you'll need to fetch the relevant MySQL driver: -``` +```shell go get github.com/go-sql-driver/mysql -go build ./... +go build . ``` -To make that possible, sqlc generates readable, **idiomatic** Go code that you -otherwise would have had to write yourself. Take a look in `tutorial/query.sql.go`. +The program should compile without errors. To make that possible, sqlc generates +readable, **idiomatic** Go code that you otherwise would've had to write +yourself. Take a look in `tutorial/query.sql.go`. + +Of course for this program to run successfully you'll need +to compile after replacing the database connection parameters in the call to +`sql.Open()` with the correct parameters for your database. And your +database must have the `authors` table as defined in `schema.sql`. + +You should now have a working program using sqlc's generated Go source code, +and hopefully can see how you'd use sqlc in your own real-world applications. -If your tables have columns with date or time types, sqlc expects these values -to scan into `time.Time` structs. If you're using -`github.com/go-sql-driver/mysql`, ensure that `parseTime=true` has been added to -the connection string. +## Query verification + +[sqlc Cloud](https://dashboard.sqlc.dev) provides additional verification, catching subtle bugs. To get started, create a +[dashboard account](https://dashboard.sqlc.dev). Once you've signed in, create a +project and generate an auth token. Add your project's ID to the `cloud` block +to your sqlc.yaml. + + +```yaml +version: "2" +cloud: + # Replace with your project ID from the sqlc Cloud dashboard + project: "" +sql: + - engine: "mysql" + queries: "query.sql" + schema: "schema.sql" + gen: + go: + package: "tutorial" + out: "tutorial" +``` + +Replace `` with your project ID from the sqlc Cloud dashboard. It +will look something like `01HA8SZH31HKYE9RR3N3N3TSJM`. + +And finally, set the `SQLC_AUTH_TOKEN` environment variable: + +```shell +export SQLC_AUTH_TOKEN="" +``` + +```shell +$ sqlc push --tag tutorial +``` diff --git a/docs/tutorials/getting-started-postgresql.md b/docs/tutorials/getting-started-postgresql.md index 9f7d09a1a4..d6045cffbd 100644 --- a/docs/tutorials/getting-started-postgresql.md +++ b/docs/tutorials/getting-started-postgresql.md @@ -3,9 +3,19 @@ This tutorial assumes that the latest version of sqlc is [installed](../overview/install.md) and ready to use. +We'll generate Go code here, but other +[language plugins](../reference/language-support.md) are available. You'll +naturally need the Go toolchain if you want to build and run a program with the +code sqlc generates, but sqlc itself has no dependencies. + +At the end, you'll push your SQL queries to [sqlc +Cloud](https://dashboard.sqlc.dev/) for further insights and analysis. + +## Setting up + Create a new directory called `sqlc-tutorial` and open it up. -Initialize a new Go module named `tutorial.sqlc.dev/app` +Initialize a new Go module named `tutorial.sqlc.dev/app`: ```shell go mod init tutorial.sqlc.dev/app @@ -25,8 +35,11 @@ sql: go: package: "tutorial" out: "tutorial" + sql_package: "pgx/v5" ``` +## Schema and queries + sqlc needs to know your database schema and queries in order to generate code. In the same directory, create a file named `schema.sql` with the following content: @@ -39,7 +52,7 @@ CREATE TABLE authors ( ); ``` -Next, create a `query.sql` file with the following four queries: +Next, create a `query.sql` file with the following five queries: ```sql -- name: GetAuthor :one @@ -58,23 +71,19 @@ INSERT INTO authors ( ) RETURNING *; --- name: DeleteAuthor :exec -DELETE FROM authors -WHERE id = $1; -``` - -If you **do not** want your SQL `UPDATE` queries to return the updated record -to the user, add this to `query.sql`: - -```sql -- name: UpdateAuthor :exec UPDATE authors set name = $2, bio = $3 WHERE id = $1; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; ``` -Otherwise, to return the updated record to the user, add this to `query.sql`: +If you prefer, you can alter the `UpdateAuthor` query to return the updated +record: ```sql -- name: UpdateAuthor :one @@ -85,13 +94,17 @@ WHERE id = $1 RETURNING *; ``` -You are now ready to generate code. You shouldn't see any errors or output. +## Generating code + +You are now ready to generate code. You shouldn't see any output when you run +the `generate` subcommand, unless something goes wrong: ```shell sqlc generate ``` -You should now have a `tutorial` package containing three files. +You should now have a `tutorial` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: ``` ├── go.mod @@ -104,31 +117,35 @@ You should now have a `tutorial` package containing three files. └── query.sql.go ``` -You can use your newly generated queries in `app.go`. +## Using generated code + +You can use your newly-generated `tutorial` package from any Go program. +Create a file named `tutorial.go` and add the following contents: ```go package main import ( "context" - "database/sql" "log" "reflect" - "tutorial.sqlc.dev/app/tutorial" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" - _ "github.com/lib/pq" + "tutorial.sqlc.dev/app/tutorial" ) func run() error { ctx := context.Background() - db, err := sql.Open("postgres", "user=pqgotest dbname=pqgotest sslmode=verify-full") + conn, err := pgx.Connect(ctx, "user=pqgotest dbname=pqgotest sslmode=verify-full") if err != nil { return err } + defer conn.Close(ctx) - queries := tutorial.New(db) + queries := tutorial.New(conn) // list all authors authors, err := queries.ListAuthors(ctx) @@ -140,7 +157,7 @@ func run() error { // create an author insertedAuthor, err := queries.CreateAuthor(ctx, tutorial.CreateAuthorParams{ Name: "Brian Kernighan", - Bio: sql.NullString{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, + Bio: pgtype.Text{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, }) if err != nil { return err @@ -165,13 +182,67 @@ func main() { } ``` -Before the code will compile, you'll need to add the Go PostgreSQL driver. +Before this code will compile you'll need to fetch the relevant PostgreSQL +driver. You can use `lib/pq` with the standard library's `database/sql` +package, but in this tutorial we've used `pgx/v5`: +```shell +go get github.com/jackc/pgx/v5 +go build . ``` -go get github.com/lib/pq -go build ./... + +The program should compile without errors. To make that possible, sqlc generates +readable, **idiomatic** Go code that you otherwise would've had to write +yourself. Take a look in `tutorial/query.sql.go`. + +Of course for this program to run successfully you'll need +to compile after replacing the database connection parameters in the call to +`pgx.Connect()` with the correct parameters for your database. And your +database must have the `authors` table as defined in `schema.sql`. + +You should now have a working program using sqlc's generated Go source code, +and hopefully can see how you'd use sqlc in your own real-world applications. + +## Query verification + +[sqlc Cloud](https://dashboard.sqlc.dev) provides additional verification, catching subtle bugs. To get started, create a +[dashboard account](https://dashboard.sqlc.dev). Once you've signed in, create a +project and generate an auth token. Add your project's ID to the `cloud` block +to your sqlc.yaml. + +```yaml +version: "2" +cloud: + # Replace with your project ID from the sqlc Cloud dashboard + project: "" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "schema.sql" + gen: + go: + package: "tutorial" + out: "tutorial" + sql_package: "pgx/v5" ``` -sqlc generates readable, **idiomatic** Go code that you otherwise would have -had to write yourself. Take a look in the `tutorial` package to see what code -sqlc generated. +Replace `` with your project ID from the sqlc Cloud dashboard. It +will look something like `01HA8SZH31HKYE9RR3N3N3TSJM`. + +And finally, set the `SQLC_AUTH_TOKEN` environment variable: + +```shell +export SQLC_AUTH_TOKEN="" +``` + +```shell +$ sqlc push --tag tutorial +``` + +In the sidebar, go to the "Queries" section to see your published queries. Run +`verify` to ensure that previously published queries continue to work against +updated database schema. + +```shell +$ sqlc verify --against tutorial +``` diff --git a/docs/tutorials/getting-started-sqlite.md b/docs/tutorials/getting-started-sqlite.md index 28f0669ea3..e5b45f86f1 100644 --- a/docs/tutorials/getting-started-sqlite.md +++ b/docs/tutorials/getting-started-sqlite.md @@ -3,9 +3,16 @@ This tutorial assumes that the latest version of sqlc is [installed](../overview/install.md) and ready to use. +We'll generate Go code here, but other +[language plugins](../reference/language-support.md) are available. You'll +naturally need the Go toolchain if you want to build and run a program with the +code sqlc generates, but sqlc itself has no dependencies. + +## Setting up + Create a new directory called `sqlc-tutorial` and open it up. -Initialize a new Go module named `tutorial.sql.dev/app` +Initialize a new Go module named `tutorial.sqlc.dev/app` ```shell go mod init tutorial.sqlc.dev/app @@ -16,19 +23,22 @@ directory. In our new directory, create a file named `sqlc.yaml` with the following contents: ```yaml -version: 2 +version: "2" sql: - engine: "sqlite" - schema: "schema.sql" queries: "query.sql" + schema: "schema.sql" gen: go: package: "tutorial" out: "tutorial" ``` -sqlc needs to know your database schema and queries. In the same directory, -create a file named `schema.sql` with the following contents: +## Schema and queries + +sqlc needs to know your database schema and queries in order to generate code. +In the same directory, create a file named `schema.sql` with the following +content: ```sql CREATE TABLE authors ( @@ -38,7 +48,7 @@ CREATE TABLE authors ( ); ``` -Next, create a `query.sql` file with the following four queries: +Next, create a `query.sql` file with the following five queries: ```sql -- name: GetAuthor :one @@ -57,22 +67,19 @@ INSERT INTO authors ( ) RETURNING *; --- name: DeleteAuthor :exec -DELETE FROM authors -WHERE id = ?; -``` - -For SQL UPDATE if you do not want to return the updated record to the user, add this to the `query.sql` file: - -```sql -- name: UpdateAuthor :exec UPDATE authors set name = ?, bio = ? WHERE id = ?; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; ``` -Otherwise, to return the updated record back to the user, add this to the `query.sql` file: +If you prefer, you can alter the `UpdateAuthor` query to return the updated +record: ```sql -- name: UpdateAuthor :one @@ -83,13 +90,17 @@ WHERE id = ? RETURNING *; ``` -You are now ready to generate code. Run the `generate` command. You shouldn't see any errors or output. +## Generating code + +You are now ready to generate code. You shouldn't see any output when you run +the `generate` subcommand, unless something goes wrong: ```shell sqlc generate ``` -You should now have a `tutorial` package containing three files. +You should now have a `tutorial` subdirectory with three files containing Go +source code. These files comprise a Go package named `tutorial`: ``` ├── go.mod @@ -102,7 +113,10 @@ You should now have a `tutorial` package containing three files. └── query.sql.go ``` -You can use your newly generated queries in `app.go`. +## Using generated code + +You can use your newly-generated `tutorial` package from any Go program. +Create a file named `tutorial.go` and add the following contents: ```go package main @@ -110,14 +124,13 @@ package main import ( "context" "database/sql" + _ "embed" "log" "reflect" - "tutorial.sqlc.dev/app/tutorial" + _ "modernc.org/sqlite" - _ "embed" - - _ "github.com/mattn/go-sqlite3" + "tutorial.sqlc.dev/app/tutorial" ) //go:embed schema.sql @@ -126,7 +139,7 @@ var ddl string func run() error { ctx := context.Background() - db, err := sql.Open("sqlite3", ":memory:") + db, err := sql.Open("sqlite", ":memory:") if err != nil { return err } @@ -173,12 +186,16 @@ func main() { } ``` -Before the code will compile, you'll need to add the Go SQLite driver. +Before this code will compile you'll need to fetch the relevant SQLite driver: +```shell +go get modernc.org/sqlite +go build . ``` -go mod tidy -go build ./... -``` -To make that possible, sqlc generates readable, **idiomatic** Go code that you -otherwise would have had to write yourself. Take a look in `tutorial/query.sql.go`. +The program should compile without errors, and run successfully. To make that +possible, sqlc generates readable, **idiomatic** Go code that you +otherwise would've had to write yourself. Take a look in `tutorial/query.sql.go`. + +You should now have a working program using sqlc's generated Go source code, +and hopefully can see how you'd use sqlc in your own real-world applications. diff --git a/equinox.pub b/equinox.pub deleted file mode 100644 index f5a0c7e18c..0000000000 --- a/equinox.pub +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN ECDSA PUBLIC KEY----- -MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEDhl+JQVqmY5ZmFMyVDmuEOpr1ufM1SaH -3k/+e5eSvl6yMqTRkdt1i2X0zYJfOde/ho6DZ9CeGjscy4/CR5bhxAWPxggbjErf -Ta40WM9gdZI81uX8O5ES2DYYblQAiVRL ------END ECDSA PUBLIC KEY----- diff --git a/examples/authors/clickhouse/db.go b/examples/authors/clickhouse/db.go new file mode 100644 index 0000000000..32f660cdd7 --- /dev/null +++ b/examples/authors/clickhouse/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/examples/authors/clickhouse/db_test.go b/examples/authors/clickhouse/db_test.go new file mode 100644 index 0000000000..81130a1a57 --- /dev/null +++ b/examples/authors/clickhouse/db_test.go @@ -0,0 +1,58 @@ +//go:build examples + +package authors + +import ( + "context" + "database/sql" + "testing" + + _ "github.com/ClickHouse/clickhouse-go/v2" + + "github.com/sqlc-dev/sqlc/examples/internal/local" +) + +func TestAuthors(t *testing.T) { + ctx := context.Background() + uri := local.ClickHouse(t, []string{"schema.sql"}) + sdb, err := sql.Open("clickhouse", uri) + if err != nil { + t.Fatal(err) + } + defer sdb.Close() + + db := New(sdb) + + // list all authors + authors, err := db.ListAuthors(ctx) + if err != nil { + t.Fatal(err) + } + t.Log(authors) + + // create an author + bio := "Co-author of The C Programming Language and The Go Programming Language" + err = db.CreateAuthor(ctx, CreateAuthorParams{ + ID: 1, + Name: "Brian Kernighan", + Bio: &bio, + }) + if err != nil { + t.Fatal(err) + } + + // get the author we just inserted + fetchedAuthor, err := db.GetAuthor(ctx, 1) + if err != nil { + t.Fatal(err) + } + if fetchedAuthor.Name != "Brian Kernighan" || !fetchedAuthor.Bio.Valid { + t.Fatalf("unexpected author: %+v", fetchedAuthor) + } + t.Log(fetchedAuthor) + + // delete the author + if err := db.DeleteAuthor(ctx, 1); err != nil { + t.Fatal(err) + } +} diff --git a/examples/authors/clickhouse/models.go b/examples/authors/clickhouse/models.go new file mode 100644 index 0000000000..be87e6a8c9 --- /dev/null +++ b/examples/authors/clickhouse/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID uint64 + Name string + Bio sql.NullString +} diff --git a/examples/authors/clickhouse/query.sql b/examples/authors/clickhouse/query.sql new file mode 100644 index 0000000000..9a46a78320 --- /dev/null +++ b/examples/authors/clickhouse/query.sql @@ -0,0 +1,18 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ? LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :exec +INSERT INTO authors ( + id, name, bio +) VALUES ( + ?, ?, ? +); + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; diff --git a/examples/authors/clickhouse/query.sql.go b/examples/authors/clickhouse/query.sql.go new file mode 100644 index 0000000000..0dc7338b7e --- /dev/null +++ b/examples/authors/clickhouse/query.sql.go @@ -0,0 +1,79 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package authors + +import ( + "context" +) + +const createAuthor = `-- name: CreateAuthor :exec +INSERT INTO authors ( + id, name, bio +) VALUES ( + ?, ?, ? +); +` + +type CreateAuthorParams struct { + ID uint64 + Name string + Bio *string +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) error { + _, err := q.db.ExecContext(ctx, createAuthor, arg.ID, arg.Name, arg.Bio) + return err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id uint64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = ? LIMIT 1; +` + +func (q *Queries) GetAuthor(ctx context.Context, id uint64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name; +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/examples/authors/clickhouse/schema.sql b/examples/authors/clickhouse/schema.sql new file mode 100644 index 0000000000..548abb06aa --- /dev/null +++ b/examples/authors/clickhouse/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id UInt64, + name String, + bio Nullable(String) +) ENGINE = MergeTree ORDER BY id; diff --git a/examples/authors/duckdb/db.go b/examples/authors/duckdb/db.go new file mode 100644 index 0000000000..32f660cdd7 --- /dev/null +++ b/examples/authors/duckdb/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/examples/authors/duckdb/db_test.go b/examples/authors/duckdb/db_test.go new file mode 100644 index 0000000000..c413f9c1c7 --- /dev/null +++ b/examples/authors/duckdb/db_test.go @@ -0,0 +1,66 @@ +//go:build examples + +package authors + +import ( + "context" + "database/sql" + "os" + "testing" + + _ "github.com/duckdb/duckdb-go/v2" +) + +func TestAuthors(t *testing.T) { + ctx := context.Background() + + // DuckDB runs in the process: an empty data source is a database in + // memory that lives as long as the connection. + sdb, err := sql.Open("duckdb", "") + if err != nil { + t.Fatal(err) + } + defer sdb.Close() + + schema, err := os.ReadFile("schema.sql") + if err != nil { + t.Fatal(err) + } + if _, err := sdb.ExecContext(ctx, string(schema)); err != nil { + t.Fatal(err) + } + + db := New(sdb) + + // list all authors + authors, err := db.ListAuthors(ctx) + if err != nil { + t.Fatal(err) + } + t.Log(authors) + + // create an author + insertedAuthor, err := db.CreateAuthor(ctx, CreateAuthorParams{ + Name: "Brian Kernighan", + Bio: sql.NullString{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, + }) + if err != nil { + t.Fatal(err) + } + t.Log(insertedAuthor) + + // get the author we just inserted + fetchedAuthor, err := db.GetAuthor(ctx, insertedAuthor.ID) + if err != nil { + t.Fatal(err) + } + if fetchedAuthor.Name != "Brian Kernighan" || !fetchedAuthor.Bio.Valid { + t.Fatalf("unexpected author: %+v", fetchedAuthor) + } + t.Log(fetchedAuthor) + + // delete the author + if err := db.DeleteAuthor(ctx, insertedAuthor.ID); err != nil { + t.Fatal(err) + } +} diff --git a/examples/authors/duckdb/models.go b/examples/authors/duckdb/models.go new file mode 100644 index 0000000000..62bacd80ae --- /dev/null +++ b/examples/authors/duckdb/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/examples/authors/duckdb/query.sql b/examples/authors/duckdb/query.sql new file mode 100644 index 0000000000..971b8f902d --- /dev/null +++ b/examples/authors/duckdb/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; diff --git a/examples/authors/duckdb/query.sql.go b/examples/authors/duckdb/query.sql.go new file mode 100644 index 0000000000..56776cfb04 --- /dev/null +++ b/examples/authors/duckdb/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio; +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1; +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name; +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/examples/authors/duckdb/schema.sql b/examples/authors/duckdb/schema.sql new file mode 100644 index 0000000000..2aaf41db32 --- /dev/null +++ b/examples/authors/duckdb/schema.sql @@ -0,0 +1,7 @@ +CREATE SEQUENCE authors_id_seq; + +CREATE TABLE authors ( + id BIGINT PRIMARY KEY DEFAULT nextval('authors_id_seq'), + name TEXT NOT NULL, + bio TEXT +); diff --git a/examples/authors/googlesql/db.go b/examples/authors/googlesql/db.go new file mode 100644 index 0000000000..32f660cdd7 --- /dev/null +++ b/examples/authors/googlesql/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/examples/authors/googlesql/db_test.go b/examples/authors/googlesql/db_test.go new file mode 100644 index 0000000000..571ab7a274 --- /dev/null +++ b/examples/authors/googlesql/db_test.go @@ -0,0 +1,58 @@ +//go:build examples + +package authors + +import ( + "context" + "database/sql" + "testing" + + _ "github.com/googleapis/go-sql-spanner" + + "github.com/sqlc-dev/sqlc/examples/internal/local" +) + +func TestAuthors(t *testing.T) { + ctx := context.Background() + dsn := local.Spanner(t, []string{"schema.sql"}) + sdb, err := sql.Open("spanner", dsn) + if err != nil { + t.Fatal(err) + } + defer sdb.Close() + + db := New(sdb) + + // list all authors + authors, err := db.ListAuthors(ctx) + if err != nil { + t.Fatal(err) + } + t.Log(authors) + + // create an author + insertedAuthor, err := db.CreateAuthor(ctx, CreateAuthorParams{ + ID: 1, + Name: "Brian Kernighan", + Bio: sql.NullString{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, + }) + if err != nil { + t.Fatal(err) + } + t.Log(insertedAuthor) + + // get the author we just inserted + fetchedAuthor, err := db.GetAuthor(ctx, insertedAuthor.ID) + if err != nil { + t.Fatal(err) + } + if fetchedAuthor.Name != "Brian Kernighan" || !fetchedAuthor.Bio.Valid { + t.Fatalf("unexpected author: %+v", fetchedAuthor) + } + t.Log(fetchedAuthor) + + // delete the author + if err := db.DeleteAuthor(ctx, insertedAuthor.ID); err != nil { + t.Fatal(err) + } +} diff --git a/examples/authors/googlesql/models.go b/examples/authors/googlesql/models.go new file mode 100644 index 0000000000..62bacd80ae --- /dev/null +++ b/examples/authors/googlesql/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/examples/authors/googlesql/query.sql b/examples/authors/googlesql/query.sql new file mode 100644 index 0000000000..f135f66557 --- /dev/null +++ b/examples/authors/googlesql/query.sql @@ -0,0 +1,18 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = @id; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + id, name, bio +) VALUES ( + @id, @name, @bio +) THEN RETURN id, name, bio; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = @id; diff --git a/examples/authors/googlesql/query.sql.go b/examples/authors/googlesql/query.sql.go new file mode 100644 index 0000000000..146182516b --- /dev/null +++ b/examples/authors/googlesql/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + id, name, bio +) VALUES ( + @id, @name, @bio +) THEN RETURN id, name, bio +` + +type CreateAuthorParams struct { + ID int64 + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, sql.Named("id", arg.ID), sql.Named("name", arg.Name), sql.Named("bio", arg.Bio)) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = @id +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, sql.Named("id", id)) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = @id +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, sql.Named("id", id)) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/examples/authors/googlesql/schema.sql b/examples/authors/googlesql/schema.sql new file mode 100644 index 0000000000..d044b8e4b7 --- /dev/null +++ b/examples/authors/googlesql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + bio STRING(MAX), +) PRIMARY KEY (id); diff --git a/examples/authors/mssql/db.go b/examples/authors/mssql/db.go new file mode 100644 index 0000000000..32f660cdd7 --- /dev/null +++ b/examples/authors/mssql/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/examples/authors/mssql/db_test.go b/examples/authors/mssql/db_test.go new file mode 100644 index 0000000000..ee04932205 --- /dev/null +++ b/examples/authors/mssql/db_test.go @@ -0,0 +1,57 @@ +//go:build examples + +package authors + +import ( + "context" + "database/sql" + "testing" + + _ "github.com/microsoft/go-mssqldb" + + "github.com/sqlc-dev/sqlc/examples/internal/local" +) + +func TestAuthors(t *testing.T) { + ctx := context.Background() + uri := local.MSSQL(t, []string{"schema.sql"}) + sdb, err := sql.Open("sqlserver", uri) + if err != nil { + t.Fatal(err) + } + defer sdb.Close() + + db := New(sdb) + + // list all authors + authors, err := db.ListAuthors(ctx) + if err != nil { + t.Fatal(err) + } + t.Log(authors) + + // create an author + insertedAuthor, err := db.CreateAuthor(ctx, CreateAuthorParams{ + Name: "Brian Kernighan", + Bio: sql.NullString{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, + }) + if err != nil { + t.Fatal(err) + } + t.Log(insertedAuthor) + + // get the author we just inserted + fetchedAuthor, err := db.GetAuthor(ctx, insertedAuthor.ID) + if err != nil { + t.Fatal(err) + } + if fetchedAuthor.Name != "Brian Kernighan" || !fetchedAuthor.Bio.Valid { + t.Fatalf("unexpected author: %+v", fetchedAuthor) + } + t.Log(fetchedAuthor) + + // delete the author + if err := db.DeleteAuthor(ctx, insertedAuthor.ID); err != nil { + t.Fatal(err) + } +} diff --git a/examples/authors/mssql/models.go b/examples/authors/mssql/models.go new file mode 100644 index 0000000000..62bacd80ae --- /dev/null +++ b/examples/authors/mssql/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/examples/authors/mssql/query.sql b/examples/authors/mssql/query.sql new file mode 100644 index 0000000000..f7ef34d4ad --- /dev/null +++ b/examples/authors/mssql/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = @id; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) OUTPUT INSERTED.id, INSERTED.name, INSERTED.bio +VALUES ( + @name, @bio +); + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = @id; diff --git a/examples/authors/mssql/query.sql.go b/examples/authors/mssql/query.sql.go new file mode 100644 index 0000000000..beed275eba --- /dev/null +++ b/examples/authors/mssql/query.sql.go @@ -0,0 +1,82 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) OUTPUT INSERTED.id, INSERTED.name, INSERTED.bio +VALUES ( + @name, @bio +); +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, sql.Named("name", arg.Name), sql.Named("bio", arg.Bio)) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = @id; +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, sql.Named("id", id)) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = @id; +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, sql.Named("id", id)) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name; +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/examples/authors/mssql/schema.sql b/examples/authors/mssql/schema.sql new file mode 100644 index 0000000000..f26604843e --- /dev/null +++ b/examples/authors/mssql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT IDENTITY(1,1) PRIMARY KEY, + name NVARCHAR(100) NOT NULL, + bio NVARCHAR(MAX) +); diff --git a/examples/authors/mysql/db.go b/examples/authors/mysql/db.go index f5d9de7305..32f660cdd7 100644 --- a/examples/authors/mysql/db.go +++ b/examples/authors/mysql/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/examples/authors/mysql/db_test.go b/examples/authors/mysql/db_test.go index 26f3035b34..96ec363f77 100644 --- a/examples/authors/mysql/db_test.go +++ b/examples/authors/mysql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package authors @@ -8,14 +7,20 @@ import ( "database/sql" "testing" - "github.com/sqlc-dev/sqlc/internal/sqltest" + _ "github.com/go-sql-driver/mysql" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestAuthors(t *testing.T) { - sdb, cleanup := sqltest.MySQL(t, []string{"schema.sql"}) - defer cleanup() - ctx := context.Background() + uri := local.MySQL(t, []string{"schema.sql"}) + sdb, err := sql.Open("mysql", uri) + if err != nil { + t.Fatal(err) + } + defer sdb.Close() + db := New(sdb) // list all authors diff --git a/examples/authors/mysql/models.go b/examples/authors/mysql/models.go index ec61702f5a..62bacd80ae 100644 --- a/examples/authors/mysql/models.go +++ b/examples/authors/mysql/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors diff --git a/examples/authors/mysql/query.sql.go b/examples/authors/mysql/query.sql.go index 450f519d35..0d66af757f 100644 --- a/examples/authors/mysql/query.sql.go +++ b/examples/authors/mysql/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package authors diff --git a/examples/authors/postgresql/db.go b/examples/authors/postgresql/db.go index f5d9de7305..fc39ddade6 100644 --- a/examples/authors/postgresql/db.go +++ b/examples/authors/postgresql/db.go @@ -1,19 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) - PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { @@ -24,7 +25,7 @@ type Queries struct { db DBTX } -func (q *Queries) WithTx(tx *sql.Tx) *Queries { +func (q *Queries) WithTx(tx pgx.Tx) *Queries { return &Queries{ db: tx, } diff --git a/examples/authors/postgresql/db_test.go b/examples/authors/postgresql/db_test.go index d2df436ae3..0fdd8824be 100644 --- a/examples/authors/postgresql/db_test.go +++ b/examples/authors/postgresql/db_test.go @@ -1,27 +1,26 @@ //go:build examples -// +build examples package authors import ( "context" - "database/sql" "testing" - _ "github.com/lib/pq" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" - "github.com/sqlc-dev/sqlc/internal/sqltest/hosted" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestAuthors(t *testing.T) { - uri := hosted.PostgreSQL(t, []string{"schema.sql"}) - db, err := sql.Open("postgres", uri) + ctx := context.Background() + uri := local.PostgreSQL(t, []string{"schema.sql"}) + db, err := pgx.Connect(ctx, uri) if err != nil { t.Fatal(err) } - defer db.Close() + defer db.Close(ctx) - ctx := context.Background() q := New(db) // list all authors @@ -34,7 +33,7 @@ func TestAuthors(t *testing.T) { // create an author insertedAuthor, err := q.CreateAuthor(ctx, CreateAuthorParams{ Name: "Brian Kernighan", - Bio: sql.NullString{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, + Bio: pgtype.Text{String: "Co-author of The C Programming Language and The Go Programming Language", Valid: true}, }) if err != nil { t.Fatal(err) diff --git a/examples/authors/postgresql/models.go b/examples/authors/postgresql/models.go index ec61702f5a..d3f6eaab75 100644 --- a/examples/authors/postgresql/models.go +++ b/examples/authors/postgresql/models.go @@ -1,15 +1,15 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors import ( - "database/sql" + "github.com/jackc/pgx/v5/pgtype" ) type Author struct { ID int64 Name string - Bio sql.NullString + Bio pgtype.Text } diff --git a/examples/authors/postgresql/query.sql.go b/examples/authors/postgresql/query.sql.go index a3864f0d97..2910a809f3 100644 --- a/examples/authors/postgresql/query.sql.go +++ b/examples/authors/postgresql/query.sql.go @@ -1,13 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package authors import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5/pgtype" ) const createAuthor = `-- name: CreateAuthor :one @@ -21,11 +22,11 @@ RETURNING id, name, bio type CreateAuthorParams struct { Name string - Bio sql.NullString + Bio pgtype.Text } func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err @@ -37,7 +38,7 @@ WHERE id = $1 ` func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { - _, err := q.db.ExecContext(ctx, deleteAuthor, id) + _, err := q.db.Exec(ctx, deleteAuthor, id) return err } @@ -47,7 +48,7 @@ WHERE id = $1 LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, id) + row := q.db.QueryRow(ctx, getAuthor, id) var i Author err := row.Scan(&i.ID, &i.Name, &i.Bio) return i, err @@ -59,7 +60,7 @@ ORDER BY name ` func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { - rows, err := q.db.QueryContext(ctx, listAuthors) + rows, err := q.db.Query(ctx, listAuthors) if err != nil { return nil, err } @@ -72,9 +73,6 @@ func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } diff --git a/examples/authors/sqlc.yaml b/examples/authors/sqlc.yaml index 9ba523c0d6..eac0ec2ca5 100644 --- a/examples/authors/sqlc.yaml +++ b/examples/authors/sqlc.yaml @@ -2,11 +2,12 @@ version: '2' cloud: project: "01HAQMMECEYQYKFJN8MP16QC41" sql: -- schema: postgresql/schema.sql +- name: postgresql + schema: postgresql/schema.sql queries: postgresql/query.sql engine: postgresql database: - managed: true + uri: "${VET_TEST_EXAMPLES_POSTGRES_AUTHORS}" analyzer: database: false rules: @@ -15,12 +16,14 @@ sql: gen: go: package: authors + sql_package: pgx/v5 out: postgresql -- schema: mysql/schema.sql +- name: mysql + schema: mysql/schema.sql queries: mysql/query.sql engine: mysql database: - uri: root:${MYSQL_ROOT_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/authors?multiStatements=true&parseTime=true + uri: "${VET_TEST_EXAMPLES_MYSQL_AUTHORS}" rules: - sqlc/db-prepare # - mysql-query-too-costly @@ -28,7 +31,8 @@ sql: go: package: authors out: mysql -- schema: sqlite/schema.sql +- name: sqlite + schema: sqlite/schema.sql queries: sqlite/query.sql engine: sqlite database: @@ -39,10 +43,42 @@ sql: go: package: authors out: sqlite +- name: duckdb + schema: duckdb/schema.sql + queries: duckdb/query.sql + engine: duckdb + gen: + go: + package: authors + out: duckdb +- name: clickhouse + schema: clickhouse/schema.sql + queries: clickhouse/query.sql + engine: clickhouse + gen: + go: + package: authors + out: clickhouse +- name: mssql + schema: mssql/schema.sql + queries: mssql/query.sql + engine: mssql + gen: + go: + package: authors + out: mssql +- name: googlesql + schema: googlesql/schema.sql + queries: googlesql/query.sql + engine: googlesql + gen: + go: + package: authors + out: googlesql rules: - name: postgresql-query-too-costly message: "Too costly" rule: "postgresql.explain.plan.total_cost > 300.0" - name: mysql-query-too-costly message: "Too costly" - rule: "has(mysql.explain.query_block.cost_info) && double(mysql.explain.query_block.cost_info.query_cost) > 2.0" \ No newline at end of file + rule: "has(mysql.explain.query_block.cost_info) && double(mysql.explain.query_block.cost_info.query_cost) > 2.0" diff --git a/examples/authors/sqlite/db.go b/examples/authors/sqlite/db.go index f5d9de7305..32f660cdd7 100644 --- a/examples/authors/sqlite/db.go +++ b/examples/authors/sqlite/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/examples/authors/sqlite/db_test.go b/examples/authors/sqlite/db_test.go index b07804b627..e10ce46069 100644 --- a/examples/authors/sqlite/db_test.go +++ b/examples/authors/sqlite/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package authors @@ -13,6 +12,7 @@ import ( func TestAuthors(t *testing.T) { sdb, cleanup := sqltest.SQLite(t, []string{"schema.sql"}) + defer sdb.Close() defer cleanup() ctx := context.Background() diff --git a/examples/authors/sqlite/models.go b/examples/authors/sqlite/models.go index ec61702f5a..62bacd80ae 100644 --- a/examples/authors/sqlite/models.go +++ b/examples/authors/sqlite/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors diff --git a/examples/authors/sqlite/query.sql.go b/examples/authors/sqlite/query.sql.go index 450f519d35..0d66af757f 100644 --- a/examples/authors/sqlite/query.sql.go +++ b/examples/authors/sqlite/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package authors diff --git a/examples/batch/postgresql/batch.go b/examples/batch/postgresql/batch.go index aa905c88cf..b6ba467b65 100644 --- a/examples/batch/postgresql/batch.go +++ b/examples/batch/postgresql/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch.go package batch @@ -8,10 +8,9 @@ package batch import ( "context" "errors" - "time" - "github.com/jackc/pgtype" - "github.com/jackc/pgx/v4" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" ) var ( @@ -32,7 +31,7 @@ type BooksByYearBatchResults struct { func (q *Queries) BooksByYear(ctx context.Context, year []int32) *BooksByYearBatchResults { batch := &pgx.Batch{} for _, a := range year { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(booksByYear, vals...) @@ -114,19 +113,19 @@ type CreateBookBatchResults struct { } type CreateBookParams struct { - AuthorID int32 `json:"author_id"` - Isbn string `json:"isbn"` - BookType BookType `json:"book_type"` - Title string `json:"title"` - Year int32 `json:"year"` - Available time.Time `json:"available"` - Tags []string `json:"tags"` + AuthorID int32 `json:"author_id"` + Isbn string `json:"isbn"` + BookType BookType `json:"book_type"` + Title string `json:"title"` + Year int32 `json:"year"` + Available pgtype.Timestamptz `json:"available"` + Tags []string `json:"tags"` } func (q *Queries) CreateBook(ctx context.Context, arg []CreateBookParams) *CreateBookBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.AuthorID, a.Isbn, a.BookType, @@ -187,7 +186,7 @@ type DeleteBookBatchResults struct { func (q *Queries) DeleteBook(ctx context.Context, bookID []int32) *DeleteBookBatchResults { batch := &pgx.Batch{} for _, a := range bookID { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(deleteBook, vals...) @@ -231,7 +230,7 @@ type DeleteBookNamedFuncBatchResults struct { func (q *Queries) DeleteBookNamedFunc(ctx context.Context, bookID []int32) *DeleteBookNamedFuncBatchResults { batch := &pgx.Batch{} for _, a := range bookID { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(deleteBookNamedFunc, vals...) @@ -275,7 +274,7 @@ type DeleteBookNamedSignBatchResults struct { func (q *Queries) DeleteBookNamedSign(ctx context.Context, bookID []int32) *DeleteBookNamedSignBatchResults { batch := &pgx.Batch{} for _, a := range bookID { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(deleteBookNamedSign, vals...) @@ -319,7 +318,7 @@ type GetBiographyBatchResults struct { func (q *Queries) GetBiography(ctx context.Context, authorID []int32) *GetBiographyBatchResults { batch := &pgx.Batch{} for _, a := range authorID { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(getBiography, vals...) @@ -328,10 +327,10 @@ func (q *Queries) GetBiography(ctx context.Context, authorID []int32) *GetBiogra return &GetBiographyBatchResults{br, len(authorID), false} } -func (b *GetBiographyBatchResults) QueryRow(f func(int, pgtype.JSONB, error)) { +func (b *GetBiographyBatchResults) QueryRow(f func(int, []byte, error)) { defer b.br.Close() for t := 0; t < b.tot; t++ { - var biography pgtype.JSONB + var biography []byte if b.closed { if f != nil { f(t, biography, ErrBatchAlreadyClosed) @@ -372,7 +371,7 @@ type UpdateBookParams struct { func (q *Queries) UpdateBook(ctx context.Context, arg []UpdateBookParams) *UpdateBookBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.Title, a.Tags, a.BookID, diff --git a/examples/batch/postgresql/db.go b/examples/batch/postgresql/db.go index c9a9445f74..64ff18e79c 100644 --- a/examples/batch/postgresql/db.go +++ b/examples/batch/postgresql/db.go @@ -1,20 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package batch import ( "context" - "github.com/jackc/pgconn" - "github.com/jackc/pgx/v4" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/examples/batch/postgresql/db_test.go b/examples/batch/postgresql/db_test.go index fd3ce4e72b..122fa1aa73 100644 --- a/examples/batch/postgresql/db_test.go +++ b/examples/batch/postgresql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package batch @@ -8,12 +7,14 @@ import ( "testing" "time" - "github.com/jackc/pgx/v4" - "github.com/sqlc-dev/sqlc/internal/sqltest/hosted" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBatchBooks(t *testing.T) { - uri := hosted.PostgreSQL(t, []string{"schema.sql"}) + uri := local.PostgreSQL(t, []string{"schema.sql"}) ctx := context.Background() @@ -31,7 +32,7 @@ func TestBatchBooks(t *testing.T) { t.Fatal(err) } - now := time.Now() + now := pgtype.Timestamptz{Time: time.Now(), Valid: true} // batch insert new books newBooksParams := []CreateBookParams{ @@ -114,7 +115,7 @@ func TestBatchBooks(t *testing.T) { }) for _, book := range books0 { - t.Logf("Book %d (%s): %s available: %s\n", book.BookID, book.BookType, book.Title, book.Available.Format(time.RFC822Z)) + t.Logf("Book %d (%s): %s available: %s\n", book.BookID, book.BookType, book.Title, book.Available.Time.Format(time.RFC822Z)) author, err := dq.GetAuthor(ctx, book.AuthorID) if err != nil { t.Fatal(err) diff --git a/examples/batch/postgresql/models.go b/examples/batch/postgresql/models.go index fdb04683f4..65d987a5d0 100644 --- a/examples/batch/postgresql/models.go +++ b/examples/batch/postgresql/models.go @@ -1,15 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package batch import ( "database/sql/driver" "fmt" - "time" - "github.com/jackc/pgtype" + "github.com/jackc/pgx/v5/pgtype" ) type BookType string @@ -19,7 +18,7 @@ const ( BookTypeNONFICTION BookType = "NONFICTION" ) -func (e *BookType) Scan(src interface{}) error { +func (e *BookType) Scan(src any) error { switch s := src.(type) { case []byte: *e = BookType(s) @@ -37,7 +36,7 @@ type NullBookType struct { } // Scan implements the Scanner interface. -func (ns *NullBookType) Scan(value interface{}) error { +func (ns *NullBookType) Scan(value any) error { if value == nil { ns.BookType, ns.Valid = "", false return nil @@ -55,18 +54,18 @@ func (ns NullBookType) Value() (driver.Value, error) { } type Author struct { - AuthorID int32 `json:"author_id"` - Name string `json:"name"` - Biography pgtype.JSONB `json:"biography"` + AuthorID int32 `json:"author_id"` + Name string `json:"name"` + Biography []byte `json:"biography"` } type Book struct { - BookID int32 `json:"book_id"` - AuthorID int32 `json:"author_id"` - Isbn string `json:"isbn"` - BookType BookType `json:"book_type"` - Title string `json:"title"` - Year int32 `json:"year"` - Available time.Time `json:"available"` - Tags []string `json:"tags"` + BookID int32 `json:"book_id"` + AuthorID int32 `json:"author_id"` + Isbn string `json:"isbn"` + BookType BookType `json:"book_type"` + Title string `json:"title"` + Year int32 `json:"year"` + Available pgtype.Timestamptz `json:"available"` + Tags []string `json:"tags"` } diff --git a/examples/batch/postgresql/querier.go b/examples/batch/postgresql/querier.go index b103b84eec..9fe9996a19 100644 --- a/examples/batch/postgresql/querier.go +++ b/examples/batch/postgresql/querier.go @@ -1,13 +1,13 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package batch import ( "context" - "github.com/jackc/pgconn" + "github.com/jackc/pgx/v5/pgconn" ) type Querier interface { diff --git a/examples/batch/postgresql/query.sql.go b/examples/batch/postgresql/query.sql.go index f6a6a42b5b..ffab325ff8 100644 --- a/examples/batch/postgresql/query.sql.go +++ b/examples/batch/postgresql/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package batch @@ -8,7 +8,7 @@ package batch import ( "context" - "github.com/jackc/pgconn" + "github.com/jackc/pgx/v5/pgconn" ) const createAuthor = `-- name: CreateAuthor :one diff --git a/examples/batch/sqlc.json b/examples/batch/sqlc.json index 32124f3959..2f6b9a9e7e 100644 --- a/examples/batch/sqlc.json +++ b/examples/batch/sqlc.json @@ -11,7 +11,7 @@ "queries": "postgresql/query.sql", "engine": "postgresql", "database": { - "managed": true + "uri": "${VET_TEST_EXAMPLES_POSTGRES_BATCH}" }, "analyzer": { "database": false @@ -19,7 +19,7 @@ "rules": [ "sqlc/db-prepare" ], - "sql_package": "pgx/v4", + "sql_package": "pgx/v5", "emit_json_tags": true, "emit_prepared_queries": true, "emit_interface": true diff --git a/examples/booktest/mysql/db.go b/examples/booktest/mysql/db.go index 3014364432..716f4f3829 100644 --- a/examples/booktest/mysql/db.go +++ b/examples/booktest/mysql/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package booktest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/examples/booktest/mysql/db_test.go b/examples/booktest/mysql/db_test.go index 810b9d68c8..6f97178c94 100644 --- a/examples/booktest/mysql/db_test.go +++ b/examples/booktest/mysql/db_test.go @@ -1,21 +1,27 @@ //go:build examples -// +build examples package booktest import ( "context" + "database/sql" "testing" "time" - "github.com/sqlc-dev/sqlc/internal/sqltest" + _ "github.com/go-sql-driver/mysql" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBooks(t *testing.T) { - db, cleanup := sqltest.MySQL(t, []string{"schema.sql"}) - defer cleanup() - ctx := context.Background() + uri := local.MySQL(t, []string{"schema.sql"}) + db, err := sql.Open("mysql", uri) + if err != nil { + t.Fatal(err) + } + defer db.Close() + dq := New(db) // create an author diff --git a/examples/booktest/mysql/models.go b/examples/booktest/mysql/models.go index 3b290c4478..f81d3af818 100644 --- a/examples/booktest/mysql/models.go +++ b/examples/booktest/mysql/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package booktest @@ -17,7 +17,7 @@ const ( BooksBookTypeNONFICTION BooksBookType = "NONFICTION" ) -func (e *BooksBookType) Scan(src interface{}) error { +func (e *BooksBookType) Scan(src any) error { switch s := src.(type) { case []byte: *e = BooksBookType(s) @@ -35,7 +35,7 @@ type NullBooksBookType struct { } // Scan implements the Scanner interface. -func (ns *NullBooksBookType) Scan(value interface{}) error { +func (ns *NullBooksBookType) Scan(value any) error { if value == nil { ns.BooksBookType, ns.Valid = "", false return nil diff --git a/examples/booktest/mysql/query.sql.go b/examples/booktest/mysql/query.sql.go index 541a305d62..39578207fb 100644 --- a/examples/booktest/mysql/query.sql.go +++ b/examples/booktest/mysql/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package booktest diff --git a/examples/booktest/postgresql/db.go b/examples/booktest/postgresql/db.go index 3014364432..ba350869bc 100644 --- a/examples/booktest/postgresql/db.go +++ b/examples/booktest/postgresql/db.go @@ -1,19 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package booktest import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) - PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { @@ -24,7 +25,7 @@ type Queries struct { db DBTX } -func (q *Queries) WithTx(tx *sql.Tx) *Queries { +func (q *Queries) WithTx(tx pgx.Tx) *Queries { return &Queries{ db: tx, } diff --git a/examples/booktest/postgresql/db_test.go b/examples/booktest/postgresql/db_test.go index 9716f56844..ae71593852 100644 --- a/examples/booktest/postgresql/db_test.go +++ b/examples/booktest/postgresql/db_test.go @@ -1,28 +1,27 @@ //go:build examples -// +build examples package booktest import ( "context" - "database/sql" "testing" "time" - _ "github.com/lib/pq" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" - "github.com/sqlc-dev/sqlc/internal/sqltest/hosted" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBooks(t *testing.T) { - uri := hosted.PostgreSQL(t, []string{"schema.sql"}) - db, err := sql.Open("postgres", uri) + ctx := context.Background() + uri := local.PostgreSQL(t, []string{"schema.sql"}) + db, err := pgx.Connect(ctx, uri) if err != nil { t.Fatal(err) } - defer db.Close() + defer db.Close(ctx) - ctx := context.Background() dq := New(db) // create an author @@ -32,7 +31,7 @@ func TestBooks(t *testing.T) { } // create transaction - tx, err := db.Begin() + tx, err := db.Begin(ctx) if err != nil { t.Fatal(err) } @@ -40,7 +39,7 @@ func TestBooks(t *testing.T) { tq := dq.WithTx(tx) // save first book - now := time.Now() + now := pgtype.Timestamptz{Time: time.Now(), Valid: true} _, err = tq.CreateBook(ctx, CreateBookParams{ AuthorID: a.AuthorID, Isbn: "1", @@ -107,7 +106,7 @@ func TestBooks(t *testing.T) { } // tx commit - err = tx.Commit() + err = tx.Commit(ctx) if err != nil { t.Fatal(err) } @@ -132,7 +131,7 @@ func TestBooks(t *testing.T) { t.Fatal(err) } for _, book := range books0 { - t.Logf("Book %d (%s): %s available: %s\n", book.BookID, book.BookType, book.Title, book.Available.Format(time.RFC822Z)) + t.Logf("Book %d (%s): %s available: %s\n", book.BookID, book.BookType, book.Title, book.Available.Time.Format(time.RFC822Z)) author, err := dq.GetAuthor(ctx, book.AuthorID) if err != nil { t.Fatal(err) @@ -150,7 +149,18 @@ func TestBooks(t *testing.T) { t.Logf("Book %d: '%s', Author: '%s', ISBN: '%s' Tags: '%v'\n", ab.BookID, ab.Title, ab.Name.String, ab.Isbn, ab.Tags) } - // TODO: call say_hello(varchar) + // call function + pgText, err := dq.SayHello(ctx, "world") + if err != nil { + t.Fatal(err) + } + str, err := pgText.Value() + if err != nil { + t.Fatal(err) + } + if str != "hello world" { + t.Fatal("expected function result to be \"hello world\". actual:", str) + } // get book 4 and delete b5, err := dq.GetBook(ctx, b3.BookID) diff --git a/examples/booktest/postgresql/models.go b/examples/booktest/postgresql/models.go index 3bfe237f71..5c514a3bfc 100644 --- a/examples/booktest/postgresql/models.go +++ b/examples/booktest/postgresql/models.go @@ -1,13 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package booktest import ( "database/sql/driver" "fmt" - "time" + + "github.com/jackc/pgx/v5/pgtype" ) type BookType string @@ -17,7 +18,7 @@ const ( BookTypeNONFICTION BookType = "NONFICTION" ) -func (e *BookType) Scan(src interface{}) error { +func (e *BookType) Scan(src any) error { switch s := src.(type) { case []byte: *e = BookType(s) @@ -35,7 +36,7 @@ type NullBookType struct { } // Scan implements the Scanner interface. -func (ns *NullBookType) Scan(value interface{}) error { +func (ns *NullBookType) Scan(value any) error { if value == nil { ns.BookType, ns.Valid = "", false return nil @@ -64,6 +65,6 @@ type Book struct { BookType BookType Title string Year int32 - Available time.Time + Available pgtype.Timestamptz Tags []string } diff --git a/examples/booktest/postgresql/query.sql b/examples/booktest/postgresql/query.sql index 194897a4bb..75b8cd3b6d 100644 --- a/examples/booktest/postgresql/query.sql +++ b/examples/booktest/postgresql/query.sql @@ -58,3 +58,6 @@ WHERE book_id = $3; UPDATE books SET title = $1, tags = $2, isbn = $4 WHERE book_id = $3; + +-- name: SayHello :one +select * from say_hello($1); diff --git a/examples/booktest/postgresql/query.sql.go b/examples/booktest/postgresql/query.sql.go index 34e55ad96c..1de3113263 100644 --- a/examples/booktest/postgresql/query.sql.go +++ b/examples/booktest/postgresql/query.sql.go @@ -1,16 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package booktest import ( "context" - "database/sql" - "time" - "github.com/lib/pq" + "github.com/jackc/pgx/v5/pgtype" ) const booksByTags = `-- name: BooksByTags :many @@ -28,13 +26,13 @@ WHERE tags && $1::varchar[] type BooksByTagsRow struct { BookID int32 Title string - Name sql.NullString + Name pgtype.Text Isbn string Tags []string } func (q *Queries) BooksByTags(ctx context.Context, dollar_1 []string) ([]BooksByTagsRow, error) { - rows, err := q.db.QueryContext(ctx, booksByTags, pq.Array(dollar_1)) + rows, err := q.db.Query(ctx, booksByTags, dollar_1) if err != nil { return nil, err } @@ -47,15 +45,12 @@ func (q *Queries) BooksByTags(ctx context.Context, dollar_1 []string) ([]BooksBy &i.Title, &i.Name, &i.Isbn, - pq.Array(&i.Tags), + &i.Tags, ); err != nil { return nil, err } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } @@ -73,7 +68,7 @@ type BooksByTitleYearParams struct { } func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearParams) ([]Book, error) { - rows, err := q.db.QueryContext(ctx, booksByTitleYear, arg.Title, arg.Year) + rows, err := q.db.Query(ctx, booksByTitleYear, arg.Title, arg.Year) if err != nil { return nil, err } @@ -89,15 +84,12 @@ func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearPara &i.Title, &i.Year, &i.Available, - pq.Array(&i.Tags), + &i.Tags, ); err != nil { return nil, err } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } @@ -110,7 +102,7 @@ RETURNING author_id, name ` func (q *Queries) CreateAuthor(ctx context.Context, name string) (Author, error) { - row := q.db.QueryRowContext(ctx, createAuthor, name) + row := q.db.QueryRow(ctx, createAuthor, name) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err @@ -143,19 +135,19 @@ type CreateBookParams struct { BookType BookType Title string Year int32 - Available time.Time + Available pgtype.Timestamptz Tags []string } func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, error) { - row := q.db.QueryRowContext(ctx, createBook, + row := q.db.QueryRow(ctx, createBook, arg.AuthorID, arg.Isbn, arg.BookType, arg.Title, arg.Year, arg.Available, - pq.Array(arg.Tags), + arg.Tags, ) var i Book err := row.Scan( @@ -166,7 +158,7 @@ func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, e &i.Title, &i.Year, &i.Available, - pq.Array(&i.Tags), + &i.Tags, ) return i, err } @@ -177,7 +169,7 @@ WHERE book_id = $1 ` func (q *Queries) DeleteBook(ctx context.Context, bookID int32) error { - _, err := q.db.ExecContext(ctx, deleteBook, bookID) + _, err := q.db.Exec(ctx, deleteBook, bookID) return err } @@ -187,7 +179,7 @@ WHERE author_id = $1 ` func (q *Queries) GetAuthor(ctx context.Context, authorID int32) (Author, error) { - row := q.db.QueryRowContext(ctx, getAuthor, authorID) + row := q.db.QueryRow(ctx, getAuthor, authorID) var i Author err := row.Scan(&i.AuthorID, &i.Name) return i, err @@ -199,7 +191,7 @@ WHERE book_id = $1 ` func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error) { - row := q.db.QueryRowContext(ctx, getBook, bookID) + row := q.db.QueryRow(ctx, getBook, bookID) var i Book err := row.Scan( &i.BookID, @@ -209,11 +201,22 @@ func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error) { &i.Title, &i.Year, &i.Available, - pq.Array(&i.Tags), + &i.Tags, ) return i, err } +const sayHello = `-- name: SayHello :one +select say_hello from say_hello($1) +` + +func (q *Queries) SayHello(ctx context.Context, s string) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, sayHello, s) + var say_hello pgtype.Text + err := row.Scan(&say_hello) + return say_hello, err +} + const updateBook = `-- name: UpdateBook :exec UPDATE books SET title = $1, tags = $2 @@ -227,7 +230,7 @@ type UpdateBookParams struct { } func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { - _, err := q.db.ExecContext(ctx, updateBook, arg.Title, pq.Array(arg.Tags), arg.BookID) + _, err := q.db.Exec(ctx, updateBook, arg.Title, arg.Tags, arg.BookID) return err } @@ -245,9 +248,9 @@ type UpdateBookISBNParams struct { } func (q *Queries) UpdateBookISBN(ctx context.Context, arg UpdateBookISBNParams) error { - _, err := q.db.ExecContext(ctx, updateBookISBN, + _, err := q.db.Exec(ctx, updateBookISBN, arg.Title, - pq.Array(arg.Tags), + arg.Tags, arg.BookID, arg.Isbn, ) diff --git a/examples/booktest/postgresql/schema.sql b/examples/booktest/postgresql/schema.sql index 2beecaba1a..3cdd97ca5f 100644 --- a/examples/booktest/postgresql/schema.sql +++ b/examples/booktest/postgresql/schema.sql @@ -23,9 +23,9 @@ CREATE TABLE books ( CREATE INDEX books_title_idx ON books(title, year); -CREATE FUNCTION say_hello(text) RETURNS text AS $$ +CREATE FUNCTION say_hello(s text) RETURNS text AS $$ BEGIN - RETURN CONCAT('hello ', $1); + RETURN CONCAT('hello ', s); END; $$ LANGUAGE plpgsql; diff --git a/examples/booktest/sqlc.json b/examples/booktest/sqlc.json index b1453a2e37..b0b0d71d01 100644 --- a/examples/booktest/sqlc.json +++ b/examples/booktest/sqlc.json @@ -10,8 +10,9 @@ "schema": "postgresql/schema.sql", "queries": "postgresql/query.sql", "engine": "postgresql", + "sql_package": "pgx/v5", "database": { - "managed": true + "uri": "${VET_TEST_EXAMPLES_POSTGRES_BOOKTEST}" }, "analyzer": { "database": false @@ -27,7 +28,7 @@ "queries": "mysql/query.sql", "engine": "mysql", "database": { - "uri": "root:${MYSQL_ROOT_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/booktest?multiStatements=true&parseTime=true" + "uri": "${VET_TEST_EXAMPLES_MYSQL_BOOKTEST}" }, "rules": [ "sqlc/db-prepare" @@ -47,4 +48,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/examples/booktest/sqlite/db.go b/examples/booktest/sqlite/db.go index 3014364432..716f4f3829 100644 --- a/examples/booktest/sqlite/db.go +++ b/examples/booktest/sqlite/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package booktest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/examples/booktest/sqlite/db_test.go b/examples/booktest/sqlite/db_test.go index f169c79148..42a8b396b1 100644 --- a/examples/booktest/sqlite/db_test.go +++ b/examples/booktest/sqlite/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package booktest @@ -19,6 +18,7 @@ const ( func TestBooks(t *testing.T) { db, cleanup := sqltest.SQLite(t, []string{"schema.sql"}) + defer db.Close() defer cleanup() ctx := context.Background() diff --git a/examples/booktest/sqlite/models.go b/examples/booktest/sqlite/models.go index 88d4527124..4473733e09 100644 --- a/examples/booktest/sqlite/models.go +++ b/examples/booktest/sqlite/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package booktest diff --git a/examples/booktest/sqlite/query.sql.go b/examples/booktest/sqlite/query.sql.go index 9152f1c02e..c8347b1e7f 100644 --- a/examples/booktest/sqlite/query.sql.go +++ b/examples/booktest/sqlite/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package booktest @@ -34,7 +34,7 @@ type BooksByTagsRow struct { func (q *Queries) BooksByTags(ctx context.Context, tags []string) ([]BooksByTagsRow, error) { query := booksByTags - var queryParams []interface{} + var queryParams []any if len(tags) > 0 { for _, v := range tags { queryParams = append(queryParams, v) diff --git a/examples/go.mod b/examples/go.mod new file mode 100644 index 0000000000..ada17c9f0d --- /dev/null +++ b/examples/go.mod @@ -0,0 +1,108 @@ +// The examples are a module of their own so that the drivers they run +// against are not dependencies of sqlc itself, and so that the DuckDB +// driver, which is cgo, does not keep sqlc's own builds from turning cgo +// off. +module github.com/sqlc-dev/sqlc/examples + +go 1.26.0 + +require ( + cloud.google.com/go/spanner v1.96.1 + github.com/ClickHouse/clickhouse-go/v2 v2.49.0 + github.com/duckdb/duckdb-go/v2 v2.10506.0 + github.com/go-sql-driver/mysql v1.10.1 + github.com/google/go-cmp v0.7.0 + github.com/googleapis/go-sql-spanner v1.27.0 + github.com/jackc/pgx/v5 v5.11.0 + github.com/lib/pq v1.12.3 + github.com/microsoft/go-mssqldb v1.11.2 + github.com/sqlc-dev/sqlc v0.0.0 + google.golang.org/api v0.304.0 + google.golang.org/grpc v1.84.0 +) + +require ( + cel.dev/expr v0.25.2 // indirect + cloud.google.com/go v0.123.0 // indirect + cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a // indirect + cloud.google.com/go/auth/oauth2adapt v0.3.0 // indirect + cloud.google.com/go/compute/metadata v0.10.0 // indirect + cloud.google.com/go/iam v1.12.0 // indirect + cloud.google.com/go/longrunning v1.2.0 // indirect + cloud.google.com/go/monitoring v1.30.0 // indirect + filippo.io/edwards25519 v1.2.0 // indirect + github.com/ClickHouse/ch-go v0.74.0 // indirect + github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.6.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.34.0 // indirect + github.com/andybalholm/brotli v1.2.6 // indirect + github.com/apache/arrow-go/v18 v18.5.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect + github.com/duckdb/duckdb-go-bindings v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/darwin-amd64 v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/darwin-arm64 v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/linux-amd64 v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/linux-arm64 v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/windows-amd64 v0.10506.0 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.37.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect + github.com/felixge/httpsnoop v1.1.0 // indirect + github.com/go-faster/city v1.0.1 // indirect + github.com/go-faster/errors v0.7.1 // indirect + github.com/go-jose/go-jose/v4 v4.1.4 // indirect + github.com/go-logr/logr v1.4.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/goccy/go-json v0.10.5 // indirect + github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/google/flatbuffers v25.12.19+incompatible // indirect + github.com/google/s2a-go v0.1.11 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.23 // indirect + github.com/googleapis/gax-go/v2 v2.26.2 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/klauspost/compress v1.19.1 // indirect + github.com/klauspost/cpuid/v2 v2.3.0 // indirect + github.com/ncruces/go-sqlite3 v0.35.6 // indirect + github.com/ncruces/go-sqlite3-wasm/v6 v6.3.35304 // indirect + github.com/ncruces/julianday v1.0.0 // indirect + github.com/paulmach/orb v0.13.0 // indirect + github.com/pierrec/lz4/v4 v4.1.27 // indirect + github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect + github.com/segmentio/asm v1.2.1 // indirect + github.com/shopspring/decimal v1.6.0 // indirect + github.com/spiffe/go-spiffe/v2 v2.8.1 // indirect + github.com/zeebo/xxh3 v1.1.0 // indirect + go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/detectors/gcp v1.44.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 // indirect + go.opentelemetry.io/otel v1.46.0 // indirect + go.opentelemetry.io/otel/metric v1.46.0 // indirect + go.opentelemetry.io/otel/sdk v1.45.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.45.0 // indirect + go.opentelemetry.io/otel/trace v1.46.0 // indirect + golang.org/x/crypto v0.58.0 // indirect + golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect + golang.org/x/mod v0.42.0 // indirect + golang.org/x/net v0.61.0 // indirect + golang.org/x/oauth2 v0.37.0 // indirect + golang.org/x/sync v0.24.0 // indirect + golang.org/x/sys v0.49.0 // indirect + golang.org/x/telemetry v0.0.0-20260924152758-ed294f943157 // indirect + golang.org/x/text v0.43.0 // indirect + golang.org/x/time v0.16.0 // indirect + golang.org/x/tools v0.51.0 // indirect + golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect + google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8 // indirect + google.golang.org/protobuf v1.36.12 // indirect +) + +replace github.com/sqlc-dev/sqlc => ../ diff --git a/examples/go.sum b/examples/go.sum new file mode 100644 index 0000000000..19b8476b6d --- /dev/null +++ b/examples/go.sum @@ -0,0 +1,329 @@ +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= +cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= +cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a h1:jW1ZLFy9oa5ai8LOI40z6s+DL1cO/L1KSm9hVGnibn8= +cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a/go.mod h1:1dmBXa9xfBvBr39ZnDUDkaaA91ccq9CcqENDgJA4d7c= +cloud.google.com/go/auth/oauth2adapt v0.3.0 h1:FY8oSZpCYoUNv6QxVODuMjQz4IlSOVeiQtZ08vLPz88= +cloud.google.com/go/auth/oauth2adapt v0.3.0/go.mod h1:7+2uCm7++XFO+/lN06c2HXpDXb/NMNn2/UwyBPbTnkk= +cloud.google.com/go/compute/metadata v0.10.0 h1:pyKMUQSwchgkIBBJGdILqQbs/BNJXqwSA7Ej6LAvvtY= +cloud.google.com/go/compute/metadata v0.10.0/go.mod h1:rGFHRrIif570kSibjFTMbt6/4/tzgJWFGI/HVol4GIk= +cloud.google.com/go/iam v1.12.0 h1:Aki3bX9aHUDKPHfnRJfDcTdVedvy6quGBQcTqx3DRXk= +cloud.google.com/go/iam v1.12.0/go.mod h1:FEZ4lXpADAC2AIpQY7LANNjjwyQ2jK439CI2VaD+sLY= +cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM= +cloud.google.com/go/longrunning v1.2.0/go.mod h1:5KMQALFGOCtFoi2xSOA1u3H7WKlhmckgiyFw7+LGQp0= +cloud.google.com/go/monitoring v1.30.0 h1:r/d+JUbyKmJ8b07iznuKfzVzrIXTWxHQ3lBRm3x2LlY= +cloud.google.com/go/monitoring v1.30.0/go.mod h1:htlUR0QWVMrjFzZmN4LGnMAve9xB/eduwjmINxVZ8RM= +cloud.google.com/go/spanner v1.96.1 h1:pLmq5/Fj+Yu6YGRBz9oMPm3ZRQIeG14FYBWFwhZZaIA= +cloud.google.com/go/spanner v1.96.1/go.mod h1:VqMSp/YlTofUq1q6ekkXBAmhAs6X860YL0I8wo7i+k0= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1 h1:zvXfGJCWvywnCA814d8ZiVyt+fm9nnTE8xSb99zRyfo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1/go.mod h1:iptorS+VYKFL2N6PnebpS91dubG35eAOEERnT4PJbQU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1 h1:u93s+zU2JD62im61Bm5CZIc1ZrOJaIAWEg0WOrMVkEo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1/go.mod h1:oXtinPO4OLj9d1DOTrqrL1oRwGhcqadvAmrl6wTeGlk= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 h1:MaKvxE6D0KkjOg6Wd9M00iqP5PR0kUxCfiezes4JweM= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0/go.mod h1:i2h9fsTFKZorh8RdV2IcSUf/Qj98GlTkrTvUbX/s8as= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 h1:Nljr4q1GRA/5vCrMONS+g4u4LRHNgOXVSh3O43J2CnI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0/go.mod h1:Y33QHnf0FfdVewFFISOGe20mkZbxX4H839o955/PoeI= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/ClickHouse/ch-go v0.74.0 h1:uYs2m4wIt0ZHSM1E72rg0maCfzhR2V3xWb/vZEgpeWE= +github.com/ClickHouse/ch-go v0.74.0/go.mod h1:sZ/r+8ttZMjyrP9PuFbgoVbth1ywIu2LIQNA2vgko6M= +github.com/ClickHouse/clickhouse-go/v2 v2.49.0 h1:HgiLTraLGgMe8kYivQ6RzMHDUkU/uFUpsWEAuhVk34Q= +github.com/ClickHouse/clickhouse-go/v2 v2.49.0/go.mod h1:o8dSgGJGxY7CeWFNiKusF9a5RnLpgzuo7OaNyH0NQPE= +github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.6.0 h1:BzsL0qE7LvtTEtXG7Dt5NS1EP0CQwI21HZfj9aGghhw= +github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.6.0/go.mod h1:I7kE2kM3qCr9QPT4cU4cCFYkEpVyVr16YOGUHzy+nR0= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.34.0 h1:yzIYdwuro811Z27D3T80Wkd3rqZzb0K43nner7Eh1yE= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.34.0/go.mod h1:pJTkW8hEUIIi3Pf65lPZOnn4Y81yCllX6IWk2jNXdkM= +github.com/andybalholm/brotli v1.2.6 h1:ftYnfj6usCp+UGV5kSJ3+chpMQgU+gJf/AxsUQ52REI= +github.com/andybalholm/brotli v1.2.6/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= +github.com/apache/arrow-go/v18 v18.5.1 h1:yaQ6zxMGgf9YCYw4/oaeOU3AULySDlAYDOcnr4LdHdI= +github.com/apache/arrow-go/v18 v18.5.1/go.mod h1:OCCJsmdq8AsRm8FkBSSmYTwL/s4zHW9CqxeBxEytkNE= +github.com/apache/thrift v0.22.0 h1:r7mTJdj51TMDe6RtcmNdQxgn9XcyfGDOzegMDRg47uc= +github.com/apache/thrift v0.22.0/go.mod h1:1e7J/O1Ae6ZQMTYdy9xa3w9k+XHWPfRvdPyJeynQ+/g= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/duckdb/duckdb-go-bindings v0.10506.0 h1:+s/v55ghAy8MV/QJnwuafD9n+ZoYQkrRd/ceSU0KReA= +github.com/duckdb/duckdb-go-bindings v0.10506.0/go.mod h1:BKswa3lVlgeqO0nzDEQdtVPqPoUbXsVM6zdjhgEDFgU= +github.com/duckdb/duckdb-go-bindings/lib/darwin-amd64 v0.10506.0 h1:bMccC8xWnr/3BjUKQfQxD8MUJPeME3GSHvddWvBKK+M= +github.com/duckdb/duckdb-go-bindings/lib/darwin-amd64 v0.10506.0/go.mod h1:EnAvZh1kNJHp5yF+M1ZHNEvapnmt6anq1xXHVrAGqMo= +github.com/duckdb/duckdb-go-bindings/lib/darwin-arm64 v0.10506.0 h1:TzekQov7ntc+Xahq/puCqVHZgJh4ApJLsqEBpOiIXSA= +github.com/duckdb/duckdb-go-bindings/lib/darwin-arm64 v0.10506.0/go.mod h1:IGLSeEcFhNeZF16aVjQCULD7TsFZKG5G7SyKJAXKp5c= +github.com/duckdb/duckdb-go-bindings/lib/linux-amd64 v0.10506.0 h1:yy2TUU+YWxiBiOQryYseUl0AcUzoFFYRmmrCGijUxiU= +github.com/duckdb/duckdb-go-bindings/lib/linux-amd64 v0.10506.0/go.mod h1:KAIynZ0GHCS7X5fRyuFnQMg/SZBPK/bS9OCOVojClxw= +github.com/duckdb/duckdb-go-bindings/lib/linux-arm64 v0.10506.0 h1:HWUiLpeaZwUFg08Rs2eSpPbbaw3yEB2t96r+5NEbAgs= +github.com/duckdb/duckdb-go-bindings/lib/linux-arm64 v0.10506.0/go.mod h1:81SGOYoEUs8qaAfSk1wRfM5oobrIJ5KI7AzYhK6/bvQ= +github.com/duckdb/duckdb-go-bindings/lib/windows-amd64 v0.10506.0 h1:6PtbnpeUum+J/iNbI56QhZmSfbvy1syhvzWsoH1NKJc= +github.com/duckdb/duckdb-go-bindings/lib/windows-amd64 v0.10506.0/go.mod h1:K25pJL26ARblGDeuAkrdblFvUen92+CwksLtPEHRqqQ= +github.com/duckdb/duckdb-go/v2 v2.10506.0 h1:mcZjUQ/kSNeZdtGCqyj5/JEDUdj7/kvILfIOUTzQIu0= +github.com/duckdb/duckdb-go/v2 v2.10506.0/go.mod h1:6pLO+4GMcb0q36+z+RlQ7h+MMxum1lL0eAVf4GsPAxs= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= +github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= +github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= +github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw= +github.com/go-faster/errors v0.7.1 h1:MkJTnDoEdi9pDabt1dpWf7AA8/BaSYZqibYyhZ20AYg= +github.com/go-faster/errors v0.7.1/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7FPGZP2quo= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME= +github.com/go-sql-driver/mysql v1.10.1/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= +github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.7.0-rc.1 h1:YojYx61/OLFsiv6Rw1Z96LpldJIy31o+UHmwAUMJ6/U= +github.com/golang/mock v1.7.0-rc.1/go.mod h1:s42URUywIqd+OcERslBJvOjepvNymP31m3q8d/GkuRs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= +github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/flatbuffers v25.12.19+incompatible h1:haMV2JRRJCe1998HeW/p0X9UaMTK6SDo0ffLn2+DbLs= +github.com/google/flatbuffers v25.12.19+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/s2a-go v0.1.11 h1:7v1V1TraNGP63WptsAkNqr2w8jgm4vM6A6qx6Lsw9iM= +github.com/google/s2a-go v0.1.11/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.23 h1:J+VGF1wjAM2dU2kKUXZxJdDppRLReWP7KWcclfngQhc= +github.com/googleapis/enterprise-certificate-proxy v0.3.23/go.mod h1:Y8NO/15GNLkrXI3OR5xOFmeU3XLX1sLSdtlXgJ0zmIw= +github.com/googleapis/gax-go/v2 v2.26.2 h1:ydkmNXxj7bEmmeK5AihkKnWxyOyBR9TDebvp5L5izk8= +github.com/googleapis/gax-go/v2 v2.26.2/go.mod h1:sMKqnMesnKH+3wiRJROcttA+cJoZoGbZl1vDQ8XYtGk= +github.com/googleapis/go-sql-spanner v1.27.0 h1:ACs1Pp02Tmod15e/++0s3X3JhjiROCAIXg6Y8uTaYK0= +github.com/googleapis/go-sql-spanner v1.27.0/go.mod h1:zWt0MMR7eFlB9P37yuhbBtEgdJTkm/mlutYQvKjIfOE= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.11.0 h1:IzBBtyK9AHqf98cctWFifYSci2hgQR/cd56wB4p+ogg= +github.com/jackc/pgx/v5 v5.11.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= +github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= +github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk= +github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= +github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ= +github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= +github.com/microsoft/go-mssqldb v1.11.2 h1:FCgeBIK8um2+X4tbun6Q71N1KsfyCDPKY41e1yGVjSE= +github.com/microsoft/go-mssqldb v1.11.2/go.mod h1:CYgwG5AMXFojbjTg+GNP5G/y6uz1BhTyZaPqQWzkGnQ= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8DFdX7uMikMLXX4oubIzJF4kv/wI= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= +github.com/ncruces/go-sqlite3 v0.35.6 h1:0JGlMne89YzKNP2CJBuiH21EEzSQNuB7pfvCbKBn0Jg= +github.com/ncruces/go-sqlite3 v0.35.6/go.mod h1:6MfWBOFbHJVSJxmTCIUKCJdLl4TKkgO895RHerlDVo8= +github.com/ncruces/go-sqlite3-wasm/v6 v6.3.35304 h1:dBSZlcEFdtBMvNRg34y50mConBPO/petSddSwGQVlSI= +github.com/ncruces/go-sqlite3-wasm/v6 v6.3.35304/go.mod h1:YvoJzbJpX6phd3BGdtiXu2NuD5RX6G8zsUdzt47GgOY= +github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= +github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= +github.com/paulmach/orb v0.13.0 h1:r7n7mQGGF+cj/CbcivEj9J3HGK+XR+yXnvzRdq9saIw= +github.com/paulmach/orb v0.13.0/go.mod h1:6scRWINywA2Jf05dcjOfLfxrUIMECvTSG2MVbRLxu/k= +github.com/pierrec/lz4/v4 v4.1.27 h1:+PhzhWDrjRj89TH2sw43nE3+4+W8lSxIuQadEHZyjUk= +github.com/pierrec/lz4/v4 v4.1.27/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= +github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= +github.com/shopspring/decimal v1.6.0 h1:DcTwjCj4tJPLuGZYsR9W0hyX9pQwMIkdo26Ig1T9xX4= +github.com/shopspring/decimal v1.6.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/spiffe/go-spiffe/v2 v2.8.1 h1:eXZMLsu+3MLEPJyGJkolqtVrteZfQdUpOWj6LTiDl/E= +github.com/spiffe/go-spiffe/v2 v2.8.1/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= +github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= +github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= +github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= +github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0 h1:NmLfL734pJhM0JKaYd2Y28+nY9dPRWYAAbxhRCrKXPw= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI= +go.opentelemetry.io/otel v1.46.0 h1:FHt5/CDyVxi/8IM1CH7VE/rRgq3kLHa2mSTVMO8AWyc= +go.opentelemetry.io/otel v1.46.0/go.mod h1:Gj3SEScelsNC45tp4nSxRYlS+f5iez7W8XPMCt905kE= +go.opentelemetry.io/otel/metric v1.46.0 h1:yBnkXvgV7AXFILZc5K6IZe/CBFF3OS7BJ8ov6/lj0K8= +go.opentelemetry.io/otel/metric v1.46.0/go.mod h1:iPmdWqifKUdzziPkvvzIJXITl56fQx2mGM/DHLB3/2o= +go.opentelemetry.io/otel/metric/x v0.67.0 h1:PcicCNZFkZ4bXfSooXdo3WN7RBOVOtjVdo1wD358Uns= +go.opentelemetry.io/otel/metric/x v0.67.0/go.mod h1:FBjCWZe6wgcqxcMtjdGiClDKXb2YxxXii0CXftE4QtI= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= +go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o= +go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= +go.opentelemetry.io/otel/trace v1.46.0 h1:OULy7ccdJnZtJ0UDYFOIGaCmiWzJ8Vi2G/Rsu60qs1c= +go.opentelemetry.io/otel/trace v1.46.0/go.mod h1:J7GAXweO77XSFkB/rmAqk9D6ihszhFjLU+d9WuUxDLI= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20260112195511-716be5621a96 h1:Z/6YuSHTLOHfNFdb8zVZomZr7cqNgTJvA8+Qz75D8gU= +golang.org/x/exp v0.0.0-20260112195511-716be5621a96/go.mod h1:nzimsREAkjBCIEFtHiYkrJyT+2uy9YZJB7H1k68CXZU= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= +golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= +golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/telemetry v0.0.0-20260924152758-ed294f943157 h1:DftxASHKl6JolFPqoN+2WrFO53JvkHwRXvFqf8gsivA= +golang.org/x/telemetry v0.0.0-20260924152758-ed294f943157/go.mod h1:i+ivNqjDnTF3WTElsdk5g9V5DTSBYgdNo7xTU9SDwYA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE= +golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= +golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da h1:noIWHXmPHxILtqtCOPIhSt0ABwskkZKjD3bXGnZGpNY= +golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/api v0.304.0 h1:2R1dYSiIVQRGcKN901u9yPFEdJu5h90oGY5X4TcgbmA= +google.golang.org/api v0.304.0/go.mod h1:dcjRWAy1QdjGb3Z67Qu0gdBWH2gL8Qoy/RI2ZVuvdeE= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d h1:C9v1o0/4quuhOAfmRXA2j+we0PqZIp8traLdeogF3Ms= +google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d/go.mod h1:Wz2wFJntZFmLGo7pLDXZ3wYk5hyc0Mb+SkHhDDXT+lU= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d h1:QwnJwPte4XXAkhPu26LTDIahnsMSUV0kK8HkxbC+Pc4= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d/go.mod h1:WRrQ7/7N19PypuT0fxLOL5Lq0waoiRri4FbtHDEKrGE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8 h1:0SXBqli5dnuCKMjI/X3FM226zEaEa0GUcSCJtN1vL2o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0= +google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/examples/internal/local/clickhouse.go b/examples/internal/local/clickhouse.go new file mode 100644 index 0000000000..b29d33e94f --- /dev/null +++ b/examples/internal/local/clickhouse.go @@ -0,0 +1,101 @@ +package local + +import ( + "context" + "database/sql" + "fmt" + "net/url" + "os" + "strings" + "sync" + "testing" + + _ "github.com/ClickHouse/clickhouse-go/v2" + + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +var clickhouseSync sync.Once +var clickhousePool *sql.DB + +// ClickHouse creates a database on the server CLICKHOUSE_SERVER_URI names, +// such as clickhouse://default:mysecretpassword@127.0.0.1:9000, runs the +// migrations in it +// and returns a URI that connects to it. The test is skipped when no +// server is named. +func ClickHouse(t *testing.T, migrations []string) string { + ctx := context.Background() + t.Helper() + + dburi := os.Getenv("CLICKHOUSE_SERVER_URI") + if dburi == "" { + t.Skip("CLICKHOUSE_SERVER_URI is empty") + } + + clickhouseSync.Do(func() { + db, err := sql.Open("clickhouse", dburi) + if err != nil { + t.Fatal(err) + } + clickhousePool = db + }) + if clickhousePool == nil { + t.Fatalf("ClickHouse pool creation failed") + } + + seed, err := statements(migrations) + if err != nil { + t.Fatal(err) + } + + name := fmt.Sprintf("sqlc_test_%s", id()) + if _, err := clickhousePool.ExecContext(ctx, fmt.Sprintf("CREATE DATABASE `%s`", name)); err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + if _, err := clickhousePool.ExecContext(ctx, fmt.Sprintf("DROP DATABASE `%s`", name)); err != nil { + t.Fatalf("failed cleaning up: %s", err) + } + }) + + uri, err := url.Parse(dburi) + if err != nil { + t.Fatal(err) + } + uri.Path = name + + db, err := sql.Open("clickhouse", uri.String()) + if err != nil { + t.Fatal(err) + } + defer db.Close() + for _, q := range seed { + if _, err := db.ExecContext(ctx, q); err != nil { + t.Fatalf("%s: %s", q, err) + } + } + return uri.String() +} + +// statements reads the migrations and splits them into the statements +// they hold, for a driver that runs one statement per call. +func statements(migrations []string) ([]string, error) { + files, err := sqlpath.Glob(migrations) + if err != nil { + return nil, err + } + var out []string + for _, f := range files { + blob, err := os.ReadFile(f) + if err != nil { + return nil, err + } + for _, q := range strings.Split(string(blob), ";") { + if strings.TrimSpace(q) == "" { + continue + } + out = append(out, q) + } + } + return out, nil +} diff --git a/examples/internal/local/local.go b/examples/internal/local/local.go new file mode 100644 index 0000000000..67d454da0e --- /dev/null +++ b/examples/internal/local/local.go @@ -0,0 +1,20 @@ +// Package local creates a database per test on the servers the examples +// for ClickHouse, SQL Server and Spanner run against, named by environment +// variable, and skips the test when none is named. The helpers for +// PostgreSQL, MySQL and SQLite live in the main module's +// internal/sqltest, which the rest of sqlc's tests share; these live with +// the examples so the drivers they need are dependencies of the examples +// module alone. +package local + +import "math/rand" + +var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +func id() string { + b := make([]rune, 10) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/examples/internal/local/mssql.go b/examples/internal/local/mssql.go new file mode 100644 index 0000000000..a826a4977f --- /dev/null +++ b/examples/internal/local/mssql.go @@ -0,0 +1,90 @@ +package local + +import ( + "context" + "database/sql" + "fmt" + "net/url" + "os" + "sync" + "testing" + + _ "github.com/microsoft/go-mssqldb" + + migrate "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +var mssqlSync sync.Once +var mssqlPool *sql.DB + +// MSSQL creates a database on the server MSSQL_SERVER_URI names, such as +// sqlserver://sa:Mysecretpassword1!@127.0.0.1:1433?encrypt=disable, runs +// the migrations in it and returns a URI that connects to it. The test is +// skipped when no server is named. +func MSSQL(t *testing.T, migrations []string) string { + ctx := context.Background() + t.Helper() + + dburi := os.Getenv("MSSQL_SERVER_URI") + if dburi == "" { + t.Skip("MSSQL_SERVER_URI is empty") + } + + mssqlSync.Do(func() { + db, err := sql.Open("sqlserver", dburi) + if err != nil { + t.Fatal(err) + } + mssqlPool = db + }) + if mssqlPool == nil { + t.Fatalf("SQL Server pool creation failed") + } + + var seed []string + files, err := sqlpath.Glob(migrations) + if err != nil { + t.Fatal(err) + } + for _, f := range files { + blob, err := os.ReadFile(f) + if err != nil { + t.Fatal(err) + } + seed = append(seed, migrate.RemoveRollbackStatements(string(blob))) + } + + name := fmt.Sprintf("sqlc_test_%s", id()) + if _, err := mssqlPool.ExecContext(ctx, fmt.Sprintf("CREATE DATABASE [%s]", name)); err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + // Sessions still in the database, the test's own included, keep + // it from being dropped until they are rolled back. + drop := fmt.Sprintf("ALTER DATABASE [%s] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE [%s]", name, name) + if _, err := mssqlPool.ExecContext(ctx, drop); err != nil { + t.Fatalf("failed cleaning up: %s", err) + } + }) + + uri, err := url.Parse(dburi) + if err != nil { + t.Fatal(err) + } + query := uri.Query() + query.Set("database", name) + uri.RawQuery = query.Encode() + + db, err := sql.Open("sqlserver", uri.String()) + if err != nil { + t.Fatal(err) + } + defer db.Close() + for _, q := range seed { + if _, err := db.ExecContext(ctx, q); err != nil { + t.Fatalf("%s: %s", q, err) + } + } + return uri.String() +} diff --git a/examples/internal/local/spanner.go b/examples/internal/local/spanner.go new file mode 100644 index 0000000000..c2dcf80f4d --- /dev/null +++ b/examples/internal/local/spanner.go @@ -0,0 +1,73 @@ +package local + +import ( + "context" + "fmt" + "os" + "strings" + "testing" + + database "cloud.google.com/go/spanner/admin/database/apiv1" + "cloud.google.com/go/spanner/admin/database/apiv1/databasepb" + "google.golang.org/api/option" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +// spannerInstance is the instance a Spanner Omni single server provides, +// which every database is created in. +const spannerInstance = "projects/default/instances/default" + +// Spanner creates a database on the Spanner Omni server SPANNER_SERVER_URI +// names by its gRPC endpoint, such as localhost:15000, runs the migrations +// as its DDL and returns a data source name for the go-sql-spanner driver +// that connects to it without TLS or credentials, as Omni is reached. The +// test is skipped when no server is named. +func Spanner(t *testing.T, migrations []string) string { + ctx := context.Background() + t.Helper() + + endpoint := os.Getenv("SPANNER_SERVER_URI") + if endpoint == "" { + t.Skip("SPANNER_SERVER_URI is empty") + } + if strings.Contains(endpoint, "://") { + t.Fatalf("SPANNER_SERVER_URI: %q should be a host:port, the gRPC endpoint of a Spanner Omni server", endpoint) + } + + ddl, err := statements(migrations) + if err != nil { + t.Fatal(err) + } + + admin, err := database.NewDatabaseAdminClient(ctx, + option.WithEndpoint(endpoint), + option.WithoutAuthentication(), + option.WithGRPCDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())), + ) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { admin.Close() }) + + name := fmt.Sprintf("sqlc_test_%s", strings.ToLower(id())) + op, err := admin.CreateDatabase(ctx, &databasepb.CreateDatabaseRequest{ + Parent: spannerInstance, + CreateStatement: "CREATE DATABASE `" + name + "`", + ExtraStatements: ddl, + }) + if err != nil { + t.Fatal(err) + } + db, err := op.Wait(ctx) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + if err := admin.DropDatabase(ctx, &databasepb.DropDatabaseRequest{Database: db.Name}); err != nil { + t.Fatalf("failed cleaning up: %s", err) + } + }) + + return endpoint + "/" + db.Name + ";usePlainText=true" +} diff --git a/examples/jets/postgresql/db.go b/examples/jets/postgresql/db.go index bee0af2640..3fb56f8740 100644 --- a/examples/jets/postgresql/db.go +++ b/examples/jets/postgresql/db.go @@ -1,19 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package jets import ( "context" - "database/sql" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) - PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { @@ -24,7 +25,7 @@ type Queries struct { db DBTX } -func (q *Queries) WithTx(tx *sql.Tx) *Queries { +func (q *Queries) WithTx(tx pgx.Tx) *Queries { return &Queries{ db: tx, } diff --git a/examples/jets/postgresql/models.go b/examples/jets/postgresql/models.go index c66a94e7eb..fc0eb9991e 100644 --- a/examples/jets/postgresql/models.go +++ b/examples/jets/postgresql/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package jets -import () - type Jet struct { ID int32 PilotID int32 diff --git a/examples/jets/postgresql/query-building.sql.go b/examples/jets/postgresql/query-building.sql.go index 64db2dfdf8..fd8086e0bb 100644 --- a/examples/jets/postgresql/query-building.sql.go +++ b/examples/jets/postgresql/query-building.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query-building.sql package jets @@ -14,7 +14,7 @@ SELECT COUNT(*) FROM pilots ` func (q *Queries) CountPilots(ctx context.Context) (int64, error) { - row := q.db.QueryRowContext(ctx, countPilots) + row := q.db.QueryRow(ctx, countPilots) var count int64 err := row.Scan(&count) return count, err @@ -25,7 +25,7 @@ DELETE FROM pilots WHERE id = $1 ` func (q *Queries) DeletePilot(ctx context.Context, id int32) error { - _, err := q.db.ExecContext(ctx, deletePilot, id) + _, err := q.db.Exec(ctx, deletePilot, id) return err } @@ -34,7 +34,7 @@ SELECT id, name FROM pilots LIMIT 5 ` func (q *Queries) ListPilots(ctx context.Context) ([]Pilot, error) { - rows, err := q.db.QueryContext(ctx, listPilots) + rows, err := q.db.Query(ctx, listPilots) if err != nil { return nil, err } @@ -47,9 +47,6 @@ func (q *Queries) ListPilots(ctx context.Context) ([]Pilot, error) { } items = append(items, i) } - if err := rows.Close(); err != nil { - return nil, err - } if err := rows.Err(); err != nil { return nil, err } diff --git a/examples/jets/sqlc.json b/examples/jets/sqlc.json index 14e80c4291..8dfa0df777 100644 --- a/examples/jets/sqlc.json +++ b/examples/jets/sqlc.json @@ -10,8 +10,9 @@ "schema": "postgresql/schema.sql", "queries": "postgresql/query-building.sql", "engine": "postgresql", + "sql_package": "pgx/v5", "database": { - "managed": true + "uri": "${VET_TEST_EXAMPLES_POSTGRES_JETS}" }, "analyzer": { "database": false diff --git a/examples/kotlin/.gitignore b/examples/kotlin/.gitignore deleted file mode 100644 index fbb16c8de7..0000000000 --- a/examples/kotlin/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/.gradle/ -/.idea/ -/build/ -/out/ diff --git a/examples/kotlin/README.md b/examples/kotlin/README.md deleted file mode 100644 index 717425cb51..0000000000 --- a/examples/kotlin/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Kotlin examples - -This is a Kotlin gradle project configured to compile and test all examples. Currently tests have only been written for the `authors` example. - -To run tests: - -```shell script -docker run --name dinosql-postgres -d -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=postgres -p 5432:5432 postgres:11 -./gradlew clean test -``` - -The project can be easily imported into Intellij. - -1. Install Java if you don't already have it -1. Download Intellij IDEA Community Edition -1. In the "Welcome" modal, click "Import Project" -1. Open the `build.gradle` file adjacent to this README file -1. Wait for Intellij to sync the gradle modules and complete indexing diff --git a/examples/kotlin/build.gradle b/examples/kotlin/build.gradle deleted file mode 100644 index 0dfec90887..0000000000 --- a/examples/kotlin/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -plugins { - id 'org.jetbrains.kotlin.jvm' version '1.3.60' -} - -group 'com.example' -version '1.0-SNAPSHOT' - -repositories { - mavenCentral() -} - -dependencies { - implementation 'mysql:mysql-connector-java:8.0.22' - implementation 'org.postgresql:postgresql:42.2.9' - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0' -} - -test { - useJUnitPlatform() -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" -} diff --git a/examples/kotlin/gradle.properties b/examples/kotlin/gradle.properties deleted file mode 100644 index 29e08e8ca8..0000000000 --- a/examples/kotlin/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -kotlin.code.style=official \ No newline at end of file diff --git a/examples/kotlin/gradle/wrapper/gradle-wrapper.jar b/examples/kotlin/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 87b738cbd0..0000000000 Binary files a/examples/kotlin/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/kotlin/gradle/wrapper/gradle-wrapper.properties b/examples/kotlin/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index fd68b0da3e..0000000000 --- a/examples/kotlin/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Sat Jan 25 10:45:34 EST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStorePath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME diff --git a/examples/kotlin/gradlew b/examples/kotlin/gradlew deleted file mode 100755 index af6708ff22..0000000000 --- a/examples/kotlin/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/examples/kotlin/gradlew.bat b/examples/kotlin/gradlew.bat deleted file mode 100644 index 6d57edc706..0000000000 --- a/examples/kotlin/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/examples/kotlin/settings.gradle b/examples/kotlin/settings.gradle deleted file mode 100644 index 5a094655c6..0000000000 --- a/examples/kotlin/settings.gradle +++ /dev/null @@ -1,5 +0,0 @@ -plugins { - id("com.gradle.enterprise").version("3.1.1") -} - -rootProject.name = 'dbtest' diff --git a/examples/kotlin/sqlc.json b/examples/kotlin/sqlc.json deleted file mode 100644 index 284b76ec91..0000000000 --- a/examples/kotlin/sqlc.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "kt", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-kotlin_1.1.0.wasm", - "sha256": "57890144f4effed4fe71855418b87ad26d53dc5ed2030a66ad77e5e3a93d77fb" - } - } - ], - "sql": [ - { - "schema": "src/main/resources/authors/postgresql/schema.sql", - "queries": "src/main/resources/authors/postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/authors/postgresql", - "plugin": "kt", - "options": { - "package": "com.example.authors.postgresql" - } - } - ] - }, - { - "schema": "src/main/resources/ondeck/postgresql/schema", - "queries": "src/main/resources/ondeck/postgresql/query", - "engine": "postgresql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/ondeck/postgresql", - "plugin": "kt", - "options": { - "package": "com.example.ondeck.postgresql" - } - } - ] - }, - { - "schema": "src/main/resources/jets/postgresql/schema.sql", - "queries": "src/main/resources/jets/postgresql/query-building.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "kt", - "out": "src/main/kotlin/com/example/jets", - "options": { - "package": "com.example.jets" - } - } - ] - }, - { - "schema": "src/main/resources/booktest/postgresql/schema.sql", - "queries": "src/main/resources/booktest/postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/booktest/postgresql", - "plugin": "kt", - "options": { - "package": "com.example.booktest.postgresql" - } - } - ] - }, - { - "schema": "src/main/resources/authors/mysql/schema.sql", - "queries": "src/main/resources/authors/mysql/query.sql", - "engine": "mysql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/authors/mysql", - "plugin": "kt", - "options": { - "package": "com.example.authors.mysql" - } - } - ] - }, - { - "schema": "src/main/resources/booktest/mysql/schema.sql", - "queries": "src/main/resources/booktest/mysql/query.sql", - "engine": "mysql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/booktest/mysql", - "plugin": "kt", - "options": { - "package": "com.example.booktest.mysql" - } - } - ] - }, - { - "schema": "src/main/resources/ondeck/mysql/schema", - "queries": "src/main/resources/ondeck/mysql/query", - "engine": "mysql", - "codegen": [ - { - "out": "src/main/kotlin/com/example/ondeck/mysql", - "plugin": "kt", - "options": { - "package": "com.example.ondeck.mysql" - } - } - ] - } - ] -} diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt deleted file mode 100644 index 4d492e5a69..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.mysql - -data class Author ( - val id: Long, - val name: String, - val bio: String? -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt deleted file mode 100644 index 5b6b46eb26..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -interface Queries { - @Throws(SQLException::class) - fun createAuthor(name: String, bio: String?): Long - - @Throws(SQLException::class) - fun deleteAuthor(id: Long) - - @Throws(SQLException::class) - fun getAuthor(id: Long): Author? - - @Throws(SQLException::class) - fun listAuthors(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt deleted file mode 100644 index dfc170f116..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -const val createAuthor = """-- name: createAuthor :execresult -INSERT INTO authors ( - name, bio -) VALUES ( - ?, ? -) -""" - -const val deleteAuthor = """-- name: deleteAuthor :exec -DELETE FROM authors -WHERE id = ? -""" - -const val getAuthor = """-- name: getAuthor :one -SELECT id, name, bio FROM authors -WHERE id = ? LIMIT 1 -""" - -const val listAuthors = """-- name: listAuthors :many -SELECT id, name, bio FROM authors -ORDER BY name -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun createAuthor(name: String, bio: String?): Long { - return conn.prepareStatement(createAuthor, Statement.RETURN_GENERATED_KEYS).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, bio) - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } - - @Throws(SQLException::class) - override fun deleteAuthor(id: Long) { - conn.prepareStatement(deleteAuthor).use { stmt -> - stmt.setLong(1, id) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getAuthor(id: Long): Author? { - return conn.prepareStatement(getAuthor).use { stmt -> - stmt.setLong(1, id) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getLong(1), - results.getString(2), - results.getString(3) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun listAuthors(): List { - return conn.prepareStatement(listAuthors).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Author( - results.getLong(1), - results.getString(2), - results.getString(3) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt deleted file mode 100644 index 226aa46cb9..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.postgresql - -data class Author ( - val id: Long, - val name: String, - val bio: String? -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt deleted file mode 100644 index 61b3a01667..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -interface Queries { - @Throws(SQLException::class) - fun createAuthor(name: String, bio: String?): Author? - - @Throws(SQLException::class) - fun deleteAuthor(id: Long) - - @Throws(SQLException::class) - fun getAuthor(id: Long): Author? - - @Throws(SQLException::class) - fun listAuthors(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt deleted file mode 100644 index 177d61d445..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.authors.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -const val createAuthor = """-- name: createAuthor :one -INSERT INTO authors ( - name, bio -) VALUES ( - ?, ? -) -RETURNING id, name, bio -""" - -const val deleteAuthor = """-- name: deleteAuthor :exec -DELETE FROM authors -WHERE id = ? -""" - -const val getAuthor = """-- name: getAuthor :one -SELECT id, name, bio FROM authors -WHERE id = ? LIMIT 1 -""" - -const val listAuthors = """-- name: listAuthors :many -SELECT id, name, bio FROM authors -ORDER BY name -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun createAuthor(name: String, bio: String?): Author? { - return conn.prepareStatement(createAuthor).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, bio) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getLong(1), - results.getString(2), - results.getString(3) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun deleteAuthor(id: Long) { - conn.prepareStatement(deleteAuthor).use { stmt -> - stmt.setLong(1, id) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getAuthor(id: Long): Author? { - return conn.prepareStatement(getAuthor).use { stmt -> - stmt.setLong(1, id) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getLong(1), - results.getString(2), - results.getString(3) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun listAuthors(): List { - return conn.prepareStatement(listAuthors).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Author( - results.getLong(1), - results.getString(2), - results.getString(3) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt deleted file mode 100644 index 9c5cd1d531..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.mysql - -import java.time.LocalDateTime - -enum class BooksBookType(val value: String) { - FICTION("FICTION"), - NONFICTION("NONFICTION"); - - companion object { - private val map = BooksBookType.values().associateBy(BooksBookType::value) - fun lookup(value: String) = map[value] - } -} - -data class Author ( - val authorId: Int, - val name: String -) - -data class Book ( - val bookId: Int, - val authorId: Int, - val isbn: String, - val bookType: BooksBookType, - val title: String, - val yr: Int, - val available: LocalDateTime, - val tags: String -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt deleted file mode 100644 index 03af9a6f3a..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.time.LocalDateTime - -interface Queries { - @Throws(SQLException::class) - fun booksByTags(tags: String): List - - @Throws(SQLException::class) - fun booksByTitleYear(title: String, yr: Int): List - - @Throws(SQLException::class) - fun createAuthor(name: String): Long - - @Throws(SQLException::class) - fun createBook( - authorId: Int, - isbn: String, - bookType: BooksBookType, - title: String, - yr: Int, - available: LocalDateTime, - tags: String): Long - - @Throws(SQLException::class) - fun deleteAuthorBeforeYear(yr: Int, authorId: Int) - - @Throws(SQLException::class) - fun deleteBook(bookId: Int) - - @Throws(SQLException::class) - fun getAuthor(authorId: Int): Author? - - @Throws(SQLException::class) - fun getBook(bookId: Int): Book? - - @Throws(SQLException::class) - fun updateBook( - title: String, - tags: String, - bookId: Int) - - @Throws(SQLException::class) - fun updateBookISBN( - title: String, - tags: String, - isbn: String, - bookId: Int) - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt deleted file mode 100644 index be81242bab..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt +++ /dev/null @@ -1,278 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.time.LocalDateTime - -const val booksByTags = """-- name: booksByTags :many -SELECT - book_id, - title, - name, - isbn, - tags -FROM books -LEFT JOIN authors ON books.author_id = authors.author_id -WHERE tags = ? -""" - -data class BooksByTagsRow ( - val bookId: Int, - val title: String, - val name: String?, - val isbn: String, - val tags: String -) - -const val booksByTitleYear = """-- name: booksByTitleYear :many -SELECT book_id, author_id, isbn, book_type, title, yr, available, tags FROM books -WHERE title = ? AND yr = ? -""" - -const val createAuthor = """-- name: createAuthor :execresult -INSERT INTO authors (name) VALUES (?) -""" - -const val createBook = """-- name: createBook :execresult -INSERT INTO books ( - author_id, - isbn, - book_type, - title, - yr, - available, - tags -) VALUES ( - ?, - ?, - ?, - ?, - ?, - ?, - ? -) -""" - -const val deleteAuthorBeforeYear = """-- name: deleteAuthorBeforeYear :exec -DELETE FROM books -WHERE yr < ? AND author_id = ? -""" - -const val deleteBook = """-- name: deleteBook :exec -DELETE FROM books -WHERE book_id = ? -""" - -const val getAuthor = """-- name: getAuthor :one -SELECT author_id, name FROM authors -WHERE author_id = ? -""" - -const val getBook = """-- name: getBook :one -SELECT book_id, author_id, isbn, book_type, title, yr, available, tags FROM books -WHERE book_id = ? -""" - -const val updateBook = """-- name: updateBook :exec -UPDATE books -SET title = ?, tags = ? -WHERE book_id = ? -""" - -const val updateBookISBN = """-- name: updateBookISBN :exec -UPDATE books -SET title = ?, tags = ?, isbn = ? -WHERE book_id = ? -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun booksByTags(tags: String): List { - return conn.prepareStatement(booksByTags).use { stmt -> - stmt.setString(1, tags) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(BooksByTagsRow( - results.getInt(1), - results.getString(2), - results.getString(3), - results.getString(4), - results.getString(5) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun booksByTitleYear(title: String, yr: Int): List { - return conn.prepareStatement(booksByTitleYear).use { stmt -> - stmt.setString(1, title) - stmt.setInt(2, yr) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BooksBookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, LocalDateTime::class.java), - results.getString(8) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun createAuthor(name: String): Long { - return conn.prepareStatement(createAuthor, Statement.RETURN_GENERATED_KEYS).use { stmt -> - stmt.setString(1, name) - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } - - @Throws(SQLException::class) - override fun createBook( - authorId: Int, - isbn: String, - bookType: BooksBookType, - title: String, - yr: Int, - available: LocalDateTime, - tags: String): Long { - return conn.prepareStatement(createBook, Statement.RETURN_GENERATED_KEYS).use { stmt -> - stmt.setInt(1, authorId) - stmt.setString(2, isbn) - stmt.setString(3, bookType.value) - stmt.setString(4, title) - stmt.setInt(5, yr) - stmt.setObject(6, available) - stmt.setString(7, tags) - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } - - @Throws(SQLException::class) - override fun deleteAuthorBeforeYear(yr: Int, authorId: Int) { - conn.prepareStatement(deleteAuthorBeforeYear).use { stmt -> - stmt.setInt(1, yr) - stmt.setInt(2, authorId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun deleteBook(bookId: Int) { - conn.prepareStatement(deleteBook).use { stmt -> - stmt.setInt(1, bookId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getAuthor(authorId: Int): Author? { - return conn.prepareStatement(getAuthor).use { stmt -> - stmt.setInt(1, authorId) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getInt(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun getBook(bookId: Int): Book? { - return conn.prepareStatement(getBook).use { stmt -> - stmt.setInt(1, bookId) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BooksBookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, LocalDateTime::class.java), - results.getString(8) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun updateBook( - title: String, - tags: String, - bookId: Int) { - conn.prepareStatement(updateBook).use { stmt -> - stmt.setString(1, title) - stmt.setString(2, tags) - stmt.setInt(3, bookId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun updateBookISBN( - title: String, - tags: String, - isbn: String, - bookId: Int) { - conn.prepareStatement(updateBookISBN).use { stmt -> - stmt.setString(1, title) - stmt.setString(2, tags) - stmt.setString(3, isbn) - stmt.setInt(4, bookId) - - stmt.execute() - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt deleted file mode 100644 index 3f3d92ad58..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.postgresql - -import java.time.OffsetDateTime - -enum class BookType(val value: String) { - FICTION("FICTION"), - NONFICTION("NONFICTION"); - - companion object { - private val map = BookType.values().associateBy(BookType::value) - fun lookup(value: String) = map[value] - } -} - -data class Author ( - val authorId: Int, - val name: String -) - -data class Book ( - val bookId: Int, - val authorId: Int, - val isbn: String, - val bookType: BookType, - val title: String, - val year: Int, - val available: OffsetDateTime, - val tags: List -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt deleted file mode 100644 index 207dbf84e7..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Types -import java.time.OffsetDateTime - -interface Queries { - @Throws(SQLException::class) - fun booksByTags(dollar1: List): List - - @Throws(SQLException::class) - fun booksByTitleYear(title: String, year: Int): List - - @Throws(SQLException::class) - fun createAuthor(name: String): Author? - - @Throws(SQLException::class) - fun createBook( - authorId: Int, - isbn: String, - bookType: BookType, - title: String, - year: Int, - available: OffsetDateTime, - tags: List): Book? - - @Throws(SQLException::class) - fun deleteBook(bookId: Int) - - @Throws(SQLException::class) - fun getAuthor(authorId: Int): Author? - - @Throws(SQLException::class) - fun getBook(bookId: Int): Book? - - @Throws(SQLException::class) - fun updateBook( - title: String, - tags: List, - bookId: Int) - - @Throws(SQLException::class) - fun updateBookISBN( - title: String, - tags: List, - isbn: String, - bookId: Int) - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt deleted file mode 100644 index f40ea684b0..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.booktest.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Types -import java.time.OffsetDateTime - -const val booksByTags = """-- name: booksByTags :many -SELECT - book_id, - title, - name, - isbn, - tags -FROM books -LEFT JOIN authors ON books.author_id = authors.author_id -WHERE tags && ?::varchar[] -""" - -data class BooksByTagsRow ( - val bookId: Int, - val title: String, - val name: String?, - val isbn: String, - val tags: List -) - -const val booksByTitleYear = """-- name: booksByTitleYear :many -SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books -WHERE title = ? AND year = ? -""" - -const val createAuthor = """-- name: createAuthor :one -INSERT INTO authors (name) VALUES (?) -RETURNING author_id, name -""" - -const val createBook = """-- name: createBook :one -INSERT INTO books ( - author_id, - isbn, - book_type, - title, - year, - available, - tags -) VALUES ( - ?, - ?, - ?, - ?, - ?, - ?, - ? -) -RETURNING book_id, author_id, isbn, book_type, title, year, available, tags -""" - -const val deleteBook = """-- name: deleteBook :exec -DELETE FROM books -WHERE book_id = ? -""" - -const val getAuthor = """-- name: getAuthor :one -SELECT author_id, name FROM authors -WHERE author_id = ? -""" - -const val getBook = """-- name: getBook :one -SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books -WHERE book_id = ? -""" - -const val updateBook = """-- name: updateBook :exec -UPDATE books -SET title = ?, tags = ? -WHERE book_id = ? -""" - -const val updateBookISBN = """-- name: updateBookISBN :exec -UPDATE books -SET title = ?, tags = ?, isbn = ? -WHERE book_id = ? -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun booksByTags(dollar1: List): List { - return conn.prepareStatement(booksByTags).use { stmt -> - stmt.setArray(1, conn.createArrayOf("pg_catalog.varchar", dollar1.toTypedArray())) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(BooksByTagsRow( - results.getInt(1), - results.getString(2), - results.getString(3), - results.getString(4), - (results.getArray(5).array as Array).toList() - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun booksByTitleYear(title: String, year: Int): List { - return conn.prepareStatement(booksByTitleYear).use { stmt -> - stmt.setString(1, title) - stmt.setInt(2, year) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, OffsetDateTime::class.java), - (results.getArray(8).array as Array).toList() - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun createAuthor(name: String): Author? { - return conn.prepareStatement(createAuthor).use { stmt -> - stmt.setString(1, name) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getInt(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun createBook( - authorId: Int, - isbn: String, - bookType: BookType, - title: String, - year: Int, - available: OffsetDateTime, - tags: List): Book? { - return conn.prepareStatement(createBook).use { stmt -> - stmt.setInt(1, authorId) - stmt.setString(2, isbn) - stmt.setObject(3, bookType.value, Types.OTHER) - stmt.setString(4, title) - stmt.setInt(5, year) - stmt.setObject(6, available) - stmt.setArray(7, conn.createArrayOf("pg_catalog.varchar", tags.toTypedArray())) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, OffsetDateTime::class.java), - (results.getArray(8).array as Array).toList() - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun deleteBook(bookId: Int) { - conn.prepareStatement(deleteBook).use { stmt -> - stmt.setInt(1, bookId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getAuthor(authorId: Int): Author? { - return conn.prepareStatement(getAuthor).use { stmt -> - stmt.setInt(1, authorId) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Author( - results.getInt(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun getBook(bookId: Int): Book? { - return conn.prepareStatement(getBook).use { stmt -> - stmt.setInt(1, bookId) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Book( - results.getInt(1), - results.getInt(2), - results.getString(3), - BookType.lookup(results.getString(4))!!, - results.getString(5), - results.getInt(6), - results.getObject(7, OffsetDateTime::class.java), - (results.getArray(8).array as Array).toList() - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun updateBook( - title: String, - tags: List, - bookId: Int) { - conn.prepareStatement(updateBook).use { stmt -> - stmt.setString(1, title) - stmt.setArray(2, conn.createArrayOf("pg_catalog.varchar", tags.toTypedArray())) - stmt.setInt(3, bookId) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun updateBookISBN( - title: String, - tags: List, - isbn: String, - bookId: Int) { - conn.prepareStatement(updateBookISBN).use { stmt -> - stmt.setString(1, title) - stmt.setArray(2, conn.createArrayOf("pg_catalog.varchar", tags.toTypedArray())) - stmt.setString(3, isbn) - stmt.setInt(4, bookId) - - stmt.execute() - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt b/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt deleted file mode 100644 index 86e15ee2ed..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.jets - -data class Jet ( - val id: Int, - val pilotId: Int, - val age: Int, - val name: String, - val color: String -) - -data class Language ( - val id: Int, - val language: String -) - -data class Pilot ( - val id: Int, - val name: String -) - -data class PilotLanguage ( - val pilotId: Int, - val languageId: Int -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt deleted file mode 100644 index d727ebb70f..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.jets - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -interface Queries { - @Throws(SQLException::class) - fun countPilots(): Long? - - @Throws(SQLException::class) - fun deletePilot(id: Int) - - @Throws(SQLException::class) - fun listPilots(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt deleted file mode 100644 index 9b3f2b57c1..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.jets - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement - -const val countPilots = """-- name: countPilots :one -SELECT COUNT(*) FROM pilots -""" - -const val deletePilot = """-- name: deletePilot :exec -DELETE FROM pilots WHERE id = ? -""" - -const val listPilots = """-- name: listPilots :many -SELECT id, name FROM pilots LIMIT 5 -""" - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun countPilots(): Long? { - return conn.prepareStatement(countPilots).use { stmt -> - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = results.getLong(1) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun deletePilot(id: Int) { - conn.prepareStatement(deletePilot).use { stmt -> - stmt.setInt(1, id) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun listPilots(): List { - return conn.prepareStatement(listPilots).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Pilot( - results.getInt(1), - results.getString(2) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt deleted file mode 100644 index a034c3600f..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.mysql - -import java.sql.Timestamp -import java.time.Instant - -enum class VenueStatus(val value: String) { - OPEN("open"), - CLOSED("closed"); - - companion object { - private val map = VenueStatus.values().associateBy(VenueStatus::value) - fun lookup(value: String) = map[value] - } -} - -data class City ( - val slug: String, - val name: String -) - -// Venues are places where muisc happens -data class Venue ( - val id: Long, - // Venues can be either open or closed - val status: VenueStatus, - val statuses: String?, - // This value appears in public URLs - val slug: String, - val name: String, - val city: String, - val spotifyPlaylist: String, - val songkickId: String?, - val tags: String?, - val createdAt: Instant -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt deleted file mode 100644 index 7cacad0d10..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Timestamp -import java.time.Instant - -interface Queries { - @Throws(SQLException::class) - fun createCity(name: String, slug: String) - - @Throws(SQLException::class) - fun createVenue( - slug: String, - name: String, - city: String, - spotifyPlaylist: String, - status: VenueStatus, - statuses: String?, - tags: String?): Long - - @Throws(SQLException::class) - fun deleteVenue(slug: String, slug_2: String) - - @Throws(SQLException::class) - fun getCity(slug: String): City? - - @Throws(SQLException::class) - fun getVenue(slug: String, city: String): Venue? - - @Throws(SQLException::class) - fun listCities(): List - - @Throws(SQLException::class) - fun listVenues(city: String): List - - @Throws(SQLException::class) - fun updateCityName(name: String, slug: String) - - @Throws(SQLException::class) - fun updateVenueName(name: String, slug: String) - - @Throws(SQLException::class) - fun venueCountByCity(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt deleted file mode 100644 index 172967cdec..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt +++ /dev/null @@ -1,278 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.mysql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Timestamp -import java.time.Instant - -const val createCity = """-- name: createCity :exec -INSERT INTO city ( - name, - slug -) VALUES ( - ?, - ? -) -""" - -const val createVenue = """-- name: createVenue :execresult -INSERT INTO venue ( - slug, - name, - city, - created_at, - spotify_playlist, - status, - statuses, - tags -) VALUES ( - ?, - ?, - ?, - NOW(), - ?, - ?, - ?, - ? -) -""" - -const val deleteVenue = """-- name: deleteVenue :exec -DELETE FROM venue -WHERE slug = ? AND slug = ? -""" - -const val getCity = """-- name: getCity :one -SELECT slug, name -FROM city -WHERE slug = ? -""" - -const val getVenue = """-- name: getVenue :one -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE slug = ? AND city = ? -""" - -const val listCities = """-- name: listCities :many -SELECT slug, name -FROM city -ORDER BY name -""" - -const val listVenues = """-- name: listVenues :many -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE city = ? -ORDER BY name -""" - -const val updateCityName = """-- name: updateCityName :exec -UPDATE city -SET name = ? -WHERE slug = ? -""" - -const val updateVenueName = """-- name: updateVenueName :exec -UPDATE venue -SET name = ? -WHERE slug = ? -""" - -const val venueCountByCity = """-- name: venueCountByCity :many -SELECT - city, - count(*) -FROM venue -GROUP BY 1 -ORDER BY 1 -""" - -data class VenueCountByCityRow ( - val city: String, - val count: Long -) - -class QueriesImpl(private val conn: Connection) : Queries { - - @Throws(SQLException::class) - override fun createCity(name: String, slug: String) { - conn.prepareStatement(createCity).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun createVenue( - slug: String, - name: String, - city: String, - spotifyPlaylist: String, - status: VenueStatus, - statuses: String?, - tags: String?): Long { - return conn.prepareStatement(createVenue, Statement.RETURN_GENERATED_KEYS).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, name) - stmt.setString(3, city) - stmt.setString(4, spotifyPlaylist) - stmt.setString(5, status.value) - stmt.setString(6, statuses) - stmt.setString(7, tags) - - stmt.execute() - - val results = stmt.generatedKeys - if (!results.next()) { - throw SQLException("no generated key returned") - } - results.getLong(1) - } - } - - @Throws(SQLException::class) - override fun deleteVenue(slug: String, slug_2: String) { - conn.prepareStatement(deleteVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, slug_2) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getCity(slug: String): City? { - return conn.prepareStatement(getCity).use { stmt -> - stmt.setString(1, slug) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = City( - results.getString(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun getVenue(slug: String, city: String): Venue? { - return conn.prepareStatement(getVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, city) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Venue( - results.getLong(1), - VenueStatus.lookup(results.getString(2))!!, - results.getString(3), - results.getString(4), - results.getString(5), - results.getString(6), - results.getString(7), - results.getString(8), - results.getString(9), - results.getTimestamp(10).toInstant() - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun listCities(): List { - return conn.prepareStatement(listCities).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(City( - results.getString(1), - results.getString(2) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun listVenues(city: String): List { - return conn.prepareStatement(listVenues).use { stmt -> - stmt.setString(1, city) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Venue( - results.getLong(1), - VenueStatus.lookup(results.getString(2))!!, - results.getString(3), - results.getString(4), - results.getString(5), - results.getString(6), - results.getString(7), - results.getString(8), - results.getString(9), - results.getTimestamp(10).toInstant() - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun updateCityName(name: String, slug: String) { - conn.prepareStatement(updateCityName).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun updateVenueName(name: String, slug: String) { - conn.prepareStatement(updateVenueName).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun venueCountByCity(): List { - return conn.prepareStatement(venueCountByCity).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(VenueCountByCityRow( - results.getString(1), - results.getLong(2) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt deleted file mode 100644 index 69c9c622d7..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.postgresql - -import java.time.LocalDateTime - -// Venues can be either open or closed -enum class Status(val value: String) { - OPEN("op!en"), - CLOSED("clo@sed"); - - companion object { - private val map = Status.values().associateBy(Status::value) - fun lookup(value: String) = map[value] - } -} - -data class City ( - val slug: String, - val name: String -) - -// Venues are places where muisc happens -data class Venue ( - val id: Int, - val status: Status, - val statuses: List, - // This value appears in public URLs - val slug: String, - val name: String, - val city: String, - val spotifyPlaylist: String, - val songkickId: String?, - val tags: List, - val createdAt: LocalDateTime -) - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt deleted file mode 100644 index e564af4e33..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Types -import java.time.LocalDateTime - -interface Queries { - @Throws(SQLException::class) - fun createCity(name: String, slug: String): City? - - @Throws(SQLException::class) - fun createVenue( - slug: String, - name: String, - city: String, - spotifyPlaylist: String, - status: Status, - statuses: List, - tags: List): Int? - - @Throws(SQLException::class) - fun deleteVenue(slug: String) - - @Throws(SQLException::class) - fun getCity(slug: String): City? - - @Throws(SQLException::class) - fun getVenue(slug: String, city: String): Venue? - - @Throws(SQLException::class) - fun listCities(): List - - @Throws(SQLException::class) - fun listVenues(city: String): List - - @Throws(SQLException::class) - fun updateCityName(name: String, slug: String) - - @Throws(SQLException::class) - fun updateVenueName(name: String, slug: String): Int? - - @Throws(SQLException::class) - fun venueCountByCity(): List - -} - diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt deleted file mode 100644 index a4d1dca384..0000000000 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt +++ /dev/null @@ -1,304 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.22.0 - -package com.example.ondeck.postgresql - -import java.sql.Connection -import java.sql.SQLException -import java.sql.Statement -import java.sql.Types -import java.time.LocalDateTime - -const val createCity = """-- name: createCity :one -INSERT INTO city ( - name, - slug -) VALUES ( - ?, - ? -) RETURNING slug, name -""" - -const val createVenue = """-- name: createVenue :one -INSERT INTO venue ( - slug, - name, - city, - created_at, - spotify_playlist, - status, - statuses, - tags -) VALUES ( - ?, - ?, - ?, - NOW(), - ?, - ?, - ?, - ? -) RETURNING id -""" - -const val deleteVenue = """-- name: deleteVenue :exec -DELETE FROM venue -WHERE slug = ? AND slug = ? -""" - -const val getCity = """-- name: getCity :one -SELECT slug, name -FROM city -WHERE slug = ? -""" - -const val getVenue = """-- name: getVenue :one -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE slug = ? AND city = ? -""" - -const val listCities = """-- name: listCities :many -SELECT slug, name -FROM city -ORDER BY name -""" - -const val listVenues = """-- name: listVenues :many -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE city = ? -ORDER BY name -""" - -const val updateCityName = """-- name: updateCityName :exec -UPDATE city -SET name = ? -WHERE slug = ? -""" - -const val updateVenueName = """-- name: updateVenueName :one -UPDATE venue -SET name = ? -WHERE slug = ? -RETURNING id -""" - -const val venueCountByCity = """-- name: venueCountByCity :many -SELECT - city, - count(*) -FROM venue -GROUP BY 1 -ORDER BY 1 -""" - -data class VenueCountByCityRow ( - val city: String, - val count: Long -) - -class QueriesImpl(private val conn: Connection) : Queries { - -// Create a new city. The slug must be unique. -// This is the second line of the comment -// This is the third line - - @Throws(SQLException::class) - override fun createCity(name: String, slug: String): City? { - return conn.prepareStatement(createCity).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = City( - results.getString(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun createVenue( - slug: String, - name: String, - city: String, - spotifyPlaylist: String, - status: Status, - statuses: List, - tags: List): Int? { - return conn.prepareStatement(createVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, name) - stmt.setString(3, city) - stmt.setString(4, spotifyPlaylist) - stmt.setObject(5, status.value, Types.OTHER) - stmt.setArray(6, conn.createArrayOf("status", statuses.map { v -> v.value }.toTypedArray())) - stmt.setArray(7, conn.createArrayOf("text", tags.toTypedArray())) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = results.getInt(1) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun deleteVenue(slug: String) { - conn.prepareStatement(deleteVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun getCity(slug: String): City? { - return conn.prepareStatement(getCity).use { stmt -> - stmt.setString(1, slug) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = City( - results.getString(1), - results.getString(2) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun getVenue(slug: String, city: String): Venue? { - return conn.prepareStatement(getVenue).use { stmt -> - stmt.setString(1, slug) - stmt.setString(2, city) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = Venue( - results.getInt(1), - Status.lookup(results.getString(2))!!, - (results.getArray(3).array as Array).map { v -> Status.lookup(v)!! }.toList(), - results.getString(4), - results.getString(5), - results.getString(6), - results.getString(7), - results.getString(8), - (results.getArray(9).array as Array).toList(), - results.getObject(10, LocalDateTime::class.java) - ) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun listCities(): List { - return conn.prepareStatement(listCities).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(City( - results.getString(1), - results.getString(2) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun listVenues(city: String): List { - return conn.prepareStatement(listVenues).use { stmt -> - stmt.setString(1, city) - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(Venue( - results.getInt(1), - Status.lookup(results.getString(2))!!, - (results.getArray(3).array as Array).map { v -> Status.lookup(v)!! }.toList(), - results.getString(4), - results.getString(5), - results.getString(6), - results.getString(7), - results.getString(8), - (results.getArray(9).array as Array).toList(), - results.getObject(10, LocalDateTime::class.java) - )) - } - ret - } - } - - @Throws(SQLException::class) - override fun updateCityName(name: String, slug: String) { - conn.prepareStatement(updateCityName).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - stmt.execute() - } - } - - @Throws(SQLException::class) - override fun updateVenueName(name: String, slug: String): Int? { - return conn.prepareStatement(updateVenueName).use { stmt -> - stmt.setString(1, name) - stmt.setString(2, slug) - - val results = stmt.executeQuery() - if (!results.next()) { - return null - } - val ret = results.getInt(1) - if (results.next()) { - throw SQLException("expected one row in result set, but got many") - } - ret - } - } - - @Throws(SQLException::class) - override fun venueCountByCity(): List { - return conn.prepareStatement(venueCountByCity).use { stmt -> - - val results = stmt.executeQuery() - val ret = mutableListOf() - while (results.next()) { - ret.add(VenueCountByCityRow( - results.getString(1), - results.getLong(2) - )) - } - ret - } - } - -} - diff --git a/examples/kotlin/src/main/resources/authors b/examples/kotlin/src/main/resources/authors deleted file mode 120000 index f391af0e5a..0000000000 --- a/examples/kotlin/src/main/resources/authors +++ /dev/null @@ -1 +0,0 @@ -../../../../authors \ No newline at end of file diff --git a/examples/kotlin/src/main/resources/booktest b/examples/kotlin/src/main/resources/booktest deleted file mode 120000 index a397d4ae21..0000000000 --- a/examples/kotlin/src/main/resources/booktest +++ /dev/null @@ -1 +0,0 @@ -../../../../booktest \ No newline at end of file diff --git a/examples/kotlin/src/main/resources/jets b/examples/kotlin/src/main/resources/jets deleted file mode 120000 index 24ed880a40..0000000000 --- a/examples/kotlin/src/main/resources/jets +++ /dev/null @@ -1 +0,0 @@ -../../../../jets \ No newline at end of file diff --git a/examples/kotlin/src/main/resources/ondeck b/examples/kotlin/src/main/resources/ondeck deleted file mode 120000 index 37517cb367..0000000000 --- a/examples/kotlin/src/main/resources/ondeck +++ /dev/null @@ -1 +0,0 @@ -../../../../ondeck \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/authors/mysql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/authors/mysql/QueriesImplTest.kt deleted file mode 100644 index 3cb7d7887d..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/authors/mysql/QueriesImplTest.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.example.authors.mysql - -import com.example.dbtest.MysqlDbTestExtension -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension - -class QueriesImplTest() { - - companion object { - @JvmField - @RegisterExtension - val dbtest = MysqlDbTestExtension("src/main/resources/authors/mysql/schema.sql") - } - - @Test - fun testCreateAuthor() { - val db = QueriesImpl(dbtest.getConnection()) - - val initialAuthors = db.listAuthors() - assert(initialAuthors.isEmpty()) - - val name = "Brian Kernighan" - val bio = "Co-author of The C Programming Language and The Go Programming Language" - val id = db.createAuthor( - name = name, - bio = bio - ) - assertEquals(id, 1) - val expectedAuthor = Author(id, name, bio) - - val fetchedAuthor = db.getAuthor(id) - assertEquals(expectedAuthor, fetchedAuthor) - - val listedAuthors = db.listAuthors() - assertEquals(1, listedAuthors.size) - assertEquals(expectedAuthor, listedAuthors[0]) - - val id2 = db.createAuthor( - name = name, - bio = bio - ) - assertEquals(id2, 2) - } - - @Test - fun testNull() { - val db = QueriesImpl(dbtest.getConnection()) - - val initialAuthors = db.listAuthors() - assert(initialAuthors.isEmpty()) - - val name = "Brian Kernighan" - val bio = null - val id = db.createAuthor(name, bio) - val expectedAuthor = Author(id, name, bio) - - val fetchedAuthor = db.getAuthor(id) - assertEquals(expectedAuthor, fetchedAuthor) - - val listedAuthors = db.listAuthors() - assertEquals(1, listedAuthors.size) - assertEquals(expectedAuthor, listedAuthors[0]) - } -} diff --git a/examples/kotlin/src/test/kotlin/com/example/authors/postgresql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/authors/postgresql/QueriesImplTest.kt deleted file mode 100644 index 86c24fb68c..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/authors/postgresql/QueriesImplTest.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.example.authors.postgresql - -import com.example.dbtest.PostgresDbTestExtension -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension - -class QueriesImplTest() { - - companion object { - @JvmField - @RegisterExtension - val dbtest = PostgresDbTestExtension("src/main/resources/authors/postgresql/schema.sql") - } - - @Test - fun testCreateAuthor() { - val db = QueriesImpl(dbtest.getConnection()) - - val initialAuthors = db.listAuthors() - assert(initialAuthors.isEmpty()) - - val name = "Brian Kernighan" - val bio = "Co-author of The C Programming Language and The Go Programming Language" - val insertedAuthor = db.createAuthor( - name = name, - bio = bio - )!! - val expectedAuthor = Author(insertedAuthor.id, name, bio) - Assertions.assertEquals(expectedAuthor, insertedAuthor) - - val fetchedAuthor = db.getAuthor(insertedAuthor.id) - Assertions.assertEquals(expectedAuthor, fetchedAuthor) - - val listedAuthors = db.listAuthors() - Assertions.assertEquals(1, listedAuthors.size) - Assertions.assertEquals(expectedAuthor, listedAuthors[0]) - } - - @Test - fun testNull() { - val db = QueriesImpl(dbtest.getConnection()) - - val initialAuthors = db.listAuthors() - assert(initialAuthors.isEmpty()) - - val name = "Brian Kernighan" - val bio = null - val insertedAuthor = db.createAuthor(name, bio)!! - val expectedAuthor = Author(insertedAuthor.id, name, bio) - Assertions.assertEquals(expectedAuthor, insertedAuthor) - - val fetchedAuthor = db.getAuthor(insertedAuthor.id) - Assertions.assertEquals(expectedAuthor, fetchedAuthor) - - val listedAuthors = db.listAuthors() - Assertions.assertEquals(1, listedAuthors.size) - Assertions.assertEquals(expectedAuthor, listedAuthors[0]) - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/booktest/mysql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/booktest/mysql/QueriesImplTest.kt deleted file mode 100644 index f69cd85e12..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/booktest/mysql/QueriesImplTest.kt +++ /dev/null @@ -1,98 +0,0 @@ -package com.example.booktest.mysql - -import com.example.dbtest.MysqlDbTestExtension -import com.example.dbtest.PostgresDbTestExtension -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension -import java.time.LocalDateTime -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class QueriesImplTest { - companion object { - @JvmField @RegisterExtension val dbtest = MysqlDbTestExtension("src/main/resources/booktest/mysql/schema.sql") - } - - @Test - fun testQueries() { - val conn = dbtest.getConnection() - val db = QueriesImpl(conn) - val authorId = db.createAuthor("Unknown Master") - val author = db.getAuthor(authorId.toInt())!! - - // Start a transaction - conn.autoCommit = false - db.createBook( - authorId = author.authorId, - isbn = "1", - title = "my book title", - bookType = BooksBookType.NONFICTION, - yr = 2016, - available = LocalDateTime.now(), - tags = "" - ) - - val b1Id = db.createBook( - authorId = author.authorId, - isbn = "2", - title = "the second book", - bookType = BooksBookType.NONFICTION, - yr = 2016, - available = LocalDateTime.now(), - tags = listOf("cool", "unique").joinToString(",") - ) - - db.updateBook( - bookId = b1Id.toInt(), - title = "changed second title", - tags = listOf("cool", "disastor").joinToString(",") - ) - - val b3Id = db.createBook( - authorId = author.authorId, - isbn = "3", - title = "the third book", - bookType = BooksBookType.NONFICTION, - yr = 2001, - available = LocalDateTime.now(), - tags = listOf("cool").joinToString(",") - ) - - db.createBook( - authorId = author.authorId, - isbn = "4", - title = "4th place finisher", - bookType = BooksBookType.NONFICTION, - yr = 2011, - available = LocalDateTime.now(), - tags = listOf("other").joinToString(",") - ) - - // Commit transaction - conn.commit() - conn.autoCommit = true - - db.updateBookISBN( - bookId = b3Id.toInt(), - isbn = "NEW ISBN", - title = "never ever gonna finish, a quatrain", - tags = listOf("someother").joinToString(",") - ) - - val books0 = db.booksByTitleYear("my book title", 2016) - - val formatter = DateTimeFormatter.ISO_DATE_TIME - for (book in books0) { - println("Book ${book.bookId} (${book.bookType}): ${book.title} available: ${book.available.format(formatter)}") - val author2 = db.getAuthor(book.authorId)!! - println("Book ${book.bookId} author: ${author2.name}") - } - - // find a book with either "cool" or "other" tag - println("---------\\nTag search results:\\n") - val res = db.booksByTags(listOf("cool", "other", "someother").joinToString(",")) - for (ab in res) { - println("Book ${ab.bookId}: '${ab.title}', Author: '${ab.name}', ISBN: '${ab.isbn}' Tags: '${ab.tags.toList()}'") - } - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/booktest/postgresql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/booktest/postgresql/QueriesImplTest.kt deleted file mode 100644 index 1a4316123d..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/booktest/postgresql/QueriesImplTest.kt +++ /dev/null @@ -1,97 +0,0 @@ -package com.example.booktest.postgresql - -import com.example.dbtest.PostgresDbTestExtension -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class QueriesImplTest { - companion object { - @JvmField @RegisterExtension val dbtest = PostgresDbTestExtension("src/main/resources/booktest/postgresql/schema.sql") - } - - @Test - fun testQueries() { - val conn = dbtest.getConnection() - val db = QueriesImpl(conn) - val author = db.createAuthor("Unknown Master")!! - - // Start a transaction - conn.autoCommit = false - db.createBook( - authorId = author.authorId, - isbn = "1", - title = "my book title", - bookType = BookType.NONFICTION, - year = 2016, - available = OffsetDateTime.now(), - tags = listOf() - ) - - val b1 = db.createBook( - authorId = author.authorId, - isbn = "2", - title = "the second book", - bookType = BookType.NONFICTION, - year = 2016, - available = OffsetDateTime.now(), - tags = listOf("cool", "unique") - )!! - - db.updateBook( - bookId = b1.bookId, - title = "changed second title", - tags = listOf("cool", "disastor") - ) - - val b3 = db.createBook( - authorId = author.authorId, - isbn = "3", - title = "the third book", - bookType = BookType.NONFICTION, - year = 2001, - available = OffsetDateTime.now(), - tags = listOf("cool") - )!! - - db.createBook( - authorId = author.authorId, - isbn = "4", - title = "4th place finisher", - bookType = BookType.NONFICTION, - year = 2011, - available = OffsetDateTime.now(), - tags = listOf("other") - ) - - // Commit transaction - conn.commit() - conn.autoCommit = true - - // ISBN update fails because parameters are not in sequential order. After changing $N to ?, ordering is lost, - // and the parameters are filled into the wrong slots. - db.updateBookISBN( - bookId = b3.bookId, - isbn = "NEW ISBN", - title = "never ever gonna finish, a quatrain", - tags = listOf("someother") - ) - - val books0 = db.booksByTitleYear("my book title", 2016) - - val formatter = DateTimeFormatter.ISO_DATE_TIME - for (book in books0) { - println("Book ${book.bookId} (${book.bookType}): ${book.title} available: ${book.available.format(formatter)}") - val author2 = db.getAuthor(book.authorId)!! - println("Book ${book.bookId} author: ${author2.name}") - } - - // find a book with either "cool" or "other" tag - println("---------\\nTag search results:\\n") - val res = db.booksByTags(listOf("cool", "other", "someother")) - for (ab in res) { - println("Book ${ab.bookId}: '${ab.title}', Author: '${ab.name}', ISBN: '${ab.isbn}' Tags: '${ab.tags.toList()}'") - } - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/dbtest/MysqlDbTestExtension.kt b/examples/kotlin/src/test/kotlin/com/example/dbtest/MysqlDbTestExtension.kt deleted file mode 100644 index 243a441476..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/dbtest/MysqlDbTestExtension.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.example.dbtest - -import org.junit.jupiter.api.extension.AfterEachCallback -import org.junit.jupiter.api.extension.BeforeEachCallback -import org.junit.jupiter.api.extension.ExtensionContext -import java.nio.file.Files -import java.nio.file.Paths -import java.sql.Connection -import java.sql.DriverManager -import kotlin.streams.toList - - -class MysqlDbTestExtension(private val migrationsPath: String) : BeforeEachCallback, AfterEachCallback { - val user = System.getenv("MYSQL_USER") ?: "root" - val pass = System.getenv("MYSQL_ROOT_PASSWORD") ?: "mysecretpassword" - val host = System.getenv("MYSQL_HOST") ?: "127.0.0.1" - val port = System.getenv("MYSQL_PORT") ?: "3306" - val mainDb = System.getenv("MYSQL_DATABASE") ?: "dinotest" - val testDb = "sqltest_mysql" - - override fun beforeEach(context: ExtensionContext) { - getConnection(mainDb).createStatement().execute("CREATE DATABASE $testDb") - val path = Paths.get(migrationsPath) - val migrations = if (Files.isDirectory(path)) { - Files.list(path).filter { it.toString().endsWith(".sql") }.sorted().map { Files.readString(it) }.toList() - } else { - listOf(Files.readString(path)) - } - migrations.forEach { - getConnection().createStatement().execute(it) - } - } - - override fun afterEach(context: ExtensionContext) { - getConnection(mainDb).createStatement().execute("DROP DATABASE $testDb") - } - - private fun getConnection(db: String): Connection { - val url = "jdbc:mysql://$host:$port/$db?user=$user&password=$pass&allowMultiQueries=true" - return DriverManager.getConnection(url) - } - - fun getConnection(): Connection { - return getConnection(testDb) - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/dbtest/PostgresDbTestExtension.kt b/examples/kotlin/src/test/kotlin/com/example/dbtest/PostgresDbTestExtension.kt deleted file mode 100644 index 55a7d6f91d..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/dbtest/PostgresDbTestExtension.kt +++ /dev/null @@ -1,51 +0,0 @@ -package com.example.dbtest - -import org.junit.jupiter.api.extension.AfterEachCallback -import org.junit.jupiter.api.extension.BeforeEachCallback -import org.junit.jupiter.api.extension.ExtensionContext -import java.nio.file.Files -import java.nio.file.Paths -import java.sql.Connection -import java.sql.DriverManager -import kotlin.streams.toList - -class PostgresDbTestExtension(private val migrationsPath: String) : BeforeEachCallback, AfterEachCallback { - private val schemaConn: Connection - private val url: String - - companion object { - const val schema = "dinosql_test" - } - - init { - val user = System.getenv("PG_USER") ?: "postgres" - val pass = System.getenv("PG_PASSWORD") ?: "mysecretpassword" - val host = System.getenv("PG_HOST") ?: "127.0.0.1" - val port = System.getenv("PG_PORT") ?: "5432" - val db = System.getenv("PG_DATABASE") ?: "dinotest" - url = "jdbc:postgresql://$host:$port/$db?user=$user&password=$pass&sslmode=disable" - - schemaConn = DriverManager.getConnection(url) - } - - override fun beforeEach(context: ExtensionContext) { - schemaConn.createStatement().execute("CREATE SCHEMA $schema") - val path = Paths.get(migrationsPath) - val migrations = if (Files.isDirectory(path)) { - Files.list(path).filter{ it.toString().endsWith(".sql")}.sorted().map { Files.readString(it) }.toList() - } else { - listOf(Files.readString(path)) - } - migrations.forEach { - getConnection().createStatement().execute(it) - } - } - - override fun afterEach(context: ExtensionContext) { - schemaConn.createStatement().execute("DROP SCHEMA $schema CASCADE") - } - - fun getConnection(): Connection { - return DriverManager.getConnection("$url¤tSchema=$schema") - } -} \ No newline at end of file diff --git a/examples/kotlin/src/test/kotlin/com/example/ondeck/mysql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/ondeck/mysql/QueriesImplTest.kt deleted file mode 100644 index 27fac23535..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/ondeck/mysql/QueriesImplTest.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.example.ondeck.mysql - -import com.example.dbtest.MysqlDbTestExtension -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension - -class QueriesImplTest { - companion object { - @JvmField - @RegisterExtension - val dbtest = MysqlDbTestExtension("src/main/resources/ondeck/mysql/schema") - } - - @Test - fun testQueries() { - val q = QueriesImpl(dbtest.getConnection()) - q.createCity( - slug = "san-francisco", - name = "San Francisco" - ) - val city = q.listCities()[0] - val venueId = q.createVenue( - slug = "the-fillmore", - name = "The Fillmore", - city = city.slug, - spotifyPlaylist = "spotify=uri", - status = VenueStatus.OPEN, - statuses = listOf(VenueStatus.OPEN, VenueStatus.CLOSED).joinToString(","), - tags = listOf("rock", "punk").joinToString(",") - ) - val venue = q.getVenue( - slug = "the-fillmore", - city = city.slug - )!! - assertEquals(venueId, venue.id) - - assertEquals(city, q.getCity(city.slug)) - assertEquals(listOf(VenueCountByCityRow(city.slug, 1)), q.venueCountByCity()) - assertEquals(listOf(city), q.listCities()) - assertEquals(listOf(venue), q.listVenues(city.slug)) - - q.updateCityName(slug = city.slug, name = "SF") - q.updateVenueName(slug = venue.slug, name = "Fillmore") - val fresh = q.getVenue(venue.slug, city.slug)!! - assertEquals("Fillmore", fresh.name) - - q.deleteVenue(venue.slug, venue.slug) - } -} diff --git a/examples/kotlin/src/test/kotlin/com/example/ondeck/postgresql/QueriesImplTest.kt b/examples/kotlin/src/test/kotlin/com/example/ondeck/postgresql/QueriesImplTest.kt deleted file mode 100644 index 990f4398d1..0000000000 --- a/examples/kotlin/src/test/kotlin/com/example/ondeck/postgresql/QueriesImplTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.example.ondeck.postgresql - -import com.example.dbtest.PostgresDbTestExtension -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension - -class QueriesImplTest { - companion object { - @JvmField @RegisterExtension val dbtest = PostgresDbTestExtension("src/main/resources/ondeck/postgresql/schema") - } - - @Test - fun testQueries() { - val q = QueriesImpl(dbtest.getConnection()) - val city = q.createCity( - slug = "san-francisco", - name = "San Francisco" - )!! - val venueId = q.createVenue( - slug = "the-fillmore", - name = "The Fillmore", - city = city.slug, - spotifyPlaylist = "spotify=uri", - status = Status.OPEN, - statuses = listOf(Status.OPEN, Status.CLOSED), - tags = listOf("rock", "punk") - ) - val venue = q.getVenue( - slug = "the-fillmore", - city = city.slug - )!! - assertEquals(venueId, venue.id) - - assertEquals(city, q.getCity(city.slug)) - assertEquals(listOf(VenueCountByCityRow(city.slug, 1)), q.venueCountByCity()) - assertEquals(listOf(city), q.listCities()) - assertEquals(listOf(venue), q.listVenues(city.slug)) - - q.updateCityName(slug = city.slug, name = "SF") - val id = q.updateVenueName(slug = venue.slug, name = "Fillmore") - assertEquals(venue.id, id) - - q.deleteVenue(venue.slug) - } -} diff --git a/examples/ondeck/mysql/city.sql.go b/examples/ondeck/mysql/city.sql.go index ca691a7b61..89b321ea7f 100644 --- a/examples/ondeck/mysql/city.sql.go +++ b/examples/ondeck/mysql/city.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: city.sql package ondeck diff --git a/examples/ondeck/mysql/db.go b/examples/ondeck/mysql/db.go index 06afcda08e..67cc093797 100644 --- a/examples/ondeck/mysql/db.go +++ b/examples/ondeck/mysql/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck @@ -11,10 +11,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -112,7 +112,7 @@ func (q *Queries) Close() error { return err } -func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (sql.Result, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) @@ -123,7 +123,7 @@ func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args . } } -func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Rows, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) @@ -134,7 +134,7 @@ func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args } } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) diff --git a/examples/ondeck/mysql/db_test.go b/examples/ondeck/mysql/db_test.go index a6ddecc18b..6ac70aaf06 100644 --- a/examples/ondeck/mysql/db_test.go +++ b/examples/ondeck/mysql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package ondeck @@ -9,9 +8,10 @@ import ( "strings" "testing" - "github.com/sqlc-dev/sqlc/internal/sqltest" - + _ "github.com/go-sql-driver/mysql" "github.com/google/go-cmp/cmp" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func join(vals ...string) sql.NullString { @@ -143,10 +143,14 @@ func runOnDeckQueries(t *testing.T, q *Queries) { func TestPrepared(t *testing.T) { t.Parallel() - sdb, cleanup := sqltest.MySQL(t, []string{"schema"}) - defer cleanup() + uri := local.MySQL(t, []string{"schema"}) + db, err := sql.Open("mysql", uri) + if err != nil { + t.Fatalf("%s: %s", uri, err) + } + defer db.Close() - q, err := Prepare(context.Background(), sdb) + q, err := Prepare(context.Background(), db) if err != nil { t.Fatal(err) } @@ -157,8 +161,12 @@ func TestPrepared(t *testing.T) { func TestQueries(t *testing.T) { t.Parallel() - sdb, cleanup := sqltest.MySQL(t, []string{"schema"}) - defer cleanup() + uri := local.MySQL(t, []string{"schema"}) + db, err := sql.Open("mysql", uri) + if err != nil { + t.Fatalf("%s: %s", uri, err) + } + defer db.Close() - runOnDeckQueries(t, New(sdb)) + runOnDeckQueries(t, New(db)) } diff --git a/examples/ondeck/mysql/models.go b/examples/ondeck/mysql/models.go index 12e87cd90c..3267be0020 100644 --- a/examples/ondeck/mysql/models.go +++ b/examples/ondeck/mysql/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck @@ -18,7 +18,7 @@ const ( VenueStatusClosed VenueStatus = "closed" ) -func (e *VenueStatus) Scan(src interface{}) error { +func (e *VenueStatus) Scan(src any) error { switch s := src.(type) { case []byte: *e = VenueStatus(s) @@ -36,7 +36,7 @@ type NullVenueStatus struct { } // Scan implements the Scanner interface. -func (ns *NullVenueStatus) Scan(value interface{}) error { +func (ns *NullVenueStatus) Scan(value any) error { if value == nil { ns.VenueStatus, ns.Valid = "", false return nil diff --git a/examples/ondeck/mysql/querier.go b/examples/ondeck/mysql/querier.go index 5b92523605..e4773837b1 100644 --- a/examples/ondeck/mysql/querier.go +++ b/examples/ondeck/mysql/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck diff --git a/examples/ondeck/mysql/schema/0001_city.sql b/examples/ondeck/mysql/schema/0001_city.sql index 6be35d16bf..94e9b0f8d4 100644 --- a/examples/ondeck/mysql/schema/0001_city.sql +++ b/examples/ondeck/mysql/schema/0001_city.sql @@ -1,4 +1,4 @@ CREATE TABLE city ( slug varchar(255) PRIMARY KEY, name text NOT NULL -) +); diff --git a/examples/ondeck/mysql/schema/0002_venue.sql b/examples/ondeck/mysql/schema/0002_venue.sql index 4fc842cee0..dcab205c96 100644 --- a/examples/ondeck/mysql/schema/0002_venue.sql +++ b/examples/ondeck/mysql/schema/0002_venue.sql @@ -5,7 +5,7 @@ CREATE TABLE venues ( statuses text, -- status[], slug text not null COMMENT 'This value appears in public URLs', name varchar(255) not null, - city text not null references city(slug), + city varchar(255) not null references city(slug), spotify_playlist varchar(255) not null, songkick_id text, tags text -- text[] diff --git a/examples/ondeck/mysql/venue.sql.go b/examples/ondeck/mysql/venue.sql.go index 13b5e28d0b..21a7a6e1bb 100644 --- a/examples/ondeck/mysql/venue.sql.go +++ b/examples/ondeck/mysql/venue.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: venue.sql package ondeck diff --git a/examples/ondeck/postgresql/city.sql.go b/examples/ondeck/postgresql/city.sql.go index a054b1b8d8..5559bf5126 100644 --- a/examples/ondeck/postgresql/city.sql.go +++ b/examples/ondeck/postgresql/city.sql.go @@ -1,6 +1,8 @@ +//go:build examples + // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: city.sql package ondeck diff --git a/examples/ondeck/postgresql/db.go b/examples/ondeck/postgresql/db.go index 06afcda08e..86609552c7 100644 --- a/examples/ondeck/postgresql/db.go +++ b/examples/ondeck/postgresql/db.go @@ -1,6 +1,8 @@ +//go:build examples + // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck @@ -11,10 +13,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -112,7 +114,7 @@ func (q *Queries) Close() error { return err } -func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (sql.Result, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) @@ -123,7 +125,7 @@ func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args . } } -func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Rows, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) @@ -134,7 +136,7 @@ func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args } } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) diff --git a/examples/ondeck/postgresql/db_test.go b/examples/ondeck/postgresql/db_test.go index c4e4ce8bbf..6d2fba6714 100644 --- a/examples/ondeck/postgresql/db_test.go +++ b/examples/ondeck/postgresql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package ondeck @@ -11,7 +10,7 @@ import ( "github.com/google/go-cmp/cmp" _ "github.com/lib/pq" - "github.com/sqlc-dev/sqlc/internal/sqltest/hosted" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func runOnDeckQueries(t *testing.T, q *Queries) { @@ -126,10 +125,10 @@ func runOnDeckQueries(t *testing.T, q *Queries) { func TestPrepared(t *testing.T) { t.Parallel() - uri := hosted.PostgreSQL(t, []string{"schema"}) + uri := local.PostgreSQL(t, []string{"schema"}) db, err := sql.Open("postgres", uri) if err != nil { - t.Fatal(err) + t.Fatalf("%s: %s", uri, err) } defer db.Close() @@ -144,10 +143,10 @@ func TestPrepared(t *testing.T) { func TestQueries(t *testing.T) { t.Parallel() - uri := hosted.PostgreSQL(t, []string{"schema"}) + uri := local.PostgreSQL(t, []string{"schema"}) db, err := sql.Open("postgres", uri) if err != nil { - t.Fatal(err) + t.Fatalf("%s: %s", uri, err) } defer db.Close() diff --git a/examples/ondeck/postgresql/models.go b/examples/ondeck/postgresql/models.go index 5f32237c2e..c0f65d7e65 100644 --- a/examples/ondeck/postgresql/models.go +++ b/examples/ondeck/postgresql/models.go @@ -1,6 +1,8 @@ +//go:build examples + // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck @@ -19,7 +21,7 @@ const ( StatusClosed Status = "clo@sed" ) -func (e *Status) Scan(src interface{}) error { +func (e *Status) Scan(src any) error { switch s := src.(type) { case []byte: *e = Status(s) @@ -37,7 +39,7 @@ type NullStatus struct { } // Scan implements the Scanner interface. -func (ns *NullStatus) Scan(value interface{}) error { +func (ns *NullStatus) Scan(value any) error { if value == nil { ns.Status, ns.Valid = "", false return nil diff --git a/examples/ondeck/postgresql/querier.go b/examples/ondeck/postgresql/querier.go index 27f622ca45..6b602d1c06 100644 --- a/examples/ondeck/postgresql/querier.go +++ b/examples/ondeck/postgresql/querier.go @@ -1,6 +1,8 @@ +//go:build examples + // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck diff --git a/examples/ondeck/postgresql/venue.sql.go b/examples/ondeck/postgresql/venue.sql.go index 212c4bd94a..0bc6713692 100644 --- a/examples/ondeck/postgresql/venue.sql.go +++ b/examples/ondeck/postgresql/venue.sql.go @@ -1,6 +1,8 @@ +//go:build examples + // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: venue.sql package ondeck diff --git a/examples/ondeck/sqlc.json b/examples/ondeck/sqlc.json index 0eed50f9d7..35f6570f1f 100644 --- a/examples/ondeck/sqlc.json +++ b/examples/ondeck/sqlc.json @@ -10,8 +10,9 @@ "schema": "postgresql/schema", "queries": "postgresql/query", "engine": "postgresql", + "sql_package": "database/sql", "database": { - "managed": true + "uri": "${VET_TEST_EXAMPLES_POSTGRES_ONDECK}" }, "analyzer": { "database": false @@ -19,6 +20,7 @@ "rules": [ "sqlc/db-prepare" ], + "build_tags": "examples", "emit_json_tags": true, "emit_prepared_queries": true, "emit_interface": true @@ -30,7 +32,7 @@ "queries": "mysql/query", "engine": "mysql", "database": { - "uri": "root:${MYSQL_ROOT_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/ondeck?multiStatements=true&parseTime=true" + "uri": "${VET_TEST_EXAMPLES_MYSQL_ONDECK}" }, "rules": [ "sqlc/db-prepare" @@ -56,4 +58,4 @@ "emit_interface": true } ] -} \ No newline at end of file +} diff --git a/examples/ondeck/sqlite/city.sql.go b/examples/ondeck/sqlite/city.sql.go index ca691a7b61..89b321ea7f 100644 --- a/examples/ondeck/sqlite/city.sql.go +++ b/examples/ondeck/sqlite/city.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: city.sql package ondeck diff --git a/examples/ondeck/sqlite/db.go b/examples/ondeck/sqlite/db.go index 06afcda08e..67cc093797 100644 --- a/examples/ondeck/sqlite/db.go +++ b/examples/ondeck/sqlite/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck @@ -11,10 +11,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -112,7 +112,7 @@ func (q *Queries) Close() error { return err } -func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (sql.Result, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) @@ -123,7 +123,7 @@ func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args . } } -func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Rows, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) @@ -134,7 +134,7 @@ func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args } } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) diff --git a/examples/ondeck/sqlite/db_test.go b/examples/ondeck/sqlite/db_test.go index f106256d45..e4bb4e4195 100644 --- a/examples/ondeck/sqlite/db_test.go +++ b/examples/ondeck/sqlite/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package ondeck @@ -150,6 +149,7 @@ func TestPrepared(t *testing.T) { t.Parallel() sdb, cleanup := sqltest.SQLite(t, []string{"schema"}) + defer sdb.Close() defer cleanup() q, err := Prepare(context.Background(), sdb) @@ -164,6 +164,7 @@ func TestQueries(t *testing.T) { t.Parallel() sdb, cleanup := sqltest.SQLite(t, []string{"schema"}) + defer sdb.Close() defer cleanup() runOnDeckQueries(t, New(sdb)) diff --git a/examples/ondeck/sqlite/models.go b/examples/ondeck/sqlite/models.go index 3d8ba8832c..2a6672343c 100644 --- a/examples/ondeck/sqlite/models.go +++ b/examples/ondeck/sqlite/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck diff --git a/examples/ondeck/sqlite/querier.go b/examples/ondeck/sqlite/querier.go index 5b92523605..e4773837b1 100644 --- a/examples/ondeck/sqlite/querier.go +++ b/examples/ondeck/sqlite/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package ondeck diff --git a/examples/ondeck/sqlite/venue.sql.go b/examples/ondeck/sqlite/venue.sql.go index 99eedb79da..6242a9ae2e 100644 --- a/examples/ondeck/sqlite/venue.sql.go +++ b/examples/ondeck/sqlite/venue.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: venue.sql package ondeck diff --git a/examples/python/requirements.txt b/examples/python/requirements.txt deleted file mode 100644 index 26f645a169..0000000000 --- a/examples/python/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -pytest~=6.2.2 -pytest-asyncio~=0.14.0 -psycopg2-binary~=2.8.6 -asyncpg~=0.21.0 -sqlalchemy==1.4.0 diff --git a/examples/python/sqlc.json b/examples/python/sqlc.json deleted file mode 100644 index 29d3cc8464..0000000000 --- a/examples/python/sqlc.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "../authors/postgresql/schema.sql", - "queries": "../authors/postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/authors", - "plugin": "py", - "options": { - "package": "authors", - "emit_sync_querier": true, - "emit_async_querier": true, - "query_parameter_limit": 5 - } - } - ] - }, - { - "schema": "../booktest/postgresql/schema.sql", - "queries": "../booktest/postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/booktest", - "plugin": "py", - "options": { - "package": "booktest", - "emit_async_querier": true, - "query_parameter_limit": 5 - } - } - ] - }, - { - "schema": "../jets/postgresql/schema.sql", - "queries": "../jets/postgresql/query-building.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "src/jets", - "plugin": "py", - "options": { - "package": "jets", - "emit_async_querier": true, - "query_parameter_limit": 5 - } - } - ] - }, - { - "schema": "../ondeck/postgresql/schema", - "queries": "../ondeck/postgresql/query", - "engine": "postgresql", - "codegen": [ - { - "out": "src/ondeck", - "plugin": "py", - "options": { - "package": "ondeck", - "emit_async_querier": true, - "query_parameter_limit": 5 - } - } - ] - } - ] -} diff --git a/examples/python/src/authors/models.py b/examples/python/src/authors/models.py deleted file mode 100644 index 143b8f88d3..0000000000 --- a/examples/python/src/authors/models.py +++ /dev/null @@ -1,12 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses -from typing import Optional - - -@dataclasses.dataclass() -class Author: - id: int - name: str - bio: Optional[str] diff --git a/examples/python/src/authors/query.py b/examples/python/src/authors/query.py deleted file mode 100644 index f4db2bd03d..0000000000 --- a/examples/python/src/authors/query.py +++ /dev/null @@ -1,112 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -from typing import AsyncIterator, Iterator, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from authors import models - - -CREATE_AUTHOR = """-- name: create_author \\:one -INSERT INTO authors ( - name, bio -) VALUES ( - :p1, :p2 -) -RETURNING id, name, bio -""" - - -DELETE_AUTHOR = """-- name: delete_author \\:exec -DELETE FROM authors -WHERE id = :p1 -""" - - -GET_AUTHOR = """-- name: get_author \\:one -SELECT id, name, bio FROM authors -WHERE id = :p1 LIMIT 1 -""" - - -LIST_AUTHORS = """-- name: list_authors \\:many -SELECT id, name, bio FROM authors -ORDER BY name -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Author]: - row = self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name, "p2": bio}).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - def delete_author(self, *, id: int) -> None: - self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id}) - - def get_author(self, *, id: int) -> Optional[models.Author]: - row = self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": id}).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - def list_authors(self) -> Iterator[models.Author]: - result = self._conn.execute(sqlalchemy.text(LIST_AUTHORS)) - for row in result: - yield models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name, "p2": bio})).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - async def delete_author(self, *, id: int) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id}) - - async def get_author(self, *, id: int) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": id})).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - async def list_authors(self) -> AsyncIterator[models.Author]: - result = await self._conn.stream(sqlalchemy.text(LIST_AUTHORS)) - async for row in result: - yield models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) diff --git a/examples/python/src/booktest/models.py b/examples/python/src/booktest/models.py deleted file mode 100644 index 903f299d50..0000000000 --- a/examples/python/src/booktest/models.py +++ /dev/null @@ -1,30 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses -import datetime -import enum -from typing import List - - -class BookType(str, enum.Enum): - FICTION = "FICTION" - NONFICTION = "NONFICTION" - - -@dataclasses.dataclass() -class Author: - author_id: int - name: str - - -@dataclasses.dataclass() -class Book: - book_id: int - author_id: int - isbn: str - book_type: BookType - title: str - year: int - available: datetime.datetime - tags: List[str] diff --git a/examples/python/src/booktest/query.py b/examples/python/src/booktest/query.py deleted file mode 100644 index c54eba214e..0000000000 --- a/examples/python/src/booktest/query.py +++ /dev/null @@ -1,211 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import dataclasses -import datetime -from typing import AsyncIterator, List, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from booktest import models - - -BOOKS_BY_TAGS = """-- name: books_by_tags \\:many -SELECT - book_id, - title, - name, - isbn, - tags -FROM books -LEFT JOIN authors ON books.author_id = authors.author_id -WHERE tags && :p1\\:\\:varchar[] -""" - - -@dataclasses.dataclass() -class BooksByTagsRow: - book_id: int - title: str - name: Optional[str] - isbn: str - tags: List[str] - - -BOOKS_BY_TITLE_YEAR = """-- name: books_by_title_year \\:many -SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books -WHERE title = :p1 AND year = :p2 -""" - - -CREATE_AUTHOR = """-- name: create_author \\:one -INSERT INTO authors (name) VALUES (:p1) -RETURNING author_id, name -""" - - -CREATE_BOOK = """-- name: create_book \\:one -INSERT INTO books ( - author_id, - isbn, - book_type, - title, - year, - available, - tags -) VALUES ( - :p1, - :p2, - :p3, - :p4, - :p5, - :p6, - :p7 -) -RETURNING book_id, author_id, isbn, book_type, title, year, available, tags -""" - - -@dataclasses.dataclass() -class CreateBookParams: - author_id: int - isbn: str - book_type: models.BookType - title: str - year: int - available: datetime.datetime - tags: List[str] - - -DELETE_BOOK = """-- name: delete_book \\:exec -DELETE FROM books -WHERE book_id = :p1 -""" - - -GET_AUTHOR = """-- name: get_author \\:one -SELECT author_id, name FROM authors -WHERE author_id = :p1 -""" - - -GET_BOOK = """-- name: get_book \\:one -SELECT book_id, author_id, isbn, book_type, title, year, available, tags FROM books -WHERE book_id = :p1 -""" - - -UPDATE_BOOK = """-- name: update_book \\:exec -UPDATE books -SET title = :p1, tags = :p2 -WHERE book_id = :p3 -""" - - -UPDATE_BOOK_ISBN = """-- name: update_book_isbn \\:exec -UPDATE books -SET title = :p1, tags = :p2, isbn = :p4 -WHERE book_id = :p3 -""" - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def books_by_tags(self, *, dollar_1: List[str]) -> AsyncIterator[BooksByTagsRow]: - result = await self._conn.stream(sqlalchemy.text(BOOKS_BY_TAGS), {"p1": dollar_1}) - async for row in result: - yield BooksByTagsRow( - book_id=row[0], - title=row[1], - name=row[2], - isbn=row[3], - tags=row[4], - ) - - async def books_by_title_year(self, *, title: str, year: int) -> AsyncIterator[models.Book]: - result = await self._conn.stream(sqlalchemy.text(BOOKS_BY_TITLE_YEAR), {"p1": title, "p2": year}) - async for row in result: - yield models.Book( - book_id=row[0], - author_id=row[1], - isbn=row[2], - book_type=row[3], - title=row[4], - year=row[5], - available=row[6], - tags=row[7], - ) - - async def create_author(self, *, name: str) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name})).first() - if row is None: - return None - return models.Author( - author_id=row[0], - name=row[1], - ) - - async def create_book(self, arg: CreateBookParams) -> Optional[models.Book]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_BOOK), { - "p1": arg.author_id, - "p2": arg.isbn, - "p3": arg.book_type, - "p4": arg.title, - "p5": arg.year, - "p6": arg.available, - "p7": arg.tags, - })).first() - if row is None: - return None - return models.Book( - book_id=row[0], - author_id=row[1], - isbn=row[2], - book_type=row[3], - title=row[4], - year=row[5], - available=row[6], - tags=row[7], - ) - - async def delete_book(self, *, book_id: int) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_BOOK), {"p1": book_id}) - - async def get_author(self, *, author_id: int) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": author_id})).first() - if row is None: - return None - return models.Author( - author_id=row[0], - name=row[1], - ) - - async def get_book(self, *, book_id: int) -> Optional[models.Book]: - row = (await self._conn.execute(sqlalchemy.text(GET_BOOK), {"p1": book_id})).first() - if row is None: - return None - return models.Book( - book_id=row[0], - author_id=row[1], - isbn=row[2], - book_type=row[3], - title=row[4], - year=row[5], - available=row[6], - tags=row[7], - ) - - async def update_book(self, *, title: str, tags: List[str], book_id: int) -> None: - await self._conn.execute(sqlalchemy.text(UPDATE_BOOK), {"p1": title, "p2": tags, "p3": book_id}) - - async def update_book_isbn(self, *, title: str, tags: List[str], book_id: int, isbn: str) -> None: - await self._conn.execute(sqlalchemy.text(UPDATE_BOOK_ISBN), { - "p1": title, - "p2": tags, - "p3": book_id, - "p4": isbn, - }) diff --git a/examples/python/src/dbtest/migrations.py b/examples/python/src/dbtest/migrations.py deleted file mode 100644 index 6ace6bcd63..0000000000 --- a/examples/python/src/dbtest/migrations.py +++ /dev/null @@ -1,43 +0,0 @@ -import os -from typing import List - -import sqlalchemy -import sqlalchemy.ext.asyncio - - -def apply_migrations(conn: sqlalchemy.engine.Connection, paths: List[str]): - files = _find_sql_files(paths) - - for file in files: - with open(file, "r") as fd: - blob = fd.read() - stmts = blob.split(";") - for stmt in stmts: - if stmt.strip(): - conn.execute(sqlalchemy.text(stmt)) - - -async def apply_migrations_async(conn: sqlalchemy.ext.asyncio.AsyncConnection, paths: List[str]): - files = _find_sql_files(paths) - - for file in files: - with open(file, "r") as fd: - blob = fd.read() - raw_conn = await conn.get_raw_connection() - # The asyncpg sqlalchemy adapter uses a prepared statement cache which can't handle the migration statements - await raw_conn._connection.execute(blob) - - -def _find_sql_files(paths: List[str]) -> List[str]: - files = [] - for path in paths: - if not os.path.exists(path): - raise FileNotFoundError(f"{path} does not exist") - if os.path.isdir(path): - for file in os.listdir(path): - if file.endswith(".sql"): - files.append(os.path.join(path, file)) - else: - files.append(path) - files.sort() - return files diff --git a/examples/python/src/jets/models.py b/examples/python/src/jets/models.py deleted file mode 100644 index 506a586b6e..0000000000 --- a/examples/python/src/jets/models.py +++ /dev/null @@ -1,31 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Jet: - id: int - pilot_id: int - age: int - name: str - color: str - - -@dataclasses.dataclass() -class Language: - id: int - language: str - - -@dataclasses.dataclass() -class Pilot: - id: int - name: str - - -@dataclasses.dataclass() -class PilotLanguage: - pilot_id: int - language_id: int diff --git a/examples/python/src/jets/query-building.py b/examples/python/src/jets/query-building.py deleted file mode 100644 index e02a371619..0000000000 --- a/examples/python/src/jets/query-building.py +++ /dev/null @@ -1,47 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query-building.sql -from typing import AsyncIterator, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from jets import models - - -COUNT_PILOTS = """-- name: count_pilots \\:one -SELECT COUNT(*) FROM pilots -""" - - -DELETE_PILOT = """-- name: delete_pilot \\:exec -DELETE FROM pilots WHERE id = :p1 -""" - - -LIST_PILOTS = """-- name: list_pilots \\:many -SELECT id, name FROM pilots LIMIT 5 -""" - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def count_pilots(self) -> Optional[int]: - row = (await self._conn.execute(sqlalchemy.text(COUNT_PILOTS))).first() - if row is None: - return None - return row[0] - - async def delete_pilot(self, *, id: int) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_PILOT), {"p1": id}) - - async def list_pilots(self) -> AsyncIterator[models.Pilot]: - result = await self._conn.stream(sqlalchemy.text(LIST_PILOTS)) - async for row in result: - yield models.Pilot( - id=row[0], - name=row[1], - ) diff --git a/examples/python/src/ondeck/city.py b/examples/python/src/ondeck/city.py deleted file mode 100644 index afd338ca3f..0000000000 --- a/examples/python/src/ondeck/city.py +++ /dev/null @@ -1,76 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: city.sql -from typing import AsyncIterator, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from ondeck import models - - -CREATE_CITY = """-- name: create_city \\:one -INSERT INTO city ( - name, - slug -) VALUES ( - :p1, - :p2 -) RETURNING slug, name -""" - - -GET_CITY = """-- name: get_city \\:one -SELECT slug, name -FROM city -WHERE slug = :p1 -""" - - -LIST_CITIES = """-- name: list_cities \\:many -SELECT slug, name -FROM city -ORDER BY name -""" - - -UPDATE_CITY_NAME = """-- name: update_city_name \\:exec -UPDATE city -SET name = :p2 -WHERE slug = :p1 -""" - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def create_city(self, *, name: str, slug: str) -> Optional[models.City]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_CITY), {"p1": name, "p2": slug})).first() - if row is None: - return None - return models.City( - slug=row[0], - name=row[1], - ) - - async def get_city(self, *, slug: str) -> Optional[models.City]: - row = (await self._conn.execute(sqlalchemy.text(GET_CITY), {"p1": slug})).first() - if row is None: - return None - return models.City( - slug=row[0], - name=row[1], - ) - - async def list_cities(self) -> AsyncIterator[models.City]: - result = await self._conn.stream(sqlalchemy.text(LIST_CITIES)) - async for row in result: - yield models.City( - slug=row[0], - name=row[1], - ) - - async def update_city_name(self, *, slug: str, name: str) -> None: - await self._conn.execute(sqlalchemy.text(UPDATE_CITY_NAME), {"p1": slug, "p2": name}) diff --git a/examples/python/src/ondeck/models.py b/examples/python/src/ondeck/models.py deleted file mode 100644 index b89452e35c..0000000000 --- a/examples/python/src/ondeck/models.py +++ /dev/null @@ -1,35 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses -import datetime -import enum -from typing import List, Optional - - -class Status(str, enum.Enum): - """Venues can be either open or closed""" - OPEN = "op!en" - CLOSED = "clo@sed" - - -@dataclasses.dataclass() -class City: - slug: str - name: str - - -@dataclasses.dataclass() -class Venue: - """Venues are places where muisc happens""" - id: int - status: Status - statuses: Optional[List[Status]] - # This value appears in public URLs - slug: str - name: str - city: str - spotify_playlist: str - songkick_id: Optional[str] - tags: Optional[List[str]] - created_at: datetime.datetime diff --git a/examples/python/src/ondeck/venue.py b/examples/python/src/ondeck/venue.py deleted file mode 100644 index 081a0d7780..0000000000 --- a/examples/python/src/ondeck/venue.py +++ /dev/null @@ -1,159 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: venue.sql -import dataclasses -from typing import AsyncIterator, List, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from ondeck import models - - -CREATE_VENUE = """-- name: create_venue \\:one -INSERT INTO venue ( - slug, - name, - city, - created_at, - spotify_playlist, - status, - statuses, - tags -) VALUES ( - :p1, - :p2, - :p3, - NOW(), - :p4, - :p5, - :p6, - :p7 -) RETURNING id -""" - - -@dataclasses.dataclass() -class CreateVenueParams: - slug: str - name: str - city: str - spotify_playlist: str - status: models.Status - statuses: Optional[List[models.Status]] - tags: Optional[List[str]] - - -DELETE_VENUE = """-- name: delete_venue \\:exec -DELETE FROM venue -WHERE slug = :p1 AND slug = :p1 -""" - - -GET_VENUE = """-- name: get_venue \\:one -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE slug = :p1 AND city = :p2 -""" - - -LIST_VENUES = """-- name: list_venues \\:many -SELECT id, status, statuses, slug, name, city, spotify_playlist, songkick_id, tags, created_at -FROM venue -WHERE city = :p1 -ORDER BY name -""" - - -UPDATE_VENUE_NAME = """-- name: update_venue_name \\:one -UPDATE venue -SET name = :p2 -WHERE slug = :p1 -RETURNING id -""" - - -VENUE_COUNT_BY_CITY = """-- name: venue_count_by_city \\:many -SELECT - city, - count(*) -FROM venue -GROUP BY 1 -ORDER BY 1 -""" - - -@dataclasses.dataclass() -class VenueCountByCityRow: - city: str - count: int - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def create_venue(self, arg: CreateVenueParams) -> Optional[int]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_VENUE), { - "p1": arg.slug, - "p2": arg.name, - "p3": arg.city, - "p4": arg.spotify_playlist, - "p5": arg.status, - "p6": arg.statuses, - "p7": arg.tags, - })).first() - if row is None: - return None - return row[0] - - async def delete_venue(self, *, slug: str) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_VENUE), {"p1": slug}) - - async def get_venue(self, *, slug: str, city: str) -> Optional[models.Venue]: - row = (await self._conn.execute(sqlalchemy.text(GET_VENUE), {"p1": slug, "p2": city})).first() - if row is None: - return None - return models.Venue( - id=row[0], - status=row[1], - statuses=row[2], - slug=row[3], - name=row[4], - city=row[5], - spotify_playlist=row[6], - songkick_id=row[7], - tags=row[8], - created_at=row[9], - ) - - async def list_venues(self, *, city: str) -> AsyncIterator[models.Venue]: - result = await self._conn.stream(sqlalchemy.text(LIST_VENUES), {"p1": city}) - async for row in result: - yield models.Venue( - id=row[0], - status=row[1], - statuses=row[2], - slug=row[3], - name=row[4], - city=row[5], - spotify_playlist=row[6], - songkick_id=row[7], - tags=row[8], - created_at=row[9], - ) - - async def update_venue_name(self, *, slug: str, name: str) -> Optional[int]: - row = (await self._conn.execute(sqlalchemy.text(UPDATE_VENUE_NAME), {"p1": slug, "p2": name})).first() - if row is None: - return None - return row[0] - - async def venue_count_by_city(self) -> AsyncIterator[VenueCountByCityRow]: - result = await self._conn.stream(sqlalchemy.text(VENUE_COUNT_BY_CITY)) - async for row in result: - yield VenueCountByCityRow( - city=row[0], - count=row[1], - ) diff --git a/examples/python/src/tests/conftest.py b/examples/python/src/tests/conftest.py deleted file mode 100644 index f807209229..0000000000 --- a/examples/python/src/tests/conftest.py +++ /dev/null @@ -1,67 +0,0 @@ -import asyncio -import os -import random - -import pytest -import sqlalchemy -import sqlalchemy.ext.asyncio - - -@pytest.fixture(scope="session") -def postgres_uri() -> str: - pg_host = os.environ.get("PG_HOST", "postgres") - pg_port = os.environ.get("PG_PORT", 5432) - pg_user = os.environ.get("PG_USER", "postgres") - pg_password = os.environ.get("PG_PASSWORD", "mysecretpassword") - pg_db = os.environ.get("PG_DATABASE", "dinotest") - - return f"postgresql://{pg_user}:{pg_password}@{pg_host}:{pg_port}/{pg_db}" - - -@pytest.fixture(scope="session") -def sqlalchemy_connection(postgres_uri) -> sqlalchemy.engine.Connection: - engine = sqlalchemy.create_engine(postgres_uri, future=True) - with engine.connect() as conn: - yield conn - - -@pytest.fixture(scope="function") -def db(sqlalchemy_connection: sqlalchemy.engine.Connection) -> sqlalchemy.engine.Connection: - conn = sqlalchemy_connection - schema_name = f"sqltest_{random.randint(0, 1000)}" - conn.execute(sqlalchemy.text(f"CREATE SCHEMA {schema_name}")) - conn.execute(sqlalchemy.text(f"SET search_path TO {schema_name}")) - conn.commit() - yield conn - conn.rollback() - conn.execute(sqlalchemy.text(f"DROP SCHEMA {schema_name} CASCADE")) - conn.execute(sqlalchemy.text("SET search_path TO public")) - - -@pytest.fixture(scope="session") -async def async_sqlalchemy_connection(postgres_uri) -> sqlalchemy.ext.asyncio.AsyncConnection: - postgres_uri = postgres_uri.replace("postgresql", "postgresql+asyncpg") - engine = sqlalchemy.ext.asyncio.create_async_engine(postgres_uri) - async with engine.connect() as conn: - yield conn - - -@pytest.fixture(scope="function") -async def async_db(async_sqlalchemy_connection: sqlalchemy.ext.asyncio.AsyncConnection) -> sqlalchemy.ext.asyncio.AsyncConnection: - conn = async_sqlalchemy_connection - schema_name = f"sqltest_{random.randint(0, 1000)}" - await conn.execute(sqlalchemy.text(f"CREATE SCHEMA {schema_name}")) - await conn.execute(sqlalchemy.text(f"SET search_path TO {schema_name}")) - await conn.commit() - yield conn - await conn.rollback() - await conn.execute(sqlalchemy.text(f"DROP SCHEMA {schema_name} CASCADE")) - await conn.execute(sqlalchemy.text("SET search_path TO public")) - - -@pytest.fixture(scope="session") -def event_loop(): - """Change event_loop fixture to session level.""" - loop = asyncio.get_event_loop_policy().new_event_loop() - yield loop - loop.close() diff --git a/examples/python/src/tests/test_authors.py b/examples/python/src/tests/test_authors.py deleted file mode 100644 index 7b0a954276..0000000000 --- a/examples/python/src/tests/test_authors.py +++ /dev/null @@ -1,56 +0,0 @@ -import os - -import pytest -import sqlalchemy.ext.asyncio - -from authors import query -from dbtest.migrations import apply_migrations, apply_migrations_async - - -def test_authors(db: sqlalchemy.engine.Connection): - apply_migrations(db, [os.path.dirname(__file__) + "/../../../authors/postgresql/schema.sql"]) - - querier = query.Querier(db) - - authors = list(querier.list_authors()) - assert authors == [] - - author_name = "Brian Kernighan" - author_bio = "Co-author of The C Programming Language and The Go Programming Language" - new_author = querier.create_author(name=author_name, bio=author_bio) - assert new_author.id > 0 - assert new_author.name == author_name - assert new_author.bio == author_bio - - db_author = querier.get_author(id=new_author.id) - assert db_author == new_author - - author_list = list(querier.list_authors()) - assert len(author_list) == 1 - assert author_list[0] == new_author - - -@pytest.mark.asyncio -async def test_authors_async(async_db: sqlalchemy.ext.asyncio.AsyncConnection): - await apply_migrations_async(async_db, [os.path.dirname(__file__) + "/../../../authors/postgresql/schema.sql"]) - - querier = query.AsyncQuerier(async_db) - - async for _ in querier.list_authors(): - assert False, "No authors should exist" - - author_name = "Brian Kernighan" - author_bio = "Co-author of The C Programming Language and The Go Programming Language" - new_author = await querier.create_author(name=author_name, bio=author_bio) - assert new_author.id > 0 - assert new_author.name == author_name - assert new_author.bio == author_bio - - db_author = await querier.get_author(id=new_author.id) - assert db_author == new_author - - author_list = [] - async for author in querier.list_authors(): - author_list.append(author) - assert len(author_list) == 1 - assert author_list[0] == new_author diff --git a/examples/python/src/tests/test_booktest.py b/examples/python/src/tests/test_booktest.py deleted file mode 100644 index 6106d9d3fd..0000000000 --- a/examples/python/src/tests/test_booktest.py +++ /dev/null @@ -1,85 +0,0 @@ -import datetime -import os - -import pytest -import sqlalchemy.ext.asyncio - -from booktest import query, models -from dbtest.migrations import apply_migrations_async - - -@pytest.mark.asyncio -async def test_books(async_db: sqlalchemy.ext.asyncio.AsyncConnection): - await apply_migrations_async(async_db, [os.path.dirname(__file__) + "/../../../booktest/postgresql/schema.sql"]) - - querier = query.AsyncQuerier(async_db) - - author = await querier.create_author(name="Unknown Master") - assert author is not None - - now = datetime.datetime.now() - await querier.create_book(query.CreateBookParams( - author_id=author.author_id, - isbn="1", - title="my book title", - book_type=models.BookType.FICTION, - year=2016, - available=now, - tags=[], - )) - - b1 = await querier.create_book(query.CreateBookParams( - author_id=author.author_id, - isbn="2", - title="the second book", - book_type=models.BookType.FICTION, - year=2016, - available=now, - tags=["cool", "unique"], - )) - - await querier.update_book(book_id=b1.book_id, title="changed second title", tags=["cool", "disastor"]) - - b3 = await querier.create_book(query.CreateBookParams( - author_id=author.author_id, - isbn="3", - title="the third book", - book_type=models.BookType.FICTION, - year=2001, - available=now, - tags=["cool"], - )) - - b4 = await querier.create_book(query.CreateBookParams( - author_id=author.author_id, - isbn="4", - title="4th place finisher", - book_type=models.BookType.NONFICTION, - year=2011, - available=now, - tags=["other"], - )) - - await querier.update_book_isbn(book_id=b4.book_id, isbn="NEW ISBN", title="never ever gonna finish, a quatrain", tags=["someother"]) - - books0 = querier.books_by_title_year(title="my book title", year=2016) - expected_titles = {"my book title"} - async for book in books0: - expected_titles.remove(book.title) # raises a key error if the title does not exist - assert len(book.tags) == 0 - - author = await querier.get_author(author_id=book.author_id) - assert author.name == "Unknown Master" - assert len(expected_titles) == 0 - - books = querier.books_by_tags(dollar_1=["cool", "other", "someother"]) - expected_titles = {"changed second title", "the third book", "never ever gonna finish, a quatrain"} - async for book in books: - expected_titles.remove(book.title) - assert len(expected_titles) == 0 - - b5 = await querier.get_book(book_id=b3.book_id) - assert b5 is not None - await querier.delete_book(book_id=b5.book_id) - b6 = await querier.get_book(book_id=b5.book_id) - assert b6 is None diff --git a/examples/python/src/tests/test_ondeck.py b/examples/python/src/tests/test_ondeck.py deleted file mode 100644 index 68cfbc9bcb..0000000000 --- a/examples/python/src/tests/test_ondeck.py +++ /dev/null @@ -1,53 +0,0 @@ -import os - -import pytest -import sqlalchemy.ext.asyncio - -from ondeck import models -from ondeck import city as city_queries -from ondeck import venue as venue_queries -from dbtest.migrations import apply_migrations_async - - -@pytest.mark.asyncio -async def test_ondeck(async_db: sqlalchemy.ext.asyncio.AsyncConnection): - await apply_migrations_async(async_db, [os.path.dirname(__file__) + "/../../../ondeck/postgresql/schema"]) - - city_querier = city_queries.AsyncQuerier(async_db) - venue_querier = venue_queries.AsyncQuerier(async_db) - - city = await city_querier.create_city(slug="san-francisco", name="San Francisco") - assert city is not None - - venue_id = await venue_querier.create_venue(venue_queries.CreateVenueParams( - slug="the-fillmore", - name="The Fillmore", - city=city.slug, - spotify_playlist="spotify:uri", - status=models.Status.OPEN, - statuses=[models.Status.OPEN, models.Status.CLOSED], - tags=["rock", "punk"], - )) - assert venue_id is not None - - venue = await venue_querier.get_venue(slug="the-fillmore", city=city.slug) - assert venue is not None - assert venue.id == venue_id - - assert city == await city_querier.get_city(slug=city.slug) - assert [venue_queries.VenueCountByCityRow(city=city.slug, count=1)] == await _to_list(venue_querier.venue_count_by_city()) - assert [city] == await _to_list(city_querier.list_cities()) - assert [venue] == await _to_list(venue_querier.list_venues(city=city.slug)) - - await city_querier.update_city_name(slug=city.slug, name="SF") - _id = await venue_querier.update_venue_name(slug=venue.slug, name="Fillmore") - assert _id == venue_id - - await venue_querier.delete_venue(slug=venue.slug) - - -async def _to_list(it): - out = [] - async for i in it: - out.append(i) - return out diff --git a/go.mod b/go.mod index 05edd4d2d9..63324a116a 100644 --- a/go.mod +++ b/go.mod @@ -1,66 +1,58 @@ module github.com/sqlc-dev/sqlc -go 1.21 +go 1.26.0 + +toolchain go1.26.5 require ( - github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1 - github.com/bytecodealliance/wasmtime-go/v13 v13.0.0 + cel.dev/cel-go v0.32.0 github.com/cubicdaiya/gonp v1.0.4 github.com/davecgh/go-spew v1.1.1 - github.com/go-sql-driver/mysql v1.7.1 - github.com/google/cel-go v0.18.1 - github.com/google/go-cmp v0.6.0 - github.com/jackc/pgconn v1.14.1 - github.com/jackc/pgx/v4 v4.18.1 - github.com/jackc/pgx/v5 v5.4.3 + github.com/fatih/structtag v1.2.0 + github.com/go-sql-driver/mysql v1.10.1 + github.com/google/go-cmp v0.7.0 + github.com/jackc/pgx/v5 v5.11.0 github.com/jinzhu/inflection v1.0.0 - github.com/lib/pq v1.10.9 - github.com/mattn/go-sqlite3 v1.14.17 - github.com/pganalyze/pg_query_go/v4 v4.2.3 + github.com/ncruces/go-sqlite3 v0.35.6 github.com/riza-io/grpc-go v0.2.0 - github.com/spf13/cobra v1.7.0 - github.com/spf13/pflag v1.0.5 + github.com/spf13/cobra v1.10.2 + github.com/spf13/pflag v1.0.10 + github.com/sqlc-dev/darkwing v0.1.0 + github.com/sqlc-dev/doubleclick v1.0.0 + github.com/sqlc-dev/marino v0.3.1 + github.com/sqlc-dev/meyer v0.1.2 + github.com/sqlc-dev/oliphant v0.2.0 + github.com/sqlc-dev/teesql v1.1.0 + github.com/sqlc-dev/zetajones v0.2.0 + github.com/tetratelabs/wazero v1.12.0 github.com/xeipuuv/gojsonschema v1.2.0 - golang.org/x/sync v0.4.0 - google.golang.org/grpc v1.58.3 - google.golang.org/protobuf v1.31.0 + github.com/yuin/goldmark v1.8.6 + golang.org/x/sync v0.24.0 + google.golang.org/grpc v1.84.0 + google.golang.org/protobuf v1.36.12 gopkg.in/yaml.v3 v3.0.1 ) require ( - github.com/benbjohnson/clock v1.3.5 // indirect - github.com/jackc/puddle/v2 v2.2.1 // indirect - github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c // indirect - github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect - github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 // indirect -) - -require ( - github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect - github.com/fatih/structtag v1.2.0 - github.com/golang/protobuf v1.5.3 // indirect + cel.dev/expr v0.25.2 // indirect + filippo.io/edwards25519 v1.2.0 // indirect + github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jackc/chunkreader/v2 v2.0.1 // indirect - github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.3.2 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgtype v1.14.0 - github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 // indirect - github.com/pingcap/log v1.1.0 // indirect - github.com/pingcap/tidb/parser v0.0.0-20231010133155-38cb4f3312be - github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect - github.com/stoewer/go-strcase v1.2.0 // indirect - go.uber.org/atomic v1.11.0 // indirect - go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.25.0 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20230724220655-d98519c11495 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/ncruces/go-sqlite3-wasm/v6 v6.3.35304 // indirect + github.com/ncruces/julianday v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.14.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect + golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect + golang.org/x/net v0.60.0 // indirect + golang.org/x/sys v0.48.0 // indirect + golang.org/x/text v0.42.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 // indirect ) diff --git a/go.sum b/go.sum index f780baa8dd..014545f708 100644 --- a/go.sum +++ b/go.sum @@ -1,336 +1,116 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1 h1:X8MJ0fnN5FPdcGF5Ij2/OW+HgiJrRg3AfHAx1PJtIzM= -github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= -github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/bytecodealliance/wasmtime-go/v13 v13.0.0 h1:o2PsUgSu6vMKr5S0+mz8EL3mZGQ0M8gHwS8/R0wY/wY= -github.com/bytecodealliance/wasmtime-go/v13 v13.0.0/go.mod h1:KmsZLdjjzNH/E5wbfoRehqP70tHzKlfNOi730VCAR4E= -github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= -github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +cel.dev/cel-go v0.32.0 h1:irvpFKr5EuGPyxeME03ERh0rii1TX+BDAnB9eL3IvNk= +cel.dev/cel-go v0.32.0/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU= +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cubicdaiya/gonp v1.0.4 h1:ky2uIAJh81WiLcGKBVD5R7KsM/36W6IqqTy6Bo6rGws= github.com/cubicdaiya/gonp v1.0.4/go.mod h1:iWGuP/7+JVTn02OWhRemVbMmG1DOUnmrGTYYACpOI0I= -github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 h1:iwZdTE0PVqJCos1vaoKsclOGD3ADKpshg3SRtYBbwso= -github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= -github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= -github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/cel-go v0.18.1 h1:V/lAXKq4C3BYLDy/ARzMtpkEEYfHQpZzVyzy69nEUjs= -github.com/google/cel-go v0.18.1/go.mod h1:PVAybmSnWkNMUZR/tEWFUiJ1Np4Hz0MHsZJcgC4zln4= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME= +github.com/go-sql-driver/mysql v1.10.1/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= -github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= -github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= -github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= -github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= -github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= -github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= -github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E= -github.com/jackc/pgconn v1.14.1 h1:smbxIaZA08n6YuxEX1sDyjV/qkbtUtkH20qLkR9MUR4= -github.com/jackc/pgconn v1.14.1/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E= -github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= -github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= -github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= -github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.3.2 h1:7eY55bdBeCz1F2fTzSz69QC+pG46jYq9/jtSPiJ5nn0= -github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= -github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= -github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= -github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.14.0 h1:y+xUdabmyMkJLyApYuPj38mW+aAIqCe5uuBB51rH3Vw= -github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= -github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= -github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= -github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= -github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.18.1 h1:YP7G1KABtKpB5IHrO9vYwSrCOhs7p3uqhvhhQBptya0= -github.com/jackc/pgx/v4 v4.18.1/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE= -github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= -github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= -github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0= -github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= -github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.11.0 h1:IzBBtyK9AHqf98cctWFifYSci2hgQR/cd56wB4p+ogg= +github.com/jackc/pgx/v5 v5.11.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= -github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= -github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/pganalyze/pg_query_go/v4 v4.2.3 h1:cNLqyiVMasV7YGWyYV+fkXyHp32gDfXVNCqoHztEGNk= -github.com/pganalyze/pg_query_go/v4 v4.2.3/go.mod h1:aEkDNOXNM5j0YGzaAapwJ7LB3dLNj+bvbWcLv1hOVqA= -github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 h1:+FZIDR/D97YOPik4N4lPDaUcLDF/EQPogxtlHB2ZZRM= -github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= -github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c h1:CgbKAHto5CQgWM9fSBIvaxsJHuGP0uM74HXtv3MyyGQ= -github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c/go.mod h1:4qGtCB0QK0wBzKtFEGDhxXnSnbQApw1gc9siScUl8ew= -github.com/pingcap/log v1.1.0 h1:ELiPxACz7vdo1qAvvaWJg1NrYFoY6gqAh/+Uo6aXdD8= -github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= -github.com/pingcap/tidb/parser v0.0.0-20230815160630-b69fa21942d1 h1:FvX5fDJ32eblK9f6KJIOVujjtu3FDEfcRGHsEDfJ4kI= -github.com/pingcap/tidb/parser v0.0.0-20230815160630-b69fa21942d1/go.mod h1:pWA6mNa/o7UTDKrg+4H75NdpRgpWRTox/cqQjaQ4ZBU= -github.com/pingcap/tidb/parser v0.0.0-20231010133155-38cb4f3312be h1:4HUBkIZs+4j+tbXGm5/B0yjB66OTz218HDKA6VrhO7U= -github.com/pingcap/tidb/parser v0.0.0-20231010133155-38cb4f3312be/go.mod h1:cwq4bKUlftpWuznB+rqNwbN0xy6/i5SL/nYvEKeJn4s= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/ncruces/go-sqlite3 v0.35.6 h1:0JGlMne89YzKNP2CJBuiH21EEzSQNuB7pfvCbKBn0Jg= +github.com/ncruces/go-sqlite3 v0.35.6/go.mod h1:6MfWBOFbHJVSJxmTCIUKCJdLl4TKkgO895RHerlDVo8= +github.com/ncruces/go-sqlite3-wasm/v6 v6.3.35304 h1:dBSZlcEFdtBMvNRg34y50mConBPO/petSddSwGQVlSI= +github.com/ncruces/go-sqlite3-wasm/v6 v6.3.35304/go.mod h1:YvoJzbJpX6phd3BGdtiXu2NuD5RX6G8zsUdzt47GgOY= +github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= +github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/riza-io/grpc-go v0.2.0 h1:2HxQKFVE7VuYstcJ8zqpN84VnAoJ4dCL6YFhJewNcHQ= github.com/riza-io/grpc-go v0.2.0/go.mod h1:2bDvR9KkKC3KhtlSHfR3dAXjUMT86kg4UfWFyVGWqi8= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= -github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= -github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/sqlc-dev/darkwing v0.1.0 h1:P5dtJebmCiy10e6DcnBQ2d7Mwuz636obuSAzTlr/1Qo= +github.com/sqlc-dev/darkwing v0.1.0/go.mod h1:kPb+99a6U+oVWtLhsuvkuDb/YRm8deK6x+W/9mX6uug= +github.com/sqlc-dev/doubleclick v1.0.0 h1:2/OApfQ2eLgcfa/Fqs8WSMA6atH0G8j9hHbQIgMfAXI= +github.com/sqlc-dev/doubleclick v1.0.0/go.mod h1:ODHRroSrk/rr5neRHlWMSRijqOak8YmNaO3VAZCNl5Y= +github.com/sqlc-dev/marino v0.3.1 h1:5LkfxftC+drpX1NE6ULTSJlRQ3FzvaFgmXSik+s0Q1Y= +github.com/sqlc-dev/marino v0.3.1/go.mod h1:mQxC2dgDE0DWHMb2B5jZNk7KToJuS6wnxnffBfYnq08= +github.com/sqlc-dev/meyer v0.1.2 h1:40Ng9Glnx7CTf3yOYV7jfvDIN7voIFjrStkIULS+uws= +github.com/sqlc-dev/meyer v0.1.2/go.mod h1:pS4USCRf/SLjWtaMcnTo4YrEEFKBj8CyyqlxcVUJQH8= +github.com/sqlc-dev/oliphant v0.2.0 h1:jJ/s2fh4Plj3U1HsdqiY/clw/IHb4FCNaHfqirwxcsI= +github.com/sqlc-dev/oliphant v0.2.0/go.mod h1:fRM/t4FutRddTIq2YCuS4O9o+2rRwSwELRvLMqtPloo= +github.com/sqlc-dev/teesql v1.1.0 h1:3sVYQ9FGxQVcqrqQOQ27bk0aF4c4yN1H1zLL79uaSxQ= +github.com/sqlc-dev/teesql v1.1.0/go.mod h1:WwOp9UtnxG17+eNFT5KXu/AGBQ8ucdGc8wIOpnj4XCI= +github.com/sqlc-dev/zetajones v0.2.0 h1:MSOmZfik8ue884guNFXV1WoPydNA4kjHZN1U3arPBIM= +github.com/sqlc-dev/zetajones v0.2.0/go.mod h1:dU1DxwqC6Cahbpnw16KpH1J2waWRDMdwyDSvovMZR4I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/tetratelabs/wazero v1.12.0 h1:DuWcpNu/FzgEXgGBDp8J1Spc+CWOvvtvVyjKlaZopYU= +github.com/tetratelabs/wazero v1.12.0/go.mod h1:LvKtzl2RqO4gyF27BiXU+nKAjcV8f38U+kP/q2vgxh0= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= -go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/exp v0.0.0-20230724220655-d98519c11495 h1:zKGKw2WlGb8oPoRGqQ2PT8g2YoCN1w/YbbQjHXCdUWE= -golang.org/x/exp v0.0.0-20230724220655-d98519c11495/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 h1:eSaPbMR4T7WfH9FvABk36NBMacoTUKdWCvV0dx+KfOg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +github.com/yuin/goldmark v1.8.6 h1:d0VcaP1sx9GkFVkoW+KtggpGi2KZ965i14b0+bDQST4= +github.com/yuin/goldmark v1.8.6/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= +golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= +golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= +golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d h1:QwnJwPte4XXAkhPu26LTDIahnsMSUV0kK8HkxbC+Pc4= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d/go.mod h1:WRrQ7/7N19PypuT0fxLOL5Lq0waoiRri4FbtHDEKrGE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 h1:cYNAzI2sUwhmCcoj9TxvihSrqsxt6uIkj3rDRhSDmW4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA= +google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0= +google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= -gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/gomod_test.go b/gomod_test.go new file mode 100644 index 0000000000..fd00b12e6f --- /dev/null +++ b/gomod_test.go @@ -0,0 +1,66 @@ +package sqlc + +import ( + "fmt" + "os" + "strings" + "testing" +) + +// TestGoModHasNoReplaceDirectives guards against regressions of +// https://github.com/sqlc-dev/sqlc/issues/4397. +// +// When go.mod contains a replace directive, the Go toolchain refuses to run +// `go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest` (and the equivalent +// `go run ...@latest`): +// +// go: github.com/sqlc-dev/sqlc/cmd/sqlc@latest (in github.com/sqlc-dev/sqlc@v...): +// The go.mod file for the module providing named packages contains one or +// more replace directives. It must not contain directives that would cause +// it to be interpreted differently than if it were the main module. +// +// https://docs.sqlc.dev/en/latest/overview/install.html tells users to run +// exactly that command, so any replace directive slipping into go.mod breaks +// the advertised installation path for the next release. +func TestGoModHasNoReplaceDirectives(t *testing.T) { + data, err := os.ReadFile("go.mod") + if err != nil { + t.Fatalf("read go.mod: %v", err) + } + + var ( + inBlock bool + offenders []string + ) + for i, raw := range strings.Split(string(data), "\n") { + line := strings.TrimSpace(raw) + if idx := strings.Index(line, "//"); idx >= 0 { + line = strings.TrimSpace(line[:idx]) + } + + if inBlock { + if line == ")" { + inBlock = false + continue + } + if line != "" { + offenders = append(offenders, fmt.Sprintf(" go.mod:%d: %s", i+1, raw)) + } + continue + } + + switch { + case line == "replace (": + inBlock = true + case strings.HasPrefix(line, "replace "): + offenders = append(offenders, fmt.Sprintf(" go.mod:%d: %s", i+1, raw)) + } + } + + if len(offenders) > 0 { + t.Fatalf("go.mod must not contain replace directives; "+ + "they break `go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest`.\n"+ + "See https://github.com/sqlc-dev/sqlc/issues/4397\n%s", + strings.Join(offenders, "\n")) + } +} diff --git a/internal/analysis/analysis.pb.go b/internal/analysis/analysis.pb.go new file mode 100644 index 0000000000..e039cd6162 --- /dev/null +++ b/internal/analysis/analysis.pb.go @@ -0,0 +1,546 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: analysis/analysis.proto + +package analysis + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Identifier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Catalog string `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"` + Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Identifier) Reset() { + *x = Identifier{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_analysis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Identifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Identifier) ProtoMessage() {} + +func (x *Identifier) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Identifier.ProtoReflect.Descriptor instead. +func (*Identifier) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{0} +} + +func (x *Identifier) GetCatalog() string { + if x != nil { + return x.Catalog + } + return "" +} + +func (x *Identifier) GetSchema() string { + if x != nil { + return x.Schema + } + return "" +} + +func (x *Identifier) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Column struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + OriginalName string `protobuf:"bytes,2,opt,name=original_name,json=originalName,proto3" json:"original_name,omitempty"` + DataType string `protobuf:"bytes,3,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"` + NotNull bool `protobuf:"varint,4,opt,name=not_null,json=notNull,proto3" json:"not_null,omitempty"` + Unsigned bool `protobuf:"varint,5,opt,name=unsigned,proto3" json:"unsigned,omitempty"` + IsArray bool `protobuf:"varint,6,opt,name=is_array,json=isArray,proto3" json:"is_array,omitempty"` + ArrayDims int32 `protobuf:"varint,7,opt,name=array_dims,json=arrayDims,proto3" json:"array_dims,omitempty"` + Comment string `protobuf:"bytes,8,opt,name=comment,proto3" json:"comment,omitempty"` + Length int32 `protobuf:"varint,9,opt,name=length,proto3" json:"length,omitempty"` // *int + IsNamedParam bool `protobuf:"varint,10,opt,name=is_named_param,json=isNamedParam,proto3" json:"is_named_param,omitempty"` + IsFuncCall bool `protobuf:"varint,11,opt,name=is_func_call,json=isFuncCall,proto3" json:"is_func_call,omitempty"` + Scope string `protobuf:"bytes,12,opt,name=scope,proto3" json:"scope,omitempty"` + Table *Identifier `protobuf:"bytes,13,opt,name=table,proto3" json:"table,omitempty"` + TableAlias string `protobuf:"bytes,14,opt,name=table_alias,json=tableAlias,proto3" json:"table_alias,omitempty"` + Type *Identifier `protobuf:"bytes,15,opt,name=type,proto3" json:"type,omitempty"` + EmbedTable *Identifier `protobuf:"bytes,16,opt,name=embed_table,json=embedTable,proto3" json:"embed_table,omitempty"` + IsSqlcSlice bool `protobuf:"varint,17,opt,name=is_sqlc_slice,json=isSqlcSlice,proto3" json:"is_sqlc_slice,omitempty"` +} + +func (x *Column) Reset() { + *x = Column{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_analysis_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Column) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Column) ProtoMessage() {} + +func (x *Column) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Column.ProtoReflect.Descriptor instead. +func (*Column) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{1} +} + +func (x *Column) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Column) GetOriginalName() string { + if x != nil { + return x.OriginalName + } + return "" +} + +func (x *Column) GetDataType() string { + if x != nil { + return x.DataType + } + return "" +} + +func (x *Column) GetNotNull() bool { + if x != nil { + return x.NotNull + } + return false +} + +func (x *Column) GetUnsigned() bool { + if x != nil { + return x.Unsigned + } + return false +} + +func (x *Column) GetIsArray() bool { + if x != nil { + return x.IsArray + } + return false +} + +func (x *Column) GetArrayDims() int32 { + if x != nil { + return x.ArrayDims + } + return 0 +} + +func (x *Column) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + +func (x *Column) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *Column) GetIsNamedParam() bool { + if x != nil { + return x.IsNamedParam + } + return false +} + +func (x *Column) GetIsFuncCall() bool { + if x != nil { + return x.IsFuncCall + } + return false +} + +func (x *Column) GetScope() string { + if x != nil { + return x.Scope + } + return "" +} + +func (x *Column) GetTable() *Identifier { + if x != nil { + return x.Table + } + return nil +} + +func (x *Column) GetTableAlias() string { + if x != nil { + return x.TableAlias + } + return "" +} + +func (x *Column) GetType() *Identifier { + if x != nil { + return x.Type + } + return nil +} + +func (x *Column) GetEmbedTable() *Identifier { + if x != nil { + return x.EmbedTable + } + return nil +} + +func (x *Column) GetIsSqlcSlice() bool { + if x != nil { + return x.IsSqlcSlice + } + return false +} + +type Parameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + Column *Column `protobuf:"bytes,2,opt,name=column,proto3" json:"column,omitempty"` +} + +func (x *Parameter) Reset() { + *x = Parameter{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_analysis_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Parameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Parameter) ProtoMessage() {} + +func (x *Parameter) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Parameter.ProtoReflect.Descriptor instead. +func (*Parameter) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{2} +} + +func (x *Parameter) GetNumber() int32 { + if x != nil { + return x.Number + } + return 0 +} + +func (x *Parameter) GetColumn() *Column { + if x != nil { + return x.Column + } + return nil +} + +type Analysis struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Columns []*Column `protobuf:"bytes,1,rep,name=columns,proto3" json:"columns,omitempty"` + Params []*Parameter `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` +} + +func (x *Analysis) Reset() { + *x = Analysis{} + if protoimpl.UnsafeEnabled { + mi := &file_analysis_analysis_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Analysis) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Analysis) ProtoMessage() {} + +func (x *Analysis) ProtoReflect() protoreflect.Message { + mi := &file_analysis_analysis_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Analysis.ProtoReflect.Descriptor instead. +func (*Analysis) Descriptor() ([]byte, []int) { + return file_analysis_analysis_proto_rawDescGZIP(), []int{3} +} + +func (x *Analysis) GetColumns() []*Column { + if x != nil { + return x.Columns + } + return nil +} + +func (x *Analysis) GetParams() []*Parameter { + if x != nil { + return x.Params + } + return nil +} + +var File_analysis_analysis_proto protoreflect.FileDescriptor + +var file_analysis_analysis_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2f, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x73, 0x69, 0x73, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xb1, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, + 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, + 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x4e, + 0x75, 0x6c, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, + 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x72, + 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, + 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, + 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, + 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, + 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, + 0x73, 0x69, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, + 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x35, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, + 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, + 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, + 0x6c, 0x63, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, + 0x69, 0x73, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x22, 0x4d, 0x0a, 0x09, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x28, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0x63, 0x0a, 0x08, 0x41, 0x6e, + 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, + 0x69, 0x73, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 0x73, 0x12, 0x2b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, + 0x89, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, + 0x42, 0x0d, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, + 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xa2, 0x02, 0x03, + 0x41, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xca, 0x02, + 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0xe2, 0x02, 0x14, 0x41, 0x6e, 0x61, 0x6c, + 0x79, 0x73, 0x69, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x08, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_analysis_analysis_proto_rawDescOnce sync.Once + file_analysis_analysis_proto_rawDescData = file_analysis_analysis_proto_rawDesc +) + +func file_analysis_analysis_proto_rawDescGZIP() []byte { + file_analysis_analysis_proto_rawDescOnce.Do(func() { + file_analysis_analysis_proto_rawDescData = protoimpl.X.CompressGZIP(file_analysis_analysis_proto_rawDescData) + }) + return file_analysis_analysis_proto_rawDescData +} + +var file_analysis_analysis_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_analysis_analysis_proto_goTypes = []interface{}{ + (*Identifier)(nil), // 0: analysis.Identifier + (*Column)(nil), // 1: analysis.Column + (*Parameter)(nil), // 2: analysis.Parameter + (*Analysis)(nil), // 3: analysis.Analysis +} +var file_analysis_analysis_proto_depIdxs = []int32{ + 0, // 0: analysis.Column.table:type_name -> analysis.Identifier + 0, // 1: analysis.Column.type:type_name -> analysis.Identifier + 0, // 2: analysis.Column.embed_table:type_name -> analysis.Identifier + 1, // 3: analysis.Parameter.column:type_name -> analysis.Column + 1, // 4: analysis.Analysis.columns:type_name -> analysis.Column + 2, // 5: analysis.Analysis.params:type_name -> analysis.Parameter + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_analysis_analysis_proto_init() } +func file_analysis_analysis_proto_init() { + if File_analysis_analysis_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_analysis_analysis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Identifier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_analysis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Column); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_analysis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Parameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_analysis_analysis_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Analysis); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_analysis_analysis_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_analysis_analysis_proto_goTypes, + DependencyIndexes: file_analysis_analysis_proto_depIdxs, + MessageInfos: file_analysis_analysis_proto_msgTypes, + }.Build() + File_analysis_analysis_proto = out.File + file_analysis_analysis_proto_rawDesc = nil + file_analysis_analysis_proto_goTypes = nil + file_analysis_analysis_proto_depIdxs = nil +} diff --git a/internal/analysis/analysis_vtproto.pb.go b/internal/analysis/analysis_vtproto.pb.go new file mode 100644 index 0000000000..7aacb8635b --- /dev/null +++ b/internal/analysis/analysis_vtproto.pb.go @@ -0,0 +1,2078 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.4.0 +// source: analysis/analysis.proto + +package analysis + +import ( + fmt "fmt" + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + bits "math/bits" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *Identifier) CloneVT() *Identifier { + if m == nil { + return (*Identifier)(nil) + } + r := &Identifier{ + Catalog: m.Catalog, + Schema: m.Schema, + Name: m.Name, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Identifier) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Column) CloneVT() *Column { + if m == nil { + return (*Column)(nil) + } + r := &Column{ + Name: m.Name, + OriginalName: m.OriginalName, + DataType: m.DataType, + NotNull: m.NotNull, + Unsigned: m.Unsigned, + IsArray: m.IsArray, + ArrayDims: m.ArrayDims, + Comment: m.Comment, + Length: m.Length, + IsNamedParam: m.IsNamedParam, + IsFuncCall: m.IsFuncCall, + Scope: m.Scope, + Table: m.Table.CloneVT(), + TableAlias: m.TableAlias, + Type: m.Type.CloneVT(), + EmbedTable: m.EmbedTable.CloneVT(), + IsSqlcSlice: m.IsSqlcSlice, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Column) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Parameter) CloneVT() *Parameter { + if m == nil { + return (*Parameter)(nil) + } + r := &Parameter{ + Number: m.Number, + Column: m.Column.CloneVT(), + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Parameter) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *Analysis) CloneVT() *Analysis { + if m == nil { + return (*Analysis)(nil) + } + r := &Analysis{} + if rhs := m.Columns; rhs != nil { + tmpContainer := make([]*Column, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Columns = tmpContainer + } + if rhs := m.Params; rhs != nil { + tmpContainer := make([]*Parameter, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Params = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Analysis) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (this *Identifier) EqualVT(that *Identifier) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Catalog != that.Catalog { + return false + } + if this.Schema != that.Schema { + return false + } + if this.Name != that.Name { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Identifier) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Identifier) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Column) EqualVT(that *Column) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Name != that.Name { + return false + } + if this.OriginalName != that.OriginalName { + return false + } + if this.DataType != that.DataType { + return false + } + if this.NotNull != that.NotNull { + return false + } + if this.Unsigned != that.Unsigned { + return false + } + if this.IsArray != that.IsArray { + return false + } + if this.ArrayDims != that.ArrayDims { + return false + } + if this.Comment != that.Comment { + return false + } + if this.Length != that.Length { + return false + } + if this.IsNamedParam != that.IsNamedParam { + return false + } + if this.IsFuncCall != that.IsFuncCall { + return false + } + if this.Scope != that.Scope { + return false + } + if !this.Table.EqualVT(that.Table) { + return false + } + if this.TableAlias != that.TableAlias { + return false + } + if !this.Type.EqualVT(that.Type) { + return false + } + if !this.EmbedTable.EqualVT(that.EmbedTable) { + return false + } + if this.IsSqlcSlice != that.IsSqlcSlice { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Column) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Column) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Parameter) EqualVT(that *Parameter) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Number != that.Number { + return false + } + if !this.Column.EqualVT(that.Column) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Parameter) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Parameter) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Analysis) EqualVT(that *Analysis) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.Columns) != len(that.Columns) { + return false + } + for i, vx := range this.Columns { + vy := that.Columns[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Column{} + } + if q == nil { + q = &Column{} + } + if !p.EqualVT(q) { + return false + } + } + } + if len(this.Params) != len(that.Params) { + return false + } + for i, vx := range this.Params { + vy := that.Params[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Parameter{} + } + if q == nil { + q = &Parameter{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Analysis) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Analysis) + if !ok { + return false + } + return this.EqualVT(that) +} +func (m *Identifier) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Identifier) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Identifier) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarint(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x12 + } + if len(m.Catalog) > 0 { + i -= len(m.Catalog) + copy(dAtA[i:], m.Catalog) + i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Column) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Column) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Column) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.IsSqlcSlice { + i-- + if m.IsSqlcSlice { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.EmbedTable != nil { + size, err := m.EmbedTable.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if m.Type != nil { + size, err := m.Type.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x7a + } + if len(m.TableAlias) > 0 { + i -= len(m.TableAlias) + copy(dAtA[i:], m.TableAlias) + i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) + i-- + dAtA[i] = 0x72 + } + if m.Table != nil { + size, err := m.Table.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x6a + } + if len(m.Scope) > 0 { + i -= len(m.Scope) + copy(dAtA[i:], m.Scope) + i = encodeVarint(dAtA, i, uint64(len(m.Scope))) + i-- + dAtA[i] = 0x62 + } + if m.IsFuncCall { + i-- + if m.IsFuncCall { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.IsNamedParam { + i-- + if m.IsNamedParam { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + if m.Length != 0 { + i = encodeVarint(dAtA, i, uint64(m.Length)) + i-- + dAtA[i] = 0x48 + } + if len(m.Comment) > 0 { + i -= len(m.Comment) + copy(dAtA[i:], m.Comment) + i = encodeVarint(dAtA, i, uint64(len(m.Comment))) + i-- + dAtA[i] = 0x42 + } + if m.ArrayDims != 0 { + i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) + i-- + dAtA[i] = 0x38 + } + if m.IsArray { + i-- + if m.IsArray { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.Unsigned { + i-- + if m.Unsigned { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.NotNull { + i-- + if m.NotNull { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.DataType) > 0 { + i -= len(m.DataType) + copy(dAtA[i:], m.DataType) + i = encodeVarint(dAtA, i, uint64(len(m.DataType))) + i-- + dAtA[i] = 0x1a + } + if len(m.OriginalName) > 0 { + i -= len(m.OriginalName) + copy(dAtA[i:], m.OriginalName) + i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Parameter) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Parameter) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Parameter) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Column != nil { + size, err := m.Column.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Number != 0 { + i = encodeVarint(dAtA, i, uint64(m.Number)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Analysis) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Analysis) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Analysis) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Params) > 0 { + for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Params[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Columns) > 0 { + for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Columns[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarint(dAtA []byte, offset int, v uint64) int { + offset -= sov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Identifier) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Identifier) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Identifier) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarint(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x12 + } + if len(m.Catalog) > 0 { + i -= len(m.Catalog) + copy(dAtA[i:], m.Catalog) + i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Column) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Column) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Column) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.IsSqlcSlice { + i-- + if m.IsSqlcSlice { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.EmbedTable != nil { + size, err := m.EmbedTable.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if m.Type != nil { + size, err := m.Type.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x7a + } + if len(m.TableAlias) > 0 { + i -= len(m.TableAlias) + copy(dAtA[i:], m.TableAlias) + i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) + i-- + dAtA[i] = 0x72 + } + if m.Table != nil { + size, err := m.Table.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x6a + } + if len(m.Scope) > 0 { + i -= len(m.Scope) + copy(dAtA[i:], m.Scope) + i = encodeVarint(dAtA, i, uint64(len(m.Scope))) + i-- + dAtA[i] = 0x62 + } + if m.IsFuncCall { + i-- + if m.IsFuncCall { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if m.IsNamedParam { + i-- + if m.IsNamedParam { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + if m.Length != 0 { + i = encodeVarint(dAtA, i, uint64(m.Length)) + i-- + dAtA[i] = 0x48 + } + if len(m.Comment) > 0 { + i -= len(m.Comment) + copy(dAtA[i:], m.Comment) + i = encodeVarint(dAtA, i, uint64(len(m.Comment))) + i-- + dAtA[i] = 0x42 + } + if m.ArrayDims != 0 { + i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) + i-- + dAtA[i] = 0x38 + } + if m.IsArray { + i-- + if m.IsArray { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.Unsigned { + i-- + if m.Unsigned { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.NotNull { + i-- + if m.NotNull { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.DataType) > 0 { + i -= len(m.DataType) + copy(dAtA[i:], m.DataType) + i = encodeVarint(dAtA, i, uint64(len(m.DataType))) + i-- + dAtA[i] = 0x1a + } + if len(m.OriginalName) > 0 { + i -= len(m.OriginalName) + copy(dAtA[i:], m.OriginalName) + i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarint(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Parameter) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Parameter) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Parameter) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Column != nil { + size, err := m.Column.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Number != 0 { + i = encodeVarint(dAtA, i, uint64(m.Number)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Analysis) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Analysis) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Analysis) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Params) > 0 { + for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Params[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Columns) > 0 { + for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Columns[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Identifier) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Catalog) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Schema) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Column) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.OriginalName) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.DataType) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.NotNull { + n += 2 + } + if m.Unsigned { + n += 2 + } + if m.IsArray { + n += 2 + } + if m.ArrayDims != 0 { + n += 1 + sov(uint64(m.ArrayDims)) + } + l = len(m.Comment) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Length != 0 { + n += 1 + sov(uint64(m.Length)) + } + if m.IsNamedParam { + n += 2 + } + if m.IsFuncCall { + n += 2 + } + l = len(m.Scope) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Table != nil { + l = m.Table.SizeVT() + n += 1 + l + sov(uint64(l)) + } + l = len(m.TableAlias) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Type != nil { + l = m.Type.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if m.EmbedTable != nil { + l = m.EmbedTable.SizeVT() + n += 2 + l + sov(uint64(l)) + } + if m.IsSqlcSlice { + n += 3 + } + n += len(m.unknownFields) + return n +} + +func (m *Parameter) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Number != 0 { + n += 1 + sov(uint64(m.Number)) + } + if m.Column != nil { + l = m.Column.SizeVT() + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Analysis) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Columns) > 0 { + for _, e := range m.Columns { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + if len(m.Params) > 0 { + for _, e := range m.Params { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func sov(x uint64) (n int) { + return (bits.Len64(x|1) + 6) / 7 +} +func soz(x uint64) (n int) { + return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Identifier) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Identifier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Identifier: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Catalog", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Catalog = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Schema = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Column) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Column: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Column: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OriginalName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OriginalName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NotNull", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.NotNull = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Unsigned = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsArray", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsArray = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ArrayDims", wireType) + } + m.ArrayDims = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ArrayDims |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Comment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) + } + m.Length = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Length |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsNamedParam", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsNamedParam = bool(v != 0) + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsFuncCall", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsFuncCall = bool(v != 0) + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Scope", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Scope = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Table == nil { + m.Table = &Identifier{} + } + if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableAlias", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableAlias = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Type == nil { + m.Type = &Identifier{} + } + if err := m.Type.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EmbedTable", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EmbedTable == nil { + m.EmbedTable = &Identifier{} + } + if err := m.EmbedTable.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsSqlcSlice", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsSqlcSlice = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Parameter) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Parameter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Parameter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) + } + m.Number = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Number |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Column", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Column == nil { + m.Column = &Column{} + } + if err := m.Column.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Analysis) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Analysis: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Analysis: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Columns = append(m.Columns, &Column{}) + if err := m.Columns[len(m.Columns)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Params = append(m.Params, &Parameter{}) + if err := m.Params[len(m.Params)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} + +func skip(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLength + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroup + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLength + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") +) diff --git a/internal/analyzer/analyzer.go b/internal/analyzer/analyzer.go index 4ad7034823..81094ef4d3 100644 --- a/internal/analyzer/analyzer.go +++ b/internal/analyzer/analyzer.go @@ -2,45 +2,130 @@ package analyzer import ( "context" + "encoding/json" + "errors" + "log/slog" + "google.golang.org/protobuf/proto" + + "github.com/sqlc-dev/sqlc/internal/analysis" + "github.com/sqlc-dev/sqlc/internal/cache" + "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/named" ) -type Column struct { - Name string - OriginalName string - DataType string - NotNull bool - Unsigned bool - IsArray bool - ArrayDims int - Comment string - Length *int - IsNamedParam bool - IsFuncCall bool - - // XXX: Figure out what PostgreSQL calls `foo.id` - Scope string - Table *ast.TableName - TableAlias string - Type *ast.TypeName - EmbedTable *ast.TableName - - IsSqlcSlice bool // is this sqlc.slice() +type CachedAnalyzer struct { + a Analyzer + config config.Config + configBytes []byte + db config.Database + store *cache.Cache +} + +func Cached(a Analyzer, c config.Config, db config.Database) *CachedAnalyzer { + return &CachedAnalyzer{ + a: a, + config: c, + db: db, + } } -type Parameter struct { - Number int - Column *Column +// Create a new error here + +func (c *CachedAnalyzer) Analyze(ctx context.Context, n ast.Node, q string, schema []string, np *named.ParamSet) (*analysis.Analysis, error) { + result, rerun, err := c.analyze(ctx, n, q, schema, np) + if rerun { + if err != nil { + slog.Warn("first analysis failed with error", "err", err) + } + return c.a.Analyze(ctx, n, q, schema, np) + } + return result, err +} + +// The name of the sole output blob a QueryAnalysis action produces. +const analysisOutput = "analysis.pb" + +func (c *CachedAnalyzer) analyze(ctx context.Context, n ast.Node, q string, schema []string, np *named.ParamSet) (*analysis.Analysis, bool, error) { + // Only cache queries for managed databases. We can't be certain the + // database is in an unchanged state otherwise + if !c.db.Managed { + return nil, true, nil + } + + if c.store == nil { + var err error + c.store, err = cache.Open() + if err != nil { + return nil, true, err + } + } + store := c.store + + if c.configBytes == nil { + var err error + c.configBytes, err = json.Marshal(c.config) + if err != nil { + return nil, true, err + } + } + + // Analyzing a query is an action whose inputs are the configuration, the + // schema migrations, and the query itself. (The sqlc binary is an + // implicit input of every action.) + action := store.NewAction("QueryAnalysis"). + AddInput("config", c.configBytes) + for _, m := range schema { + action.AddInput("schema", []byte(m)) + } + actionDigest := action.AddInput("query", []byte(q)).Digest() + + if cached, err := store.Actions.Get(actionDigest); err == nil { + contents, err := store.CAS.Get(cached.Outputs[analysisOutput]) + if err == nil { + var a analysis.Analysis + if err := proto.Unmarshal(contents, &a); err == nil { + return &a, false, nil + } + } + if !errors.Is(err, cache.ErrNotFound) { + slog.Warn("reading analysis from cache failed", "err", err) + } + } + + result, err := c.a.Analyze(ctx, n, q, schema, np) + + if err == nil { + contents, err := proto.Marshal(result) + if err != nil { + slog.Warn("unable to marshal analysis", "err", err) + return result, false, nil + } + outDigest, err := store.CAS.Put(contents) + if err != nil { + slog.Warn("saving analysis to cache failed", "err", err) + return result, false, nil + } + err = store.Actions.Put(actionDigest, &cache.ActionResult{ + Outputs: map[string]cache.Digest{analysisOutput: outDigest}, + }) + if err != nil { + slog.Warn("saving analysis action result failed", "err", err) + } + } + + return result, false, err } -type Analysis struct { - Columns []Column - Params []Parameter +func (c *CachedAnalyzer) Close(ctx context.Context) error { + if c.store != nil { + c.store.Close() + } + return c.a.Close(ctx) } type Analyzer interface { - Analyze(context.Context, ast.Node, string, []string, *named.ParamSet) (*Analysis, error) + Analyze(context.Context, ast.Node, string, []string, *named.ParamSet) (*analysis.Analysis, error) Close(context.Context) error } diff --git a/internal/bundler/multipart.go b/internal/bundler/multipart.go index 1336c1a559..b1d1925fde 100644 --- a/internal/bundler/multipart.go +++ b/internal/bundler/multipart.go @@ -4,52 +4,37 @@ import ( "os" "path/filepath" - "github.com/sqlc-dev/sqlc/internal/config" pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" ) -func readInputs(file string, conf *config.Config) ([]*pb.File, error) { - refs := map[string]struct{}{} - refs[filepath.Base(file)] = struct{}{} - - for _, pkg := range conf.SQL { - for _, paths := range []config.Paths{pkg.Schema, pkg.Queries} { - files, err := sqlpath.Glob(paths) - if err != nil { - return nil, err - } - for _, file := range files { - refs[file] = struct{}{} - } - } +func readFiles(dir string, paths []string) ([]*pb.File, error) { + files, err := sqlpath.Glob(paths) + if err != nil { + return nil, err } - - var files []*pb.File - for file, _ := range refs { - contents, err := os.ReadFile(file) + var out []*pb.File + for _, file := range files { + f, err := readFile(dir, file) if err != nil { return nil, err } - files = append(files, &pb.File{ - Name: file, - Contents: contents, - }) + out = append(out, f) } - return files, nil + return out, nil } -func readOutputs(dir string, output map[string]string) ([]*pb.File, error) { - var files []*pb.File - for filename, contents := range output { - rel, err := filepath.Rel(dir, filename) - if err != nil { - return nil, err - } - files = append(files, &pb.File{ - Name: rel, - Contents: []byte(contents), - }) +func readFile(dir string, path string) (*pb.File, error) { + rel, err := filepath.Rel(dir, path) + if err != nil { + return nil, err + } + blob, err := os.ReadFile(path) + if err != nil { + return nil, err } - return files, nil + return &pb.File{ + Name: rel, + Contents: blob, + }, nil } diff --git a/internal/bundler/upload.go b/internal/bundler/upload.go index 1152925e02..49e3b44a4c 100644 --- a/internal/bundler/upload.go +++ b/internal/bundler/upload.go @@ -2,28 +2,50 @@ package bundler import ( "context" + "errors" "fmt" + "log/slog" "os" + "strings" - "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/info" + "github.com/sqlc-dev/sqlc/internal/plugin" "github.com/sqlc-dev/sqlc/internal/quickdb" pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" ) +var ErrNoProject = errors.New(`project uploads require a cloud project + +If you don't have a project, you can create one from the sqlc Cloud +dashboard at https://dashboard.sqlc.dev/. If you have a project, ensure +you've set its id as the value of the "project" field within the "cloud" +section of your sqlc configuration. The id will look similar to +"01HA8TWGMYPHK0V2GGMB3R2TP9".`) +var ErrNoAuthToken = errors.New(`project uploads require an auth token + +If you don't have an auth token, you can create one from the sqlc Cloud +dashboard at https://dashboard.sqlc.dev/. If you have an auth token, ensure +you've set it as the value of the SQLC_AUTH_TOKEN environment variable.`) + type Uploader struct { - token string configPath string config *config.Config dir string client pb.QuickClient } +type QuerySetArchive struct { + Name string + Queries []string + Schema []string + Request *plugin.GenerateRequest +} + func NewUploader(configPath, dir string, conf *config.Config) *Uploader { return &Uploader{ - token: os.Getenv("SQLC_AUTH_TOKEN"), configPath: configPath, config: conf, dir: dir, @@ -32,10 +54,10 @@ func NewUploader(configPath, dir string, conf *config.Config) *Uploader { func (up *Uploader) Validate() error { if up.config.Cloud.Project == "" { - return fmt.Errorf("cloud.project is not set") + return ErrNoProject } - if up.token == "" { - return fmt.Errorf("SQLC_AUTH_TOKEN environment variable is not set") + if up.config.Cloud.AuthToken == "" { + return ErrNoAuthToken } if up.client == nil { client, err := quickdb.NewClientFromConfig(up.config.Cloud) @@ -47,36 +69,91 @@ func (up *Uploader) Validate() error { return nil } -func (up *Uploader) buildRequest(ctx context.Context, result map[string]string) (*pb.UploadArchiveRequest, error) { - ins, err := readInputs(up.configPath, up.config) - if err != nil { - return nil, err +var envvars = []string{ + "GITHUB_REPOSITORY", + "GITHUB_REF", + "GITHUB_REF_NAME", + "GITHUB_REF_TYPE", + "GITHUB_SHA", +} + +func annotate() map[string]string { + labels := map[string]string{} + for _, ev := range envvars { + key := strings.ReplaceAll(strings.ToLower(ev), "_", ".") + labels[key] = os.Getenv(ev) } - outs, err := readOutputs(up.dir, result) + return labels +} + +func BuildRequest(ctx context.Context, dir, configPath string, results []*QuerySetArchive, tags []string) (*pb.UploadArchiveRequest, error) { + conf, err := readFile(dir, configPath) if err != nil { return nil, err } - return &pb.UploadArchiveRequest{ + res := &pb.UploadArchiveRequest{ SqlcVersion: info.Version, - Inputs: ins, - Outputs: outs, - }, nil + Config: conf, + Tags: tags, + Annotations: annotate(), + } + for i, result := range results { + schema, err := readFiles(dir, result.Schema) + if err != nil { + return nil, err + } + queries, err := readFiles(dir, result.Queries) + if err != nil { + return nil, err + } + name := result.Name + if name == "" { + name = fmt.Sprintf("queryset_%d", i) + } + genreq, err := proto.Marshal(result.Request) + if err != nil { + return nil, err + } + res.QuerySets = append(res.QuerySets, &pb.QuerySet{ + Name: name, + Schema: schema, + Queries: queries, + CodegenRequest: &pb.File{ + Name: "codegen_request.pb", + Contents: genreq, + }, + }) + } + return res, nil +} + +func (up *Uploader) buildRequest(ctx context.Context, results []*QuerySetArchive, tags []string) (*pb.UploadArchiveRequest, error) { + return BuildRequest(ctx, up.dir, up.configPath, results, tags) } -func (up *Uploader) DumpRequestOut(ctx context.Context, result map[string]string) error { - req, err := up.buildRequest(ctx, result) +func (up *Uploader) DumpRequestOut(ctx context.Context, result []*QuerySetArchive) error { + req, err := up.buildRequest(ctx, result, []string{}) if err != nil { return err } - fmt.Println(protojson.Format(req)) + slog.Info("config", "file", req.Config.Name, "bytes", len(req.Config.Contents)) + for _, qs := range req.QuerySets { + slog.Info("codegen_request", "queryset", qs.Name, "file", "codegen_request.pb") + for _, file := range qs.Schema { + slog.Info("schema", "queryset", qs.Name, "file", file.Name, "bytes", len(file.Contents)) + } + for _, file := range qs.Queries { + slog.Info("query", "queryset", qs.Name, "file", file.Name, "bytes", len(file.Contents)) + } + } return nil } -func (up *Uploader) Upload(ctx context.Context, result map[string]string) error { +func (up *Uploader) Upload(ctx context.Context, result []*QuerySetArchive, tags []string) error { if err := up.Validate(); err != nil { return err } - req, err := up.buildRequest(ctx, result) + req, err := up.buildRequest(ctx, result, tags) if err != nil { return err } diff --git a/internal/cache/action.go b/internal/cache/action.go new file mode 100644 index 0000000000..16f4df9cbc --- /dev/null +++ b/internal/cache/action.go @@ -0,0 +1,209 @@ +package cache + +import ( + "encoding/json" + "errors" + "fmt" + "io/fs" + "os" + "path/filepath" +) + +// ActionResult records the outputs of a completed action, mirroring Bazel's +// ActionResult message. Outputs are not stored inline: each named output is a +// digest pointing into the CAS. +type ActionResult struct { + // Outputs maps an output name (e.g. "analysis.pb", "plugin.wasm") to the + // CAS digest of its contents. + Outputs map[string]Digest `json:"outputs"` +} + +// ActionCache maps action digests to ActionResults, stored as JSON files at +// ac// under the cache root. Unlike CAS entries, action cache +// entries are not self-validating — the value is not derivable from the key — +// so Get additionally checks that every referenced output still exists in the +// CAS before reporting a hit, exactly like Bazel's disk cache does. +// +// Entry I/O goes through the same os.Root as the CAS, confining every read +// and write to the cache directory. +type ActionCache struct { + root *os.Root + cas *CAS +} + +func newActionCache(root *os.Root, cas *CAS) *ActionCache { + return &ActionCache{root: root, cas: cas} +} + +// path returns an entry's path relative to the cache root. +func (a *ActionCache) path(d Digest) string { + return filepath.Join("ac", d.Hash[:2], d.Hash) +} + +// Get returns the cached result for an action, or ErrNotFound on a miss. An +// entry whose outputs are missing or corrupt in the CAS is treated as a miss +// and evicted. +func (a *ActionCache) Get(action Digest) (*ActionResult, error) { + if !action.valid() { + return nil, ErrNotFound + } + path := a.path(action) + data, err := a.root.ReadFile(path) + if err != nil { + if errors.Is(err, fs.ErrNotExist) { + return nil, ErrNotFound + } + return nil, fmt.Errorf("cache: %w", err) + } + var result ActionResult + if err := json.Unmarshal(data, &result); err != nil { + a.root.Remove(path) + return nil, ErrNotFound + } + for _, d := range result.Outputs { + if !a.cas.Contains(d) { + a.root.Remove(path) + return nil, ErrNotFound + } + } + return &result, nil +} + +// PutTree stores every file under dir in the CAS and records them as the +// action's outputs, named by their paths relative to dir. Use this for +// actions whose tool writes an output directory, like WASM compilation. +func (a *ActionCache) PutTree(action Digest, dir string) error { + outputs := map[string]Digest{} + err := filepath.WalkDir(dir, func(path string, entry fs.DirEntry, err error) error { + if err != nil || entry.IsDir() { + return err + } + rel, err := filepath.Rel(dir, path) + if err != nil { + return err + } + data, err := os.ReadFile(path) + if err != nil { + return err + } + d, err := a.cas.Put(data) + if err != nil { + return err + } + outputs[filepath.ToSlash(rel)] = d + return nil + }) + if err != nil { + return fmt.Errorf("cache: %w", err) + } + if len(outputs) == 0 { + return fmt.Errorf("cache: no outputs found under %s", dir) + } + return a.Put(action, &ActionResult{Outputs: outputs}) +} + +// GetTree materializes a cached action's outputs as files under dir, or +// returns ErrNotFound on a miss. A file already present is reused only if its +// contents still hash to the expected digest; otherwise it is rewritten from +// the CAS. Writes are staged, fsynced, and renamed, so a crash cannot leave a +// right-sized but torn file that later reads would trust. +func (a *ActionCache) GetTree(action Digest, dir string) error { + result, err := a.Get(action) + if err != nil { + return err + } + for rel, d := range result.Outputs { + // Output names come from the action cache entry, which — unlike a CAS + // blob — is not self-validating, so a tampered entry could carry a + // name like "../../etc/x". Reject anything that isn't a relative path + // confined to dir; this is the confinement the os.Root gives the rest + // of the cache, which GetTree can't use because dir is a caller-owned + // path a tool must read by absolute name. + if !filepath.IsLocal(rel) { + return fmt.Errorf("cache: unsafe output path %q in action %s", rel, action) + } + path := filepath.Join(dir, filepath.FromSlash(rel)) + // Trust an existing file only if it still hashes to the digest; + // size alone can mask in-place corruption that would make the + // consuming tool hard-fail with no way to repair (see wazero). + if existing, err := os.ReadFile(path); err == nil && DigestOf(existing) == d { + continue + } + data, err := a.cas.Get(d) + if err != nil { + return err + } + if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { + return fmt.Errorf("cache: %w", err) + } + if err := writeFileAtomic(path, data); err != nil { + return fmt.Errorf("cache: %w", err) + } + } + return nil +} + +// writeFileAtomic writes data to path via a staged temp file in the same +// directory, fsynced before an atomic rename, so a reader never observes a +// partial or torn file even across a crash. +func writeFileAtomic(path string, data []byte) error { + f, err := os.CreateTemp(filepath.Dir(path), "."+filepath.Base(path)+"-*") + if err != nil { + return err + } + tmp := f.Name() + if _, err := f.Write(data); err != nil { + f.Close() + os.Remove(tmp) + return err + } + if err := f.Sync(); err != nil { + f.Close() + os.Remove(tmp) + return err + } + if err := f.Close(); err != nil { + os.Remove(tmp) + return err + } + if err := os.Rename(tmp, path); err != nil { + os.Remove(tmp) + return err + } + return nil +} + +// Put records the result of an action. All outputs must already be in the +// CAS; writes are staged and renamed so concurrent processes never observe a +// partial entry. +func (a *ActionCache) Put(action Digest, result *ActionResult) error { + for name, d := range result.Outputs { + if !a.cas.Contains(d) { + return fmt.Errorf("cache: output %q (%s) missing from CAS", name, d) + } + } + data, err := json.Marshal(result) + if err != nil { + return fmt.Errorf("cache: %w", err) + } + path := a.path(action) + if err := a.root.MkdirAll(filepath.Dir(path), 0755); err != nil { + return fmt.Errorf("cache: %w", err) + } + f, name, err := a.cas.createTemp(action.Hash[:8] + "-") + if err != nil { + return fmt.Errorf("cache: %w", err) + } + defer a.root.Remove(name) + if _, err := f.Write(data); err != nil { + f.Close() + return fmt.Errorf("cache: %w", err) + } + if err := f.Close(); err != nil { + return fmt.Errorf("cache: %w", err) + } + if err := a.root.Rename(name, path); err != nil { + return fmt.Errorf("cache: %w", err) + } + return nil +} diff --git a/internal/cache/cache.go b/internal/cache/cache.go new file mode 100644 index 0000000000..f0528add0b --- /dev/null +++ b/internal/cache/cache.go @@ -0,0 +1,103 @@ +// Package cache implements sqlc's on-disk cache, designed after Bazel's +// local disk cache. +// +// It has two halves: +// +// - A content-addressable store (CAS) holding blobs keyed by the SHA-256 +// hash of their contents, laid out as cas//. +// - An action cache (AC) mapping the digest of an action — a description of +// cacheable work and all of its inputs — to the digests of the outputs +// that work produced, laid out as ac//. +// +// Work whose output is not derivable from its inputs, like query analysis, +// uses both halves, just like Bazel: hash the action, look its digest up in +// the action cache, then fetch the referenced output blobs from the CAS. +// +// Remote fetches with a declared checksum, like WASM plugins, need no action +// cache entry at all: the declared sha256 is itself a content address, so the +// blob is stored and loaded directly from the CAS keyed by that checksum. +package cache + +import ( + "fmt" + "os" + "path/filepath" +) + +// Cache bundles the CAS and the action cache that shares it. All storage +// I/O is confined to the cache directory through an os.Root; callers should +// Close the cache when finished with it to release the root. +type Cache struct { + root *os.Root + CAS *CAS + Actions *ActionCache +} + +// Dir returns the cache root, defaulting to os.UserCacheDir(). The location +// can be overridden with the SQLCCACHE environment variable. +func Dir() (string, error) { + cache := os.Getenv("SQLCCACHE") + if cache != "" { + return cache, nil + } + cacheHome, err := os.UserCacheDir() + if err != nil { + return "", err + } + return filepath.Join(cacheHome, "sqlc"), nil +} + +// Open returns the cache rooted at Dir(). +func Open() (*Cache, error) { + root, err := Dir() + if err != nil { + return nil, err + } + return OpenAt(root) +} + +// OpenAt returns the cache rooted at the given directory, creating it if +// necessary. +func OpenAt(dir string) (*Cache, error) { + if err := os.MkdirAll(dir, 0755); err != nil { + return nil, fmt.Errorf("failed to create %s directory: %w", dir, err) + } + root, err := os.OpenRoot(dir) + if err != nil { + return nil, fmt.Errorf("cache: %w", err) + } + cas, err := newCAS(root) + if err != nil { + root.Close() + return nil, err + } + return &Cache{ + root: root, + CAS: cas, + Actions: newActionCache(root, cas), + }, nil +} + +// Close releases the cache's handle on its root directory. +func (c *Cache) Close() error { + return c.root.Close() +} + +// ExecDir creates a fresh, private scratch directory for materializing the +// output tree of the given action, for tools that need their outputs on disk +// (like wazero's compilation cache). Each call returns a new directory under +// exec/, so two concurrent processes never share one — otherwise a tool +// staging files there (wazero writes .tmp files in place) could be swept +// into the other's PutTree. The caller must remove it when done; its contents +// are always reproducible from the CAS, so losing it is harmless. +func (c *Cache) ExecDir(action Digest) (string, error) { + base := filepath.Join(c.root.Name(), "exec") + if err := os.MkdirAll(base, 0755); err != nil { + return "", fmt.Errorf("failed to create %s directory: %w", base, err) + } + dir, err := os.MkdirTemp(base, action.Hash+"-") + if err != nil { + return "", fmt.Errorf("cache: %w", err) + } + return dir, nil +} diff --git a/internal/cache/cas.go b/internal/cache/cas.go new file mode 100644 index 0000000000..baf959d9c7 --- /dev/null +++ b/internal/cache/cas.go @@ -0,0 +1,138 @@ +package cache + +import ( + "errors" + "fmt" + "io/fs" + "math/rand/v2" + "os" + "path/filepath" + "strconv" +) + +// ErrNotFound is returned when a blob or action result is not in the cache. +var ErrNotFound = errors.New("cache: not found") + +// CAS is an on-disk content-addressable store keyed by SHA-256, modeled on +// Bazel's disk cache. Blobs live at cas// under the cache root, +// where is the first two hex characters of the hash. Because a blob's +// name is derived from its contents, entries never change once written: +// writers race benignly and readers can detect corruption by re-hashing. +// +// Content with an externally declared checksum (remotely fetched plugins) +// needs no action cache entry: the declared sha256 is the address, so it is +// stored and loaded directly — see SHA256Digest. +// +// All I/O goes through an os.Root, so no entry name — hash-derived or read +// from an action cache entry — can escape the cache directory. +type CAS struct { + root *os.Root +} + +func newCAS(root *os.Root) (*CAS, error) { + if err := root.MkdirAll("tmp", 0755); err != nil { + return nil, fmt.Errorf("cache: create tmp: %w", err) + } + return &CAS{root: root}, nil +} + +// path returns a blob's path relative to the cache root. +func (c *CAS) path(d Digest) string { + return filepath.Join("cas", d.Hash[:2], d.Hash) +} + +// Filename returns the path of a stored blob, for a consumer that needs the +// file rather than its bytes — SQLite, for one, opens a database by name. A +// blob is named after the hash of its contents, so the file at this path never +// changes and any number of processes may read it at once. +// +// It reports false when the blob is not stored. +func (c *CAS) Filename(d Digest) (string, bool) { + if !c.Contains(d) { + return "", false + } + return filepath.Join(c.root.Name(), c.path(d)), true +} + +// createTemp creates a staging file under tmp/ in the cache root, returning +// the open file and its root-relative name. +func (c *CAS) createTemp(prefix string) (*os.File, string, error) { + for range 10000 { + name := filepath.Join("tmp", prefix+strconv.FormatUint(rand.Uint64(), 36)) + f, err := c.root.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0644) + if errors.Is(err, fs.ErrExist) { + continue + } + return f, name, err + } + return nil, "", errors.New("cache: could not create temp file") +} + +// Put stores a blob and returns its digest. Writing is atomic: the blob is +// staged in a temp file and renamed into place, so concurrent sqlc processes +// never observe partial entries. +func (c *CAS) Put(data []byte) (Digest, error) { + d := DigestOf(data) + path := c.path(d) + // Skip the write only when an entry of the right size already exists; a + // wrong-sized entry is corrupt and is atomically replaced by the rename + // below. + if fi, err := c.root.Stat(path); err == nil && fi.Size() == d.SizeBytes { + return d, nil + } + if err := c.root.MkdirAll(filepath.Dir(path), 0755); err != nil { + return Digest{}, fmt.Errorf("cache: %w", err) + } + f, name, err := c.createTemp(d.Hash[:8] + "-") + if err != nil { + return Digest{}, fmt.Errorf("cache: %w", err) + } + defer c.root.Remove(name) + if _, err := f.Write(data); err != nil { + f.Close() + return Digest{}, fmt.Errorf("cache: %w", err) + } + if err := f.Close(); err != nil { + return Digest{}, fmt.Errorf("cache: %w", err) + } + if err := c.root.Rename(name, path); err != nil { + return Digest{}, fmt.Errorf("cache: %w", err) + } + return d, nil +} + +// Get returns the blob for a digest. Contents are re-hashed before being +// returned; a corrupt entry is evicted and reported as ErrNotFound so +// callers simply redo the work that produced it. +func (c *CAS) Get(d Digest) ([]byte, error) { + if !d.valid() { + return nil, ErrNotFound + } + path := c.path(d) + data, err := c.root.ReadFile(path) + if err != nil { + if errors.Is(err, fs.ErrNotExist) { + return nil, ErrNotFound + } + return nil, fmt.Errorf("cache: %w", err) + } + if DigestOf(data).Hash != d.Hash { + c.root.Remove(path) + return nil, ErrNotFound + } + return data, nil +} + +// Contains reports whether a blob with the given digest is present, checking +// size when the digest carries one. It does not verify contents; Get performs +// full verification. +func (c *CAS) Contains(d Digest) bool { + if !d.valid() { + return false + } + fi, err := c.root.Stat(c.path(d)) + if err != nil { + return false + } + return d.SizeBytes < 0 || fi.Size() == d.SizeBytes +} diff --git a/internal/cache/digest.go b/internal/cache/digest.go new file mode 100644 index 0000000000..4909d466ed --- /dev/null +++ b/internal/cache/digest.go @@ -0,0 +1,100 @@ +package cache + +import ( + "crypto/sha256" + "encoding/binary" + "encoding/hex" + "fmt" + "hash" +) + +// Digest identifies a blob by its SHA-256 hash and size, mirroring the +// Digest message from Bazel's remote execution API. The size is stored +// alongside the hash so that entries can be validated without reading blob +// contents; a negative size means the size is unknown, as with a checksum +// declared in a configuration file. +type Digest struct { + // Hash is the lowercase hex-encoded SHA-256 hash of the blob. + Hash string `json:"hash"` + // SizeBytes is the length of the blob in bytes, or negative if unknown. + SizeBytes int64 `json:"size_bytes"` +} + +func (d Digest) String() string { + return fmt.Sprintf("sha256:%s/%d", d.Hash, d.SizeBytes) +} + +func (d Digest) valid() bool { + if len(d.Hash) != 64 { + return false + } + _, err := hex.DecodeString(d.Hash) + return err == nil +} + +// DigestOf returns the Digest of a blob. +func DigestOf(data []byte) Digest { + sum := sha256.Sum256(data) + return Digest{ + Hash: hex.EncodeToString(sum[:]), + SizeBytes: int64(len(data)), + } +} + +// SHA256Digest returns a Digest referencing a blob by a declared SHA-256 +// checksum whose size is not known, suitable for looking up remotely fetched +// content in the CAS. +func SHA256Digest(hexhash string) Digest { + return Digest{ + Hash: hexhash, + SizeBytes: -1, + } +} + +// An Action describes a unit of cacheable work, playing the role of Bazel's +// Action message: a mnemonic naming the kind of work plus the complete set of +// inputs that determine its outputs. Two actions with the same digest are +// assumed to produce the same outputs. +// +// Inputs are hashed incrementally with length-prefixed framing so that the +// boundary between inputs is unambiguous ("ab"+"c" hashes differently from +// "a"+"bc"). +type Action struct { + hasher hash.Hash +} + +// NewAction starts building an action key for the given mnemonic, e.g. +// "QueryAnalysis". The sha256 of the sqlc binary itself is always the first +// input: the tool that executes an action determines its outputs just as +// much as the declared inputs do, so a rebuilt sqlc never reuses stale +// entries. The binary's digest is memoized in the cache — see toolDigest — +// which is why actions are created through a Cache. +func (c *Cache) NewAction(mnemonic string) *Action { + a := &Action{hasher: sha256.New()} + a.write([]byte(mnemonic)) + a.AddInput("tool", c.toolDigest()) + return a +} + +// AddInput mixes a named input into the action key. Order matters: callers +// must add inputs in a deterministic order. +func (a *Action) AddInput(name string, data []byte) *Action { + a.write([]byte(name)) + a.write(data) + return a +} + +// Digest returns the action's digest, used as the action cache key. +func (a *Action) Digest() Digest { + return Digest{ + Hash: hex.EncodeToString(a.hasher.Sum(nil)), + SizeBytes: 0, + } +} + +func (a *Action) write(data []byte) { + var frame [8]byte + binary.LittleEndian.PutUint64(frame[:], uint64(len(data))) + a.hasher.Write(frame[:]) + a.hasher.Write(data) +} diff --git a/internal/cache/tool.go b/internal/cache/tool.go new file mode 100644 index 0000000000..51c8c42c2a --- /dev/null +++ b/internal/cache/tool.go @@ -0,0 +1,95 @@ +package cache + +import ( + "crypto/sha256" + "encoding/hex" + "encoding/json" + "io" + "os" + "sync" + + "github.com/sqlc-dev/sqlc/internal/info" +) + +// The sha256 of the sqlc binary is an input to every action — a rebuilt sqlc +// may analyze queries or embed a different wazero than the one that produced +// a cache entry, even when the version string is unchanged (dev builds). +// +// Hashing a ~100MB executable costs tens of milliseconds, too much to pay on +// every short-lived sqlc process, so the digest is memoized on disk keyed by +// the executable's path, size, and mtime — the same trick Bazel's file +// digest cache uses. A warm run costs one stat and a tiny read; only a +// rebuilt (or moved) binary is re-hashed. +var tool struct { + sync.Mutex + digest []byte +} + +type toolMemo struct { + Path string `json:"path"` + SizeBytes int64 `json:"size_bytes"` + MtimeNS int64 `json:"mtime_ns"` + SHA256 string `json:"sha256"` +} + +const toolMemoPath = "tool" + +func (c *Cache) toolDigest() []byte { + tool.Lock() + defer tool.Unlock() + if tool.digest == nil { + tool.digest = c.computeToolDigest() + } + return tool.digest +} + +func (c *Cache) computeToolDigest() []byte { + path, err := os.Executable() + if err != nil { + return []byte(info.Version) + } + fi, err := os.Stat(path) + if err != nil { + return []byte(info.Version) + } + + var memo toolMemo + if data, err := c.root.ReadFile(toolMemoPath); err == nil { + if err := json.Unmarshal(data, &memo); err == nil && + memo.Path == path && + memo.SizeBytes == fi.Size() && + memo.MtimeNS == fi.ModTime().UnixNano() && + memo.SHA256 != "" { + return []byte(memo.SHA256) + } + } + + f, err := os.Open(path) + if err != nil { + return []byte(info.Version) + } + defer f.Close() + h := sha256.New() + if _, err := io.Copy(h, f); err != nil { + return []byte(info.Version) + } + sum := hex.EncodeToString(h.Sum(nil)) + + memo = toolMemo{ + Path: path, + SizeBytes: fi.Size(), + MtimeNS: fi.ModTime().UnixNano(), + SHA256: sum, + } + if data, err := json.Marshal(memo); err == nil { + if f, name, err := c.CAS.createTemp("tool-"); err == nil { + if _, werr := f.Write(data); werr == nil && f.Close() == nil { + c.root.Rename(name, toolMemoPath) + } else { + f.Close() + } + c.root.Remove(name) + } + } + return []byte(sum) +} diff --git a/internal/cmd/analyze.go b/internal/cmd/analyze.go new file mode 100644 index 0000000000..ba278498b6 --- /dev/null +++ b/internal/cmd/analyze.go @@ -0,0 +1,275 @@ +package cmd + +import ( + "encoding/json" + "fmt" + "io" + "os" + "strings" + + "github.com/spf13/cobra" + + "github.com/sqlc-dev/sqlc/internal/compiler" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/multierr" + "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func newAnalyzeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "analyze [query-file]", + Short: "Analyze a query against a schema and output the result columns and parameters", + Long: `Analyze a query file against a schema file and output the inferred result +columns and parameters as JSON. + +Unlike "sqlc generate", this command does not require a configuration file and +does not connect to a database. It uses sqlc's native static analysis to infer +types from the provided schema. + +Examples: + # Analyze a PostgreSQL query + sqlc analyze --dialect postgresql --schema schema.sql query.sql + + # Analyze a MySQL query + sqlc analyze --dialect mysql --schema schema.sql query.sql + + # Analyze a SQLite query + sqlc analyze --dialect sqlite --schema schema.sql query.sql + + # Analyze a ClickHouse query + sqlc analyze --dialect clickhouse --schema schema.sql query.sql + + # Analyze a GoogleSQL (BigQuery, Spanner) query + sqlc analyze --dialect googlesql --schema schema.sql query.sql + + # Analyze a SQL Server (T-SQL) query + sqlc analyze --dialect mssql --schema schema.sql query.sql + + # Analyze a DuckDB query + sqlc analyze --dialect duckdb --schema schema.sql query.sql + + # Analyze a query piped via stdin + echo "-- name: GetAuthor :one + SELECT * FROM authors WHERE id = $1;" | sqlc analyze --dialect postgresql --schema schema.sql + + # Include the statement AST in the output + sqlc analyze --dialect postgresql --schema schema.sql --ast query.sql`, + Args: cobra.MaximumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + dialect, err := cmd.Flags().GetString("dialect") + if err != nil { + return err + } + if dialect == "" { + return fmt.Errorf("--dialect flag is required (postgresql, mysql, sqlite, clickhouse, googlesql, mssql, or duckdb)") + } + + schemaPath, err := cmd.Flags().GetString("schema") + if err != nil { + return err + } + if schemaPath == "" { + return fmt.Errorf("--schema flag is required") + } + + includeAST, err := cmd.Flags().GetBool("ast") + if err != nil { + return err + } + + // The query comes from a file argument or, when none is given, from + // stdin. The compiler reads queries from files, so stdin is written to + // a temporary file. + var queryPath string + if len(args) == 1 { + queryPath = args[0] + } else { + stat, err := os.Stdin.Stat() + if err != nil { + return fmt.Errorf("failed to stat stdin: %w", err) + } + if (stat.Mode() & os.ModeCharDevice) != 0 { + return fmt.Errorf("no query provided. Specify a query file or pipe SQL via stdin") + } + data, err := io.ReadAll(cmd.InOrStdin()) + if err != nil { + return fmt.Errorf("failed to read stdin: %w", err) + } + tmp, err := os.CreateTemp("", "sqlc-analyze-*.sql") + if err != nil { + return fmt.Errorf("failed to create temp file: %w", err) + } + defer os.Remove(tmp.Name()) + if _, err := tmp.Write(data); err != nil { + tmp.Close() + return fmt.Errorf("failed to write temp file: %w", err) + } + if err := tmp.Close(); err != nil { + return fmt.Errorf("failed to close temp file: %w", err) + } + queryPath = tmp.Name() + } + + var engine config.Engine + switch dialect { + case "postgresql", "postgres", "pg": + engine = config.EnginePostgreSQL + case "mysql": + engine = config.EngineMySQL + case "sqlite": + engine = config.EngineSQLite + case "clickhouse": + engine = config.EngineClickHouse + case "googlesql": + engine = config.EngineGoogleSQL + case "mssql", "sqlserver": + engine = config.EngineMSSQL + case "duckdb": + engine = config.EngineDuckDB + default: + return fmt.Errorf("unsupported dialect: %s (use postgresql, mysql, sqlite, clickhouse, googlesql, mssql, or duckdb)", dialect) + } + + sql := config.SQL{ + Engine: engine, + Schema: config.Paths{schemaPath}, + Queries: config.Paths{queryPath}, + } + combo := config.Combine(config.Config{}, sql) + parserOpts := opts.Parser{} + + ctx := cmd.Context() + c, err := compiler.NewCompiler(sql, combo, parserOpts, compiler.WithCoreAnalysis()) + if err != nil { + return fmt.Errorf("error creating compiler: %w", err) + } + defer c.Close(ctx) + + if err := c.ParseCatalog(sql.Schema); err != nil { + return fmt.Errorf("error parsing schema: %w", formatParseError(err)) + } + if err := c.ParseQueries(sql.Queries, parserOpts); err != nil { + return fmt.Errorf("error parsing queries: %w", formatParseError(err)) + } + + result := c.Result() + + out := make([]analyzedQuery, 0, len(result.Queries)) + for _, q := range result.Queries { + out = append(out, newAnalyzedQuery(q, includeAST)) + } + + stdout := cmd.OutOrStdout() + encoder := json.NewEncoder(stdout) + encoder.SetIndent("", " ") + if err := encoder.Encode(out); err != nil { + return fmt.Errorf("failed to encode analysis: %w", err) + } + + return nil + }, + } + cmd.Flags().StringP("dialect", "d", "", "SQL dialect to use (postgresql, mysql, sqlite, clickhouse, googlesql, mssql, or duckdb)") + cmd.Flags().StringP("schema", "s", "", "path to the schema file") + cmd.Flags().BoolP("ast", "", false, "include the statement AST in the output") + return cmd +} + +// formatParseError unwraps a multierr.Error into a single error containing all +// of the underlying file errors, so the analyze command can report each one with +// its file location. +func formatParseError(err error) error { + parserErr, ok := err.(*multierr.Error) + if !ok { + return err + } + var msgs []string + for _, fileErr := range parserErr.Errs() { + msgs = append(msgs, fmt.Sprintf("%s:%d:%d: %s", + fileErr.Filename, fileErr.Line, fileErr.Column, fileErr.Err)) + } + if len(msgs) == 0 { + return err + } + return fmt.Errorf("%s", strings.Join(msgs, "; ")) +} + +type analyzedQuery struct { + Name string `json:"name"` + Cmd string `json:"cmd"` + Columns []analyzedColumn `json:"columns"` + Params []analyzedParam `json:"params"` + AST *ast.RawStmt `json:"ast,omitempty"` +} + +type analyzedColumn struct { + Name string `json:"name"` + Type *core.TypeExpr `json:"type,omitempty"` + Table string `json:"table,omitempty"` +} + +type analyzedParam struct { + Number int `json:"number"` + Column analyzedColumn `json:"column"` +} + +func newAnalyzedQuery(q *compiler.Query, includeAST bool) analyzedQuery { + aq := analyzedQuery{ + Name: q.Metadata.Name, + Cmd: q.Metadata.Cmd, + Columns: make([]analyzedColumn, 0, len(q.Columns)), + Params: make([]analyzedParam, 0, len(q.Params)), + } + for _, col := range q.Columns { + aq.Columns = append(aq.Columns, newAnalyzedColumn(col)) + } + for _, p := range q.Params { + aq.Params = append(aq.Params, analyzedParam{ + Number: p.Number, + Column: newAnalyzedColumn(p.Column), + }) + } + if includeAST { + aq.AST = q.RawStmt + } + return aq +} + +func newAnalyzedColumn(col *compiler.Column) analyzedColumn { + if col == nil { + return analyzedColumn{} + } + ac := analyzedColumn{ + Name: col.Name, + Type: newAnalyzedType(col), + } + if col.Table != nil { + ac.Table = col.Table.Name + } + return ac +} + +// newAnalyzedType is the column's type as an expression: the one the +// analysis core wrote when it did, otherwise the flat description the +// compiler holds, which is the data type wrapped in one array node per +// dimension with the column's nullability on the outermost node. +func newAnalyzedType(col *compiler.Column) *core.TypeExpr { + if col.TypeExpr != nil { + return col.TypeExpr + } + if col.DataType == "" { + return nil + } + t := core.ParseTypeExpr(col.DataType) + dims := col.ArrayDims + if col.IsArray && dims == 0 { + dims = 1 + } + for i := 0; i < dims; i++ { + t = &core.TypeExpr{Name: "array", Args: []core.TypeArg{{Type: t}}} + } + t.Nullable = !col.NotNull + return t +} diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index 6e31be3ab8..4b14751a5f 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -18,14 +18,17 @@ import ( "gopkg.in/yaml.v3" "github.com/sqlc-dev/sqlc/internal/config" - "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/info" "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" "github.com/sqlc-dev/sqlc/internal/tracer" ) +var debugProcessPlugins = sqlcdebug.New("processplugins") + func init() { - uploadCmd.Flags().BoolP("dry-run", "", false, "dump upload request (default: false)") + createDBCmd.Flags().StringP("queryset", "", "", "name of the queryset to use") + pushCmd.Flags().BoolP("dry-run", "", false, "dump push request (default: false)") initCmd.Flags().BoolP("v1", "", false, "generate v1 config yaml file") initCmd.Flags().BoolP("v2", "", true, "generate v2 config yaml file") initCmd.MarkFlagsMutuallyExclusive("v1", "v2") @@ -35,17 +38,18 @@ func init() { func Do(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int { rootCmd := &cobra.Command{Use: "sqlc", SilenceUsage: true} rootCmd.PersistentFlags().StringP("file", "f", "", "specify an alternate config file (default: sqlc.yaml)") - rootCmd.PersistentFlags().BoolP("experimental", "x", false, "DEPRECATED: enable experimental features (default: false)") - rootCmd.PersistentFlags().Bool("no-remote", false, "disable remote execution (default: false)") - rootCmd.PersistentFlags().Bool("remote", false, "enable remote execution (default: false)") - rootCmd.PersistentFlags().Bool("no-database", false, "disable database connections (default: false)") rootCmd.AddCommand(checkCmd) + rootCmd.AddCommand(createDBCmd) rootCmd.AddCommand(diffCmd) rootCmd.AddCommand(genCmd) + rootCmd.AddCommand(newFmtCmd()) rootCmd.AddCommand(initCmd) + rootCmd.AddCommand(newParseCmd()) + rootCmd.AddCommand(newAnalyzeCmd()) rootCmd.AddCommand(versionCmd) - rootCmd.AddCommand(uploadCmd) + rootCmd.AddCommand(verifyCmd) + rootCmd.AddCommand(pushCmd) rootCmd.AddCommand(NewCmdVet()) rootCmd.SetArgs(args) @@ -54,7 +58,7 @@ func Do(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int rootCmd.SetErr(stderr) ctx := context.Background() - if debug.Debug.Trace != "" { + if tracer.Path() != "" { tracectx, cleanup, err := tracer.Start(ctx) if err != nil { fmt.Printf("failed to start trace: %v\n", err) @@ -97,7 +101,7 @@ var initCmd = &cobra.Command{ if err != nil { return err } - var yamlConfig interface{} + var yamlConfig any if useV1 { yamlConfig = config.V1GenerateSettings{Version: "1"} } else { @@ -136,23 +140,14 @@ var initCmd = &cobra.Command{ type Env struct { DryRun bool - Debug opts.Debug - Remote bool - NoRemote bool - NoDatabase bool + Experiment opts.Experiment } func ParseEnv(c *cobra.Command) Env { dr := c.Flag("dry-run") - r := c.Flag("remote") - nr := c.Flag("no-remote") - nodb := c.Flag("no-database") return Env{ DryRun: dr != nil && dr.Changed, - Debug: opts.DebugFromEnv(), - Remote: r != nil && nr.Value.String() == "true", - NoRemote: nr != nil && nr.Value.String() == "true", - NoDatabase: nodb != nil && nodb.Value.String() == "true", + Experiment: opts.ExperimentFromEnv(), } } @@ -160,7 +155,7 @@ var ErrPluginProcessDisabled = errors.New("plugin: process-based plugins disable func (e *Env) Validate(cfg *config.Config) error { for _, plugin := range cfg.Plugins { - if plugin.Process != nil && !e.Debug.ProcessPlugins { + if plugin.Process != nil && debugProcessPlugins.Value() == "0" { return ErrPluginProcessDisabled } } @@ -192,7 +187,7 @@ func getConfigPath(stderr io.Writer, f *pflag.Flag) (string, string) { var genCmd = &cobra.Command{ Use: "generate", - Short: "Generate Go code from SQL", + Short: "Generate source code from SQL", RunE: func(cmd *cobra.Command, args []string) error { defer trace.StartRegion(cmd.Context(), "generate").End() stderr := cmd.ErrOrStderr() @@ -216,24 +211,6 @@ var genCmd = &cobra.Command{ }, } -var uploadCmd = &cobra.Command{ - Use: "upload", - Short: "Upload the schema, queries, and configuration for this project", - RunE: func(cmd *cobra.Command, args []string) error { - stderr := cmd.ErrOrStderr() - dir, name := getConfigPath(stderr, cmd.Flag("file")) - opts := &Options{ - Env: ParseEnv(cmd), - Stderr: stderr, - } - if err := createPkg(cmd.Context(), dir, name, opts); err != nil { - fmt.Fprintf(stderr, "error uploading: %s\n", err) - os.Exit(1) - } - return nil - }, -} - var checkCmd = &cobra.Command{ Use: "compile", Short: "Statically check SQL for syntax and type errors", diff --git a/internal/cmd/createdb.go b/internal/cmd/createdb.go new file mode 100644 index 0000000000..09536816d3 --- /dev/null +++ b/internal/cmd/createdb.go @@ -0,0 +1,102 @@ +package cmd + +import ( + "context" + "fmt" + "os" + "runtime/trace" + "time" + + "github.com/spf13/cobra" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +var createDBCmd = &cobra.Command{ + Use: "createdb", + Short: "Create an ephemeral database", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + defer trace.StartRegion(cmd.Context(), "createdb").End() + stderr := cmd.ErrOrStderr() + dir, filename := getConfigPath(stderr, cmd.Flag("file")) + querySetName, err := cmd.Flags().GetString("queryset") + if err != nil { + return err + } + err = CreateDB(cmd.Context(), dir, filename, querySetName, &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + }) + if err != nil { + fmt.Fprintln(stderr, err.Error()) + os.Exit(1) + } + return nil + }, +} + +func CreateDB(ctx context.Context, dir, filename, querySetName string, o *Options) error { + _, conf, err := o.ReadConfig(dir, filename) + if err != nil { + return err + } + // Find the first queryset with a managed database + var queryset *config.SQL + var count int + for _, sql := range conf.SQL { + if querySetName != "" && sql.Name != querySetName { + continue + } + if sql.Database != nil && sql.Database.Managed { + queryset = &sql + count += 1 + } + } + if queryset == nil && querySetName != "" { + return fmt.Errorf("no queryset found with name %q", querySetName) + } + if queryset == nil { + return fmt.Errorf("no querysets configured to use a managed database") + } + if count > 1 { + return fmt.Errorf("multiple querysets configured to use managed databases") + } + + switch queryset.Engine { + case config.EngineMySQL: + // pass + case config.EnginePostgreSQL: + // pass + default: + return fmt.Errorf("createdb does not support the %s engine", queryset.Engine) + } + + var ddl []string + files, err := sqlpath.Glob(queryset.Schema) + if err != nil { + return err + } + for _, schema := range files { + contents, err := os.ReadFile(schema) + if err != nil { + return fmt.Errorf("read file: %w", err) + } + ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents))) + } + + now := time.Now().UTC().UnixNano() + client := dbmanager.NewClient(conf.Servers) + resp, err := client.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: string(queryset.Engine), + Migrations: ddl, + Prefix: fmt.Sprintf("sqlc_createdb_%d", now), + }) + if err != nil { + return fmt.Errorf("managed: create database: %w", err) + } + fmt.Println(resp.Uri) + return nil +} diff --git a/internal/cmd/fmt.go b/internal/cmd/fmt.go new file mode 100644 index 0000000000..54763d9420 --- /dev/null +++ b/internal/cmd/fmt.go @@ -0,0 +1,481 @@ +package cmd + +import ( + "context" + "fmt" + "io" + "os" + "path/filepath" + "runtime/trace" + "sort" + "strings" + + "github.com/cubicdaiya/gonp" + "github.com/spf13/cobra" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/engine/dolphin" + "github.com/sqlc-dev/sqlc/internal/engine/postgresql" + "github.com/sqlc-dev/sqlc/internal/engine/sqlite" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/format" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +// noLineLimit renders without a maximum line width: like gofmt, fmt never +// rewraps a line on its own. Breaks come from the author's own line breaks +// at the boundaries the printer models, and from comments, which cannot +// share a line with the code after them. +const noLineLimit = 1 << 30 + +// queryFormatter is what the fmt command needs from an engine: a parser +// that surfaces the comments its lexer already scans (so statements and +// comments come from one pass, and interior comments format along with +// their statements) plus dialect-aware formatting. Comments cannot be +// reprinted without parser support, so ParseFile is the price of admission. +type queryFormatter interface { + ParseFile(io.Reader) (*ast.File, error) + format.Dialect +} + +// newQueryFormatter returns the formatter for engines fmt supports — +// SQLite, PostgreSQL and MySQL today. An engine joins by teaching its +// parser to surface comments (meyer's, oliphant's and marino's ParseFile +// are the templates) and adding its case here. +func newQueryFormatter(engine config.Engine) queryFormatter { + switch engine { + case config.EnginePostgreSQL: + return postgresql.NewParser() + case config.EngineSQLite: + return sqlite.NewParser() + case config.EngineMySQL: + // The format parser preserves identifier case and proves every + // statement via Fingerprint, the way oliphant does for PostgreSQL. + return dolphin.NewFormatParser() + default: + return nil + } +} + +func newFmtCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "fmt", + Short: "Format SQL queries", + Long: `Format the SQL query files referenced by the configuration file. + +Each query is parsed with the engine's parser and printed back in a canonical +form, with its comments kept where they were written. A statement that cannot +be proven to survive formatting unchanged is left exactly as written. Files +are rewritten in place; pass --diff to print the changes to stdout instead.`, + RunE: func(cmd *cobra.Command, args []string) error { + defer trace.StartRegion(cmd.Context(), "fmt").End() + stderr := cmd.ErrOrStderr() + stdout := cmd.OutOrStdout() + showDiff, err := cmd.Flags().GetBool("diff") + if err != nil { + return err + } + dir, name := getConfigPath(stderr, cmd.Flag("file")) + output, err := Format(cmd.Context(), dir, name, &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + }) + if err != nil { + os.Exit(1) + } + + filenames := make([]string, 0, len(output)) + for filename := range output { + filenames = append(filenames, filename) + } + sort.Strings(filenames) + + for _, filename := range filenames { + existing, err := os.ReadFile(filename) + if err != nil { + fmt.Fprintf(stderr, "%s: %s\n", filename, err) + return err + } + source := output[filename] + if string(existing) == source { + continue + } + if showDiff { + diff := gonp.New(getLines(existing), getLines([]byte(source))) + diff.Compose() + uniHunks := filterHunks(diff.UnifiedHunks()) + if len(uniHunks) == 0 { + continue + } + rel := filepath.ToSlash(strings.TrimPrefix(filename, dir)) + fmt.Fprintf(stdout, "--- a%s\n", rel) + fmt.Fprintf(stdout, "+++ b%s\n", rel) + diff.FprintUniHunks(stdout, uniHunks) + continue + } + if err := os.WriteFile(filename, []byte(source), 0644); err != nil { + fmt.Fprintf(stderr, "%s: %s\n", filename, err) + return err + } + } + return nil + }, + } + cmd.Flags().Bool("diff", false, "display diffs instead of rewriting files") + return cmd +} + +// Format formats every query file referenced by the configuration with its +// engine's SQL formatter. It returns the formatted contents of each file, +// keyed by absolute path. Query files for engines without a formatter are +// skipped. +func Format(ctx context.Context, dir, filename string, o *Options) (map[string]string, error) { + defer trace.StartRegion(ctx, "format").End() + stderr := o.Stderr + + configPath, conf, err := o.ReadConfig(dir, filename) + if err != nil { + return nil, err + } + base := filepath.Base(configPath) + if err := config.Validate(conf); err != nil { + fmt.Fprintf(stderr, "error validating %s: %s\n", base, err) + return nil, err + } + + engines := map[string]config.Engine{} + var files []string + for _, sql := range conf.SQL { + joined := make([]string, 0, len(sql.Queries)) + for _, q := range sql.Queries { + joined = append(joined, filepath.Join(dir, q)) + } + list, err := sqlpath.Glob(joined) + if err != nil { + fmt.Fprintf(stderr, "error listing queries: %s\n", err) + return nil, err + } + for _, file := range list { + if _, ok := engines[file]; ok { + continue + } + engines[file] = sql.Engine + files = append(files, file) + } + } + + output := map[string]string{} + unsupported := map[config.Engine]bool{} + for _, file := range files { + f := newQueryFormatter(engines[file]) + if f == nil { + if !unsupported[engines[file]] { + unsupported[engines[file]] = true + fmt.Fprintf(stderr, "sqlc fmt does not yet support the %s engine; query files left unchanged\n", engines[file]) + } + continue + } + rel, err := filepath.Rel(dir, file) + if err != nil { + rel = file + } + contents, err := os.ReadFile(file) + if err != nil { + fmt.Fprintf(stderr, "%s: skipped: %s\n", rel, err) + continue + } + formatted, err := formatQueries(f, string(contents)) + if err != nil { + // Not every query file parses without the compiler's help — for + // example, some engines only accept sqlc.slice() after + // preprocessing. Leave those files as they are. + fmt.Fprintf(stderr, "%s: skipped: %s\n", rel, err) + continue + } + // File-level belt for the reprinter path: no formatting result may + // change the file's comments or its statement count. A violation is + // a formatter bug; keep the file as written and say so. + before, err1 := f.ParseFile(strings.NewReader(string(contents))) + after, err2 := f.ParseFile(strings.NewReader(formatted)) + if err1 == nil && (err2 != nil || len(before.Stmts) != len(after.Stmts) || !sameComments(before.Comments, after.Comments)) { + fmt.Fprintf(stderr, "%s: skipped: formatting would alter the file (this is a bug in sqlc fmt)\n", rel) + continue + } + output[file] = formatted + } + return output, nil +} + +// formatQueries formats each statement in a query file. The comments above +// every statement (that's where the "-- name:" annotation lives) are kept +// as written; comments inside a statement are threaded through the printer +// by position. +func formatQueries(f queryFormatter, src string) (string, error) { + // The parser hands over statements and comments from one lexer pass; + // statement bodies slice the comment list by span. + file, err := f.ParseFile(strings.NewReader(src)) + if err != nil { + return "", err + } + stmts, fileComments := file.Stmts, file.Comments + var blocks []string + prevEnd := 0 + for _, stmt := range stmts { + if stmt.Raw == nil { + continue + } + start := stmt.Raw.StmtLocation + length := stmt.Raw.StmtLen + if length == 0 { + // An unterminated final statement is reported with a zero length. + length = len(src) - start + } + if start < 0 || start+length > len(src) { + return "", fmt.Errorf("statement location out of bounds") + } + // Engines differ on whether a statement's span covers the comments + // above it, so start each segment where the previous one ended: the + // gap holds nothing but the previous terminator, whitespace and + // comments. + segStart := prevEnd + if start < segStart { + segStart = start + } + if start+length <= prevEnd { + continue + } + prevEnd = start + length + seg := src[segStart : start+length] + segOff := segStart + // A comment on the same line as the previous statement's terminator + // belongs to that statement, not to this one's header. + if len(blocks) > 0 { + if trailing, remainder := splitTrailingComment(seg); trailing != "" { + blocks[len(blocks)-1] += " " + trailing + segOff += len(seg) - len(remainder) + seg = remainder + } + } + orig := strings.TrimSpace(strings.TrimLeft(seg, "; \t\r\n")) + if orig == "" { + continue + } + header, rest := splitLeadingComments(orig) + // The statement body's own file offset, so its interior comments + // can be sliced out of the file's comment list in the same + // coordinates the parser stamped on the nodes. + restOff := segOff + strings.Index(seg, orig) + len(orig) - len(rest) + var interior []ast.Comment + for _, c := range fileComments { + if c.Start >= restOff && c.End <= start+length { + interior = append(interior, c) + } + } + block := append([]string{}, header...) + block = append(block, formatStmt(f, stmt.Raw, rest, interior, src)) + blocks = append(blocks, strings.Join(block, "\n")) + } + // Everything after the last statement is its terminator, whitespace and + // trailing comments; keep the comments. + tailSeg := src[prevEnd:] + if len(blocks) > 0 { + if trailing, remainder := splitTrailingComment(tailSeg); trailing != "" { + blocks[len(blocks)-1] += " " + trailing + tailSeg = remainder + } + } + if tail := strings.TrimSpace(strings.TrimLeft(tailSeg, "; \t\r\n")); tail != "" { + blocks = append(blocks, tail) + } + if len(blocks) == 0 { + return src, nil + } + return strings.Join(blocks, "\n\n") + "\n", nil +} + +// splitTrailingComment splits a comment sitting on the same line as the +// previous statement's terminator off the front of the text between two +// statements, returning the comment (or "") and the remaining text. +func splitTrailingComment(seg string) (string, string) { + k := 0 + for k < len(seg) && (seg[k] == ';' || seg[k] == ' ' || seg[k] == '\t' || seg[k] == '\r') { + k++ + } + rest := seg[k:] + line, _, _ := strings.Cut(rest, "\n") + trimmed := strings.TrimSpace(line) + switch { + case strings.HasPrefix(trimmed, "--"), strings.HasPrefix(trimmed, "#"): + return trimmed, seg[k+len(line):] + case strings.HasPrefix(trimmed, "/*") && + strings.HasSuffix(trimmed, "*/") && strings.Count(trimmed, "*/") == 1: + // A block comment contained on the terminator's line. + return trimmed, seg[k+len(line):] + } + return "", seg +} + +// splitLeadingComments splits a statement's text into the comment lines above +// it and the statement itself. Comment lines are returned with surrounding +// whitespace trimmed (block comment continuation lines keep their leading +// whitespace); blank lines between comments are kept. +func splitLeadingComments(text string) ([]string, string) { + var header []string + rest := text + for rest != "" { + line, remainder, found := strings.Cut(rest, "\n") + trimmed := strings.TrimSpace(line) + if strings.HasPrefix(trimmed, "/*") && !strings.Contains(trimmed, "*/") { + // A block comment spanning several lines: commit it to the + // header only when its closing line arrives with nothing after + // it. Otherwise leave the whole block with the statement. + block := []string{trimmed} + blockRest := remainder + for closed := false; !closed; { + if !found || blockRest == "" { + return header, rest + } + var blockLine string + blockLine, blockRest, found = strings.Cut(blockRest, "\n") + if end := strings.TrimSpace(blockLine); strings.Contains(end, "*/") { + if !strings.HasSuffix(end, "*/") || strings.Count(end, "*/") != 1 { + return header, rest + } + closed = true + } + block = append(block, strings.TrimRight(blockLine, " \t\r")) + } + header = append(header, block...) + rest = blockRest + continue + } + if !isCommentLine(trimmed) { + break + } + header = append(header, trimmed) + if !found { + rest = "" + break + } + rest = remainder + } + // A statement never ends with a comment-only line here (the parser found a + // statement in this segment), but drop any blank lines left at the end of + // the header so comments sit directly above their query. + for len(header) > 0 && header[len(header)-1] == "" { + header = header[:len(header)-1] + } + return header, rest +} + +func isCommentLine(line string) bool { + switch { + case line == "": + // A blank line between comments. + return true + case strings.HasPrefix(line, "--"): + return true + case strings.HasPrefix(line, "#"): + // MySQL's line-comment syntax; text that reaches these helpers sits + // outside statements, where a # line in a file the engine parsed + // can only be a comment. + return true + case strings.HasPrefix(line, "/*") && strings.HasSuffix(line, "*/") && strings.Count(line, "*/") == 1: + // A block comment contained on a single line. + return true + default: + return false + } +} + +// fingerprinter is implemented by engines that can reduce a query to a +// fingerprint that survives changes in whitespace, case and layout — +// PostgreSQL via oliphant's pg_query-compatible Fingerprint. Where it is +// available, fmt gets a proof the other checks cannot give: the formatted +// statement still parses to the same query as the original. +type fingerprinter interface { + Fingerprint(string) (string, error) +} + +// formatStmt returns the canonical form of a single statement, or the +// original text when formatting cannot be proven to preserve the query. +func formatStmt(f queryFormatter, raw *ast.RawStmt, orig string, interior []ast.Comment, src string) string { + fallback := strings.TrimSuffix(strings.TrimSpace(orig), ";") + ";" + if out, ok := formatWithComments(f, raw, interior, src); ok { + if fp, ok := f.(fingerprinter); ok && !sameFingerprint(fp, orig, out) { + return fallback + } + return out + } + return fallback +} + +// sameFingerprint reports that both texts fingerprint successfully to the +// same value. Anything less is not a proof, so the caller keeps the +// statement as written. +func sameFingerprint(fp fingerprinter, orig, out string) bool { + a, err1 := fp.Fingerprint(orig) + b, err2 := fp.Fingerprint(out) + return err1 == nil && err2 == nil && a == b +} + +// formatWithComments pretty-prints a statement with its interior comments +// and proves the result faithful three ways before accepting it: every +// comment survives (multiset equality after reparsing the output), the SQL +// still parses as one statement, and the output is a fixed point (printing +// the reparsed statement with its reparsed comments reproduces it). +func formatWithComments(f queryFormatter, raw *ast.RawStmt, interior []ast.Comment, src string) (string, bool) { + out := prettyCommented(raw, f, interior, src) + if strings.TrimSpace(strings.TrimSuffix(out, ";")) == "" { + return "", false + } + file, err := f.ParseFile(strings.NewReader(out)) + if err != nil || len(file.Stmts) != 1 || file.Stmts[0].Raw == nil { + return "", false + } + if !sameComments(interior, file.Comments) { + return "", false + } + again := prettyCommented(file.Stmts[0].Raw, f, file.Comments, out) + if !strings.EqualFold(again, out) { + return "", false + } + return out, true +} + +// prettyCommented attaches a statement's comments to its nodes and renders +// it, returning "" when the printer panics or fails to place every comment. +func prettyCommented(raw *ast.RawStmt, f queryFormatter, comments []ast.Comment, src string) (out string) { + defer func() { + if r := recover(); r != nil { + out = "" + } + }() + ct := ast.AttachComments(raw, f, comments, src) + out = ast.PrettyWithComments(raw, f, noLineLimit, ct) + if !ct.Exhausted() { + return "" + } + return out +} + +// sameComments reports whether two comment lists carry the same comment +// texts, as multisets, ignoring surrounding whitespace. +func sameComments(a, b []ast.Comment) bool { + if len(a) != len(b) { + return false + } + counts := make(map[string]int, len(a)) + for _, c := range a { + counts[strings.TrimSpace(c.Text)]++ + } + for _, c := range b { + counts[strings.TrimSpace(c.Text)]-- + } + for _, n := range counts { + if n != 0 { + return false + } + } + return true +} diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index 35a5f06e4e..fbdb084409 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -1,7 +1,6 @@ package cmd import ( - "bytes" "context" "encoding/json" "errors" @@ -9,12 +8,11 @@ import ( "io" "os" "path/filepath" - "runtime" "runtime/trace" + "strings" "sync" - "golang.org/x/sync/errgroup" - "google.golang.org/grpc/status" + "google.golang.org/grpc" "github.com/sqlc-dev/sqlc/internal/codegen/golang" genjson "github.com/sqlc-dev/sqlc/internal/codegen/json" @@ -25,14 +23,14 @@ import ( "github.com/sqlc-dev/sqlc/internal/ext" "github.com/sqlc-dev/sqlc/internal/ext/process" "github.com/sqlc-dev/sqlc/internal/ext/wasm" - "github.com/sqlc-dev/sqlc/internal/info" "github.com/sqlc-dev/sqlc/internal/multierr" "github.com/sqlc-dev/sqlc/internal/opts" "github.com/sqlc-dev/sqlc/internal/plugin" - "github.com/sqlc-dev/sqlc/internal/remote" - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" ) +var debugDumpCatalog = sqlcdebug.New("dumpcatalog") + const errMessageNoVersion = `The configuration file must have a version number. Set the version to 1 or 2 at the top of sqlc.json: @@ -56,13 +54,6 @@ func printFileErr(stderr io.Writer, dir string, fileErr *multierr.FileError) { fmt.Fprintf(stderr, "%s:%d:%d: %s\n", filename, fileErr.Line, fileErr.Column, fileErr.Err) } -type outPair struct { - Gen config.SQLGen - Plugin *config.Codegen - - config.SQL -} - func findPlugin(conf config.Config, name string) (*config.Plugin, error) { for _, plug := range conf.Plugins { if plug.Name == name { @@ -159,195 +150,120 @@ func Generate(ctx context.Context, dir, filename string, o *Options) (map[string return nil, err } - if conf.Cloud.Project != "" && e.Remote && !e.NoRemote { - return remoteGenerate(ctx, configPath, conf, dir, stderr) + g := &generator{ + dir: dir, + output: map[string]string{}, } - output := map[string]string{} - errored := false + if err := processQuerySets(ctx, g, conf, dir, o); err != nil { + return nil, err + } + + return g.output, nil +} + +type generator struct { + m sync.Mutex + dir string + output map[string]string +} - var pairs []outPair +func (g *generator) Pairs(ctx context.Context, conf *config.Config) []OutputPair { + var pairs []OutputPair for _, sql := range conf.SQL { if sql.Gen.Go != nil { - pairs = append(pairs, outPair{ + pairs = append(pairs, OutputPair{ SQL: sql, Gen: config.SQLGen{Go: sql.Gen.Go}, }) } if sql.Gen.JSON != nil { - pairs = append(pairs, outPair{ + pairs = append(pairs, OutputPair{ SQL: sql, Gen: config.SQLGen{JSON: sql.Gen.JSON}, }) } for i := range sql.Codegen { - pairs = append(pairs, outPair{ + pairs = append(pairs, OutputPair{ SQL: sql, Plugin: &sql.Codegen[i], }) } } - - var m sync.Mutex - grp, gctx := errgroup.WithContext(ctx) - grp.SetLimit(runtime.GOMAXPROCS(0)) - - stderrs := make([]bytes.Buffer, len(pairs)) - - for i, pair := range pairs { - sql := pair - errout := &stderrs[i] - - grp.Go(func() error { - combo := config.Combine(*conf, sql.SQL) - if sql.Plugin != nil { - combo.Codegen = *sql.Plugin - } - - // TODO: This feels like a hack that will bite us later - joined := make([]string, 0, len(sql.Schema)) - for _, s := range sql.Schema { - joined = append(joined, filepath.Join(dir, s)) - } - sql.Schema = joined - - joined = make([]string, 0, len(sql.Queries)) - for _, q := range sql.Queries { - joined = append(joined, filepath.Join(dir, q)) - } - sql.Queries = joined - - var name, lang string - parseOpts := opts.Parser{ - Debug: debug.Debug, - } - - switch { - case sql.Gen.Go != nil: - name = combo.Go.Package - lang = "golang" - - case sql.Plugin != nil: - lang = fmt.Sprintf("process:%s", sql.Plugin.Plugin) - name = sql.Plugin.Plugin - } - - packageRegion := trace.StartRegion(gctx, "package") - trace.Logf(gctx, "", "name=%s dir=%s plugin=%s", name, dir, lang) - - result, failed := parse(gctx, name, dir, sql.SQL, combo, parseOpts, errout) - if failed { - packageRegion.End() - errored = true - return nil - } - - out, resp, err := codegen(gctx, combo, sql, result) - if err != nil { - fmt.Fprintf(errout, "# package %s\n", name) - fmt.Fprintf(errout, "error generating code: %s\n", err) - errored = true - packageRegion.End() - return nil - } - - files := map[string]string{} - for _, file := range resp.Files { - files[file.Name] = string(file.Contents) - } - - m.Lock() - for n, source := range files { - filename := filepath.Join(dir, out, n) - output[filename] = source - } - m.Unlock() - - packageRegion.End() - return nil - }) - } - if err := grp.Wait(); err != nil { - return nil, err - } - if errored { - for i, _ := range stderrs { - if _, err := io.Copy(stderr, &stderrs[i]); err != nil { - return nil, err - } - } - return nil, fmt.Errorf("errored") - } - return output, nil + return pairs } -func remoteGenerate(ctx context.Context, configPath string, conf *config.Config, dir string, stderr io.Writer) (map[string]string, error) { - rpcClient, err := remote.NewClient(conf.Cloud) +func (g *generator) ProcessResult(ctx context.Context, combo config.CombinedSettings, sql OutputPair, result *compiler.Result) error { + out, resp, err := codegen(ctx, combo, sql, result) if err != nil { - fmt.Fprintf(stderr, "error creating rpc client: %s\n", err) - return nil, err + return err } - - configBytes, err := os.ReadFile(configPath) - if err != nil { - fmt.Fprintf(stderr, "error reading config file %s: %s\n", configPath, err) - return nil, err + files := map[string]string{} + for _, file := range resp.Files { + files[file.Name] = string(file.Contents) } - - rpcReq := remote.GenerateRequest{ - Version: info.Version, - Inputs: []*remote.File{{Path: filepath.Base(configPath), Bytes: configBytes}}, + g.m.Lock() + + // out is specified by the user, not a plugin + absout := filepath.Join(g.dir, out) + + // When the Go codegen is configured to emit the models file into a + // separate package directory, route that file to its own absolute path. + // This is the only file allowed to live outside of `out`. + var ( + modelsFileName string + modelsAbsout string + modelsAbsfile string + ) + if sql.Gen.Go != nil && sql.Gen.Go.OutputModelsPath != "" && sql.Gen.Go.ModelsEmitEnabled() { + modelsFileName = sql.Gen.Go.OutputModelsFileName + if modelsFileName == "" { + modelsFileName = "models.go" + } + modelsAbsout = filepath.Join(g.dir, sql.Gen.Go.OutputModelsPath) + modelsAbsfile = filepath.Join(modelsAbsout, modelsFileName) } - for _, pkg := range conf.SQL { - for _, paths := range []config.Paths{pkg.Schema, pkg.Queries} { - for i, relFilePath := range paths { - paths[i] = filepath.Join(dir, relFilePath) - } - files, err := sqlpath.Glob(paths) - if err != nil { - fmt.Fprintf(stderr, "error globbing paths: %s\n", err) - return nil, err + for n, source := range files { + if modelsFileName != "" && n == modelsFileName { + // Models file routed to a separate package directory. + if strings.Contains(modelsAbsfile, "..") { + return fmt.Errorf("invalid file output path: %s", modelsAbsfile) } - for _, filePath := range files { - fileBytes, err := os.ReadFile(filePath) - if err != nil { - fmt.Fprintf(stderr, "error reading file %s: %s\n", filePath, err) - return nil, err - } - fileRelPath, _ := filepath.Rel(dir, filePath) - rpcReq.Inputs = append(rpcReq.Inputs, &remote.File{Path: fileRelPath, Bytes: fileBytes}) + if !strings.HasPrefix(modelsAbsfile, modelsAbsout) { + return fmt.Errorf("invalid file output path: %s", modelsAbsfile) } + g.output[modelsAbsfile] = source + continue } - } - - rpcResp, err := rpcClient.Generate(ctx, &rpcReq) - if err != nil { - rpcStatus, ok := status.FromError(err) - if !ok { - return nil, err + filename := filepath.Join(g.dir, out, n) + // filepath.Join calls filepath.Clean which should remove all "..", but + // double check to make sure + if strings.Contains(filename, "..") { + return fmt.Errorf("invalid file output path: %s", filename) } - fmt.Fprintf(stderr, "rpc error: %s", rpcStatus.Message()) - return nil, rpcStatus.Err() - } - - if rpcResp.ExitCode != 0 { - fmt.Fprintf(stderr, "%s", rpcResp.Stderr) - return nil, errors.New("remote execution returned with non-zero exit code") - } - - output := map[string]string{} - for _, file := range rpcResp.Outputs { - output[filepath.Join(dir, file.Path)] = string(file.Bytes) + // The output file must be contained inside the output directory + if !strings.HasPrefix(filename, absout) { + return fmt.Errorf("invalid file output path: %s", filename) + } + g.output[filename] = source } - - return output, nil + g.m.Unlock() + return nil } func parse(ctx context.Context, name, dir string, sql config.SQL, combo config.CombinedSettings, parserOpts opts.Parser, stderr io.Writer) (*compiler.Result, bool) { defer trace.StartRegion(ctx, "parse").End() - c, err := compiler.NewCompiler(sql, combo) - defer c.Close(ctx) + var copts []compiler.Option + if parserOpts.Experiment.CoreAnalyzer { + copts = append(copts, compiler.WithCoreAnalysis()) + } + c, err := compiler.NewCompiler(sql, combo, parserOpts, copts...) + defer func() { + if c != nil { + c.Close(ctx) + } + }() if err != nil { fmt.Fprintf(stderr, "error creating compiler: %s\n", err) return nil, true @@ -363,7 +279,7 @@ func parse(ctx context.Context, name, dir string, sql config.SQL, combo config.C } return nil, true } - if parserOpts.Debug.DumpCatalog { + if debugDumpCatalog.Value() == "1" { debug.Dump(c.Catalog()) } if err := c.ParseQueries(sql.Queries, parserOpts); err != nil { @@ -380,10 +296,10 @@ func parse(ctx context.Context, name, dir string, sql config.SQL, combo config.C return c.Result(), false } -func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, result *compiler.Result) (string, *plugin.CodeGenResponse, error) { +func codegen(ctx context.Context, combo config.CombinedSettings, sql OutputPair, result *compiler.Result) (string, *plugin.GenerateResponse, error) { defer trace.StartRegion(ctx, "codegen").End() req := codeGenRequest(result, combo) - var handler ext.Handler + var handler grpc.ClientConnInterface var out string switch { case sql.Plugin != nil: @@ -396,8 +312,9 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re switch { case plug.Process != nil: handler = &process.Runner{ - Cmd: plug.Process.Cmd, - Env: plug.Env, + Cmd: plug.Process.Cmd, + Env: plug.Env, + Format: plug.Process.Format, } case plug.WASM != nil: handler = &wasm.Runner{ @@ -411,10 +328,19 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re opts, err := convert.YAMLtoJSON(sql.Plugin.Options) if err != nil { - return "", nil, fmt.Errorf("invalid plugin options") + return "", nil, fmt.Errorf("invalid plugin options: %w", err) } req.PluginOptions = opts + global, found := combo.Global.Options[plug.Name] + if found { + opts, err := convert.YAMLtoJSON(global) + if err != nil { + return "", nil, fmt.Errorf("invalid global options: %w", err) + } + req.GlobalOptions = opts + } + case sql.Gen.Go != nil: out = combo.Go.Out handler = ext.HandleFunc(golang.Generate) @@ -424,6 +350,14 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re } req.PluginOptions = opts + if combo.Global.Overrides.Go != nil { + opts, err := json.Marshal(combo.Global.Overrides.Go) + if err != nil { + return "", nil, fmt.Errorf("opts marshal failed: %w", err) + } + req.GlobalOptions = opts + } + case sql.Gen.JSON != nil: out = combo.JSON.Out handler = ext.HandleFunc(genjson.Generate) @@ -436,6 +370,7 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re default: return "", nil, fmt.Errorf("missing language backend") } - resp, err := handler.Generate(ctx, req) + client := plugin.NewCodegenServiceClient(handler) + resp, err := client.Generate(ctx, req) return out, resp, err } diff --git a/internal/cmd/options.go b/internal/cmd/options.go index 8dd99fb04f..02d3614f4e 100644 --- a/internal/cmd/options.go +++ b/internal/cmd/options.go @@ -7,8 +7,13 @@ import ( ) type Options struct { - Env Env - Stderr io.Writer + Env Env + Stderr io.Writer + // TODO: Move these to a command-specific struct + Tags []string + Against string + + // Testing only MutateConfig func(*config.Config) } diff --git a/internal/cmd/package.go b/internal/cmd/package.go deleted file mode 100644 index c4d3df7fd5..0000000000 --- a/internal/cmd/package.go +++ /dev/null @@ -1,30 +0,0 @@ -package cmd - -import ( - "context" - "os" - - "github.com/sqlc-dev/sqlc/internal/bundler" -) - -func createPkg(ctx context.Context, dir, filename string, opts *Options) error { - e := opts.Env - stderr := opts.Stderr - configPath, conf, err := readConfig(stderr, dir, filename) - if err != nil { - return err - } - up := bundler.NewUploader(configPath, dir, conf) - if err := up.Validate(); err != nil { - return err - } - output, err := Generate(ctx, dir, filename, opts) - if err != nil { - os.Exit(1) - } - if e.DryRun { - return up.DumpRequestOut(ctx, output) - } else { - return up.Upload(ctx, output) - } -} diff --git a/internal/cmd/parse.go b/internal/cmd/parse.go new file mode 100644 index 0000000000..72f59612c8 --- /dev/null +++ b/internal/cmd/parse.go @@ -0,0 +1,166 @@ +package cmd + +import ( + "encoding/json" + "fmt" + "io" + "os" + "strings" + + "github.com/spf13/cobra" + + "github.com/sqlc-dev/sqlc/internal/engine/clickhouse" + "github.com/sqlc-dev/sqlc/internal/engine/dolphin" + "github.com/sqlc-dev/sqlc/internal/engine/duckdb" + "github.com/sqlc-dev/sqlc/internal/engine/googlesql" + "github.com/sqlc-dev/sqlc/internal/engine/mssql" + "github.com/sqlc-dev/sqlc/internal/engine/postgresql" + "github.com/sqlc-dev/sqlc/internal/engine/sqlite" + "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +// dialectParser is the subset of the engine parsers that the parse command +// needs: parsing SQL into statements and reporting the dialect's comment syntax +// (used to extract the sqlc query name and command). +type dialectParser interface { + Parse(io.Reader) ([]ast.Statement, error) + CommentSyntax() source.CommentSyntax +} + +// parsedStatement is the JSON representation of a single parsed statement. The +// name and cmd are extracted from the sqlc query annotation (e.g. +// "-- name: GetAuthor :one") and are omitted when the statement has none. +type parsedStatement struct { + Name string `json:"name,omitempty"` + Cmd string `json:"cmd,omitempty"` + AST *ast.RawStmt `json:"ast"` +} + +func newParseCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "parse [file]", + Short: "Parse SQL and output the AST as JSON", + Long: `Parse SQL from a file or stdin and output the abstract syntax tree as JSON. + +Each statement is reported with its sqlc query name and command (when the +statement carries a "-- name:" annotation) alongside the AST. + +Examples: + # Parse a SQL file with PostgreSQL dialect + sqlc parse --dialect postgresql schema.sql + + # Parse from stdin with MySQL dialect + echo "SELECT * FROM users" | sqlc parse --dialect mysql + + # Parse SQLite SQL + sqlc parse --dialect sqlite queries.sql + + # Parse ClickHouse SQL + sqlc parse --dialect clickhouse queries.sql + + # Parse GoogleSQL (BigQuery, Spanner) + sqlc parse --dialect googlesql queries.sql + + # Parse SQL Server (T-SQL) SQL + sqlc parse --dialect mssql queries.sql + + # Parse DuckDB SQL + sqlc parse --dialect duckdb queries.sql`, + Args: cobra.MaximumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + dialect, err := cmd.Flags().GetString("dialect") + if err != nil { + return err + } + if dialect == "" { + return fmt.Errorf("--dialect flag is required (postgresql, mysql, sqlite, clickhouse, googlesql, mssql, or duckdb)") + } + + // Determine input source + var input io.Reader + if len(args) == 1 { + file, err := os.Open(args[0]) + if err != nil { + return fmt.Errorf("failed to open file: %w", err) + } + defer file.Close() + input = file + } else { + // Check if stdin has data + stat, err := os.Stdin.Stat() + if err != nil { + return fmt.Errorf("failed to stat stdin: %w", err) + } + if (stat.Mode() & os.ModeCharDevice) != 0 { + return fmt.Errorf("no input provided. Specify a file path or pipe SQL via stdin") + } + input = cmd.InOrStdin() + } + + // Select the parser for the requested dialect + var parser dialectParser + switch dialect { + case "postgresql", "postgres", "pg": + parser = postgresql.NewParser() + case "mysql": + parser = dolphin.NewParser() + case "sqlite": + parser = sqlite.NewParser() + case "clickhouse": + parser = clickhouse.NewParser() + case "googlesql": + parser = googlesql.NewParser() + case "mssql", "sqlserver": + parser = mssql.NewParser() + case "duckdb": + parser = duckdb.NewParser() + default: + return fmt.Errorf("unsupported dialect: %s (use postgresql, mysql, sqlite, clickhouse, googlesql, mssql, or duckdb)", dialect) + } + + // Read the full source so each statement's name and command can be + // extracted from its annotation comment. + src, err := io.ReadAll(input) + if err != nil { + return fmt.Errorf("failed to read input: %w", err) + } + + stmts, err := parser.Parse(strings.NewReader(string(src))) + if err != nil { + return fmt.Errorf("parse error: %w", err) + } + + commentSyntax := metadata.CommentSyntax(parser.CommentSyntax()) + + // Output the AST as a single JSON document + out := make([]parsedStatement, 0, len(stmts)) + for _, stmt := range stmts { + ps := parsedStatement{AST: stmt.Raw} + rawSQL, err := source.Pluck(string(src), stmt.Raw.StmtLocation, stmt.Raw.StmtLen) + if err != nil { + return fmt.Errorf("failed to read statement source: %w", err) + } + name, cmd, err := metadata.ParseQueryNameAndType(rawSQL, commentSyntax) + if err != nil { + return fmt.Errorf("failed to parse query annotation: %w", err) + } + ps.Name = name + ps.Cmd = cmd + out = append(out, ps) + } + + stdout := cmd.OutOrStdout() + encoder := json.NewEncoder(stdout) + encoder.SetIndent("", " ") + if err := encoder.Encode(out); err != nil { + return fmt.Errorf("failed to encode AST: %w", err) + } + + return nil + }, + } + cmd.Flags().StringP("dialect", "d", "", "SQL dialect to use (postgresql, mysql, sqlite, clickhouse, googlesql, mssql, or duckdb)") + return cmd +} diff --git a/internal/cmd/process.go b/internal/cmd/process.go new file mode 100644 index 0000000000..e54eb43b39 --- /dev/null +++ b/internal/cmd/process.go @@ -0,0 +1,133 @@ +package cmd + +import ( + "bytes" + "context" + "fmt" + "io" + "path/filepath" + "runtime" + "runtime/trace" + + "golang.org/x/sync/errgroup" + + "github.com/sqlc-dev/sqlc/internal/compiler" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/opts" +) + +type OutputPair struct { + Gen config.SQLGen + Plugin *config.Codegen + + config.SQL +} + +type ResultProcessor interface { + Pairs(context.Context, *config.Config) []OutputPair + ProcessResult(context.Context, config.CombinedSettings, OutputPair, *compiler.Result) error +} + +func Process(ctx context.Context, rp ResultProcessor, dir, filename string, o *Options) error { + e := o.Env + stderr := o.Stderr + + configPath, conf, err := o.ReadConfig(dir, filename) + if err != nil { + return err + } + + base := filepath.Base(configPath) + if err := config.Validate(conf); err != nil { + fmt.Fprintf(stderr, "error validating %s: %s\n", base, err) + return err + } + + if err := e.Validate(conf); err != nil { + fmt.Fprintf(stderr, "error validating %s: %s\n", base, err) + return err + } + + return processQuerySets(ctx, rp, conf, dir, o) +} + +func processQuerySets(ctx context.Context, rp ResultProcessor, conf *config.Config, dir string, o *Options) error { + stderr := o.Stderr + + errored := false + + pairs := rp.Pairs(ctx, conf) + grp, gctx := errgroup.WithContext(ctx) + grp.SetLimit(runtime.GOMAXPROCS(0)) + + stderrs := make([]bytes.Buffer, len(pairs)) + + for i, pair := range pairs { + sql := pair + errout := &stderrs[i] + + grp.Go(func() error { + combo := config.Combine(*conf, sql.SQL) + if sql.Plugin != nil { + combo.Codegen = *sql.Plugin + } + + // TODO: This feels like a hack that will bite us later + joined := make([]string, 0, len(sql.Schema)) + for _, s := range sql.Schema { + joined = append(joined, filepath.Join(dir, s)) + } + sql.Schema = joined + + joined = make([]string, 0, len(sql.Queries)) + for _, q := range sql.Queries { + joined = append(joined, filepath.Join(dir, q)) + } + sql.Queries = joined + + var name, lang string + parseOpts := opts.Parser{ + Experiment: o.Env.Experiment, + } + + switch { + case sql.Gen.Go != nil: + name = combo.Go.Package + lang = "golang" + + case sql.Plugin != nil: + lang = fmt.Sprintf("process:%s", sql.Plugin.Plugin) + name = sql.Plugin.Plugin + } + + packageRegion := trace.StartRegion(gctx, "package") + trace.Logf(gctx, "", "name=%s dir=%s plugin=%s", name, dir, lang) + + result, failed := parse(gctx, name, dir, sql.SQL, combo, parseOpts, errout) + if failed { + packageRegion.End() + errored = true + return nil + } + if err := rp.ProcessResult(gctx, combo, sql, result); err != nil { + fmt.Fprintf(errout, "# package %s\n", name) + fmt.Fprintf(errout, "error generating code: %s\n", err) + errored = true + } + packageRegion.End() + return nil + }) + } + if err := grp.Wait(); err != nil { + return err + } + if errored { + for i, _ := range stderrs { + if _, err := io.Copy(stderr, &stderrs[i]); err != nil { + return err + } + } + return fmt.Errorf("errored") + } + return nil +} diff --git a/internal/cmd/push.go b/internal/cmd/push.go new file mode 100644 index 0000000000..19aca6739b --- /dev/null +++ b/internal/cmd/push.go @@ -0,0 +1,92 @@ +package cmd + +import ( + "context" + "fmt" + "os" + "sync" + + "github.com/spf13/cobra" + + "github.com/sqlc-dev/sqlc/internal/bundler" + "github.com/sqlc-dev/sqlc/internal/compiler" + "github.com/sqlc-dev/sqlc/internal/config" +) + +func init() { + pushCmd.Flags().StringSliceP("tag", "t", nil, "tag this push with a value") +} + +var pushCmd = &cobra.Command{ + Use: "push", + Aliases: []string{"upload"}, + Short: "Push the schema, queries, and configuration for this project", + RunE: func(cmd *cobra.Command, args []string) error { + stderr := cmd.ErrOrStderr() + dir, name := getConfigPath(stderr, cmd.Flag("file")) + tags, err := cmd.Flags().GetStringSlice("tag") + if err != nil { + return err + } + opts := &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + Tags: tags, + } + if err := Push(cmd.Context(), dir, name, opts); err != nil { + fmt.Fprintf(stderr, "error pushing: %s\n", err) + os.Exit(1) + } + return nil + }, +} + +type pusher struct { + m sync.Mutex + results []*bundler.QuerySetArchive +} + +func (g *pusher) Pairs(ctx context.Context, conf *config.Config) []OutputPair { + var pairs []OutputPair + for _, sql := range conf.SQL { + pairs = append(pairs, OutputPair{ + SQL: sql, + }) + } + return pairs +} + +func (g *pusher) ProcessResult(ctx context.Context, combo config.CombinedSettings, sql OutputPair, result *compiler.Result) error { + req := codeGenRequest(result, combo) + g.m.Lock() + g.results = append(g.results, &bundler.QuerySetArchive{ + Name: sql.Name, + Schema: sql.Schema, + Queries: sql.Queries, + Request: req, + }) + g.m.Unlock() + return nil +} + +func Push(ctx context.Context, dir, filename string, opts *Options) error { + e := opts.Env + stderr := opts.Stderr + configPath, conf, err := readConfig(stderr, dir, filename) + if err != nil { + return err + } + up := bundler.NewUploader(configPath, dir, conf) + if err := up.Validate(); err != nil { + return err + } + p := &pusher{} + if err := Process(ctx, p, dir, filename, opts); err != nil { + return err + } + if e.DryRun { + return up.DumpRequestOut(ctx, p.results) + } else { + return up.Upload(ctx, p.results, opts.Tags) + } +} diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index 4453d47a3c..9987a1783d 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -1,63 +1,22 @@ package cmd import ( - "strings" - "github.com/sqlc-dev/sqlc/internal/compiler" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/config/convert" + "github.com/sqlc-dev/sqlc/internal/core" "github.com/sqlc-dev/sqlc/internal/info" "github.com/sqlc-dev/sqlc/internal/plugin" "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func pluginOverride(r *compiler.Result, o config.Override) *plugin.Override { - var column string - var table plugin.Identifier - - if o.Column != "" { - colParts := strings.Split(o.Column, ".") - switch len(colParts) { - case 2: - table.Schema = r.Catalog.DefaultSchema - table.Name = colParts[0] - column = colParts[1] - case 3: - table.Schema = colParts[0] - table.Name = colParts[1] - column = colParts[2] - case 4: - table.Catalog = colParts[0] - table.Schema = colParts[1] - table.Name = colParts[2] - column = colParts[3] - } - } - return &plugin.Override{ - CodeType: "", // FIXME - DbType: o.DBType, - Nullable: o.Nullable, - Unsigned: o.Unsigned, - Column: o.Column, - ColumnName: column, - Table: &table, - GoType: pluginGoType(o), - } -} - func pluginSettings(r *compiler.Result, cs config.CombinedSettings) *plugin.Settings { - var over []*plugin.Override - for _, o := range cs.Overrides { - over = append(over, pluginOverride(r, o)) - } return &plugin.Settings{ - Version: cs.Global.Version, - Engine: string(cs.Package.Engine), - Schema: []string(cs.Package.Schema), - Queries: []string(cs.Package.Queries), - Overrides: over, - Rename: cs.Rename, - Codegen: pluginCodegen(cs, cs.Codegen), + Version: cs.Global.Version, + Engine: string(cs.Package.Engine), + Schema: []string(cs.Package.Schema), + Queries: []string(cs.Package.Queries), + Codegen: pluginCodegen(cs, cs.Codegen), } } @@ -101,20 +60,6 @@ func pluginWASM(p config.Plugin) *plugin.Codegen_WASM { return nil } -func pluginGoType(o config.Override) *plugin.ParsedGoType { - // Note that there is a slight mismatch between this and the - // proto api. The GoType on the override is the unparsed type, - // which could be a qualified path or an object, as per - // https://docs.sqlc.dev/en/v1.18.0/reference/config.html#type-overriding - return &plugin.ParsedGoType{ - ImportPath: o.GoImportPath, - Package: o.GoPackage, - TypeName: o.GoTypeName, - BasicType: o.GoBasicType, - StructTags: o.GoStructTags, - } -} - func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { var schemas []*plugin.Schema for _, s := range c.Schemas { @@ -156,6 +101,7 @@ func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { IsArray: c.IsArray, ArrayDims: int32(c.ArrayDims), Length: int32(l), + TypeExpr: pluginTypeExpr(c.TypeExpr), Table: &plugin.Identifier{ Catalog: t.Rel.Catalog, Schema: t.Rel.Schema, @@ -209,13 +155,13 @@ func pluginQueries(r *compiler.Result) []*plugin.Query { } } out = append(out, &plugin.Query{ - Name: q.Name, - Cmd: q.Cmd, + Name: q.Metadata.Name, + Cmd: q.Metadata.Cmd, Text: q.SQL, - Comments: q.Comments, + Comments: q.Metadata.Comments, Columns: columns, Params: params, - Filename: q.Filename, + Filename: q.Metadata.Filename, InsertIntoTable: iit, }) } @@ -269,6 +215,42 @@ func pluginQueryColumn(c *compiler.Column) *plugin.Column { } } + // The type as an expression is only known when the analysis core typed + // the column, so the legacy path leaves it unset and codegen falls back + // to the flat fields above. + out.TypeExpr = pluginTypeExpr(c.TypeExpr) + + return out +} + +func pluginTypeExpr(t *core.TypeExpr) *plugin.TypeExpr { + if t == nil { + return nil + } + out := &plugin.TypeExpr{ + Name: t.Name, + Nullable: t.Nullable, + } + for _, arg := range t.Args { + out.Args = append(out.Args, pluginTypeArg(arg)) + } + return out +} + +func pluginTypeArg(a core.TypeArg) *plugin.TypeArg { + out := &plugin.TypeArg{Label: a.Label} + switch { + case a.Type != nil: + out.Value = &plugin.TypeArg_Type{Type: pluginTypeExpr(a.Type)} + case a.Int != nil: + out.Value = &plugin.TypeArg_IntValue{IntValue: *a.Int} + case a.Bool != nil: + out.Value = &plugin.TypeArg_BoolValue{BoolValue: *a.Bool} + case a.String != nil: + out.Value = &plugin.TypeArg_StringValue{StringValue: *a.String} + case a.Ident != nil: + out.Value = &plugin.TypeArg_Ident{Ident: *a.Ident} + } return out } @@ -276,11 +258,12 @@ func pluginQueryParam(p compiler.Parameter) *plugin.Parameter { return &plugin.Parameter{ Number: int32(p.Number), Column: pluginQueryColumn(p.Column), + Name: p.Name, } } -func codeGenRequest(r *compiler.Result, settings config.CombinedSettings) *plugin.CodeGenRequest { - return &plugin.CodeGenRequest{ +func codeGenRequest(r *compiler.Result, settings config.CombinedSettings) *plugin.GenerateRequest { + return &plugin.GenerateRequest{ Settings: pluginSettings(r, settings), Catalog: pluginCatalog(r.Catalog), Queries: pluginQueries(r), diff --git a/internal/cmd/verify.go b/internal/cmd/verify.go new file mode 100644 index 0000000000..a52c218bff --- /dev/null +++ b/internal/cmd/verify.go @@ -0,0 +1,156 @@ +package cmd + +import ( + "context" + "database/sql" + "errors" + "fmt" + "log/slog" + "os" + + _ "github.com/jackc/pgx/v5/stdlib" + "github.com/spf13/cobra" + "google.golang.org/protobuf/proto" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/plugin" + "github.com/sqlc-dev/sqlc/internal/quickdb" + pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" +) + +func init() { + verifyCmd.Flags().String("against", "", "compare against this tag") +} + +var verifyCmd = &cobra.Command{ + Use: "verify", + Short: "Verify schema, queries, and configuration for this project", + RunE: func(cmd *cobra.Command, args []string) error { + stderr := cmd.ErrOrStderr() + dir, name := getConfigPath(stderr, cmd.Flag("file")) + against, err := cmd.Flags().GetString("against") + if err != nil { + return err + } + opts := &Options{ + Env: ParseEnv(cmd), + Stderr: stderr, + Against: against, + } + if err := Verify(cmd.Context(), dir, name, opts); err != nil { + fmt.Fprintf(stderr, "Error verifying queries: %s\n", err) + os.Exit(1) + } + return nil + }, +} + +func Verify(ctx context.Context, dir, filename string, opts *Options) error { + stderr := opts.Stderr + _, conf, err := readConfig(stderr, dir, filename) + if err != nil { + return err + } + + client, err := quickdb.NewClientFromConfig(conf.Cloud) + if err != nil { + return fmt.Errorf("client init failed: %w", err) + } + + manager := dbmanager.NewClient(conf.Servers) + + // Get query sets from a previous archive by tag. If no tag is provided, get + // the latest query sets. + previous, err := client.GetQuerySets(ctx, &pb.GetQuerySetsRequest{ + Tag: opts.Against, + }) + if err != nil { + return err + } + + // Create a mapping of name to query set + existing := map[string]config.SQL{} + for _, qs := range conf.SQL { + existing[qs.Name] = qs + } + + var verr error + for _, qs := range previous.QuerySets { + // TODO: Create a function for this so that we can return early on errors + + check := func() error { + if qs.Name == "" { + return fmt.Errorf("unnamed query set") + } + + current, found := existing[qs.Name] + if !found { + return fmt.Errorf("unknown query set: %s", qs.Name) + } + + // Read the schema files into memory, removing rollback statements + var ddl []string + files, err := sqlpath.Glob(current.Schema) + if err != nil { + return err + } + for _, schema := range files { + contents, err := os.ReadFile(schema) + if err != nil { + return fmt.Errorf("read file: %w", err) + } + ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents))) + } + + var codegen plugin.GenerateRequest + if err := proto.Unmarshal(qs.CodegenRequest.Contents, &codegen); err != nil { + return err + } + + // Create (or re-use) a database to verify against + resp, err := manager.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: string(current.Engine), + Migrations: ddl, + }) + if err != nil { + return err + } + + db, err := sql.Open("pgx", resp.Uri) + if err != nil { + return err + } + defer db.Close() + + var qerr error + for _, query := range codegen.Queries { + stmt, err := db.PrepareContext(ctx, query.Text) + if err != nil { + fmt.Fprintf(stderr, "Failed to prepare the following query:\n") + fmt.Fprintf(stderr, "%s\n", query.Text) + fmt.Fprintf(stderr, "Error was: %s\n", err) + qerr = err + continue + } + if err := stmt.Close(); err != nil { + slog.Error("stmt.Close failed", "err", err) + } + } + + return qerr + } + + if err := check(); err != nil { + verr = errors.New("errored") + fmt.Fprintf(stderr, "FAIL\t%s\n", qs.Name) + fmt.Fprintf(stderr, " ERROR\t%s\n", err) + } else { + fmt.Fprintf(stderr, "ok\t%s\n", qs.Name) + } + } + + return verr +} diff --git a/internal/cmd/vet.go b/internal/cmd/vet.go index 31aa3ec33c..1bdf87ddf1 100644 --- a/internal/cmd/vet.go +++ b/internal/cmd/vet.go @@ -6,40 +6,47 @@ import ( "encoding/json" "errors" "fmt" + "github.com/sqlc-dev/sqlc/internal/constants" "io" "log" "os" "path/filepath" "runtime/trace" + "slices" "strings" + "sync" "time" _ "github.com/go-sql-driver/mysql" - "github.com/google/cel-go/cel" - "github.com/google/cel-go/ext" + "cel.dev/cel-go/cel" + "cel.dev/cel-go/ext" "github.com/jackc/pgx/v5" - _ "github.com/mattn/go-sqlite3" "github.com/spf13/cobra" "google.golang.org/protobuf/encoding/protojson" "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/dbmanager" "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/migrations" "github.com/sqlc-dev/sqlc/internal/opts" "github.com/sqlc-dev/sqlc/internal/plugin" "github.com/sqlc-dev/sqlc/internal/quickdb" - pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" "github.com/sqlc-dev/sqlc/internal/shfmt" "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" "github.com/sqlc-dev/sqlc/internal/vet" ) +var ( + debugDumpExplain = sqlcdebug.New("dumpexplain") + debugDumpVetEnv = sqlcdebug.New("dumpvetenv") + debugDatabases = sqlcdebug.New("databases") +) + var ErrFailedChecks = errors.New("failed checks") var pjson = protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} -const RuleDbPrepare = "sqlc/db-prepare" -const QueryFlagSqlcVetDisable = "@sqlc-vet-disable" - func NewCmdVet() *cobra.Command { return &cobra.Command{ Use: "vet", @@ -109,7 +116,7 @@ func Vet(ctx context.Context, dir, filename string, opts *Options) error { } rules := map[string]rule{ - RuleDbPrepare: {NeedsPrepare: true}, + constants.QueryRuleDbPrepare: {NeedsPrepare: true}, } for _, c := range conf.Rules { @@ -133,7 +140,7 @@ func Vet(ctx context.Context, dir, filename string, opts *Options) error { rule := rule{Program: &prg, Message: c.Msg} // TODO There's probably a nicer way to do this from the ast - // https://pkg.go.dev/github.com/google/cel-go/common/ast#AllMatcher + // https://pkg.go.dev/cel.dev/cel-go/common/ast#AllMatcher if strings.Contains(c.Rule, "postgresql.explain") || strings.Contains(c.Rule, "mysql.explain") { rule.NeedsExplain = true @@ -143,13 +150,13 @@ func Vet(ctx context.Context, dir, filename string, opts *Options) error { } c := checker{ - Rules: rules, - Conf: conf, - Dir: dir, - Env: env, - Envmap: map[string]string{}, - Stderr: stderr, - NoDatabase: e.NoDatabase, + Rules: rules, + Conf: conf, + Dir: dir, + Env: env, + Stderr: stderr, + OnlyManagedDB: debugDatabases.Value() == "managed", + Replacer: shfmt.NewReplacer(nil), } errored := false for _, sql := range conf.SQL { @@ -316,7 +323,7 @@ func (p *pgxConn) Explain(ctx context.Context, query string, args ...*plugin.Par if err := row.Scan(&result); err != nil { return nil, err } - if debug.Debug.DumpExplain { + if debugDumpExplain.Value() == "1" { fmt.Println(eQuery, "with args", eArgs) fmt.Println(string(result[0])) } @@ -333,7 +340,9 @@ type dbPreparer struct { func (p *dbPreparer) Prepare(ctx context.Context, name, query string) error { s, err := p.db.PrepareContext(ctx, query) - s.Close() + if s != nil { + s.Close() + } return err } @@ -356,7 +365,7 @@ func (me *mysqlExplainer) Explain(ctx context.Context, query string, args ...*pl if err := row.Scan(&result); err != nil { return nil, err } - if debug.Debug.DumpExplain { + if debugDumpExplain.Value() == "1" { fmt.Println(eQuery, "with args", eArgs) fmt.Println(string(result)) } @@ -378,14 +387,28 @@ type rule struct { } type checker struct { - Rules map[string]rule - Conf *config.Config - Dir string - Env *cel.Env - Envmap map[string]string - Stderr io.Writer - NoDatabase bool - Client pb.QuickClient + Rules map[string]rule + Conf *config.Config + Dir string + Env *cel.Env + Stderr io.Writer + OnlyManagedDB bool + Client dbmanager.Client + clientOnce sync.Once + Replacer *shfmt.Replacer +} + +// isInMemorySQLite checks if a SQLite URI refers to an in-memory database +func isInMemorySQLite(uri string) bool { + if uri == ":memory:" || uri == "" { + return true + } + // Check for file URI with mode=memory parameter + // e.g., "file:test?mode=memory&cache=shared" + if strings.Contains(uri, "mode=memory") { + return true + } + return false } func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, func() error, error) { @@ -400,60 +423,50 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f uri, err := c.DSN(s.Database.URI) return uri, cleanup, err } - if s.Engine != config.EnginePostgreSQL { - return "", cleanup, fmt.Errorf("managed: only PostgreSQL currently") - } - if c.Client == nil { - // FIXME: Eventual race condition - client, err := quickdb.NewClientFromConfig(c.Conf.Cloud) - if err != nil { - return "", cleanup, fmt.Errorf("managed: client: %w", err) - } - c.Client = client - } + // Initialize the client exactly once, even if called concurrently + c.clientOnce.Do(func() { + c.Client = dbmanager.NewClient(c.Conf.Servers) + }) - var migrations []string + var ddl []string files, err := sqlpath.Glob(s.Schema) if err != nil { return "", cleanup, err } - for _, query := range files { - contents, err := os.ReadFile(query) + for _, schema := range files { + contents, err := os.ReadFile(schema) if err != nil { return "", cleanup, fmt.Errorf("read file: %w", err) } - migrations = append(migrations, string(contents)) + ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents))) } - resp, err := c.Client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{ - Engine: "postgresql", - Region: quickdb.GetClosestRegion(), - Migrations: migrations, + resp, err := c.Client.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ + Engine: string(s.Engine), + Migrations: ddl, }) if err != nil { return "", cleanup, fmt.Errorf("managed: create database: %w", err) } - cleanup = func() error { - _, err := c.Client.DropEphemeralDatabase(ctx, &pb.DropEphemeralDatabaseRequest{ - DatabaseId: resp.DatabaseId, - }) - return err + var uri string + switch s.Engine { + case config.EngineMySQL: + dburi, err := quickdb.MySQLReformatURI(resp.Uri) + if err != nil { + return "", cleanup, fmt.Errorf("reformat uri: %w", err) + } + uri = dburi + default: + uri = resp.Uri } - return resp.Uri, cleanup, nil + return uri, cleanup, nil } func (c *checker) DSN(dsn string) (string, error) { - // Populate the environment variable map if it is empty - if len(c.Envmap) == 0 { - for _, e := range os.Environ() { - k, v, _ := strings.Cut(e, "=") - c.Envmap[k] = v - } - } - return shfmt.Replace(dsn, c.Envmap), nil + return c.Replacer.Replace(dsn), nil } func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { @@ -474,9 +487,7 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { s.Queries = joined var name string - parseOpts := opts.Parser{ - Debug: debug.Debug, - } + parseOpts := opts.Parser{} result, failed := parse(ctx, name, c.Dir, s, combo, parseOpts, c.Stderr) if failed { @@ -486,8 +497,8 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { var prep preparer var expl explainer if s.Database != nil { // TODO only set up a database connection if a rule evaluation requires it - if c.NoDatabase { - return fmt.Errorf("database: connections disabled via command line flag") + if s.Database.URI != "" && c.OnlyManagedDB { + return fmt.Errorf("database: connections disabled via SQLCDEBUG=databases=managed") } dburl, cleanup, err := c.fetchDatabaseUri(ctx, s) if err != nil { @@ -532,6 +543,23 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { return fmt.Errorf("database: connection error: %s", err) } defer db.Close() + // For in-memory SQLite databases, apply migrations + if isInMemorySQLite(dburl) { + files, err := sqlpath.Glob(s.Schema) + if err != nil { + return fmt.Errorf("schema: %w", err) + } + for _, schema := range files { + contents, err := os.ReadFile(schema) + if err != nil { + return fmt.Errorf("read schema file: %w", err) + } + ddl := migrations.RemoveRollbackStatements(string(contents)) + if _, err := db.ExecContext(ctx, ddl); err != nil { + return fmt.Errorf("apply schema %s: %w", schema, err) + } + } + } prep = &dbPreparer{db} // SQLite really doesn't want us to depend on the output of EXPLAIN // QUERY PLAN: https://www.sqlite.org/eqp.html @@ -545,11 +573,23 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { req := codeGenRequest(result, combo) cfg := vetConfig(req) for i, query := range req.Queries { - if result.Queries[i].Flags[QueryFlagSqlcVetDisable] { - if debug.Active { - log.Printf("Skipping vet rules for query: %s\n", query.Name) + md := result.Queries[i].Metadata + if md.Flags[constants.QueryFlagSqlcVetDisable] { + // If the vet disable flag is specified without any rules listed, all rules are ignored. + if len(md.RuleSkiplist) == 0 { + if debug.Active { + log.Printf("Skipping all vet rules for query: %s\n", query.Name) + } + continue + } + + // Rules which are listed to be disabled but not declared in the config file are rejected. + for r := range md.RuleSkiplist { + if !slices.Contains(s.Rules, r) { + fmt.Fprintf(c.Stderr, "%s: %s: rule-check error: rule %q does not exist in the config file\n", query.Filename, query.Name, r) + errored = true + } } - continue } evalMap := map[string]any{ @@ -558,81 +598,88 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { } for _, name := range s.Rules { - rule, ok := c.Rules[name] - if !ok { - return fmt.Errorf("type-check error: a rule with the name '%s' does not exist", name) - } - - if rule.NeedsPrepare { - if prep == nil { - fmt.Fprintf(c.Stderr, "%s: %s: %s: error preparing query: database connection required\n", query.Filename, query.Name, name) - errored = true - continue + if _, skip := md.RuleSkiplist[name]; skip { + if debug.Active { + log.Printf("Skipping vet rule %q for query: %s\n", name, query.Name) } - prepName := fmt.Sprintf("sqlc_vet_%d_%d", time.Now().Unix(), i) - if err := prep.Prepare(ctx, prepName, query.Text); err != nil { - fmt.Fprintf(c.Stderr, "%s: %s: %s: error preparing query: %s\n", query.Filename, query.Name, name, err) - errored = true - continue + } else { + rule, ok := c.Rules[name] + if !ok { + return fmt.Errorf("type-check error: a rule with the name '%s' does not exist", name) } - } - - // short-circuit for "sqlc/db-prepare" rule which doesn't have a CEL program - if rule.Program == nil { - continue - } - // Get explain output for this query if we need it - _, pgsqlOK := evalMap["postgresql"] - _, mysqlOK := evalMap["mysql"] - if rule.NeedsExplain && !(pgsqlOK || mysqlOK) { - if expl == nil { - fmt.Fprintf(c.Stderr, "%s: %s: %s: error explaining query: database connection required\n", query.Filename, query.Name, name) - errored = true - continue + if rule.NeedsPrepare { + if prep == nil { + fmt.Fprintf(c.Stderr, "%s: %s: %s: error preparing query: database connection required\n", query.Filename, query.Name, name) + errored = true + continue + } + prepName := fmt.Sprintf("sqlc_vet_%d_%d", time.Now().Unix(), i) + if err := prep.Prepare(ctx, prepName, query.Text); err != nil { + fmt.Fprintf(c.Stderr, "%s: %s: %s: error preparing query: %s\n", query.Filename, query.Name, name, err) + errored = true + continue + } } - engineOutput, err := expl.Explain(ctx, query.Text, query.Params...) - if err != nil { - fmt.Fprintf(c.Stderr, "%s: %s: %s: error explaining query: %s\n", query.Filename, query.Name, name, err) - errored = true + + // short-circuit for "sqlc/db-prepare" rule which doesn't have a CEL program + if rule.Program == nil { continue } - evalMap["postgresql"] = engineOutput.PostgreSQL - evalMap["mysql"] = engineOutput.MySQL - } + // Get explain output for this query if we need it + _, pgsqlOK := evalMap["postgresql"] + _, mysqlOK := evalMap["mysql"] + if rule.NeedsExplain && !(pgsqlOK || mysqlOK) { + if expl == nil { + fmt.Fprintf(c.Stderr, "%s: %s: %s: error explaining query: database connection required\n", query.Filename, query.Name, name) + errored = true + continue + } + engineOutput, err := expl.Explain(ctx, query.Text, query.Params...) + if err != nil { + fmt.Fprintf(c.Stderr, "%s: %s: %s: error explaining query: %s\n", query.Filename, query.Name, name, err) + errored = true + continue + } + + evalMap["postgresql"] = engineOutput.PostgreSQL + evalMap["mysql"] = engineOutput.MySQL + } - if debug.Debug.DumpVetEnv { - fmt.Printf("vars for rule '%s' evaluating against query '%s':\n", name, query.Name) - debug.DumpAsJSON(evalMap) - } + if debugDumpVetEnv.Value() == "1" { + fmt.Printf("vars for rule '%s' evaluating against query '%s':\n", name, query.Name) + debug.DumpAsJSON(evalMap) + } - out, _, err := (*rule.Program).Eval(evalMap) - if err != nil { - return err - } - tripped, ok := out.Value().(bool) - if !ok { - return fmt.Errorf("expression returned non-bool value: %v", out.Value()) - } - if tripped { - // TODO: Get line numbers in the output - if rule.Message == "" { - fmt.Fprintf(c.Stderr, "%s: %s: %s\n", query.Filename, query.Name, name) - } else { - fmt.Fprintf(c.Stderr, "%s: %s: %s: %s\n", query.Filename, query.Name, name, rule.Message) + out, _, err := (*rule.Program).Eval(evalMap) + if err != nil { + return err + } + tripped, ok := out.Value().(bool) + if !ok { + return fmt.Errorf("expression returned non-bool value: %v", out.Value()) + } + if tripped { + // TODO: Get line numbers in the output + if rule.Message == "" { + fmt.Fprintf(c.Stderr, "%s: %s: %s\n", query.Filename, query.Name, name) + } else { + fmt.Fprintf(c.Stderr, "%s: %s: %s: %s\n", query.Filename, query.Name, name, rule.Message) + } + errored = true } - errored = true } } } + if errored { return ErrFailedChecks } return nil } -func vetConfig(req *plugin.CodeGenRequest) *vet.Config { +func vetConfig(req *plugin.GenerateRequest) *vet.Config { return &vet.Config{ Version: req.Settings.Version, Engine: req.Settings.Engine, diff --git a/internal/cmd/vet_sqlite.go b/internal/cmd/vet_sqlite.go new file mode 100644 index 0000000000..ed79fe78f4 --- /dev/null +++ b/internal/cmd/vet_sqlite.go @@ -0,0 +1,7 @@ +package cmd + +import ( + _ "github.com/ncruces/go-sqlite3/driver" + + _ "github.com/sqlc-dev/sqlc/internal/sqlite3ext" +) diff --git a/internal/codegen/golang/clickhouse_type.go b/internal/codegen/golang/clickhouse_type.go new file mode 100644 index 0000000000..5944113758 --- /dev/null +++ b/internal/codegen/golang/clickhouse_type.go @@ -0,0 +1,180 @@ +package golang + +import ( + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +// clickhouseType maps a ClickHouse type to the Go type +// github.com/ClickHouse/clickhouse-go/v2 hands database/sql for it. The +// driver scans a Nullable value into a pointer, and the types with a +// database/sql wrapper take that instead unless the options ask for +// pointers. Wide integers are big.Int, decimals are shopspring decimals, +// and geo types are orb geometries, as the driver returns them. The +// nesting the type carries is rendered: Map(String, Array(UInt8)) is a +// map[string][]uint8, LowCardinality and SimpleAggregateFunction wrap the +// type they carry. A Tuple is a slice of any, or a map by field name when +// its elements are named. +// +// A parameter is typed for what the driver can send rather than what it +// scans. The std driver passes arguments through without calling their +// Value method, and a {name:Type} placeholder is sent as text formatted +// from the value itself, so a sql.Null wrapper would go out as its struct +// fields and a decimal, UUID or address quoted, which the server rejects. +// A nullable parameter is therefore a pointer, which the driver sends as +// NULL when nil, and the types without a plain Go form are strings, which +// the server parses as the placeholder's type. +func clickhouseType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column, param bool) string { + t, nullable := columnType(col) + return clickhouseGoType(options, t, nullable, false, param) +} + +// clickhouseGoType renders t. Inside an array or a map, where nested is +// set, the driver returns a nullable value as a pointer whatever the +// column's own nullability is scanned into, so the wrappers are not used. +// A parameter, where param is set, takes the pointer form too, and is +// typed at its top level for the text the driver sends. +func clickhouseGoType(options *opts.Options, t *plugin.TypeExpr, nullable, nested, param bool) string { + param = param && !nested + null := func(typ, nullTyp string) string { + if nested || param { + nullTyp = "" + } + return nullableGoType(options, nullable, typ, nullTyp) + } + // text is the type of a value the driver would send quoted: a string + // for a parameter, typ otherwise. + text := func(typ, nullTyp string) string { + if param { + return null("string", "") + } + return null(typ, nullTyp) + } + + switch typeExprName(t) { + case "nullable": + if inner := typeExprArg(t, 0); inner != nil { + return clickhouseGoType(options, inner, true, nested, param) + } + return "any" + + // The driver hands database/sql a Nullable value as a pointer, and + // dereferences it only when Nullable is the column's outermost type. + // Wrapped in LowCardinality or SimpleAggregateFunction the pointer + // comes through as is, which a sql.Null wrapper cannot scan, so a + // nullable one takes the pointer form the nested types do. + case "lowcardinality": + if inner := typeExprArg(t, 0); inner != nil { + wrapped := nullable || t.Nullable || inner.Nullable + return clickhouseGoType(options, inner, wrapped, nested || wrapped, param) + } + return "any" + + case "simpleaggregatefunction": + if inner := typeExprLastArg(t); inner != nil { + wrapped := nullable || t.Nullable || inner.Nullable + return clickhouseGoType(options, inner, wrapped, nested || wrapped, param) + } + return "any" + + case "array": + elem := typeExprArg(t, 0) + if elem == nil { + return "[]any" + } + return "[]" + clickhouseGoType(options, elem, elem.Nullable, true, false) + + case "map": + key, value := typeExprArg(t, 0), typeExprArg(t, 1) + if key == nil || value == nil { + return "map[string]any" + } + return "map[" + clickhouseGoType(options, key, false, true, false) + "]" + clickhouseGoType(options, value, value.Nullable, true, false) + + case "tuple": + for _, arg := range t.GetArgs() { + if arg.GetLabel() != "" { + return "map[string]any" + } + } + return "[]any" + + case "bool": + return null("bool", "sql.NullBool") + + case "int8": + return null("int8", "sql.NullInt16") + + case "int16": + return null("int16", "sql.NullInt16") + + case "int32": + return null("int32", "sql.NullInt32") + + case "int64": + return null("int64", "sql.NullInt64") + + case "uint8": + return null("uint8", "sql.NullByte") + + case "uint16": + return null("uint16", "") + + case "uint32": + return null("uint32", "") + + case "uint64": + return null("uint64", "") + + case "int128", "int256", "uint128", "uint256": + if param { + return null("string", "") + } + return "*big.Int" + + case "float32", "bfloat16": + return null("float32", "sql.NullFloat64") + + case "float64": + return null("float64", "sql.NullFloat64") + + case "decimal", "decimal32", "decimal64", "decimal128", "decimal256": + return text("decimal.Decimal", "decimal.NullDecimal") + + case "string", "fixedstring", "enum", "enum8", "enum16": + return null("string", "sql.NullString") + + case "date", "date32", "datetime", "datetime32", "datetime64": + return null("time.Time", "sql.NullTime") + + case "time", "time64": + return text("time.Duration", "") + + case "uuid": + return text("uuid.UUID", "uuid.NullUUID") + + case "ipv4", "ipv6": + return text("net.IP", "") + + case "point": + return null("orb.Point", "") + + case "ring": + return null("orb.Ring", "") + + case "linestring": + return null("orb.LineString", "") + + case "multilinestring": + return null("orb.MultiLineString", "") + + case "polygon": + return null("orb.Polygon", "") + + case "multipolygon": + return null("orb.MultiPolygon", "") + + default: + return "any" + } +} diff --git a/internal/codegen/golang/driver.go b/internal/codegen/golang/driver.go index 7ef723b55e..28c0098bea 100644 --- a/internal/codegen/golang/driver.go +++ b/internal/codegen/golang/driver.go @@ -1,46 +1,66 @@ package golang -type SQLDriver string +import ( + "fmt" -const ( - SQLPackagePGXV4 string = "pgx/v4" - SQLPackagePGXV5 string = "pgx/v5" - SQLPackageStandard string = "database/sql" -) - -const ( - SQLDriverPGXV4 SQLDriver = "github.com/jackc/pgx/v4" - SQLDriverPGXV5 = "github.com/jackc/pgx/v5" - SQLDriverLibPQ = "github.com/lib/pq" - SQLDriverGoSQLDriverMySQL = "github.com/go-sql-driver/mysql" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" ) -func parseDriver(sqlPackage string) SQLDriver { +func parseDriver(sqlPackage string) opts.SQLDriver { switch sqlPackage { - case SQLPackagePGXV4: - return SQLDriverPGXV4 - case SQLPackagePGXV5: - return SQLDriverPGXV5 + case opts.SQLPackagePGXV4: + return opts.SQLDriverPGXV4 + case opts.SQLPackagePGXV5: + return opts.SQLDriverPGXV5 default: - return SQLDriverLibPQ + return opts.SQLDriverLibPQ } } -func (d SQLDriver) IsPGX() bool { - return d == SQLDriverPGXV4 || d == SQLDriverPGXV5 +// The engines, as the request names them. +const ( + engineClickHouse = "clickhouse" + engineDuckDB = "duckdb" + engineGoogleSQL = "googlesql" + engineMSSQL = "mssql" + engineMySQL = "mysql" + enginePostgreSQL = "postgresql" + engineSQLite = "sqlite" +) + +// usesPqArrays reports whether the queries pass array values through +// pq.Array. That is how lib/pq reads and writes PostgreSQL arrays, so it +// holds for PostgreSQL under database/sql; pgx and the other engines' +// drivers scan a slice directly. +func usesPqArrays(engine string, driver opts.SQLDriver) bool { + if usesDriverTypes(engine) { + return false + } + return !driver.IsPGX() } -func (d SQLDriver) IsGoSQLDriverMySQL() bool { - return d == SQLDriverGoSQLDriverMySQL +// usesDriverTypes reports whether the engine is one whose mapper reads the +// type expression and draws types from its driver's packages, the ones in +// driverTypes. These engines generate code for database/sql only. +func usesDriverTypes(engine string) bool { + switch engine { + case engineClickHouse, engineDuckDB, engineGoogleSQL, engineMSSQL: + return true + } + return false } -func (d SQLDriver) Package() string { - switch d { - case SQLDriverPGXV4: - return SQLPackagePGXV4 - case SQLDriverPGXV5: - return SQLPackagePGXV5 - default: - return SQLPackageStandard +// validateSQLPackage rejects a sql_package the engine's generated code does +// not support. The engines whose mappers read the type expression target +// database/sql alone: their types are what those drivers scan into, and +// their named placeholders bind through sql.Named. +func validateSQLPackage(engine string, options *opts.Options) error { + if !usesDriverTypes(engine) { + return nil + } + switch options.SqlPackage { + case "", opts.SQLPackageStandard: + return nil } + return fmt.Errorf("invalid options: engine %q supports sql_package %q only, not %q", engine, opts.SQLPackageStandard, options.SqlPackage) } diff --git a/internal/codegen/golang/duckdb_type.go b/internal/codegen/golang/duckdb_type.go new file mode 100644 index 0000000000..5af6df6f4d --- /dev/null +++ b/internal/codegen/golang/duckdb_type.go @@ -0,0 +1,157 @@ +package golang + +import ( + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +// duckdbType maps a DuckDB type to the Go type github.com/duckdb/duckdb-go +// hands database/sql for it. The driver returns a LIST or ARRAY as a slice +// of any, a STRUCT as a map by field name and a MAP as its own ordered +// map, and offers duckdb.Composite to decode a list into a typed slice, so +// a list column is a Composite of the slice its elements make. A Composite +// is not accepted as a query argument, while the driver binds a slice as a +// list and its own types as themselves, so a list parameter is the slice +// itself. DECIMAL, INTERVAL and BIT come back as the driver's structs and +// map to those; a UUID comes back as its bytes, which uuid.UUID scans. The +// driver binds neither a Decimal nor a pointer to a map, so a DECIMAL +// parameter is passed as its text, which DuckDB casts, and a STRUCT +// parameter as a map. An ENUM is reported by the name it was created with, +// which the catalog does not yet carry, so it maps to any until it does. +// JSON comes back decoded, as whatever value the document holds, which +// only any holds, and is bound from its text, so a JSON parameter is a +// string. +func duckdbType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column, param bool) string { + t, nullable := columnType(col) + if param { + return duckdbGoType(options, t, nullable, duckdbParam) + } + return duckdbGoType(options, t, nullable, duckdbScan) +} + +// duckdbPlace is where a value of the type goes: scanned from a row, +// passed as a query argument, or decoded inside a Composite, where the +// driver's own types are not decoded and a nullable value is a pointer. +type duckdbPlace int + +const ( + duckdbScan duckdbPlace = iota + duckdbParam + duckdbNested +) + +func duckdbGoType(options *opts.Options, t *plugin.TypeExpr, nullable bool, place duckdbPlace) string { + null := func(typ, nullTyp string) string { + if place == duckdbNested { + nullTyp = "" + } + return nullableGoType(options, nullable, typ, nullTyp) + } + driver := func(typ, nullTyp string) string { + if place == duckdbNested { + return "any" + } + return nullableGoType(options, nullable, typ, nullTyp) + } + + switch typeExprName(t) { + case "array", "list": + elem := typeExprArg(t, 0) + var typ string + if elem == nil { + typ = "[]any" + } else { + typ = "[]" + duckdbGoType(options, elem, elem.Nullable, duckdbNested) + } + if place == duckdbScan { + return "duckdb.Composite[" + typ + "]" + } + return typ + + case "struct": + // The driver binds a nil map as a struct of nulls rather than as + // NULL, so a nullable STRUCT parameter takes a map or a bare nil. + if place == duckdbParam { + if nullable { + return "any" + } + return "map[string]any" + } + return null("map[string]any", "") + + case "map": + return driver("duckdb.Map", "") + + case "boolean", "bool", "logical": + return null("bool", "sql.NullBool") + + case "tinyint", "int1": + return null("int8", "sql.NullInt16") + + case "smallint", "int2", "short": + return null("int16", "sql.NullInt16") + + case "integer", "int", "int4", "signed": + return null("int32", "sql.NullInt32") + + case "bigint", "int8", "long": + return null("int64", "sql.NullInt64") + + case "utinyint": + return null("uint8", "sql.NullByte") + + case "usmallint": + return null("uint16", "") + + case "uinteger": + return null("uint32", "") + + case "ubigint": + return null("uint64", "") + + case "hugeint", "uhugeint", "bignum": + return "*big.Int" + + case "float", "float4", "real": + return null("float32", "sql.NullFloat64") + + case "double", "float8": + return null("float64", "sql.NullFloat64") + + case "decimal", "numeric": + if place == duckdbParam { + return null("string", "sql.NullString") + } + return driver("duckdb.Decimal", "") + + case "varchar", "char", "bpchar", "text", "string": + return null("string", "sql.NullString") + + case "json": + if place == duckdbParam { + return null("string", "sql.NullString") + } + return "any" + + case "bit", "bitstring": + return driver("duckdb.Bit", "") + + case "blob", "bytea", "binary", "varbinary": + return "[]byte" + + case "date", + "timestamp", "datetime", "timestamp_s", "timestamp_ms", "timestamp_ns", + "timestamp with time zone", "timestamptz", "timestamptz_ns", + "time", "time with time zone", "timetz", "time_ns": + return null("time.Time", "sql.NullTime") + + case "interval": + return driver("duckdb.Interval", "") + + case "uuid": + return driver("uuid.UUID", "uuid.NullUUID") + + default: + return "any" + } +} diff --git a/internal/codegen/golang/enum.go b/internal/codegen/golang/enum.go index 75291d3ace..f429551f4b 100644 --- a/internal/codegen/golang/enum.go +++ b/internal/codegen/golang/enum.go @@ -1,12 +1,10 @@ package golang import ( - "regexp" "strings" + "unicode" ) -var IdentPattern = regexp.MustCompile("[^a-zA-Z0-9_]+") - type Constant struct { Name string Type string @@ -29,21 +27,38 @@ func (e Enum) ValidTag() string { return TagsToString(e.ValidTags) } +func enumReplacer(r rune) rune { + if strings.ContainsRune("-/:_", r) { + return '_' + } else if (r >= 'a' && r <= 'z') || + (r >= 'A' && r <= 'Z') || + (r >= '0' && r <= '9') { + return r + } else { + return -1 + } +} + +// EnumReplace removes all non ident symbols (all but letters, numbers and +// underscore) and returns valid ident name for provided name. func EnumReplace(value string) string { - id := strings.Replace(value, "-", "_", -1) - id = strings.Replace(id, ":", "_", -1) - id = strings.Replace(id, "/", "_", -1) - return IdentPattern.ReplaceAllString(id, "") + return strings.Map(enumReplacer, value) } +// EnumValueName removes all non ident symbols (all but letters, numbers and +// underscore) and converts snake case ident to camel case. func EnumValueName(value string) string { - name := "" - id := strings.Replace(value, "-", "_", -1) - id = strings.Replace(id, ":", "_", -1) - id = strings.Replace(id, "/", "_", -1) - id = IdentPattern.ReplaceAllString(id, "") - for _, part := range strings.Split(id, "_") { - name += strings.Title(part) + parts := strings.Split(EnumReplace(value), "_") + for i, part := range parts { + parts[i] = titleFirst(part) } - return name + + return strings.Join(parts, "") +} + +func titleFirst(s string) string { + r := []rune(s) + r[0] = unicode.ToUpper(r[0]) + + return string(r) } diff --git a/internal/codegen/golang/field.go b/internal/codegen/golang/field.go index 2a8d9ccdfc..b21710ef75 100644 --- a/internal/codegen/golang/field.go +++ b/internal/codegen/golang/field.go @@ -6,16 +6,20 @@ import ( "sort" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/plugin" ) type Field struct { - Name string // CamelCased name for Go - DBName string // Name as used in the DB - Type string - Tags map[string]string - Comment string - Column *plugin.Column + Name string // CamelCased name for Go + DBName string // Name as used in the DB + // ParamName is the name of the placeholder a parameter is bound by, + // when the query names it; empty otherwise and for row fields. + ParamName string + Type string + Tags map[string]string + Comment string + Column *plugin.Column // EmbedFields contains the embedded fields that require scanning. EmbedFields []Field } @@ -40,7 +44,7 @@ func TagsToString(tags map[string]string) string { return strings.Join(tagParts, " ") } -func JSONTagName(name string, options *opts) string { +func JSONTagName(name string, options *opts.Options) string { style := options.JsonTagsCaseStyle idUppercase := options.JsonTagsIdUppercase if style == "" || style == "none" { @@ -96,23 +100,23 @@ func toPascalCase(s string) string { } func toCamelInitCase(name string, initUpper bool) string { - out := "" + var out strings.Builder for i, p := range strings.Split(name, "_") { if !initUpper && i == 0 { - out += p + out.WriteString(p) continue } if p == "id" { - out += "ID" + out.WriteString("ID") } else { - out += strings.Title(p) + out.WriteString(strings.Title(p)) } } - return out + return out.String() } func toJsonCamelCase(name string, idUppercase bool) string { - out := "" + var out strings.Builder idStr := "Id" if idUppercase { @@ -121,16 +125,16 @@ func toJsonCamelCase(name string, idUppercase bool) string { for i, p := range strings.Split(name, "_") { if i == 0 { - out += p + out.WriteString(p) continue } if p == "id" { - out += idStr + out.WriteString(idStr) } else { - out += strings.Title(p) + out.WriteString(strings.Title(p)) } } - return out + return out.String() } func toLowerCase(str string) string { diff --git a/internal/codegen/golang/gen.go b/internal/codegen/golang/gen.go index e5762374ba..725f5970cf 100644 --- a/internal/codegen/golang/gen.go +++ b/internal/codegen/golang/gen.go @@ -7,22 +7,25 @@ import ( "errors" "fmt" "go/format" + "slices" "strings" "text/template" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/plugin" ) type tmplCtx struct { - Q string - Package string - SQLDriver SQLDriver - Enums []Enum - Structs []Struct - GoQueries []Query - SqlcVersion string + Q string + Package string + ModelsPackage string + SQLDriver opts.SQLDriver + Enums []Enum + Structs []Struct + GoQueries []Query + SqlcVersion string // TODO: Race conditions SourceName string @@ -38,7 +41,9 @@ type tmplCtx struct { EmitAllEnumValues bool UsesCopyFrom bool UsesBatch bool + OmitSqlcVersion bool BuildTags string + WrapErrors bool } func (t *tmplCtx) OutputQuery(sourceName string) bool { @@ -96,39 +101,80 @@ func (t *tmplCtx) codegenQueryRetval(q Query) (string, error) { case ":execrows", ":execlastid": return "result, err :=", nil case ":execresult": + if t.WrapErrors { + return "result, err :=", nil + } return "return", nil default: return "", fmt.Errorf("unhandled q.Cmd case %q", q.Cmd) } } -func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - options, err := parseOpts(req) +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { + options, err := opts.Parse(req) if err != nil { return nil, err } + if err := opts.ValidateOpts(options); err != nil { + return nil, err + } + if err := validateSQLPackage(req.Settings.Engine, options); err != nil { + return nil, err + } + enums := buildEnums(req, options) structs := buildStructs(req, options) - queries, err := buildQueries(req, options, structs) + queries, err := buildQueries(req, options, enums, structs) if err != nil { return nil, err } if options.OmitUnusedStructs { - enums, structs = filterUnusedStructs(enums, structs, queries) + enums, structs = filterUnusedStructs(enums, structs, queries, options.ModelsTypeQualifier()) + } + + if err := validate(options, enums, structs, queries); err != nil { + return nil, err } return generate(req, options, enums, structs, queries) } -func generate(req *plugin.CodeGenRequest, options *opts, enums []Enum, structs []Struct, queries []Query) (*plugin.CodeGenResponse, error) { +func validate(options *opts.Options, enums []Enum, structs []Struct, queries []Query) error { + enumNames := make(map[string]struct{}) + for _, enum := range enums { + enumNames[enum.Name] = struct{}{} + enumNames["Null"+enum.Name] = struct{}{} + } + structNames := make(map[string]struct{}) + for _, struckt := range structs { + if _, ok := enumNames[struckt.Name]; ok { + return fmt.Errorf("struct name conflicts with enum name: %s", struckt.Name) + } + structNames[struckt.Name] = struct{}{} + } + if !options.EmitExportedQueries { + return nil + } + for _, query := range queries { + if _, ok := enumNames[query.ConstantName]; ok { + return fmt.Errorf("query constant name conflicts with enum name: %s", query.ConstantName) + } + if _, ok := structNames[query.ConstantName]; ok { + return fmt.Errorf("query constant name conflicts with struct name: %s", query.ConstantName) + } + } + return nil +} + +func generate(req *plugin.GenerateRequest, options *opts.Options, enums []Enum, structs []Struct, queries []Query) (*plugin.GenerateResponse, error) { i := &importer{ - Settings: req.Settings, - Options: options, - Queries: queries, - Enums: enums, - Structs: structs, + Options: options, + Engine: req.Settings.Engine, + Queries: queries, + Enums: enums, + Structs: structs, } tctx := tmplCtx{ @@ -146,21 +192,24 @@ func generate(req *plugin.CodeGenRequest, options *opts, enums []Enum, structs [ SQLDriver: parseDriver(options.SqlPackage), Q: "`", Package: options.Package, + ModelsPackage: options.ModelsPackage(), Enums: enums, Structs: structs, SqlcVersion: req.SqlcVersion, BuildTags: options.BuildTags, + OmitSqlcVersion: options.OmitSqlcVersion, + WrapErrors: options.WrapErrors, } - if tctx.UsesCopyFrom && !tctx.SQLDriver.IsPGX() && options.SqlDriver != SQLDriverGoSQLDriverMySQL { + if tctx.UsesCopyFrom && !tctx.SQLDriver.IsPGX() && options.SqlDriver != opts.SQLDriverGoSQLDriverMySQL { return nil, errors.New(":copyfrom is only supported by pgx and github.com/go-sql-driver/mysql") } - if tctx.UsesCopyFrom && options.SqlDriver == SQLDriverGoSQLDriverMySQL { + if tctx.UsesCopyFrom && options.SqlDriver == opts.SQLDriverGoSQLDriverMySQL { if err := checkNoTimesForMySQLCopyFrom(queries); err != nil { return nil, err } - tctx.SQLDriver = SQLDriverGoSQLDriverMySQL + tctx.SQLDriver = opts.SQLDriverGoSQLDriverMySQL } if tctx.UsesBatch && !tctx.SQLDriver.IsPGX() { @@ -172,6 +221,7 @@ func generate(req *plugin.CodeGenRequest, options *opts, enums []Enum, structs [ "comment": sdk.DoubleSlashComment, "escape": sdk.EscapeBacktick, "imports": i.Imports, + "hasImports": i.HasImports, "hasPrefix": strings.HasPrefix, // These methods are Go specific, they do not belong in the codegen package @@ -249,8 +299,10 @@ func generate(req *plugin.CodeGenRequest, options *opts, enums []Enum, structs [ if err := execute(dbFileName, "dbFile"); err != nil { return nil, err } - if err := execute(modelsFileName, "modelsFile"); err != nil { - return nil, err + if options.ModelsEmitEnabled() { + if err := execute(modelsFileName, "modelsFile"); err != nil { + return nil, err + } } if options.EmitInterface { if err := execute(querierFileName, "interfaceFile"); err != nil { @@ -278,7 +330,7 @@ func generate(req *plugin.CodeGenRequest, options *opts, enums []Enum, structs [ return nil, err } } - resp := plugin.CodeGenResponse{} + resp := plugin.GenerateResponse{} for filename, code := range output { resp.Files = append(resp.Files, &plugin.File{ @@ -301,10 +353,8 @@ func usesCopyFrom(queries []Query) bool { func usesBatch(queries []Query) bool { for _, q := range queries { - for _, cmd := range []string{metadata.CmdBatchExec, metadata.CmdBatchMany, metadata.CmdBatchOne} { - if q.Cmd == cmd { - return true - } + if slices.Contains([]string{metadata.CmdBatchExec, metadata.CmdBatchMany, metadata.CmdBatchOne}, q.Cmd) { + return true } } return false @@ -324,23 +374,36 @@ func checkNoTimesForMySQLCopyFrom(queries []Query) error { return nil } -func filterUnusedStructs(enums []Enum, structs []Struct, queries []Query) ([]Enum, []Struct) { +func filterUnusedStructs(enums []Enum, structs []Struct, queries []Query, qualifier string) ([]Enum, []Struct) { keepTypes := make(map[string]struct{}) + keep := func(t string) { + keepTypes[t] = struct{}{} + // Also store the bare type name so that lookups against + // bare struct/enum names match even when types have been + // qualified with the models package prefix (e.g. "model.User"). + if bare := stripQualifier(t, qualifier); bare != t { + keepTypes[bare] = struct{}{} + } + } + for _, query := range queries { if !query.Arg.isEmpty() { - keepTypes[query.Arg.Type()] = struct{}{} + keep(query.Arg.Type()) if query.Arg.IsStruct() { for _, field := range query.Arg.Struct.Fields { - keepTypes[field.Type] = struct{}{} + keep(field.Type) } } } if query.hasRetType() { - keepTypes[query.Ret.Type()] = struct{}{} + keep(query.Ret.Type()) if query.Ret.IsStruct() { for _, field := range query.Ret.Struct.Fields { - keepTypes[field.Type] = struct{}{} + keep(strings.TrimPrefix(field.Type, "[]")) + for _, embedField := range field.EmbedFields { + keep(embedField.Type) + } } } } @@ -350,7 +413,8 @@ func filterUnusedStructs(enums []Enum, structs []Struct, queries []Query) ([]Enu for _, enum := range enums { _, keep := keepTypes[enum.Name] _, keepNull := keepTypes["Null"+enum.Name] - if keep || keepNull { + _, keepPointer := keepTypes["*"+enum.Name] + if keep || keepNull || keepPointer { keepEnums = append(keepEnums, enum) } } diff --git a/internal/codegen/golang/go_type.go b/internal/codegen/golang/go_type.go index 2b5f75bcd4..257ed99869 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -1,18 +1,25 @@ package golang import ( + "maps" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, col *plugin.Column) { - for _, oride := range req.Settings.Overrides { +func addExtraGoStructTags(tags map[string]string, req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) { + for _, override := range options.Overrides { + oride := override.ShimOverride if oride.GoType.StructTags == nil { continue } - if !sdk.Matches(oride, col.Table, req.Catalog.DefaultSchema) { + if override.MatchesColumn(col) { + maps.Copy(tags, oride.GoType.StructTags) + continue + } + if !override.Matches(col.Table, req.Catalog.DefaultSchema) { // Different table. continue } @@ -25,15 +32,28 @@ func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, co continue } // Add the extra tags. - for k, v := range oride.GoType.StructTags { - tags[k] = v - } + maps.Copy(tags, oride.GoType.StructTags) } } -func goType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) string { +// goType is the Go type of a column's value: what a query's row scans +// into, or what a table's model holds. +func goType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { + return goValueType(req, options, col, false) +} + +// goParamType is the Go type of a parameter's value: what is passed to the +// driver for it. It differs from goType only where a driver reads a value +// through a type it will not accept as an argument. +func goParamType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { + return goValueType(req, options, col, true) +} + +func goValueType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column, param bool) string { // Check if the column's type has been overridden - for _, oride := range req.Settings.Overrides { + for _, override := range options.Overrides { + oride := override.ShimOverride + if oride.GoType.TypeName == "" { continue } @@ -41,7 +61,7 @@ func goType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) strin if col.OriginalName != "" { cname = col.OriginalName } - sameTable := sdk.Matches(oride, col.Table, req.Catalog.DefaultSchema) + sameTable := override.Matches(col.Table, req.Catalog.DefaultSchema) if oride.Column != "" && sdk.MatchString(oride.ColumnName, cname) && sameTable { if col.IsSqlcSlice { return "[]" + oride.GoType.TypeName @@ -49,39 +69,49 @@ func goType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) strin return oride.GoType.TypeName } } - typ := goInnerType(req, options, col) + typ, complete := goInnerType(req, options, col, param) if col.IsSqlcSlice { return "[]" + typ } - if col.IsArray { + if col.IsArray && !complete { return strings.Repeat("[]", int(col.ArrayDims)) + typ } return typ } -func goInnerType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) string { - columnType := sdk.DataType(col.Type) - notNull := col.NotNull || col.IsArray - +// goInnerType is the Go type of the column's value. The legacy mappers +// return the element type of an array column and leave the dimensions to +// goType; the mappers that read the type expression render the whole type, +// arrays included, and say so with complete. +func goInnerType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column, param bool) (typ string, complete bool) { // package overrides have a higher precedence - for _, oride := range req.Settings.Overrides { + for _, override := range options.Overrides { + oride := override.ShimOverride if oride.GoType.TypeName == "" { continue } - if oride.DbType != "" && oride.DbType == columnType && oride.Nullable != notNull && oride.Unsigned == col.Unsigned { - return oride.GoType.TypeName + if override.MatchesColumn(col) { + return oride.GoType.TypeName, false } } // TODO: Extend the engine interface to handle types switch req.Settings.Engine { - case "mysql": - return mysqlType(req, col) - case "postgresql": - return postgresType(req, options, col) - case "sqlite": - return sqliteType(req, col) + case engineMySQL: + return mysqlType(req, options, col), false + case enginePostgreSQL: + return postgresType(req, options, col), false + case engineSQLite: + return sqliteType(req, options, col), false + case engineClickHouse: + return clickhouseType(req, options, col, param), true + case engineDuckDB: + return duckdbType(req, options, col, param), true + case engineGoogleSQL: + return googlesqlType(req, options, col), true + case engineMSSQL: + return mssqlType(req, options, col), true default: - return "interface{}" + return "any", false } } diff --git a/internal/codegen/golang/googlesql_type.go b/internal/codegen/golang/googlesql_type.go new file mode 100644 index 0000000000..cf3be62ba9 --- /dev/null +++ b/internal/codegen/golang/googlesql_type.go @@ -0,0 +1,102 @@ +package golang + +import ( + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +// googlesqlType maps a Spanner GoogleSQL type to the Go type +// github.com/googleapis/go-sql-spanner hands database/sql for it. The +// driver decodes the elements of an ARRAY into the Null-prefixed types of +// cloud.google.com/go/spanner unless it is told to decode them natively, +// so an array column is a slice of those. NUMERIC and JSON have no +// database/sql wrapper and take the spanner package's; a DATE is a civil +// date. +func googlesqlType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { + t, nullable := columnType(col) + if typeExprName(t) == "array" { + elem := typeExprArg(t, 0) + if elem == nil { + return "[]any" + } + return "[]" + googlesqlElementType(elem) + } + null := func(typ, nullTyp string) string { + return nullableGoType(options, nullable, typ, nullTyp) + } + + switch typeExprName(t) { + case "int64": + return null("int64", "sql.NullInt64") + + case "float64": + return null("float64", "sql.NullFloat64") + + case "float32": + return null("float32", "spanner.NullFloat32") + + case "bool": + return null("bool", "sql.NullBool") + + case "string": + return null("string", "sql.NullString") + + case "bytes": + return "[]byte" + + case "date": + return null("civil.Date", "spanner.NullDate") + + case "timestamp": + return null("time.Time", "sql.NullTime") + + case "numeric", "bignumeric": + return null("big.Rat", "spanner.NullNumeric") + + case "json": + return "spanner.NullJSON" + + case "uuid": + return null("uuid.UUID", "spanner.NullUUID") + + case "interval": + return null("spanner.Interval", "spanner.NullInterval") + + default: + return "any" + } +} + +// googlesqlElementType is the type of an array's elements, as the driver +// decodes them: nullable whatever the schema says, in the spanner package's +// wrappers. +func googlesqlElementType(t *plugin.TypeExpr) string { + switch typeExprName(t) { + case "int64": + return "spanner.NullInt64" + case "float64": + return "spanner.NullFloat64" + case "float32": + return "spanner.NullFloat32" + case "bool": + return "spanner.NullBool" + case "string": + return "spanner.NullString" + case "bytes": + return "[]byte" + case "date": + return "spanner.NullDate" + case "timestamp": + return "spanner.NullTime" + case "numeric", "bignumeric": + return "spanner.NullNumeric" + case "json": + return "spanner.NullJSON" + case "uuid": + return "spanner.NullUUID" + case "interval": + return "spanner.NullInterval" + default: + return "any" + } +} diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index 381ec0ffe9..e1370e48eb 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -5,8 +5,8 @@ import ( "sort" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/metadata" - "github.com/sqlc-dev/sqlc/internal/plugin" ) type fileImports struct { @@ -58,11 +58,11 @@ func mergeImports(imps ...fileImports) [][]ImportSpec { } type importer struct { - Settings *plugin.Settings - Options *opts - Queries []Query - Enums []Enum - Structs []Struct + Options *opts.Options + Engine string + Queries []Query + Enums []Enum + Structs []Struct } func (i *importer) usesType(typ string) bool { @@ -76,6 +76,11 @@ func (i *importer) usesType(typ string) bool { return false } +func (i *importer) HasImports(filename string) bool { + imports := i.Imports(filename) + return len(imports[0]) != 0 || len(imports[1]) != 0 +} + func (i *importer) Imports(filename string) [][]ImportSpec { dbFileName := "db.go" if i.Options.OutputDbFileName != "" { @@ -122,10 +127,10 @@ func (i *importer) dbImports() fileImports { sqlpkg := parseDriver(i.Options.SqlPackage) switch sqlpkg { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgconn"}) pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgx/v4"}) - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgx/v5/pgconn"}) pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgx/v5"}) default: @@ -143,10 +148,35 @@ func (i *importer) dbImports() fileImports { var stdlibTypes = map[string]string{ "json.RawMessage": "encoding/json", "time.Time": "time", + "time.Duration": "time", "net.IP": "net", "net.HardwareAddr": "net", "netip.Addr": "net/netip", "netip.Prefix": "net/netip", + "big.Int": "math/big", + "big.Rat": "math/big", +} + +// driverTypes are the packages the ClickHouse, DuckDB, Spanner and SQL +// Server mappers draw types from, by the qualifier those types carry. +var driverTypes = map[string]string{ + "civil.": "cloud.google.com/go/civil", + "decimal.": "github.com/shopspring/decimal", + "duckdb.": "github.com/duckdb/duckdb-go/v2", + "mssql.": "github.com/microsoft/go-mssqldb", + "orb.": "github.com/paulmach/orb", + "spanner.": "cloud.google.com/go/spanner", +} + +// overrideHasQualifier reports whether an override's type is qualified +// by qualifier, so its import already names that package. +func overrideHasQualifier(overrideTypes map[string]string, qualifier string) bool { + for typeName := range overrideTypes { + if strings.HasPrefix(typeName, qualifier) { + return true + } + } + return false } var pqtypeTypes = map[string]struct{}{ @@ -156,7 +186,7 @@ var pqtypeTypes = map[string]struct{}{ "pqtype.NullRawMessage": {}, } -func buildImports(settings *plugin.Settings, options *opts, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { +func buildImports(options *opts.Options, engine string, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { pkg := make(map[ImportSpec]struct{}) std := make(map[string]struct{}) @@ -168,9 +198,9 @@ func buildImports(settings *plugin.Settings, options *opts, queries []Query, use for _, q := range queries { if q.Cmd == metadata.CmdExecResult { switch sqlpkg { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: pkg[ImportSpec{Path: "github.com/jackc/pgconn"}] = struct{}{} - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: pkg[ImportSpec{Path: "github.com/jackc/pgx/v5/pgconn"}] = struct{}{} default: std["database/sql"] = struct{}{} @@ -185,7 +215,7 @@ func buildImports(settings *plugin.Settings, options *opts, queries []Query, use } if uses("pgtype.") { - if sqlpkg == SQLDriverPGXV5 { + if sqlpkg == opts.SQLDriverPGXV5 { pkg[ImportSpec{Path: "github.com/jackc/pgx/v5/pgtype"}] = struct{}{} } else { pkg[ImportSpec{Path: "github.com/jackc/pgtype"}] = struct{}{} @@ -200,13 +230,26 @@ func buildImports(settings *plugin.Settings, options *opts, queries []Query, use } overrideTypes := map[string]string{} - for _, o := range settings.Overrides { + for _, override := range options.Overrides { + o := override.ShimOverride if o.GoType.BasicType || o.GoType.TypeName == "" { continue } overrideTypes[o.GoType.TypeName] = o.GoType.ImportPath } + // Only the engines whose mappers draw on the driver packages import + // them, and an override whose type carries the same qualifier brings + // its own import: a PostgreSQL numeric overridden to another package's + // decimal.Decimal must not pull in shopspring's as well. + if usesDriverTypes(engine) { + for qualifier, path := range driverTypes { + if uses(qualifier) && !overrideHasQualifier(overrideTypes, qualifier) { + pkg[ImportSpec{Path: path}] = struct{}{} + } + } + } + _, overrideNullTime := overrideTypes["pq.NullTime"] if uses("pq.NullTime") && !overrideNullTime { pkg[ImportSpec{Path: "github.com/lib/pq"}] = struct{}{} @@ -219,9 +262,15 @@ func buildImports(settings *plugin.Settings, options *opts, queries []Query, use if uses("uuid.NullUUID") && !overrideNullUUID { pkg[ImportSpec{Path: "github.com/google/uuid"}] = struct{}{} } + _, overrideVector := overrideTypes["pgvector.Vector"] + if uses("pgvector.Vector") && !overrideVector { + pkg[ImportSpec{Path: "github.com/pgvector/pgvector-go"}] = struct{}{} + } // Custom imports - for _, o := range settings.Overrides { + for _, override := range options.Overrides { + o := override.ShimOverride + if o.GoType.BasicType || o.GoType.TypeName == "" { continue } @@ -232,11 +281,22 @@ func buildImports(settings *plugin.Settings, options *opts, queries []Query, use } } + // Models package import. When models live in a separate Go package and + // any type in this file references a qualified model type, import the + // models package under a fixed `models` alias so query files always + // reference types as `models.User` regardless of how the actual + // package is named. + if options.ModelsAreExternal() { + if uses(options.ModelsTypeQualifier()) { + pkg[ImportSpec{Path: options.OutputModelsImport, ID: opts.ModelsImportAlias}] = struct{}{} + } + } + return std, pkg } func (i *importer) interfaceImports() fileImports { - std, pkg := buildImports(i.Settings, i.Options, i.Queries, func(name string) bool { + std, pkg := buildImports(i.Options, i.Engine, i.Queries, func(name string) bool { for _, q := range i.Queries { if q.hasRetType() { if usesBatch([]Query{q}) { @@ -261,7 +321,7 @@ func (i *importer) interfaceImports() fileImports { } func (i *importer) modelImports() fileImports { - std, pkg := buildImports(i.Settings, i.Options, nil, i.usesType) + std, pkg := buildImports(i.Options, i.Engine, nil, i.usesType) if len(i.Enums) > 0 { std["fmt"] = struct{}{} @@ -300,7 +360,7 @@ func (i *importer) queryImports(filename string) fileImports { } } - std, pkg := buildImports(i.Settings, i.Options, gq, func(name string) bool { + std, pkg := buildImports(i.Options, i.Engine, gq, func(name string) bool { for _, q := range gq { if q.hasRetType() { if q.Ret.EmitStruct() { @@ -379,18 +439,29 @@ func (i *importer) queryImports(filename string) fileImports { return false } + // A query bound by name passes sql.Named arguments. + for _, q := range gq { + if q.Arg.NamedArgs && !q.Arg.isEmpty() { + std["database/sql"] = struct{}{} + } + } + if anyNonCopyFrom { std["context"] = struct{}{} } sqlpkg := parseDriver(i.Options.SqlPackage) - if sqlcSliceScan() { + if sqlcSliceScan() && !sqlpkg.IsPGX() { std["strings"] = struct{}{} } - if sliceScan() && !sqlpkg.IsPGX() { + if sliceScan() && usesPqArrays(i.Engine, sqlpkg) { pkg[ImportSpec{Path: "github.com/lib/pq"}] = struct{}{} } + if i.Options.WrapErrors { + std["fmt"] = struct{}{} + } + return sortedImports(std, pkg) } @@ -401,7 +472,7 @@ func (i *importer) copyfromImports() fileImports { copyFromQueries = append(copyFromQueries, q) } } - std, pkg := buildImports(i.Settings, i.Options, copyFromQueries, func(name string) bool { + std, pkg := buildImports(i.Options, i.Engine, copyFromQueries, func(name string) bool { for _, q := range copyFromQueries { if q.hasRetType() { if strings.HasPrefix(q.Ret.Type(), name) { @@ -418,7 +489,7 @@ func (i *importer) copyfromImports() fileImports { }) std["context"] = struct{}{} - if i.Options.SqlDriver == SQLDriverGoSQLDriverMySQL { + if i.Options.SqlDriver == opts.SQLDriverGoSQLDriverMySQL { std["io"] = struct{}{} std["fmt"] = struct{}{} std["sync/atomic"] = struct{}{} @@ -436,7 +507,7 @@ func (i *importer) batchImports() fileImports { batchQueries = append(batchQueries, q) } } - std, pkg := buildImports(i.Settings, i.Options, batchQueries, func(name string) bool { + std, pkg := buildImports(i.Options, i.Engine, batchQueries, func(name string) bool { for _, q := range batchQueries { if q.hasRetType() { if q.Ret.EmitStruct() { @@ -470,9 +541,9 @@ func (i *importer) batchImports() fileImports { std["errors"] = struct{}{} sqlpkg := parseDriver(i.Options.SqlPackage) switch sqlpkg { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: pkg[ImportSpec{Path: "github.com/jackc/pgx/v4"}] = struct{}{} - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: pkg[ImportSpec{Path: "github.com/jackc/pgx/v5"}] = struct{}{} } @@ -480,17 +551,95 @@ func (i *importer) batchImports() fileImports { } func trimSliceAndPointerPrefix(v string) string { - v = strings.TrimPrefix(v, "[]") - v = strings.TrimPrefix(v, "*") - return v + for { + trimmed := strings.TrimPrefix(strings.TrimPrefix(v, "[]"), "*") + if trimmed == v { + return v + } + v = trimmed + } } +// hasPrefixIgnoringSliceAndPointerPrefix reports whether the type s names +// prefix once its slice and pointer prefixes are stripped. A map type names +// it when its key or its value does, so map[string]decimal.Decimal uses the +// decimal package, and an instantiated generic type names it when the type +// or one of its arguments does, so duckdb.Composite[[]time.Time] uses both +// the duckdb and the time packages. func hasPrefixIgnoringSliceAndPointerPrefix(s, prefix string) bool { trimmedS := trimSliceAndPointerPrefix(s) trimmedPrefix := trimSliceAndPointerPrefix(prefix) + if key, value, ok := splitMapType(trimmedS); ok { + return hasPrefixIgnoringSliceAndPointerPrefix(key, trimmedPrefix) || + hasPrefixIgnoringSliceAndPointerPrefix(value, trimmedPrefix) + } + if typ, args, ok := splitGenericType(trimmedS); ok { + if strings.HasPrefix(typ, trimmedPrefix) { + return true + } + for _, arg := range args { + if hasPrefixIgnoringSliceAndPointerPrefix(arg, trimmedPrefix) { + return true + } + } + return false + } return strings.HasPrefix(trimmedS, trimmedPrefix) } +// splitGenericType splits an instantiated generic type pkg.Name[A, B] into +// pkg.Name and its type arguments, matching the brackets so an argument +// that is itself a slice, a map or a generic type is kept whole. +func splitGenericType(s string) (string, []string, bool) { + open := strings.IndexByte(s, '[') + if open <= 0 || !strings.HasSuffix(s, "]") { + return "", nil, false + } + var args []string + depth, start := 0, open+1 + for i := open; i < len(s); i++ { + switch s[i] { + case '[': + depth++ + case ']': + depth-- + if depth == 0 { + if i != len(s)-1 { + return "", nil, false + } + args = append(args, strings.TrimSpace(s[start:i])) + } + case ',': + if depth == 1 { + args = append(args, strings.TrimSpace(s[start:i])) + start = i + 1 + } + } + } + return s[:open], args, true +} + +// splitMapType splits map[K]V into K and V, matching the brackets so a key +// that is itself a map or an array is kept whole. +func splitMapType(s string) (string, string, bool) { + if !strings.HasPrefix(s, "map[") { + return "", "", false + } + depth := 0 + for i := 3; i < len(s); i++ { + switch s[i] { + case '[': + depth++ + case ']': + depth-- + if depth == 0 { + return s[4:i], s[i+1:], true + } + } + } + return "", "", false +} + func replaceConflictedArg(imports [][]ImportSpec, queries []Query) []Query { m := make(map[string]struct{}) for _, is := range imports { diff --git a/internal/codegen/golang/mssql_type.go b/internal/codegen/golang/mssql_type.go new file mode 100644 index 0000000000..94492f58e9 --- /dev/null +++ b/internal/codegen/golang/mssql_type.go @@ -0,0 +1,65 @@ +package golang + +import ( + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +// mssqlType maps a SQL Server type to the Go type +// github.com/microsoft/go-mssqldb hands database/sql for it. Exact numerics +// come back as their decimal text, so they map to string the way +// PostgreSQL's numeric does under database/sql. A uniqueidentifier maps to +// the driver's own type, which keeps SQL Server's byte order straight. An +// alias type created with CREATE TYPE ... FROM is reported by its own name, +// which the catalog does not yet resolve to its base, so it maps to any +// until it does. +func mssqlType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { + t, nullable := columnType(col) + null := func(typ, nullTyp string) string { + return nullableGoType(options, nullable, typ, nullTyp) + } + + switch typeExprName(t) { + case "bigint": + return null("int64", "sql.NullInt64") + + case "int": + return null("int32", "sql.NullInt32") + + case "smallint": + return null("int16", "sql.NullInt16") + + case "tinyint": + return null("uint8", "sql.NullByte") + + case "bit": + return null("bool", "sql.NullBool") + + case "decimal", "numeric", "money", "smallmoney": + return null("string", "sql.NullString") + + case "float": + return null("float64", "sql.NullFloat64") + + case "real": + return null("float32", "sql.NullFloat64") + + case "char", "varchar", "nchar", "nvarchar", "text", "ntext", "sysname", "xml", "json": + return null("string", "sql.NullString") + + case "binary", "varbinary", "image", "rowversion", "timestamp": + return "[]byte" + + case "date", "datetime", "datetime2", "smalldatetime", "datetimeoffset", "time": + return null("time.Time", "sql.NullTime") + + case "uniqueidentifier": + return null("mssql.UniqueIdentifier", "mssql.NullUniqueIdentifier") + + case "geography", "geometry", "hierarchyid", "vector": + return "[]byte" + + default: + return "any" + } +} diff --git a/internal/codegen/golang/mysql_type.go b/internal/codegen/golang/mysql_type.go index c89d8ff3c7..7586e02c58 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -3,12 +3,13 @@ package golang import ( "log" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func mysqlType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray unsigned := col.Unsigned @@ -30,14 +31,31 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { } else { if notNull { if unsigned { - return "uint32" + return "uint8" } - return "int32" + return "int8" } - return "sql.NullInt32" + // The database/sql package does not have a sql.NullInt8 type, so we + // use the smallest type they have which is NullInt16 + return "sql.NullInt16" } - case "int", "integer", "smallint", "mediumint", "year": + case "year": + if notNull { + return "int16" + } + return "sql.NullInt16" + + case "smallint": + if notNull { + if unsigned { + return "uint16" + } + return "int16" + } + return "sql.NullInt16" + + case "int", "integer", "mediumint": if notNull { if unsigned { return "uint32" @@ -46,7 +64,11 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { } return "sql.NullInt32" - case "bigint": + case "bigint", "bigint unsigned", "bigint signed": + // "bigint unsigned" and "bigint signed" are MySQL CAST types + // Note: We use int64 for CAST AS UNSIGNED to match original behavior, + // even though uint64 would be more semantically correct. + // The Unsigned flag on columns (from table schema) still uses uint64. if notNull { if unsigned { return "uint64" @@ -93,7 +115,7 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "json.RawMessage" case "any": - return "interface{}" + return "any" default: for _, schema := range req.Catalog.Schemas { @@ -101,14 +123,14 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { if enum.Name == columnType { if notNull { if schema.Name == req.Catalog.DefaultSchema { - return StructName(enum.Name, req.Settings) + return StructName(enum.Name, options) } - return StructName(schema.Name+"_"+enum.Name, req.Settings) + return StructName(schema.Name+"_"+enum.Name, options) } else { if schema.Name == req.Catalog.DefaultSchema { - return "Null" + StructName(enum.Name, req.Settings) + return "Null" + StructName(enum.Name, options) } - return "Null" + StructName(schema.Name+"_"+enum.Name, req.Settings) + return "Null" + StructName(schema.Name+"_"+enum.Name, options) } } } @@ -116,7 +138,7 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { if debug.Active { log.Printf("Unknown MySQL type: %s\n", columnType) } - return "interface{}" + return "any" } } diff --git a/internal/codegen/golang/opts.go b/internal/codegen/golang/opts.go deleted file mode 100644 index af90dcc6bd..0000000000 --- a/internal/codegen/golang/opts.go +++ /dev/null @@ -1,61 +0,0 @@ -package golang - -import ( - "bytes" - "encoding/json" - "fmt" - - "github.com/sqlc-dev/sqlc/internal/plugin" -) - -type opts struct { - EmitInterface bool `json:"emit_interface"` - EmitJsonTags bool `json:"emit_json_tags"` - JsonTagsIdUppercase bool `json:"json_tags_id_uppercase"` - EmitDbTags bool `json:"emit_db_tags"` - EmitPreparedQueries bool `json:"emit_prepared_queries"` - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty"` - EmitEmptySlices bool `json:"emit_empty_slices,omitempty"` - EmitExportedQueries bool `json:"emit_exported_queries"` - EmitResultStructPointers bool `json:"emit_result_struct_pointers"` - EmitParamsStructPointers bool `json:"emit_params_struct_pointers"` - EmitMethodsWithDbArgument bool `json:"emit_methods_with_db_argument,omitempty"` - EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types"` - EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty"` - EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty"` - JsonTagsCaseStyle string `json:"json_tags_case_style,omitempty"` - Package string `json:"package"` - Out string `json:"out"` - SqlPackage string `json:"sql_package"` - SqlDriver string `json:"sql_driver"` - OutputBatchFileName string `json:"output_batch_file_name,omitempty"` - OutputDbFileName string `json:"output_db_file_name,omitempty"` - OutputModelsFileName string `json:"output_models_file_name,omitempty"` - OutputQuerierFileName string `json:"output_querier_file_name,omitempty"` - OutputCopyfromFileName string `json:"output_copyfrom_file_name,omitempty"` - OutputFilesSuffix string `json:"output_files_suffix,omitempty"` - InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty"` - QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty"` - OmitUnusedStructs bool `json:"omit_unused_structs,omitempty"` - BuildTags string `json:"build_tags,omitempty"` - - // Unused but left in for parsing convenience - Overrides json.RawMessage `json:"overrides,omitempty"` - Rename json.RawMessage `json:"rename,omitempty"` -} - -func parseOpts(req *plugin.CodeGenRequest) (*opts, error) { - var options *opts - dec := json.NewDecoder(bytes.NewReader(req.PluginOptions)) - dec.DisallowUnknownFields() - if err := dec.Decode(&options); err != nil { - return options, fmt.Errorf("unmarshalling options: %w", err) - } - - if options.QueryParameterLimit == nil { - options.QueryParameterLimit = new(int32) - *options.QueryParameterLimit = 1 - } - - return options, nil -} diff --git a/internal/codegen/golang/opts/enum.go b/internal/codegen/golang/opts/enum.go new file mode 100644 index 0000000000..40457d040a --- /dev/null +++ b/internal/codegen/golang/opts/enum.go @@ -0,0 +1,64 @@ +package opts + +import "fmt" + +type SQLDriver string + +const ( + SQLPackagePGXV4 string = "pgx/v4" + SQLPackagePGXV5 string = "pgx/v5" + SQLPackageStandard string = "database/sql" +) + +var validPackages = map[string]struct{}{ + string(SQLPackagePGXV4): {}, + string(SQLPackagePGXV5): {}, + string(SQLPackageStandard): {}, +} + +func validatePackage(sqlPackage string) error { + if _, found := validPackages[sqlPackage]; !found { + return fmt.Errorf("unknown SQL package: %s", sqlPackage) + } + return nil +} + +const ( + SQLDriverPGXV4 SQLDriver = "github.com/jackc/pgx/v4" + SQLDriverPGXV5 = "github.com/jackc/pgx/v5" + SQLDriverLibPQ = "github.com/lib/pq" + SQLDriverGoSQLDriverMySQL = "github.com/go-sql-driver/mysql" +) + +var validDrivers = map[string]struct{}{ + string(SQLDriverPGXV4): {}, + string(SQLDriverPGXV5): {}, + string(SQLDriverLibPQ): {}, + string(SQLDriverGoSQLDriverMySQL): {}, +} + +func validateDriver(sqlDriver string) error { + if _, found := validDrivers[sqlDriver]; !found { + return fmt.Errorf("unknown SQL driver: %s", sqlDriver) + } + return nil +} + +func (d SQLDriver) IsPGX() bool { + return d == SQLDriverPGXV4 || d == SQLDriverPGXV5 +} + +func (d SQLDriver) IsGoSQLDriverMySQL() bool { + return d == SQLDriverGoSQLDriverMySQL +} + +func (d SQLDriver) Package() string { + switch d { + case SQLDriverPGXV4: + return SQLPackagePGXV4 + case SQLDriverPGXV5: + return SQLPackagePGXV5 + default: + return SQLPackageStandard + } +} diff --git a/internal/config/go_type.go b/internal/codegen/golang/opts/go_type.go similarity index 91% rename from internal/config/go_type.go rename to internal/codegen/golang/opts/go_type.go index 14765e5f32..723594cffb 100644 --- a/internal/config/go_type.go +++ b/internal/codegen/golang/opts/go_type.go @@ -1,4 +1,4 @@ -package config +package opts import ( "encoding/json" @@ -16,8 +16,8 @@ type GoType struct { Name string `json:"type" yaml:"type"` Pointer bool `json:"pointer" yaml:"pointer"` Slice bool `json:"slice" yaml:"slice"` - Spec string - BuiltIn bool + Spec string `json:"-"` + BuiltIn bool `json:"-"` } type ParsedGoType struct { @@ -28,6 +28,14 @@ type ParsedGoType struct { StructTag string } +func (o *GoType) MarshalJSON() ([]byte, error) { + if o.Spec != "" { + return json.Marshal(o.Spec) + } + type alias GoType + return json.Marshal(alias(*o)) +} + func (o *GoType) UnmarshalJSON(data []byte) error { var spec string if err := json.Unmarshal(data, &spec); err == nil { @@ -43,7 +51,7 @@ func (o *GoType) UnmarshalJSON(data []byte) error { return nil } -func (o *GoType) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (o *GoType) UnmarshalYAML(unmarshal func(any) error) error { var spec string if err := unmarshal(&spec); err == nil { *o = GoType{Spec: spec} @@ -77,7 +85,7 @@ func generatePackageID(importPath string) (string, bool) { } // validate GoType -func (gt GoType) Parse() (*ParsedGoType, error) { +func (gt GoType) parse() (*ParsedGoType, error) { var o ParsedGoType if gt.Spec == "" { @@ -171,7 +179,7 @@ type GoStructTag string // empty string {} // `a:"b"` {"a": "b"} // `a:"b" x:"y,z"` {"a": "b", "x": "y,z"} -func (s GoStructTag) Parse() (map[string]string, error) { +func (s GoStructTag) parse() (map[string]string, error) { m := make(map[string]string) tags, err := structtag.Parse(string(s)) if err != nil { diff --git a/internal/codegen/golang/opts/options.go b/internal/codegen/golang/opts/options.go new file mode 100644 index 0000000000..64ceb13796 --- /dev/null +++ b/internal/codegen/golang/opts/options.go @@ -0,0 +1,251 @@ +package opts + +import ( + "encoding/json" + "fmt" + "maps" + "path/filepath" + + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +type Options struct { + EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` + EmitJsonTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` + JsonTagsIdUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` + EmitDbTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` + EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` + EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` + EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` + EmitExportedQueries bool `json:"emit_exported_queries" yaml:"emit_exported_queries"` + EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` + EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` + EmitMethodsWithDbArgument bool `json:"emit_methods_with_db_argument,omitempty" yaml:"emit_methods_with_db_argument"` + EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` + // nil inherits EmitPointersForNullTypes; non-nil overrides for enums only. + EmitPointersForNullEnumTypes *bool `json:"emit_pointers_for_null_enum_types,omitempty" yaml:"emit_pointers_for_null_enum_types"` + EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` + EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` + EmitSqlAsComment bool `json:"emit_sql_as_comment,omitempty" yaml:"emit_sql_as_comment"` + JsonTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` + Package string `json:"package" yaml:"package"` + Out string `json:"out" yaml:"out"` + Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` + Rename map[string]string `json:"rename,omitempty" yaml:"rename"` + SqlPackage string `json:"sql_package" yaml:"sql_package"` + SqlDriver string `json:"sql_driver" yaml:"sql_driver"` + OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` + OutputDbFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` + OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` + OutputModelsPath string `json:"output_models_path,omitempty" yaml:"output_models_path"` + OutputModelsPackage string `json:"output_models_package,omitempty" yaml:"output_models_package"` + OutputModelsImport string `json:"output_models_import,omitempty" yaml:"output_models_import"` + OutputModelsEmit *bool `json:"output_models_emit,omitempty" yaml:"output_models_emit"` + OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` + OutputCopyfromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` + OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` + InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty" yaml:"inflection_exclude_table_names"` + WrapErrors bool `json:"wrap_errors,omitempty" yaml:"wrap_errors"` + QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` + OmitSqlcVersion bool `json:"omit_sqlc_version,omitempty" yaml:"omit_sqlc_version"` + OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` + BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` + Initialisms *[]string `json:"initialisms,omitempty" yaml:"initialisms"` + + InitialismsMap map[string]struct{} `json:"-" yaml:"-"` +} + +type GlobalOptions struct { + Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` + Rename map[string]string `json:"rename,omitempty" yaml:"rename"` +} + +func Parse(req *plugin.GenerateRequest) (*Options, error) { + options, err := parseOpts(req) + if err != nil { + return nil, err + } + global, err := parseGlobalOpts(req) + if err != nil { + return nil, err + } + if len(global.Overrides) > 0 { + options.Overrides = append(global.Overrides, options.Overrides...) + } + if len(global.Rename) > 0 { + if options.Rename == nil { + options.Rename = map[string]string{} + } + maps.Copy(options.Rename, global.Rename) + } + return options, nil +} + +func parseOpts(req *plugin.GenerateRequest) (*Options, error) { + var options Options + if len(req.PluginOptions) == 0 { + return &options, nil + } + if err := json.Unmarshal(req.PluginOptions, &options); err != nil { + return nil, fmt.Errorf("unmarshalling plugin options: %w", err) + } + + if options.Package == "" { + if options.Out != "" { + options.Package = filepath.Base(options.Out) + } else { + return nil, fmt.Errorf("invalid options: missing package name") + } + } + + // Default the models package name to the base of the models path. When + // the user only configures output_models_emit: false (no path), fall + // back to the base of the import path. + if options.OutputModelsPackage == "" { + if options.OutputModelsPath != "" { + options.OutputModelsPackage = filepath.Base(options.OutputModelsPath) + } else if options.OutputModelsImport != "" { + options.OutputModelsPackage = filepath.Base(options.OutputModelsImport) + } + } + + for i := range options.Overrides { + if err := options.Overrides[i].parse(req); err != nil { + return nil, err + } + } + + if options.SqlPackage != "" { + if err := validatePackage(options.SqlPackage); err != nil { + return nil, fmt.Errorf("invalid options: %s", err) + } + } + + if options.SqlDriver != "" { + if err := validateDriver(options.SqlDriver); err != nil { + return nil, fmt.Errorf("invalid options: %s", err) + } + } + + if options.QueryParameterLimit == nil { + options.QueryParameterLimit = new(int32) + *options.QueryParameterLimit = 1 + } + + if options.Initialisms == nil { + options.Initialisms = new([]string) + *options.Initialisms = []string{"id"} + } + + options.InitialismsMap = map[string]struct{}{} + for _, initial := range *options.Initialisms { + options.InitialismsMap[initial] = struct{}{} + } + + return &options, nil +} + +func parseGlobalOpts(req *plugin.GenerateRequest) (*GlobalOptions, error) { + var options GlobalOptions + if len(req.GlobalOptions) == 0 { + return &options, nil + } + if err := json.Unmarshal(req.GlobalOptions, &options); err != nil { + return nil, fmt.Errorf("unmarshalling global options: %w", err) + } + // Global overrides are shared by every SQL package, so drop the ones + // scoped to a different engine + overrides := options.Overrides[:0] + for _, o := range options.Overrides { + if o.Engine != "" && o.Engine != req.Settings.GetEngine() { + continue + } + if err := o.parse(req); err != nil { + return nil, err + } + overrides = append(overrides, o) + } + options.Overrides = overrides + return &options, nil +} + +func ValidateOpts(opts *Options) error { + if opts.EmitMethodsWithDbArgument && opts.EmitPreparedQueries { + return fmt.Errorf("invalid options: emit_methods_with_db_argument and emit_prepared_queries options are mutually exclusive") + } + if *opts.QueryParameterLimit < 0 { + return fmt.Errorf("invalid options: query parameter limit must not be negative") + } + + if err := validateModelsOptions(opts); err != nil { + return err + } + + return nil +} + +// ModelsEmitEnabled reports whether this codegen block should write the +// models file. Defaults to true when the option is unset. +func (o *Options) ModelsEmitEnabled() bool { + if o.OutputModelsEmit == nil { + return true + } + return *o.OutputModelsEmit +} + +// ModelsImportAlias is the fixed Go import alias used for the models +// package in query files. Using a constant alias keeps the type qualifier +// consistent regardless of how the user names the actual package. +const ModelsImportAlias = "models" + +// ModelsPackage returns the Go package name to use in the models file +// itself (i.e. the `package X` declaration). When the caller has not +// configured a separate models package, this is the same as Package. +func (o *Options) ModelsPackage() string { + if o.OutputModelsPackage != "" { + return o.OutputModelsPackage + } + return o.Package +} + +// ModelsAreExternal reports whether model types live in a different Go +// package than the queries package. When true, query files must import the +// models package and reference types as `models.Type`. +func (o *Options) ModelsAreExternal() bool { + return o.OutputModelsImport != "" +} + +// ModelsTypeQualifier returns the prefix to use when referencing a model +// type from a query file ("models."). Empty string when no qualifier is +// needed. +func (o *Options) ModelsTypeQualifier() string { + if o.ModelsAreExternal() { + return ModelsImportAlias + "." + } + return "" +} + +func validateModelsOptions(opts *Options) error { + hasAnyModelsOpt := opts.OutputModelsPath != "" || + opts.OutputModelsPackage != "" || + opts.OutputModelsImport != "" || + opts.OutputModelsEmit != nil + + if !hasAnyModelsOpt { + return nil + } + + if opts.OutputModelsImport == "" { + return fmt.Errorf("invalid options: output_models_import is required when any output_models_* option is set") + } + + if opts.ModelsEmitEnabled() && opts.OutputModelsPath == "" { + return fmt.Errorf("invalid options: output_models_path is required when emitting models to a separate package") + } + + if opts.ModelsEmitEnabled() && opts.OutputModelsPath == opts.Out { + return fmt.Errorf("invalid options: output_models_path matches out; models would overwrite the queries package") + } + + return nil +} diff --git a/internal/config/override.go b/internal/codegen/golang/opts/override.go similarity index 76% rename from internal/config/override.go rename to internal/codegen/golang/opts/override.go index f2337a79de..6916c0c7f3 100644 --- a/internal/config/override.go +++ b/internal/codegen/golang/opts/override.go @@ -1,12 +1,13 @@ -package config +package opts import ( "fmt" "os" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/pattern" - "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/plugin" ) type Override struct { @@ -22,7 +23,7 @@ type Override struct { Deprecated_PostgresType string `json:"postgres_type" yaml:"postgres_type"` // for global overrides only when two different engines are in use - Engine Engine `json:"engine,omitempty" yaml:"engine"` + Engine string `json:"engine,omitempty" yaml:"engine"` // True if the GoType should override if the matching type is nullable Nullable bool `json:"nullable" yaml:"nullable"` @@ -36,54 +37,53 @@ type Override struct { // fully qualified name of the column, e.g. `accounts.id` Column string `json:"column" yaml:"column"` - ColumnName *pattern.Match - TableCatalog *pattern.Match - TableSchema *pattern.Match - TableRel *pattern.Match - GoImportPath string - GoPackage string - GoTypeName string - GoBasicType bool + ColumnName *pattern.Match `json:"-"` + TableCatalog *pattern.Match `json:"-"` + TableSchema *pattern.Match `json:"-"` + TableRel *pattern.Match `json:"-"` + GoImportPath string `json:"-"` + GoPackage string `json:"-"` + GoTypeName string `json:"-"` + GoBasicType bool `json:"-"` // Parsed form of GoStructTag, e.g. {"validate:", "required"} - GoStructTags map[string]string + GoStructTags map[string]string `json:"-"` + ShimOverride *ShimOverride `json:"-"` } -func (o *Override) Matches(n *ast.TableName, defaultSchema string) bool { +func (o *Override) Matches(n *plugin.Identifier, defaultSchema string) bool { if n == nil { return false } - schema := n.Schema if n.Schema == "" { schema = defaultSchema } - if o.TableCatalog != nil && !o.TableCatalog.MatchString(n.Catalog) { return false } - if o.TableSchema == nil && schema != "" { return false } - if o.TableSchema != nil && !o.TableSchema.MatchString(schema) { return false } - if o.TableRel == nil && n.Name != "" { return false } - if o.TableRel != nil && !o.TableRel.MatchString(n.Name) { return false } - return true } -func (o *Override) Parse() (err error) { +func (o *Override) MatchesColumn(col *plugin.Column) bool { + columnType := sdk.DataType(col.Type) + notNull := col.NotNull || col.IsArray + return o.DBType != "" && o.DBType == columnType && o.Nullable != notNull && o.Unsigned == col.Unsigned +} +func (o *Override) parse(req *plugin.GenerateRequest) (err error) { // validate deprecated postgres_type field if o.Deprecated_PostgresType != "" { fmt.Fprintf(os.Stderr, "WARNING: \"postgres_type\" is deprecated. Instead, use \"db_type\" to specify a type override.\n") @@ -99,6 +99,11 @@ func (o *Override) Parse() (err error) { o.Nullable = true } + schema := "public" + if req != nil && req.Catalog != nil { + schema = req.Catalog.DefaultSchema + } + // validate option combinations switch { case o.Column != "" && o.DBType != "": @@ -118,7 +123,7 @@ func (o *Override) Parse() (err error) { if o.TableRel, err = pattern.MatchCompile(colParts[0]); err != nil { return err } - if o.TableSchema, err = pattern.MatchCompile("public"); err != nil { + if o.TableSchema, err = pattern.MatchCompile(schema); err != nil { return err } case 3: @@ -150,7 +155,7 @@ func (o *Override) Parse() (err error) { } // validate GoType - parsed, err := o.GoType.Parse() + parsed, err := o.GoType.parse() if err != nil { return err } @@ -160,11 +165,12 @@ func (o *Override) Parse() (err error) { o.GoBasicType = parsed.BasicType // validate GoStructTag - tags, err := o.GoStructTag.Parse() + tags, err := o.GoStructTag.parse() if err != nil { return err } o.GoStructTags = tags + o.ShimOverride = shimOverride(req, o) return nil } diff --git a/internal/codegen/golang/opts/override_test.go b/internal/codegen/golang/opts/override_test.go new file mode 100644 index 0000000000..8405666f36 --- /dev/null +++ b/internal/codegen/golang/opts/override_test.go @@ -0,0 +1,117 @@ +package opts + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestTypeOverrides(t *testing.T) { + for _, test := range []struct { + override Override + pkg string + typeName string + basic bool + }{ + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "github.com/segmentio/ksuid.KSUID"}, + }, + "github.com/segmentio/ksuid", + "ksuid.KSUID", + false, + }, + // TODO: Add test for struct pointers + // + // { + // Override{ + // DBType: "uuid", + // GoType: "github.com/segmentio/*ksuid.KSUID", + // }, + // "github.com/segmentio/ksuid", + // "*ksuid.KSUID", + // false, + // }, + { + Override{ + DBType: "citext", + GoType: GoType{Spec: "string"}, + }, + "", + "string", + true, + }, + { + Override{ + DBType: "timestamp", + GoType: GoType{Spec: "time.Time"}, + }, + "time", + "time.Time", + false, + }, + } { + tt := test + t.Run(tt.override.GoType.Spec, func(t *testing.T) { + if err := tt.override.parse(nil); err != nil { + t.Fatalf("override parsing failed; %s", err) + } + if diff := cmp.Diff(tt.pkg, tt.override.GoImportPath); diff != "" { + t.Errorf("package mismatch;\n%s", diff) + } + if diff := cmp.Diff(tt.typeName, tt.override.GoTypeName); diff != "" { + t.Errorf("type name mismatch;\n%s", diff) + } + if diff := cmp.Diff(tt.basic, tt.override.GoBasicType); diff != "" { + t.Errorf("basic mismatch;\n%s", diff) + } + }) + } + for _, test := range []struct { + override Override + err string + }{ + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "Pointer"}, + }, + "Package override `go_type` specifier \"Pointer\" is not a Go basic type e.g. 'string'", + }, + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "untyped rune"}, + }, + "Package override `go_type` specifier \"untyped rune\" is not a Go basic type e.g. 'string'", + }, + } { + tt := test + t.Run(tt.override.GoType.Spec, func(t *testing.T) { + err := tt.override.parse(nil) + if err == nil { + t.Fatalf("expected parse to fail; got nil") + } + if diff := cmp.Diff(tt.err, err.Error()); diff != "" { + t.Errorf("error mismatch;\n%s", diff) + } + }) + } +} + +func FuzzOverride(f *testing.F) { + for _, spec := range []string{ + "string", + "github.com/gofrs/uuid.UUID", + "github.com/segmentio/ksuid.KSUID", + } { + f.Add(spec) + } + f.Fuzz(func(t *testing.T, s string) { + o := Override{ + GoType: GoType{Spec: s}, + } + o.parse(nil) + }) +} diff --git a/internal/codegen/golang/opts/shim.go b/internal/codegen/golang/opts/shim.go new file mode 100644 index 0000000000..7912e17664 --- /dev/null +++ b/internal/codegen/golang/opts/shim.go @@ -0,0 +1,77 @@ +package opts + +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +// The ShimOverride struct exists to bridge the gap between the Override struct +// and the previous Override struct defined in codegen.proto. Eventually these +// shim structs should be removed in favor of using the existing Override and +// GoType structs, but it's easier to provide these shim structs to not change +// the existing, working code. +type ShimOverride struct { + DbType string + Nullable bool + Column string + Table *plugin.Identifier + ColumnName string + Unsigned bool + GoType *ShimGoType +} + +func shimOverride(req *plugin.GenerateRequest, o *Override) *ShimOverride { + var column string + var table plugin.Identifier + + if o.Column != "" { + colParts := strings.Split(o.Column, ".") + switch len(colParts) { + case 2: + table.Schema = req.Catalog.DefaultSchema + table.Name = colParts[0] + column = colParts[1] + case 3: + table.Schema = colParts[0] + table.Name = colParts[1] + column = colParts[2] + case 4: + table.Catalog = colParts[0] + table.Schema = colParts[1] + table.Name = colParts[2] + column = colParts[3] + } + } + return &ShimOverride{ + DbType: o.DBType, + Nullable: o.Nullable, + Unsigned: o.Unsigned, + Column: o.Column, + ColumnName: column, + Table: &table, + GoType: shimGoType(o), + } +} + +type ShimGoType struct { + ImportPath string + Package string + TypeName string + BasicType bool + StructTags map[string]string +} + +func shimGoType(o *Override) *ShimGoType { + // Note that there is a slight mismatch between this and the + // proto api. The GoType on the override is the unparsed type, + // which could be a qualified path or an object, as per + // https://docs.sqlc.dev/en/v1.18.0/reference/config.html#type-overriding + return &ShimGoType{ + ImportPath: o.GoImportPath, + Package: o.GoPackage, + TypeName: o.GoTypeName, + BasicType: o.GoBasicType, + StructTags: o.GoStructTags, + } +} diff --git a/internal/codegen/golang/postgresql_type.go b/internal/codegen/golang/postgresql_type.go index 815befad30..3bdfed6a1a 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -5,6 +5,7 @@ import ( "log" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/plugin" @@ -33,11 +34,15 @@ func parseIdentifierString(name string) (*plugin.Identifier, error) { } } -func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) string { +func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray driver := parseDriver(options.SqlPackage) emitPointersForNull := driver.IsPGX() && options.EmitPointersForNullTypes + emitPointersForNullEnums := emitPointersForNull + if options.EmitPointersForNullEnumTypes != nil { + emitPointersForNullEnums = driver.IsPGX() && *options.EmitPointersForNullEnumTypes + } switch columnType { case "serial", "serial4", "pg_catalog.serial4": @@ -47,7 +52,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*int32" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int4" } return "sql.NullInt32" @@ -59,7 +64,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*int64" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int8" } return "sql.NullInt64" @@ -71,7 +76,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*int16" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int2" } return "sql.NullInt16" @@ -83,7 +88,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*int32" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int4" } return "sql.NullInt32" @@ -95,7 +100,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*int64" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int8" } return "sql.NullInt64" @@ -107,7 +112,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*int16" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Int2" } return "sql.NullInt16" @@ -119,7 +124,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*float64" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Float8" } return "sql.NullFloat64" @@ -131,7 +136,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*float32" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Float4" } return "sql.NullFloat64" // TODO: Change to sql.NullFloat32 after updating the go.mod file @@ -159,48 +164,48 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*bool" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Bool" } return "sql.NullBool" - case "json": + case "json", "pg_catalog.json": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "[]byte" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.JSON" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: if notNull { return "json.RawMessage" } else { return "pqtype.NullRawMessage" } default: - return "interface{}" + return "any" } - case "jsonb": + case "jsonb", "pg_catalog.jsonb": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "[]byte" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.JSONB" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: if notNull { return "json.RawMessage" } else { return "pqtype.NullRawMessage" } default: - return "interface{}" + return "any" } case "bytea", "blob", "pg_catalog.bytea": return "[]byte" case "date": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Date" } if notNull { @@ -211,8 +216,8 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) } return "sql.NullTime" - case "pg_catalog.time": - if driver == SQLDriverPGXV5 { + case "pg_catalog.time", "time", "time without time zone": + if driver == opts.SQLDriverPGXV5 { return "pgtype.Time" } if notNull { @@ -223,7 +228,7 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) } return "sql.NullTime" - case "pg_catalog.timetz": + case "pg_catalog.timetz", "timetz", "time with time zone": if notNull { return "time.Time" } @@ -232,8 +237,8 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) } return "sql.NullTime" - case "pg_catalog.timestamp": - if driver == SQLDriverPGXV5 { + case "pg_catalog.timestamp", "timestamp", "timestamp without time zone": + if driver == opts.SQLDriverPGXV5 { return "pgtype.Timestamp" } if notNull { @@ -244,8 +249,8 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) } return "sql.NullTime" - case "pg_catalog.timestamptz", "timestamptz": - if driver == SQLDriverPGXV5 { + case "pg_catalog.timestamptz", "timestamptz", "timestamp with time zone": + if driver == opts.SQLDriverPGXV5 { return "pgtype.Timestamptz" } if notNull { @@ -256,20 +261,20 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) } return "sql.NullTime" - case "text", "pg_catalog.varchar", "pg_catalog.bpchar", "string", "citext", "name": + case "text", "pg_catalog.varchar", "varchar", "character varying", "pg_catalog.bpchar", "bpchar", "character", "string", "citext", "name": if notNull { return "string" } if emitPointersForNull { return "*string" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Text" } return "sql.NullString" case "uuid": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.UUID" } if notNull { @@ -282,44 +287,44 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) case "inet": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: if notNull { return "netip.Addr" } return "*netip.Addr" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Inet" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: return "pqtype.Inet" default: - return "interface{}" + return "any" } case "cidr": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: if notNull { return "netip.Prefix" } return "*netip.Prefix" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.CIDR" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: return "pqtype.CIDR" default: - return "interface{}" + return "any" } case "macaddr", "macaddr8": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "net.HardwareAddr" - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Macaddr" - case SQLDriverLibPQ: + case opts.SQLDriverLibPQ: return "pqtype.Macaddr" default: - return "interface{}" + return "any" } case "ltree", "lquery", "ltxtquery": @@ -334,13 +339,13 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if emitPointersForNull { return "*string" } - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Text" } return "sql.NullString" case "interval", "pg_catalog.interval": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Interval" } if notNull { @@ -353,139 +358,139 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) case "daterange": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Daterange" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Date]" default: - return "interface{}" + return "any" } case "datemultirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Date]]" default: - return "interface{}" + return "any" } case "tsrange": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Tsrange" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Timestamp]" default: - return "interface{}" + return "any" } case "tsmultirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Timestamp]]" default: - return "interface{}" + return "any" } case "tstzrange": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Tstzrange" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Timestamptz]" default: - return "interface{}" + return "any" } case "tstzmultirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Timestamptz]]" default: - return "interface{}" + return "any" } case "numrange": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Numrange" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Numeric]" default: - return "interface{}" + return "any" } case "nummultirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Numeric]]" default: - return "interface{}" + return "any" } case "int4range": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Int4range" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Int4]" default: - return "interface{}" + return "any" } case "int4multirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Int4]]" default: - return "interface{}" + return "any" } case "int8range": switch driver { - case SQLDriverPGXV4: + case opts.SQLDriverPGXV4: return "pgtype.Int8range" - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Range[pgtype.Int8]" default: - return "interface{}" + return "any" } case "int8multirange": switch driver { - case SQLDriverPGXV5: + case opts.SQLDriverPGXV5: return "pgtype.Multirange[pgtype.Range[pgtype.Int8]]" default: - return "interface{}" + return "any" } case "hstore": if driver.IsPGX() { return "pgtype.Hstore" } - return "interface{}" + return "any" - case "bit", "varbit", "pg_catalog.bit", "pg_catalog.varbit": - if driver == SQLDriverPGXV5 { + case "bit", "varbit", "bit varying", "pg_catalog.bit", "pg_catalog.varbit": + if driver == opts.SQLDriverPGXV5 { return "pgtype.Bits" } - if driver == SQLDriverPGXV4 { + if driver == opts.SQLDriverPGXV4 { return "pgtype.Varbit" } case "cid": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Uint32" } - if driver == SQLDriverPGXV4 { + if driver == opts.SQLDriverPGXV4 { return "pgtype.CID" } case "oid": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Uint32" } - if driver == SQLDriverPGXV4 { + if driver == opts.SQLDriverPGXV4 { return "pgtype.OID" } @@ -495,13 +500,18 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) } case "xid": - if driver == SQLDriverPGXV5 { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Uint32" } - if driver == SQLDriverPGXV4 { + if driver == opts.SQLDriverPGXV4 { return "pgtype.XID" } + case "xid8": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Uint64" + } + case "box": if driver.IsPGX() { return "pgtype.Box" @@ -537,18 +547,27 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) return "pgtype.Polygon" } + case "vector": + if driver == opts.SQLDriverPGXV5 { + if emitPointersForNull { + return "*pgvector.Vector" + } else { + return "pgvector.Vector" + } + } + case "void": // A void value can only be scanned into an empty interface. - return "interface{}" + return "any" case "any": - return "interface{}" + return "any" default: rel, err := parseIdentifierString(columnType) if err != nil { // TODO: Should this actually return an error here? - return "interface{}" + return "any" } if rel.Schema == "" { rel.Schema = req.Catalog.DefaultSchema @@ -563,14 +582,18 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if rel.Name == enum.Name && rel.Schema == schema.Name { if notNull { if schema.Name == req.Catalog.DefaultSchema { - return StructName(enum.Name, req.Settings) + return StructName(enum.Name, options) } - return StructName(schema.Name+"_"+enum.Name, req.Settings) + return StructName(schema.Name+"_"+enum.Name, options) } else { + nullPrefix := "Null" + if emitPointersForNullEnums { + nullPrefix = "*" + } if schema.Name == req.Catalog.DefaultSchema { - return "Null" + StructName(enum.Name, req.Settings) + return nullPrefix + StructName(enum.Name, options) } - return "Null" + StructName(schema.Name+"_"+enum.Name, req.Settings) + return nullPrefix + StructName(schema.Name+"_"+enum.Name, options) } } } @@ -592,5 +615,5 @@ func postgresType(req *plugin.CodeGenRequest, options *opts, col *plugin.Column) if debug.Active { log.Printf("unknown PostgreSQL type: %s\n", columnType) } - return "interface{}" + return "any" } diff --git a/internal/codegen/golang/qualify.go b/internal/codegen/golang/qualify.go new file mode 100644 index 0000000000..47577bf2e0 --- /dev/null +++ b/internal/codegen/golang/qualify.go @@ -0,0 +1,79 @@ +package golang + +import "strings" + +// stripQualifier removes a leading slice/pointer prefix and the given +// `pkg.` qualifier from a Go type expression. When the qualifier is empty +// or absent from the type, the input is returned unchanged. +func stripQualifier(t, qualifier string) string { + if qualifier == "" { + return t + } + var prefix strings.Builder + rest := t + for { + if strings.HasPrefix(rest, "[]") { + prefix.WriteString("[]") + rest = rest[2:] + continue + } + if strings.HasPrefix(rest, "*") { + prefix.WriteString("*") + rest = rest[1:] + continue + } + break + } + if strings.HasPrefix(rest, qualifier) { + return prefix.String() + rest[len(qualifier):] + } + return t +} + +// modelTypeSet is the set of Go type names that live in the models file. +type modelTypeSet map[string]struct{} + +// buildModelTypeSet returns the set of type names that are declared in +// models.go for the current codegen invocation. +func buildModelTypeSet(enums []Enum, structs []Struct) modelTypeSet { + set := make(modelTypeSet, len(enums)*4+len(structs)) + for _, e := range enums { + set[e.Name] = struct{}{} + set["Null"+e.Name] = struct{}{} + } + for _, s := range structs { + if s.IsModel { + set[s.Name] = struct{}{} + } + } + return set +} + +// qualifyType prefixes a Go type expression with `qualifier` when the bare +// type name belongs to `models`. Slice and pointer prefixes are preserved. +// When qualifier is empty (i.e. models live in the queries package), the +// input is returned unchanged. +func qualifyType(t string, models modelTypeSet, qualifier string) string { + if qualifier == "" || t == "" || len(models) == 0 { + return t + } + var prefix strings.Builder + rest := t + for { + if strings.HasPrefix(rest, "[]") { + prefix.WriteString("[]") + rest = rest[2:] + continue + } + if strings.HasPrefix(rest, "*") { + prefix.WriteString("*") + rest = rest[1:] + continue + } + break + } + if _, ok := models[rest]; ok { + return prefix.String() + qualifier + rest + } + return t +} diff --git a/internal/codegen/golang/query.go b/internal/codegen/golang/query.go index b82178686c..6bd9b70e25 100644 --- a/internal/codegen/golang/query.go +++ b/internal/codegen/golang/query.go @@ -2,8 +2,10 @@ package golang import ( "fmt" + "strconv" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/plugin" ) @@ -13,9 +15,20 @@ type QueryValue struct { EmitPointer bool Name string DBName string // The name of the field in the database. Only set if Struct==nil. + ParamName string // The name of the placeholder a parameter is bound by, when the query names it. Only set if Struct==nil. Struct *Struct Typ string - SQLDriver SQLDriver + SQLDriver opts.SQLDriver + Engine string + + // NamedArgs is set when the query's placeholders name their parameters, + // as SQL Server's and Spanner's @name and ClickHouse's {name:Type} do, + // so each argument is passed as sql.Named with that name. + NamedArgs bool + + // ModelQualifier prefixes references to model types when the models file + // lives in a different Go package (e.g. "model."). Empty otherwise. + ModelQualifier string // Column is kept so late in the generation process around to differentiate // between mysql slices and pg arrays @@ -87,6 +100,14 @@ func (v QueryValue) Type() string { return v.Typ } if v.Struct != nil { + // Model structs (table-derived) live in the models file. When that + // file is generated into a different Go package, references from + // query files must be qualified. Synthetic structs (Params/Row) + // are defined in the same query file as their use, so they stay + // bare. + if v.Struct.IsModel && v.ModelQualifier != "" { + return v.ModelQualifier + v.Struct.Name + } return v.Struct.Name } panic("no type for QueryValue: " + v.Name) @@ -122,23 +143,37 @@ func (v QueryValue) UniqueFields() []Field { return fields } +// pqArrays reports whether the value's slices go through pq.Array. +func (v QueryValue) pqArrays() bool { + return usesPqArrays(v.Engine, v.SQLDriver) +} + +// namedArg is the argument expr passed for the parameter the query names +// name, wrapped in sql.Named when the query's placeholders are named. +func (v QueryValue) namedArg(name, expr string) string { + if !v.NamedArgs { + return expr + } + return "sql.Named(" + strconv.Quote(name) + ", " + expr + ")" +} + func (v QueryValue) Params() string { if v.isEmpty() { return "" } var out []string if v.Struct == nil { - if !v.Column.IsSqlcSlice && strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" && !v.SQLDriver.IsPGX() { + if !v.Column.IsSqlcSlice && strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" && v.pqArrays() { out = append(out, "pq.Array("+escape(v.Name)+")") } else { - out = append(out, escape(v.Name)) + out = append(out, v.namedArg(v.ParamName, escape(v.Name))) } } else { for _, f := range v.Struct.Fields { - if !f.HasSqlcSlice() && strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" && !v.SQLDriver.IsPGX() { + if !f.HasSqlcSlice() && strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" && v.pqArrays() { out = append(out, "pq.Array("+escape(v.VariableForField(f))+")") } else { - out = append(out, escape(v.VariableForField(f))) + out = append(out, v.namedArg(f.ParamName, escape(v.VariableForField(f)))) } } } @@ -192,7 +227,7 @@ func (v QueryValue) HasSqlcSlices() bool { func (v QueryValue) Scan() string { var out []string if v.Struct == nil { - if strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" && !v.SQLDriver.IsPGX() { + if strings.HasPrefix(v.Typ, "[]") && v.Typ != "[]byte" && v.pqArrays() { out = append(out, "pq.Array(&"+v.Name+")") } else { out = append(out, "&"+v.Name) @@ -203,7 +238,7 @@ func (v QueryValue) Scan() string { // append any embedded fields if len(f.EmbedFields) > 0 { for _, embed := range f.EmbedFields { - if strings.HasPrefix(embed.Type, "[]") && embed.Type != "[]byte" && !v.SQLDriver.IsPGX() { + if strings.HasPrefix(embed.Type, "[]") && embed.Type != "[]byte" && v.pqArrays() { out = append(out, "pq.Array(&"+v.Name+"."+f.Name+"."+embed.Name+")") } else { out = append(out, "&"+v.Name+"."+f.Name+"."+embed.Name) @@ -212,7 +247,7 @@ func (v QueryValue) Scan() string { continue } - if strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" && !v.SQLDriver.IsPGX() { + if strings.HasPrefix(f.Type, "[]") && f.Type != "[]byte" && v.pqArrays() { out = append(out, "pq.Array(&"+v.Name+"."+f.Name+")") } else { out = append(out, "&"+v.Name+"."+f.Name) diff --git a/internal/codegen/golang/reserved.go b/internal/codegen/golang/reserved.go index fee711c57b..e4a30c71dd 100644 --- a/internal/codegen/golang/reserved.go +++ b/internal/codegen/golang/reserved.go @@ -9,6 +9,10 @@ func escape(s string) string { func IsReserved(s string) bool { switch s { + // Not a keyword, but generated code refers to the predeclared type + // `any`, so a package-scope identifier with that name would shadow it. + case "any": + return true case "break": return true case "default": @@ -59,6 +63,8 @@ func IsReserved(s string) bool { return true case "var": return true + case "q": + return true default: return false } diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 03e2d21fcd..82059c54b7 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -1,17 +1,19 @@ package golang import ( + "bufio" "fmt" "sort" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/inflection" "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func buildEnums(req *plugin.CodeGenRequest, options *opts) []Enum { +func buildEnums(req *plugin.GenerateRequest, options *opts.Options) []Enum { var enums []Enum for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" || schema.Name == "information_schema" { @@ -26,7 +28,7 @@ func buildEnums(req *plugin.CodeGenRequest, options *opts) []Enum { } e := Enum{ - Name: StructName(enumName, req.Settings), + Name: StructName(enumName, options), Comment: enum.Comment, NameTags: map[string]string{}, ValidTags: map[string]string{}, @@ -43,7 +45,7 @@ func buildEnums(req *plugin.CodeGenRequest, options *opts) []Enum { value = fmt.Sprintf("value_%d", i) } e.Constants = append(e.Constants, Constant{ - Name: StructName(enumName+"_"+value, req.Settings), + Name: StructName(enumName+"_"+value, options), Value: v, Type: e.Name, }) @@ -58,7 +60,7 @@ func buildEnums(req *plugin.CodeGenRequest, options *opts) []Enum { return enums } -func buildStructs(req *plugin.CodeGenRequest, options *opts) []Struct { +func buildStructs(req *plugin.GenerateRequest, options *opts.Options) []Struct { var structs []Struct for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" || schema.Name == "information_schema" { @@ -80,8 +82,9 @@ func buildStructs(req *plugin.CodeGenRequest, options *opts) []Struct { } s := Struct{ Table: &plugin.Identifier{Schema: schema.Name, Name: table.Rel.Name}, - Name: StructName(structName, req.Settings), + Name: StructName(structName, options), Comment: table.Comment, + IsModel: true, } for _, column := range table.Columns { tags := map[string]string{} @@ -91,9 +94,9 @@ func buildStructs(req *plugin.CodeGenRequest, options *opts) []Struct { if options.EmitJsonTags { tags["json"] = JSONTagName(column.Name, options) } - addExtraGoStructTags(tags, req, column) + addExtraGoStructTags(tags, req, options, column) s.Fields = append(s.Fields, Field{ - Name: StructName(column.Name, req.Settings), + Name: StructName(column.Name, options), Type: goType(req, options, column), Tags: tags, Comment: column.Comment, @@ -112,6 +115,9 @@ type goColumn struct { id int *plugin.Column embed *goEmbed + // paramName is the name of the placeholder a parameter is bound by, + // when the query names it. + paramName string } type goEmbed struct { @@ -139,9 +145,7 @@ func newGoEmbed(embed *plugin.Identifier, structs []Struct, defaultSchema string } fields := make([]Field, len(s.Fields)) - for i, f := range s.Fields { - fields[i] = f - } + copy(fields, s.Fields) return &goEmbed{ modelType: s.Name, @@ -168,20 +172,22 @@ func paramName(p *plugin.Parameter) string { } func argName(name string) string { - out := "" + var out strings.Builder for i, p := range strings.Split(name, "_") { if i == 0 { - out += strings.ToLower(p) + out.WriteString(strings.ToLower(p)) } else if p == "id" { - out += "ID" + out.WriteString("ID") } else { - out += strings.Title(p) + out.WriteString(strings.Title(p)) } } - return out + return out.String() } -func buildQueries(req *plugin.CodeGenRequest, options *opts, structs []Struct) ([]Query, error) { +func buildQueries(req *plugin.GenerateRequest, options *opts.Options, enums []Enum, structs []Struct) ([]Query, error) { + models := buildModelTypeSet(enums, structs) + qualifier := options.ModelsTypeQualifier() qs := make([]Query, 0, len(req.Queries)) for _, query := range req.Queries { if query.Name == "" { @@ -195,7 +201,23 @@ func buildQueries(req *plugin.CodeGenRequest, options *opts, structs []Struct) ( if options.EmitExportedQueries { constantName = sdk.Title(query.Name) } else { - constantName = sdk.LowerTitle(query.Name) + constantName = escape(sdk.LowerTitle(query.Name)) + } + + comments := query.Comments + if options.EmitSqlAsComment { + if len(comments) == 0 { + comments = append(comments, query.Name) + } + comments = append(comments, " ") + scanner := bufio.NewScanner(strings.NewReader(query.Text)) + for scanner.Scan() { + line := scanner.Text() + comments = append(comments, " "+line) + } + if err := scanner.Err(); err != nil { + return nil, err + } } gq := Query{ @@ -205,43 +227,55 @@ func buildQueries(req *plugin.CodeGenRequest, options *opts, structs []Struct) ( MethodName: query.Name, SourceName: query.Filename, SQL: query.Text, - Comments: query.Comments, + Comments: comments, Table: query.InsertIntoTable, } sqlpkg := parseDriver(options.SqlPackage) qpl := int(*options.QueryParameterLimit) + namedArgs := placeholdersAreNamed(query.Params) + if len(query.Params) == 1 && qpl != 0 { p := query.Params[0] gq.Arg = QueryValue{ - Name: escape(paramName(p)), - DBName: p.Column.GetName(), - Typ: goType(req, options, p.Column), - SQLDriver: sqlpkg, - Column: p.Column, + Name: escape(paramName(p)), + DBName: p.Column.GetName(), + ParamName: p.Name, + Typ: qualifyType(goParamType(req, options, p.Column), models, qualifier), + SQLDriver: sqlpkg, + Engine: req.Settings.Engine, + NamedArgs: namedArgs, + ModelQualifier: qualifier, + Column: p.Column, } } else if len(query.Params) >= 1 { var cols []goColumn for _, p := range query.Params { cols = append(cols, goColumn{ - id: int(p.Number), - Column: p.Column, + id: int(p.Number), + Column: p.Column, + paramName: p.Name, }) } - s, err := columnsToStruct(req, options, gq.MethodName+"Params", cols, false) + s, err := columnsToStruct(req, options, gq.MethodName+"Params", cols, false, models, qualifier) if err != nil { return nil, err } gq.Arg = QueryValue{ - Emit: true, - Name: "arg", - Struct: s, - SQLDriver: sqlpkg, - EmitPointer: options.EmitParamsStructPointers, + Emit: true, + Name: "arg", + Struct: s, + SQLDriver: sqlpkg, + Engine: req.Settings.Engine, + NamedArgs: namedArgs, + EmitPointer: options.EmitParamsStructPointers, + ModelQualifier: qualifier, } - if len(query.Params) <= qpl { + // if query params is 2, and query params limit is 4 AND this is a copyfrom, we still want to emit the query's model + // otherwise we end up with a copyfrom using a struct without the struct definition + if len(query.Params) <= qpl && query.Cmd != ":copyfrom" { gq.Arg.Emit = false } } @@ -250,11 +284,31 @@ func buildQueries(req *plugin.CodeGenRequest, options *opts, structs []Struct) ( c := query.Columns[0] name := columnName(c, 0) name = strings.Replace(name, "$", "_", -1) + retName := escape(name) + // For :one queries the scan destination lives in the same scope as + // the query parameters, so reusing a parameter's name would cause + // Scan to overwrite the input and leak it back to the caller on + // sql.ErrNoRows (see sqlc-dev/sqlc#4354). Rename the return + // variable when it would collide. + if query.Cmd == metadata.CmdOne { + argNames := map[string]struct{}{} + for _, p := range gq.Arg.Pairs() { + argNames[p.Name] = struct{}{} + } + for { + if _, conflict := argNames[retName]; !conflict { + break + } + retName += "_2" + } + } gq.Ret = QueryValue{ - Name: escape(name), - DBName: name, - Typ: goType(req, options, c), - SQLDriver: sqlpkg, + Name: retName, + DBName: name, + Typ: qualifyType(goType(req, options, c), models, qualifier), + SQLDriver: sqlpkg, + Engine: req.Settings.Engine, + ModelQualifier: qualifier, } } else if putOutColumns(query) { var gs *Struct @@ -267,7 +321,7 @@ func buildQueries(req *plugin.CodeGenRequest, options *opts, structs []Struct) ( same := true for i, f := range s.Fields { c := query.Columns[i] - sameName := f.Name == StructName(columnName(c, i), req.Settings) + sameName := f.Name == StructName(columnName(c, i), options) sameType := f.Type == goType(req, options, c) sameTable := sdk.SameTableName(c.Table, s.Table, req.Catalog.DefaultSchema) if !sameName || !sameType || !sameTable { @@ -290,18 +344,20 @@ func buildQueries(req *plugin.CodeGenRequest, options *opts, structs []Struct) ( }) } var err error - gs, err = columnsToStruct(req, options, gq.MethodName+"Row", columns, true) + gs, err = columnsToStruct(req, options, gq.MethodName+"Row", columns, true, models, qualifier) if err != nil { return nil, err } emit = true } gq.Ret = QueryValue{ - Emit: emit, - Name: "i", - Struct: gs, - SQLDriver: sqlpkg, - EmitPointer: options.EmitResultStructPointers, + Emit: emit, + Name: "i", + Struct: gs, + SQLDriver: sqlpkg, + Engine: req.Settings.Engine, + EmitPointer: options.EmitResultStructPointers, + ModelQualifier: qualifier, } } @@ -311,16 +367,16 @@ func buildQueries(req *plugin.CodeGenRequest, options *opts, structs []Struct) ( return qs, nil } +var cmdReturnsData = map[string]struct{}{ + metadata.CmdBatchMany: {}, + metadata.CmdBatchOne: {}, + metadata.CmdMany: {}, + metadata.CmdOne: {}, +} + func putOutColumns(query *plugin.Query) bool { - if len(query.Columns) > 0 { - return true - } - for _, allowed := range []string{metadata.CmdMany, metadata.CmdOne, metadata.CmdBatchMany} { - if query.Cmd == allowed { - return true - } - } - return false + _, found := cmdReturnsData[query.Cmd] + return found } // It's possible that this method will generate duplicate JSON tag values @@ -331,7 +387,7 @@ func putOutColumns(query *plugin.Query) bool { // JSON tags: count, count_2, count_2 // // This is unlikely to happen, so don't fix it yet -func columnsToStruct(req *plugin.CodeGenRequest, options *opts, name string, columns []goColumn, useID bool) (*Struct, error) { +func columnsToStruct(req *plugin.GenerateRequest, options *opts.Options, name string, columns []goColumn, useID bool, models modelTypeSet, qualifier string) (*Struct, error) { gs := Struct{ Name: name, } @@ -347,7 +403,7 @@ func columnsToStruct(req *plugin.CodeGenRequest, options *opts, name string, col tagName = SetCaseStyle(colName, "snake") } - fieldName := StructName(colName, req.Settings) + fieldName := StructName(colName, options) baseFieldName := fieldName // Track suffixes by the ID of the column, so that columns referring to the same numbered parameter can be // reused. @@ -369,17 +425,24 @@ func columnsToStruct(req *plugin.CodeGenRequest, options *opts, name string, col if options.EmitJsonTags { tags["json"] = JSONTagName(tagName, options) } - addExtraGoStructTags(tags, req, c.Column) + addExtraGoStructTags(tags, req, options, c.Column) f := Field{ - Name: fieldName, - DBName: colName, - Tags: tags, - Column: c.Column, + Name: fieldName, + DBName: colName, + ParamName: c.paramName, + Tags: tags, + Column: c.Column, } if c.embed == nil { - f.Type = goType(req, options, c.Column) + // A row struct is scanned into, a params struct is passed as + // arguments, and a driver can want different types for the two. + if useID { + f.Type = qualifyType(goType(req, options, c.Column), models, qualifier) + } else { + f.Type = qualifyType(goParamType(req, options, c.Column), models, qualifier) + } } else { - f.Type = c.embed.modelType + f.Type = qualifyType(c.embed.modelType, models, qualifier) f.EmbedFields = c.embed.fields } @@ -395,7 +458,7 @@ func columnsToStruct(req *plugin.CodeGenRequest, options *opts, name string, col // field with the same name has a known type, assign // the known type to the field without a known type for i, field := range gs.Fields { - if len(seen[field.Name]) > 1 && field.Type == "interface{}" { + if len(seen[field.Name]) > 1 && field.Type == "any" { for _, j := range seen[field.Name] { if i == j { continue @@ -428,3 +491,20 @@ func checkIncompatibleFieldTypes(fields []Field) error { } return nil } + +// placeholdersAreNamed reports whether every parameter of a query is bound +// by name: the compiler passes the name a placeholder carries, SQL +// Server's and Spanner's @name and ClickHouse's {name:Type}, which their +// drivers take as sql.Named. A query written with ? is bound by position, +// so nothing is named unless every parameter is. +func placeholdersAreNamed(params []*plugin.Parameter) bool { + if len(params) == 0 { + return false + } + for _, p := range params { + if p.Name == "" { + return false + } + } + return true +} diff --git a/internal/codegen/golang/result_test.go b/internal/codegen/golang/result_test.go index 4156b848e2..0c58525ec3 100644 --- a/internal/codegen/golang/result_test.go +++ b/internal/codegen/golang/result_test.go @@ -50,7 +50,7 @@ func TestPutOutColumns_ForZeroColumns(t *testing.T) { }, { cmd: metadata.CmdBatchOne, - want: false, + want: true, }, } for _, tc := range tests { diff --git a/internal/codegen/golang/sqlite_type.go b/internal/codegen/golang/sqlite_type.go index 2581197fd5..364f8c891e 100644 --- a/internal/codegen/golang/sqlite_type.go +++ b/internal/codegen/golang/sqlite_type.go @@ -4,14 +4,16 @@ import ( "log" "strings" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func sqliteType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { dt := strings.ToLower(sdk.DataType(col.Type)) notNull := col.NotNull || col.IsArray + emitPointersForNull := options.EmitPointersForNullTypes switch dt { @@ -19,6 +21,9 @@ func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { if notNull { return "int64" } + if emitPointersForNull { + return "*int64" + } return "sql.NullInt64" case "blob": @@ -28,22 +33,34 @@ func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { if notNull { return "float64" } + if emitPointersForNull { + return "*float64" + } return "sql.NullFloat64" case "boolean", "bool": if notNull { return "bool" } + if emitPointersForNull { + return "*bool" + } return "sql.NullBool" case "date", "datetime", "timestamp": if notNull { return "time.Time" } + if emitPointersForNull { + return "*time.Time" + } return "sql.NullTime" + case "json", "jsonb": + return "json.RawMessage" + case "any": - return "interface{}" + return "any" } @@ -60,12 +77,18 @@ func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { if notNull { return "string" } + if emitPointersForNull { + return "*string" + } return "sql.NullString" case strings.HasPrefix(dt, "decimal"), dt == "numeric": if notNull { return "float64" } + if emitPointersForNull { + return "*float64" + } return "sql.NullFloat64" default: @@ -73,7 +96,7 @@ func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { log.Printf("unknown SQLite type: %s\n", dt) } - return "interface{}" + return "any" } } diff --git a/internal/codegen/golang/struct.go b/internal/codegen/golang/struct.go index 31904205e1..9845c0c4fb 100644 --- a/internal/codegen/golang/struct.go +++ b/internal/codegen/golang/struct.go @@ -5,6 +5,7 @@ import ( "unicode" "unicode/utf8" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/plugin" ) @@ -13,13 +14,17 @@ type Struct struct { Name string Fields []Field Comment string + // IsModel is true for table structs that live in the models file. When + // the models file is generated into a different Go package, references + // to these types from query files must be qualified. + IsModel bool } -func StructName(name string, settings *plugin.Settings) string { - if rename := settings.Rename[name]; rename != "" { +func StructName(name string, options *opts.Options) string { + if rename := options.Rename[name]; rename != "" { return rename } - out := "" + var out strings.Builder name = strings.Map(func(r rune) rune { if unicode.IsLetter(r) { return r @@ -30,19 +35,19 @@ func StructName(name string, settings *plugin.Settings) string { return rune('_') }, name) - for _, p := range strings.Split(name, "_") { - if p == "id" { - out += "ID" + for p := range strings.SplitSeq(name, "_") { + if _, found := options.InitialismsMap[p]; found { + out.WriteString(strings.ToUpper(p)) } else { - out += strings.Title(p) + out.WriteString(strings.Title(p)) } } // If a name has a digit as its first char, prepand an underscore to make it a valid Go name. - r, _ := utf8.DecodeRuneInString(out) + r, _ := utf8.DecodeRuneInString(out.String()) if unicode.IsDigit(r) { - return "_" + out + return "_" + out.String() } else { - return out + return out.String() } } diff --git a/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl b/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl index 3bdc5d5729..e21475b148 100644 --- a/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl +++ b/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl @@ -9,11 +9,11 @@ func convertRowsFor{{.MethodName}}(w *io.PipeWriter, {{.Arg.SlicePair}}) { {{- with $arg := .Arg }} {{- range $arg.CopyFromMySQLFields}} {{- if eq .Type "string"}} - e.AppendString({{if eq (len $arg.CopyFromMySQLFields) 1}}row{{else}}row.{{.Name}}{{end}}) -{{- else if eq .Type "[]byte"}} - e.AppendBytes({{if eq (len $arg.CopyFromMySQLFields) 1}}row{{else}}row.{{.Name}}{{end}}) + e.AppendString({{if $arg.Struct}}row.{{.Name}}{{else}}row{{end}}) +{{- else if or (eq .Type "[]byte") (eq .Type "json.RawMessage")}} + e.AppendBytes({{if $arg.Struct}}row.{{.Name}}{{else}}row{{end}}) {{- else}} - e.AppendValue({{if eq (len $arg.CopyFromMySQLFields) 1}}row{{else}}row.{{.Name}}{{end}}) + e.AppendValue({{if $arg.Struct}}row.{{.Name}}{{else}}row{{end}}) {{- end}} {{- end}} {{- end}} diff --git a/internal/codegen/golang/templates/pgx/batchCode.tmpl b/internal/codegen/golang/templates/pgx/batchCode.tmpl index 93cdad48a3..cec2ddb30d 100644 --- a/internal/codegen/golang/templates/pgx/batchCode.tmpl +++ b/internal/codegen/golang/templates/pgx/batchCode.tmpl @@ -16,7 +16,7 @@ type {{.MethodName}}BatchResults struct { closed bool } -{{if .Arg.EmitStruct}} +{{if .Arg.Struct}} type {{.Arg.Type}} struct { {{- range .Arg.Struct.Fields}} {{.Name}} {{.Type}} {{if .Tag}}{{$.Q}}{{.Tag}}{{$.Q}}{{end}} {{- end}} @@ -35,7 +35,7 @@ type {{.Ret.Type}} struct { {{- range .Ret.Struct.Fields}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ if $.EmitMethodsWithDBArgument}}db DBTX,{{end}} {{.Arg.SlicePair}}) *{{.MethodName}}BatchResults { batch := &pgx.Batch{} for _, a := range {{index .Arg.Name}} { - vals := []interface{}{ + vals := []any{ {{- if .Arg.Struct }} {{- range .Arg.Struct.Fields }} a.{{.Name}}, diff --git a/internal/codegen/golang/templates/pgx/copyfromCopy.tmpl b/internal/codegen/golang/templates/pgx/copyfromCopy.tmpl index c1cfa68d1d..5c14ba359c 100644 --- a/internal/codegen/golang/templates/pgx/copyfromCopy.tmpl +++ b/internal/codegen/golang/templates/pgx/copyfromCopy.tmpl @@ -19,8 +19,8 @@ func (r *iteratorFor{{.MethodName}}) Next() bool { return len(r.rows) > 0 } -func (r iteratorFor{{.MethodName}}) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorFor{{.MethodName}}) Values() ([]any, error) { + return []any{ {{- if .Arg.Struct }} {{- range .Arg.Struct.Fields }} r.rows[0].{{.Name}}, diff --git a/internal/codegen/golang/templates/pgx/dbCode.tmpl b/internal/codegen/golang/templates/pgx/dbCode.tmpl index 236554d9f2..592ea5c504 100644 --- a/internal/codegen/golang/templates/pgx/dbCode.tmpl +++ b/internal/codegen/golang/templates/pgx/dbCode.tmpl @@ -1,9 +1,9 @@ {{define "dbCodeTemplatePgx"}} type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row {{- if .UsesCopyFrom }} CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) {{- end }} diff --git a/internal/codegen/golang/templates/pgx/queryCode.tmpl b/internal/codegen/golang/templates/pgx/queryCode.tmpl index 18de5db2ba..59a88c880a 100644 --- a/internal/codegen/golang/templates/pgx/queryCode.tmpl +++ b/internal/codegen/golang/templates/pgx/queryCode.tmpl @@ -37,6 +37,11 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.De var {{.Ret.Name}} {{.Ret.Type}} {{- end}} err := row.Scan({{.Ret.Scan}}) + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + {{- end}} return {{.Ret.ReturnName}}, err } {{end}} @@ -52,7 +57,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret. rows, err := q.db.Query(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} if err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } defer rows.Close() {{- if $.EmitEmptySlices}} @@ -63,12 +68,12 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret. for rows.Next() { var {{.Ret.Name}} {{.Ret.Type}} if err := rows.Scan({{.Ret.Scan}}); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } items = append(items, {{.Ret.ReturnName}}) } if err := rows.Err(); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return items, nil } @@ -84,7 +89,14 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) e func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) error { _, err := q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} + {{- if $.WrapErrors }} + if err != nil { + return fmt.Errorf("query {{.MethodName}}: %w", err) + } + return nil + {{- else }} return err + {{- end }} } {{end}} @@ -99,7 +111,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, er result, err := q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} if err != nil { - return 0, err + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return result.RowsAffected(), nil } @@ -110,11 +122,17 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, er {{end -}} {{- if $.EmitMethodsWithDBArgument -}} func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (pgconn.CommandTag, error) { - return db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) + {{queryRetval .}} db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- else -}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (pgconn.CommandTag, error) { - return q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) + {{queryRetval .}} q.db.Exec(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + return result, err + {{- end}} } {{end}} diff --git a/internal/codegen/golang/templates/stdlib/dbCode.tmpl b/internal/codegen/golang/templates/stdlib/dbCode.tmpl index 7433d522f6..771b1cc597 100644 --- a/internal/codegen/golang/templates/stdlib/dbCode.tmpl +++ b/internal/codegen/golang/templates/stdlib/dbCode.tmpl @@ -1,9 +1,9 @@ {{define "dbCodeTemplateStd"}} type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } {{ if .EmitMethodsWithDBArgument}} @@ -42,7 +42,7 @@ func (q *Queries) Close() error { return err } -func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (sql.Result, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) @@ -53,7 +53,7 @@ func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args . } } -func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Rows, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) @@ -64,7 +64,7 @@ func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args } } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Row) { +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Row) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) diff --git a/internal/codegen/golang/templates/stdlib/queryCode.tmpl b/internal/codegen/golang/templates/stdlib/queryCode.tmpl index cf56000ec6..8fd67f1567 100644 --- a/internal/codegen/golang/templates/stdlib/queryCode.tmpl +++ b/internal/codegen/golang/templates/stdlib/queryCode.tmpl @@ -28,6 +28,11 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} var {{.Ret.Name}} {{.Ret.Type}} {{- end}} err := row.Scan({{.Ret.Scan}}) + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + {{- end}} return {{.Ret.ReturnName}}, err } {{end}} @@ -38,7 +43,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error) { {{- template "queryCodeStdExec" . }} if err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } defer rows.Close() {{- if $.EmitEmptySlices}} @@ -49,15 +54,15 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} for rows.Next() { var {{.Ret.Name}} {{.Ret.Type}} if err := rows.Scan({{.Ret.Scan}}); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } items = append(items, {{.Ret.ReturnName}}) } if err := rows.Close(); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } if err := rows.Err(); err != nil { - return nil, err + return nil, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return items, nil } @@ -68,6 +73,11 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} {{end -}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) error { {{- template "queryCodeStdExec" . }} + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + {{- end}} return err } {{end}} @@ -78,7 +88,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) (int64, error) { {{- template "queryCodeStdExec" . }} if err != nil { - return 0, err + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return result.RowsAffected() } @@ -90,7 +100,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) (int64, error) { {{- template "queryCodeStdExec" . }} if err != nil { - return 0, err + return 0, {{if $.WrapErrors}}fmt.Errorf("query {{.MethodName}}: %w", err){{else}}err{{end}} } return result.LastInsertId() } @@ -101,6 +111,12 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} {{end -}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) (sql.Result, error) { {{- template "queryCodeStdExec" . }} + {{- if $.WrapErrors}} + if err != nil { + err = fmt.Errorf("query {{.MethodName}}: %w", err) + } + return result, err + {{- end}} } {{end}} @@ -111,7 +127,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}} {{define "queryCodeStdExec"}} {{- if .Arg.HasSqlcSlices }} query := {{.ConstantName}} - var queryParams []interface{} + var queryParams []any {{- if .Arg.Struct }} {{- $arg := .Arg }} {{- range .Arg.Struct.Fields }} diff --git a/internal/codegen/golang/templates/template.tmpl b/internal/codegen/golang/templates/template.tmpl index 29f29801c6..bb54f25042 100644 --- a/internal/codegen/golang/templates/template.tmpl +++ b/internal/codegen/golang/templates/template.tmpl @@ -3,17 +3,20 @@ //go:build {{.BuildTags}} {{end}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} +{{end}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "dbCode" . }} {{end}} @@ -33,17 +36,20 @@ import ( //go:build {{.BuildTags}} {{end}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} +{{end}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "interfaceCode" . }} {{end}} @@ -61,17 +67,20 @@ import ( //go:build {{.BuildTags}} {{end}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} +{{end}} -package {{.Package}} +package {{.ModelsPackage}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "modelsCode" . }} {{end}} @@ -87,7 +96,7 @@ const ( {{- end}} ) -func (e *{{.Name}}) Scan(src interface{}) error { +func (e *{{.Name}}) Scan(src any) error { switch s := src.(type) { case []byte: *e = {{.Name}}(s) @@ -105,7 +114,7 @@ type Null{{.Name}} struct { } // Scan implements the Scanner interface. -func (ns *Null{{.Name}}) Scan(value interface{}) error { +func (ns *Null{{.Name}}) Scan(value any) error { if value == nil { ns.{{.Name}}, ns.Valid = "", false return nil @@ -158,18 +167,20 @@ type {{.Name}} struct { {{- range .Fields}} //go:build {{.BuildTags}} {{end}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} -// source: {{.SourceName}} +{{end}}// source: {{.SourceName}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "queryCode" . }} {{end}} @@ -187,18 +198,20 @@ import ( //go:build {{.BuildTags}} {{end}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} -// source: {{.SourceName}} +{{end}}// source: {{.SourceName}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} {{template "copyfromCode" . }} {{end}} @@ -216,18 +229,21 @@ import ( //go:build {{.BuildTags}} {{end}}// Code generated by sqlc. DO NOT EDIT. -// versions: +{{if not .OmitSqlcVersion}}// versions: // sqlc {{.SqlcVersion}} -// source: {{.SourceName}} +{{end}}// source: {{.SourceName}} package {{.Package}} +{{ if hasImports .SourceName }} import ( {{range imports .SourceName}} {{range .}}{{.}} {{end}} {{end}} ) +{{end}} + {{template "batchCode" . }} {{end}} diff --git a/internal/codegen/golang/type_expr.go b/internal/codegen/golang/type_expr.go new file mode 100644 index 0000000000..c78cc963c0 --- /dev/null +++ b/internal/codegen/golang/type_expr.go @@ -0,0 +1,72 @@ +package golang + +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +// columnType is the type a mapper that reads the type expression starts +// from, and whether a value of it may be null. The expression is only +// present when the analysis core typed the column; without it the flat +// description stands in, the type name wrapped in one array per dimension, +// with the elements taken as not null the way the legacy mappers do. +func columnType(col *plugin.Column) (*plugin.TypeExpr, bool) { + if col.TypeExpr != nil { + return col.TypeExpr, !col.NotNull + } + t := &plugin.TypeExpr{Name: col.Type.GetName()} + dims := int(col.ArrayDims) + if col.IsArray && dims == 0 { + dims = 1 + } + for range dims { + t = &plugin.TypeExpr{Name: "array", Args: []*plugin.TypeArg{{Value: &plugin.TypeArg_Type{Type: t}}}} + } + return t, !col.NotNull +} + +// typeExprName is the type's name as the mappers switch on it. +func typeExprName(t *plugin.TypeExpr) string { + return strings.ToLower(t.GetName()) +} + +// typeExprArg is the i-th argument that is itself a type, or nil. +func typeExprArg(t *plugin.TypeExpr, i int) *plugin.TypeExpr { + n := 0 + for _, arg := range t.GetArgs() { + if arg.GetType() == nil { + continue + } + if n == i { + return arg.GetType() + } + n++ + } + return nil +} + +// typeExprLastArg is the last argument that is a type, or nil. +func typeExprLastArg(t *plugin.TypeExpr) *plugin.TypeExpr { + var last *plugin.TypeExpr + for _, arg := range t.GetArgs() { + if arg.GetType() != nil { + last = arg.GetType() + } + } + return last +} + +// nullableGoType is typ for a value that cannot be null, and for one that +// can, a pointer to it when the options say so or when nullTyp, the +// Null-prefixed wrapper the type has, is empty. +func nullableGoType(options *opts.Options, nullable bool, typ, nullTyp string) string { + if !nullable { + return typ + } + if options.EmitPointersForNullTypes || nullTyp == "" { + return "*" + typ + } + return nullTyp +} diff --git a/internal/codegen/json/gen.go b/internal/codegen/json/gen.go index b7e4057780..ad797efd92 100644 --- a/internal/codegen/json/gen.go +++ b/internal/codegen/json/gen.go @@ -11,7 +11,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/plugin" ) -func parseOptions(req *plugin.CodeGenRequest) (*opts, error) { +func parseOptions(req *plugin.GenerateRequest) (*opts, error) { if len(req.PluginOptions) == 0 { return new(opts), nil } @@ -25,7 +25,7 @@ func parseOptions(req *plugin.CodeGenRequest) (*opts, error) { return options, nil } -func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { options, err := parseOptions(req) if err != nil { return nil, err @@ -57,7 +57,7 @@ func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenR if err != nil { return nil, err } - return &plugin.CodeGenResponse{ + return &plugin.GenerateResponse{ Files: []*plugin.File{ { Name: filename, diff --git a/internal/codegen/sdk/sdk.go b/internal/codegen/sdk/sdk.go index 415cbaaec5..53e3fc6a9f 100644 --- a/internal/codegen/sdk/sdk.go +++ b/internal/codegen/sdk/sdk.go @@ -21,32 +21,6 @@ func MatchString(pat, target string) bool { return matcher.MatchString(target) } -func Matches(o *plugin.Override, n *plugin.Identifier, defaultSchema string) bool { - if n == nil { - return false - } - schema := n.Schema - if n.Schema == "" { - schema = defaultSchema - } - if o.Table.Catalog != "" && !MatchString(o.Table.Catalog, n.Catalog) { - return false - } - if o.Table.Schema == "" && schema != "" { - return false - } - if o.Table.Schema != "" && !MatchString(o.Table.Schema, schema) { - return false - } - if o.Table.Name == "" && n.Name != "" { - return false - } - if o.Table.Name != "" && !MatchString(o.Table.Name, n.Name) { - return false - } - return true -} - func SameTableName(tableID, f *plugin.Identifier, defaultSchema string) bool { if tableID == nil { return false diff --git a/internal/codegen/sdk/utils.go b/internal/codegen/sdk/utils.go index 1dffda9e7e..ec4a4e5ab4 100644 --- a/internal/codegen/sdk/utils.go +++ b/internal/codegen/sdk/utils.go @@ -23,12 +23,14 @@ func Title(s string) string { // a backtick, replace it the following way: // // input: -// SELECT `group` FROM foo +// +// SELECT `group` FROM foo // // output: -// SELECT ` + "`" + `group` + "`" + ` FROM foo // -// The escaped string must be rendered inside an existing string literal +// SELECT ` + "`" + `group` + "`" + ` FROM foo +// +// # The escaped string must be rendered inside an existing string literal // // A string cannot be escaped twice func EscapeBacktick(s string) string { diff --git a/internal/compiler/analyze.go b/internal/compiler/analyze.go index 739cd07993..020f7865aa 100644 --- a/internal/compiler/analyze.go +++ b/internal/compiler/analyze.go @@ -3,25 +3,47 @@ package compiler import ( "sort" - "github.com/sqlc-dev/sqlc/internal/analyzer" + analyzer "github.com/sqlc-dev/sqlc/internal/analysis" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/named" - "github.com/sqlc-dev/sqlc/internal/sql/rewrite" + "github.com/sqlc-dev/sqlc/internal/sql/preprocess" "github.com/sqlc-dev/sqlc/internal/sql/validate" ) type analysis struct { - Table *ast.TableName - Columns []*Column - QueryCatalog *QueryCatalog - Parameters []Parameter - Named *named.ParamSet - Query string + Table *ast.TableName + Columns []*Column + Parameters []Parameter + Named *named.ParamSet + Query string } -func convertColumn(c analyzer.Column) *Column { +func convertTableName(id *analyzer.Identifier) *ast.TableName { + if id == nil { + return nil + } + return &ast.TableName{ + Catalog: id.Catalog, + Schema: id.Schema, + Name: id.Name, + } +} + +func convertTypeName(id *analyzer.Identifier) *ast.TypeName { + if id == nil { + return nil + } + return &ast.TypeName{ + Catalog: id.Catalog, + Schema: id.Schema, + Name: id.Name, + } +} + +func convertColumn(c *analyzer.Column) *Column { + length := int(c.Length) return &Column{ Name: c.Name, OriginalName: c.OriginalName, @@ -29,16 +51,16 @@ func convertColumn(c analyzer.Column) *Column { NotNull: c.NotNull, Unsigned: c.Unsigned, IsArray: c.IsArray, - ArrayDims: c.ArrayDims, + ArrayDims: int(c.ArrayDims), Comment: c.Comment, - Length: c.Length, + Length: &length, IsNamedParam: c.IsNamedParam, IsFuncCall: c.IsFuncCall, Scope: c.Scope, - Table: c.Table, + Table: convertTableName(c.Table), TableAlias: c.TableAlias, - Type: c.Type, - EmbedTable: c.EmbedTable, + Type: convertTypeName(c.Type), + EmbedTable: convertTableName(c.EmbedTable), IsSqlcSlice: c.IsSqlcSlice, } } @@ -51,13 +73,19 @@ func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis { var params []Parameter for _, p := range a.Params { params = append(params, Parameter{ - Number: p.Number, - Column: convertColumn(*p.Column), + Number: int(p.Number), + Column: convertColumn(p.Column), }) } if len(prev.Columns) == len(cols) { for i := range prev.Columns { - prev.Columns[i].DataType = cols[i].DataType + // Only override column types if the analyzer provides a specific type + // (not "any"), since the catalog-based inference may have better info + if cols[i].DataType != "any" { + prev.Columns[i].DataType = cols[i].DataType + prev.Columns[i].IsArray = cols[i].IsArray + prev.Columns[i].ArrayDims = cols[i].ArrayDims + } } } else { embedding := false @@ -72,7 +100,13 @@ func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis { } if len(prev.Parameters) == len(params) { for i := range prev.Parameters { - prev.Parameters[i].Column.DataType = params[i].Column.DataType + // Only override parameter types if the analyzer provides a specific type + // (not "any"), since the catalog-based inference may have better info + if params[i].Column.DataType != "any" { + prev.Parameters[i].Column.DataType = params[i].Column.DataType + prev.Parameters[i].Column.IsArray = params[i].Column.IsArray + prev.Parameters[i].Column.ArrayDims = params[i].Column.ArrayDims + } } } else { prev.Parameters = params @@ -80,15 +114,15 @@ func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis { return prev } -func (c *Compiler) analyzeQuery(raw *ast.RawStmt, query string) (*analysis, error) { - return c._analyzeQuery(raw, query, true) +func (c *Compiler) analyzeQuery(raw *ast.RawStmt, query string, pre *preprocess.Statement) (*analysis, error) { + return c._analyzeQuery(raw, query, pre, true) } -func (c *Compiler) inferQuery(raw *ast.RawStmt, query string) (*analysis, error) { - return c._analyzeQuery(raw, query, false) +func (c *Compiler) inferQuery(raw *ast.RawStmt, query string, pre *preprocess.Statement) (*analysis, error) { + return c._analyzeQuery(raw, query, pre, false) } -func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) (*analysis, error) { +func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, pre *preprocess.Statement, failfast bool) (*analysis, error) { errors := make([]error, 0) check := func(err error) error { if failfast { @@ -100,35 +134,22 @@ func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) return nil } - numbers, dollar, err := validate.ParamRef(raw) - if err := check(err); err != nil { + dollar := pre.Dollar + if err := check(pre.ParamErr); err != nil { return nil, err } - raw, namedParams, edits := rewrite.NamedParameters(c.conf.Engine, raw, numbers, dollar) + namedParams := pre.Params var table *ast.TableName switch n := raw.Stmt.(type) { - case *ast.CallStmt: - case *ast.SelectStmt: - case *ast.DeleteStmt: - case *ast.DoStmt: case *ast.InsertStmt: - if err := check(validate.InsertStmt(n)); err != nil { - return nil, err - } var err error table, err = ParseTableName(n.Relation) if err := check(err); err != nil { return nil, err } - case *ast.ListenStmt: - case *ast.NotifyStmt: - case *ast.TruncateStmt: - case *ast.UpdateStmt: - case *ast.RefreshMatViewStmt: - default: - if err := check(ErrUnsupportedStatementType); err != nil { + if err := check(validate.InsertStmt(c.catalog, table, n)); err != nil { return nil, err } } @@ -137,7 +158,7 @@ func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) return nil, err } - if err := check(validate.In(c.catalog, raw)); err != nil { + if err := check(validate.Slice(raw, pre.Slices)); err != nil { return nil, err } rvs := rangeVars(raw.Stmt) @@ -154,7 +175,7 @@ func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) } else { sort.Slice(refs, func(i, j int) bool { return refs[i].ref.Number < refs[j].ref.Number }) } - raw, embeds := rewrite.Embeds(raw) + embeds := pre.Embeds qc, err := c.buildQueryCatalog(c.catalog, raw.Stmt, embeds) if err := check(err); err != nil { return nil, err @@ -169,11 +190,10 @@ func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) return nil, err } - expandEdits, err := c.expand(qc, raw) + edits, err := c.expand(qc, raw) if check(err); err != nil { return nil, err } - edits = append(edits, expandEdits...) expanded, err := source.Mutate(query, edits) if err != nil { return nil, err @@ -185,11 +205,10 @@ func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) } return &analysis{ - Table: table, - Columns: cols, - Parameters: params, - QueryCatalog: qc, - Query: expanded, - Named: namedParams, + Table: table, + Columns: cols, + Parameters: params, + Query: expanded, + Named: namedParams, }, rerr } diff --git a/internal/compiler/catalog_core.go b/internal/compiler/catalog_core.go new file mode 100644 index 0000000000..5afccdccc9 --- /dev/null +++ b/internal/compiler/catalog_core.go @@ -0,0 +1,66 @@ +package compiler + +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +// coreResultCatalog dumps the core catalog into the legacy catalog shape a +// Result carries, so codegen sees the same table models either way a query +// set was analyzed. Only relations make the trip: codegen reads tables and +// their columns to build models, and none of the types, functions or +// operators the core catalog also holds. +func coreResultCatalog(c *core.Catalog) (*catalog.Catalog, error) { + cat := catalog.New("public") + namespaces, err := c.Namespaces() + if err != nil { + return nil, err + } + for _, ns := range namespaces { + schema := &catalog.Schema{Name: ns.Name} + tables, err := c.TablesInNamespace(ns.OID) + if err != nil { + return nil, err + } + for _, table := range tables { + cols, err := c.ClassCodegenColumns(table.OID) + if err != nil { + return nil, err + } + t := &catalog.Table{Rel: &ast.TableName{Schema: ns.Name, Name: table.Name}} + for _, col := range cols { + // Codegen reads a data type and an array flag, and renders + // a "[]" per dimension, so an array of arrays of integers + // is the type integer with two dimensions. + expr, err := c.TypeExprOf(col.TypeOID) + if err != nil { + return nil, err + } + inner := expr.Innermost() + column := &catalog.Column{ + Name: col.Name, + Type: ast.TypeName{Name: strings.TrimSuffix(inner.Name, " unsigned")}, + IsNotNull: col.NotNull, + IsArray: expr.IsArray(), + ArrayDims: expr.ArrayDims(), + IsUnsigned: strings.HasSuffix(inner.Name, " unsigned"), + // The expression says whether a value may be null the + // way a query's result column does, from the column's + // constraint. + TypeExpr: expr.WithNullable(!col.NotNull), + } + if len(inner.Args) > 0 && inner.Args[0].Int != nil { + l := int(*inner.Args[0].Int) + column.Length = &l + } + t.Columns = append(t.Columns, column) + } + schema.Tables = append(schema.Tables, t) + } + cat.Schemas = append(cat.Schemas, schema) + } + return cat, nil +} diff --git a/internal/compiler/compile.go b/internal/compiler/compile.go index a6744fc6d2..b6f703d1cb 100644 --- a/internal/compiler/compile.go +++ b/internal/compiler/compile.go @@ -6,13 +6,20 @@ import ( "io" "os" "path/filepath" + "runtime" "strings" - "github.com/sqlc-dev/sqlc/internal/metadata" + "golang.org/x/sync/errgroup" + + "github.com/sqlc-dev/sqlc/internal/core" + coreschema "github.com/sqlc-dev/sqlc/internal/core/schema" "github.com/sqlc-dev/sqlc/internal/migrations" "github.com/sqlc-dev/sqlc/internal/multierr" "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/rpc" + "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/preprocess" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" ) @@ -20,50 +27,148 @@ import ( // TODO: Rename this interface Engine type Parser interface { Parse(io.Reader) ([]ast.Statement, error) - CommentSyntax() metadata.CommentSyntax + CommentSyntax() source.CommentSyntax IsReservedKeyword(string) bool } +// schemaFile is a schema file's contents, after the rewrites that are applied +// before any of it is parsed. +type schemaFile struct { + name string + contents string +} + func (c *Compiler) parseCatalog(schemas []string) error { - files, err := sqlpath.Glob(schemas) + paths, err := sqlpath.Glob(schemas) if err != nil { return err } + merr := multierr.New() - for _, filename := range files { - blob, err := os.ReadFile(filename) + files := make([]schemaFile, 0, len(paths)) + for _, path := range paths { + blob, err := os.ReadFile(path) if err != nil { - merr.Add(filename, "", 0, err) + merr.Add(path, "", 0, err) continue } contents := migrations.RemoveRollbackStatements(string(blob)) + contents = migrations.RemovePsqlMetaCommands(contents) + files = append(files, schemaFile{name: path, contents: contents}) c.schema = append(c.schema, contents) - stmts, err := c.parser.Parse(strings.NewReader(contents)) + } + + if c.coreAnalysis { + // A schema file that could not be read is not part of the schema the + // action was keyed on, so there is no catalog to restore and nothing + // further to report. + if len(merr.Errs()) > 0 { + return merr + } + if err := c.parseCatalogCore(files, merr); err != nil { + return err + } + } else { + c.parseCatalogLegacy(files, merr) + } + + if len(merr.Errs()) > 0 { + return merr + } + return nil +} + +func (c *Compiler) parseCatalogLegacy(files []schemaFile, merr *multierr.Error) { + for _, file := range files { + stmts, err := c.parser.Parse(strings.NewReader(file.contents)) if err != nil { - merr.Add(filename, contents, 0, err) + // A schema file and a query file are often the same file, so a + // query's sqlc syntax can fail here. Look for an explanation + // before reporting the syntax error it caused. + if reported := addSyntaxErrors(merr, file.name, file.contents, preprocess.File(c.conf.Engine, file.contents)); !reported { + merr.Add(file.name, file.contents, 0, err) + } continue } + for i := range stmts { if err := c.catalog.Update(stmts[i], c); err != nil { - merr.Add(filename, contents, stmts[i].Pos(), err) + merr.Add(file.name, file.contents, stmts[i].Pos(), err) continue } } } - if len(merr.Errs()) > 0 { - return merr +} + +// parseCatalogCore builds the catalog the analysis core works against: the +// dialect's seed with the schema's DDL applied. The two are one cached action, +// so a run that has built this catalog before restores it and never parses the +// schema at all. +func (c *Compiler) parseCatalogCore(files []schemaFile, merr *multierr.Error) error { + contents := make([]string, 0, len(files)) + for _, file := range files { + contents = append(contents, file.contents) } + + cat, err := core.NewCached(string(c.conf.Engine), contents, func(cat *core.Catalog) error { + for _, file := range files { + stmts, err := c.parser.Parse(strings.NewReader(file.contents)) + if err != nil { + // A schema file and a query file are often the same file, so a + // query's sqlc syntax can fail here. Look for an explanation + // before reporting the syntax error it caused. + if reported := addSyntaxErrors(merr, file.name, file.contents, preprocess.File(c.conf.Engine, file.contents)); !reported { + merr.Add(file.name, file.contents, 0, err) + } + continue + } + for i := range stmts { + if err := coreschema.Apply(cat, stmts[i].Raw); err != nil { + merr.Add(file.name, file.contents, stmts[i].Pos(), err) + continue + } + } + } + // A catalog the whole schema did not make it into is not the catalog + // this action describes, so it is not one to keep. + if len(merr.Errs()) > 0 { + return merr + } + return nil + }, c.coreDialect) + + if cat == nil { + return fmt.Errorf("%s: init catalog: %w", c.conf.Engine, err) + } + // Whatever apply reported is already in merr, which the caller returns. + c.coreCatalog = cat + + // Codegen consumes the catalog through the Result, in the legacy shape. + legacy, err := coreResultCatalog(cat) + if err != nil { + return fmt.Errorf("%s: dump catalog: %w", c.conf.Engine, err) + } + c.catalog = legacy return nil } +// statement is a parsed query awaiting analysis, with what error reporting +// needs to place it back in the file it came from. +type statement struct { + filename string + src string + pp *preprocess.Result + raw *ast.RawStmt +} + func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { - var q []*Query merr := multierr.New() - set := map[string]struct{}{} files, err := sqlpath.Glob(c.conf.Queries) if err != nil { return nil, err } + + var stmts []statement for _, filename := range files { blob, err := os.ReadFile(filename) if err != nil { @@ -71,46 +176,125 @@ func (c *Compiler) parseQueries(o opts.Parser) (*Result, error) { continue } src := string(blob) - stmts, err := c.parser.Parse(strings.NewReader(src)) + + // sqlc syntax is not SQL. Rewrite it to native placeholders before the + // engine parser ever sees the query, so parsers only handle SQL. + pp := preprocess.File(c.conf.Engine, src) + + parsed, err := c.parser.Parse(strings.NewReader(pp.Text)) if err != nil { - merr.Add(filename, src, 0, err) + if reported := addSyntaxErrors(merr, filename, src, pp); !reported { + merr.Add(filename, src, 0, err) + } continue } - for _, stmt := range stmts { - query, err := c.parseQuery(stmt.Raw, src, o) - if err == ErrUnsupportedStatementType { - continue + for _, stmt := range parsed { + stmts = append(stmts, statement{filename: filename, src: src, pp: pp, raw: stmt.Raw}) + } + } + + queries, errs := c.analyzeStatements(stmts, o) + + var q []*Query + set := map[string]struct{}{} + for i, stmt := range stmts { + if err := errs[i]; err != nil { + var e *sqlerr.Error + loc := stmt.raw.Pos() + if errors.As(err, &e) && e.Location != 0 { + loc = e.Location } - if err != nil { - var e *sqlerr.Error - loc := stmt.Raw.Pos() - if errors.As(err, &e) && e.Location != 0 { - loc = e.Location - } - merr.Add(filename, src, loc, err) - continue + // Locations are reported against the rewritten query; map them + // back so errors point at what the user wrote. + loc = stmt.pp.Origin(loc) + if e != nil && e.Location != 0 { + e.Location = loc } - if query.Name != "" { - if _, exists := set[query.Name]; exists { - merr.Add(filename, src, stmt.Raw.Pos(), fmt.Errorf("duplicate query name: %s", query.Name)) - continue - } - set[query.Name] = struct{}{} + merr.Add(stmt.filename, stmt.src, loc, err) + // If this rpc unauthenticated error bubbles up, then all future parsing/analysis will fail + if errors.Is(err, rpc.ErrUnauthenticated) { + return nil, merr } - query.Filename = filepath.Base(filename) - if query != nil { - q = append(q, query) + continue + } + query := queries[i] + if query == nil { + continue + } + query.Metadata.Filename = filepath.Base(stmt.filename) + queryName := query.Metadata.Name + if queryName != "" { + if _, exists := set[queryName]; exists { + merr.Add(stmt.filename, stmt.src, stmt.pp.Origin(stmt.raw.Pos()), fmt.Errorf("duplicate query name: %s", queryName)) + continue } + set[queryName] = struct{}{} } + q = append(q, query) } + if len(merr.Errs()) > 0 { return nil, merr } if len(q) == 0 { return nil, fmt.Errorf("no queries contained in paths %s", strings.Join(c.conf.Queries, ",")) } + return &Result{ Catalog: c.catalog, Queries: q, }, nil } + +// analyzeStatements analyzes each statement, returning the results in the +// order the statements were given so that queries and errors come out in +// source order however they were produced. +// +// The analysis core reads the catalog and nothing else, so its statements are +// analyzed concurrently. Every other path holds state that a second goroutine +// would race — a database connection, the legacy catalog — and stays serial. +func (c *Compiler) analyzeStatements(stmts []statement, o opts.Parser) ([]*Query, []error) { + queries := make([]*Query, len(stmts)) + errs := make([]error, len(stmts)) + + analyze := func(i int) { + queries[i], errs[i] = c.parseQuery(stmts[i].raw, stmts[i].pp, o) + } + + workers := runtime.GOMAXPROCS(0) + if !c.coreAnalysis || workers < 2 || len(stmts) < 2 { + for i := range stmts { + analyze(i) + } + return queries, errs + } + + var g errgroup.Group + g.SetLimit(workers) + for i := range stmts { + g.Go(func() error { + analyze(i) + return nil + }) + } + g.Wait() + return queries, errs +} + +func addSyntaxErrors(merr *multierr.Error, filename, src string, pp *preprocess.Result) bool { + var found bool + for _, stmt := range pp.Statements() { + if stmt.Err == nil { + continue + } + found = true + loc := pp.Origin(stmt.Start) + var e *sqlerr.Error + if errors.As(stmt.Err, &e) && e.Location != 0 { + loc = pp.Origin(e.Location) + e.Location = loc + } + merr.Add(filename, src, loc, stmt.Err) + } + return found +} diff --git a/internal/compiler/engine.go b/internal/compiler/engine.go index bbef2f00d5..959207b12f 100644 --- a/internal/compiler/engine.go +++ b/internal/compiler/engine.go @@ -6,13 +6,18 @@ import ( "github.com/sqlc-dev/sqlc/internal/analyzer" "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/engine/clickhouse" "github.com/sqlc-dev/sqlc/internal/engine/dolphin" + "github.com/sqlc-dev/sqlc/internal/engine/duckdb" + "github.com/sqlc-dev/sqlc/internal/engine/googlesql" + "github.com/sqlc-dev/sqlc/internal/engine/mssql" "github.com/sqlc-dev/sqlc/internal/engine/postgresql" pganalyze "github.com/sqlc-dev/sqlc/internal/engine/postgresql/analyzer" "github.com/sqlc-dev/sqlc/internal/engine/sqlite" + sqliteanalyze "github.com/sqlc-dev/sqlc/internal/engine/sqlite/analyzer" "github.com/sqlc-dev/sqlc/internal/opts" - "github.com/sqlc-dev/sqlc/internal/quickdb" - pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) @@ -23,43 +28,143 @@ type Compiler struct { parser Parser result *Result analyzer analyzer.Analyzer - client pb.QuickClient + client dbmanager.Client + selector selector + + coreCatalog *core.Catalog + + // coreAnalysis routes every engine through the core catalog and analyzer, + // and coreDialect seeds the catalog it does so with. The catalog itself is + // not built until the schema is loaded, because the two are cached + // together. + coreAnalysis bool + coreDialect core.Option + + // newParser builds a parser for the configured engine, and is set for + // every engine either path supports. The core path analyzes statements + // concurrently, and a parser holds enough state that two goroutines cannot + // share one, so a goroutine that has to parse something of its own — the + // query text it just rewrote — builds its own rather than taking c.parser. + newParser func() Parser schema []string } -func NewCompiler(conf config.SQL, combo config.CombinedSettings) (*Compiler, error) { +// Option configures a Compiler. +type Option func(*Compiler) + +// WithCoreAnalysis analyzes queries with the core catalog and analyzer rather +// than each engine's own analysis path. ClickHouse and GoogleSQL always do; +// this opts the remaining engines in. +func WithCoreAnalysis() Option { + return func(c *Compiler) { c.coreAnalysis = true } +} + +func NewCompiler(conf config.SQL, combo config.CombinedSettings, parserOpts opts.Parser, options ...Option) (*Compiler, error) { c := &Compiler{conf: conf, combo: combo} + for _, o := range options { + o(c) + } - if conf.Database != nil && conf.Database.Managed { - client, err := quickdb.NewClientFromConfig(combo.Global.Cloud) - if err != nil { - return nil, fmt.Errorf("client error: %w", err) + // ClickHouse, GoogleSQL, SQL Server and DuckDB have no legacy analysis + // path to fall back to. + switch conf.Engine { + case config.EngineClickHouse, config.EngineGoogleSQL, config.EngineMSSQL, config.EngineDuckDB: + c.coreAnalysis = true + } + if c.coreAnalysis { + if err := c.initCore(); err != nil { + return nil, err } + return c, nil + } + + if conf.Database != nil && conf.Database.Managed { + client := dbmanager.NewClient(combo.Global.Servers) c.client = client } switch conf.Engine { case config.EngineSQLite: - c.parser = sqlite.NewParser() + c.newParser = func() Parser { return sqlite.NewParser() } c.catalog = sqlite.NewCatalog() + c.selector = newSQLiteSelector() + + if conf.Database != nil { + if conf.Analyzer.Database == nil || *conf.Analyzer.Database { + c.analyzer = analyzer.Cached( + sqliteanalyze.New(*conf.Database), + combo.Global, + *conf.Database, + ) + } + } case config.EngineMySQL: - c.parser = dolphin.NewParser() + c.newParser = func() Parser { return dolphin.NewParser() } c.catalog = dolphin.NewCatalog() + c.selector = newDefaultSelector() case config.EnginePostgreSQL: - c.parser = postgresql.NewParser() + c.newParser = func() Parser { return postgresql.NewParser() } c.catalog = postgresql.NewCatalog() + c.selector = newDefaultSelector() + if conf.Database != nil { if conf.Analyzer.Database == nil || *conf.Analyzer.Database { - c.analyzer = pganalyze.New(c.client, *conf.Database) + c.analyzer = analyzer.Cached( + pganalyze.New(c.client, *conf.Database), + combo.Global, + *conf.Database, + ) } } default: return nil, fmt.Errorf("unknown engine: %s", conf.Engine) } + c.parser = c.newParser() return c, nil } +// initCore wires up the engine's parser and a core catalog seeded with its +// dialect. No legacy catalog and no analyzer connection are involved. +func (c *Compiler) initCore() error { + var dialect core.Option + switch c.conf.Engine { + case config.EngineSQLite: + c.newParser = func() Parser { return sqlite.NewParser() } + c.selector = newSQLiteSelector() + dialect = sqlite.Dialect() + case config.EngineMySQL: + c.newParser = func() Parser { return dolphin.NewParser() } + c.selector = newDefaultSelector() + dialect = dolphin.Dialect() + case config.EnginePostgreSQL: + c.newParser = func() Parser { return postgresql.NewParser() } + c.selector = newDefaultSelector() + dialect = postgresql.Dialect() + case config.EngineClickHouse: + c.newParser = func() Parser { return clickhouse.NewParser() } + c.selector = newDefaultSelector() + dialect = clickhouse.Dialect() + case config.EngineGoogleSQL: + c.newParser = func() Parser { return googlesql.NewParser() } + c.selector = newDefaultSelector() + dialect = googlesql.Dialect() + case config.EngineMSSQL: + c.newParser = func() Parser { return mssql.NewParser() } + c.selector = newDefaultSelector() + dialect = mssql.Dialect() + case config.EngineDuckDB: + c.newParser = func() Parser { return duckdb.NewParser() } + c.selector = newDefaultSelector() + dialect = duckdb.Dialect() + default: + return fmt.Errorf("unknown engine: %s", c.conf.Engine) + } + c.parser = c.newParser() + c.coreDialect = dialect + return nil +} + func (c *Compiler) Catalog() *catalog.Catalog { return c.catalog } @@ -85,4 +190,10 @@ func (c *Compiler) Close(ctx context.Context) { if c.analyzer != nil { c.analyzer.Close(ctx) } + if c.client != nil { + c.client.Close(ctx) + } + if c.coreCatalog != nil { + c.coreCatalog.Close() + } } diff --git a/internal/compiler/expand.go b/internal/compiler/expand.go index 60e654b696..8c8a490b6d 100644 --- a/internal/compiler/expand.go +++ b/internal/compiler/expand.go @@ -78,12 +78,51 @@ func (c *Compiler) quote(x string) string { } } +// starOldFunc measures how much of the query text a star reference occupies, +// so an edit replaces the reference and nothing else. Each part is measured +// both bare and quoted: an embed was rewritten to "table.*" in the query text, +// preserving the way the user quoted the table, so it is measured the same way +// as a star reference the user wrote. +func (c *Compiler) starOldFunc(parts []string) func(string) int { + old := make([]string, 0, len(parts)) + for _, p := range parts { + if p == "*" { + old = append(old, p) + } else { + old = append(old, c.quoteIdent(p)) + } + } + return func(s string) int { + length := 0 + for i, o := range old { + if hasSeparator := i > 0; hasSeparator { + length++ + } + if strings.HasPrefix(s[length:], o) { + length += len(o) + } else if quoted := c.quote(o); strings.HasPrefix(s[length:], quoted) { + length += len(quoted) + } else { + length += len(o) + } + } + return length + } +} + func (c *Compiler) expandStmt(qc *QueryCatalog, raw *ast.RawStmt, node ast.Node) ([]source.Edit, error) { tables, err := c.sourceTables(qc, node) if err != nil { return nil, err } + // Virtual tables for the OLD and NEW aliases available in a RETURNING + // clause (PostgreSQL 18) + rtables, err := c.returningTables(qc, node) + if err != nil { + return nil, err + } + var targets *ast.List switch n := node.(type) { case *ast.DeleteStmt: @@ -131,7 +170,11 @@ func (c *Compiler) expandStmt(qc *QueryCatalog, raw *ast.RawStmt, node ast.Node) } } } - for _, t := range tables { + starTables := tables + if vt := returningTableForScope(tables, rtables, scope); vt != nil { + starTables = []*Table{vt} + } + for _, t := range starTables { if scope != "" && scope != t.Rel.Name { continue } @@ -149,47 +192,17 @@ func (c *Compiler) expandStmt(qc *QueryCatalog, raw *ast.RawStmt, node ast.Node) if counts[cname] > 1 { cname = tableName + "." + cname } - cols = append(cols, cname) - } - } - var old []string - for _, p := range parts { - if p == "*" { - old = append(old, p) - } else { - old = append(old, c.quoteIdent(p)) - } - } - - var oldString string - var oldFunc func(string) int - // use the sqlc.embed string instead - if embed, ok := qc.embeds.Find(ref); ok { - oldString = embed.Orig() - } else { - oldFunc = func(s string) int { - length := 0 - for i, o := range old { - if hasSeparator := i > 0; hasSeparator { - length++ - } - if strings.HasPrefix(s[length:], o) { - length += len(o) - } else if quoted := c.quote(o); strings.HasPrefix(s[length:], quoted) { - length += len(quoted) - } else { - length += len(o) - } - } - return length + // This is important for SQLite in particular which needs to + // wrap jsonb column values with `json(colname)` so they're in a + // publicly usable format (i.e. not jsonb). + cname = c.selector.ColumnExpr(cname, column) + cols = append(cols, cname) } } - edits = append(edits, source.Edit{ Location: res.Location - raw.StmtLocation, - Old: oldString, - OldFunc: oldFunc, + OldFunc: c.starOldFunc(parts), New: strings.Join(cols, ", "), }) } diff --git a/internal/compiler/expand_core.go b/internal/compiler/expand_core.go new file mode 100644 index 0000000000..ab818c38e1 --- /dev/null +++ b/internal/compiler/expand_core.go @@ -0,0 +1,76 @@ +package compiler + +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +// expandCore rewrites the stars in a query's text with the columns the core +// analyzer resolved them to. The analyzer has already walked the statement and +// its subqueries, so there is nothing left to look up here: what remains is +// deciding how each name is written, which is the engine's business and not +// the core's. +func (c *Compiler) expandCore(raw *ast.RawStmt, stars []core.StarExpansion) []source.Edit { + if len(stars) == 0 { + return nil + } + edits := make([]source.Edit, 0, len(stars)) + seen := make(map[int]bool, len(stars)) + for _, star := range stars { + // The analyzer types an expression again when a later clause refers to + // the output name it was given, so "SELECT (SELECT * FROM t) AS x ... + // GROUP BY x" reports the star in the subquery once per pass. The + // passes agree on what the star covers, and editing the same reference + // twice would overlap, so only the first is kept. + if seen[star.Location] { + continue + } + seen[star.Location] = true + + // Everything before the star qualifies it: "foo.*" is scoped to foo, + // while a bare "*" covers every relation in the FROM clause. + scope := strings.Join(star.Fields[:len(star.Fields)-1], ".") + + // An unqualified star that covers more than one relation may name the + // same column twice, so those are written with their relation. + counts := map[string]int{} + if scope == "" { + for _, col := range star.Columns { + counts[col.Name]++ + } + } + + cols := make([]string, 0, len(star.Columns)) + for _, col := range star.Columns { + cname := col.Name + if star.Alias != "" { + cname = star.Alias + } + cname = c.quoteIdent(cname) + if scope != "" { + cname = c.quoteIdent(scope) + "." + cname + } + if counts[cname] > 1 { + cname = c.quoteIdent(col.Relation) + "." + cname + } + + // This is important for SQLite in particular which needs to wrap + // jsonb column values with `json(colname)` so they're in a publicly + // usable format (i.e. not jsonb). + cols = append(cols, c.selector.ColumnExpr(cname, &Column{ + Name: col.Name, + DataType: col.DataType, + })) + } + + edits = append(edits, source.Edit{ + Location: star.Location - raw.StmtLocation, + OldFunc: c.starOldFunc(star.Fields), + New: strings.Join(cols, ", "), + }) + } + return edits +} diff --git a/internal/compiler/find_params.go b/internal/compiler/find_params.go index ca38199b9d..8199addd33 100644 --- a/internal/compiler/find_params.go +++ b/internal/compiler/find_params.go @@ -195,7 +195,7 @@ func (p paramSearch) Visit(node ast.Node) astutils.Visitor { if n.Sel == nil { p.parent = node } else { - if sel, ok := n.Sel.(*ast.SelectStmt); ok && sel.FromClause != nil { + if sel, ok := n.Sel.(*ast.SelectStmt); ok && sel.FromClause != nil && len(sel.FromClause.Items) > 0 { from := sel.FromClause if schema, ok := from.Items[0].(*ast.RangeVar); ok && schema != nil { p.rangeVar = &ast.RangeVar{ diff --git a/internal/compiler/output_columns.go b/internal/compiler/output_columns.go index 8dfca0c5d3..557fb7d575 100644 --- a/internal/compiler/output_columns.go +++ b/internal/compiler/output_columns.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" + "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" "github.com/sqlc-dev/sqlc/internal/sql/catalog" @@ -57,7 +58,14 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er return nil, err } - var targets *ast.List + // Virtual tables for the OLD and NEW aliases available in a RETURNING + // clause (PostgreSQL 18) + rtables, err := c.returningTables(qc, node) + if err != nil { + return nil, err + } + + targets := &ast.List{} switch n := node.(type) { case *ast.DeleteStmt: targets = n.ReturningList @@ -69,7 +77,7 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if n.GroupClause != nil { for _, item := range n.GroupClause.Items { - if err := findColumnForNode(item, tables, targets); err != nil { + if err := c.findColumnForNode(item, tables, targets); err != nil { return nil, err } } @@ -85,7 +93,7 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if !ok { continue } - if err := findColumnForNode(sb.Node, tables, targets); err != nil { + if err := c.findColumnForNode(sb.Node, tables, targets); err != nil { return nil, fmt.Errorf("%v: if you want to skip this validation, set 'strict_order_by' to false", err) } } @@ -101,7 +109,7 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if !ok { continue } - if err := findColumnForNode(caseExpr.Xpr, tables, targets); err != nil { + if err := c.findColumnForNode(caseExpr.Xpr, tables, targets); err != nil { return nil, fmt.Errorf("%v: if you want to skip this validation, set 'strict_order_by' to false", err) } } @@ -114,16 +122,8 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if isUnion { return c.outputColumns(qc, n.Larg) } - case *ast.DoStmt: - targets = &ast.List{} - case *ast.CallStmt: - targets = &ast.List{} - case *ast.TruncateStmt, *ast.RefreshMatViewStmt, *ast.NotifyStmt, *ast.ListenStmt: - targets = &ast.List{} case *ast.UpdateStmt: targets = n.ReturningList - default: - return nil, fmt.Errorf("outputColumns: unsupported node type: %T", n) } var cols []*Column @@ -158,11 +158,11 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if res.Name != nil { name = *res.Name } - switch { - case lang.IsComparisonOperator(astutils.Join(n.Name, "")): + switch op := astutils.Join(n.Name, ""); { + case lang.IsComparisonOperator(op): // TODO: Generate a name for these operations cols = append(cols, &Column{Name: name, DataType: "bool", NotNull: true}) - case lang.IsMathematicalOperator(astutils.Join(n.Name, "")): + case lang.IsMathematicalOperator(op): cols = append(cols, &Column{Name: name, DataType: "int", NotNull: true}) default: cols = append(cols, &Column{Name: name, DataType: "any", NotNull: false}) @@ -242,7 +242,7 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er continue } if ref, ok := arg.(*ast.ColumnRef); ok { - columns, err := outputColumnRefs(res, tables, ref) + columns, err := outputColumnRefs(res, tablesForRef(ref, tables, rtables), ref) if err != nil { return nil, err } @@ -266,7 +266,7 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if hasStarRef(n) { // add a column with a reference to an embedded table - if embed, ok := qc.embeds.Find(n); ok { + if embed, ok := qc.embeds.Find(n.Location, res.Location); ok { cols = append(cols, &Column{ Name: embed.Table.Name, EmbedTable: embed.Table, @@ -275,8 +275,12 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er } // TODO: This code is copied in func expand() - for _, t := range tables { - scope := astutils.Join(n.Fields, ".") + scope := astutils.Join(n.Fields, ".") + starTables := tables + if vt := returningTableForScope(tables, rtables, scope); vt != nil { + starTables = []*Table{vt} + } + for _, t := range starTables { if scope != "" && scope != t.Rel.Name { continue } @@ -304,7 +308,7 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er continue } - columns, err := outputColumnRefs(res, tables, n) + columns, err := outputColumnRefs(res, tablesForRef(n, tables, rtables), n) if err != nil { return nil, err } @@ -403,7 +407,8 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er continue } for _, f := range n.FromClause.Items { - if res := isTableRequired(f, col, tableRequired); res != tableNotFound { + res := isTableRequired(f, col, tableRequired) + if res != tableNotFound { col.NotNull = res == tableRequired break } @@ -423,10 +428,12 @@ const ( func isTableRequired(n ast.Node, col *Column, prior int) int { switch n := n.(type) { case *ast.RangeVar: - if n.Alias == nil && *n.Relname == col.Table.Name { - return prior + tableMatch := *n.Relname == col.Table.Name + aliasMatch := true + if n.Alias != nil && col.TableAlias != "" { + aliasMatch = *n.Alias.Aliasname == col.TableAlias } - if n.Alias != nil && *n.Alias.Aliasname == col.TableAlias && *n.Relname == col.Table.Name { + if aliasMatch && tableMatch { return prior } case *ast.JoinExpr: @@ -446,7 +453,7 @@ func isTableRequired(n ast.Node, col *Column, prior int) int { return helper(tableOptional, tableRequired) case ast.JoinTypeFull: return helper(tableOptional, tableOptional) - case ast.JoinTypeInner: + case ast.JoinTypeInner, ast.JoinTypeCross, ast.JoinTypeComma: return helper(tableRequired, tableRequired) } case *ast.List: @@ -484,10 +491,17 @@ func (r *tableVisitor) Visit(n ast.Node) astutils.Visitor { // Return an error if a table is referenced twice // Return an error if an unknown column is referenced func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, error) { - var list *ast.List + list := &ast.List{} switch n := node.(type) { case *ast.DeleteStmt: - list = n.Relations + if n.Relations != nil { + list = n.Relations + } else if n.FromClause != nil { + // Multi-table DELETE: walk FromClause to find tables + var tv tableVisitor + astutils.Walk(&tv, n.FromClause) + list = &tv.list + } case *ast.InsertStmt: list = &ast.List{ Items: []ast.Node{n.Relation}, @@ -511,19 +525,10 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro astutils.Walk(&tv, n.FromClause) astutils.Walk(&tv, n.Relations) list = &tv.list - case *ast.DoStmt: - list = &ast.List{} - case *ast.CallStmt: - list = &ast.List{} - case *ast.NotifyStmt, *ast.ListenStmt: - list = &ast.List{} - default: - return nil, fmt.Errorf("sourceTables: unsupported node type: %T", n) } var tables []*Table for _, item := range list.Items { - item := item switch n := item.(type) { case *ast.RangeFunction: @@ -550,12 +555,15 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro if err != nil { continue } - table, err := qc.GetTable(&ast.TableName{ - Catalog: fn.ReturnType.Catalog, - Schema: fn.ReturnType.Schema, - Name: fn.ReturnType.Name, - }) - if err != nil { + var table *Table + if fn.ReturnType != nil { + table, err = qc.GetTable(&ast.TableName{ + Catalog: fn.ReturnType.Catalog, + Schema: fn.ReturnType.Schema, + Name: fn.ReturnType.Name, + }) + } + if table == nil || err != nil { if n.Alias != nil && len(n.Alias.Colnames.Items) > 0 { table = &Table{} for _, colName := range n.Alias.Colnames.Items { @@ -575,12 +583,22 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro Schema: fn.Rel.Schema, Name: fn.Rel.Name, }, - Columns: []*Column{ + } + if len(fn.Outs) > 0 { + for _, arg := range fn.Outs { + table.Columns = append(table.Columns, &Column{ + Name: arg.Name, + DataType: arg.Type.Name, + }) + } + } + if fn.ReturnType != nil { + table.Columns = []*Column{ { Name: colName, DataType: fn.ReturnType.Name, }, - }, + } } } } @@ -596,9 +614,15 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro if err != nil { return nil, err } + + var tableName string + if n.Alias != nil { + tableName = *n.Alias.Aliasname + } + tables = append(tables, &Table{ Rel: &ast.TableName{ - Name: *n.Alias.Aliasname, + Name: tableName, }, Columns: cols, }) @@ -608,6 +632,9 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro if err != nil { return nil, err } + if qc == nil { + return nil, fmt.Errorf("query catalog is empty") + } table, cerr := qc.GetTable(fqn) if cerr != nil { // TODO: Update error location @@ -657,13 +684,13 @@ func outputColumnRefs(res *ast.ResTarget, tables []*Table, node *ast.ColumnRef) continue } for _, c := range t.Columns { + if c.Name == name { found += 1 cname := c.Name if res.Name != nil { cname = *res.Name } - cols = append(cols, &Column{ Name: cname, Type: c.Type, @@ -698,14 +725,36 @@ func outputColumnRefs(res *ast.ResTarget, tables []*Table, node *ast.ColumnRef) return cols, nil } -func findColumnForNode(item ast.Node, tables []*Table, targetList *ast.List) error { +func (c *Compiler) findColumnForNode(item ast.Node, tables []*Table, targetList *ast.List) error { ref, ok := item.(*ast.ColumnRef) if !ok { return nil } + if c.isImplicitColumnRef(ref) { + return nil + } return findColumnForRef(ref, tables, targetList) } +// isImplicitColumnRef reports whether ref names a column that every table in +// the dialect has without declaring it, and which therefore never appears in +// a catalog built from the schema. SQLite gives each ordinary table a rowid, +// reachable under three spellings. +func (c *Compiler) isImplicitColumnRef(ref *ast.ColumnRef) bool { + if c.conf.Engine != config.EngineSQLite { + return false + } + parts := stringSlice(ref.Fields) + if len(parts) == 0 { + return false + } + switch parts[len(parts)-1] { + case "rowid", "_rowid_", "oid": + return true + } + return false +} + func findColumnForRef(ref *ast.ColumnRef, tables []*Table, targetList *ast.List) error { parts := stringSlice(ref.Fields) var alias, name string diff --git a/internal/compiler/parse.go b/internal/compiler/parse.go index 53e3043c7d..0fcc7cee54 100644 --- a/internal/compiler/parse.go +++ b/internal/compiler/parse.go @@ -12,30 +12,41 @@ import ( "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/preprocess" "github.com/sqlc-dev/sqlc/internal/sql/validate" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" ) -var ErrUnsupportedStatementType = errors.New("parseQuery: unsupported statement type") +var debugDumpAST = sqlcdebug.New("dumpast") -func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, error) { - ctx := context.Background() +func (c *Compiler) parseQuery(stmt ast.Node, pp *preprocess.Result, o opts.Parser) (*Query, error) { + raw, ok := stmt.(*ast.RawStmt) + if !ok { + return nil, errors.New("node is not a statement") + } - if o.Debug.DumpAST { - debug.Dump(stmt) + // The preprocessor already replaced every sqlc.* construct with native SQL + // and recorded what it replaced. + pre := pp.Statement(raw.StmtLocation) + if pre.Err != nil { + return nil, pre.Err } - // validate sqlc-specific syntax - if err := validate.SqlcFunctions(stmt); err != nil { - return nil, err + // Engines number bind parameters in whatever order they convert the AST. + // Restore the numbering the preprocessor assigned in source order. + renumberParams(raw, pre.Numbers) + + if c.coreCatalog != nil { + return c.parseQueryCore(raw, pp.Text, pre) } - // rewrite queries to remove sqlc.* functions + ctx := context.Background() - raw, ok := stmt.(*ast.RawStmt) - if !ok { - return nil, errors.New("node is not a statement") + if debugDumpAST.Value() == "1" { + debug.Dump(stmt) } - rawSQL, err := source.Pluck(src, raw.StmtLocation, raw.StmtLen) + + rawSQL, err := source.Pluck(pp.Text, raw.StmtLocation, raw.StmtLen) if err != nil { return nil, err } @@ -43,18 +54,38 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, return nil, errors.New("missing semicolon at end of file") } - name, cmd, err := metadata.ParseQueryNameAndType(strings.TrimSpace(rawSQL), c.parser.CommentSyntax()) + name, cmd, err := metadata.ParseQueryNameAndType(rawSQL, metadata.CommentSyntax(c.parser.CommentSyntax())) if err != nil { return nil, err } + + if name == "" { + return nil, nil + } + if err := validate.Cmd(raw.Stmt, name, cmd); err != nil { return nil, err } + md := metadata.Metadata{ + Name: name, + Cmd: cmd, + } + + // TODO eventually can use this for name and type/cmd parsing too + cleanedComments, err := source.CleanedComments(rawSQL, c.parser.CommentSyntax()) + if err != nil { + return nil, err + } + + md.Params, md.Flags, md.RuleSkiplist, err = metadata.ParseCommentFlags(cleanedComments) + if err != nil { + return nil, err + } + var anlys *analysis if c.analyzer != nil { - // TODO: Handle panics - inference, _ := c.inferQuery(raw, rawSQL) + inference, _ := c.inferQuery(raw, rawSQL, pre) if inference == nil { inference = &analysis{} } @@ -67,10 +98,22 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, return nil, err } + // If the query uses star expansion, verify that it was edited. If not, + // return an error. + stars := astutils.Search(raw, func(node ast.Node) bool { + _, ok := node.(*ast.A_Star) + return ok + }) + hasStars := len(stars.Items) > 0 + unchanged := inference.Query == rawSQL + if unchanged && hasStars { + return nil, fmt.Errorf("star expansion failed for query") + } + // FOOTGUN: combineAnalysis mutates inference anlys = combineAnalysis(inference, result) } else { - anlys, err = c.analyzeQuery(raw, rawSQL) + anlys, err = c.analyzeQuery(raw, rawSQL, pre) if err != nil { return nil, err } @@ -90,17 +133,11 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, return nil, err } - flags, err := metadata.ParseQueryFlags(comments) - if err != nil { - return nil, err - } + md.Comments = comments return &Query{ RawStmt: raw, - Cmd: cmd, - Comments: comments, - Name: name, - Flags: flags, + Metadata: md, Params: anlys.Parameters, Columns: anlys.Columns, SQL: trimmed, @@ -108,6 +145,23 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, }, nil } +// renumberParams applies the parameter numbers the preprocessor assigned, +// matching each node by the location of its placeholder in the query text. +func renumberParams(raw *ast.RawStmt, numbers map[int]int) { + if len(numbers) == 0 { + return + } + astutils.Walk(astutils.VisitorFunc(func(node ast.Node) { + ref, ok := node.(*ast.ParamRef) + if !ok { + return + } + if n, ok := numbers[ref.Location]; ok { + ref.Number = n + } + }), raw) +} + func rangeVars(root ast.Node) []*ast.RangeVar { var vars []*ast.RangeVar find := astutils.VisitorFunc(func(node ast.Node) { diff --git a/internal/compiler/parse_core.go b/internal/compiler/parse_core.go new file mode 100644 index 0000000000..2e1dfc7042 --- /dev/null +++ b/internal/compiler/parse_core.go @@ -0,0 +1,213 @@ +package compiler + +import ( + "errors" + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/core" + coreanalyzer "github.com/sqlc-dev/sqlc/internal/core/analyzer" + "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/named" + "github.com/sqlc-dev/sqlc/internal/sql/preprocess" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sql/validate" +) + +func (c *Compiler) parseQueryCore(raw *ast.RawStmt, src string, pre *preprocess.Statement) (*Query, error) { + rawSQL, err := source.Pluck(src, raw.StmtLocation, raw.StmtLen) + if err != nil { + return nil, err + } + if strings.TrimSpace(rawSQL) == "" { + return nil, errors.New("missing semicolon at end of file") + } + + name, cmd, err := metadata.ParseQueryNameAndType(rawSQL, metadata.CommentSyntax(c.parser.CommentSyntax())) + if err != nil { + return nil, err + } + if name == "" { + return nil, nil + } + if err := validate.Cmd(raw.Stmt, name, cmd); err != nil { + return nil, err + } + + md := metadata.Metadata{Name: name, Cmd: cmd} + cleanedComments, err := source.CleanedComments(rawSQL, c.parser.CommentSyntax()) + if err != nil { + return nil, err + } + md.Params, md.Flags, md.RuleSkiplist, err = metadata.ParseCommentFlags(cleanedComments) + if err != nil { + return nil, err + } + + if pre.ParamErr != nil { + return nil, pre.ParamErr + } + namedParams := pre.Params + expanded := rawSQL + + var cols []*Column + var params []Parameter + switch raw.Stmt.(type) { + case *ast.SelectStmt, *ast.InsertStmt, *ast.UpdateStmt, *ast.DeleteStmt: + res, err := coreanalyzer.Prepare(c.coreCatalog, raw) + if err != nil { + return nil, err + } + for _, col := range res.Columns { + cols = append(cols, coreColumn(col)) + } + placeholders, err := placeholderNames(raw) + if err != nil { + return nil, err + } + for _, p := range res.Parameters { + params = append(params, Parameter{Number: p.Number, Column: coreParamColumn(p, namedParams), Name: placeholders[p.Number]}) + } + expanded, err = source.Mutate(rawSQL, c.expandCore(raw, res.Stars)) + if err != nil { + return nil, err + } + } + + // If the query string was edited, make sure the syntax is valid + if expanded != rawSQL { + if _, err := c.newParser().Parse(strings.NewReader(expanded)); err != nil { + return nil, fmt.Errorf("edited query syntax is invalid: %w", err) + } + } + + trimmed, comments, err := source.StripComments(expanded) + if err != nil { + return nil, err + } + md.Comments = comments + + var insertTable *ast.TableName + if ins, ok := raw.Stmt.(*ast.InsertStmt); ok { + insertTable, _ = ParseTableName(ins.Relation) + } + + return &Query{ + RawStmt: raw, + Metadata: md, + Params: params, + Columns: cols, + SQL: trimmed, + InsertIntoTable: insertTable, + }, nil +} + +func coreColumn(c core.Column) *Column { + col := &Column{ + Name: c.Name, + DataType: c.DataType, + NotNull: c.NotNull, + IsArray: c.IsArray, + TypeExpr: c.Type, + } + describeType(col, c.Type) + if c.Source != nil && c.Source.Table != "" { + col.Table = &ast.TableName{Schema: c.Source.Schema, Name: c.Source.Table} + col.TableAlias = c.Source.TableAlias + col.OriginalName = c.Source.Column + } + return col +} + +// describeType fills in what codegen reads about a type from its +// expression: one array dimension per nesting, the length that is the +// innermost type's first integer argument (which is how a MySQL tinyint(1) +// is told from a tinyint), and whether the innermost type is unsigned. +func describeType(col *Column, t *core.TypeExpr) { + if t == nil { + if col.IsArray { + col.ArrayDims = 1 + } + return + } + col.ArrayDims = t.ArrayDims() + inner := t.Innermost() + if len(inner.Args) > 0 && inner.Args[0].Int != nil { + l := int(*inner.Args[0].Int) + col.Length = &l + } + col.Unsigned = strings.HasSuffix(inner.Name, " unsigned") +} + +// placeholderNames maps each parameter number to the name its placeholder +// carries, for the placeholders that have one: @name and {name:Type}. A +// query bound by name passes every argument by name, so one that mixes +// named placeholders with positional ones, such as the ? sqlc.arg becomes, +// cannot be bound and is an error. +func placeholderNames(root ast.Node) (map[int]string, error) { + names := map[int]string{} + var named, positional *ast.ParamRef + astutils.Apply(root, func(c *astutils.Cursor) bool { + pr, ok := c.Node().(*ast.ParamRef) + if !ok { + return true + } + if pr.Name == "" { + if positional == nil { + positional = pr + } + return true + } + if named == nil { + named = pr + } + names[pr.Number] = pr.Name + return true + }, nil) + if named != nil && positional != nil { + return nil, &sqlerr.Error{ + Message: fmt.Sprintf("query mixes the named placeholder %q with a positional one; bind every parameter by name or every one by position", named.Name), + Location: positional.Location, + } + } + return names, nil +} + +func coreParamColumn(p core.Parameter, params *named.ParamSet) *Column { + col := &Column{ + Name: p.Name, + DataType: p.DataType, + NotNull: p.NotNull, + IsArray: p.IsArray, + TypeExpr: p.Type, + } + describeType(col, p.Type) + if p.Source != nil && p.Source.Table != "" { + col.Table = &ast.TableName{Schema: p.Source.Schema, Name: p.Source.Table} + col.OriginalName = p.Source.Column + } + if col.Name == "" && p.Source != nil { + col.Name = p.Source.Column + } + // Merge in what the user asked for: sqlc.narg() makes the parameter + // nullable and sqlc.slice() marks it as a slice, whichever way the + // analyzer typed it. + if param, isNamed := params.FetchMerge(p.Number, named.NewInferredParam(col.Name, p.NotNull)); isNamed { + col.Name = param.Name() + col.NotNull = param.NotNull() + col.IsSqlcSlice = param.IsSqlcSlice() + col.IsNamedParam = true + } + // sqlc.slice() already says the argument is a list of values, so a + // slice the analyzer typed as an array, as it does "= ANY(sqlc.slice(x))", + // is a slice of the array's elements. + if col.IsSqlcSlice && col.TypeExpr.IsArray() { + col.TypeExpr = col.TypeExpr.Element() + col.IsArray = false + describeType(col, col.TypeExpr) + } + return col +} diff --git a/internal/compiler/query.go b/internal/compiler/query.go index 117cf44813..339126405c 100644 --- a/internal/compiler/query.go +++ b/internal/compiler/query.go @@ -1,12 +1,16 @@ package compiler import ( + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) type Function struct { Rel *ast.FuncName ReturnType *ast.TypeName + Outs []*catalog.Argument } type Table struct { @@ -34,6 +38,11 @@ type Column struct { Type *ast.TypeName EmbedTable *ast.TableName + // TypeExpr is the type as the analysis core wrote it, with the + // arguments and nesting DataType and IsArray flatten away. It is unset + // on the legacy path. + TypeExpr *core.TypeExpr + IsSqlcSlice bool // is this sqlc.slice() skipTableRequiredCheck bool @@ -41,15 +50,9 @@ type Column struct { type Query struct { SQL string - Name string - Cmd string // TODO: Pick a better name. One of: one, many, exec, execrows, copyFrom - Flags map[string]bool + Metadata metadata.Metadata Columns []*Column Params []Parameter - Comments []string - - // XXX: Hack - Filename string // Needed for CopyFrom InsertIntoTable *ast.TableName @@ -61,4 +64,8 @@ type Query struct { type Parameter struct { Number int Column *Column + // Name is the name the placeholder itself carries, @name or + // {name:Type}, by which the query binds the parameter. It is empty for + // a positional placeholder. + Name string } diff --git a/internal/compiler/query_catalog.go b/internal/compiler/query_catalog.go index 42088446d2..c4972415ad 100644 --- a/internal/compiler/query_catalog.go +++ b/internal/compiler/query_catalog.go @@ -5,16 +5,16 @@ import ( "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/catalog" - "github.com/sqlc-dev/sqlc/internal/sql/rewrite" + "github.com/sqlc-dev/sqlc/internal/sql/preprocess" ) type QueryCatalog struct { catalog *catalog.Catalog ctes map[string]*Table - embeds rewrite.EmbedSet + embeds preprocess.EmbedSet } -func (comp *Compiler) buildQueryCatalog(c *catalog.Catalog, node ast.Node, embeds rewrite.EmbedSet) (*QueryCatalog, error) { +func (comp *Compiler) buildQueryCatalog(c *catalog.Catalog, node ast.Node, embeds preprocess.EmbedSet) (*QueryCatalog, error) { var with *ast.WithClause switch n := node.(type) { case *ast.DeleteStmt: @@ -103,6 +103,7 @@ func (qc QueryCatalog) GetFunc(rel *ast.FuncName) (*Function, error) { } return &Function{ Rel: rel, + Outs: funcs[0].OutArgs(), ReturnType: funcs[0].ReturnType, }, nil } diff --git a/internal/compiler/resolve.go b/internal/compiler/resolve.go index 4624c5a45d..f47a01d7a8 100644 --- a/internal/compiler/resolve.go +++ b/internal/compiler/resolve.go @@ -9,7 +9,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/sql/astutils" "github.com/sqlc-dev/sqlc/internal/sql/catalog" "github.com/sqlc-dev/sqlc/internal/sql/named" - "github.com/sqlc-dev/sqlc/internal/sql/rewrite" + "github.com/sqlc-dev/sqlc/internal/sql/preprocess" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) @@ -21,7 +21,7 @@ func dataType(n *ast.TypeName) string { } } -func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, args []paramRef, params *named.ParamSet, embeds rewrite.EmbedSet) ([]Parameter, error) { +func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, args []paramRef, params *named.ParamSet, embeds preprocess.EmbedSet) ([]Parameter, error) { c := comp.catalog aliasMap := map[string]*ast.TableName{} @@ -63,7 +63,10 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } table, err := c.GetTable(fqn) if err != nil { - // If the table name doesn't exist, fisrt check if it's a CTE + if qc == nil { + continue + } + // If the table name doesn't exist, first check if it's a CTE if _, qcerr := qc.GetTable(fqn); qcerr != nil { return nil, err } @@ -95,6 +98,20 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } var a []Parameter + + addUnknownParam := func(ref paramRef) { + defaultP := named.NewInferredParam(ref.name, false) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) + a = append(a, Parameter{ + Number: ref.ref.Number, + Column: &Column{ + Name: p.Name(), + DataType: "any", + IsNamedParam: isNamed, + }, + }) + } + for _, ref := range args { switch n := ref.parent.(type) { @@ -142,7 +159,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, // TODO: Move this to database-specific engine package dataType := "any" if astutils.Join(n.Name, ".") == "||" { - dataType = "string" + dataType = "text" } defaultP := named.NewParam("") @@ -170,6 +187,10 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, case 2: alias = items[0] key = items[1] + case 3: + // schema := items[0] + alias = items[1] + key = items[2] default: panic("too many field items: " + strconv.Itoa(len(items))) } @@ -311,6 +332,8 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, ReturnType: &ast.TypeName{Name: "any"}, } } + + var added bool for i, item := range n.Args.Items { funcName := fun.Name var argName string @@ -350,6 +373,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, defaultP := named.NewInferredParam(defaultName, false) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) + added = true a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ @@ -391,6 +415,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, defaultP := named.NewInferredParam(paramName, true) p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) + added = true a = append(a, Parameter{ Number: ref.ref.Number, Column: &Column{ @@ -404,6 +429,9 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } if fun.ReturnType == nil { + if !added { + addUnknownParam(ref) + } continue } @@ -413,7 +441,9 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, Name: fun.ReturnType.Name, }) if err != nil { - // The return type wasn't a table. + if !added { + addUnknownParam(ref) + } continue } err = indexTable(table) @@ -483,10 +513,11 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } col := toColumn(n.TypeName) defaultP := named.NewInferredParam(col.Name, col.NotNull) - p, _ := params.FetchMerge(ref.ref.Number, defaultP) + p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) col.Name = p.Name() col.NotNull = p.NotNull() + col.IsNamedParam = isNamed a = append(a, Parameter{ Number: ref.ref.Number, Column: col, @@ -600,16 +631,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, default: slog.Debug("unsupported reference type", "type", fmt.Sprintf("%T", n)) - defaultP := named.NewInferredParam(ref.name, false) - p, isNamed := params.FetchMerge(ref.ref.Number, defaultP) - a = append(a, Parameter{ - Number: ref.ref.Number, - Column: &Column{ - Name: p.Name(), - DataType: "any", - IsNamedParam: isNamed, - }, - }) + addUnknownParam(ref) } } return a, nil diff --git a/internal/compiler/returning.go b/internal/compiler/returning.go new file mode 100644 index 0000000000..0a38abee86 --- /dev/null +++ b/internal/compiler/returning.go @@ -0,0 +1,138 @@ +package compiler + +import ( + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +// returningTables builds virtual tables for the OLD and NEW aliases that +// PostgreSQL 18 makes available in the RETURNING clause of INSERT, UPDATE and +// DELETE statements. Each alias exposes the columns of the statement's target +// table. For INSERT there is usually no old row and for DELETE there is no +// new row, so every column reached through those aliases becomes nullable. +func (c *Compiler) returningTables(qc *QueryCatalog, node ast.Node) ([]*Table, error) { + if c.conf.Engine != config.EnginePostgreSQL { + return nil, nil + } + + var rv *ast.RangeVar + var returning *ast.List + oldAlias, newAlias := "old", "new" + var oldNullable, newNullable bool + switch n := node.(type) { + case *ast.DeleteStmt: + rv = firstRangeVar(n.Relations) + returning = n.ReturningList + if n.ReturningOldAlias != "" { + oldAlias = n.ReturningOldAlias + } + if n.ReturningNewAlias != "" { + newAlias = n.ReturningNewAlias + } + // A deleted row has no new value + newNullable = true + case *ast.InsertStmt: + rv = n.Relation + returning = n.ReturningList + if n.ReturningOldAlias != "" { + oldAlias = n.ReturningOldAlias + } + if n.ReturningNewAlias != "" { + newAlias = n.ReturningNewAlias + } + // An inserted row has no old value, except when an ON CONFLICT + // clause updates an existing row instead + oldNullable = true + case *ast.UpdateStmt: + rv = firstRangeVar(n.Relations) + returning = n.ReturningList + if n.ReturningOldAlias != "" { + oldAlias = n.ReturningOldAlias + } + if n.ReturningNewAlias != "" { + newAlias = n.ReturningNewAlias + } + default: + return nil, nil + } + if rv == nil || returning == nil || len(returning.Items) == 0 { + return nil, nil + } + + fqn, err := ParseTableName(rv) + if err != nil { + return nil, err + } + + build := func(alias string, nullable bool) *Table { + table, err := qc.GetTable(fqn) + if err != nil { + // An unresolvable target table is reported by the regular + // source table lookup, so ignore the error here + return nil + } + table.Rel = &ast.TableName{Name: alias} + if nullable { + for _, col := range table.Columns { + col.NotNull = false + } + } + return table + } + + var tables []*Table + if t := build(oldAlias, oldNullable); t != nil { + tables = append(tables, t) + } + if t := build(newAlias, newNullable); t != nil { + tables = append(tables, t) + } + return tables, nil +} + +func firstRangeVar(list *ast.List) *ast.RangeVar { + if list == nil { + return nil + } + for _, item := range list.Items { + if rv, ok := item.(*ast.RangeVar); ok && rv != nil { + return rv + } + } + return nil +} + +// returningTableForScope returns the OLD or NEW virtual table named by scope. +// A source table with the same name shadows the virtual table, matching +// PostgreSQL, where the implicit aliases are only available when no relation +// in the query is already known under that name. +func returningTableForScope(tables, rtables []*Table, scope string) *Table { + if scope == "" { + return nil + } + for _, t := range tables { + if t.Rel.Name == scope { + return nil + } + } + for _, t := range rtables { + if t.Rel.Name == scope { + return t + } + } + return nil +} + +// tablesForRef resolves a column reference against the source tables, +// extended with the OLD or NEW virtual table when the reference is qualified +// with one of their names. +func tablesForRef(ref *ast.ColumnRef, tables, rtables []*Table) []*Table { + parts := stringSlice(ref.Fields) + if len(parts) != 2 { + return tables + } + if vt := returningTableForScope(tables, rtables, parts[0]); vt != nil { + return append(append([]*Table{}, tables...), vt) + } + return tables +} diff --git a/internal/compiler/selector.go b/internal/compiler/selector.go new file mode 100644 index 0000000000..115c9eb835 --- /dev/null +++ b/internal/compiler/selector.go @@ -0,0 +1,48 @@ +package compiler + +import "strings" + +// selector is an interface used by a compiler for generating expressions for +// output columns in a `SELECT ...` or `RETURNING ...` statement. +// +// This interface is exclusively needed at the moment for SQLite, which must +// wrap output `jsonb` columns with a `json(column_name)` invocation so that a +// publicly consumable format (i.e. not jsonb) is returned. +type selector interface { + // ColumnExpr generates output to be used in a `SELECT ...` or `RETURNING + // ...` statement based on input column name and metadata. + ColumnExpr(name string, column *Column) string +} + +// defaultSelector is a selector implementation that does the simpliest possible +// pass through when generating column expressions. Its use is suitable for all +// database engines not requiring additional customization. +type defaultSelector struct{} + +func newDefaultSelector() *defaultSelector { + return &defaultSelector{} +} + +func (s *defaultSelector) ColumnExpr(name string, column *Column) string { + return name +} + +type sqliteSelector struct{} + +func newSQLiteSelector() *sqliteSelector { + return &sqliteSelector{} +} + +func (s *sqliteSelector) ColumnExpr(name string, column *Column) string { + // Under SQLite, neither json nor jsonb are real data types, and rather just + // of type blob, so database drivers just return whatever raw binary is + // stored as values. This is a problem for jsonb, which is considered an + // internal format to SQLite and no attempt should be made to parse it + // outside of the database itself. For jsonb columns in SQLite, wrap values + // in `json(col)` to coerce the internal binary format to JSON parsable by + // the user-space application. + if strings.EqualFold(column.DataType, "jsonb") { + return "json(" + name + ")" + } + return name +} diff --git a/internal/compiler/selector_test.go b/internal/compiler/selector_test.go new file mode 100644 index 0000000000..e460dd281c --- /dev/null +++ b/internal/compiler/selector_test.go @@ -0,0 +1,35 @@ +package compiler + +import "testing" + +func TestSelector(t *testing.T) { + t.Parallel() + + selectorExpectColumnExpr := func(t *testing.T, selector selector, expected, name string, column *Column) { + if actual := selector.ColumnExpr(name, column); expected != actual { + t.Errorf("Expected %v, got %v for data type %v", expected, actual, column.DataType) + } + } + + t.Run("DefaultSelectorColumnExpr", func(t *testing.T) { + t.Parallel() + + selector := newDefaultSelector() + + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "integer"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "json"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "jsonb"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "text"}) + }) + + t.Run("SQLiteSelectorColumnExpr", func(t *testing.T) { + t.Parallel() + + selector := newSQLiteSelector() + + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "integer"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "json"}) + selectorExpectColumnExpr(t, selector, "json(my_column)", "my_column", &Column{DataType: "jsonb"}) + selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "text"}) + }) +} diff --git a/internal/config/config.go b/internal/config/config.go index abf264c8e1..8dc9c280db 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,6 +7,8 @@ import ( "io" "gopkg.in/yaml.v3" + + golang "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" ) type versionSetting struct { @@ -34,7 +36,7 @@ func (p *Paths) UnmarshalJSON(data []byte) error { return nil } -func (p *Paths) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (p *Paths) UnmarshalYAML(unmarshal func(any) error) error { out := []string{} if sliceErr := unmarshal(&out); sliceErr != nil { var ele string @@ -52,15 +54,27 @@ const ( EngineMySQL Engine = "mysql" EnginePostgreSQL Engine = "postgresql" EngineSQLite Engine = "sqlite" + EngineClickHouse Engine = "clickhouse" + EngineGoogleSQL Engine = "googlesql" + EngineMSSQL Engine = "mssql" + EngineDuckDB Engine = "duckdb" ) type Config struct { - Version string `json:"version" yaml:"version"` - Cloud Cloud `json:"cloud" yaml:"cloud"` - SQL []SQL `json:"sql" yaml:"sql"` - Gen Gen `json:"overrides,omitempty" yaml:"overrides"` - Plugins []Plugin `json:"plugins" yaml:"plugins"` - Rules []Rule `json:"rules" yaml:"rules"` + Version string `json:"version" yaml:"version"` + Cloud Cloud `json:"cloud" yaml:"cloud"` + Servers []Server `json:"servers" yaml:"servers"` + SQL []SQL `json:"sql" yaml:"sql"` + Overrides Overrides `json:"overrides" yaml:"overrides"` + Plugins []Plugin `json:"plugins" yaml:"plugins"` + Rules []Rule `json:"rules" yaml:"rules"` + Options map[string]yaml.Node `json:"options" yaml:"options"` +} + +type Server struct { + Name string `json:"name,omitempty" yaml:"name"` + Engine Engine `json:"engine,omitempty" yaml:"engine"` + URI string `json:"uri" yaml:"uri"` } type Database struct { @@ -72,13 +86,15 @@ type Cloud struct { Organization string `json:"organization" yaml:"organization"` Project string `json:"project" yaml:"project"` Hostname string `json:"hostname" yaml:"hostname"` + AuthToken string `json:"-" yaml:"-"` } type Plugin struct { Name string `json:"name" yaml:"name"` Env []string `json:"env" yaml:"env"` Process *struct { - Cmd string `json:"cmd" yaml:"cmd"` + Cmd string `json:"cmd" yaml:"cmd"` + Format string `json:"format" yaml:"format"` } `json:"process" yaml:"process"` WASM *struct { URL string `json:"url" yaml:"url"` @@ -92,16 +108,12 @@ type Rule struct { Msg string `json:"message" yaml:"message"` } -type Gen struct { - Go *GenGo `json:"go,omitempty" yaml:"go"` -} - -type GenGo struct { - Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` - Rename map[string]string `json:"rename,omitempty" yaml:"rename"` +type Overrides struct { + Go *golang.GlobalOptions `json:"go,omitempty" yaml:"go"` } type SQL struct { + Name string `json:"name" yaml:"name"` Engine Engine `json:"engine,omitempty" yaml:"engine"` Schema Paths `json:"schema" yaml:"schema"` Queries Paths `json:"queries" yaml:"queries"` @@ -126,42 +138,8 @@ type Codegen struct { } type SQLGen struct { - Go *SQLGo `json:"go,omitempty" yaml:"go"` - JSON *SQLJSON `json:"json,omitempty" yaml:"json"` -} - -type SQLGo struct { - EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` - EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` - JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` - EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` - EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` - EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` - EmitExportedQueries bool `json:"emit_exported_queries" yaml:"emit_exported_queries"` - EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` - EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` - EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument,omitempty" yaml:"emit_methods_with_db_argument"` - EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` - EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` - EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` - JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` - Package string `json:"package" yaml:"package"` - Out string `json:"out" yaml:"out"` - Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` - Rename map[string]string `json:"rename,omitempty" yaml:"rename"` - SQLPackage string `json:"sql_package" yaml:"sql_package"` - SQLDriver string `json:"sql_driver" yaml:"sql_driver"` - OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` - OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` - OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` - OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` - OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` - OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` - InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty" yaml:"inflection_exclude_table_names"` - QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` - OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` - BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` + Go *golang.Options `json:"go,omitempty" yaml:"go"` + JSON *SQLJSON `json:"json,omitempty" yaml:"json"` } type SQLJSON struct { @@ -173,22 +151,34 @@ type SQLJSON struct { var ErrMissingEngine = errors.New("unknown engine") var ErrMissingVersion = errors.New("no version number") var ErrNoOutPath = errors.New("no output path") -var ErrNoPackageName = errors.New("missing package name") var ErrNoPackagePath = errors.New("missing package path") var ErrNoPackages = errors.New("no packages") var ErrNoQuerierType = errors.New("no querier emit type enabled") var ErrUnknownEngine = errors.New("invalid engine") var ErrUnknownVersion = errors.New("invalid version number") -var ErrInvalidQueryParameterLimit = errors.New("invalid query parameter limit") var ErrPluginBuiltin = errors.New("a built-in plugin with that name already exists") var ErrPluginNoName = errors.New("missing plugin name") var ErrPluginExists = errors.New("a plugin with that name already exists") var ErrPluginNotFound = errors.New("no plugin found") var ErrPluginNoType = errors.New("plugin: field `process` or `wasm` required") -var ErrPluginBothTypes = errors.New("plugin: both `process` and `wasm` cannot both be defined") +var ErrPluginBothTypes = errors.New("plugin: `process` and `wasm` cannot both be defined") var ErrPluginProcessNoCmd = errors.New("plugin: missing process command") +var ErrInvalidDatabase = errors.New("database must be managed or have a non-empty URI") +var ErrManagedDatabaseNoProject = errors.New(`managed databases require a cloud project + +If you don't have a project, you can create one from the sqlc Cloud +dashboard at https://dashboard.sqlc.dev/. If you have a project, ensure +you've set its id as the value of the "project" field within the "cloud" +section of your sqlc configuration. The id will look similar to +"01HA8TWGMYPHK0V2GGMB3R2TP9".`) +var ErrManagedDatabaseNoAuthToken = errors.New(`managed databases require an auth token + +If you don't have an auth token, you can create one from the sqlc Cloud +dashboard at https://dashboard.sqlc.dev/. If you have an auth token, ensure +you've set it as the value of the SQLC_AUTH_TOKEN environment variable.`) + func ParseConfig(rd io.Reader) (Config, error) { var buf bytes.Buffer var config Config @@ -202,23 +192,33 @@ func ParseConfig(rd io.Reader) (Config, error) { if version.Number == "" { return config, ErrMissingVersion } + var err error switch version.Number { case "1": - return v1ParseConfig(&buf) + config, err = v1ParseConfig(&buf) + if err != nil { + return config, err + } case "2": - return v2ParseConfig(&buf) + config, err = v2ParseConfig(&buf) + if err != nil { + return config, err + } default: return config, ErrUnknownVersion } + err = config.addEnvVars() + if err != nil { + return config, err + } + return config, nil } type CombinedSettings struct { - Global Config - Package SQL - Go SQLGo - JSON SQLJSON - Rename map[string]string - Overrides []Override + Global Config + Package SQL + Go golang.Options + JSON SQLJSON // TODO: Combine these into a more usable type Codegen Codegen @@ -228,20 +228,9 @@ func Combine(conf Config, pkg SQL) CombinedSettings { cs := CombinedSettings{ Global: conf, Package: pkg, - Rename: map[string]string{}, - } - if conf.Gen.Go != nil { - for k, v := range conf.Gen.Go.Rename { - cs.Rename[k] = v - } - cs.Overrides = append(cs.Overrides, conf.Gen.Go.Overrides...) } if pkg.Gen.Go != nil { cs.Go = *pkg.Gen.Go - for k, v := range pkg.Gen.Go.Rename { - cs.Rename[k] = v - } - cs.Overrides = append(cs.Overrides, pkg.Gen.Go.Overrides...) } if pkg.Gen.JSON != nil { cs.JSON = *pkg.Gen.JSON diff --git a/internal/config/config_test.go b/internal/config/config_test.go index d643eeb9f0..57211d674c 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -79,124 +79,13 @@ func FuzzConfig(f *testing.F) { func TestInvalidConfig(t *testing.T) { err := Validate(&Config{ SQL: []SQL{{ - Gen: SQLGen{ - Go: &SQLGo{ - EmitMethodsWithDBArgument: true, - EmitPreparedQueries: true, - }, + Database: &Database{ + URI: "", + Managed: false, }, - }}}) + }}, + }) if err == nil { t.Errorf("expected err; got nil") } } - -func TestTypeOverrides(t *testing.T) { - for _, test := range []struct { - override Override - pkg string - typeName string - basic bool - }{ - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "github.com/segmentio/ksuid.KSUID"}, - }, - "github.com/segmentio/ksuid", - "ksuid.KSUID", - false, - }, - // TODO: Add test for struct pointers - // - // { - // Override{ - // DBType: "uuid", - // GoType: "github.com/segmentio/*ksuid.KSUID", - // }, - // "github.com/segmentio/ksuid", - // "*ksuid.KSUID", - // false, - // }, - { - Override{ - DBType: "citext", - GoType: GoType{Spec: "string"}, - }, - "", - "string", - true, - }, - { - Override{ - DBType: "timestamp", - GoType: GoType{Spec: "time.Time"}, - }, - "time", - "time.Time", - false, - }, - } { - tt := test - t.Run(tt.override.GoType.Spec, func(t *testing.T) { - if err := tt.override.Parse(); err != nil { - t.Fatalf("override parsing failed; %s", err) - } - if diff := cmp.Diff(tt.pkg, tt.override.GoImportPath); diff != "" { - t.Errorf("package mismatch;\n%s", diff) - } - if diff := cmp.Diff(tt.typeName, tt.override.GoTypeName); diff != "" { - t.Errorf("type name mismatch;\n%s", diff) - } - if diff := cmp.Diff(tt.basic, tt.override.GoBasicType); diff != "" { - t.Errorf("basic mismatch;\n%s", diff) - } - }) - } - for _, test := range []struct { - override Override - err string - }{ - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "Pointer"}, - }, - "Package override `go_type` specifier \"Pointer\" is not a Go basic type e.g. 'string'", - }, - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "untyped rune"}, - }, - "Package override `go_type` specifier \"untyped rune\" is not a Go basic type e.g. 'string'", - }, - } { - tt := test - t.Run(tt.override.GoType.Spec, func(t *testing.T) { - err := tt.override.Parse() - if err == nil { - t.Fatalf("expected parse to fail; got nil") - } - if diff := cmp.Diff(tt.err, err.Error()); diff != "" { - t.Errorf("error mismatch;\n%s", diff) - } - }) - } -} - -func FuzzOverride(f *testing.F) { - for _, spec := range []string{ - "string", - "github.com/gofrs/uuid.UUID", - "github.com/segmentio/ksuid.KSUID", - } { - f.Add(spec) - } - f.Fuzz(func(t *testing.T, s string) { - o := Override{ - GoType: GoType{Spec: s}, - } - o.Parse() - }) -} diff --git a/internal/config/convert/convert.go b/internal/config/convert/convert.go index 2bd0550886..a1fd2881ce 100644 --- a/internal/config/convert/convert.go +++ b/internal/config/convert/convert.go @@ -8,11 +8,11 @@ import ( "gopkg.in/yaml.v3" ) -func gen(n *yaml.Node) (interface{}, error) { +func gen(n *yaml.Node) (any, error) { switch n.Kind { case yaml.MappingNode: - nn := map[string]interface{}{} + nn := map[string]any{} for i, _ := range n.Content { if i%2 == 0 { k := n.Content[i] @@ -26,7 +26,7 @@ func gen(n *yaml.Node) (interface{}, error) { return nn, nil case yaml.SequenceNode: - nn := []interface{}{} + nn := []any{} for i, _ := range n.Content { v, err := gen(n.Content[i]) if err != nil { diff --git a/internal/config/env.go b/internal/config/env.go new file mode 100644 index 0000000000..0c608aa232 --- /dev/null +++ b/internal/config/env.go @@ -0,0 +1,17 @@ +package config + +import ( + "fmt" + "os" + "strings" +) + +func (c *Config) addEnvVars() error { + authToken := os.Getenv("SQLC_AUTH_TOKEN") + if authToken != "" && !strings.HasPrefix(authToken, "sqlc_") { + return fmt.Errorf("$SQLC_AUTH_TOKEN doesn't start with \"sqlc_\"") + } + c.Cloud.AuthToken = authToken + + return nil +} diff --git a/internal/config/python_type.go b/internal/config/python_type.go deleted file mode 100644 index e908448057..0000000000 --- a/internal/config/python_type.go +++ /dev/null @@ -1,17 +0,0 @@ -package config - -type PythonType struct { - Module string `json:"module" yaml:"module"` - Name string `json:"name" yaml:"name"` -} - -func (t PythonType) IsSet() bool { - return t.Module != "" || t.Name != "" -} - -func (t PythonType) TypeString() string { - if t.Name != "" && t.Module == "" { - return t.Name - } - return t.Module + "." + t.Name -} diff --git a/internal/config/v_one.go b/internal/config/v_one.go index c1a0a9f79e..fa1a4d8d28 100644 --- a/internal/config/v_one.go +++ b/internal/config/v_one.go @@ -6,55 +6,64 @@ import ( "path/filepath" yaml "gopkg.in/yaml.v3" + + golang "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" ) type V1GenerateSettings struct { Version string `json:"version" yaml:"version"` Cloud Cloud `json:"cloud" yaml:"cloud"` Packages []v1PackageSettings `json:"packages" yaml:"packages"` - Overrides []Override `json:"overrides,omitempty" yaml:"overrides,omitempty"` + Overrides []golang.Override `json:"overrides,omitempty" yaml:"overrides,omitempty"` Rename map[string]string `json:"rename,omitempty" yaml:"rename,omitempty"` Rules []Rule `json:"rules" yaml:"rules"` } type v1PackageSettings struct { - Name string `json:"name" yaml:"name"` - Engine Engine `json:"engine,omitempty" yaml:"engine"` - Database *Database `json:"database,omitempty" yaml:"database"` - Analyzer Analyzer `json:"analyzer" yaml:"analyzer"` - Path string `json:"path" yaml:"path"` - Schema Paths `json:"schema" yaml:"schema"` - Queries Paths `json:"queries" yaml:"queries"` - EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` - EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` - JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` - EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` - EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` - EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` - EmitExportedQueries bool `json:"emit_exported_queries,omitempty" yaml:"emit_exported_queries"` - EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` - EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` - EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument" yaml:"emit_methods_with_db_argument"` - EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` - EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` - EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` - JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` - SQLPackage string `json:"sql_package" yaml:"sql_package"` - SQLDriver string `json:"sql_driver" yaml:"sql_driver"` - Overrides []Override `json:"overrides" yaml:"overrides"` - OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` - OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` - OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` - OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` - OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` - OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` - StrictFunctionChecks bool `json:"strict_function_checks" yaml:"strict_function_checks"` - StrictOrderBy *bool `json:"strict_order_by" yaml:"strict_order_by"` - QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` - OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` - Rules []string `json:"rules" yaml:"rules"` - BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` + Name string `json:"name" yaml:"name"` + Engine Engine `json:"engine,omitempty" yaml:"engine"` + Database *Database `json:"database,omitempty" yaml:"database"` + Analyzer Analyzer `json:"analyzer" yaml:"analyzer"` + Path string `json:"path" yaml:"path"` + Schema Paths `json:"schema" yaml:"schema"` + Queries Paths `json:"queries" yaml:"queries"` + EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` + EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` + JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` + EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` + EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` + EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` + EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` + EmitExportedQueries bool `json:"emit_exported_queries,omitempty" yaml:"emit_exported_queries"` + EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` + EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` + EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument" yaml:"emit_methods_with_db_argument"` + EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` + EmitPointersForNullEnumTypes *bool `json:"emit_pointers_for_null_enum_types,omitempty" yaml:"emit_pointers_for_null_enum_types"` + EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` + EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` + EmitSqlAsComment bool `json:"emit_sql_as_comment,omitempty" yaml:"emit_sql_as_comment"` + JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` + SQLPackage string `json:"sql_package" yaml:"sql_package"` + SQLDriver string `json:"sql_driver" yaml:"sql_driver"` + Overrides []golang.Override `json:"overrides" yaml:"overrides"` + OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` + OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` + OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` + OutputModelsPath string `json:"output_models_path,omitempty" yaml:"output_models_path"` + OutputModelsPackage string `json:"output_models_package,omitempty" yaml:"output_models_package"` + OutputModelsImport string `json:"output_models_import,omitempty" yaml:"output_models_import"` + OutputModelsEmit *bool `json:"output_models_emit,omitempty" yaml:"output_models_emit"` + OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` + OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` + OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` + StrictFunctionChecks bool `json:"strict_function_checks" yaml:"strict_function_checks"` + StrictOrderBy *bool `json:"strict_order_by" yaml:"strict_order_by"` + QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` + OmitSqlcVersion bool `json:"omit_sqlc_version,omitempty" yaml:"omit_sqlc_version"` + OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` + Rules []string `json:"rules" yaml:"rules"` + BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` } func v1ParseConfig(rd io.Reader) (Config, error) { @@ -77,37 +86,18 @@ func v1ParseConfig(rd io.Reader) (Config, error) { if err := settings.ValidateGlobalOverrides(); err != nil { return config, err } - for i := range settings.Overrides { - if err := settings.Overrides[i].Parse(); err != nil { - return config, err - } - } for j := range settings.Packages { if settings.Packages[j].Path == "" { return config, ErrNoPackagePath } - if settings.Packages[j].QueryParameterLimit != nil && (*settings.Packages[j].QueryParameterLimit < 0) { - return config, ErrInvalidQueryParameterLimit - } - - if settings.Packages[j].QueryParameterLimit == nil { - settings.Packages[j].QueryParameterLimit = new(int32) - *settings.Packages[j].QueryParameterLimit = 1 - } - - for i := range settings.Packages[j].Overrides { - if err := settings.Packages[j].Overrides[i].Parse(); err != nil { - return config, err - } - } if settings.Packages[j].Name == "" { settings.Packages[j].Name = filepath.Base(settings.Packages[j].Path) } + if settings.Packages[j].Engine == "" { settings.Packages[j].Engine = EnginePostgreSQL } - } return settings.Translate(), nil @@ -143,6 +133,7 @@ func (c *V1GenerateSettings) Translate() Config { pkg.StrictOrderBy = &defaultValue } conf.SQL = append(conf.SQL, SQL{ + Name: pkg.Name, Engine: pkg.Engine, Database: pkg.Database, Schema: pkg.Schema, @@ -150,36 +141,43 @@ func (c *V1GenerateSettings) Translate() Config { Rules: pkg.Rules, Analyzer: pkg.Analyzer, Gen: SQLGen{ - Go: &SQLGo{ - EmitInterface: pkg.EmitInterface, - EmitJSONTags: pkg.EmitJSONTags, - JsonTagsIDUppercase: pkg.JsonTagsIDUppercase, - EmitDBTags: pkg.EmitDBTags, - EmitPreparedQueries: pkg.EmitPreparedQueries, - EmitExactTableNames: pkg.EmitExactTableNames, - EmitEmptySlices: pkg.EmitEmptySlices, - EmitExportedQueries: pkg.EmitExportedQueries, - EmitResultStructPointers: pkg.EmitResultStructPointers, - EmitParamsStructPointers: pkg.EmitParamsStructPointers, - EmitMethodsWithDBArgument: pkg.EmitMethodsWithDBArgument, - EmitPointersForNullTypes: pkg.EmitPointersForNullTypes, - EmitEnumValidMethod: pkg.EmitEnumValidMethod, - EmitAllEnumValues: pkg.EmitAllEnumValues, - Package: pkg.Name, - Out: pkg.Path, - SQLPackage: pkg.SQLPackage, - SQLDriver: pkg.SQLDriver, - Overrides: pkg.Overrides, - JSONTagsCaseStyle: pkg.JSONTagsCaseStyle, - OutputBatchFileName: pkg.OutputBatchFileName, - OutputDBFileName: pkg.OutputDBFileName, - OutputModelsFileName: pkg.OutputModelsFileName, - OutputQuerierFileName: pkg.OutputQuerierFileName, - OutputCopyFromFileName: pkg.OutputCopyFromFileName, - OutputFilesSuffix: pkg.OutputFilesSuffix, - QueryParameterLimit: pkg.QueryParameterLimit, - OmitUnusedStructs: pkg.OmitUnusedStructs, - BuildTags: pkg.BuildTags, + Go: &golang.Options{ + EmitInterface: pkg.EmitInterface, + EmitJsonTags: pkg.EmitJSONTags, + JsonTagsIdUppercase: pkg.JsonTagsIDUppercase, + EmitDbTags: pkg.EmitDBTags, + EmitPreparedQueries: pkg.EmitPreparedQueries, + EmitExactTableNames: pkg.EmitExactTableNames, + EmitEmptySlices: pkg.EmitEmptySlices, + EmitExportedQueries: pkg.EmitExportedQueries, + EmitResultStructPointers: pkg.EmitResultStructPointers, + EmitParamsStructPointers: pkg.EmitParamsStructPointers, + EmitMethodsWithDbArgument: pkg.EmitMethodsWithDBArgument, + EmitPointersForNullTypes: pkg.EmitPointersForNullTypes, + EmitPointersForNullEnumTypes: pkg.EmitPointersForNullEnumTypes, + EmitEnumValidMethod: pkg.EmitEnumValidMethod, + EmitAllEnumValues: pkg.EmitAllEnumValues, + EmitSqlAsComment: pkg.EmitSqlAsComment, + Package: pkg.Name, + Out: pkg.Path, + SqlPackage: pkg.SQLPackage, + SqlDriver: pkg.SQLDriver, + Overrides: pkg.Overrides, + JsonTagsCaseStyle: pkg.JSONTagsCaseStyle, + OutputBatchFileName: pkg.OutputBatchFileName, + OutputDbFileName: pkg.OutputDBFileName, + OutputModelsFileName: pkg.OutputModelsFileName, + OutputModelsPath: pkg.OutputModelsPath, + OutputModelsPackage: pkg.OutputModelsPackage, + OutputModelsImport: pkg.OutputModelsImport, + OutputModelsEmit: pkg.OutputModelsEmit, + OutputQuerierFileName: pkg.OutputQuerierFileName, + OutputCopyfromFileName: pkg.OutputCopyFromFileName, + OutputFilesSuffix: pkg.OutputFilesSuffix, + QueryParameterLimit: pkg.QueryParameterLimit, + OmitSqlcVersion: pkg.OmitSqlcVersion, + OmitUnusedStructs: pkg.OmitUnusedStructs, + BuildTags: pkg.BuildTags, }, }, StrictFunctionChecks: pkg.StrictFunctionChecks, @@ -188,7 +186,7 @@ func (c *V1GenerateSettings) Translate() Config { } if len(c.Overrides) > 0 || len(c.Rename) > 0 { - conf.Gen.Go = &GenGo{ + conf.Overrides.Go = &golang.GlobalOptions{ Overrides: c.Overrides, Rename: c.Rename, } diff --git a/internal/config/v_one.json b/internal/config/v_one.json index 166888ab93..20435d1e1c 100644 --- a/internal/config/v_one.json +++ b/internal/config/v_one.json @@ -125,12 +125,18 @@ "emit_pointers_for_null_types": { "type": "boolean" }, + "emit_pointers_for_null_enum_types": { + "type": "boolean" + }, "emit_enum_valid_method": { "type": "boolean" }, "emit_all_enum_values": { "type": "boolean" }, + "emit_sql_as_comment": { + "type": "boolean" + }, "build_tags": { "type": "string" }, @@ -221,6 +227,18 @@ "output_models_file_name": { "type": "string" }, + "output_models_path": { + "type": "string" + }, + "output_models_package": { + "type": "string" + }, + "output_models_import": { + "type": "string" + }, + "output_models_emit": { + "type": "boolean" + }, "output_querier_file_name": { "type": "string" }, @@ -340,4 +358,4 @@ } } } -} \ No newline at end of file +} diff --git a/internal/config/v_two.go b/internal/config/v_two.go index e2c97a2749..0fe22ffa2c 100644 --- a/internal/config/v_two.go +++ b/internal/config/v_two.go @@ -3,7 +3,6 @@ package config import ( "fmt" "io" - "path/filepath" yaml "gopkg.in/yaml.v3" ) @@ -27,13 +26,6 @@ func v2ParseConfig(rd io.Reader) (Config, error) { if err := conf.validateGlobalOverrides(); err != nil { return conf, err } - if conf.Gen.Go != nil { - for i := range conf.Gen.Go.Overrides { - if err := conf.Gen.Go.Overrides[i].Parse(); err != nil { - return conf, err - } - } - } // TODO: Store built-in plugins somewhere else builtins := map[string]struct{}{ "go": {}, @@ -71,27 +63,6 @@ func v2ParseConfig(rd io.Reader) (Config, error) { if conf.SQL[j].Gen.Go.Out == "" { return conf, ErrNoPackagePath } - if conf.SQL[j].Gen.Go.Package == "" { - conf.SQL[j].Gen.Go.Package = filepath.Base(conf.SQL[j].Gen.Go.Out) - } - - if conf.SQL[j].Gen.Go.QueryParameterLimit != nil && (*conf.SQL[j].Gen.Go.QueryParameterLimit < 0) { - return conf, ErrInvalidQueryParameterLimit - } - - if conf.SQL[j].Gen.Go.QueryParameterLimit == nil { - conf.SQL[j].Gen.Go.QueryParameterLimit = new(int32) - *conf.SQL[j].Gen.Go.QueryParameterLimit = 1 - } - - for i := range conf.SQL[j].Gen.Go.Overrides { - if err := conf.SQL[j].Gen.Go.Overrides[i].Parse(); err != nil { - return conf, err - } - } - for k, v := range conf.SQL[j].Gen.Go.Rename { - conf.SQL[j].Gen.Go.Rename[k] = v - } } if conf.SQL[j].Gen.JSON != nil { if conf.SQL[j].Gen.JSON.Out == "" { @@ -105,7 +76,7 @@ func v2ParseConfig(rd io.Reader) (Config, error) { if cg.Out == "" { return conf, ErrNoOutPath } - // TOOD: Allow the use of built-in codegen from here + // TODO: Allow the use of built-in codegen from here if _, ok := plugins[cg.Plugin]; !ok { return conf, ErrPluginNotFound } @@ -125,11 +96,11 @@ func (c *Config) validateGlobalOverrides() error { engines[pkg.Engine] = struct{}{} } } - if c.Gen.Go == nil { + if c.Overrides.Go == nil { return nil } usesMultipleEngines := len(engines) > 1 - for _, oride := range c.Gen.Go.Overrides { + for _, oride := range c.Overrides.Go.Overrides { if usesMultipleEngines && oride.Engine == "" { return fmt.Errorf(`the "engine" field is required for global type overrides because your configuration uses multiple database engines`) } diff --git a/internal/config/v_two.json b/internal/config/v_two.json index c2f1b03142..3728ece520 100644 --- a/internal/config/v_two.json +++ b/internal/config/v_two.json @@ -31,6 +31,9 @@ "engine" ], "properties": { + "name": { + "type": "string" + }, "engine": { "enum": [ "postgresql", @@ -131,12 +134,18 @@ "emit_pointers_for_null_types": { "type": "boolean" }, + "emit_pointers_for_null_enum_types": { + "type": "boolean" + }, "emit_enum_valid_method": { "type": "boolean" }, "emit_all_enum_values": { "type": "boolean" }, + "emit_sql_as_comment": { + "type": "boolean" + }, "build_tags": { "type": "string" }, @@ -236,6 +245,18 @@ "output_models_file_name": { "type": "string" }, + "output_models_path": { + "type": "string" + }, + "output_models_package": { + "type": "string" + }, + "output_models_import": { + "type": "string" + }, + "output_models_emit": { + "type": "boolean" + }, "output_querier_file_name": { "type": "string" }, @@ -439,4 +460,4 @@ } } } -} \ No newline at end of file +} diff --git a/internal/config/validate.go b/internal/config/validate.go index 207a888ecf..fadef4fb3b 100644 --- a/internal/config/validate.go +++ b/internal/config/validate.go @@ -1,19 +1,10 @@ package config -import "fmt" - func Validate(c *Config) error { for _, sql := range c.SQL { - sqlGo := sql.Gen.Go - if sqlGo == nil { - continue - } - if sqlGo.EmitMethodsWithDBArgument && sqlGo.EmitPreparedQueries { - return fmt.Errorf("invalid config: emit_methods_with_db_argument and emit_prepared_queries settings are mutually exclusive") - } if sql.Database != nil { if sql.Database.URI == "" && !sql.Database.Managed { - return fmt.Errorf("invalid config: database must be managed or have a non-empty URI") + return ErrInvalidDatabase } } } diff --git a/internal/constants/query.go b/internal/constants/query.go new file mode 100644 index 0000000000..a572c56c6f --- /dev/null +++ b/internal/constants/query.go @@ -0,0 +1,12 @@ +package constants + +// Flags +const ( + QueryFlagParam = "@param" + QueryFlagSqlcVetDisable = "@sqlc-vet-disable" +) + +// Rules +const ( + QueryRuleDbPrepare = "sqlc/db-prepare" +) diff --git a/internal/core/analysis.go b/internal/core/analysis.go new file mode 100644 index 0000000000..b0854bf457 --- /dev/null +++ b/internal/core/analysis.go @@ -0,0 +1,82 @@ +package core + +type Command string + +const ( + CommandSelect Command = "SELECT" + CommandInsert Command = "INSERT" + CommandUpdate Command = "UPDATE" + CommandDelete Command = "DELETE" +) + +type PrepareResult struct { + Command Command `json:"command,omitempty"` + Columns []Column `json:"columns"` + Parameters []Parameter `json:"parameters"` + Stars []StarExpansion `json:"stars,omitempty"` +} + +// StarExpansion is what a star in a target list stands for. The analyzer +// resolves the reference against the query's scope and reports the columns it +// covers; rewriting the query text with them is the caller's to do, since only +// it knows how the engine quotes an identifier. +type StarExpansion struct { + // Location is where the target the star belongs to starts, measured the + // way the AST measures a node: from the beginning of the file the + // statement was parsed from. + Location int `json:"location"` + + // Fields is the reference as it was written, with the star as its last + // element: ["*"] for a bare star and ["foo", "*"] for a qualified one. + Fields []string `json:"fields"` + + // Alias is the output name the target was given, if any. + Alias string `json:"alias,omitempty"` + + Columns []StarColumn `json:"columns"` +} + +// StarColumn is a single column a star expanded to. +type StarColumn struct { + // Relation is the name the column's relation goes by in the query, which + // is its alias when it was given one. + Relation string `json:"relation,omitempty"` + Name string `json:"name"` + DataType string `json:"data_type,omitempty"` +} + +type ColumnSource struct { + Schema string `json:"schema,omitempty"` + Table string `json:"table,omitempty"` + TableAlias string `json:"table_alias,omitempty"` + Column string `json:"column,omitempty"` +} + +type Column struct { + Name string `json:"name"` + DataType string `json:"data_type"` + // Type is the column's type as an expression, carrying what DataType + // and IsArray flatten away: arguments, nesting and inner nullability. + Type *TypeExpr `json:"type,omitempty"` + TypeOID int64 `json:"type_oid,omitempty"` + NotNull bool `json:"not_null"` + IsArray bool `json:"is_array,omitempty"` + SourceClassOID int64 `json:"source_class_oid,omitempty"` + SourceAttributeOID int64 `json:"source_attribute_oid,omitempty"` + Source *ColumnSource `json:"source,omitempty"` + DeclType string `json:"decl_type,omitempty"` + IsPrimaryKey bool `json:"is_primary_key,omitempty"` + IsUnique bool `json:"is_unique,omitempty"` + IsAutoIncrement bool `json:"is_auto_increment,omitempty"` +} + +type Parameter struct { + Number int `json:"number"` + Name string `json:"name,omitempty"` + DataType string `json:"data_type,omitempty"` + Type *TypeExpr `json:"type,omitempty"` + TypeOID int64 `json:"type_oid,omitempty"` + NotNull bool `json:"not_null"` + IsArray bool `json:"is_array,omitempty"` + Source *ColumnSource `json:"source,omitempty"` +} diff --git a/internal/core/analyzer/analyzer.go b/internal/core/analyzer/analyzer.go new file mode 100644 index 0000000000..2bc94d7338 --- /dev/null +++ b/internal/core/analyzer/analyzer.go @@ -0,0 +1,389 @@ +package analyzer + +import ( + "fmt" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func Prepare(cat *core.Catalog, stmt ast.Node) (core.PrepareResult, error) { + if rs, ok := stmt.(*ast.RawStmt); ok { + stmt = rs.Stmt + } + a := &analyzer{ + cat: cat, + params: map[int]core.Parameter{}, + stars: &[]core.StarExpansion{}, + } + switch s := stmt.(type) { + case *ast.SelectStmt: + if err := a.analyzeSelect(s); err != nil { + return core.PrepareResult{}, err + } + a.command = core.CommandSelect + case *ast.InsertStmt: + if err := a.analyzeInsert(s); err != nil { + return core.PrepareResult{}, err + } + a.command = core.CommandInsert + case *ast.UpdateStmt: + if err := a.analyzeUpdate(s); err != nil { + return core.PrepareResult{}, err + } + a.command = core.CommandUpdate + case *ast.DeleteStmt: + if err := a.analyzeDelete(s); err != nil { + return core.PrepareResult{}, err + } + a.command = core.CommandDelete + default: + return core.PrepareResult{}, fmt.Errorf("analyzer: unsupported statement %T", stmt) + } + return a.result(), nil +} + +type analyzer struct { + cat *core.Catalog + scope *scope + columns []core.Column + params map[int]core.Parameter + command core.Command + + // outer is the scope of the query this one is nested in, which a + // correlated subquery refers to. + outer *scope + + // ctes are the relations a WITH clause defined, visible to this query and + // to the ones nested in it. + ctes map[string]scopeRel + + // aliases are the names the target list gives its expressions. GROUP BY, + // HAVING and ORDER BY may refer to a result column by its output name. + aliases map[string]ast.Node + + // resolving guards against an alias that refers to itself. + resolving map[string]bool + + // stars are the expansions every star in the statement asked for, shared + // with the analyzers of the queries nested in it so one statement reports + // all of them. + stars *[]core.StarExpansion +} + +func (a *analyzer) recordStar(s core.StarExpansion) { + if a.stars == nil { + return + } + *a.stars = append(*a.stars, s) +} + +// subquery analyzes a nested SELECT. It shares the parameter set, so a +// placeholder inside the subquery is reported with the rest, and it sees this +// query's scope, so a correlated reference resolves. +func (a *analyzer) subquery(s *ast.SelectStmt) (*analyzer, error) { + sub := &analyzer{ + cat: a.cat, + params: a.params, + outer: a.scope, + ctes: a.ctes, + stars: a.stars, + } + if err := sub.analyzeSelect(s); err != nil { + return nil, err + } + return sub, nil +} + +func (a *analyzer) subqueryColumns(s *ast.SelectStmt) ([]core.Column, error) { + sub, err := a.subquery(s) + if err != nil { + return nil, err + } + return sub.columns, nil +} + +// derivedRel turns a subquery's result columns into a relation, so that the +// query selecting from it resolves columns the same way as from a table. +func derivedRel(alias string, cols []core.Column) scopeRel { + rel := scopeRel{alias: alias, cols: make([]core.ClassColumn, 0, len(cols))} + for _, col := range cols { + rel.cols = append(rel.cols, core.ClassColumn{ + AttOID: col.SourceAttributeOID, + Name: col.Name, + TypeOID: col.TypeOID, + Type: col.Type.WithNullable(false), + NotNull: col.NotNull, + }) + } + return rel +} + +func (a *analyzer) result() core.PrepareResult { + // A placeholder nothing constrained takes the dialect's type for one, when + // the dialect has such a type. + if oid, ok := a.cat.UntypedTypeOID(); ok { + for n, p := range a.params { + if p.TypeOID == 0 && p.Type == nil { + t := exprType{typeOID: oid, nullable: true} + p.TypeOID = oid + p.DataType, p.IsArray = a.typeNameOf(t) + p.NotNull = false + p.Type = a.typeExprOf(t) + a.params[n] = p + } + } + } + res := core.PrepareResult{ + Command: a.command, + Columns: a.columns, + Parameters: orderedParams(a.params), + } + if a.stars != nil { + res.Stars = *a.stars + } + return res +} + +func orderedParams(m map[int]core.Parameter) []core.Parameter { + if len(m) == 0 { + return nil + } + maxN := 0 + for n := range m { + if n > maxN { + maxN = n + } + } + out := make([]core.Parameter, 0, len(m)) + for i := 1; i <= maxN; i++ { + if p, ok := m[i]; ok { + out = append(out, p) + } + } + return out +} + +func (a *analyzer) analyzeSelect(s *ast.SelectStmt) error { + if err := a.bindCTEs(s.WithClause); err != nil { + return err + } + + // A set operation reports the columns of its first branch. The other + // branches still get analyzed, for the placeholders they hold. + if s.Larg != nil && s.Rarg != nil { + if err := a.analyzeSetOperation(s); err != nil { + return err + } + return nil + } + + sc, err := a.buildScope(s.FromClause) + if err != nil { + return err + } + a.scope = sc + + a.bindAliases(s.TargetList) + + for _, item := range listItems(s.FromClause) { + if err := a.typeJoinConditions(item); err != nil { + return fmt.Errorf("join: %w", err) + } + } + + if s.WhereClause != nil { + if _, err := a.typeExpr(s.WhereClause); err != nil { + return fmt.Errorf("where: %w", err) + } + } + if items := listItems(s.GroupClause); items != nil { + for _, g := range items { + if _, err := a.typeExpr(g); err != nil { + return fmt.Errorf("group by: %w", err) + } + } + } + if s.HavingClause != nil { + if _, err := a.typeExpr(s.HavingClause); err != nil { + return fmt.Errorf("having: %w", err) + } + } + + targets := listItems(s.TargetList) + if targets == nil { + // A VALUES list produces rows without naming columns. + if s.ValuesLists != nil { + return a.typeValuesLists(s.ValuesLists) + } + return fmt.Errorf("select: empty target list") + } + a.columns = make([]core.Column, 0, len(targets)) + for _, t := range targets { + rt, ok := t.(*ast.ResTarget) + if !ok { + continue + } + if err := a.projectTarget(rt); err != nil { + return err + } + } + for _, item := range listItems(s.SortClause) { + if sb, ok := item.(*ast.SortBy); ok { + if _, err := a.typeExpr(sb.Node); err != nil { + return fmt.Errorf("order by: %w", err) + } + } + } + for _, n := range []ast.Node{s.LimitCount, s.LimitOffset} { + if err := a.typeLimit(n); err != nil { + return fmt.Errorf("limit: %w", err) + } + } + return nil +} + +// typeLimit types a LIMIT or OFFSET count. A bare placeholder there holds +// whatever the dialect counts rows in. +func (a *analyzer) typeLimit(n ast.Node) error { + if n == nil { + return nil + } + if pr, ok := n.(*ast.ParamRef); ok { + oid, err := a.cat.LimitTypeOID() + if err != nil { + return err + } + a.inferParam(pr, exprType{typeOID: oid}) + return nil + } + _, err := a.typeExpr(n) + return err +} + +func (a *analyzer) typeValuesLists(l *ast.List) error { + for _, row := range listItems(l) { + if _, err := a.typeExpr(row); err != nil { + return err + } + } + return nil +} + +// analyzeSetOperation types both sides of UNION, INTERSECT or EXCEPT and +// reports the first branch's columns, the way the databases name the result. +func (a *analyzer) analyzeSetOperation(s *ast.SelectStmt) error { + left, err := a.subquery(s.Larg) + if err != nil { + return err + } + if _, err := a.subquery(s.Rarg); err != nil { + return err + } + a.columns = left.columns + a.scope = left.scope + return nil +} + +// bindCTEs analyzes a WITH clause, making each common table expression +// available to the query as a relation. +func (a *analyzer) bindCTEs(with *ast.WithClause) error { + if with == nil { + return nil + } + for _, item := range listItems(with.Ctes) { + cte, ok := item.(*ast.CommonTableExpr) + if !ok || cte.Ctename == nil { + continue + } + sel, ok := cte.Ctequery.(*ast.SelectStmt) + if !ok { + continue + } + cols, err := a.subqueryColumns(sel) + if err != nil { + return fmt.Errorf("with %s: %w", *cte.Ctename, err) + } + rel := derivedRel(*cte.Ctename, cols) + renameColumns(&rel, cte.Aliascolnames) + if a.ctes == nil { + a.ctes = map[string]scopeRel{} + } + a.ctes[*cte.Ctename] = rel + } + return nil +} + +// bindAliases records the output names the target list assigns, so a later +// clause can refer to a result column by name. +func (a *analyzer) bindAliases(targets *ast.List) { + for _, item := range listItems(targets) { + rt, ok := item.(*ast.ResTarget) + if !ok || rt.Name == nil || *rt.Name == "" { + continue + } + if a.aliases == nil { + a.aliases = map[string]ast.Node{} + } + a.aliases[*rt.Name] = rt.Val + } +} + +// typeAlias types the expression an output name stands for, which is how a +// GROUP BY or HAVING clause refers to a result column. +func (a *analyzer) typeAlias(name string) (exprType, bool, error) { + val, ok := a.aliases[name] + if !ok || a.resolving[name] { + return exprType{}, false, nil + } + if a.resolving == nil { + a.resolving = map[string]bool{} + } + a.resolving[name] = true + defer delete(a.resolving, name) + + t, err := a.typeExpr(val) + if err != nil { + return exprType{}, false, err + } + return t, true, nil +} + +// renameColumns applies the column aliases a derived relation was declared +// with, as in "WITH t(a, b) AS (...)". +func renameColumns(rel *scopeRel, names *ast.List) { + for i, item := range listItems(names) { + if i >= len(rel.cols) { + break + } + if s, ok := item.(*ast.String); ok && s.Str != "" { + rel.cols[i].Name = s.Str + } + } +} + +func listItems(l *ast.List) []ast.Node { + if l == nil { + return nil + } + return l.Items +} + +func (a *analyzer) typeJoinConditions(item ast.Node) error { + je, ok := item.(*ast.JoinExpr) + if !ok { + return nil + } + if err := a.typeJoinConditions(je.Larg); err != nil { + return err + } + if err := a.typeJoinConditions(je.Rarg); err != nil { + return err + } + if je.Quals != nil { + if _, err := a.typeExpr(je.Quals); err != nil { + return fmt.Errorf("ON: %w", err) + } + } + return nil +} diff --git a/internal/core/analyzer/bench_test.go b/internal/core/analyzer/bench_test.go new file mode 100644 index 0000000000..8d6bc6a478 --- /dev/null +++ b/internal/core/analyzer/bench_test.go @@ -0,0 +1,110 @@ +package analyzer_test + +import ( + "strings" + "testing" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/analyzer" + coreschema "github.com/sqlc-dev/sqlc/internal/core/schema" + "github.com/sqlc-dev/sqlc/internal/engine/googlesql" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +const benchSchema = ` +CREATE TABLE users ( + id INT64 NOT NULL, + name STRING NOT NULL, + bio STRING, +) PRIMARY KEY (id); + +CREATE TABLE posts ( + id INT64 NOT NULL, + user_id INT64 NOT NULL, + title STRING(255), + created TIMESTAMP NOT NULL, +) PRIMARY KEY (id); +` + +const benchQueries = ` +SELECT * FROM users; +SELECT COUNT(*) AS total FROM users; +SELECT u.name, p.* FROM users u JOIN posts p ON p.user_id = u.id WHERE u.name = @name; +SELECT id, name, bio FROM users WHERE id = @id AND name = @name; +SELECT p.title, p.created FROM posts p WHERE p.user_id = @uid AND p.title = @t; +` + +func parseAll(t testing.TB, src string) []ast.Node { + p := googlesql.NewParser() + stmts, err := p.Parse(strings.NewReader(src)) + if err != nil { + t.Fatal(err) + } + out := make([]ast.Node, 0, len(stmts)) + for i := range stmts { + out = append(out, stmts[i].Raw) + } + return out +} + +// parseQueries mirrors the compiler pipeline. GoogleSQL is not preprocessed — +// "@name" is native syntax the converter turns into a ParamRef — so parsing is +// all it takes. +func parseQueries(t testing.TB, src string) []ast.Node { + return parseAll(t, src) +} + +func newBenchCatalog(t testing.TB) (*core.Catalog, []ast.Node) { + cat, err := core.New(googlesql.Dialect()) + if err != nil { + t.Fatal(err) + } + for _, n := range parseAll(t, benchSchema) { + if err := coreschema.Apply(cat, n); err != nil { + t.Fatal(err) + } + } + return cat, parseQueries(t, benchQueries) +} + +// BenchmarkCatalogNew measures per-compile catalog setup: open the SQLite +// catalog, install the schema, and run the dialect seed. +func BenchmarkCatalogNew(b *testing.B) { + for b.Loop() { + cat, err := core.New(googlesql.Dialect()) + if err != nil { + b.Fatal(err) + } + cat.Close() + } +} + +// BenchmarkApplySchema measures loading user DDL into the catalog. +func BenchmarkApplySchema(b *testing.B) { + stmts := parseAll(b, benchSchema) + for b.Loop() { + cat, err := core.New(googlesql.Dialect()) + if err != nil { + b.Fatal(err) + } + for _, n := range stmts { + if err := coreschema.Apply(cat, n); err != nil { + b.Fatal(err) + } + } + cat.Close() + } +} + +// BenchmarkPrepare measures steady-state query analysis against a warm catalog. +func BenchmarkPrepare(b *testing.B) { + cat, queries := newBenchCatalog(b) + defer cat.Close() + for b.Loop() { + for _, q := range queries { + if _, err := analyzer.Prepare(cat, q); err != nil { + b.Fatal(err) + } + } + } +} diff --git a/internal/core/analyzer/dml.go b/internal/core/analyzer/dml.go new file mode 100644 index 0000000000..597723cedd --- /dev/null +++ b/internal/core/analyzer/dml.go @@ -0,0 +1,211 @@ +package analyzer + +import ( + "fmt" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func (a *analyzer) analyzeInsert(s *ast.InsertStmt) error { + if s.Relation == nil { + return fmt.Errorf("insert: missing relation") + } + rel, err := a.bindRangeVar(s.Relation) + if err != nil { + return err + } + a.scope = &scope{rels: []scopeRel{rel}} + + targets, err := insertTargets(rel, s.Cols) + if err != nil { + return err + } + if err := a.bindInsertValues(s.SelectStmt, rel, targets); err != nil { + return err + } + return a.projectReturning(s.ReturningList) +} + +func (a *analyzer) analyzeUpdate(s *ast.UpdateStmt) error { + if err := a.bindCTEs(s.WithClause); err != nil { + return err + } + sc, err := a.relationScope(s.Relations, s.FromClause, nil) + if err != nil { + return err + } + a.scope = sc + target := sc.rels[0] + + for _, item := range listItems(s.TargetList) { + rt, ok := item.(*ast.ResTarget) + if !ok || rt.Name == nil { + continue + } + col, ok := findColumn(target, *rt.Name) + if !ok { + return fmt.Errorf("unknown column %q", *rt.Name) + } + if err := a.bindValue(target, &col, rt.Val); err != nil { + return fmt.Errorf("set %s: %w", *rt.Name, err) + } + } + + if s.WhereClause != nil { + if _, err := a.typeExpr(s.WhereClause); err != nil { + return fmt.Errorf("where: %w", err) + } + } + return a.projectReturning(s.ReturningList) +} + +func (a *analyzer) analyzeDelete(s *ast.DeleteStmt) error { + if err := a.bindCTEs(s.WithClause); err != nil { + return err + } + sc, err := a.relationScope(s.Relations, s.UsingClause, s.FromClause) + if err != nil { + return err + } + a.scope = sc + + if s.WhereClause != nil { + if _, err := a.typeExpr(s.WhereClause); err != nil { + return fmt.Errorf("where: %w", err) + } + } + return a.projectReturning(s.ReturningList) +} + +// relationScope builds the scope a DML statement operates on: the relations it +// targets, whatever a USING or FROM clause joins in, and — for the engines that +// report a multi-table DELETE that way — a single FROM node. +func (a *analyzer) relationScope(relations, extra *ast.List, from ast.Node) (*scope, error) { + sc := &scope{} + defer a.binding(sc)() + for _, item := range listItems(relations) { + if err := a.appendFromItem(sc, item); err != nil { + return nil, err + } + } + for _, item := range listItems(extra) { + if err := a.appendFromItem(sc, item); err != nil { + return nil, err + } + } + if from != nil { + if err := a.appendFromItem(sc, from); err != nil { + return nil, err + } + } + if len(sc.rels) == 0 { + return nil, fmt.Errorf("missing target relation") + } + return sc, nil +} + +func insertTargets(rel scopeRel, cols *ast.List) ([]core.ClassColumn, error) { + items := listItems(cols) + if len(items) == 0 { + out := make([]core.ClassColumn, 0, len(rel.cols)) + for _, col := range rel.cols { + if !col.Hidden { + out = append(out, col) + } + } + return out, nil + } + out := make([]core.ClassColumn, 0, len(items)) + for _, item := range items { + rt, ok := item.(*ast.ResTarget) + if !ok || rt.Name == nil { + return nil, fmt.Errorf("insert: unsupported column target %T", item) + } + col, ok := findColumn(rel, *rt.Name) + if !ok { + return nil, fmt.Errorf("unknown column %q", *rt.Name) + } + out = append(out, col) + } + return out, nil +} + +func (a *analyzer) bindInsertValues(n ast.Node, rel scopeRel, targets []core.ClassColumn) error { + if n == nil { + return nil + } + sel, ok := n.(*ast.SelectStmt) + if !ok { + return fmt.Errorf("insert: unsupported source %T", n) + } + // INSERT ... SELECT inserts whatever the query returns. The rows are not + // the statement's result, but the query still holds placeholders. + if sel.ValuesLists == nil { + _, err := a.subqueryColumns(sel) + return err + } + for _, row := range listItems(sel.ValuesLists) { + values, ok := row.(*ast.List) + if !ok { + continue + } + for i, v := range values.Items { + var target *core.ClassColumn + if i < len(targets) { + target = &targets[i] + } + if err := a.bindValue(rel, target, v); err != nil { + return err + } + } + } + return nil +} + +func (a *analyzer) bindValue(rel scopeRel, target *core.ClassColumn, v ast.Node) error { + if target != nil { + switch value := v.(type) { + case *ast.ParamRef: + a.inferParam(value, columnType(rel, *target)) + return nil + case *ast.A_Const: + return nil + } + } + _, err := a.typeExpr(v) + return err +} + +func (a *analyzer) projectReturning(l *ast.List) error { + for _, item := range listItems(l) { + rt, ok := item.(*ast.ResTarget) + if !ok { + continue + } + if err := a.projectTarget(rt); err != nil { + return err + } + } + return nil +} + +func findColumn(rel scopeRel, name string) (core.ClassColumn, bool) { + for _, col := range rel.cols { + if col.Name == name { + return col, true + } + } + return core.ClassColumn{}, false +} + +func columnType(rel scopeRel, col core.ClassColumn) exprType { + return exprType{ + typeOID: col.TypeOID, + expr: col.Type, + nullable: !col.NotNull, + sourceClassOID: rel.classOID, + sourceAttributeOID: col.AttOID, + sourceTableAlias: rel.alias, + } +} diff --git a/internal/core/analyzer/expr.go b/internal/core/analyzer/expr.go new file mode 100644 index 0000000000..62a69b273d --- /dev/null +++ b/internal/core/analyzer/expr.go @@ -0,0 +1,1168 @@ +package analyzer + +import ( + "fmt" + "slices" + "strings" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +type exprType struct { + // typeOID is the type's row: the instance when the catalog holds one, + // else the family, else 0 for a type no dialect seeded and no schema + // declared. + typeOID int64 + // expr is the whole expression when it says more than the row does — a + // cast to numeric(5, 1) when only numeric is a row — or names a type + // the catalog does not hold. Analysis never adds a type: it reports the + // expression the query used and carries on, so a query can be analyzed + // against a catalog it cannot write to. + expr *core.TypeExpr + nullable bool + sourceClassOID int64 + sourceAttributeOID int64 + sourceTableAlias string +} + +func (a *analyzer) typeExpr(n ast.Node) (exprType, error) { + switch e := n.(type) { + case nil: + return exprType{}, nil + + case *ast.TODO: + return exprType{}, nil + + case *ast.A_Const: + return a.typeConst(e) + + case *ast.ColumnRef: + return a.typeColumnRef(e) + + case *ast.ParamRef: + return a.typeParamRef(e) + + case *ast.A_Expr: + return a.typeAExpr(e) + + case *ast.BoolExpr: + return a.typeBoolExpr(e) + + case *ast.FuncCall: + return a.typeFuncCall(e) + + case *ast.TypeCast: + return a.typeTypeCast(e) + + case *ast.NullTest: + if _, err := a.typeExpr(e.Arg); err != nil { + return exprType{}, err + } + return a.boolType(false) + + case *ast.In: + return a.typeIn(e) + + case *ast.BetweenExpr: + return a.typeBetween(e) + + case *ast.CaseExpr: + return a.typeCase(e) + + case *ast.CoalesceExpr: + return a.typeCoalesce(e) + + case *ast.MinMaxExpr: + return a.typeFirstOf(listItems(e.Args), false) + + case *ast.A_ArrayExpr: + return a.typeArrayExpr(e) + + case *ast.A_Indirection: + return a.typeIndirection(e) + + case *ast.SubLink: + return a.typeSubLink(e) + + case *ast.CollateExpr: + return a.typeExpr(e.Arg) + + case *ast.IntervalExpr: + // A dialect with no interval type of its own leaves it untyped. + oid, err := a.cat.TypeOID("interval") + if err != nil { + return exprType{}, nil + } + return exprType{typeOID: oid}, nil + + // A user variable and an ordinal in GROUP BY / ORDER BY carry no type of + // their own, and neither is something to resolve. + case *ast.VariableExpr, *ast.Integer, *ast.String, *ast.Float: + return exprType{}, nil + + case *ast.List: + for _, item := range listItems(e) { + if _, err := a.typeExpr(item); err != nil { + return exprType{}, err + } + } + return exprType{}, nil + } + return exprType{}, fmt.Errorf("typeExpr: unsupported %T", n) +} + +func (a *analyzer) typeConst(c *ast.A_Const) (exprType, error) { + switch v := c.Val.(type) { + case *ast.Integer: + _ = v + oid, err := a.cat.ConstTypeOID(core.ConstInteger) + if err != nil { + return exprType{}, err + } + return exprType{typeOID: oid}, nil + case *ast.Float: + oid, err := a.cat.ConstTypeOID(core.ConstFloat) + if err != nil { + return exprType{}, err + } + return exprType{typeOID: oid}, nil + case *ast.String: + oid, err := a.cat.ConstTypeOID(core.ConstString) + if err != nil { + return exprType{}, err + } + return exprType{typeOID: oid}, nil + case *ast.Boolean: + return a.boolType(false) + case *ast.Null, nil: + return exprType{nullable: true}, nil + } + return exprType{}, fmt.Errorf("typeConst: unsupported %T", c.Val) +} + +func (a *analyzer) boolType(nullable bool) (exprType, error) { + oid, err := a.cat.BoolTypeOID() + if err != nil { + return exprType{}, err + } + return exprType{typeOID: oid, nullable: nullable}, nil +} + +func (a *analyzer) typeColumnRef(c *ast.ColumnRef) (exprType, error) { + parts := flattenFields(c.Fields) + if len(parts) == 0 { + return exprType{}, fmt.Errorf("column ref: empty") + } + relation := "" + column := parts[0] + if len(parts) >= 2 { + relation = parts[0] + column = parts[1] + } + rel, col, ok, err := a.resolveColumn(relation, column) + if err != nil { + return exprType{}, err + } + // A dotted name may be a column's own, as ClickHouse names the columns + // a Nested column stores as n.a. + if !ok && relation != "" { + rel, col, ok, err = a.resolveColumn("", relation+"."+column) + if err != nil { + return exprType{}, err + } + } + if !ok { + if relation != "" { + return exprType{}, fmt.Errorf("unknown column %q.%q", relation, column) + } + // The name may be one the target list assigned rather than one a + // relation offers. + if t, ok, err := a.typeAlias(column); err != nil || ok { + return t, err + } + return exprType{}, fmt.Errorf("unknown column %q", column) + } + return columnType(rel, col), nil +} + +func flattenFields(fields *ast.List) []string { + if fields == nil { + return nil + } + out := make([]string, 0, len(fields.Items)) + for _, item := range fields.Items { + switch v := item.(type) { + case *ast.String: + out = append(out, v.Str) + case *ast.A_Star: + out = append(out, "*") + return out + } + } + return out +} + +// param is the parameter p refers to, recorded with the name the +// placeholder carries, whichever of its uses is seen first. +func (a *analyzer) param(p *ast.ParamRef) core.Parameter { + cur, ok := a.params[p.Number] + if !ok { + cur = core.Parameter{Number: p.Number} + } + if cur.Name == "" { + cur.Name = p.Name + } + a.params[p.Number] = cur + return cur +} + +func (a *analyzer) typeParamRef(p *ast.ParamRef) (exprType, error) { + cur := a.param(p) + return exprType{typeOID: cur.TypeOID, expr: cur.Type.WithNullable(false), nullable: !cur.NotNull}, nil +} + +func (a *analyzer) inferParam(p *ast.ParamRef, t exprType) { + cur := a.param(p) + typed := cur.TypeOID == 0 && cur.Type == nil && (t.typeOID != 0 || t.expr != nil) + if typed { + cur.TypeOID = t.typeOID + cur.DataType, cur.IsArray = a.typeNameOf(t) + cur.NotNull = !t.nullable + cur.Type = a.typeExprOf(t) + } + if cur.Source == nil && t.sourceAttributeOID != 0 { + ad, err := a.cat.LookupAttribute(t.sourceAttributeOID) + if err == nil { + cur.Source = &core.ColumnSource{ + Schema: ad.Schema, + Table: ad.Table, + TableAlias: t.sourceTableAlias, + Column: ad.Column, + } + } + } + a.params[p.Number] = cur +} + +// nameParamAfter names a placeholder compared with a function call after +// the function, the way a placeholder compared with a column is named after +// the column. +func (a *analyzer) nameParamAfter(number int, other ast.Node) { + fc, ok := other.(*ast.FuncCall) + if !ok { + return + } + cur := a.params[number] + if cur.Name == "" && cur.Source == nil { + cur.Name = funcCallName(fc) + a.params[number] = cur + } +} + +func (a *analyzer) typeAExpr(e *ast.A_Expr) (exprType, error) { + // Not every engine classifies its operators, so a zero kind is a plain + // operator application rather than an unset field. LIKE and its relatives + // name a real operator too, so they resolve the same way. + switch e.Kind { + case ast.A_Expr_Kind_OP, ast.A_Expr_Kind_LIKE, ast.A_Expr_Kind_ILIKE, ast.A_Expr_Kind_SIMILAR, 0: + case ast.A_Expr_Kind_OP_ANY, ast.A_Expr_Kind_OP_ALL: + return a.typeQuantifiedExpr(e) + case ast.A_Expr_Kind_IN, ast.A_Expr_Kind_BETWEEN, ast.A_Expr_Kind_NOT_BETWEEN, + ast.A_Expr_Kind_BETWEEN_SYM, ast.A_Expr_Kind_NOT_BETWEEN_SYM: + return a.typePredicateList(e) + case ast.A_Expr_Kind_DISTINCT, ast.A_Expr_Kind_NOT_DISTINCT: + return a.typeComparison(e) + case ast.A_Expr_Kind_NULLIF: + return a.typeNullIf(e) + default: + return exprType{}, fmt.Errorf("a_expr: unsupported kind %v", e.Kind) + } + opName := normalizeOperator(opNameFromList(e.Name)) + if opName == "" { + return exprType{}, fmt.Errorf("a_expr: unnamed operator") + } + + // Engines that do not have a dedicated boolean node report AND and OR as + // operators. They combine predicates whatever the dialect. + if opName == "AND" || opName == "OR" { + if _, err := a.typeExpr(e.Lexpr); err != nil { + return exprType{}, err + } + if _, err := a.typeExpr(e.Rexpr); err != nil { + return exprType{}, err + } + return a.boolType(false) + } + + leftT, err := a.typeExpr(e.Lexpr) + if err != nil { + return exprType{}, err + } + // The postfix null tests SQLite has — x ISNULL, x NOTNULL, x NOT NULL — + // arrive as operators with no right operand, and are predicates that + // are never NULL. + if e.Rexpr == nil && isNullTest(opName) { + return a.boolType(false) + } + rightT, err := a.typeExpr(e.Rexpr) + if err != nil { + return exprType{}, err + } + + if pr, ok := e.Lexpr.(*ast.ParamRef); ok && rightT.typeOID != 0 { + a.inferParam(pr, rightT) + a.nameParamAfter(pr.Number, e.Rexpr) + leftT = rightT + } else if pr := castParamRef(e.Lexpr); pr != nil { + a.inferParam(pr, rightT) + a.nameParamAfter(pr.Number, e.Rexpr) + } + if pr, ok := e.Rexpr.(*ast.ParamRef); ok && leftT.typeOID != 0 { + a.inferParam(pr, leftT) + a.nameParamAfter(pr.Number, e.Lexpr) + rightT = leftT + } else if pr := castParamRef(e.Rexpr); pr != nil { + a.inferParam(pr, leftT) + a.nameParamAfter(pr.Number, e.Lexpr) + } + + overload, err := a.resolveOperator(opName, leftT, rightT) + if err != nil { + return exprType{}, err + } + // An operator's result is NULL when an operand is, except for IS and + // IS NOT, which test for NULL rather than propagate it: x IS NULL and + // x IS y are never NULL, whatever x and y are. + return exprType{ + typeOID: overload.ResultTypeOID, + nullable: (leftT.nullable || rightT.nullable) && !isNullTest(opName), + }, nil +} + +// castParamRef is the placeholder a cast wraps, as ClickHouse's {p:UInt64} +// is written, or nil. The cast has typed it already; what it is compared +// with still names it and says which column it stands in for. +func castParamRef(n ast.Node) *ast.ParamRef { + tc, ok := n.(*ast.TypeCast) + if !ok { + return nil + } + pr, _ := tc.Arg.(*ast.ParamRef) + return pr +} + +// isNullTest reports whether an operator compares with NULL as a value +// rather than propagating it, so that its result is never NULL. +func isNullTest(opName string) bool { + switch opName { + case "IS", "IS NOT", "ISNULL", "NOTNULL", "NOT NULL": + return true + } + return false +} + +// typeQuantifiedExpr types "x = ANY($1)" and "x > ALL(...)": the right side +// holds values of the left side's type, and the result is a predicate. +func (a *analyzer) typeQuantifiedExpr(e *ast.A_Expr) (exprType, error) { + leftT, err := a.typeExpr(e.Lexpr) + if err != nil { + return exprType{}, err + } + // "x = ANY(SELECT ...)" compares x against the subquery's column, but + // "x = ANY(array)" against the elements of an array, so a placeholder + // there is an array of x's type. + right := leftT + if _, sub := e.Rexpr.(*ast.SubLink); !sub { + right = a.arrayOf(leftT) + right.sourceClassOID = leftT.sourceClassOID + right.sourceAttributeOID = leftT.sourceAttributeOID + right.sourceTableAlias = leftT.sourceTableAlias + } + if err := a.typeOperands(e.Rexpr, right); err != nil { + return exprType{}, err + } + return a.boolType(false) +} + +// typePredicateList types IN and BETWEEN, where the right side is a list of +// values compared against the left. +func (a *analyzer) typePredicateList(e *ast.A_Expr) (exprType, error) { + leftT, err := a.typeExpr(e.Lexpr) + if err != nil { + return exprType{}, err + } + if l, ok := e.Rexpr.(*ast.List); ok { + for _, item := range listItems(l) { + if err := a.typeOperands(item, leftT); err != nil { + return exprType{}, err + } + } + return a.boolType(false) + } + if err := a.typeOperands(e.Rexpr, leftT); err != nil { + return exprType{}, err + } + return a.boolType(false) +} + +// typeIn types the IN node the engines that have one report, where the values +// compared against are held apart from the expression. +func (a *analyzer) typeIn(e *ast.In) (exprType, error) { + leftT, err := a.typeExpr(e.Expr) + if err != nil { + return exprType{}, err + } + for _, item := range e.List { + if err := a.typeOperands(item, leftT); err != nil { + return exprType{}, err + } + } + // "x IN (SELECT ...)" compares x against the subquery's column, and the + // subquery's own placeholders are reported with the rest. + if sel, ok := e.Sel.(*ast.SelectStmt); ok { + cols, err := a.subqueryColumns(sel) + if err != nil { + return exprType{}, err + } + if pr, ok := e.Expr.(*ast.ParamRef); ok && len(cols) > 0 { + if err := a.typeOperands(pr, columnExprType(cols[0])); err != nil { + return exprType{}, err + } + } + } + return a.boolType(false) +} + +// typeBetween types the BETWEEN node the engines that have one report. +func (a *analyzer) typeBetween(e *ast.BetweenExpr) (exprType, error) { + leftT, err := a.typeExpr(e.Expr) + if err != nil { + return exprType{}, err + } + for _, bound := range []ast.Node{e.Left, e.Right} { + if err := a.typeOperands(bound, leftT); err != nil { + return exprType{}, err + } + } + return a.boolType(false) +} + +// typeCase types CASE. Its result is the first branch's, and it is nullable +// unless every branch and the default are. +func (a *analyzer) typeCase(e *ast.CaseExpr) (exprType, error) { + argT, err := a.typeExpr(e.Arg) + if err != nil { + return exprType{}, err + } + results := make([]ast.Node, 0, len(listItems(e.Args))+1) + for _, item := range listItems(e.Args) { + when, ok := item.(*ast.CaseWhen) + if !ok { + continue + } + // "CASE x WHEN y" compares y against x; "CASE WHEN y" is a predicate. + if e.Arg != nil { + if err := a.typeOperands(when.Expr, argT); err != nil { + return exprType{}, err + } + } else if _, err := a.typeExpr(when.Expr); err != nil { + return exprType{}, err + } + results = append(results, when.Result) + } + if e.Defresult != nil { + results = append(results, e.Defresult) + } + t, err := a.typeFirstOf(results, e.Defresult == nil) + if err != nil { + return exprType{}, err + } + return t, nil +} + +// typeCoalesce types COALESCE, which is its first typed argument's type and +// is null only when every argument is. +func (a *analyzer) typeCoalesce(e *ast.CoalesceExpr) (exprType, error) { + var out exprType + found := false + nullable := true + for _, n := range listItems(e.Args) { + t, err := a.typeExpr(n) + if err != nil { + return exprType{}, err + } + if !found && (t.typeOID != 0 || t.expr != nil) { + // The result is an expression's, not the column's it came from. + out = exprType{typeOID: t.typeOID, expr: t.expr} + found = true + } + nullable = nullable && t.nullable + } + out.nullable = nullable + return out, nil +} + +// typeFirstOf types a set of alternative results, taking the first one that has +// a type. The result is nullable when any alternative is, or when the caller +// says the set is not exhaustive. +func (a *analyzer) typeFirstOf(nodes []ast.Node, nullable bool) (exprType, error) { + var out exprType + found := false + for _, n := range nodes { + t, err := a.typeExpr(n) + if err != nil { + return exprType{}, err + } + if !found && (t.typeOID != 0 || t.expr != nil) { + out = t + found = true + } + nullable = nullable || t.nullable + } + out.nullable = nullable + return out, nil +} + +// typeArrayExpr types ARRAY[...], whose type is an array of its elements'. +func (a *analyzer) typeArrayExpr(e *ast.A_ArrayExpr) (exprType, error) { + elemT, err := a.typeFirstOf(listItems(e.Elements), false) + if err != nil { + return exprType{}, err + } + element := a.exprOf(elemT) + if element == nil { + return exprType{}, nil + } + return a.lookupType(core.Array(element.WithNullable(false))), nil +} + +// typeIndirection types an array subscript, arr[i], as the array's element, +// and a slice, arr[i:j], as the array itself. An element may be NULL, and a +// subscript past the end of the array yields NULL in the dialects that do not +// raise an error for it. The subscripts are integers. +func (a *analyzer) typeIndirection(e *ast.A_Indirection) (exprType, error) { + t, err := a.typeExpr(e.Arg) + if err != nil { + return exprType{}, err + } + intT := exprType{} + if oid, err := a.cat.ConstTypeOID(core.ConstInteger); err == nil { + intT.typeOID = oid + } + for _, item := range listItems(e.Indirection) { + idx, ok := item.(*ast.A_Indices) + if !ok { + return exprType{}, fmt.Errorf("typeExpr: unsupported indirection %T", item) + } + for _, bound := range []ast.Node{idx.Lidx, idx.Uidx} { + if err := a.typeOperands(bound, intT); err != nil { + return exprType{}, err + } + } + if idx.IsSlice { + continue + } + element := a.exprOf(t).Element() + if element == nil { + return exprType{nullable: true}, nil + } + t = a.lookupType(element) + t.nullable = true + } + return t, nil +} + +// arrayOf is the type of an array of t's type. +func (a *analyzer) arrayOf(t exprType) exprType { + element := a.exprOf(t) + if element == nil { + return exprType{} + } + return a.lookupType(core.Array(element.WithNullable(false))) +} + +// lookupType is the type an expression refers to: its row when the catalog +// holds one, its family's row when it holds only that, and the expression +// alone when it holds neither. +func (a *analyzer) lookupType(t *core.TypeExpr) exprType { + if t == nil { + return exprType{} + } + found, ok := a.cat.LookupTypeExpr(t) + if !ok { + return exprType{expr: t.WithNullable(false)} + } + out := exprType{typeOID: found.OID} + if found.OID == found.FamilyOID && len(found.Expr.Args) > 0 { + out.expr = found.Expr + } + return out +} + +// namedType is the type a name refers to, or the name itself when the catalog +// has no such type. +func (a *analyzer) namedType(name string) exprType { + return a.lookupType(core.ParseTypeExpr(name)) +} + +// exprOf is a type's expression: the one the analysis carries, or the one +// its row stands for. It is a copy, and nil for an untyped expression. +func (a *analyzer) exprOf(t exprType) *core.TypeExpr { + if t.expr != nil { + return t.expr.Clone() + } + if t.typeOID == 0 { + return nil + } + e, err := a.cat.TypeExprOf(t.typeOID) + if err != nil { + return nil + } + return e +} + +// typeExprOf writes a type as the expression a result reports, with the +// expression's own nullability set from the analysis. +func (a *analyzer) typeExprOf(t exprType) *core.TypeExpr { + e := a.exprOf(t) + if e == nil { + return nil + } + e.Nullable = t.nullable + return e +} + +// typeNameOf reports a type's innermost family name and whether the type is +// an array, which is the flat view the legacy compiler reads. +func (a *analyzer) typeNameOf(t exprType) (string, bool) { + e := a.exprOf(t) + if e == nil { + return "", false + } + // MySQL's unsigned families are their own types, but codegen reads + // the signed family and an unsigned flag, which the bridge derives + // from the expression. + return strings.TrimSuffix(e.Innermost().Name, " unsigned"), e.IsArray() +} + +// columnExprType is the type a result column of a nested query has, as an +// operand of the query around it. +func columnExprType(col core.Column) exprType { + return exprType{typeOID: col.TypeOID, expr: col.Type.WithNullable(false), nullable: !col.NotNull} +} + +// familyOID is the row everything about a type is registered on: the end of +// its resolution chain. +func (a *analyzer) familyOID(oid int64) int64 { + chain := a.cat.ResolutionChain(oid) + return chain[len(chain)-1] +} + +// typeSubLink types a subquery used as an expression: EXISTS and IN yield a +// predicate, and a scalar subquery yields its first column. +func (a *analyzer) typeSubLink(e *ast.SubLink) (exprType, error) { + if _, err := a.typeExpr(e.Testexpr); err != nil { + return exprType{}, err + } + sel, ok := e.Subselect.(*ast.SelectStmt) + if !ok { + if e.SubLinkType == ast.EXPR_SUBLINK || e.SubLinkType == ast.ARRAY_SUBLINK { + return exprType{nullable: true}, nil + } + return a.boolType(false) + } + cols, err := a.subqueryColumns(sel) + if err != nil { + return exprType{}, err + } + switch e.SubLinkType { + case ast.EXPR_SUBLINK: + if len(cols) == 0 { + return exprType{nullable: true}, nil + } + // A subquery that matches no row yields NULL. + t := columnExprType(cols[0]) + t.nullable = true + return t, nil + case ast.ARRAY_SUBLINK: + // ARRAY(SELECT ...) collects the column into an array, which is + // empty rather than NULL when no row matches. + if len(cols) == 0 { + return exprType{}, nil + } + return a.arrayOf(columnExprType(cols[0])), nil + default: + return a.boolType(false) + } +} + +// typeComparison types IS DISTINCT FROM and its negation, which compare any two +// values and never return NULL. +func (a *analyzer) typeComparison(e *ast.A_Expr) (exprType, error) { + leftT, err := a.typeExpr(e.Lexpr) + if err != nil { + return exprType{}, err + } + rightT, err := a.typeExpr(e.Rexpr) + if err != nil { + return exprType{}, err + } + if err := a.typeOperands(e.Rexpr, leftT); err != nil { + return exprType{}, err + } + if err := a.typeOperands(e.Lexpr, rightT); err != nil { + return exprType{}, err + } + return a.boolType(false) +} + +// typeNullIf types NULLIF(x, y), which is x, made nullable. +func (a *analyzer) typeNullIf(e *ast.A_Expr) (exprType, error) { + leftT, err := a.typeExpr(e.Lexpr) + if err != nil { + return exprType{}, err + } + if err := a.typeOperands(e.Rexpr, leftT); err != nil { + return exprType{}, err + } + leftT.nullable = true + return leftT, nil +} + +// typeOperands types a node standing opposite one of known type, giving a bare +// placeholder that type. +func (a *analyzer) typeOperands(n ast.Node, other exprType) error { + if pr, ok := n.(*ast.ParamRef); ok { + // Registering the placeholder first keeps the name its syntax gave + // it, as ClickHouse's {name:Type} does. + if _, err := a.typeParamRef(pr); err != nil { + return err + } + if other.typeOID != 0 || other.expr != nil { + a.inferParam(pr, other) + } + return nil + } + _, err := a.typeExpr(n) + return err +} + +// normalizeOperator upper-cases a word operator ("like", "is not") so that the +// spelling a user wrote matches the one a dialect seeded. Symbolic operators +// are already canonical. +func normalizeOperator(name string) string { + for _, r := range name { + if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') { + return strings.ToUpper(name) + } + } + return name +} + +func opNameFromList(l *ast.List) string { + if l == nil { + return "" + } + parts := make([]string, 0, len(l.Items)) + for _, item := range l.Items { + if s, ok := item.(*ast.String); ok { + parts = append(parts, s.Str) + } + } + return strings.Join(parts, ".") +} + +// resolveOperator finds the overload of an operator over two operand types. +// An operator is registered on a family, so an operand that is an instance, +// an alias or a domain is looked up along its resolution chain: numeric(10, +// 2) + numeric(5, 1) resolves on numeric. +func (a *analyzer) resolveOperator(name string, leftT, rightT exprType) (core.OperatorOverload, error) { + leftChain := a.cat.ResolutionChain(leftT.typeOID) + rightChain := a.cat.ResolutionChain(rightT.typeOID) + all, err := a.cat.FindOperators(name, 0, 0) + if err != nil { + return core.OperatorOverload{}, err + } + // The operator's overloads are read once; the pairs along the two + // chains are tried against them in order, nearest first. + byOperands := make(map[[2]int64]core.OperatorOverload, len(all)) + for _, ov := range all { + key := [2]int64{ov.LeftTypeOID, ov.RightTypeOID} + if _, seen := byOperands[key]; !seen { + byOperands[key] = ov + } + } + for _, l := range leftChain { + for _, r := range rightChain { + if ov, ok := byOperands[[2]int64{l, r}]; ok && l != 0 && r != 0 { + return ov, nil + } + } + } + leftOID := leftChain[len(leftChain)-1] + rightOID := rightChain[len(rightChain)-1] + + for _, ov := range all { + if leftOID != 0 && ov.LeftTypeOID != 0 && leftOID != ov.LeftTypeOID { + ok, _ := a.cat.CastAllowed(leftOID, ov.LeftTypeOID, "i") + if !ok { + continue + } + } + if rightOID != 0 && ov.RightTypeOID != 0 && rightOID != ov.RightTypeOID { + ok, _ := a.cat.CastAllowed(rightOID, ov.RightTypeOID, "i") + if !ok { + continue + } + } + if (leftOID == 0) != (ov.LeftTypeOID == 0) { + continue + } + if (rightOID == 0) != (ov.RightTypeOID == 0) { + continue + } + return ov, nil + } + + // No dialect declares every operator over every type — extensions add + // them, and an operator over a type the schema declared may never have + // been registered. Rather than fail the query, assume the shape the + // operator's name implies: a comparison yields a boolean and anything + // else yields the type it was applied to. + if a.cat.IsComparisonOperator(name) { + boolOID, err := a.cat.BoolTypeOID() + if err != nil { + return core.OperatorOverload{}, err + } + return core.OperatorOverload{Name: name, ResultTypeOID: boolOID}, nil + } + result := leftOID + if result == 0 { + result = rightOID + } + return core.OperatorOverload{Name: name, ResultTypeOID: result}, nil +} + +func (a *analyzer) typeBoolExpr(b *ast.BoolExpr) (exprType, error) { + for _, item := range listItems(b.Args) { + if _, err := a.typeExpr(item); err != nil { + return exprType{}, err + } + } + return a.boolType(false) +} + +func (a *analyzer) typeFuncCall(f *ast.FuncCall) (exprType, error) { + name := funcCallName(f) + if name == "" { + return exprType{}, fmt.Errorf("func call: missing name") + } + + if f.AggStar && (name == "count" || name == "count.*") { + if overloads, err := a.cat.FindProcs("count", nil); err == nil && len(overloads) > 0 { + return exprType{typeOID: overloads[0].ReturnTypeOID, nullable: overloads[0].ReturnNullable}, nil + } + oid, err := a.cat.TypeOID("bigint") + if err != nil { + return exprType{}, err + } + return exprType{typeOID: oid, nullable: false}, nil + } + + args := listItems(f.Args) + argTypes := make([]exprType, 0, len(args)) + argOIDs := make([]int64, 0, len(args)) + anyNullable := false + for _, arg := range args { + t, err := a.typeExpr(arg) + if err != nil { + return exprType{}, err + } + argTypes = append(argTypes, t) + argOIDs = append(argOIDs, t.typeOID) + anyNullable = anyNullable || t.nullable + } + + overloads, err := a.cat.FindProcs(name, nil) + if err != nil { + return exprType{}, err + } + if len(overloads) == 0 { + // A dialect's function list is never complete — extensions add to it, + // and so does the user. An unknown function leaves the result untyped + // rather than failing the query. + return exprType{nullable: true}, nil + } + p := a.pickOverload(overloads, argOIDs) + // An argument that is a bare placeholder takes the parameter's type, + // unless the parameter is polymorphic, when it takes what the other + // arguments say: the element of the array passed for an anyarray, or + // an array of the value passed for an anyelement, as + // array_includes(anyarray, anyelement) relates them. + for i, arg := range args { + if i >= len(p.ArgTypes) { + break + } + if a.isPolymorphicOID(p.ArgTypes[i]) { + if t, ok := a.polymorphicArg(p, i, argTypes); ok { + if err := a.typeOperands(arg, t); err != nil { + return exprType{}, err + } + } + continue + } + if err := a.typeOperands(arg, exprType{typeOID: p.ArgTypes[i]}); err != nil { + return exprType{}, err + } + } + ret := a.returnType(p, argTypes) + // A result that depends on an argument's value is spelled by the seed + // as a template over the arguments, filled in from the call. + if computed := a.returnTemplate(p, args, argTypes); computed != nil { + ret = a.lookupType(computed) + } + ret.nullable = p.ReturnNullable + if !p.NeverNull && anyNullable && a.cat.PropagatesNullable() { + ret.nullable = true + } + return ret, nil +} + +// returnTemplate fills a seed's return template — Decimal(18, $2) — from +// the call: a $n that stands for an integer literal takes its value, and +// one that stands for a typed argument takes its type. A template that +// cannot be filled leaves the answer to the catalog. +func (a *analyzer) returnTemplate(p core.ProcOverload, args []ast.Node, argTypes []exprType) *core.TypeExpr { + if p.ReturnTemplate == "" { + return nil + } + template := core.ParseTypeExpr(p.ReturnTemplate) + fill := func(arg core.TypeArg) (core.TypeArg, bool) { + n, ok := argIndex(arg.Type.Name) + if !ok || n >= len(args) { + return core.TypeArg{}, false + } + if c, ok := args[n].(*ast.A_Const); ok { + if lit, ok := c.Val.(*ast.Integer); ok { + v := lit.Ival + return core.TypeArg{Label: arg.Label, Int: &v}, true + } + if lit, ok := c.Val.(*ast.String); ok { + v := lit.Str + return core.TypeArg{Label: arg.Label, String: &v}, true + } + } + if t := a.exprOf(argTypes[n]); t != nil { + return core.TypeArg{Label: arg.Label, Type: t.WithNullable(false)}, true + } + return core.TypeArg{}, false + } + for i, arg := range template.Args { + if arg.Type == nil || !strings.HasPrefix(arg.Type.Name, "$") { + continue + } + filled, ok := fill(arg) + if !ok { + return nil + } + template.Args[i] = filled + } + return template +} + +// returnType resolves a polymorphic return type — max(anyelement), or a +// seed's "$2" for the type of the second argument — to the type the call was +// made with. +func (a *analyzer) returnType(p core.ProcOverload, argTypes []exprType) exprType { + if p.ReturnTypeOID == 0 || len(argTypes) == 0 { + return exprType{typeOID: p.ReturnTypeOID} + } + name, err := a.cat.TypeName(p.ReturnTypeOID) + if err != nil { + return exprType{typeOID: p.ReturnTypeOID} + } + if n, ok := argIndex(name); ok { + if n < len(argTypes) { + return exprType{typeOID: argTypes[n].typeOID, expr: argTypes[n].expr} + } + return exprType{} + } + if isPolymorphic(name) && (argTypes[0].typeOID != 0 || argTypes[0].expr != nil) { + arg := exprType{typeOID: argTypes[0].typeOID, expr: argTypes[0].expr} + // An element taken from an array argument, unnest(anyarray) + // returning anyelement, is the array's element; an array built from + // an element argument is an array of it. + paramName := "" + if len(p.ArgTypes) > 0 { + paramName, _ = a.cat.TypeName(p.ArgTypes[0]) + } + switch { + case isPolymorphicArray(paramName) && !isPolymorphicArray(name): + if element := a.exprOf(arg).Element(); element != nil { + return a.lookupType(element) + } + case !isPolymorphicArray(paramName) && isPolymorphicArray(name) && isPolymorphic(paramName): + return a.arrayOf(arg) + } + return arg + } + return exprType{typeOID: p.ReturnTypeOID} +} + +// polymorphicArg is the type the other arguments of a call give its i-th, +// polymorphic, parameter: the element of an array passed for an anyarray +// when the parameter is an element, or an array of an element passed for +// an anyelement when the parameter is an array. +func (a *analyzer) polymorphicArg(p core.ProcOverload, i int, argTypes []exprType) (exprType, bool) { + name, err := a.cat.TypeName(p.ArgTypes[i]) + if err != nil || !isPolymorphic(name) { + return exprType{}, false + } + for j, other := range p.ArgTypes { + if j == i || j >= len(argTypes) || (argTypes[j].typeOID == 0 && argTypes[j].expr == nil) { + continue + } + otherName, err := a.cat.TypeName(other) + if err != nil || !isPolymorphic(otherName) { + continue + } + switch { + case isPolymorphicArray(otherName) && !isPolymorphicArray(name): + if element := a.exprOf(argTypes[j]).Element(); element != nil { + return a.lookupType(element), true + } + case !isPolymorphicArray(otherName) && isPolymorphicArray(name): + return a.arrayOf(argTypes[j]), true + } + } + return exprType{}, false +} + +// isPolymorphicArray reports whether a polymorphic type stands for an array. +func isPolymorphicArray(typeName string) bool { + return typeName == "anyarray" || typeName == "anycompatiblearray" +} + +// argIndex reads a seed's "$n" pseudo-type as the zero-based index of the +// argument whose type it stands for. +func argIndex(typeName string) (int, bool) { + rest, ok := strings.CutPrefix(typeName, "$") + if !ok { + return 0, false + } + n := 0 + for _, r := range rest { + if r < '0' || r > '9' { + return 0, false + } + n = n*10 + int(r-'0') + } + if n == 0 { + return 0, false + } + return n - 1, true +} + +// isPolymorphicOID reports whether a parameter type accepts any argument. +func (a *analyzer) isPolymorphicOID(oid int64) bool { + if oid == 0 { + return true + } + name, err := a.cat.TypeName(oid) + if err != nil { + return false + } + if _, ok := argIndex(name); ok { + return true + } + return isPolymorphic(name) +} + +func isPolymorphic(typeName string) bool { + switch typeName { + case "any", "anyelement", "anyarray", "anynonarray", "anyenum", "anyrange", + "anymultirange", "anycompatible", "anycompatiblearray", + "anycompatiblenonarray", "anycompatiblerange": + return true + } + return false +} + +// pickOverload chooses the overload whose parameters the call's arguments +// match best: an exact type match on a parameter beats a match on the +// argument's family, which beats a polymorphic parameter, which beats a +// mismatch, and any overload of the right arity beats one of the wrong +// arity. +func (a *analyzer) pickOverload(overloads []core.ProcOverload, argTypes []int64) core.ProcOverload { + best := -1 + bestScore := -1 + chains := make([][]int64, len(argTypes)) + for j, oid := range argTypes { + if oid != 0 { + chains[j] = a.cat.ResolutionChain(oid) + } + } + for i := range overloads { + ov := &overloads[i] + if len(ov.ArgTypes) != len(argTypes) { + continue + } + score := 0 + for j, oid := range argTypes { + switch { + case oid != 0 && oid == ov.ArgTypes[j]: + score += 3 + case oid != 0 && slices.Contains(chains[j], ov.ArgTypes[j]): + score += 2 + case a.isPolymorphicOID(ov.ArgTypes[j]): + score += 1 + } + } + if score > bestScore { + best, bestScore = i, score + } + } + if best >= 0 { + return overloads[best] + } + return overloads[0] +} + +func funcCallName(f *ast.FuncCall) string { + if f.Funcname != nil { + return opNameFromList(f.Funcname) + } + if f.Func != nil { + return strings.ToLower(f.Func.Name) + } + return "" +} + +func (a *analyzer) typeTypeCast(c *ast.TypeCast) (exprType, error) { + if c.TypeName == nil { + return exprType{}, fmt.Errorf("cast: missing target type") + } + target := core.TypeExprOfTypeName(c.TypeName) + if target == nil { + return exprType{}, fmt.Errorf("cast: missing target type") + } + t := a.lookupType(target) + // A cast is how a query says what an otherwise untyped placeholder + // holds, and a placeholder so typed is not null unless the type says + // otherwise, as ClickHouse's Nullable(String) does. Anything else + // cast is NULL when it was NULL before, or when the type says so. + t.nullable = target.Nullable + if pr, ok := c.Arg.(*ast.ParamRef); ok { + if err := a.typeOperands(pr, t); err != nil { + return exprType{}, err + } + return t, nil + } + arg, err := a.typeExpr(c.Arg) + if err != nil { + return exprType{}, err + } + t.nullable = t.nullable || arg.nullable + return t, nil +} diff --git a/internal/core/analyzer/projection.go b/internal/core/analyzer/projection.go new file mode 100644 index 0000000000..17fc3cbf47 --- /dev/null +++ b/internal/core/analyzer/projection.go @@ -0,0 +1,169 @@ +package analyzer + +import ( + "slices" + "strings" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func (a *analyzer) projectTarget(rt *ast.ResTarget) error { + // A column reference's field list is flattened once here and threaded + // through the star check, the star expansion and the output name. + var fields []string + if cr, ok := rt.Val.(*ast.ColumnRef); ok { + fields = flattenFields(cr.Fields) + if isStar(fields) { + a.emitStar(rt, fields) + return nil + } + } + + t, err := a.typeExpr(rt.Val) + if err != nil { + return err + } + // A placeholder selected directly is named by its alias and, when nothing + // constrains it, typed as the dialect types such a placeholder. + if pr, ok := rt.Val.(*ast.ParamRef); ok { + if rt.Name != nil && *rt.Name != "" { + if p := a.params[pr.Number]; p.Name == "" { + p.Name = *rt.Name + a.params[pr.Number] = p + } + } + if t.typeOID == 0 && t.expr == nil { + if oid, ok := a.cat.UntypedTypeOID(); ok { + t = exprType{typeOID: oid, nullable: true} + } + } + } + col := core.Column{ + Name: targetName(rt, fields), + TypeOID: t.typeOID, + NotNull: !t.nullable, + SourceClassOID: t.sourceClassOID, + SourceAttributeOID: t.sourceAttributeOID, + } + col.DataType, col.IsArray = a.typeNameOf(t) + col.Type = a.typeExprOf(t) + a.decorateSource(&col, t.sourceAttributeOID, t.sourceTableAlias) + if rt.Name == nil || *rt.Name == "" { + // A column whose own name is dotted, as ClickHouse's n.a is, is + // reported under that name rather than its last part. + if col.Source != nil && strings.Contains(col.Source.Column, ".") { + col.Name = col.Source.Column + } + a.qualifyDuplicate(&col, t.sourceTableAlias) + } + a.columns = append(a.columns, col) + return nil +} + +// qualifyDuplicate names a column after its relation when an earlier result +// column from another relation already has its name, in a dialect that +// does so. +func (a *analyzer) qualifyDuplicate(col *core.Column, alias string) { + if alias == "" || !a.cat.QualifiesDuplicateColumns() { + return + } + for _, prev := range a.columns { + if prev.Name != col.Name { + continue + } + prevAlias := "" + if prev.Source != nil { + prevAlias = prev.Source.TableAlias + } + if prevAlias != alias { + col.Name = alias + "." + col.Name + return + } + } +} + +func (a *analyzer) decorateSource(col *core.Column, attOID int64, tableAlias string) { + if attOID == 0 { + return + } + ad, err := a.cat.LookupAttribute(attOID) + if err != nil { + return + } + col.Source = &core.ColumnSource{ + Schema: ad.Schema, + Table: ad.Table, + TableAlias: tableAlias, + Column: ad.Column, + } + col.DeclType = ad.DeclType + col.IsPrimaryKey = ad.IsPrimaryKey + col.IsUnique = ad.IsUnique + col.IsAutoIncrement = ad.AutoIncrement +} + +// targetName picks the output name for a target. fields is the already +// flattened field list when rt.Val is a column reference, and nil otherwise. +func targetName(rt *ast.ResTarget, fields []string) string { + if rt.Name != nil && *rt.Name != "" { + return *rt.Name + } + if len(fields) > 0 { + return fields[len(fields)-1] + } + if fc, ok := rt.Val.(*ast.FuncCall); ok { + if name := funcCallName(fc); name != "" { + return name + } + } + return "?column?" +} + +func isStar(fields []string) bool { + return len(fields) > 0 && fields[len(fields)-1] == "*" +} + +func (a *analyzer) emitStar(rt *ast.ResTarget, fields []string) { + relName := "" + if len(fields) > 1 { + relName = fields[0] + } + // The star is reported along with the columns it covers, so the query text + // can be rewritten to name them. + star := core.StarExpansion{Location: rt.Location, Fields: fields} + if rt.Name != nil { + star.Alias = *rt.Name + } + for _, rel := range a.scope.rels { + if relName != "" && rel.alias != relName { + continue + } + a.columns = slices.Grow(a.columns, len(rel.cols)) + star.Columns = slices.Grow(star.Columns, len(rel.cols)) + for _, c := range rel.cols { + if c.Hidden { + continue + } + col := core.Column{ + Name: c.Name, + TypeOID: c.TypeOID, + NotNull: c.NotNull, + SourceClassOID: rel.classOID, + SourceAttributeOID: c.AttOID, + } + t := exprType{typeOID: c.TypeOID, expr: c.Type, nullable: !c.NotNull} + col.DataType, col.IsArray = a.typeNameOf(t) + col.Type = a.typeExprOf(t) + a.decorateSource(&col, c.AttOID, rel.alias) + a.qualifyDuplicate(&col, rel.alias) + a.columns = append(a.columns, col) + star.Columns = append(star.Columns, core.StarColumn{ + Relation: rel.alias, + Name: c.Name, + DataType: col.DataType, + }) + } + } + a.recordStar(star) +} diff --git a/internal/core/analyzer/scope.go b/internal/core/analyzer/scope.go new file mode 100644 index 0000000000..218a8e0b11 --- /dev/null +++ b/internal/core/analyzer/scope.go @@ -0,0 +1,252 @@ +package analyzer + +import ( + "fmt" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +type scope struct { + rels []scopeRel +} + +type scopeRel struct { + alias string + classOID int64 + // cols is the catalog's column list, held as-is rather than copied into a + // scope-local column type. + cols []core.ClassColumn +} + +func (a *analyzer) buildScope(from *ast.List) (*scope, error) { + items := listItems(from) + sc := &scope{rels: make([]scopeRel, 0, len(items))} + defer a.binding(sc)() + for _, item := range items { + if err := a.appendFromItem(sc, item); err != nil { + return nil, err + } + } + return sc, nil +} + +// binding makes the scope under construction the one the analyzer resolves +// against, and returns the func that puts back the scope it replaced. A FROM +// item can refer to the ones before it — a set-returning function takes its +// arguments from them — so binding an item has to see what is bound so far +// rather than no scope at all. +func (a *analyzer) binding(sc *scope) func() { + prev := a.scope + a.scope = sc + return func() { a.scope = prev } +} + +func (a *analyzer) appendFromItem(sc *scope, item ast.Node) error { + switch v := item.(type) { + case *ast.RangeVar: + rel, err := a.bindRangeVar(v) + if err != nil { + return err + } + sc.rels = append(sc.rels, rel) + return nil + case *ast.JoinExpr: + if err := a.appendFromItem(sc, v.Larg); err != nil { + return err + } + return a.appendFromItem(sc, v.Rarg) + case *ast.RangeFunction: + rel, err := a.bindRangeFunction(v) + if err != nil { + return err + } + sc.rels = append(sc.rels, rel) + return nil + case *ast.RangeSubselect: + rel, err := a.bindRangeSubselect(v) + if err != nil { + return err + } + sc.rels = append(sc.rels, rel) + return nil + case *ast.List: + // Some engines report a comma-separated FROM as a nested list. + for _, item := range listItems(v) { + if err := a.appendFromItem(sc, item); err != nil { + return err + } + } + return nil + default: + return fmt.Errorf("scope: unsupported FROM item %T", item) + } +} + +// bindRangeFunction binds a function called in FROM. A set-returning function +// stands in for a relation of a single column named after it. +func (a *analyzer) bindRangeFunction(rf *ast.RangeFunction) (scopeRel, error) { + call := findFuncCall(rf.Functions) + if call == nil { + return scopeRel{}, fmt.Errorf("range function: no function call") + } + name := funcCallName(call) + overloads, err := a.cat.FindProcs(name, nil) + if err != nil { + return scopeRel{}, err + } + if len(overloads) == 0 { + return scopeRel{}, fmt.Errorf("unknown function %q", name) + } + + // The arguments are typed against the scope built so far, which is what + // gives a placeholder passed to the function its type, and what + // resolves a polymorphic result: unnest of an array of strings yields + // strings. + t, err := a.typeFuncCall(call) + if err != nil { + return scopeRel{}, err + } + + // The relation's alias names its single column too, as "unnest(tags) + // AS tag" does. + colName := name + rel := scopeRel{alias: name} + if rf.Alias != nil && rf.Alias.Aliasname != nil && *rf.Alias.Aliasname != "" { + rel.alias = *rf.Alias.Aliasname + colName = rel.alias + } + col := core.ClassColumn{Name: colName, TypeOID: t.typeOID, Type: t.expr, NotNull: !t.nullable} + if t.typeOID == 0 && t.expr == nil { + p := overloads[0] + col.TypeOID, col.NotNull = p.ReturnTypeOID, !p.ReturnNullable + } + rel.cols = []core.ClassColumn{col} + return rel, nil +} + +func findFuncCall(l *ast.List) *ast.FuncCall { + for _, item := range listItems(l) { + switch v := item.(type) { + case *ast.FuncCall: + return v + case *ast.List: + if call := findFuncCall(v); call != nil { + return call + } + } + } + return nil +} + +// bindRangeSubselect binds a subquery used as a relation in FROM. +func (a *analyzer) bindRangeSubselect(rs *ast.RangeSubselect) (scopeRel, error) { + sel, ok := rs.Subquery.(*ast.SelectStmt) + if !ok { + return scopeRel{}, fmt.Errorf("subquery: unsupported %T", rs.Subquery) + } + cols, err := a.subqueryColumns(sel) + if err != nil { + return scopeRel{}, err + } + alias := "" + if rs.Alias != nil && rs.Alias.Aliasname != nil { + alias = *rs.Alias.Aliasname + } + rel := derivedRel(alias, cols) + if rs.Alias != nil { + renameColumns(&rel, rs.Alias.Colnames) + } + return rel, nil +} + +func (a *analyzer) bindRangeVar(rv *ast.RangeVar) (scopeRel, error) { + if rv.Relname == nil { + return scopeRel{}, fmt.Errorf("range var: missing relation name") + } + relName := *rv.Relname + + // A WITH clause defines a relation that shadows nothing but is not in the + // catalog, so it is resolved before one. + if cte, ok := a.ctes[relName]; ok && (rv.Schemaname == nil || *rv.Schemaname == "") { + if rv.Alias != nil && rv.Alias.Aliasname != nil && *rv.Alias.Aliasname != "" { + cte.alias = *rv.Alias.Aliasname + } + return cte, nil + } + + schema := "" + if rv.Schemaname != nil { + schema = *rv.Schemaname + } + if schema == "" { + schema = "public" + } + nsOID, err := a.cat.NamespaceOID(schema) + if err != nil { + return scopeRel{}, fmt.Errorf("schema %q: %w", schema, err) + } + classOID, err := a.cat.ClassOID(nsOID, relName) + if err != nil { + return scopeRel{}, fmt.Errorf("relation %q.%q: %w", schema, relName, err) + } + rel := scopeRel{ + alias: relName, + classOID: classOID, + } + if rv.Alias != nil && rv.Alias.Aliasname != nil && *rv.Alias.Aliasname != "" { + rel.alias = *rv.Alias.Aliasname + } + + cols, err := a.cat.ClassColumns(classOID) + if err != nil { + return scopeRel{}, err + } + rel.cols = cols + return rel, nil +} + +// resolveColumn finds a column in this query's scope, falling back to the scope +// of the query it is nested in, which is what a correlated subquery refers to. +func (a *analyzer) resolveColumn(relation, column string) (scopeRel, core.ClassColumn, bool, error) { + rel, col, ok, err := a.scope.resolveColumn(relation, column) + if err != nil || ok { + return rel, col, ok, err + } + if a.outer != nil { + return a.outer.resolveColumn(relation, column) + } + return rel, col, false, nil +} + +// resolveColumn finds the single column named column, optionally qualified by +// relation. It reports an error when more than one relation in scope offers +// that name. +func (s *scope) resolveColumn(relation, column string) (rel scopeRel, col core.ClassColumn, ok bool, err error) { + // A statement whose scope is not built yet offers no columns. Report the + // column as unresolved and let the caller say so, rather than crashing on + // the way to the same answer. + if s == nil { + return rel, col, false, nil + } + found := 0 + for _, r := range s.rels { + if relation != "" && r.alias != relation { + continue + } + for _, c := range r.cols { + if c.Name != column { + continue + } + found++ + if found > 1 { + return scopeRel{}, core.ClassColumn{}, false, fmt.Errorf("ambiguous column reference %q", column) + } + rel, col = r, c + } + } + if found == 0 { + return scopeRel{}, core.ClassColumn{}, false, nil + } + return rel, col, true, nil +} diff --git a/internal/core/attribute.go b/internal/core/attribute.go new file mode 100644 index 0000000000..9c2a927f5b --- /dev/null +++ b/internal/core/attribute.go @@ -0,0 +1,287 @@ +package core + +import ( + "context" + "fmt" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +type AttributeSpec struct { + ClassOID int64 + Name string + TypeOID int64 + Num int + NotNull bool + HasDefault bool + DeclType string + AutoIncrement bool + IsPrimaryKey bool + IsUnique bool + // Hidden columns resolve by name but stay out of a star expansion and + // the relation's model, like the column an sqlite fts5 table names + // after itself. + Hidden bool +} + +func (c *Catalog) CreateAttributeSpec(s AttributeSpec) error { + err := c.q.CreateAttribute(context.Background(), catalogdb.CreateAttributeParams{ + ClassOid: s.ClassOID, + Name: s.Name, + TypeOid: s.TypeOID, + NotNull: boolToInt64(s.NotNull), + HasDefault: boolToInt64(s.HasDefault), + Num: int64(s.Num), + DeclType: s.DeclType, + AutoIncrement: boolToInt64(s.AutoIncrement), + IsPrimaryKey: boolToInt64(s.IsPrimaryKey), + IsUnique: boolToInt64(s.IsUnique), + Hidden: boolToInt64(s.Hidden), + }) + if err != nil { + return fmt.Errorf("create attribute %q on class %d: %w", s.Name, s.ClassOID, err) + } + return nil +} + +func (c *Catalog) CreateAttribute(classOID int64, name string, typeOID int64, notNull bool, hasDefault bool, num int) error { + return c.CreateAttributeSpec(AttributeSpec{ + ClassOID: classOID, + Name: name, + TypeOID: typeOID, + Num: num, + NotNull: notNull, + HasDefault: hasDefault, + }) +} + +// DropAttribute removes a column from a relation. +func (c *Catalog) DropAttribute(classOID int64, name string) error { + err := c.q.DeleteAttribute(context.Background(), catalogdb.DeleteAttributeParams{ + ClassOid: classOID, + Name: name, + }) + if err != nil { + return fmt.Errorf("drop attribute %q on class %d: %w", name, classOID, err) + } + return nil +} + +// RenameAttribute renames a column. +func (c *Catalog) RenameAttribute(classOID int64, name, newName string) error { + err := c.q.RenameAttribute(context.Background(), catalogdb.RenameAttributeParams{ + ClassOid: classOID, + Name: name, + NewName: newName, + }) + if err != nil { + return fmt.Errorf("rename attribute %q on class %d: %w", name, classOID, err) + } + return nil +} + +// SetAttributeType changes a column's type. +func (c *Catalog) SetAttributeType(classOID int64, name string, typeOID int64, declType string) error { + err := c.q.SetAttributeType(context.Background(), catalogdb.SetAttributeTypeParams{ + ClassOid: classOID, + Name: name, + TypeOid: typeOID, + DeclType: declType, + }) + if err != nil { + return fmt.Errorf("set type of attribute %q on class %d: %w", name, classOID, err) + } + return nil +} + +// SetAttributeNotNull records whether a column accepts NULL. +func (c *Catalog) SetAttributeNotNull(classOID int64, name string, notNull bool) error { + err := c.q.SetAttributeNotNull(context.Background(), catalogdb.SetAttributeNotNullParams{ + ClassOid: classOID, + Name: name, + NotNull: boolToInt64(notNull), + }) + if err != nil { + return fmt.Errorf("set null of attribute %q on class %d: %w", name, classOID, err) + } + return nil +} + +// NextAttributeNum is the ordinal a column added to the relation takes. +func (c *Catalog) NextAttributeNum(classOID int64) (int, error) { + num, err := c.q.MaxAttributeNum(context.Background(), classOID) + if err != nil { + return 0, fmt.Errorf("attribute count for class %d: %w", classOID, err) + } + return int(num) + 1, nil +} + +func (c *Catalog) SetAttributePrimaryKey(classOID int64, columns []string) error { + ctx := context.Background() + for _, name := range columns { + err := c.q.SetAttributePrimaryKey(ctx, catalogdb.SetAttributePrimaryKeyParams{ + ClassOid: classOID, + Name: name, + }) + if err != nil { + return fmt.Errorf("mark pk %s on class %d: %w", name, classOID, err) + } + } + return nil +} + +func (c *Catalog) SetAttributeUnique(classOID int64, columns []string) error { + ctx := context.Background() + for _, name := range columns { + err := c.q.SetAttributeUnique(ctx, catalogdb.SetAttributeUniqueParams{ + ClassOid: classOID, + Name: name, + }) + if err != nil { + return fmt.Errorf("mark unique %s on class %d: %w", name, classOID, err) + } + } + return nil +} + +type ColumnInfo struct { + Name string + TypeName string + TypeOID int64 + NotNull bool + DeclType string + AutoIncrement bool + IsPrimaryKey bool + IsUnique bool + AttributeOID int64 + ClassOID int64 +} + +func (c *Catalog) ResolveColumn(table, column string) (*ColumnInfo, error) { + r, err := c.q.ResolveColumn(context.Background(), catalogdb.ResolveColumnParams{ + TableName: table, + ColumnName: column, + }) + if err != nil { + return nil, fmt.Errorf("resolve %s.%s: %w", table, column, err) + } + info := ColumnInfo{ + AttributeOID: r.Oid, + ClassOID: r.ClassOid, + Name: r.Name, + TypeName: r.TypeName, + TypeOID: r.TypeOid, + NotNull: r.NotNull != 0, + DeclType: r.DeclType, + AutoIncrement: r.AutoIncrement != 0, + IsPrimaryKey: r.IsPrimaryKey != 0, + IsUnique: r.IsUnique != 0, + } + return &info, nil +} + +func (c *Catalog) TableColumns(table string) ([]ColumnInfo, error) { + rows, err := c.q.TableColumns(context.Background(), table) + if err != nil { + return nil, fmt.Errorf("table columns %q: %w", table, err) + } + cols := make([]ColumnInfo, 0, len(rows)) + for _, r := range rows { + cols = append(cols, ColumnInfo{ + AttributeOID: r.Oid, + ClassOID: r.ClassOid, + Name: r.Name, + TypeName: r.TypeName, + TypeOID: r.TypeOid, + NotNull: r.NotNull != 0, + DeclType: r.DeclType, + AutoIncrement: r.AutoIncrement != 0, + IsPrimaryKey: r.IsPrimaryKey != 0, + IsUnique: r.IsUnique != 0, + }) + } + return cols, nil +} + +type ClassColumn struct { + AttOID int64 + Name string + TypeOID int64 + // Type is the column's type as an expression, set for a column of a + // derived relation whose type the catalog holds no row for, or holds + // only the family of. + Type *TypeExpr + NotNull bool + Hidden bool +} + +// ClassColumns returns a relation's columns in ordinal order. +func (c *Catalog) ClassColumns(classOID int64) ([]ClassColumn, error) { + rows, err := c.q.ClassAttributes(context.Background(), classOID) + if err != nil { + return nil, fmt.Errorf("class columns %d: %w", classOID, err) + } + out := make([]ClassColumn, 0, len(rows)) + for _, r := range rows { + out = append(out, ClassColumn{ + AttOID: r.Oid, + Name: r.Name, + TypeOID: r.TypeOid, + NotNull: r.NotNull != 0, + Hidden: r.Hidden != 0, + }) + } + return out, nil +} + +type CodegenColumn struct { + Name string + TypeOID int64 + NotNull bool +} + +func (c *Catalog) ClassCodegenColumns(classOID int64) ([]CodegenColumn, error) { + rows, err := c.q.ListClassColumns(context.Background(), classOID) + if err != nil { + return nil, fmt.Errorf("class codegen columns %d: %w", classOID, err) + } + out := make([]CodegenColumn, 0, len(rows)) + for _, r := range rows { + out = append(out, CodegenColumn{ + Name: r.ColumnName, + TypeOID: r.TypeOid, + NotNull: r.NotNull != 0, + }) + } + return out, nil +} + +type AttributeDetails struct { + Schema string + Table string + Column string + Num int + DeclType string + AutoIncrement bool + IsPrimaryKey bool + IsUnique bool + NotNull bool +} + +func (c *Catalog) LookupAttribute(attOID int64) (AttributeDetails, error) { + r, err := c.q.LookupAttribute(context.Background(), attOID) + if err != nil { + return AttributeDetails{}, fmt.Errorf("lookup attribute %d: %w", attOID, err) + } + return AttributeDetails{ + Schema: r.SchemaName, + Table: r.TableName, + Column: r.ColumnName, + Num: int(r.Num), + DeclType: r.DeclType, + AutoIncrement: r.AutoIncrement != 0, + IsPrimaryKey: r.IsPrimaryKey != 0, + IsUnique: r.IsUnique != 0, + NotNull: r.NotNull != 0, + }, nil +} diff --git a/internal/core/cache.go b/internal/core/cache.go new file mode 100644 index 0000000000..34591da696 --- /dev/null +++ b/internal/core/cache.go @@ -0,0 +1,161 @@ +package core + +import ( + "context" + "database/sql" + "errors" + "fmt" + "log/slog" + + "github.com/ncruces/go-sqlite3" + "github.com/ncruces/go-sqlite3/ext/serdes" + + "github.com/sqlc-dev/sqlc/internal/cache" + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +// The name of the sole output blob a CoreCatalog action produces. +const catalogOutput = "catalog.db" + +// rawConn is the driver's escape hatch to the SQLite connection underneath a +// database/sql connection, which the serialization API needs. +type rawConn interface { + Raw() *sqlite3.Conn +} + +// NewCached returns the catalog a dialect and a schema produce, restored from +// the cache when a run has produced it before. +// +// Producing one means seeding the dialect — thousands of rows, since +// PostgreSQL's functions and system catalogs alone run to five figures — and +// then parsing the schema and applying its DDL. The result is the same every +// time, so the finished database is stored in the cache and opened directly on +// the next run, turning all of that work into opening a file. +// It is a single action: the dialect and the schema together are what the +// catalog is, so they are one key, and a hit means apply is never called. +// +// The dialect data is embedded in the sqlc binary, whose digest is an input to +// every action, so the dialect only has to be named. The schema is hashed in +// the order it is applied, since DDL order decides what the catalog holds. +// +// A catalog whose apply fails is returned but not cached, so that a caller can +// report the failure against the catalog it got. A nil catalog means the +// catalog could not be created at all. A cache that cannot be opened, read or +// written is not an error: the catalog is simply built the long way. +func NewCached(dialect string, schema []string, apply func(*Catalog) error, opts ...Option) (*Catalog, error) { + store, action := openAction(dialect, schema) + if store != nil { + defer store.Close() + if cat, err := restore(store, action); err == nil { + return cat, nil + } else if !errors.Is(err, cache.ErrNotFound) { + slog.Debug("restoring the catalog from the cache failed", "err", err) + } + } + + cat, err := New(opts...) + if err != nil { + return nil, err + } + if err := apply(cat); err != nil { + return cat, err + } + if store != nil { + if err := save(store, action, cat); err != nil { + slog.Debug("saving the catalog to the cache failed", "err", err) + } + } + return cat, nil +} + +// openAction opens the cache and digests the action that produces a catalog. A +// nil store means the cache is unavailable and the catalog has to be built. +func openAction(dialect string, schema []string) (*cache.Cache, cache.Digest) { + store, err := cache.Open() + if err != nil { + slog.Debug("opening the cache failed", "err", err) + return nil, cache.Digest{} + } + action := store.NewAction("CoreCatalog").AddInput("dialect", []byte(dialect)) + for _, s := range schema { + action.AddInput("schema", []byte(s)) + } + return store, action.Digest() +} + +// restore opens the catalog a previous run cached. The stored blob is opened +// where it lies rather than copied: analysis only ever reads the catalog, so +// every run that wants this one reads the same file. +func restore(store *cache.Cache, action cache.Digest) (*Catalog, error) { + result, err := store.Actions.Get(action) + if err != nil { + return nil, err + } + path, ok := store.CAS.Filename(result.Outputs[catalogOutput]) + if !ok { + return nil, cache.ErrNotFound + } + + db, err := openFile(path) + if err != nil { + return nil, err + } + + stmts := newStmtCache(db) + cat := &Catalog{db: db, stmts: stmts, q: catalogdb.New(stmts)} + + // The seeds recorded the dialect on the catalog as they ran. A restored + // catalog reads it back from the database instead. + row, err := cat.q.SeededDialect(context.Background()) + if err != nil { + cat.Close() + return nil, fmt.Errorf("core: restored catalog has no dialect: %w", err) + } + cat.dialectOID = row.Oid + return cat, nil +} + +// save stores a finished catalog for the next run. +func save(store *cache.Cache, action cache.Digest, cat *Catalog) error { + blob, err := serialize(cat.db) + if err != nil { + return err + } + digest, err := store.CAS.Put(blob) + if err != nil { + return err + } + return store.Actions.Put(action, &cache.ActionResult{ + Outputs: map[string]cache.Digest{catalogOutput: digest}, + }) +} + +// serialize returns the bytes a database being built in memory would be +// written to disk as, which is what gets stored. +func serialize(db *sql.DB) ([]byte, error) { + var blob []byte + err := withRawConn(db, func(c *sqlite3.Conn) error { + var err error + blob, err = serdes.Serialize(c, "main") + return err + }) + if err != nil { + return nil, fmt.Errorf("core: serialize catalog: %w", err) + } + return blob, nil +} + +func withRawConn(db *sql.DB, fn func(*sqlite3.Conn) error) error { + conn, err := db.Conn(context.Background()) + if err != nil { + return err + } + defer conn.Close() + return conn.Raw(func(driverConn any) error { + r, ok := driverConn.(rawConn) + if !ok { + return fmt.Errorf("driver does not expose its SQLite connection") + } + return fn(r.Raw()) + }) +} diff --git a/internal/core/cast.go b/internal/core/cast.go new file mode 100644 index 0000000000..408663bf8e --- /dev/null +++ b/internal/core/cast.go @@ -0,0 +1,69 @@ +package core + +import ( + "context" + "fmt" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +type CastSpec struct { + SourceTypeOID int64 + TargetTypeOID int64 + ProcOID int64 + Context string + DialectOID int64 +} + +func (c *Catalog) CreateCast(cs CastSpec) error { + if cs.Context == "" { + cs.Context = "e" + } + err := c.q.CreateCast(context.Background(), catalogdb.CreateCastParams{ + SourceTypeOid: cs.SourceTypeOID, + TargetTypeOid: cs.TargetTypeOID, + ProcOid: nullInt64(cs.ProcOID), + Context: cs.Context, + DialectOid: nullInt64(cs.DialectOID), + }) + if err != nil { + return fmt.Errorf("create cast %d->%d: %w", cs.SourceTypeOID, cs.TargetTypeOID, err) + } + return nil +} + +func (c *Catalog) FindCast(src, tgt int64) (CastSpec, bool, error) { + row, err := c.q.FindCast(context.Background(), catalogdb.FindCastParams{ + SourceTypeOid: src, + TargetTypeOid: tgt, + }) + if err != nil { + return CastSpec{}, false, nil + } + return CastSpec{ + SourceTypeOID: row.SourceTypeOid, + TargetTypeOID: row.TargetTypeOid, + ProcOID: orZero(row.ProcOid), + Context: row.Context, + DialectOID: orZero(row.DialectOid), + }, true, nil +} + +func (c *Catalog) CastAllowed(src, tgt int64, ctx string) (bool, error) { + if src == tgt { + return true, nil + } + cs, ok, err := c.FindCast(src, tgt) + if err != nil || !ok { + return false, err + } + switch ctx { + case "i": + return cs.Context == "i", nil + case "a": + return cs.Context == "i" || cs.Context == "a", nil + case "e": + return true, nil + } + return false, fmt.Errorf("unknown cast context %q", ctx) +} diff --git a/internal/core/catalog.go b/internal/core/catalog.go new file mode 100644 index 0000000000..334dcdb787 --- /dev/null +++ b/internal/core/catalog.go @@ -0,0 +1,189 @@ +package core + +import ( + "context" + "database/sql" + "fmt" + "runtime" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" + "github.com/sqlc-dev/sqlc/internal/core/catalogdef" + + _ "github.com/ncruces/go-sqlite3/driver" +) + +//go:generate go run github.com/sqlc-dev/sqlc/cmd/sqlc generate + +type Catalog struct { + db *sql.DB + stmts *stmtCache + q *catalogdb.Queries + + // dialectOID is the dialect this catalog was seeded with. A catalog is + // built for one dialect, so dialect-wide lookups need no other input. + dialectOID int64 + + // loadExtension applies a named extension's seed, installed by the + // dialect's seed for the engines that ship extension data. It runs at most + // once per extension name: a schema is free to say CREATE EXTENSION twice. + loadExtension func(name string) error + extensions map[string]bool + + // types remembers the rows and expressions looked up so far, and rules + // what the dialect does to a type before storing it. + types typeCache + rules rules +} + +type Option func(*Catalog) error + +func WithSeed(fn func(*Catalog) error) Option { + return func(c *Catalog) error { return fn(c) } +} + +func New(opts ...Option) (*Catalog, error) { + db, err := openDB() + if err != nil { + return nil, err + } + + // catalogdef.Schema is a batch of DDL statements, so it goes to the + // connection directly rather than through the prepared-statement cache. + if _, err := db.Exec(catalogdef.Schema); err != nil { + db.Close() + return nil, fmt.Errorf("core: init schema: %w", err) + } + + stmts := newStmtCache(db) + c := &Catalog{db: db, stmts: stmts, q: catalogdb.New(stmts)} + + // Run the seeds inside one transaction rather than paying a commit for each + // of the hundreds of rows a dialect registers. + ctx := context.Background() + if err := stmts.begin(ctx); err != nil { + db.Close() + return nil, fmt.Errorf("core: begin setup: %w", err) + } + if err := c.setup(opts); err != nil { + stmts.rollback() + db.Close() + return nil, err + } + if err := stmts.commit(); err != nil { + db.Close() + return nil, fmt.Errorf("core: commit setup: %w", err) + } + return c, nil +} + +// openFile opens a catalog held in a file, read only. The file is named after +// the hash of its contents, so it can never change under a reader: SQLite is +// told as much, which lets any number of processes share it with no locking +// and no copy. +func openFile(path string) (*sql.DB, error) { + db, err := sql.Open("sqlite3", "file:"+path+"?mode=ro&immutable=1") + if err != nil { + return nil, fmt.Errorf("core: open catalog %s: %w", path, err) + } + // An immutable file has no locking to contend for, so queries analyzed + // concurrently each get their own connection rather than queueing on one. + db.SetMaxOpenConns(runtime.GOMAXPROCS(0)) + db.SetMaxIdleConns(runtime.GOMAXPROCS(0)) + db.SetConnMaxIdleTime(0) + db.SetConnMaxLifetime(0) + return db, nil +} + +// pinPool holds a catalog being built to a single connection that is never +// retired: every ":memory:" connection is its own empty database, so a second +// one would see a catalog with no tables in it. +func pinPool(db *sql.DB) { + db.SetMaxOpenConns(1) + db.SetMaxIdleConns(1) + db.SetConnMaxIdleTime(0) + db.SetConnMaxLifetime(0) +} + +// openDB opens the empty SQLite database a catalog is built in. +func openDB() (*sql.DB, error) { + db, err := sql.Open("sqlite3", ":memory:") + if err != nil { + return nil, fmt.Errorf("core: open catalog: %w", err) + } + pinPool(db) + + // The catalog being built is scratch state that is never read back from + // disk, so durability buys nothing and costs a journal write per statement. + // Foreign keys are declared in the schema as documentation but not + // enforced: dialect seeds carry dangling references (a proc whose return + // type was never registered), and enforcement would also charge an index + // lookup per seeded row. The driver compiles SQLite with enforcement on by + // default, so it is switched off explicitly. + for _, pragma := range []string{ + "PRAGMA journal_mode = OFF", + "PRAGMA synchronous = OFF", + "PRAGMA foreign_keys = OFF", + } { + if _, err := db.Exec(pragma); err != nil { + db.Close() + return nil, fmt.Errorf("core: %s: %w", pragma, err) + } + } + return db, nil +} + +func (c *Catalog) setup(opts []Option) error { + if err := c.bootstrap(); err != nil { + return fmt.Errorf("core: bootstrap: %w", err) + } + for i, opt := range opts { + if err := opt(c); err != nil { + return fmt.Errorf("core: option %d: %w", i, err) + } + } + return nil +} + +func (c *Catalog) Close() error { + err := c.stmts.Close() + if cerr := c.db.Close(); err == nil { + err = cerr + } + return err +} + +func (c *Catalog) DB() *sql.DB { + return c.db +} + +func (c *Catalog) bootstrap() error { + _, err := c.CreateNamespace("public") + return err +} + +// SeededDialectOID returns the dialect this catalog was seeded with, which is +// what anything registered after seeding — an extension's types and functions +// — records as its dialect. +func (c *Catalog) SeededDialectOID() int64 { + return c.dialectOID +} + +// SetExtensionLoader installs the function CREATE EXTENSION calls to apply an +// extension's seed. A dialect without extension data leaves it unset. +func (c *Catalog) SetExtensionLoader(fn func(name string) error) { + c.loadExtension = fn +} + +// LoadExtension applies the named extension's seed to the catalog. An +// extension already applied, or a dialect with no loader, contributes +// nothing; an extension the loader does not know is the loader's to ignore. +func (c *Catalog) LoadExtension(name string) error { + if c.loadExtension == nil || c.extensions[name] { + return nil + } + if c.extensions == nil { + c.extensions = map[string]bool{} + } + c.extensions[name] = true + return c.loadExtension(name) +} diff --git a/internal/core/catalogdb/db.go b/internal/core/catalogdb/db.go new file mode 100644 index 0000000000..8ad3680481 --- /dev/null +++ b/internal/core/catalogdb/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package catalogdb + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/core/catalogdb/models.go b/internal/core/catalogdb/models.go new file mode 100644 index 0000000000..9c103853ea --- /dev/null +++ b/internal/core/catalogdb/models.go @@ -0,0 +1,142 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package catalogdb + +import ( + "database/sql" +) + +type SqlAttribute struct { + Oid int64 + ClassOid int64 + Name string + TypeOid int64 + NotNull int64 + HasDefault int64 + Num int64 + DeclType string + AutoIncrement int64 + IsPrimaryKey int64 + IsUnique int64 + Hidden int64 +} + +type SqlCast struct { + SourceTypeOid int64 + TargetTypeOid int64 + ProcOid sql.NullInt64 + Context string + DialectOid sql.NullInt64 +} + +type SqlClass struct { + Oid int64 + NamespaceOid int64 + Name string + Kind string +} + +type SqlConstraint struct { + Oid int64 + ClassOid int64 + Name string + Kind string + Columns string +} + +type SqlDialect struct { + Oid int64 + Name string +} + +type SqlDialectFlag struct { + DialectOid int64 + Key string + Value string +} + +type SqlNamespace struct { + Oid int64 + Name string +} + +type SqlOperator struct { + Oid int64 + NamespaceOid sql.NullInt64 + DialectOid sql.NullInt64 + Name string + LeftTypeOid sql.NullInt64 + RightTypeOid sql.NullInt64 + ResultTypeOid int64 + ProcOid sql.NullInt64 + CommutatorOid sql.NullInt64 + NegatorOid sql.NullInt64 +} + +type SqlProc struct { + Oid int64 + NamespaceOid sql.NullInt64 + DialectOid sql.NullInt64 + Name string + Kind string + ReturnTypeOid int64 + ReturnSet int64 + ReturnNullable int64 + ReturnTemplate string + Strict int64 + VariadicKind string +} + +type SqlProcArg struct { + ProcOid int64 + Ord int64 + Name string + TypeOid int64 + Mode string + HasDefault int64 +} + +type SqlType struct { + Oid int64 + NamespaceOid int64 + DialectOid sql.NullInt64 + Name string + Expr string + Typtype string + Category sql.NullString + Preferred int64 + FamilyOid sql.NullInt64 + ElementOid sql.NullInt64 + BaseOid sql.NullInt64 + CanonicalOid sql.NullInt64 + NotNull int64 +} + +type SqlTypeAffinity struct { + DialectOid int64 + Ord int64 + Words string + TypeOid int64 +} + +type SqlTypeArg struct { + TypeOid int64 + Ord int64 + Label string + ArgTypeOid sql.NullInt64 + Nullable int64 + IntValue sql.NullInt64 + BoolValue sql.NullInt64 + StringValue sql.NullString + Ident sql.NullString +} + +type SqlTypeRewrite struct { + DialectOid int64 + Ord int64 + Pattern string + Template string + Cond string +} diff --git a/internal/core/catalogdb/query.sql.go b/internal/core/catalogdb/query.sql.go new file mode 100644 index 0000000000..ba4ee026d2 --- /dev/null +++ b/internal/core/catalogdb/query.sql.go @@ -0,0 +1,1445 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package catalogdb + +import ( + "context" + "database/sql" + "strings" +) + +const classAttributes = `-- name: ClassAttributes :many +SELECT oid, name, type_oid, not_null, hidden +FROM sql_attribute +WHERE class_oid = ? +ORDER BY num +` + +type ClassAttributesRow struct { + Oid int64 + Name string + TypeOid int64 + NotNull int64 + Hidden int64 +} + +func (q *Queries) ClassAttributes(ctx context.Context, classOid int64) ([]ClassAttributesRow, error) { + rows, err := q.db.QueryContext(ctx, classAttributes, classOid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ClassAttributesRow + for rows.Next() { + var i ClassAttributesRow + if err := rows.Scan( + &i.Oid, + &i.Name, + &i.TypeOid, + &i.NotNull, + &i.Hidden, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const classOID = `-- name: ClassOID :one +SELECT oid FROM sql_class WHERE namespace_oid = ? AND name = ? +` + +type ClassOIDParams struct { + NamespaceOid int64 + Name string +} + +func (q *Queries) ClassOID(ctx context.Context, arg ClassOIDParams) (int64, error) { + row := q.db.QueryRowContext(ctx, classOID, arg.NamespaceOid, arg.Name) + var oid int64 + err := row.Scan(&oid) + return oid, err +} + +const classOIDByName = `-- name: ClassOIDByName :one +SELECT oid FROM sql_class WHERE name = ? LIMIT 1 +` + +func (q *Queries) ClassOIDByName(ctx context.Context, name string) (int64, error) { + row := q.db.QueryRowContext(ctx, classOIDByName, name) + var oid int64 + err := row.Scan(&oid) + return oid, err +} + +const createAttribute = `-- name: CreateAttribute :exec + +INSERT INTO sql_attribute ( + class_oid, name, type_oid, not_null, has_default, num, + decl_type, auto_increment, is_primary_key, is_unique, hidden +) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +` + +type CreateAttributeParams struct { + ClassOid int64 + Name string + TypeOid int64 + NotNull int64 + HasDefault int64 + Num int64 + DeclType string + AutoIncrement int64 + IsPrimaryKey int64 + IsUnique int64 + Hidden int64 +} + +// ============================= sql_attribute =========================== +func (q *Queries) CreateAttribute(ctx context.Context, arg CreateAttributeParams) error { + _, err := q.db.ExecContext(ctx, createAttribute, + arg.ClassOid, + arg.Name, + arg.TypeOid, + arg.NotNull, + arg.HasDefault, + arg.Num, + arg.DeclType, + arg.AutoIncrement, + arg.IsPrimaryKey, + arg.IsUnique, + arg.Hidden, + ) + return err +} + +const createCast = `-- name: CreateCast :exec + +INSERT INTO sql_cast (source_type_oid, target_type_oid, proc_oid, context, dialect_oid) +VALUES (?, ?, ?, ?, ?) +` + +type CreateCastParams struct { + SourceTypeOid int64 + TargetTypeOid int64 + ProcOid sql.NullInt64 + Context string + DialectOid sql.NullInt64 +} + +// =============================== sql_cast ============================== +func (q *Queries) CreateCast(ctx context.Context, arg CreateCastParams) error { + _, err := q.db.ExecContext(ctx, createCast, + arg.SourceTypeOid, + arg.TargetTypeOid, + arg.ProcOid, + arg.Context, + arg.DialectOid, + ) + return err +} + +const createClass = `-- name: CreateClass :execlastid + +INSERT INTO sql_class (namespace_oid, name, kind) VALUES (?, ?, ?) +` + +type CreateClassParams struct { + NamespaceOid int64 + Name string + Kind string +} + +// =============================== sql_class ============================= +func (q *Queries) CreateClass(ctx context.Context, arg CreateClassParams) (int64, error) { + result, err := q.db.ExecContext(ctx, createClass, arg.NamespaceOid, arg.Name, arg.Kind) + if err != nil { + return 0, err + } + return result.LastInsertId() +} + +const createConstraint = `-- name: CreateConstraint :exec + +INSERT INTO sql_constraint (class_oid, name, kind, columns) VALUES (?, ?, ?, ?) +` + +type CreateConstraintParams struct { + ClassOid int64 + Name string + Kind string + Columns string +} + +// ============================ sql_constraint =========================== +func (q *Queries) CreateConstraint(ctx context.Context, arg CreateConstraintParams) error { + _, err := q.db.ExecContext(ctx, createConstraint, + arg.ClassOid, + arg.Name, + arg.Kind, + arg.Columns, + ) + return err +} + +const createDialect = `-- name: CreateDialect :execlastid + +INSERT INTO sql_dialect (name) VALUES (?) +` + +// ============================== sql_dialect ============================ +func (q *Queries) CreateDialect(ctx context.Context, name string) (int64, error) { + result, err := q.db.ExecContext(ctx, createDialect, name) + if err != nil { + return 0, err + } + return result.LastInsertId() +} + +const createNamespace = `-- name: CreateNamespace :execlastid + + +INSERT INTO sql_namespace (name) VALUES (?) +` + +// Queries against sqlc's own sql_* catalog tables, compiled by sqlc's +// SQLite engine. Regenerate with `go generate ./internal/core/...`. +// ============================ sql_namespace ============================ +func (q *Queries) CreateNamespace(ctx context.Context, name string) (int64, error) { + result, err := q.db.ExecContext(ctx, createNamespace, name) + if err != nil { + return 0, err + } + return result.LastInsertId() +} + +const createOperator = `-- name: CreateOperator :execlastid + +INSERT INTO sql_operator + (namespace_oid, dialect_oid, name, + left_type_oid, right_type_oid, result_type_oid, proc_oid) +VALUES (?, ?, ?, ?, ?, ?, ?) +` + +type CreateOperatorParams struct { + NamespaceOid sql.NullInt64 + DialectOid sql.NullInt64 + Name string + LeftTypeOid sql.NullInt64 + RightTypeOid sql.NullInt64 + ResultTypeOid int64 + ProcOid sql.NullInt64 +} + +// ============================= sql_operator ============================ +func (q *Queries) CreateOperator(ctx context.Context, arg CreateOperatorParams) (int64, error) { + result, err := q.db.ExecContext(ctx, createOperator, + arg.NamespaceOid, + arg.DialectOid, + arg.Name, + arg.LeftTypeOid, + arg.RightTypeOid, + arg.ResultTypeOid, + arg.ProcOid, + ) + if err != nil { + return 0, err + } + return result.LastInsertId() +} + +const createProc = `-- name: CreateProc :execlastid + +INSERT INTO sql_proc + (namespace_oid, dialect_oid, name, kind, + return_type_oid, return_set, return_nullable, return_template, strict, variadic_kind) +VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +` + +type CreateProcParams struct { + NamespaceOid sql.NullInt64 + DialectOid sql.NullInt64 + Name string + Kind string + ReturnTypeOid int64 + ReturnSet int64 + ReturnNullable int64 + ReturnTemplate string + Strict int64 + VariadicKind string +} + +// =============================== sql_proc ============================== +func (q *Queries) CreateProc(ctx context.Context, arg CreateProcParams) (int64, error) { + result, err := q.db.ExecContext(ctx, createProc, + arg.NamespaceOid, + arg.DialectOid, + arg.Name, + arg.Kind, + arg.ReturnTypeOid, + arg.ReturnSet, + arg.ReturnNullable, + arg.ReturnTemplate, + arg.Strict, + arg.VariadicKind, + ) + if err != nil { + return 0, err + } + return result.LastInsertId() +} + +const createProcArg = `-- name: CreateProcArg :exec +INSERT INTO sql_proc_arg (proc_oid, ord, name, type_oid, mode, has_default) +VALUES (?, ?, ?, ?, ?, ?) +` + +type CreateProcArgParams struct { + ProcOid int64 + Ord int64 + Name string + TypeOid int64 + Mode string + HasDefault int64 +} + +func (q *Queries) CreateProcArg(ctx context.Context, arg CreateProcArgParams) error { + _, err := q.db.ExecContext(ctx, createProcArg, + arg.ProcOid, + arg.Ord, + arg.Name, + arg.TypeOid, + arg.Mode, + arg.HasDefault, + ) + return err +} + +const createType = `-- name: CreateType :execlastid + +INSERT INTO sql_type + (name, expr, typtype, category, preferred, namespace_oid, dialect_oid, + family_oid, element_oid, base_oid, canonical_oid, not_null) +VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +` + +type CreateTypeParams struct { + Name string + Expr string + Typtype string + Category sql.NullString + Preferred int64 + NamespaceOid int64 + DialectOid sql.NullInt64 + FamilyOid sql.NullInt64 + ElementOid sql.NullInt64 + BaseOid sql.NullInt64 + CanonicalOid sql.NullInt64 + NotNull int64 +} + +// =============================== sql_type ============================== +func (q *Queries) CreateType(ctx context.Context, arg CreateTypeParams) (int64, error) { + result, err := q.db.ExecContext(ctx, createType, + arg.Name, + arg.Expr, + arg.Typtype, + arg.Category, + arg.Preferred, + arg.NamespaceOid, + arg.DialectOid, + arg.FamilyOid, + arg.ElementOid, + arg.BaseOid, + arg.CanonicalOid, + arg.NotNull, + ) + if err != nil { + return 0, err + } + return result.LastInsertId() +} + +const createTypeAffinity = `-- name: CreateTypeAffinity :exec +INSERT INTO sql_type_affinity (dialect_oid, ord, words, type_oid) +VALUES (?, ?, ?, ?) +` + +type CreateTypeAffinityParams struct { + DialectOid int64 + Ord int64 + Words string + TypeOid int64 +} + +func (q *Queries) CreateTypeAffinity(ctx context.Context, arg CreateTypeAffinityParams) error { + _, err := q.db.ExecContext(ctx, createTypeAffinity, + arg.DialectOid, + arg.Ord, + arg.Words, + arg.TypeOid, + ) + return err +} + +const createTypeArg = `-- name: CreateTypeArg :exec +INSERT INTO sql_type_arg + (type_oid, ord, label, arg_type_oid, nullable, int_value, bool_value, string_value, ident) +VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) +` + +type CreateTypeArgParams struct { + TypeOid int64 + Ord int64 + Label string + ArgTypeOid sql.NullInt64 + Nullable int64 + IntValue sql.NullInt64 + BoolValue sql.NullInt64 + StringValue sql.NullString + Ident sql.NullString +} + +func (q *Queries) CreateTypeArg(ctx context.Context, arg CreateTypeArgParams) error { + _, err := q.db.ExecContext(ctx, createTypeArg, + arg.TypeOid, + arg.Ord, + arg.Label, + arg.ArgTypeOid, + arg.Nullable, + arg.IntValue, + arg.BoolValue, + arg.StringValue, + arg.Ident, + ) + return err +} + +const createTypeRewrite = `-- name: CreateTypeRewrite :exec +INSERT INTO sql_type_rewrite (dialect_oid, ord, pattern, template, cond) +VALUES (?, ?, ?, ?, ?) +` + +type CreateTypeRewriteParams struct { + DialectOid int64 + Ord int64 + Pattern string + Template string + Cond string +} + +func (q *Queries) CreateTypeRewrite(ctx context.Context, arg CreateTypeRewriteParams) error { + _, err := q.db.ExecContext(ctx, createTypeRewrite, + arg.DialectOid, + arg.Ord, + arg.Pattern, + arg.Template, + arg.Cond, + ) + return err +} + +const deleteAttribute = `-- name: DeleteAttribute :exec +DELETE FROM sql_attribute WHERE class_oid = ? AND name = ? +` + +type DeleteAttributeParams struct { + ClassOid int64 + Name string +} + +func (q *Queries) DeleteAttribute(ctx context.Context, arg DeleteAttributeParams) error { + _, err := q.db.ExecContext(ctx, deleteAttribute, arg.ClassOid, arg.Name) + return err +} + +const deleteAttributesByClass = `-- name: DeleteAttributesByClass :exec +DELETE FROM sql_attribute WHERE class_oid = ? +` + +func (q *Queries) DeleteAttributesByClass(ctx context.Context, classOid int64) error { + _, err := q.db.ExecContext(ctx, deleteAttributesByClass, classOid) + return err +} + +const deleteClass = `-- name: DeleteClass :exec +DELETE FROM sql_class WHERE oid = ? +` + +func (q *Queries) DeleteClass(ctx context.Context, oid int64) error { + _, err := q.db.ExecContext(ctx, deleteClass, oid) + return err +} + +const dialectFlag = `-- name: DialectFlag :one +SELECT value FROM sql_dialect_flag WHERE dialect_oid = ? AND key = ? +` + +type DialectFlagParams struct { + DialectOid int64 + Key string +} + +func (q *Queries) DialectFlag(ctx context.Context, arg DialectFlagParams) (string, error) { + row := q.db.QueryRowContext(ctx, dialectFlag, arg.DialectOid, arg.Key) + var value string + err := row.Scan(&value) + return value, err +} + +const dialectOID = `-- name: DialectOID :one +SELECT oid FROM sql_dialect WHERE name = ? +` + +func (q *Queries) DialectOID(ctx context.Context, name string) (int64, error) { + row := q.db.QueryRowContext(ctx, dialectOID, name) + var oid int64 + err := row.Scan(&oid) + return oid, err +} + +const findCast = `-- name: FindCast :one +SELECT source_type_oid, target_type_oid, proc_oid, context, dialect_oid +FROM sql_cast +WHERE source_type_oid = ? AND target_type_oid = ? +` + +type FindCastParams struct { + SourceTypeOid int64 + TargetTypeOid int64 +} + +func (q *Queries) FindCast(ctx context.Context, arg FindCastParams) (SqlCast, error) { + row := q.db.QueryRowContext(ctx, findCast, arg.SourceTypeOid, arg.TargetTypeOid) + var i SqlCast + err := row.Scan( + &i.SourceTypeOid, + &i.TargetTypeOid, + &i.ProcOid, + &i.Context, + &i.DialectOid, + ) + return i, err +} + +const findOperators = `-- name: FindOperators :many +SELECT oid, name, left_type_oid, right_type_oid, result_type_oid, proc_oid +FROM sql_operator +WHERE name = ?1 + AND (?2 = 0 OR left_type_oid = ?2) + AND (?3 = 0 OR right_type_oid = ?3) +` + +type FindOperatorsParams struct { + Name string + LeftTypeOid any + RightTypeOid any +} + +type FindOperatorsRow struct { + Oid int64 + Name string + LeftTypeOid sql.NullInt64 + RightTypeOid sql.NullInt64 + ResultTypeOid int64 + ProcOid sql.NullInt64 +} + +func (q *Queries) FindOperators(ctx context.Context, arg FindOperatorsParams) ([]FindOperatorsRow, error) { + rows, err := q.db.QueryContext(ctx, findOperators, arg.Name, arg.LeftTypeOid, arg.RightTypeOid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FindOperatorsRow + for rows.Next() { + var i FindOperatorsRow + if err := rows.Scan( + &i.Oid, + &i.Name, + &i.LeftTypeOid, + &i.RightTypeOid, + &i.ResultTypeOid, + &i.ProcOid, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const findProcsAnyNamespace = `-- name: FindProcsAnyNamespace :many +SELECT oid, name, kind, return_type_oid, return_nullable, return_template +FROM sql_proc +WHERE name = ? +` + +type FindProcsAnyNamespaceRow struct { + Oid int64 + Name string + Kind string + ReturnTypeOid int64 + ReturnNullable int64 + ReturnTemplate string +} + +func (q *Queries) FindProcsAnyNamespace(ctx context.Context, name string) ([]FindProcsAnyNamespaceRow, error) { + rows, err := q.db.QueryContext(ctx, findProcsAnyNamespace, name) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FindProcsAnyNamespaceRow + for rows.Next() { + var i FindProcsAnyNamespaceRow + if err := rows.Scan( + &i.Oid, + &i.Name, + &i.Kind, + &i.ReturnTypeOid, + &i.ReturnNullable, + &i.ReturnTemplate, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const findProcsInNamespaces = `-- name: FindProcsInNamespaces :many +SELECT oid, name, kind, return_type_oid, return_nullable, return_template +FROM sql_proc +WHERE name = ?1 + AND namespace_oid IN (/*SLICE:namespace_oids*/?) +` + +type FindProcsInNamespacesParams struct { + Name string + NamespaceOids []sql.NullInt64 +} + +type FindProcsInNamespacesRow struct { + Oid int64 + Name string + Kind string + ReturnTypeOid int64 + ReturnNullable int64 + ReturnTemplate string +} + +func (q *Queries) FindProcsInNamespaces(ctx context.Context, arg FindProcsInNamespacesParams) ([]FindProcsInNamespacesRow, error) { + query := findProcsInNamespaces + var queryParams []any + queryParams = append(queryParams, arg.Name) + if len(arg.NamespaceOids) > 0 { + for _, v := range arg.NamespaceOids { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:namespace_oids*/?", strings.Repeat(",?", len(arg.NamespaceOids))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:namespace_oids*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FindProcsInNamespacesRow + for rows.Next() { + var i FindProcsInNamespacesRow + if err := rows.Scan( + &i.Oid, + &i.Name, + &i.Kind, + &i.ReturnTypeOid, + &i.ReturnNullable, + &i.ReturnTemplate, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listClassColumns = `-- name: ListClassColumns :many +SELECT a.name AS column_name, a.type_oid, a.not_null +FROM sql_attribute a +JOIN sql_type t ON t.oid = a.type_oid +WHERE a.class_oid = ? AND a.hidden = 0 +ORDER BY a.num +` + +type ListClassColumnsRow struct { + ColumnName string + TypeOid int64 + NotNull int64 +} + +func (q *Queries) ListClassColumns(ctx context.Context, classOid int64) ([]ListClassColumnsRow, error) { + rows, err := q.db.QueryContext(ctx, listClassColumns, classOid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListClassColumnsRow + for rows.Next() { + var i ListClassColumnsRow + if err := rows.Scan(&i.ColumnName, &i.TypeOid, &i.NotNull); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listNamespaces = `-- name: ListNamespaces :many +SELECT oid, name FROM sql_namespace ORDER BY oid +` + +func (q *Queries) ListNamespaces(ctx context.Context) ([]SqlNamespace, error) { + rows, err := q.db.QueryContext(ctx, listNamespaces) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SqlNamespace + for rows.Next() { + var i SqlNamespace + if err := rows.Scan(&i.Oid, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listTablesInNamespace = `-- name: ListTablesInNamespace :many +SELECT oid, name FROM sql_class +WHERE namespace_oid = ? AND kind = 'r' +ORDER BY oid +` + +type ListTablesInNamespaceRow struct { + Oid int64 + Name string +} + +func (q *Queries) ListTablesInNamespace(ctx context.Context, namespaceOid int64) ([]ListTablesInNamespaceRow, error) { + rows, err := q.db.QueryContext(ctx, listTablesInNamespace, namespaceOid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListTablesInNamespaceRow + for rows.Next() { + var i ListTablesInNamespaceRow + if err := rows.Scan(&i.Oid, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listTypeAffinities = `-- name: ListTypeAffinities :many +SELECT words, type_oid FROM sql_type_affinity +WHERE dialect_oid = ? ORDER BY ord +` + +type ListTypeAffinitiesRow struct { + Words string + TypeOid int64 +} + +func (q *Queries) ListTypeAffinities(ctx context.Context, dialectOid int64) ([]ListTypeAffinitiesRow, error) { + rows, err := q.db.QueryContext(ctx, listTypeAffinities, dialectOid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListTypeAffinitiesRow + for rows.Next() { + var i ListTypeAffinitiesRow + if err := rows.Scan(&i.Words, &i.TypeOid); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listTypeRewrites = `-- name: ListTypeRewrites :many +SELECT pattern, template, cond FROM sql_type_rewrite +WHERE dialect_oid = ? ORDER BY ord +` + +type ListTypeRewritesRow struct { + Pattern string + Template string + Cond string +} + +func (q *Queries) ListTypeRewrites(ctx context.Context, dialectOid int64) ([]ListTypeRewritesRow, error) { + rows, err := q.db.QueryContext(ctx, listTypeRewrites, dialectOid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListTypeRewritesRow + for rows.Next() { + var i ListTypeRewritesRow + if err := rows.Scan(&i.Pattern, &i.Template, &i.Cond); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const lookupAttribute = `-- name: LookupAttribute :one +SELECT ns.name AS schema_name, cls.name AS table_name, a.name AS column_name, a.num, + a.decl_type, a.auto_increment, a.is_primary_key, a.is_unique, a.not_null +FROM sql_attribute a +JOIN sql_class cls ON cls.oid = a.class_oid +JOIN sql_namespace ns ON ns.oid = cls.namespace_oid +WHERE a.oid = ? +` + +type LookupAttributeRow struct { + SchemaName string + TableName string + ColumnName string + Num int64 + DeclType string + AutoIncrement int64 + IsPrimaryKey int64 + IsUnique int64 + NotNull int64 +} + +func (q *Queries) LookupAttribute(ctx context.Context, oid int64) (LookupAttributeRow, error) { + row := q.db.QueryRowContext(ctx, lookupAttribute, oid) + var i LookupAttributeRow + err := row.Scan( + &i.SchemaName, + &i.TableName, + &i.ColumnName, + &i.Num, + &i.DeclType, + &i.AutoIncrement, + &i.IsPrimaryKey, + &i.IsUnique, + &i.NotNull, + ) + return i, err +} + +const lookupType = `-- name: LookupType :one +SELECT oid, namespace_oid, name, expr, category, typtype, preferred, + family_oid, element_oid, base_oid, canonical_oid, not_null +FROM sql_type +WHERE oid = ? +` + +type LookupTypeRow struct { + Oid int64 + NamespaceOid int64 + Name string + Expr string + Category sql.NullString + Typtype string + Preferred int64 + FamilyOid sql.NullInt64 + ElementOid sql.NullInt64 + BaseOid sql.NullInt64 + CanonicalOid sql.NullInt64 + NotNull int64 +} + +func (q *Queries) LookupType(ctx context.Context, oid int64) (LookupTypeRow, error) { + row := q.db.QueryRowContext(ctx, lookupType, oid) + var i LookupTypeRow + err := row.Scan( + &i.Oid, + &i.NamespaceOid, + &i.Name, + &i.Expr, + &i.Category, + &i.Typtype, + &i.Preferred, + &i.FamilyOid, + &i.ElementOid, + &i.BaseOid, + &i.CanonicalOid, + &i.NotNull, + ) + return i, err +} + +const maxAttributeNum = `-- name: MaxAttributeNum :one +SELECT CAST(COALESCE(MAX(num), 0) AS INTEGER) AS num FROM sql_attribute WHERE class_oid = ? +` + +func (q *Queries) MaxAttributeNum(ctx context.Context, classOid int64) (int64, error) { + row := q.db.QueryRowContext(ctx, maxAttributeNum, classOid) + var num int64 + err := row.Scan(&num) + return num, err +} + +const namespaceOID = `-- name: NamespaceOID :one +SELECT oid FROM sql_namespace WHERE name = ? +` + +func (q *Queries) NamespaceOID(ctx context.Context, name string) (int64, error) { + row := q.db.QueryRowContext(ctx, namespaceOID, name) + var oid int64 + err := row.Scan(&oid) + return oid, err +} + +const procArgTypes = `-- name: ProcArgTypes :many +SELECT type_oid FROM sql_proc_arg +WHERE proc_oid = ? AND mode IN ('i', 'b', 'v') +ORDER BY ord +` + +func (q *Queries) ProcArgTypes(ctx context.Context, procOid int64) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, procArgTypes, procOid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var type_oid int64 + if err := rows.Scan(&type_oid); err != nil { + return nil, err + } + items = append(items, type_oid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const renameAttribute = `-- name: RenameAttribute :exec +UPDATE sql_attribute SET name = ?1 +WHERE class_oid = ?2 AND name = ?3 +` + +type RenameAttributeParams struct { + NewName string + ClassOid int64 + Name string +} + +func (q *Queries) RenameAttribute(ctx context.Context, arg RenameAttributeParams) error { + _, err := q.db.ExecContext(ctx, renameAttribute, arg.NewName, arg.ClassOid, arg.Name) + return err +} + +const renameClass = `-- name: RenameClass :exec +UPDATE sql_class SET name = ?1 WHERE oid = ?2 +` + +type RenameClassParams struct { + NewName string + Oid int64 +} + +func (q *Queries) RenameClass(ctx context.Context, arg RenameClassParams) error { + _, err := q.db.ExecContext(ctx, renameClass, arg.NewName, arg.Oid) + return err +} + +const resolveColumn = `-- name: ResolveColumn :one +SELECT a.oid, a.class_oid, a.name, t.name AS type_name, a.type_oid, a.not_null, + a.decl_type, a.auto_increment, a.is_primary_key, a.is_unique +FROM sql_attribute a +JOIN sql_class c ON c.oid = a.class_oid +JOIN sql_type t ON t.oid = a.type_oid +WHERE c.name = ?1 AND a.name = ?2 +` + +type ResolveColumnParams struct { + TableName string + ColumnName string +} + +type ResolveColumnRow struct { + Oid int64 + ClassOid int64 + Name string + TypeName string + TypeOid int64 + NotNull int64 + DeclType string + AutoIncrement int64 + IsPrimaryKey int64 + IsUnique int64 +} + +func (q *Queries) ResolveColumn(ctx context.Context, arg ResolveColumnParams) (ResolveColumnRow, error) { + row := q.db.QueryRowContext(ctx, resolveColumn, arg.TableName, arg.ColumnName) + var i ResolveColumnRow + err := row.Scan( + &i.Oid, + &i.ClassOid, + &i.Name, + &i.TypeName, + &i.TypeOid, + &i.NotNull, + &i.DeclType, + &i.AutoIncrement, + &i.IsPrimaryKey, + &i.IsUnique, + ) + return i, err +} + +const seededDialect = `-- name: SeededDialect :one +SELECT oid, name FROM sql_dialect ORDER BY oid LIMIT 1 +` + +// The dialect a catalog was seeded with. A catalog is built for exactly one, +// so a restored catalog finds it without being told its name. +func (q *Queries) SeededDialect(ctx context.Context) (SqlDialect, error) { + row := q.db.QueryRowContext(ctx, seededDialect) + var i SqlDialect + err := row.Scan(&i.Oid, &i.Name) + return i, err +} + +const setAttributeNotNull = `-- name: SetAttributeNotNull :exec +UPDATE sql_attribute SET not_null = ?1 +WHERE class_oid = ?2 AND name = ?3 +` + +type SetAttributeNotNullParams struct { + NotNull int64 + ClassOid int64 + Name string +} + +func (q *Queries) SetAttributeNotNull(ctx context.Context, arg SetAttributeNotNullParams) error { + _, err := q.db.ExecContext(ctx, setAttributeNotNull, arg.NotNull, arg.ClassOid, arg.Name) + return err +} + +const setAttributePrimaryKey = `-- name: SetAttributePrimaryKey :exec +UPDATE sql_attribute SET is_primary_key = 1, not_null = 1 +WHERE class_oid = ? AND name = ? +` + +type SetAttributePrimaryKeyParams struct { + ClassOid int64 + Name string +} + +func (q *Queries) SetAttributePrimaryKey(ctx context.Context, arg SetAttributePrimaryKeyParams) error { + _, err := q.db.ExecContext(ctx, setAttributePrimaryKey, arg.ClassOid, arg.Name) + return err +} + +const setAttributeType = `-- name: SetAttributeType :exec +UPDATE sql_attribute SET type_oid = ?1, decl_type = ?2 +WHERE class_oid = ?3 AND name = ?4 +` + +type SetAttributeTypeParams struct { + TypeOid int64 + DeclType string + ClassOid int64 + Name string +} + +func (q *Queries) SetAttributeType(ctx context.Context, arg SetAttributeTypeParams) error { + _, err := q.db.ExecContext(ctx, setAttributeType, + arg.TypeOid, + arg.DeclType, + arg.ClassOid, + arg.Name, + ) + return err +} + +const setAttributeUnique = `-- name: SetAttributeUnique :exec +UPDATE sql_attribute SET is_unique = 1 +WHERE class_oid = ? AND name = ? +` + +type SetAttributeUniqueParams struct { + ClassOid int64 + Name string +} + +func (q *Queries) SetAttributeUnique(ctx context.Context, arg SetAttributeUniqueParams) error { + _, err := q.db.ExecContext(ctx, setAttributeUnique, arg.ClassOid, arg.Name) + return err +} + +const setDialectFlag = `-- name: SetDialectFlag :exec +INSERT INTO sql_dialect_flag (dialect_oid, key, value) +VALUES (?, ?, ?) +ON CONFLICT(dialect_oid, key) DO UPDATE SET value = excluded.value +` + +type SetDialectFlagParams struct { + DialectOid int64 + Key string + Value string +} + +func (q *Queries) SetDialectFlag(ctx context.Context, arg SetDialectFlagParams) error { + _, err := q.db.ExecContext(ctx, setDialectFlag, arg.DialectOid, arg.Key, arg.Value) + return err +} + +const tableColumns = `-- name: TableColumns :many +SELECT a.oid, a.class_oid, a.name, t.name AS type_name, a.type_oid, a.not_null, + a.decl_type, a.auto_increment, a.is_primary_key, a.is_unique +FROM sql_attribute a +JOIN sql_class c ON c.oid = a.class_oid +JOIN sql_type t ON t.oid = a.type_oid +WHERE c.name = ? +ORDER BY a.num +` + +type TableColumnsRow struct { + Oid int64 + ClassOid int64 + Name string + TypeName string + TypeOid int64 + NotNull int64 + DeclType string + AutoIncrement int64 + IsPrimaryKey int64 + IsUnique int64 +} + +func (q *Queries) TableColumns(ctx context.Context, name string) ([]TableColumnsRow, error) { + rows, err := q.db.QueryContext(ctx, tableColumns, name) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TableColumnsRow + for rows.Next() { + var i TableColumnsRow + if err := rows.Scan( + &i.Oid, + &i.ClassOid, + &i.Name, + &i.TypeName, + &i.TypeOid, + &i.NotNull, + &i.DeclType, + &i.AutoIncrement, + &i.IsPrimaryKey, + &i.IsUnique, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const typeArgs = `-- name: TypeArgs :many +SELECT ord, label, arg_type_oid, nullable, int_value, bool_value, string_value, ident +FROM sql_type_arg +WHERE type_oid = ? +ORDER BY ord +` + +type TypeArgsRow struct { + Ord int64 + Label string + ArgTypeOid sql.NullInt64 + Nullable int64 + IntValue sql.NullInt64 + BoolValue sql.NullInt64 + StringValue sql.NullString + Ident sql.NullString +} + +func (q *Queries) TypeArgs(ctx context.Context, typeOid int64) ([]TypeArgsRow, error) { + rows, err := q.db.QueryContext(ctx, typeArgs, typeOid) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TypeArgsRow + for rows.Next() { + var i TypeArgsRow + if err := rows.Scan( + &i.Ord, + &i.Label, + &i.ArgTypeOid, + &i.Nullable, + &i.IntValue, + &i.BoolValue, + &i.StringValue, + &i.Ident, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const typeNameByOID = `-- name: TypeNameByOID :one +SELECT name FROM sql_type WHERE oid = ? +` + +func (q *Queries) TypeNameByOID(ctx context.Context, oid int64) (string, error) { + row := q.db.QueryRowContext(ctx, typeNameByOID, oid) + var name string + err := row.Scan(&name) + return name, err +} + +const typeOIDByExpr = `-- name: TypeOIDByExpr :one +SELECT t.oid +FROM sql_type t +JOIN sql_namespace ns ON ns.oid = t.namespace_oid +WHERE t.expr = ?1 +ORDER BY + CASE ns.name + WHEN 'pg_catalog' THEN 0 + WHEN 'public' THEN 1 + ELSE 2 + END, + ns.name +LIMIT 1 +` + +func (q *Queries) TypeOIDByExpr(ctx context.Context, expr string) (int64, error) { + row := q.db.QueryRowContext(ctx, typeOIDByExpr, expr) + var oid int64 + err := row.Scan(&oid) + return oid, err +} + +const typeOIDByExprInNamespace = `-- name: TypeOIDByExprInNamespace :one +SELECT oid FROM sql_type WHERE namespace_oid = ? AND expr = ? +` + +type TypeOIDByExprInNamespaceParams struct { + NamespaceOid int64 + Expr string +} + +func (q *Queries) TypeOIDByExprInNamespace(ctx context.Context, arg TypeOIDByExprInNamespaceParams) (int64, error) { + row := q.db.QueryRowContext(ctx, typeOIDByExprInNamespace, arg.NamespaceOid, arg.Expr) + var oid int64 + err := row.Scan(&oid) + return oid, err +} + +const typeOIDByName = `-- name: TypeOIDByName :one +SELECT t.oid +FROM sql_type t +JOIN sql_namespace ns ON ns.oid = t.namespace_oid +WHERE t.name = ?1 AND t.family_oid IS NULL +ORDER BY + CASE ns.name + WHEN 'pg_catalog' THEN 0 + WHEN 'public' THEN 1 + ELSE 2 + END, + ns.name +LIMIT 1 +` + +// The family spelled name: an instance carries its family's name too, and +// is found by its expression instead. +func (q *Queries) TypeOIDByName(ctx context.Context, name string) (int64, error) { + row := q.db.QueryRowContext(ctx, typeOIDByName, name) + var oid int64 + err := row.Scan(&oid) + return oid, err +} + +const typeOIDByNameInNamespace = `-- name: TypeOIDByNameInNamespace :one +SELECT oid FROM sql_type +WHERE namespace_oid = ? AND name = ? AND family_oid IS NULL +` + +type TypeOIDByNameInNamespaceParams struct { + NamespaceOid int64 + Name string +} + +func (q *Queries) TypeOIDByNameInNamespace(ctx context.Context, arg TypeOIDByNameInNamespaceParams) (int64, error) { + row := q.db.QueryRowContext(ctx, typeOIDByNameInNamespace, arg.NamespaceOid, arg.Name) + var oid int64 + err := row.Scan(&oid) + return oid, err +} + +const typeOIDsByNameInNamespaces = `-- name: TypeOIDsByNameInNamespaces :many +SELECT oid, namespace_oid FROM sql_type +WHERE name = ?1 AND family_oid IS NULL + AND namespace_oid IN (/*SLICE:namespace_oids*/?) +` + +type TypeOIDsByNameInNamespacesParams struct { + Name string + NamespaceOids []int64 +} + +type TypeOIDsByNameInNamespacesRow struct { + Oid int64 + NamespaceOid int64 +} + +func (q *Queries) TypeOIDsByNameInNamespaces(ctx context.Context, arg TypeOIDsByNameInNamespacesParams) ([]TypeOIDsByNameInNamespacesRow, error) { + query := typeOIDsByNameInNamespaces + var queryParams []any + queryParams = append(queryParams, arg.Name) + if len(arg.NamespaceOids) > 0 { + for _, v := range arg.NamespaceOids { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:namespace_oids*/?", strings.Repeat(",?", len(arg.NamespaceOids))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:namespace_oids*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TypeOIDsByNameInNamespacesRow + for rows.Next() { + var i TypeOIDsByNameInNamespacesRow + if err := rows.Scan(&i.Oid, &i.NamespaceOid); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const typeOIDsInCategory = `-- name: TypeOIDsInCategory :many +SELECT oid FROM sql_type +WHERE dialect_oid = ? AND category = ? + AND family_oid IS NULL AND canonical_oid IS NULL +ORDER BY oid +` + +type TypeOIDsInCategoryParams struct { + DialectOid sql.NullInt64 + Category sql.NullString +} + +// The families of a category: an instance inherits its family's category +// and an alias stands for the row it points at, so neither is listed. +func (q *Queries) TypeOIDsInCategory(ctx context.Context, arg TypeOIDsInCategoryParams) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, typeOIDsInCategory, arg.DialectOid, arg.Category) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var oid int64 + if err := rows.Scan(&oid); err != nil { + return nil, err + } + items = append(items, oid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/core/catalogdef/embed.go b/internal/core/catalogdef/embed.go new file mode 100644 index 0000000000..416961f2f2 --- /dev/null +++ b/internal/core/catalogdef/embed.go @@ -0,0 +1,6 @@ +package catalogdef + +import _ "embed" + +//go:embed schema.sql +var Schema string diff --git a/internal/core/catalogdef/query.sql b/internal/core/catalogdef/query.sql new file mode 100644 index 0000000000..2c56ac5d15 --- /dev/null +++ b/internal/core/catalogdef/query.sql @@ -0,0 +1,284 @@ +-- Queries against sqlc's own sql_* catalog tables, compiled by sqlc's +-- SQLite engine. Regenerate with `go generate ./internal/core/...`. + +-- ============================ sql_namespace ============================ + +-- name: CreateNamespace :execlastid +INSERT INTO sql_namespace (name) VALUES (?); + +-- name: NamespaceOID :one +SELECT oid FROM sql_namespace WHERE name = ?; + +-- name: ListNamespaces :many +SELECT oid, name FROM sql_namespace ORDER BY oid; + +-- ============================== sql_dialect ============================ + +-- name: CreateDialect :execlastid +INSERT INTO sql_dialect (name) VALUES (?); + +-- name: DialectOID :one +SELECT oid FROM sql_dialect WHERE name = ?; + +-- name: SeededDialect :one +-- The dialect a catalog was seeded with. A catalog is built for exactly one, +-- so a restored catalog finds it without being told its name. +SELECT oid, name FROM sql_dialect ORDER BY oid LIMIT 1; + +-- name: SetDialectFlag :exec +INSERT INTO sql_dialect_flag (dialect_oid, key, value) +VALUES (?, ?, ?) +ON CONFLICT(dialect_oid, key) DO UPDATE SET value = excluded.value; + +-- name: DialectFlag :one +SELECT value FROM sql_dialect_flag WHERE dialect_oid = ? AND key = ?; + +-- =============================== sql_type ============================== + +-- name: CreateType :execlastid +INSERT INTO sql_type + (name, expr, typtype, category, preferred, namespace_oid, dialect_oid, + family_oid, element_oid, base_oid, canonical_oid, not_null) +VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + +-- name: CreateTypeArg :exec +INSERT INTO sql_type_arg + (type_oid, ord, label, arg_type_oid, nullable, int_value, bool_value, string_value, ident) +VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?); + +-- name: TypeArgs :many +SELECT ord, label, arg_type_oid, nullable, int_value, bool_value, string_value, ident +FROM sql_type_arg +WHERE type_oid = ? +ORDER BY ord; + +-- name: TypeOIDByExpr :one +SELECT t.oid +FROM sql_type t +JOIN sql_namespace ns ON ns.oid = t.namespace_oid +WHERE t.expr = sqlc.arg(expr) +ORDER BY + CASE ns.name + WHEN 'pg_catalog' THEN 0 + WHEN 'public' THEN 1 + ELSE 2 + END, + ns.name +LIMIT 1; + +-- name: TypeOIDsByNameInNamespaces :many +SELECT oid, namespace_oid FROM sql_type +WHERE name = sqlc.arg(name) AND family_oid IS NULL + AND namespace_oid IN (sqlc.slice(namespace_oids)); + +-- name: TypeOIDByNameInNamespace :one +SELECT oid FROM sql_type +WHERE namespace_oid = ? AND name = ? AND family_oid IS NULL; + +-- name: TypeOIDByExprInNamespace :one +SELECT oid FROM sql_type WHERE namespace_oid = ? AND expr = ?; + +-- name: TypeOIDByName :one +-- The family spelled name: an instance carries its family's name too, and +-- is found by its expression instead. +SELECT t.oid +FROM sql_type t +JOIN sql_namespace ns ON ns.oid = t.namespace_oid +WHERE t.name = sqlc.arg(name) AND t.family_oid IS NULL +ORDER BY + CASE ns.name + WHEN 'pg_catalog' THEN 0 + WHEN 'public' THEN 1 + ELSE 2 + END, + ns.name +LIMIT 1; + +-- name: TypeNameByOID :one +SELECT name FROM sql_type WHERE oid = ?; + +-- name: TypeOIDsInCategory :many +-- The families of a category: an instance inherits its family's category +-- and an alias stands for the row it points at, so neither is listed. +SELECT oid FROM sql_type +WHERE dialect_oid = ? AND category = ? + AND family_oid IS NULL AND canonical_oid IS NULL +ORDER BY oid; + +-- name: LookupType :one +SELECT oid, namespace_oid, name, expr, category, typtype, preferred, + family_oid, element_oid, base_oid, canonical_oid, not_null +FROM sql_type +WHERE oid = ?; + +-- name: CreateTypeRewrite :exec +INSERT INTO sql_type_rewrite (dialect_oid, ord, pattern, template, cond) +VALUES (?, ?, ?, ?, ?); + +-- name: ListTypeRewrites :many +SELECT pattern, template, cond FROM sql_type_rewrite +WHERE dialect_oid = ? ORDER BY ord; + +-- name: CreateTypeAffinity :exec +INSERT INTO sql_type_affinity (dialect_oid, ord, words, type_oid) +VALUES (?, ?, ?, ?); + +-- name: ListTypeAffinities :many +SELECT words, type_oid FROM sql_type_affinity +WHERE dialect_oid = ? ORDER BY ord; + +-- =============================== sql_class ============================= + +-- name: CreateClass :execlastid +INSERT INTO sql_class (namespace_oid, name, kind) VALUES (?, ?, ?); + +-- name: ClassOID :one +SELECT oid FROM sql_class WHERE namespace_oid = ? AND name = ?; + +-- name: ClassOIDByName :one +SELECT oid FROM sql_class WHERE name = ? LIMIT 1; + +-- name: ListTablesInNamespace :many +SELECT oid, name FROM sql_class +WHERE namespace_oid = ? AND kind = 'r' +ORDER BY oid; + +-- name: DeleteClass :exec +DELETE FROM sql_class WHERE oid = ?; + +-- name: RenameClass :exec +UPDATE sql_class SET name = sqlc.arg(new_name) WHERE oid = sqlc.arg(oid); + +-- ============================= sql_attribute =========================== + +-- name: CreateAttribute :exec +INSERT INTO sql_attribute ( + class_oid, name, type_oid, not_null, has_default, num, + decl_type, auto_increment, is_primary_key, is_unique, hidden +) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + +-- name: SetAttributePrimaryKey :exec +UPDATE sql_attribute SET is_primary_key = 1, not_null = 1 +WHERE class_oid = ? AND name = ?; + +-- name: SetAttributeUnique :exec +UPDATE sql_attribute SET is_unique = 1 +WHERE class_oid = ? AND name = ?; + +-- name: DeleteAttributesByClass :exec +DELETE FROM sql_attribute WHERE class_oid = ?; + +-- name: DeleteAttribute :exec +DELETE FROM sql_attribute WHERE class_oid = ? AND name = ?; + +-- name: RenameAttribute :exec +UPDATE sql_attribute SET name = sqlc.arg(new_name) +WHERE class_oid = sqlc.arg(class_oid) AND name = sqlc.arg(name); + +-- name: SetAttributeType :exec +UPDATE sql_attribute SET type_oid = sqlc.arg(type_oid), decl_type = sqlc.arg(decl_type) +WHERE class_oid = sqlc.arg(class_oid) AND name = sqlc.arg(name); + +-- name: SetAttributeNotNull :exec +UPDATE sql_attribute SET not_null = sqlc.arg(not_null) +WHERE class_oid = sqlc.arg(class_oid) AND name = sqlc.arg(name); + +-- name: MaxAttributeNum :one +SELECT CAST(COALESCE(MAX(num), 0) AS INTEGER) AS num FROM sql_attribute WHERE class_oid = ?; + +-- name: ResolveColumn :one +SELECT a.oid, a.class_oid, a.name, t.name AS type_name, a.type_oid, a.not_null, + a.decl_type, a.auto_increment, a.is_primary_key, a.is_unique +FROM sql_attribute a +JOIN sql_class c ON c.oid = a.class_oid +JOIN sql_type t ON t.oid = a.type_oid +WHERE c.name = sqlc.arg(table_name) AND a.name = sqlc.arg(column_name); + +-- name: TableColumns :many +SELECT a.oid, a.class_oid, a.name, t.name AS type_name, a.type_oid, a.not_null, + a.decl_type, a.auto_increment, a.is_primary_key, a.is_unique +FROM sql_attribute a +JOIN sql_class c ON c.oid = a.class_oid +JOIN sql_type t ON t.oid = a.type_oid +WHERE c.name = ? +ORDER BY a.num; + +-- name: ClassAttributes :many +SELECT oid, name, type_oid, not_null, hidden +FROM sql_attribute +WHERE class_oid = ? +ORDER BY num; + +-- name: ListClassColumns :many +SELECT a.name AS column_name, a.type_oid, a.not_null +FROM sql_attribute a +JOIN sql_type t ON t.oid = a.type_oid +WHERE a.class_oid = ? AND a.hidden = 0 +ORDER BY a.num; + +-- name: LookupAttribute :one +SELECT ns.name AS schema_name, cls.name AS table_name, a.name AS column_name, a.num, + a.decl_type, a.auto_increment, a.is_primary_key, a.is_unique, a.not_null +FROM sql_attribute a +JOIN sql_class cls ON cls.oid = a.class_oid +JOIN sql_namespace ns ON ns.oid = cls.namespace_oid +WHERE a.oid = ?; + +-- ============================ sql_constraint =========================== + +-- name: CreateConstraint :exec +INSERT INTO sql_constraint (class_oid, name, kind, columns) VALUES (?, ?, ?, ?); + +-- =============================== sql_proc ============================== + +-- name: CreateProc :execlastid +INSERT INTO sql_proc + (namespace_oid, dialect_oid, name, kind, + return_type_oid, return_set, return_nullable, return_template, strict, variadic_kind) +VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + +-- name: CreateProcArg :exec +INSERT INTO sql_proc_arg (proc_oid, ord, name, type_oid, mode, has_default) +VALUES (?, ?, ?, ?, ?, ?); + +-- name: ProcArgTypes :many +SELECT type_oid FROM sql_proc_arg +WHERE proc_oid = ? AND mode IN ('i', 'b', 'v') +ORDER BY ord; + +-- name: FindProcsAnyNamespace :many +SELECT oid, name, kind, return_type_oid, return_nullable, return_template +FROM sql_proc +WHERE name = ?; + +-- name: FindProcsInNamespaces :many +SELECT oid, name, kind, return_type_oid, return_nullable, return_template +FROM sql_proc +WHERE name = sqlc.arg(name) + AND namespace_oid IN (sqlc.slice(namespace_oids)); + +-- ============================= sql_operator ============================ + +-- name: CreateOperator :execlastid +INSERT INTO sql_operator + (namespace_oid, dialect_oid, name, + left_type_oid, right_type_oid, result_type_oid, proc_oid) +VALUES (?, ?, ?, ?, ?, ?, ?); + +-- name: FindOperators :many +SELECT oid, name, left_type_oid, right_type_oid, result_type_oid, proc_oid +FROM sql_operator +WHERE name = sqlc.arg(name) + AND (sqlc.arg(left_type_oid) = 0 OR left_type_oid = sqlc.arg(left_type_oid)) + AND (sqlc.arg(right_type_oid) = 0 OR right_type_oid = sqlc.arg(right_type_oid)); + +-- =============================== sql_cast ============================== + +-- name: CreateCast :exec +INSERT INTO sql_cast (source_type_oid, target_type_oid, proc_oid, context, dialect_oid) +VALUES (?, ?, ?, ?, ?); + +-- name: FindCast :one +SELECT source_type_oid, target_type_oid, proc_oid, context, dialect_oid +FROM sql_cast +WHERE source_type_oid = ? AND target_type_oid = ?; diff --git a/internal/core/catalogdef/schema.sql b/internal/core/catalogdef/schema.sql new file mode 100644 index 0000000000..26c70436e9 --- /dev/null +++ b/internal/core/catalogdef/schema.sql @@ -0,0 +1,227 @@ +-- sql_namespace: schemas / namespaces +CREATE TABLE sql_namespace ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL UNIQUE +); + +-- sql_dialect: registered SQL dialects (postgresql, sqlite, mysql, ...). +CREATE TABLE sql_dialect ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL UNIQUE +); + +-- sql_dialect_flag: per-dialect configuration knobs (case-folding, +-- identifier quoting, alias scoping rules, etc.). Values are opaque +-- strings; the analyzer interprets them per key. +CREATE TABLE sql_dialect_flag ( + dialect_oid INTEGER NOT NULL REFERENCES sql_dialect(oid), + key TEXT NOT NULL, + value TEXT NOT NULL, + PRIMARY KEY (dialect_oid, key) +); + +-- sql_type: data types, one row per type expression. Modeled on pg_type, +-- with the arguments PostgreSQL keeps as a typmod on the use site held in +-- the row instead. +-- +-- A row is a family — a name the dialect or the schema declares: numeric, +-- array, mood — or an instance, a family applied to arguments: numeric(10, 2), +-- array(integer). expr is the canonical spelling of the whole expression and +-- the row's identity; name is the family's name, on an instance too, so a +-- lookup by name finds the family and an instance points at it. +-- +-- typtype: 'b'ase | 'c'omposite | 'd'omain | 'e'num | 'p'seudo | 'r'ange +-- category: 'N'umeric | 'S'tring | 'B'oolean | 'D'atetime | 'A'rray | +-- 'C'omposite | 'E'num | 'U'serdef | 'X'unknown +-- preferred: tie-breaker for implicit cast resolution within a category +-- family_oid: NULL on a family; the family on an instance +-- element_oid: what the type holds: an array's element, a map's value, +-- a range's subtype +-- base_oid: what the type stands on: a domain's or alias type's base, +-- a wrapper's inner type, a SQLite spelling's affinity +-- canonical_oid: the row the engine reports this one as: an alias spelling +-- points at the type it names +-- not_null: a domain or alias type declared NOT NULL +-- dialect_oid: NULL = standard / shared across dialects +CREATE TABLE sql_type ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + namespace_oid INTEGER NOT NULL REFERENCES sql_namespace(oid), + dialect_oid INTEGER REFERENCES sql_dialect(oid), + name TEXT NOT NULL, + expr TEXT NOT NULL, + typtype TEXT NOT NULL DEFAULT 'b', + category TEXT, + preferred INTEGER NOT NULL DEFAULT 0, + family_oid INTEGER REFERENCES sql_type(oid), + element_oid INTEGER REFERENCES sql_type(oid), + base_oid INTEGER REFERENCES sql_type(oid), + canonical_oid INTEGER REFERENCES sql_type(oid), + not_null INTEGER NOT NULL DEFAULT 0, + UNIQUE (namespace_oid, expr) +); +CREATE INDEX idx_sql_type_name ON sql_type(name); + +-- sql_type_arg: the arguments of an instance, or the fields, labels or +-- members of a declared composite, enum or set, in order. Exactly one of +-- arg_type_oid, int_value, bool_value, string_value and ident is set. +-- label: a struct field, tuple element or enum label +-- nullable: the argument type is nullable at this position, as the inner +-- type of Array(Nullable(String)) is +-- ident: a bare word that is not a type: max, sum, day to second +CREATE TABLE sql_type_arg ( + type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + ord INTEGER NOT NULL, + label TEXT NOT NULL DEFAULT '', + arg_type_oid INTEGER REFERENCES sql_type(oid), + nullable INTEGER NOT NULL DEFAULT 0, + int_value INTEGER, + bool_value INTEGER, + string_value TEXT, + ident TEXT, + PRIMARY KEY (type_oid, ord) +); + +-- sql_type_rewrite: the rewrites a dialect applies to a type before it is +-- interned, in order, which are how a dialect stores what only it spells: +-- SQL Server keeps float(24) as real and a bare decimal as decimal(18,0), +-- ClickHouse keeps Decimal32(4) as Decimal(9, 4). pattern is a type +-- expression whose arguments may be $1, $2... binding whatever stands there; +-- template is the expression the match becomes, with the bindings +-- substituted; cond bounds a binding, as "$1 <= 24" does. +CREATE TABLE sql_type_rewrite ( + dialect_oid INTEGER NOT NULL REFERENCES sql_dialect(oid), + ord INTEGER NOT NULL, + pattern TEXT NOT NULL, + template TEXT NOT NULL, + cond TEXT NOT NULL DEFAULT '', + PRIMARY KEY (dialect_oid, ord) +); + +-- sql_type_affinity: the rule a dialect resolves an unseeded type family +-- by, in order: the first row one of whose words the family's name +-- contains names the type it stands on, and a row with no words is the +-- default. SQLite gives every declared spelling one of five affinities +-- this way. +CREATE TABLE sql_type_affinity ( + dialect_oid INTEGER NOT NULL REFERENCES sql_dialect(oid), + ord INTEGER NOT NULL, + words TEXT NOT NULL DEFAULT '', -- comma-separated, upper case + type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + PRIMARY KEY (dialect_oid, ord) +); + +-- sql_class: relations (tables, views, indexes). +-- kind: 'r' = table, 'v' = view, 'i' = index, 'c' = composite type, 'f' = foreign +CREATE TABLE sql_class ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + namespace_oid INTEGER NOT NULL REFERENCES sql_namespace(oid), + name TEXT NOT NULL, + kind TEXT NOT NULL DEFAULT 'r', + UNIQUE(namespace_oid, name) +); + +-- sql_attribute: columns of a relation. +-- decl_type: the type as the schema spelled it, before +-- canonicalization (VARCHAR(10), BIGINT UNSIGNED), which +-- is what a formatter prints back and what SQLite reports. +-- auto_increment: rowid alias (sqlite INTEGER PRIMARY KEY), AUTOINCREMENT, +-- pg serial/bigserial/identity, mysql AUTO_INCREMENT. +-- is_primary_key: this column participates in the relation's primary key. +-- Set both for inline-column PK and for table-level PK. +-- is_unique: column has a UNIQUE constraint or a single-column UNIQUE +-- table constraint. +-- hidden: resolvable by name but absent from a star expansion and +-- from the relation's model, like the column an sqlite +-- fts5 table names after itself. +CREATE TABLE sql_attribute ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + class_oid INTEGER NOT NULL REFERENCES sql_class(oid), + name TEXT NOT NULL, + type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + not_null INTEGER NOT NULL DEFAULT 0, + has_default INTEGER NOT NULL DEFAULT 0, + num INTEGER NOT NULL, -- ordinal position (1-based) + decl_type TEXT NOT NULL DEFAULT '', + auto_increment INTEGER NOT NULL DEFAULT 0, + is_primary_key INTEGER NOT NULL DEFAULT 0, + is_unique INTEGER NOT NULL DEFAULT 0, + hidden INTEGER NOT NULL DEFAULT 0, + UNIQUE(class_oid, name), + UNIQUE(class_oid, num) +); + +-- sql_constraint: constraints on a relation. +-- kind: 'p' = primary key, 'f' = foreign key, 'u' = unique, 'c' = check +CREATE TABLE sql_constraint ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + class_oid INTEGER NOT NULL REFERENCES sql_class(oid), + name TEXT NOT NULL DEFAULT '', + kind TEXT NOT NULL, + columns TEXT NOT NULL DEFAULT '' -- comma-separated attribute nums +); + +-- sql_proc: functions, aggregates, window functions, procedures. +-- Modeled on pg_proc. +-- kind: 'f' = function, 'a' = aggregate, 'w' = window, 'p' = procedure +-- variadic_kind: 'n' = none, 'a' = array (VARIADIC any[]), 'v' = variadic-any +-- return_set: 1 if SETOF / table-returning +-- return_template: the result as an expression over the call's arguments, +-- when it depends on their values: Decimal(18, $2) for +-- toDecimal64(x, s). Empty for a result the type says. +CREATE TABLE sql_proc ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + namespace_oid INTEGER REFERENCES sql_namespace(oid), + dialect_oid INTEGER REFERENCES sql_dialect(oid), + name TEXT NOT NULL, + kind TEXT NOT NULL DEFAULT 'f', + return_type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + return_set INTEGER NOT NULL DEFAULT 0, + return_nullable INTEGER NOT NULL DEFAULT 1, + return_template TEXT NOT NULL DEFAULT '', + strict INTEGER NOT NULL DEFAULT 0, + variadic_kind TEXT NOT NULL DEFAULT 'n' +); + +-- sql_proc_arg: ordered argument list for a proc. +-- mode: 'i' = in, 'o' = out, 'b' = both, 't' = table, 'v' = variadic +CREATE TABLE sql_proc_arg ( + proc_oid INTEGER NOT NULL REFERENCES sql_proc(oid), + ord INTEGER NOT NULL, + name TEXT NOT NULL DEFAULT '', + type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + mode TEXT NOT NULL DEFAULT 'i', + has_default INTEGER NOT NULL DEFAULT 0, + PRIMARY KEY (proc_oid, ord) +); + +-- sql_operator: operator overloads. +-- left_type_oid is NULL for prefix unary; right_type_oid is NULL for postfix. +CREATE TABLE sql_operator ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + namespace_oid INTEGER REFERENCES sql_namespace(oid), + dialect_oid INTEGER REFERENCES sql_dialect(oid), + name TEXT NOT NULL, + left_type_oid INTEGER REFERENCES sql_type(oid), + right_type_oid INTEGER REFERENCES sql_type(oid), + result_type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + proc_oid INTEGER REFERENCES sql_proc(oid), + commutator_oid INTEGER REFERENCES sql_operator(oid), + negator_oid INTEGER REFERENCES sql_operator(oid) +); + +-- sql_cast: type coercion rules. +-- context: 'i' = implicit, 'a' = assignment-only, 'e' = explicit-only +-- proc_oid NULL = binary-coercible (no function needed) +CREATE TABLE sql_cast ( + source_type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + target_type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + proc_oid INTEGER REFERENCES sql_proc(oid), + context TEXT NOT NULL DEFAULT 'e', + dialect_oid INTEGER REFERENCES sql_dialect(oid), + PRIMARY KEY (source_type_oid, target_type_oid) +); + +-- Resolution-speed indexes. +CREATE INDEX idx_sql_proc_name ON sql_proc(name, namespace_oid); +CREATE INDEX idx_sql_operator_name ON sql_operator(name, left_type_oid, right_type_oid); +CREATE INDEX idx_sql_attribute_name ON sql_attribute(name); diff --git a/internal/core/class.go b/internal/core/class.go new file mode 100644 index 0000000000..7f3e140939 --- /dev/null +++ b/internal/core/class.go @@ -0,0 +1,78 @@ +package core + +import ( + "context" + "fmt" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +func (c *Catalog) CreateClass(namespaceOID int64, name string, kind string) (int64, error) { + oid, err := c.q.CreateClass(context.Background(), catalogdb.CreateClassParams{ + NamespaceOid: namespaceOID, + Name: name, + Kind: kind, + }) + if err != nil { + return 0, fmt.Errorf("create class %q: %w", name, err) + } + return oid, nil +} + +func (c *Catalog) ClassOID(namespaceOID int64, name string) (int64, error) { + oid, err := c.q.ClassOID(context.Background(), catalogdb.ClassOIDParams{ + NamespaceOid: namespaceOID, + Name: name, + }) + if err != nil { + return 0, fmt.Errorf("class %q: %w", name, err) + } + return oid, nil +} + +func (c *Catalog) ClassOIDByName(name string) (int64, error) { + oid, err := c.q.ClassOIDByName(context.Background(), name) + if err != nil { + return 0, fmt.Errorf("class %q: %w", name, err) + } + return oid, nil +} + +func (c *Catalog) DropClass(classOID int64) error { + ctx := context.Background() + if err := c.q.DeleteAttributesByClass(ctx, classOID); err != nil { + return fmt.Errorf("drop class %d attributes: %w", classOID, err) + } + if err := c.q.DeleteClass(ctx, classOID); err != nil { + return fmt.Errorf("drop class %d: %w", classOID, err) + } + return nil +} + +func (c *Catalog) RenameClass(classOID int64, name string) error { + err := c.q.RenameClass(context.Background(), catalogdb.RenameClassParams{ + Oid: classOID, + NewName: name, + }) + if err != nil { + return fmt.Errorf("rename class %d: %w", classOID, err) + } + return nil +} + +type ClassInfo struct { + OID int64 + Name string +} + +func (c *Catalog) TablesInNamespace(namespaceOID int64) ([]ClassInfo, error) { + rows, err := c.q.ListTablesInNamespace(context.Background(), namespaceOID) + if err != nil { + return nil, fmt.Errorf("list tables in namespace %d: %w", namespaceOID, err) + } + out := make([]ClassInfo, 0, len(rows)) + for _, r := range rows { + out = append(out, ClassInfo{OID: r.Oid, Name: r.Name}) + } + return out, nil +} diff --git a/internal/core/constraint.go b/internal/core/constraint.go new file mode 100644 index 0000000000..d75e3c2abf --- /dev/null +++ b/internal/core/constraint.go @@ -0,0 +1,21 @@ +package core + +import ( + "context" + "fmt" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +func (c *Catalog) CreateConstraint(classOID int64, name string, kind string, columns string) error { + err := c.q.CreateConstraint(context.Background(), catalogdb.CreateConstraintParams{ + ClassOid: classOID, + Name: name, + Kind: kind, + Columns: columns, + }) + if err != nil { + return fmt.Errorf("create constraint %q on class %d: %w", name, classOID, err) + } + return nil +} diff --git a/internal/core/db.go b/internal/core/db.go new file mode 100644 index 0000000000..1f58522ee9 --- /dev/null +++ b/internal/core/db.go @@ -0,0 +1,171 @@ +package core + +import ( + "context" + "database/sql" + "sync" +) + +// stmtCache is a catalogdb.DBTX that keeps one prepared statement per distinct +// query string. +// +// The catalog runs the same dozen or so statements over and over — seeding a +// dialect is hundreds of inserts through a handful of queries, and analysis +// issues one lookup per table, column, type, operator and function a statement +// touches. Handing the raw *sql.DB to catalogdb means SQLite re-parses and +// re-plans that SQL text on every call, which dominated both paths. Preparing +// once and rebinding is the whole win. +// +// Statements live for the lifetime of the catalog and are released by Close. +type stmtCache struct { + db *sql.DB + + mu sync.RWMutex + stmts map[string]*sql.Stmt + + // While a transaction is open every statement must be prepared on the + // transaction's own connection: the catalog pins the pool to a single + // connection, so reaching for the *sql.DB mid-transaction would block + // forever waiting for a connection the transaction already holds. These + // statements are owned by the transaction and die with it. + tx *sql.Tx + txStmts map[string]*sql.Stmt +} + +func newStmtCache(db *sql.DB) *stmtCache { + return &stmtCache{db: db, stmts: make(map[string]*sql.Stmt)} +} + +func (c *stmtCache) prepared(ctx context.Context, query string) (*sql.Stmt, error) { + c.mu.RLock() + tx, cache := c.tx, c.stmts + if tx != nil { + cache = c.txStmts + } + stmt, ok := cache[query] + c.mu.RUnlock() + if ok { + return stmt, nil + } + + if tx != nil { + stmt, err := tx.PrepareContext(ctx, query) + if err != nil { + return nil, err + } + c.mu.Lock() + defer c.mu.Unlock() + // Bail out if the transaction ended while we were preparing; the + // statement is dead either way. + if c.tx != tx { + return stmt, nil + } + if existing, ok := c.txStmts[query]; ok { + stmt.Close() + return existing, nil + } + c.txStmts[query] = stmt + return stmt, nil + } + + stmt, err := c.db.PrepareContext(ctx, query) + if err != nil { + return nil, err + } + + c.mu.Lock() + defer c.mu.Unlock() + // Another goroutine may have prepared the same query while we were not + // holding the lock; keep the winner so each query has a single statement. + if existing, ok := c.stmts[query]; ok { + stmt.Close() + return existing, nil + } + c.stmts[query] = stmt + return stmt, nil +} + +func (c *stmtCache) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) { + stmt, err := c.prepared(ctx, query) + if err != nil { + return nil, err + } + return stmt.ExecContext(ctx, args...) +} + +func (c *stmtCache) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) { + stmt, err := c.prepared(ctx, query) + if err != nil { + return nil, err + } + return stmt.QueryContext(ctx, args...) +} + +func (c *stmtCache) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row { + stmt, err := c.prepared(ctx, query) + if err != nil { + // *sql.Row carries an error but has no exported constructor, so fall + // back to the unprepared path and let it report the failure on Scan. + return c.db.QueryRowContext(ctx, query, args...) + } + return stmt.QueryRowContext(ctx, args...) +} + +// PrepareContext returns a statement owned by the caller; it is deliberately +// not cached, since the caller is responsible for closing it. +func (c *stmtCache) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) { + return c.db.PrepareContext(ctx, query) +} + +// begin opens a transaction that every subsequent statement runs inside, until +// commit or rollback. Batching writes this way saves SQLite a commit per +// statement, which is most of the cost of installing a dialect seed. +func (c *stmtCache) begin(ctx context.Context) error { + tx, err := c.db.BeginTx(ctx, nil) + if err != nil { + return err + } + c.mu.Lock() + c.tx = tx + c.txStmts = make(map[string]*sql.Stmt) + c.mu.Unlock() + return nil +} + +// endTx detaches the current transaction and returns it, or nil if none is +// open. The transaction's statements are released along with it. +func (c *stmtCache) endTx() *sql.Tx { + c.mu.Lock() + defer c.mu.Unlock() + tx := c.tx + c.tx, c.txStmts = nil, nil + return tx +} + +func (c *stmtCache) commit() error { + if tx := c.endTx(); tx != nil { + return tx.Commit() + } + return nil +} + +func (c *stmtCache) rollback() { + if tx := c.endTx(); tx != nil { + tx.Rollback() + } +} + +func (c *stmtCache) Close() error { + c.rollback() + + c.mu.Lock() + defer c.mu.Unlock() + var firstErr error + for query, stmt := range c.stmts { + if err := stmt.Close(); err != nil && firstErr == nil { + firstErr = err + } + delete(c.stmts, query) + } + return firstErr +} diff --git a/internal/core/dialect.go b/internal/core/dialect.go new file mode 100644 index 0000000000..e192c442c9 --- /dev/null +++ b/internal/core/dialect.go @@ -0,0 +1,210 @@ +package core + +import ( + "context" + "fmt" + "slices" + "strings" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +func (c *Catalog) CreateDialect(name string) (int64, error) { + oid, err := c.q.CreateDialect(context.Background(), name) + if err != nil { + return 0, fmt.Errorf("create dialect %q: %w", name, err) + } + c.dialectOID = oid + return oid, nil +} + +func (c *Catalog) DialectOID(name string) (int64, error) { + oid, err := c.q.DialectOID(context.Background(), name) + if err != nil { + return 0, fmt.Errorf("dialect %q: %w", name, err) + } + return oid, nil +} + +func (c *Catalog) SetDialectFlag(dialectOID int64, key, value string) error { + err := c.q.SetDialectFlag(context.Background(), catalogdb.SetDialectFlagParams{ + DialectOid: dialectOID, + Key: key, + Value: value, + }) + if err != nil { + return fmt.Errorf("set dialect flag %s.%s: %w", key, value, err) + } + return nil +} + +func (c *Catalog) DialectFlag(dialectOID int64, key string) (string, error) { + value, err := c.q.DialectFlag(context.Background(), catalogdb.DialectFlagParams{ + DialectOid: dialectOID, + Key: key, + }) + if err != nil { + return "", nil + } + return value, nil +} + +// FlagComparisonOperators holds the dialect's comparison operators as a +// comma-separated list, so that a type declared by a schema can be given the +// same ones the seeded types have. +const FlagComparisonOperators = "operators.comparison" + +// FlagBoolType holds the type a comparison or predicate yields, when it is +// not the type a boolean literal has: ClickHouse compares to UInt8 while +// writing true as Bool. +const FlagBoolType = "types.bool" + +// FlagLimitType holds the type a LIMIT or OFFSET count has, which is what a +// placeholder in one is typed as. +const FlagLimitType = "types.limit" + +// FlagUntypedType holds the type a placeholder takes when nothing in the +// query constrains it, for a dialect that gives such a placeholder one. +const FlagUntypedType = "types.untyped" + +// FlagPropagateNullable is set when a function's result is nullable whenever +// one of its arguments is, the way ClickHouse's ordinary functions behave. +const FlagPropagateNullable = "functions.propagate_nullable" + +// FlagQualifyDuplicateColumns is set for a dialect that names a result +// column after its relation when an earlier result column from another +// relation has the same name, as ClickHouse names the second id of a join +// e.id. +const FlagQualifyDuplicateColumns = "columns.qualify_duplicates" + +// FlagDefaultSchema holds the schema the dialect puts an unqualified object +// in, when that is not the catalog's own default: a type in it is reported +// without its schema. +const FlagDefaultSchema = "schema.default" + +// FlagCastCategories holds the categories whose types are all implicitly +// castable to one another, as the dialect's seed declared them, so that a type +// arriving after the seed — an extension's, say — can join its category. +const FlagCastCategories = "casts.categories" + +// Constant kinds. A literal in a query has no declared type, so each dialect +// names the type its literals take on. +const ( + ConstInteger = "integer" + ConstFloat = "float" + ConstString = "string" + ConstBool = "bool" +) + +// defaultConstTypes are the PostgreSQL type names, used by any dialect that +// does not name its own. +var defaultConstTypes = map[string]string{ + ConstInteger: "int4", + ConstFloat: "numeric", + ConstString: "text", + ConstBool: "bool", +} + +// IsComparisonOperator reports whether the dialect counts name among the +// operators that compare two values and yield a boolean. +func (c *Catalog) IsComparisonOperator(name string) bool { + if c.dialectOID == 0 { + return false + } + ops, _ := c.DialectFlag(c.dialectOID, FlagComparisonOperators) + if ops == "" { + return false + } + return slices.Contains(strings.Split(ops, ","), name) +} + +// SetConstType records the type a literal of the given kind takes on in this +// dialect. +func (c *Catalog) SetConstType(dialectOID int64, kind, typeName string) error { + return c.SetDialectFlag(dialectOID, "const."+kind, typeName) +} + +// ConstTypeOID returns the type a literal of the given kind takes on. +func (c *Catalog) ConstTypeOID(kind string) (int64, error) { + if c.dialectOID != 0 { + if name, _ := c.DialectFlag(c.dialectOID, "const."+kind); name != "" { + return c.TypeOID(name) + } + } + name, ok := defaultConstTypes[kind] + if !ok { + return 0, fmt.Errorf("unknown constant kind %q", kind) + } + return c.TypeOID(name) +} + +// BoolTypeOID returns the type a comparison or predicate yields. +func (c *Catalog) BoolTypeOID() (int64, error) { + if c.dialectOID != 0 { + if name, _ := c.DialectFlag(c.dialectOID, FlagBoolType); name != "" { + return c.TypeOID(name) + } + } + return c.ConstTypeOID(ConstBool) +} + +// LimitTypeOID returns the type a LIMIT or OFFSET count has, falling back to +// the type of an integer literal. +func (c *Catalog) LimitTypeOID() (int64, error) { + if c.dialectOID != 0 { + if name, _ := c.DialectFlag(c.dialectOID, FlagLimitType); name != "" { + return c.TypeOID(name) + } + } + return c.ConstTypeOID(ConstInteger) +} + +// UntypedTypeOID returns the type an unconstrained placeholder takes, and +// whether the dialect gives it one at all. +func (c *Catalog) UntypedTypeOID() (int64, bool) { + if c.dialectOID == 0 { + return 0, false + } + name, _ := c.DialectFlag(c.dialectOID, FlagUntypedType) + if name == "" { + return 0, false + } + oid, err := c.TypeOID(name) + if err != nil { + return 0, false + } + return oid, true +} + +// PropagatesNullable reports whether a function's result is nullable +// whenever one of its arguments is. +func (c *Catalog) PropagatesNullable() bool { + if c.dialectOID == 0 { + return false + } + v, _ := c.DialectFlag(c.dialectOID, FlagPropagateNullable) + return v == "true" +} + +// QualifiesDuplicateColumns reports whether a result column that repeats an +// earlier one's name from another relation is named after its relation. +func (c *Catalog) QualifiesDuplicateColumns() bool { + if c.dialectOID == 0 { + return false + } + v, _ := c.DialectFlag(c.dialectOID, FlagQualifyDuplicateColumns) + return v == "true" +} + +// DefaultNamespaces lists the namespaces a type is reported from without +// qualification: the catalog's default, PostgreSQL's system catalog, and +// the dialect's own default schema when it names one. +func (c *Catalog) DefaultNamespaces() []string { + out := []string{"public", "pg_catalog"} + if c.dialectOID != 0 { + if name, _ := c.DialectFlag(c.dialectOID, FlagDefaultSchema); name != "" { + out = append(out, name) + } + } + return out +} diff --git a/internal/core/namespace.go b/internal/core/namespace.go new file mode 100644 index 0000000000..b59405336e --- /dev/null +++ b/internal/core/namespace.go @@ -0,0 +1,39 @@ +package core + +import ( + "context" + "fmt" +) + +func (c *Catalog) CreateNamespace(name string) (int64, error) { + oid, err := c.q.CreateNamespace(context.Background(), name) + if err != nil { + return 0, fmt.Errorf("create namespace %q: %w", name, err) + } + return oid, nil +} + +func (c *Catalog) NamespaceOID(name string) (int64, error) { + oid, err := c.q.NamespaceOID(context.Background(), name) + if err != nil { + return 0, fmt.Errorf("namespace %q: %w", name, err) + } + return oid, nil +} + +type NamespaceInfo struct { + OID int64 + Name string +} + +func (c *Catalog) Namespaces() ([]NamespaceInfo, error) { + rows, err := c.q.ListNamespaces(context.Background()) + if err != nil { + return nil, fmt.Errorf("list namespaces: %w", err) + } + out := make([]NamespaceInfo, 0, len(rows)) + for _, r := range rows { + out = append(out, NamespaceInfo{OID: r.Oid, Name: r.Name}) + } + return out, nil +} diff --git a/internal/core/operator.go b/internal/core/operator.go new file mode 100644 index 0000000000..784ea892a6 --- /dev/null +++ b/internal/core/operator.go @@ -0,0 +1,68 @@ +package core + +import ( + "context" + "fmt" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +type OperatorSpec struct { + Name string + NamespaceOID int64 + DialectOID int64 + LeftTypeOID int64 + RightTypeOID int64 + ResultTypeOID int64 + ProcOID int64 +} + +func (c *Catalog) CreateOperator(o OperatorSpec) (int64, error) { + oid, err := c.q.CreateOperator(context.Background(), catalogdb.CreateOperatorParams{ + NamespaceOid: nullInt64(o.NamespaceOID), + DialectOid: nullInt64(o.DialectOID), + Name: o.Name, + LeftTypeOid: nullInt64(o.LeftTypeOID), + RightTypeOid: nullInt64(o.RightTypeOID), + ResultTypeOid: o.ResultTypeOID, + ProcOid: nullInt64(o.ProcOID), + }) + if err != nil { + return 0, fmt.Errorf("create operator %q: %w", o.Name, err) + } + return oid, nil +} + +type OperatorOverload struct { + OID int64 + Name string + LeftTypeOID int64 + RightTypeOID int64 + ResultTypeOID int64 + ProcOID int64 +} + +// FindOperators returns the overloads of name matching the given operand types, +// where a zero OID means "any". +func (c *Catalog) FindOperators(name string, leftTypeOID, rightTypeOID int64) ([]OperatorOverload, error) { + rows, err := c.q.FindOperators(context.Background(), catalogdb.FindOperatorsParams{ + Name: name, + LeftTypeOid: leftTypeOID, + RightTypeOid: rightTypeOID, + }) + if err != nil { + return nil, fmt.Errorf("find operators %q: %w", name, err) + } + out := make([]OperatorOverload, 0, len(rows)) + for _, r := range rows { + out = append(out, OperatorOverload{ + OID: r.Oid, + Name: r.Name, + LeftTypeOID: orZero(r.LeftTypeOid), + RightTypeOID: orZero(r.RightTypeOid), + ResultTypeOID: r.ResultTypeOid, + ProcOID: orZero(r.ProcOid), + }) + } + return out, nil +} diff --git a/internal/core/proc.go b/internal/core/proc.go new file mode 100644 index 0000000000..28bf32c978 --- /dev/null +++ b/internal/core/proc.go @@ -0,0 +1,173 @@ +package core + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +type ProcSpec struct { + Name string + NamespaceOID int64 + DialectOID int64 + Kind string + ReturnTypeOID int64 + ReturnSet bool + ReturnNullable bool + // NeverNull marks a function whose result is never NULL even when an + // argument is, in a dialect that otherwise propagates nullability. + NeverNull bool + // ReturnTemplate is the result as an expression over the call's + // arguments, when it depends on their values: Decimal(18, $2) for + // toDecimal64(x, s). + ReturnTemplate string + Strict bool + VariadicKind string + Args []ProcArg +} + +// The proc table stores nullability as one integer: 0 leaves it to the +// dialect's rule, 1 is always nullable and 2 is never nullable. +const ( + nullableDefault int64 = 0 + nullableAlways int64 = 1 + nullableNever int64 = 2 +) + +type ProcArg struct { + Name string + TypeOID int64 + Mode string + HasDefault bool +} + +func (c *Catalog) CreateProc(p ProcSpec) (int64, error) { + if p.Kind == "" { + p.Kind = "f" + } + if p.VariadicKind == "" { + p.VariadicKind = "n" + } + ctx := context.Background() + procOID, err := c.q.CreateProc(ctx, catalogdb.CreateProcParams{ + NamespaceOid: nullInt64(p.NamespaceOID), + DialectOid: nullInt64(p.DialectOID), + Name: strings.ToLower(p.Name), + Kind: p.Kind, + ReturnTypeOid: p.ReturnTypeOID, + ReturnSet: boolToInt64(p.ReturnSet), + ReturnNullable: returnNullable(p), + ReturnTemplate: p.ReturnTemplate, + Strict: boolToInt64(p.Strict), + VariadicKind: p.VariadicKind, + }) + if err != nil { + return 0, fmt.Errorf("create proc %q: %w", p.Name, err) + } + for i, a := range p.Args { + mode := a.Mode + if mode == "" { + mode = "i" + } + err := c.q.CreateProcArg(ctx, catalogdb.CreateProcArgParams{ + ProcOid: procOID, + Ord: int64(i + 1), + Name: a.Name, + TypeOid: a.TypeOID, + Mode: mode, + HasDefault: boolToInt64(a.HasDefault), + }) + if err != nil { + return 0, fmt.Errorf("create proc %q arg %d: %w", p.Name, i+1, err) + } + } + return procOID, nil +} + +func returnNullable(p ProcSpec) int64 { + switch { + case p.NeverNull: + return nullableNever + case p.ReturnNullable: + return nullableAlways + } + return nullableDefault +} + +type ProcOverload struct { + OID int64 + Name string + Kind string + ReturnTypeOID int64 + ReturnNullable bool + NeverNull bool + ReturnTemplate string + ArgTypes []int64 +} + +// FindProcs returns the overloads of name, optionally restricted to the given +// namespaces. +func (c *Catalog) FindProcs(name string, namespaceOIDs []int64) ([]ProcOverload, error) { + ctx := context.Background() + lname := strings.ToLower(name) + + var out []ProcOverload + if len(namespaceOIDs) == 0 { + rows, err := c.q.FindProcsAnyNamespace(ctx, lname) + if err != nil { + return nil, fmt.Errorf("find procs %q: %w", name, err) + } + out = make([]ProcOverload, 0, len(rows)) + for _, r := range rows { + out = append(out, ProcOverload{ + OID: r.Oid, + Name: r.Name, + Kind: r.Kind, + ReturnTypeOID: r.ReturnTypeOid, + ReturnNullable: r.ReturnNullable == nullableAlways, + NeverNull: r.ReturnNullable == nullableNever, + ReturnTemplate: r.ReturnTemplate, + }) + } + } else { + nss := make([]sql.NullInt64, len(namespaceOIDs)) + for i, ns := range namespaceOIDs { + nss[i] = sql.NullInt64{Int64: ns, Valid: true} + } + rows, err := c.q.FindProcsInNamespaces(ctx, catalogdb.FindProcsInNamespacesParams{ + Name: lname, + NamespaceOids: nss, + }) + if err != nil { + return nil, fmt.Errorf("find procs %q: %w", name, err) + } + out = make([]ProcOverload, 0, len(rows)) + for _, r := range rows { + out = append(out, ProcOverload{ + OID: r.Oid, + Name: r.Name, + Kind: r.Kind, + ReturnTypeOID: r.ReturnTypeOid, + ReturnNullable: r.ReturnNullable == nullableAlways, + NeverNull: r.ReturnNullable == nullableNever, + ReturnTemplate: r.ReturnTemplate, + }) + } + } + + for i := range out { + argTypes, err := c.procArgTypes(out[i].OID) + if err != nil { + return nil, err + } + out[i].ArgTypes = argTypes + } + return out, nil +} + +func (c *Catalog) procArgTypes(procOID int64) ([]int64, error) { + return c.q.ProcArgTypes(context.Background(), procOID) +} diff --git a/internal/core/rewrite.go b/internal/core/rewrite.go new file mode 100644 index 0000000000..352afe9bb1 --- /dev/null +++ b/internal/core/rewrite.go @@ -0,0 +1,361 @@ +package core + +import ( + "context" + "fmt" + "strconv" + "strings" + "sync" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +// A dialect describes, as data, what it does to a type before storing it. +// The seed loads three kinds of it from dialect.json: rewrites, which turn +// one expression into another (float(24) into real, a bare decimal into +// decimal(18, 0)); identifier words and positions, which say where a bare +// word is a word rather than a type (the max of nvarchar(max), the +// function of SimpleAggregateFunction(sum, UInt64)); and an affinity rule, +// which says what a family the schema declares and the seed does not list +// stands on. None of it is code, so an engine adds a dialect by writing +// files. + +// FlagIdents holds the words that are identifiers wherever they stand as a +// type argument, comma-separated. +const FlagIdents = "types.idents" + +// FlagIdentArgs holds the argument positions that are identifiers in a +// family, as "family:1,2;family:1". +const FlagIdentArgs = "types.ident_args" + +// typeRewrite is one rewrite, parsed: a pattern whose $n arguments bind +// whatever stands there, a template the bindings are substituted into, and +// a condition on a binding. +type typeRewrite struct { + pattern *TypeExpr + template *TypeExpr + cond rewriteCond +} + +// rewriteCond bounds an integer binding: "$1 <= 24". +type rewriteCond struct { + binding string + op string + value int64 +} + +// rules is what the catalog knows of its dialect's rewriting, read from the +// tables once and kept. The seed invalidates it as it adds to them. +type rules struct { + mu sync.Mutex + loaded bool + rewrites []typeRewrite + idents map[string]bool + identArgs map[string][]int +} + +func (c *Catalog) invalidateRules() { + c.rules.mu.Lock() + c.rules.loaded = false + c.rules.mu.Unlock() +} + +// loadRules reads the dialect's rewrites and identifier settings. +func (c *Catalog) loadRules() (*rules, error) { + r := &c.rules + r.mu.Lock() + defer r.mu.Unlock() + if r.loaded { + return r, nil + } + r.rewrites, r.idents, r.identArgs = nil, map[string]bool{}, map[string][]int{} + if c.dialectOID == 0 { + r.loaded = true + return r, nil + } + rows, err := c.q.ListTypeRewrites(context.Background(), c.dialectOID) + if err != nil { + return nil, fmt.Errorf("type rewrites: %w", err) + } + for _, row := range rows { + rw := typeRewrite{pattern: ParseTypeExpr(row.Pattern), template: ParseTypeExpr(row.Template)} + if row.Cond != "" { + cond, err := parseRewriteCond(row.Cond) + if err != nil { + return nil, fmt.Errorf("type rewrite %q: %w", row.Pattern, err) + } + rw.cond = cond + } + r.rewrites = append(r.rewrites, rw) + } + if idents, _ := c.DialectFlag(c.dialectOID, FlagIdents); idents != "" { + for _, w := range strings.Split(idents, ",") { + r.idents[strings.ToLower(strings.TrimSpace(w))] = true + } + } + if identArgs, _ := c.DialectFlag(c.dialectOID, FlagIdentArgs); identArgs != "" { + for _, entry := range strings.Split(identArgs, ";") { + family, positions, ok := strings.Cut(entry, ":") + if !ok { + continue + } + for _, p := range strings.Split(positions, ",") { + if n, err := strconv.Atoi(strings.TrimSpace(p)); err == nil { + family = strings.ToLower(strings.TrimSpace(family)) + r.identArgs[family] = append(r.identArgs[family], n) + } + } + } + } + r.loaded = true + return r, nil +} + +// parseRewriteCond reads "$1 <= 24". +func parseRewriteCond(s string) (rewriteCond, error) { + fields := strings.Fields(s) + if len(fields) != 3 || !strings.HasPrefix(fields[0], "$") { + return rewriteCond{}, fmt.Errorf("condition %q: want \"$n op value\"", s) + } + switch fields[1] { + case "<", "<=", "=", ">=", ">", "!=": + default: + return rewriteCond{}, fmt.Errorf("condition %q: unknown operator", s) + } + v, err := strconv.ParseInt(fields[2], 10, 64) + if err != nil { + return rewriteCond{}, fmt.Errorf("condition %q: %w", s, err) + } + return rewriteCond{binding: fields[0], op: fields[1], value: v}, nil +} + +func (cond rewriteCond) holds(bindings map[string]TypeArg) bool { + if cond.binding == "" { + return true + } + a, ok := bindings[cond.binding] + if !ok || a.Int == nil { + return false + } + switch cond.op { + case "<": + return *a.Int < cond.value + case "<=": + return *a.Int <= cond.value + case "=": + return *a.Int == cond.value + case ">=": + return *a.Int >= cond.value + case ">": + return *a.Int > cond.value + case "!=": + return *a.Int != cond.value + } + return false +} + +// AddTypeRewrite records a rewrite of the catalog's dialect, applied after +// the ones recorded before it. +func (c *Catalog) AddTypeRewrite(ord int, pattern, template, cond string) error { + err := c.q.CreateTypeRewrite(context.Background(), catalogdb.CreateTypeRewriteParams{ + DialectOid: c.dialectOID, + Ord: int64(ord), + Pattern: pattern, + Template: template, + Cond: cond, + }) + if err != nil { + return fmt.Errorf("type rewrite %q: %w", pattern, err) + } + c.invalidateRules() + return nil +} + +// AddTypeAffinity records the next step of the dialect's affinity rule: a +// family whose name contains one of words, upper-cased, stands on typeOID. +// No words is the default that ends the rule. +func (c *Catalog) AddTypeAffinity(ord int, words []string, typeOID int64) error { + err := c.q.CreateTypeAffinity(context.Background(), catalogdb.CreateTypeAffinityParams{ + DialectOid: c.dialectOID, + Ord: int64(ord), + Words: strings.ToUpper(strings.Join(words, ",")), + TypeOid: typeOID, + }) + if err != nil { + return fmt.Errorf("type affinity %d: %w", ord, err) + } + return nil +} + +// userTypeBase is the type an unseeded family stands on by the dialect's +// affinity rule, or 0 when the dialect has none or none of it matches. +func (c *Catalog) userTypeBase(name string) (int64, error) { + if c.dialectOID == 0 { + return 0, nil + } + rows, err := c.q.ListTypeAffinities(context.Background(), c.dialectOID) + if err != nil { + return 0, fmt.Errorf("type affinities: %w", err) + } + upper := strings.ToUpper(name) + for _, row := range rows { + if row.Words == "" { + return row.TypeOid, nil + } + for _, w := range strings.Split(row.Words, ",") { + if w != "" && strings.Contains(upper, w) { + return row.TypeOid, nil + } + } + } + return 0, nil +} + +// canonicalize applies the dialect's identifier settings and rewrites to +// an expression: the first rewrite whose pattern matches is applied, and +// its result is not rewritten again. A rewrite names a family as the +// dialect spells it, so an expression spelled with an alias — dec(10) for +// a rule on decimal — is tried again with the alias resolved. +func (c *Catalog) canonicalize(t *TypeExpr) (*TypeExpr, error) { + r, err := c.loadRules() + if err != nil { + return nil, err + } + t = r.identify(t) + if len(r.rewrites) == 0 { + return t, nil + } + if out, ok := r.rewrite(t); ok { + return out, nil + } + if canonical, ok := c.canonicalFamilyName(t.Name); ok && !strings.EqualFold(canonical, t.Name) { + resolved := t.Clone() + resolved.Name = canonical + if out, ok := r.rewrite(resolved); ok { + return out, nil + } + } + return t, nil +} + +// rewrite applies the first rewrite whose pattern matches the expression. +func (r *rules) rewrite(t *TypeExpr) (*TypeExpr, bool) { + name := strings.ToLower(t.Name) + for _, rw := range r.rewrites { + if strings.ToLower(rw.pattern.Name) != name || len(rw.pattern.Args) != len(t.Args) { + continue + } + bindings, ok := matchArgs(rw.pattern.Args, t.Args) + if !ok || !rw.cond.holds(bindings) { + continue + } + out := substitute(rw.template, bindings) + out.Nullable = t.Nullable + return out, true + } + return nil, false +} + +// canonicalFamilyName is the name the catalog spells a family by, with +// aliases resolved, or false when the name is not a family it holds. +func (c *Catalog) canonicalFamilyName(name string) (string, bool) { + oid, err := c.familyOIDByQualifiedName(strings.ToLower(strings.TrimSpace(name))) + if err != nil { + return "", false + } + if oid, err = c.canonicalOID(oid); err != nil { + return "", false + } + info, err := c.LookupType(oid) + if err != nil { + return "", false + } + return c.qualifiedName(info), true +} + +// identify turns the bare words the dialect calls identifiers into +// identifier arguments. +func (r *rules) identify(t *TypeExpr) *TypeExpr { + if len(t.Args) == 0 || (len(r.idents) == 0 && len(r.identArgs) == 0) { + return t + } + positions := r.identArgs[strings.ToLower(t.Name)] + var out *TypeExpr + for i, a := range t.Args { + if a.Type == nil || len(a.Type.Args) != 0 { + continue + } + word := strings.ToLower(a.Type.Name) + if !r.idents[word] && !containsInt(positions, i+1) { + continue + } + if out == nil { + out = t.Clone() + } + out.Args[i] = TypeArg{Label: a.Label, Ident: &word} + } + if out == nil { + return t + } + return out +} + +func containsInt(list []int, n int) bool { + for _, v := range list { + if v == n { + return true + } + } + return false +} + +// matchArgs matches a pattern's arguments against an expression's, binding +// each $n to what stands in its place and requiring a literal to be equal. +func matchArgs(pattern, args []TypeArg) (map[string]TypeArg, bool) { + bindings := map[string]TypeArg{} + for i, p := range pattern { + a := args[i] + switch { + case p.Type != nil && strings.HasPrefix(p.Type.Name, "$"): + bindings[p.Type.Name] = a + case p.Type != nil: + if a.Type == nil || !strings.EqualFold(a.Type.Name, p.Type.Name) { + return nil, false + } + case p.Int != nil: + if a.Int == nil || *a.Int != *p.Int { + return nil, false + } + case p.String != nil: + if a.String == nil || *a.String != *p.String { + return nil, false + } + case p.Ident != nil: + if a.Ident == nil || *a.Ident != *p.Ident { + return nil, false + } + default: + return nil, false + } + } + return bindings, true +} + +// substitute fills a template's $n arguments from the bindings. +func substitute(template *TypeExpr, bindings map[string]TypeArg) *TypeExpr { + out := template.Clone() + for i, a := range out.Args { + if a.Type != nil && strings.HasPrefix(a.Type.Name, "$") { + if bound, ok := bindings[a.Type.Name]; ok { + label := a.Label + out.Args[i] = bound + if label != "" { + out.Args[i].Label = label + } + } + } else if a.Type != nil { + out.Args[i].Type = substitute(a.Type, bindings) + } + } + return out +} diff --git a/internal/core/schema/schema.go b/internal/core/schema/schema.go new file mode 100644 index 0000000000..e96d8dbe2a --- /dev/null +++ b/internal/core/schema/schema.go @@ -0,0 +1,570 @@ +package schema + +import ( + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/analyzer" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func Apply(cat *core.Catalog, n ast.Node) error { + switch v := n.(type) { + case nil: + return nil + case *ast.RawStmt: + return Apply(cat, v.Stmt) + case *ast.List: + for _, it := range v.Items { + if err := Apply(cat, it); err != nil { + return err + } + } + return nil + case *ast.CreateTableStmt: + return applyCreateTable(cat, v) + case *ast.DropTableStmt: + return applyDropTable(cat, v) + case *ast.CreateEnumStmt: + return applyCreateEnum(cat, v) + case *ast.CreateDomainStmt: + return applyCreateDomain(cat, v) + case *ast.CompositeTypeStmt: + return applyCompositeType(cat, v) + case *ast.CreateRangeStmt: + return applyCreateRange(cat, v) + case *ast.CreateExtensionStmt: + if v.Extname == nil { + return nil + } + return cat.LoadExtension(*v.Extname) + case *ast.CreateFunctionStmt: + return applyCreateFunction(cat, v) + case *ast.AlterTableStmt: + return applyAlterTable(cat, v) + case *ast.RenameColumnStmt: + return applyRenameColumn(cat, v) + case *ast.RenameTableStmt: + return applyRenameTable(cat, v) + case *ast.ViewStmt: + return applyView(cat, v.View, v.Aliases, v.Query, v.Replace) + case *ast.CreateTableAsStmt: + if v.Into == nil { + return nil + } + return applyView(cat, v.Into.Rel, v.Into.ColNames, v.Query, false) + } + return nil +} + +// applyView records a view, or a table created from a query, as a relation +// whose columns are the ones its query selects. +func applyView(cat *core.Catalog, rel *ast.RangeVar, aliases *ast.List, query ast.Node, replace bool) error { + if rel == nil || rel.Relname == nil { + return fmt.Errorf("create view with nil name") + } + name := *rel.Relname + schema := "" + if rel.Schemaname != nil { + schema = *rel.Schemaname + } + nsOID, err := resolveOrCreateNamespace(cat, schema) + if err != nil { + return err + } + if existing, err := cat.ClassOID(nsOID, name); err == nil { + if !replace { + return fmt.Errorf("relation %q already exists", name) + } + if err := cat.DropClass(existing); err != nil { + return err + } + } + + sel, ok := query.(*ast.SelectStmt) + if !ok { + return fmt.Errorf("view %q: unsupported query %T", name, query) + } + res, err := analyzer.Prepare(cat, sel) + if err != nil { + return fmt.Errorf("view %q: %w", name, err) + } + + classOID, err := cat.CreateClass(nsOID, name, "v") + if err != nil { + return err + } + names := listStrings(aliases) + for i, col := range res.Columns { + colName := col.Name + if i < len(names) { + colName = names[i] + } + typeOID := col.TypeOID + if typeOID == 0 { + typeOID, err = cat.ResolveTypeName("any") + if err != nil { + return err + } + } + if err := cat.CreateAttributeSpec(core.AttributeSpec{ + ClassOID: classOID, + Name: colName, + TypeOID: typeOID, + Num: i + 1, + NotNull: col.NotNull, + DeclType: col.DataType, + }); err != nil { + return fmt.Errorf("view %s.%s: %w", name, colName, err) + } + } + return nil +} + +func listStrings(l *ast.List) []string { + if l == nil { + return nil + } + out := make([]string, 0, len(l.Items)) + for _, item := range l.Items { + if s, ok := item.(*ast.String); ok { + out = append(out, s.Str) + } + } + return out +} + +func applyCreateTable(cat *core.Catalog, stmt *ast.CreateTableStmt) error { + if stmt.Name == nil { + return fmt.Errorf("create table with nil name") + } + // A virtual table's module is the dialect's word for the extension it + // needs, the way CREATE EXTENSION is PostgreSQL's. + if stmt.Using != "" { + if err := cat.LoadExtension(stmt.Using); err != nil { + return err + } + } + nsOID, err := resolveOrCreateNamespace(cat, stmt.Name.Schema) + if err != nil { + return err + } + if _, err := cat.ClassOID(nsOID, stmt.Name.Name); err == nil { + if stmt.IfNotExists { + return nil + } + return fmt.Errorf("relation %q already exists", stmt.Name.Name) + } + classOID, err := cat.CreateClass(nsOID, stmt.Name.Name, "r") + if err != nil { + return err + } + for i, col := range stmt.Cols { + if col == nil || col.TypeName == nil { + return fmt.Errorf("column %d on %q: missing type", i+1, stmt.Name.Name) + } + typeOID, err := columnTypeOID(cat, col) + if err != nil { + return fmt.Errorf("column %s.%s: %w", stmt.Name.Name, col.Colname, err) + } + if err := cat.CreateAttributeSpec(core.AttributeSpec{ + ClassOID: classOID, + Name: col.Colname, + TypeOID: typeOID, + Num: i + 1, + NotNull: col.IsNotNull || col.PrimaryKey || typeNotNull(cat, typeOID), + IsPrimaryKey: col.PrimaryKey, + DeclType: declType(col.TypeName), + Hidden: col.IsHidden, + }); err != nil { + return fmt.Errorf("attr %s.%s: %w", stmt.Name.Name, col.Colname, err) + } + } + return nil +} + +func applyDropTable(cat *core.Catalog, stmt *ast.DropTableStmt) error { + for _, tn := range stmt.Tables { + if tn == nil { + continue + } + nsOID, err := cat.NamespaceOID(nsName(tn.Schema)) + if err != nil { + if stmt.IfExists { + continue + } + return err + } + classOID, err := cat.ClassOID(nsOID, tn.Name) + if err != nil { + if stmt.IfExists { + continue + } + return fmt.Errorf("drop table %q: %w", tn.Name, err) + } + if err := cat.DropClass(classOID); err != nil { + return fmt.Errorf("drop table %q: %w", tn.Name, err) + } + } + return nil +} + +func applyAlterTable(cat *core.Catalog, stmt *ast.AlterTableStmt) error { + table := stmt.Table + if table == nil && stmt.Relation != nil { + table = rangeVarTableName(stmt.Relation) + } + classOID, err := lookupClass(cat, table) + if err != nil { + if stmt.MissingOk { + return nil + } + return err + } + for _, item := range listItems(stmt.Cmds) { + cmd, ok := item.(*ast.AlterTableCmd) + if !ok { + continue + } + switch cmd.Subtype { + case ast.AT_AddColumn: + if cmd.Def == nil { + continue + } + typeOID, err := columnTypeOID(cat, cmd.Def) + if err != nil { + return err + } + num, err := cat.NextAttributeNum(classOID) + if err != nil { + return err + } + if err := cat.CreateAttributeSpec(core.AttributeSpec{ + ClassOID: classOID, + Name: cmd.Def.Colname, + TypeOID: typeOID, + Num: num, + NotNull: cmd.Def.IsNotNull || cmd.Def.PrimaryKey || typeNotNull(cat, typeOID), + IsPrimaryKey: cmd.Def.PrimaryKey, + DeclType: declType(cmd.Def.TypeName), + }); err != nil { + return err + } + case ast.AT_DropColumn: + if cmd.Name == nil { + continue + } + if err := cat.DropAttribute(classOID, *cmd.Name); err != nil { + return err + } + case ast.AT_AlterColumnType: + if cmd.Def == nil { + continue + } + name := cmd.Def.Colname + if cmd.Name != nil && *cmd.Name != "" { + name = *cmd.Name + } + typeOID, err := columnTypeOID(cat, cmd.Def) + if err != nil { + return err + } + if err := cat.SetAttributeType(classOID, name, typeOID, declType(cmd.Def.TypeName)); err != nil { + return err + } + // An engine that reports a column's whole new definition also + // reports whether it still accepts NULL. + if cmd.Def.IsNotNull { + if err := cat.SetAttributeNotNull(classOID, name, true); err != nil { + return err + } + } + case ast.AT_SetNotNull, ast.AT_DropNotNull: + if cmd.Name == nil { + continue + } + if err := cat.SetAttributeNotNull(classOID, *cmd.Name, cmd.Subtype == ast.AT_SetNotNull); err != nil { + return err + } + } + } + return nil +} + +func applyRenameColumn(cat *core.Catalog, stmt *ast.RenameColumnStmt) error { + if stmt.Col == nil || stmt.NewName == nil { + return nil + } + classOID, err := lookupClass(cat, stmt.Table) + if err != nil { + if stmt.MissingOk { + return nil + } + return err + } + // Engines report the column either as a field list or as a bare name. + name := stmt.Col.Name + if names := listStrings(stmt.Col.Fields); len(names) > 0 { + name = names[len(names)-1] + } + if name == "" { + return nil + } + return cat.RenameAttribute(classOID, name, *stmt.NewName) +} + +func applyRenameTable(cat *core.Catalog, stmt *ast.RenameTableStmt) error { + if stmt.NewName == nil { + return nil + } + classOID, err := lookupClass(cat, stmt.Table) + if err != nil { + if stmt.MissingOk { + return nil + } + return err + } + return cat.RenameClass(classOID, *stmt.NewName) +} + +func lookupClass(cat *core.Catalog, table *ast.TableName) (int64, error) { + if table == nil { + return 0, fmt.Errorf("missing table name") + } + nsOID, err := cat.NamespaceOID(nsName(table.Schema)) + if err != nil { + return 0, err + } + return cat.ClassOID(nsOID, table.Name) +} + +func rangeVarTableName(rv *ast.RangeVar) *ast.TableName { + tn := &ast.TableName{} + if rv.Schemaname != nil { + tn.Schema = *rv.Schemaname + } + if rv.Relname != nil { + tn.Name = *rv.Relname + } + return tn +} + +func listItems(l *ast.List) []ast.Node { + if l == nil { + return nil + } + return l.Items +} + +// applyCreateEnum records an enum as a type whose arguments are its labels, +// in order, the way pg_enum keeps them. +func applyCreateEnum(cat *core.Catalog, stmt *ast.CreateEnumStmt) error { + if stmt.TypeName == nil { + return fmt.Errorf("create type with nil name") + } + name := declaredTypeName(stmt.TypeName) + if name == "" { + return fmt.Errorf("create type with empty name") + } + if cat.TypeDeclared(name) { + return nil + } + var labels []core.TypeArg + for _, label := range listStrings(stmt.Vals) { + l := label + labels = append(labels, core.TypeArg{String: &l}) + } + _, err := cat.CreateTypeWithArgs(core.TypeSpec{Name: name, Typtype: "e", Category: "E"}, labels) + return err +} + +// applyCreateDomain records a domain: a type of its own that stands on its +// base, which is what it resolves through, and that may forbid NULL. +func applyCreateDomain(cat *core.Catalog, stmt *ast.CreateDomainStmt) error { + name := strings.ToLower(strings.Join(listStrings(stmt.Domainname), ".")) + if name == "" || stmt.TypeName == nil { + return fmt.Errorf("create domain: missing name or type") + } + if cat.TypeDeclared(name) { + return nil + } + baseOID, err := cat.ResolveType(stmt.TypeName) + if err != nil { + return fmt.Errorf("domain %q: %w", name, err) + } + base, err := cat.LookupType(baseOID) + if err != nil { + return err + } + notNull := false + for _, item := range listItems(stmt.Constraints) { + if con, ok := item.(*ast.Constraint); ok && con.Contype == ast.ConstrTypeNotNull { + notNull = true + } + } + _, err = cat.CreateTypeWithArgs(core.TypeSpec{ + Name: name, + Typtype: "d", + Category: base.Category, + BaseOID: baseOID, + NotNull: notNull, + }, nil) + return err +} + +// applyCompositeType records a composite type as a type whose arguments are +// its fields, labelled by name. +func applyCompositeType(cat *core.Catalog, stmt *ast.CompositeTypeStmt) error { + if stmt.TypeName == nil { + return fmt.Errorf("create type with nil name") + } + name := declaredTypeName(stmt.TypeName) + if name == "" { + return fmt.Errorf("create type with empty name") + } + if cat.TypeDeclared(name) { + return nil + } + var fields []core.TypeArg + for _, item := range listItems(stmt.Coldeflist) { + col, ok := item.(*ast.ColumnDef) + if !ok || col.TypeName == nil { + continue + } + t := core.ColumnTypeExpr(col) + if t == nil { + continue + } + fields = append(fields, core.TypeArg{Label: col.Colname, Type: t}) + } + _, err := cat.CreateTypeWithArgs(core.TypeSpec{Name: name, Typtype: "c", Category: "C"}, fields) + return err +} + +// applyCreateRange records a range type over its subtype, which is what a +// bound of it has. +func applyCreateRange(cat *core.Catalog, stmt *ast.CreateRangeStmt) error { + name := strings.ToLower(strings.Join(listStrings(stmt.TypeName), ".")) + if name == "" { + return fmt.Errorf("create type with empty name") + } + if cat.TypeDeclared(name) { + return nil + } + spec := core.TypeSpec{Name: name, Typtype: "r", Category: "R"} + for _, item := range listItems(stmt.Params) { + def, ok := item.(*ast.DefElem) + if !ok || def.Defname == nil || *def.Defname != "subtype" { + continue + } + tn, ok := def.Arg.(*ast.TypeName) + if !ok { + continue + } + oid, err := cat.ResolveType(tn) + if err != nil { + return fmt.Errorf("range %q: %w", name, err) + } + spec.ElementOID = oid + } + _, err := cat.CreateTypeWithArgs(spec, nil) + return err +} + +// declaredTypeName is the name a CREATE TYPE gives, qualified by its schema +// when it names one. +func declaredTypeName(tn *ast.TypeName) string { + t := core.TypeExprOfTypeName(tn) + if t == nil { + return "" + } + if tn.Schema != "" && !strings.Contains(t.Name, ".") { + return strings.ToLower(tn.Schema) + "." + t.Name + } + return t.Name +} + +func applyCreateFunction(cat *core.Catalog, stmt *ast.CreateFunctionStmt) error { + // A procedure returns nothing, so there is no result for a query to + // select and nothing worth recording. + if stmt.Func == nil || stmt.Func.Name == "" || stmt.ReturnType == nil { + return nil + } + returnOID, err := cat.ResolveType(stmt.ReturnType) + if err != nil { + return fmt.Errorf("function %q: %w", stmt.Func.Name, err) + } + var args []core.ProcArg + if stmt.Params != nil { + for _, item := range stmt.Params.Items { + p, ok := item.(*ast.FuncParam) + if !ok { + continue + } + switch p.Mode { + case ast.FuncParamOut, ast.FuncParamTable: + continue + } + argOID, err := cat.ResolveType(p.Type) + if err != nil { + return fmt.Errorf("function %q: %w", stmt.Func.Name, err) + } + arg := core.ProcArg{TypeOID: argOID, HasDefault: p.DefExpr != nil} + if p.Name != nil { + arg.Name = *p.Name + } + args = append(args, arg) + } + } + _, err = cat.CreateProc(core.ProcSpec{ + Name: stmt.Func.Name, + ReturnTypeOID: returnOID, + ReturnSet: stmt.ReturnType != nil && stmt.ReturnType.Setof, + Args: args, + }) + return err +} + +func nsName(schema string) string { + if schema == "" { + return "public" + } + return schema +} + +func resolveOrCreateNamespace(cat *core.Catalog, schema string) (int64, error) { + name := nsName(schema) + if oid, err := cat.NamespaceOID(name); err == nil { + return oid, nil + } + return cat.CreateNamespace(name) +} + +// typeNotNull reports whether a column of the type can never be NULL +// because the type itself says so, as a domain declared NOT NULL does. +func typeNotNull(cat *core.Catalog, typeOID int64) bool { + info, err := cat.LookupType(typeOID) + return err == nil && info.NotNull +} + +// columnTypeOID interns a column's type and returns its row. +func columnTypeOID(cat *core.Catalog, col *ast.ColumnDef) (int64, error) { + t := core.ColumnTypeExpr(col) + if t == nil { + return 0, fmt.Errorf("missing type name") + } + return cat.ResolveTypeExpr(t) +} + +// declType is the type as the schema spelled it: an engine that folds or +// reduces the name for the catalog keeps the full spelling alongside. +func declType(tn *ast.TypeName) string { + if tn == nil { + return "" + } + if tn.Spelling != "" { + return tn.Spelling + } + return tn.Name +} diff --git a/internal/core/seed/extension.go b/internal/core/seed/extension.go new file mode 100644 index 0000000000..c0f3689535 --- /dev/null +++ b/internal/core/seed/extension.go @@ -0,0 +1,134 @@ +package seed + +import ( + "fmt" + "io/fs" + "path" + "strings" + + "github.com/sqlc-dev/sqlc/internal/core" +) + +// applyExtension applies the extension directory dir, relative to the +// dialect, to a catalog that has already been seeded. Unlike the dialect's +// own seed, an extension lands in a catalog full of types, so everything it +// names is resolved against what is there before being created. +func applyExtension(cat *core.Catalog, fsys fs.FS, dir string) error { + name := path.Base(dir) + sub, err := fs.Sub(fsys, dir) + if err != nil { + return fmt.Errorf("seed: extension %s: %w", name, err) + } + e := &extension{cat: cat} + if err := stream(sub, TypesFile, e.addType); err != nil { + return fmt.Errorf("extension %s: %w", name, err) + } + if err := stream(sub, FunctionsFile, e.addFunction); err != nil { + return fmt.Errorf("extension %s: %w", name, err) + } + return nil +} + +type extension struct { + cat *core.Catalog +} + +// addType registers a type the extension defines. The type joins the +// dialect's rules the way a type declared by a schema does: it gains the +// comparison operators, and implicit casts to the types of its category when +// the dialect's seed declared that category mutually castable. +func (e *extension) addType(t Type) error { + for _, name := range append([]string{t.Name}, t.Aliases...) { + if _, err := e.cat.TypeOID(name); err == nil { + // The dialect, or an earlier extension, already ships this type. + continue + } + oid, err := e.cat.CreateUserType(name, t.Category) + if err != nil { + return fmt.Errorf("type %q: %w", name, err) + } + if err := e.categoryCasts(oid, t.Category); err != nil { + return fmt.Errorf("type %q: %w", name, err) + } + } + return nil +} + +// categoryCasts makes a new type implicitly castable to and from the types +// already in its category, under the same rule the dialect's seed applied to +// the types it was born with. +func (e *extension) categoryCasts(oid int64, category string) error { + categories, err := e.cat.DialectFlag(e.cat.SeededDialectOID(), core.FlagCastCategories) + if err != nil || categories == "" { + return err + } + if categories != "*" && !strings.Contains(categories, category) { + return nil + } + peers, err := e.cat.TypeOIDsInCategory(category) + if err != nil { + return err + } + for _, peer := range peers { + if peer == oid { + continue + } + for _, cast := range [][2]int64{{oid, peer}, {peer, oid}} { + if err := e.cat.CreateCast(core.CastSpec{ + SourceTypeOID: cast[0], + TargetTypeOID: cast[1], + Context: "i", + DialectOID: e.cat.SeededDialectOID(), + }); err != nil { + return err + } + } + } + return nil +} + +func (e *extension) addFunction(fn Function) error { + returnOID, err := e.funcType(fn.Returns) + if err != nil { + return fmt.Errorf("function %q: %w", fn.Name, err) + } + args := make([]core.ProcArg, 0, len(fn.Args)) + for _, a := range fn.Args { + // An out or table parameter is part of the result, not the call. + switch a.Mode { + case "o", "t": + continue + } + argOID, err := e.funcType(a.Type) + if err != nil { + return fmt.Errorf("function %q: %w", fn.Name, err) + } + args = append(args, core.ProcArg{ + Name: a.Name, + TypeOID: argOID, + Mode: a.Mode, + HasDefault: a.HasDefault, + }) + } + _, err = e.cat.CreateProc(core.ProcSpec{ + Name: fn.Name, + DialectOID: e.cat.SeededDialectOID(), + Kind: fn.Kind, + ReturnTypeOID: returnOID, + ReturnNullable: fn.Nullable, + Args: args, + }) + if err != nil { + return fmt.Errorf("function %q: %w", fn.Name, err) + } + return nil +} + +// funcType resolves a type a function signature names, registering the ones +// no seed bothered to list the way the dialect's own function list does. +func (e *extension) funcType(name string) (int64, error) { + if name == "" { + return 0, nil + } + return e.cat.ResolvePseudoTypeExpr(core.ParseTypeExpr(name)) +} diff --git a/internal/core/seed/seed.go b/internal/core/seed/seed.go new file mode 100644 index 0000000000..064afedae8 --- /dev/null +++ b/internal/core/seed/seed.go @@ -0,0 +1,984 @@ +// Package seed builds a core catalog for a SQL dialect from a declarative +// description of its type system: the types it defines, the operators and +// casts between them, and the functions it ships with. +// +// A dialect is a directory which each engine package embeds and hands to +// Dialect: +// +// dialect.json what the dialect is called and the rules it is built by +// types.jsonl the types it defines +// operators.jsonl operator overloads beyond the ones the rules generate +// casts.jsonl casts beyond the ones the rules generate +// functions.jsonl the functions it ships with +// relations.jsonl the system tables and views it ships with +// +// The lists are JSONL — one record per line — and are applied as they are +// read, so a dialect whose function list runs to thousands of entries is never +// held in memory as a whole. Any of the lists may be left out. +// +// A dialect may also hold an extensions/ directory with one directory per +// extension, each a smaller bundle of the same files, applied when a schema +// says CREATE EXTENSION — or, for a dialect whose settings map virtual table +// modules to extensions, CREATE VIRTUAL TABLE ... USING. +package seed + +import ( + "bufio" + "encoding/json" + "errors" + "fmt" + "io" + "io/fs" + "path" + "slices" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +// The files a dialect directory is made of. +const ( + SettingsFile = "dialect.json" + TypesFile = "types.jsonl" + OperatorsFile = "operators.jsonl" + CastsFile = "casts.jsonl" + FunctionsFile = "functions.jsonl" + RelationsFile = "relations.jsonl" +) + +// ExtensionsDir is the directory under a dialect holding one directory per +// extension the dialect knows. +const ExtensionsDir = "extensions" + +// Settings is dialect.json: what the dialect is called and the rules that +// generate its operators and casts. +type Settings struct { + // Dialect is the name recorded in the catalog, e.g. "postgresql". + Dialect string `json:"dialect"` + + // Const names the type each kind of literal takes on, keyed by the + // core.Const* constants. Kinds left out fall back to PostgreSQL's names. + Const map[string]string `json:"const,omitempty"` + + // Bool names the type comparisons return. + Bool string `json:"bool,omitempty"` + + // Limit names the type a LIMIT or OFFSET count has, which is what a + // placeholder in one is typed as. Unset, it is the integer literal's. + Limit string `json:"limit,omitempty"` + + // Untyped names the type a placeholder takes when nothing in the query + // constrains it. Unset, such a placeholder stays untyped. + Untyped string `json:"untyped,omitempty"` + + // PropagateNullable makes a function's result nullable whenever one of + // its arguments is, the way ClickHouse's ordinary functions behave, + // unless the function is seeded as never null. + PropagateNullable bool `json:"propagate_nullable,omitempty"` + + // QualifyDuplicateColumns names a result column after its relation when + // an earlier result column from another relation has the same name, as + // ClickHouse names the second id of a join e.id. + QualifyDuplicateColumns bool `json:"qualify_duplicate_columns,omitempty"` + + // Comparison operators are registered as (T, T) -> Bool for every type in + // ComparisonCategories. + Comparison []string `json:"comparison,omitempty"` + ComparisonCategories string `json:"comparison_categories,omitempty"` + + // Arithmetic operators are registered as (T, T) -> T for every type in + // ArithmeticCategories. + Arithmetic []string `json:"arithmetic,omitempty"` + ArithmeticCategories string `json:"arithmetic_categories,omitempty"` + + // CastCategories lists the categories whose types are all implicitly + // castable to one another, so that an operator on two spellings of the + // same kind of value resolves. "*" makes every seeded type implicitly + // castable to every other, for dialects that compare across categories. + CastCategories string `json:"cast_categories,omitempty"` + + // Modules names the extension a virtual table module belongs to, for a + // dialect whose schemas say CREATE VIRTUAL TABLE ... USING rather than + // CREATE EXTENSION: SQLite's fts5 module comes with the functions its + // enable_fts5 compile option adds. + Modules map[string]string `json:"modules,omitempty"` + + // DefaultSchema names the schema a dialect puts an unqualified object + // in when it is not the catalog's own default: SQL Server's dbo, + // DuckDB's main. A type in it is reported unqualified. + DefaultSchema string `json:"default_schema,omitempty"` + + // Rewrites are what the dialect does to a type before storing it, in + // order: the first whose pattern matches applies. A pattern's $1, $2 + // bind whatever stands there, the template is what the match becomes, + // and Where bounds a binding, as "$1 <= 24" does. + Rewrites []Rewrite `json:"rewrites,omitempty"` + + // Idents are the words that are identifiers wherever they stand as a + // type argument, such as the max of nvarchar(max), and IdentArgs the + // argument positions, counted from one, that are identifiers in a + // family, such as the first of SimpleAggregateFunction(sum, UInt64). + Idents []string `json:"idents,omitempty"` + IdentArgs map[string][]int `json:"ident_args,omitempty"` + + // Affinity is the rule a type family the schema declares and the seed + // does not list stands on, in order: the first whose words the name + // contains names the base, and one with no words is the default. + Affinity []Affinity `json:"affinity,omitempty"` + + // Alias says what an alias in types.jsonl is. "canonical", the default, + // makes it another spelling of the type, which a column declared with + // it is reported as, the way PostgreSQL reports int as integer. "base" + // makes it a type of its own that stands on the one it aliases, which + // is how SQLite keeps a column's declared spelling while comparing it + // by its affinity. + Alias string `json:"alias,omitempty"` + + // fsys is the dialect directory the settings were read from. + fsys fs.FS +} + +// Rewrite is one rewrite of a type expression. +type Rewrite struct { + From string `json:"from"` + To string `json:"to"` + Where string `json:"where,omitempty"` +} + +// Affinity is one step of the rule an unseeded family stands on. +type Affinity struct { + Contains []string `json:"contains,omitempty"` + Type string `json:"type"` +} + +// Type is a type family the dialect defines. Aliases are other spellings of +// it that a schema may use in a column definition; each becomes a row that +// points at the type, as an alias of it or as a type standing on it, +// depending on the dialect's Alias setting. +type Type struct { + Name string `json:"name"` + Category string `json:"category"` + Aliases []string `json:"aliases,omitempty"` + // Base names the family this one stands on, which must be listed + // before it: MySQL's bigint unsigned is a type of its own that + // resolves as a bigint where nothing takes it as itself. + Base string `json:"base,omitempty"` +} + +// Operator is a single operator overload. +type Operator struct { + Name string `json:"name"` + Left string `json:"left"` + Right string `json:"right"` + Result string `json:"result"` +} + +// Cast is a single cast between two types. Context is 'i'mplicit, 'a'ssignment +// or 'e'xplicit. +type Cast struct { + Source string `json:"source"` + Target string `json:"target"` + Context string `json:"context,omitempty"` +} + +// Function is a function the dialect ships with. Kind is 'f'unction, +// 'a'ggregate, 'w'indow or 'p'rocedure. +type Function struct { + Name string `json:"name,omitempty"` + Kind string `json:"kind,omitempty"` + Args []Arg `json:"args,omitempty"` + // Returns names the result type, or "$1", "$2"... for the type of that + // argument, or an expression over the arguments — Decimal(18, $2) — + // for a result that depends on an argument's value. + Returns string `json:"returns"` + Nullable bool `json:"nullable,omitempty"` + // NeverNull marks a result that is never NULL even when an argument + // is, in a dialect that propagates nullability. + NeverNull bool `json:"never_null,omitempty"` +} + +// Relation is a table or view the dialect ships with, such as one of +// PostgreSQL's system catalogs. Kind is 'r' for a table or 'v' for a view, and +// defaults to a table. +type Relation struct { + // Catalog is the database the relation belongs to, which PostgreSQL + // reports for its own schemas and which the legacy catalog carries. + Catalog string `json:"catalog,omitempty"` + Schema string `json:"schema"` + Name string `json:"name"` + Kind string `json:"kind,omitempty"` + Columns []Column `json:"columns"` +} + +// Column is one of a relation's columns. +type Column struct { + Name string `json:"name"` + Type string `json:"type"` + NotNull bool `json:"not_null,omitempty"` + Array bool `json:"array,omitempty"` + Length int `json:"length,omitempty"` +} + +// Arg is one of a function's parameters. Mode is 'i'n, 'o'ut, 'b'oth, 't'able +// or 'v'ariadic, and defaults to in. +type Arg struct { + Name string `json:"name,omitempty"` + Type string `json:"type"` + Mode string `json:"mode,omitempty"` + HasDefault bool `json:"has_default,omitempty"` +} + +// Dialect returns the catalog option that seeds the dialect described by the +// JSONL files in dir. A dialect that ships extension data — a directory per +// extension under extensions/ — also has CREATE EXTENSION wired up to it. +func Dialect(fsys fs.FS, dir string) core.Option { + return core.WithSeed(func(cat *core.Catalog) error { + sub, err := fs.Sub(fsys, dir) + if err != nil { + return fmt.Errorf("seed: %s: %w", dir, err) + } + settings, err := loadSettings(sub) + if err != nil { + return err + } + if err := apply(cat, sub, settings); err != nil { + return err + } + cat.SetExtensionLoader(func(name string) error { + dir, ok := settings.extensionDir(name) + if !ok { + // An extension sqlc has no data for adds nothing, the way + // the legacy catalog has always treated one. + return nil + } + return applyExtension(cat, sub, dir) + }) + return nil + }) +} + +// ExtensionDir resolves what a schema named — an extension, or a virtual +// table module the dialect's settings map to one — to the extension's +// directory under dir, reporting whether the dialect has data for it. +func ExtensionDir(fsys fs.FS, dir, name string) (string, bool) { + sub, err := fs.Sub(fsys, dir) + if err != nil { + return "", false + } + settings, err := loadSettings(sub) + if err != nil { + return "", false + } + rel, ok := settings.extensionDir(name) + if !ok { + return "", false + } + return path.Join(dir, rel), true +} + +// extensionDir is the directory of the extension a name refers to, +// relative to the dialect, if the dialect ships one. +func (s Settings) extensionDir(name string) (string, bool) { + if ext, ok := s.Modules[strings.ToLower(name)]; ok { + name = ext + } + dir := path.Join(ExtensionsDir, name) + if _, err := fs.Stat(s.fsys, dir); err != nil { + return "", false + } + return dir, true +} + +func apply(cat *core.Catalog, fsys fs.FS, settings Settings) error { + var err error + b := &builder{ + cat: cat, + settings: settings, + oids: map[string]int64{}, + namespaces: map[string]int64{}, + seenCasts: map[[2]int64]bool{}, + } + if b.dialectOID, err = cat.CreateDialect(settings.Dialect); err != nil { + return err + } + + // Types come first: everything else names them. + if err := stream(fsys, TypesFile, b.addType); err != nil { + return err + } + // Every dialect has arrays, whether or not its list names the family, + // and a lookup of one against the cached catalog cannot add it then. + if _, err := b.createType(core.ArrayTypeName, "A", 0); err != nil { + return err + } + if err := b.consts(); err != nil { + return err + } + if err := b.rules(); err != nil { + return err + } + // An operator the dialect lists replaces the one its rules would + // generate for the same operands, as GoogleSQL's INT64 / INT64 is a + // FLOAT64, so the list is read before the rules apply. + var operators []Operator + if err := stream(fsys, OperatorsFile, func(op Operator) error { + operators = append(operators, op) + return nil + }); err != nil { + return err + } + if err := b.categoryOperators(operators); err != nil { + return err + } + for i, op := range operators { + if err := b.addOperator(op); err != nil { + return fmt.Errorf("seed: %s: record %d: %w", OperatorsFile, i+1, err) + } + } + if err := stream(fsys, CastsFile, b.addCast); err != nil { + return err + } + if err := b.categoryCasts(); err != nil { + return err + } + if err := stream(fsys, FunctionsFile, b.addFunction); err != nil { + return err + } + return stream(fsys, RelationsFile, b.addRelation) +} + +func loadSettings(fsys fs.FS) (Settings, error) { + f, err := fsys.Open(SettingsFile) + if err != nil { + return Settings{}, fmt.Errorf("seed: %w", err) + } + defer f.Close() + + dec := json.NewDecoder(bufio.NewReader(f)) + dec.DisallowUnknownFields() + var settings Settings + if err := dec.Decode(&settings); err != nil { + return Settings{}, fmt.Errorf("seed: %s: %w", SettingsFile, err) + } + if settings.Dialect == "" { + return Settings{}, fmt.Errorf("seed: %s: dialect has no name", SettingsFile) + } + settings.fsys = fsys + return settings, nil +} + +// stream decodes name a record at a time, handing each to fn as it is read. A +// file that is not there contributes nothing, so a dialect only writes the +// files it needs. An unknown field is an error rather than something to +// ignore, so that a misspelled key is caught where it is written. +func stream[T any](fsys fs.FS, name string, fn func(T) error) error { + f, err := fsys.Open(name) + if errors.Is(err, fs.ErrNotExist) { + return nil + } + if err != nil { + return fmt.Errorf("seed: %w", err) + } + defer f.Close() + + dec := json.NewDecoder(bufio.NewReader(f)) + dec.DisallowUnknownFields() + for record := 1; ; record++ { + var rec T + if err := dec.Decode(&rec); err != nil { + if errors.Is(err, io.EOF) { + return nil + } + return fmt.Errorf("seed: %s: record %d: %w", name, record, err) + } + if err := fn(rec); err != nil { + return fmt.Errorf("seed: %s: record %d: %w", name, record, err) + } + } +} + +// Functions streams a dialect's functions into the form the engine catalogs +// use. It is how an engine whose standard library lives in functions.jsonl +// hands that library to the rest of sqlc. +func Functions(fsys fs.FS, dir string) ([]*catalog.Function, error) { + sub, err := fs.Sub(fsys, dir) + if err != nil { + return nil, fmt.Errorf("seed: %s: %w", dir, err) + } + var out []*catalog.Function + err = stream(sub, FunctionsFile, func(fn Function) error { + args := make([]*catalog.Argument, 0, len(fn.Args)) + for _, a := range fn.Args { + args = append(args, &catalog.Argument{ + Name: a.Name, + Type: &ast.TypeName{Name: a.Type}, + HasDefault: a.HasDefault, + Mode: argMode(a.Mode), + }) + } + out = append(out, &catalog.Function{ + Name: fn.Name, + Args: args, + ReturnType: &ast.TypeName{Name: fn.Returns}, + ReturnTypeNullable: fn.Nullable, + }) + return nil + }) + if err != nil { + return nil, err + } + return out, nil +} + +// Relations streams the relations a dialect ships with in the named schema +// into the form the engine catalogs use. +func Relations(fsys fs.FS, dir, schema string) ([]*catalog.Table, error) { + sub, err := fs.Sub(fsys, dir) + if err != nil { + return nil, fmt.Errorf("seed: %s: %w", dir, err) + } + var out []*catalog.Table + err = stream(sub, RelationsFile, func(rel Relation) error { + if rel.Schema != schema { + return nil + } + table := &catalog.Table{ + Rel: &ast.TableName{Catalog: rel.Catalog, Schema: rel.Schema, Name: rel.Name}, + Columns: make([]*catalog.Column, 0, len(rel.Columns)), + } + for _, col := range rel.Columns { + // A column's type may carry arguments, as MySQL's varchar(64) + // does; the legacy catalog holds the family and the length + // apart. + t := core.ParseTypeExpr(col.Type) + column := &catalog.Column{ + Name: col.Name, + Type: ast.TypeName{Name: t.Name}, + IsNotNull: col.NotNull, + IsArray: col.Array, + } + if col.Array { + column.ArrayDims = 1 + } + if col.Length > 0 { + length := col.Length + column.Length = &length + } else if len(t.Args) > 0 && t.Args[0].Int != nil { + length := int(*t.Args[0].Int) + column.Length = &length + } + table.Columns = append(table.Columns, column) + } + out = append(out, table) + return nil + }) + if err != nil { + return nil, err + } + return out, nil +} + +// argModes maps the mode a record carries to the one the catalog uses. The +// letters are PostgreSQL's, which is where the generated function lists come +// from. +var argModes = map[string]ast.FuncParamMode{ + "i": ast.FuncParamIn, + "o": ast.FuncParamOut, + "b": ast.FuncParamInOut, + "v": ast.FuncParamVariadic, + "t": ast.FuncParamTable, + "d": ast.FuncParamDefault, +} + +func argMode(mode string) ast.FuncParamMode { + if m, ok := argModes[mode]; ok { + return m + } + return ast.FuncParamIn +} + +// ArgMode is the letter a record carries for a catalog argument mode, the +// inverse of the mapping applied when reading one. +func ArgMode(mode ast.FuncParamMode) string { + for letter, m := range argModes { + if m == mode { + return letter + } + } + return "i" +} + +type builder struct { + cat *core.Catalog + settings Settings + dialectOID int64 + + // oids maps a lowercased type spelling to the row a seed record naming + // it means, and categories records the category each family was seeded + // under, in the order they were read. + oids map[string]int64 + categories []categorized + + // namespaces maps a schema name to its OID, so that a run of relations in + // the same schema resolves it once. + namespaces map[string]int64 + + // seenCasts records the pairs already registered. The alias rules and the + // category rules overlap, and a cast pair is unique in the catalog. + seenCasts map[[2]int64]bool +} + +type categorized struct { + name string + category string +} + +func (b *builder) addType(t Type) error { + var baseOID int64 + if t.Base != "" { + oid, ok := b.oids[strings.ToLower(t.Base)] + if !ok { + return fmt.Errorf("type %q: base %q is not a type listed before it", t.Name, t.Base) + } + baseOID = oid + } + oid, err := b.createType(t.Name, t.Category, baseOID) + if err != nil { + return fmt.Errorf("type %q: %w", t.Name, err) + } + for _, alias := range t.Aliases { + if err := b.addAlias(alias, oid, t.Category); err != nil { + return fmt.Errorf("type %q: alias %q: %w", t.Name, alias, err) + } + } + return nil +} + +// addAlias registers another spelling of a type: a row that points at the +// type as its canonical form, or — for a dialect whose aliases are types of +// their own — as its base. +func (b *builder) addAlias(name string, typeOID int64, category string) error { + key := strings.ToLower(name) + if _, ok := b.oids[key]; ok { + return nil + } + spec := core.TypeSpec{Name: key, Typtype: "b", Category: category, DialectOID: b.dialectOID} + if b.settings.Alias == "base" { + spec.BaseOID = typeOID + } else { + spec.CanonicalOID = typeOID + } + oid, err := b.cat.CreateTypeSpec(spec) + if err != nil { + return err + } + // A record naming the alias means the type it stands for, unless the + // alias is a type of its own. + if b.settings.Alias == "base" { + b.oids[key] = oid + } else { + b.oids[key] = typeOID + } + return nil +} + +func (b *builder) createType(name, category string, baseOID int64) (int64, error) { + key := strings.ToLower(name) + if oid, ok := b.oids[key]; ok { + return oid, nil + } + oid, err := b.cat.CreateTypeSpec(core.TypeSpec{ + Name: key, + Typtype: "b", + Category: category, + BaseOID: baseOID, + DialectOID: b.dialectOID, + }) + if err != nil { + return 0, err + } + b.oids[key] = oid + b.categories = append(b.categories, categorized{name: key, category: category}) + return oid, nil +} + +// constKinds are the kinds of literal a dialect may name a type for. +var constKinds = []string{core.ConstInteger, core.ConstFloat, core.ConstString, core.ConstBool} + +func (b *builder) consts() error { + for kind := range b.settings.Const { + if !slices.Contains(constKinds, kind) { + return fmt.Errorf("seed %s: unknown constant kind %q, want one of %s", + b.settings.Dialect, kind, strings.Join(constKinds, ", ")) + } + } + // Written in a fixed order rather than the map's: a catalog built from the + // same dialect twice has to come out byte for byte the same, so that the + // cache stores one copy of it rather than one per run. + for _, kind := range constKinds { + name, ok := b.settings.Const[kind] + if !ok { + continue + } + if _, ok := b.oids[strings.ToLower(name)]; !ok { + return fmt.Errorf("seed %s: constant %s names unknown type %q", b.settings.Dialect, kind, name) + } + if err := b.cat.SetConstType(b.dialectOID, kind, name); err != nil { + return err + } + } + if b.settings.DefaultSchema != "" { + if err := b.cat.SetDialectFlag(b.dialectOID, core.FlagDefaultSchema, strings.ToLower(b.settings.DefaultSchema)); err != nil { + return err + } + } + for key, name := range map[string]string{ + core.FlagBoolType: b.settings.Bool, + core.FlagLimitType: b.settings.Limit, + core.FlagUntypedType: b.settings.Untyped, + } { + if name == "" { + continue + } + if _, ok := b.oids[strings.ToLower(name)]; !ok { + return fmt.Errorf("seed %s: %s names unknown type %q", b.settings.Dialect, key, name) + } + if err := b.cat.SetDialectFlag(b.dialectOID, key, name); err != nil { + return err + } + } + if b.settings.PropagateNullable { + if err := b.cat.SetDialectFlag(b.dialectOID, core.FlagPropagateNullable, "true"); err != nil { + return err + } + } + if b.settings.QualifyDuplicateColumns { + if err := b.cat.SetDialectFlag(b.dialectOID, core.FlagQualifyDuplicateColumns, "true"); err != nil { + return err + } + } + // A schema declares types the seed knows nothing about — enums, domains, + // arrays, a SQLite column typed whatever the author felt like. Recording + // the comparison operators lets the catalog give those types the same ones. + if len(b.settings.Comparison) > 0 { + if err := b.cat.SetDialectFlag(b.dialectOID, core.FlagComparisonOperators, + strings.Join(b.settings.Comparison, ",")); err != nil { + return err + } + } + // The cast categories are recorded for the same reason: a type an + // extension adds joins its category's casts. + if b.settings.CastCategories != "" { + return b.cat.SetDialectFlag(b.dialectOID, core.FlagCastCategories, b.settings.CastCategories) + } + return nil +} + +// rules records what the dialect does to a type before storing it: its +// rewrites, its identifier words and positions, and its affinity rule. +func (b *builder) rules() error { + s := b.settings + for i, rw := range s.Rewrites { + if rw.From == "" || rw.To == "" { + return fmt.Errorf("seed %s: rewrite %d needs from and to", s.Dialect, i+1) + } + if err := b.cat.AddTypeRewrite(i+1, rw.From, rw.To, rw.Where); err != nil { + return err + } + } + if len(s.Idents) > 0 { + if err := b.cat.SetDialectFlag(b.dialectOID, core.FlagIdents, strings.ToLower(strings.Join(s.Idents, ","))); err != nil { + return err + } + } + if len(s.IdentArgs) > 0 { + families := make([]string, 0, len(s.IdentArgs)) + for family := range s.IdentArgs { + families = append(families, family) + } + // In a fixed order, so the catalog comes out the same every time. + slices.Sort(families) + entries := make([]string, 0, len(families)) + for _, family := range families { + positions := make([]string, 0, len(s.IdentArgs[family])) + for _, p := range s.IdentArgs[family] { + positions = append(positions, strconv.Itoa(p)) + } + entries = append(entries, strings.ToLower(family)+":"+strings.Join(positions, ",")) + } + if err := b.cat.SetDialectFlag(b.dialectOID, core.FlagIdentArgs, strings.Join(entries, ";")); err != nil { + return err + } + } + for i, a := range s.Affinity { + oid, ok := b.oids[strings.ToLower(a.Type)] + if !ok { + return fmt.Errorf("seed %s: affinity names unknown type %q", s.Dialect, a.Type) + } + if err := b.cat.AddTypeAffinity(i+1, a.Contains, oid); err != nil { + return err + } + } + return nil +} + +func (b *builder) categoryOperators(listed []Operator) error { + s := b.settings + overridden := map[[3]string]bool{} + for _, op := range listed { + overridden[[3]string{op.Name, strings.ToLower(op.Left), strings.ToLower(op.Right)}] = true + } + boolOID, ok := b.oids[strings.ToLower(s.Bool)] + if len(s.Comparison) > 0 && !ok { + return fmt.Errorf("seed %s: comparison operators need a bool type", s.Dialect) + } + for _, t := range b.categories { + if strings.Contains(s.ComparisonCategories, t.category) { + for _, op := range s.Comparison { + if err := b.operator(op, t.name, t.name, s.Bool, boolOID); err != nil { + return err + } + } + } + if strings.Contains(s.ArithmeticCategories, t.category) { + for _, op := range s.Arithmetic { + if overridden[[3]string{op, strings.ToLower(t.name), strings.ToLower(t.name)}] { + continue + } + if err := b.operator(op, t.name, t.name, t.name, b.oids[t.name]); err != nil { + return err + } + } + } + } + return nil +} + +func (b *builder) addOperator(op Operator) error { + return b.operator(op.Name, op.Left, op.Right, op.Result, 0) +} + +func (b *builder) operator(name, left, right, result string, resultOID int64) error { + leftOID, ok := b.oids[strings.ToLower(left)] + if !ok { + return fmt.Errorf("operator %q: unknown left type %q", name, left) + } + rightOID, ok := b.oids[strings.ToLower(right)] + if !ok { + return fmt.Errorf("operator %q: unknown right type %q", name, right) + } + if resultOID == 0 { + resultOID, ok = b.oids[strings.ToLower(result)] + if !ok { + return fmt.Errorf("operator %q: unknown result type %q", name, result) + } + } + _, err := b.cat.CreateOperator(core.OperatorSpec{ + Name: name, + DialectOID: b.dialectOID, + LeftTypeOID: leftOID, + RightTypeOID: rightOID, + ResultTypeOID: resultOID, + }) + return err +} + +// categoryCasts applies the rule that makes the types in a category mutually +// castable, once every type has been read. +func (b *builder) categoryCasts() error { + categories := b.settings.CastCategories + if categories == "" { + return nil + } + anyCategory := categories == "*" + for _, src := range b.categories { + if !anyCategory && !strings.Contains(categories, src.category) { + continue + } + for _, tgt := range b.categories { + if src.name == tgt.name { + continue + } + if !anyCategory && src.category != tgt.category { + continue + } + if err := b.addCast(Cast{Source: src.name, Target: tgt.name, Context: "i"}); err != nil { + return err + } + } + } + return nil +} + +func (b *builder) addCast(c Cast) error { + srcOID, ok := b.oids[strings.ToLower(c.Source)] + if !ok { + return fmt.Errorf("cast: unknown source type %q", c.Source) + } + tgtOID, ok := b.oids[strings.ToLower(c.Target)] + if !ok { + return fmt.Errorf("cast: unknown target type %q", c.Target) + } + if srcOID == tgtOID || b.seenCasts[[2]int64{srcOID, tgtOID}] { + return nil + } + b.seenCasts[[2]int64{srcOID, tgtOID}] = true + context := c.Context + if context == "" { + context = "i" + } + return b.cat.CreateCast(core.CastSpec{ + SourceTypeOID: srcOID, + TargetTypeOID: tgtOID, + Context: context, + DialectOID: b.dialectOID, + }) +} + +func (b *builder) addFunction(fn Function) error { + returns, template := returnTemplate(fn.Returns) + returnOID, err := b.funcType(returns) + if err != nil { + return fmt.Errorf("function %q: %w", fn.Name, err) + } + args := make([]core.ProcArg, 0, len(fn.Args)) + for _, a := range fn.Args { + // An out or table parameter is part of the result, not the call. + switch a.Mode { + case "o", "t": + continue + } + argOID, err := b.funcType(a.Type) + if err != nil { + return fmt.Errorf("function %q: %w", fn.Name, err) + } + args = append(args, core.ProcArg{ + Name: a.Name, + TypeOID: argOID, + Mode: a.Mode, + HasDefault: a.HasDefault, + }) + } + _, err = b.cat.CreateProc(core.ProcSpec{ + Name: fn.Name, + DialectOID: b.dialectOID, + Kind: fn.Kind, + ReturnTypeOID: returnOID, + ReturnNullable: fn.Nullable, + NeverNull: fn.NeverNull, + ReturnTemplate: template, + Args: args, + }) + if err != nil { + return fmt.Errorf("function %q: %w", fn.Name, err) + } + return nil +} + +// returnTemplate splits a function's Returns into the type the catalog +// records and the template it keeps: a result spelled over the arguments, +// as Decimal(18, $2) is, records its family and keeps the whole spelling +// to fill in at each call. A bare $n, the type of that argument, is a +// pseudo-type of its own rather than a template. +func returnTemplate(returns string) (string, string) { + if !strings.Contains(returns, "$") || strings.HasPrefix(returns, "$") { + return returns, "" + } + t := core.ParseTypeExpr(returns) + return t.Name, returns +} + +func (b *builder) addRelation(rel Relation) error { + if rel.Name == "" { + return errors.New("relation has no name") + } + nsOID, err := b.namespace(rel.Schema) + if err != nil { + return err + } + kind := rel.Kind + if kind == "" { + kind = "r" + } + classOID, err := b.cat.CreateClass(nsOID, rel.Name, kind) + if err != nil { + return err + } + for i, col := range rel.Columns { + t := core.ParseTypeExpr(col.Type) + if col.Array { + t = core.Array(t) + } + typeOID, err := b.columnType(t) + if err != nil { + return fmt.Errorf("relation %q column %q: %w", rel.Name, col.Name, err) + } + if err := b.cat.CreateAttributeSpec(core.AttributeSpec{ + ClassOID: classOID, + Name: col.Name, + TypeOID: typeOID, + Num: i + 1, + NotNull: col.NotNull, + DeclType: col.Type, + }); err != nil { + return fmt.Errorf("relation %q column %q: %w", rel.Name, col.Name, err) + } + } + return nil +} + +// namespace resolves the schema a relation belongs to, creating it the first +// time it is named. A relation with no schema belongs to the default one. +func (b *builder) namespace(schema string) (int64, error) { + if schema == "" { + schema = "public" + } + if oid, ok := b.namespaces[schema]; ok { + return oid, nil + } + oid, err := b.cat.NamespaceOID(schema) + if err != nil { + if oid, err = b.cat.CreateNamespace(schema); err != nil { + return 0, err + } + } + b.namespaces[schema] = oid + return oid, nil +} + +// columnType resolves a column's type, which may be an array or carry +// arguments. +func (b *builder) columnType(t *core.TypeExpr) (int64, error) { + key := t.Key() + if oid, ok := b.oids[key]; ok { + return oid, nil + } + oid, err := b.cat.ResolveTypeExpr(t) + if err != nil { + return 0, err + } + b.oids[key] = oid + return oid, nil +} + +// funcType resolves the type a function signature names. Signatures reference +// pseudo types ("any", "record") and types no dialect bothers to list, so an +// unknown name is registered rather than rejected. +func (b *builder) funcType(name string) (int64, error) { + if name == "" { + return 0, nil + } + key := strings.ToLower(name) + if oid, ok := b.oids[key]; ok { + return oid, nil + } + oid, err := b.cat.ResolvePseudoTypeExpr(core.ParseTypeExpr(name)) + if err != nil { + return 0, err + } + b.oids[key] = oid + return oid, nil +} diff --git a/internal/core/sqlc.json b/internal/core/sqlc.json new file mode 100644 index 0000000000..3b4763b697 --- /dev/null +++ b/internal/core/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "engine": "sqlite", + "schema": "catalogdef/schema.sql", + "queries": "catalogdef/query.sql", + "gen": { + "go": { + "package": "catalogdb", + "out": "catalogdb" + } + } + } + ] +} diff --git a/internal/core/typeexpr.go b/internal/core/typeexpr.go new file mode 100644 index 0000000000..59372bb1f9 --- /dev/null +++ b/internal/core/typeexpr.go @@ -0,0 +1,324 @@ +package core + +import ( + "strconv" + "strings" +) + +// TypeExpr is a type written as a call expression: a lowercased name applied +// to arguments that are other types, integers, booleans or strings, each +// with an optional label, and a nullable flag at whatever depth it applies. +// Nothing about a nested type is special-cased, so an array of nullable +// strings is array(string nullable), a map is map(string, uint32) and a +// named tuple is tuple(lat: float64, lon: float64). The catalog resolves the +// names; the expression only records what was declared or inferred. +type TypeExpr struct { + Name string `json:"name"` + Nullable bool `json:"nullable,omitempty"` + Args []TypeArg `json:"args,omitempty"` +} + +// TypeArg is one argument of a TypeExpr: exactly one of Type, Int, Bool, +// String or Ident is set. Ident is a bare word that is not a type — the max +// of nvarchar(max), the function of SimpleAggregateFunction(sum, UInt64), +// the fields of interval day to second. +type TypeArg struct { + Label string `json:"label,omitempty"` + Type *TypeExpr `json:"type,omitempty"` + Int *int64 `json:"int,omitempty"` + Bool *bool `json:"bool,omitempty"` + String *string `json:"string,omitempty"` + Ident *string `json:"ident,omitempty"` +} + +// ArrayTypeName is the family every dialect's array is an instance of: an +// array of integers is array(integer), whatever the dialect spells it. +const ArrayTypeName = "array" + +// Array wraps element in one array dimension. +func Array(element *TypeExpr) *TypeExpr { + return &TypeExpr{Name: ArrayTypeName, Args: []TypeArg{{Type: element}}} +} + +// IsArray reports whether the expression is an array. +func (t *TypeExpr) IsArray() bool { + return t != nil && t.Name == ArrayTypeName && len(t.Args) > 0 && t.Args[0].Type != nil +} + +// Element is an array's element type, or nil for anything else. +func (t *TypeExpr) Element() *TypeExpr { + if !t.IsArray() { + return nil + } + return t.Args[0].Type +} + +// ArrayDims counts the array dimensions wrapped around the expression's +// innermost type, and Innermost is that type: the integer of an array of +// arrays of integers. +func (t *TypeExpr) ArrayDims() int { + dims := 0 + for t.IsArray() { + dims++ + t = t.Element() + } + return dims +} + +func (t *TypeExpr) Innermost() *TypeExpr { + for t.IsArray() { + t = t.Element() + } + return t +} + +// Clone copies the expression, arguments and all, so that a caller can set +// nullability on the copy without touching a cached one. +func (t *TypeExpr) Clone() *TypeExpr { + if t == nil { + return nil + } + out := &TypeExpr{Name: t.Name, Nullable: t.Nullable} + if len(t.Args) > 0 { + out.Args = make([]TypeArg, len(t.Args)) + for i, a := range t.Args { + out.Args[i] = a + out.Args[i].Type = a.Type.Clone() + } + } + return out +} + +// WithNullable returns a copy of the expression with its own nullability set +// as given; the nullability of a nested type is left alone. +func (t *TypeExpr) WithNullable(nullable bool) *TypeExpr { + out := t.Clone() + if out != nil { + out.Nullable = nullable + } + return out +} + +// Key is the expression's canonical spelling, which identifies its row in +// the catalog: the expression's own nullability is not part of it, since a +// row is never nullable, while the nullability of a nested type is. +func (t *TypeExpr) Key() string { + if t == nil { + return "" + } + if !t.Nullable { + return t.String() + } + return t.WithNullable(false).String() +} + +// ParseTypeExpr reads a type spelled the way every dialect spells one, as a +// name optionally applied to a parenthesised, comma-separated argument list +// whose entries may be labelled (`lat Float64` in a tuple, `'a' = 1` in an +// enum). A Nullable(T) wrapper becomes T with Nullable set, and a trailing +// [] becomes an array of the element. +func ParseTypeExpr(s string) *TypeExpr { + s = strings.TrimSpace(s) + if element, ok := strings.CutSuffix(s, ArraySuffix); ok { + return Array(ParseTypeExpr(element)) + } + name, args := splitTypeArgs(s) + name = strings.ToLower(name) + if name == "nullable" && len(args) == 1 { + t := ParseTypeExpr(args[0]) + t.Nullable = true + return t + } + t := &TypeExpr{Name: name} + for _, a := range args { + t.Args = append(t.Args, parseTypeArg(a)) + } + return t +} + +func parseTypeArg(a string) TypeArg { + a = strings.TrimSpace(a) + if strings.HasPrefix(a, "'") { + end := quotedEnd(a) + lit := strings.ReplaceAll(strings.ReplaceAll(a[1:end-1], `\'`, `'`), `''`, `'`) + if rest := strings.TrimSpace(a[end:]); strings.HasPrefix(rest, "=") { + arg := parseTypeArg(rest[1:]) + arg.Label = lit + return arg + } + return TypeArg{String: &lit} + } + if n, err := strconv.ParseInt(a, 10, 64); err == nil { + return TypeArg{Int: &n} + } + switch strings.ToLower(a) { + case "true", "false": + b := strings.EqualFold(a, "true") + return TypeArg{Bool: &b} + } + // A label is a word before a colon, as the canonical form writes it: + // `lat: Float64`. A word before a space is a label too, as ClickHouse + // writes `lat Float64`, but only when what follows is a single word, + // since `timestamp with time zone` is a name and not a label. + head := a + if p := strings.IndexByte(a, '('); p >= 0 { + head = a[:p] + } + if i := strings.IndexByte(head, ':'); i > 0 && !strings.ContainsAny(head[:i], " '\"") { + return TypeArg{Label: strings.TrimSpace(a[:i]), Type: ParseTypeExpr(a[i+1:])} + } + if i := strings.IndexByte(head, ' '); i > 0 && !strings.Contains(strings.TrimSpace(head[i+1:]), " ") { + return TypeArg{Label: a[:i], Type: ParseTypeExpr(a[i+1:])} + } + return TypeArg{Type: ParseTypeExpr(a)} +} + +// quotedEnd returns the index just past the single-quoted literal starting +// at the beginning of s, honouring backslash escapes and doubled quotes. +func quotedEnd(s string) int { + for i := 1; i < len(s); i++ { + switch { + case s[i] == '\\' && i+1 < len(s): + i++ + case s[i] == '\'' && i+1 < len(s) && s[i+1] == '\'': + i++ + case s[i] == '\'': + return i + 1 + } + } + return len(s) +} + +// splitTypeArgs splits `Base(arg, arg)` into its base name and top-level +// arguments, leaving nested parentheses and quoted strings intact. Words +// after the closing parenthesis belong to the name, since MySQL writes +// decimal(10,2) unsigned and PostgreSQL timestamp(3) with time zone. +func splitTypeArgs(t string) (string, []string) { + open := strings.IndexByte(t, '(') + if open < 0 { + return t, nil + } + close := matchingParen(t, open) + if close < 0 { + return t, nil + } + base := strings.TrimSpace(t[:open]) + if rest := strings.TrimSpace(t[close+1:]); rest != "" { + base += " " + rest + } + inner := t[open+1 : close] + var ( + args []string + depth int + quote byte + start int + ) + for i := 0; i < len(inner); i++ { + c := inner[i] + switch { + case quote != 0: + if c == '\\' { + i++ + } else if c == quote { + quote = 0 + } + case c == '\'' || c == '"' || c == '`': + quote = c + case c == '(': + depth++ + case c == ')': + depth-- + case c == ',' && depth == 0: + args = append(args, strings.TrimSpace(inner[start:i])) + start = i + 1 + } + } + if last := strings.TrimSpace(inner[start:]); last != "" || len(args) > 0 { + args = append(args, last) + } + return base, args +} + +// matchingParen finds the parenthesis closing the one at open, skipping +// nested parentheses and quoted strings, or -1 when it is not closed. +func matchingParen(t string, open int) int { + depth := 0 + var quote byte + for i := open; i < len(t); i++ { + c := t[i] + switch { + case quote != 0: + if c == '\\' { + i++ + } else if c == quote { + quote = 0 + } + case c == '\'' || c == '"' || c == '`': + quote = c + case c == '(': + depth++ + case c == ')': + depth-- + if depth == 0 { + return i + } + } + } + return -1 +} + +// HasNullable reports whether the expression marks nullability anywhere, +// which tells whether the spelling it came from said so itself. +func (t *TypeExpr) HasNullable() bool { + if t == nil { + return false + } + if t.Nullable { + return true + } + for _, a := range t.Args { + if a.Type.HasNullable() { + return true + } + } + return false +} + +// String renders the expression in its canonical text form, with a trailing +// "nullable" marking a nullable type. +func (t *TypeExpr) String() string { + if t == nil { + return "" + } + var b strings.Builder + b.WriteString(t.Name) + if len(t.Args) > 0 { + b.WriteByte('(') + for i, a := range t.Args { + if i > 0 { + b.WriteString(", ") + } + if a.Label != "" { + b.WriteString(a.Label) + b.WriteString(": ") + } + switch { + case a.Type != nil: + b.WriteString(a.Type.String()) + case a.Int != nil: + b.WriteString(strconv.FormatInt(*a.Int, 10)) + case a.Bool != nil: + b.WriteString(strconv.FormatBool(*a.Bool)) + case a.String != nil: + b.WriteString("'" + strings.ReplaceAll(*a.String, "'", `\'`) + "'") + case a.Ident != nil: + b.WriteString(*a.Ident) + } + } + b.WriteByte(')') + } + if t.Nullable { + b.WriteString(" nullable") + } + return b.String() +} diff --git a/internal/core/typename.go b/internal/core/typename.go new file mode 100644 index 0000000000..4c37a272ac --- /dev/null +++ b/internal/core/typename.go @@ -0,0 +1,150 @@ +package core + +import ( + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +// TypeExprOfTypeName reads the type an AST node names into an expression. +// An engine that renders the whole type as a call expression — DuckDB's +// struct(a: integer, b: varchar) — hands it over in Canonical; one that +// folds it into the spelling the formatter prints back — ClickHouse's +// Array(Nullable(String)), SQLite's VARYING CHARACTER(10) — in Spelling. +// Otherwise the name comes from Name or the qualifying parts of Names, the +// type modifiers become integer or string arguments, and each array bound +// wraps the result in an array. +func TypeExprOfTypeName(tn *ast.TypeName) *TypeExpr { + if tn == nil { + return nil + } + if tn.Canonical != "" { + return ParseTypeExpr(tn.Canonical) + } + if tn.Spelling != "" { + return ParseTypeExpr(tn.Spelling) + } + name := strings.TrimSpace(tn.Name) + if name == "" && tn.Names != nil { + parts := make([]string, 0, len(tn.Names.Items)) + for _, item := range tn.Names.Items { + s, ok := item.(*ast.String) + if !ok || s.Str == "pg_catalog" { + continue + } + parts = append(parts, s.Str) + } + name = strings.Join(parts, ".") + } + name = strings.ToLower(name) + if name == "" { + return nil + } + // An engine that reports the schema apart from the name qualifies it + // the way a dotted name does, so the type resolves in its namespace. + if schema := strings.ToLower(tn.Schema); schema != "" && schema != "pg_catalog" && !strings.Contains(name, ".") { + name = schema + "." + name + } + // A name an engine spelled with its own arguments or array suffix reads + // the same way a spelling does. + t := ParseTypeExpr(name) + for _, item := range listItems(tn.Typmods) { + if arg, ok := typmodArg(item); ok { + t.Args = append(t.Args, arg) + } + } + for range listItems(tn.ArrayBounds) { + t = Array(t) + } + return t +} + +// ColumnTypeExpr reads a column definition's type. Engines report an array +// column either on the type name or on the column itself. +func ColumnTypeExpr(col *ast.ColumnDef) *TypeExpr { + if col == nil { + return nil + } + t := TypeExprOfTypeName(col.TypeName) + if t == nil { + return nil + } + // MySQL reports an unsigned column on the definition, and the + // members of an enum or set apart from the type's name. + if col.IsUnsigned && !strings.Contains(t.Name, " unsigned") { + t.Name += " unsigned" + } + if vals := listItems(col.Vals); len(vals) > 0 && len(t.Args) == 0 { + for _, item := range vals { + if s, ok := item.(*ast.String); ok { + v := s.Str + t.Args = append(t.Args, TypeArg{String: &v}) + } + } + } + if col.TypeName.Canonical != "" || col.TypeName.Spelling != "" || listItems(col.TypeName.ArrayBounds) != nil { + return t + } + dims := col.ArrayDims + if dims == 0 && col.IsArray { + dims = 1 + } + for i := 0; i < dims; i++ { + t = Array(t) + } + return t +} + +// typmodArg reads one type modifier as an argument: an integer, a quoted +// string, or a bare word, which is an identifier such as the max of +// nvarchar(max) or the day to second of an interval. A constant node holds +// a literal; a bare String node holds a word. +func typmodArg(n ast.Node) (TypeArg, bool) { + switch v := n.(type) { + case *ast.A_Const: + switch val := v.Val.(type) { + case *ast.String: + s := val.Str + return TypeArg{String: &s}, true + default: + return typmodArg(v.Val) + } + case *ast.Integer: + i := v.Ival + return TypeArg{Int: &i}, true + case *ast.String: + s := strings.ToLower(v.Str) + return TypeArg{Ident: &s}, true + case *ast.ColumnRef: + parts := make([]string, 0, len(listItems(v.Fields))) + for _, item := range listItems(v.Fields) { + if s, ok := item.(*ast.String); ok { + parts = append(parts, s.Str) + } + } + if len(parts) == 0 { + return TypeArg{}, false + } + ident := strings.ToLower(strings.Join(parts, ".")) + return TypeArg{Ident: &ident}, true + } + return TypeArg{}, false +} + +func listItems(l *ast.List) []ast.Node { + if l == nil { + return nil + } + return l.Items +} + +// ResolveType interns the type an AST node names, registering it when the +// dialect's seed did not: a schema is free to declare types of its own. +func (c *Catalog) ResolveType(tn *ast.TypeName) (int64, error) { + t := TypeExprOfTypeName(tn) + if t == nil { + return 0, fmt.Errorf("missing type name") + } + return c.ResolveTypeExpr(t) +} diff --git a/internal/core/types.go b/internal/core/types.go new file mode 100644 index 0000000000..7c482a1f2b --- /dev/null +++ b/internal/core/types.go @@ -0,0 +1,825 @@ +package core + +import ( + "context" + "database/sql" + "errors" + "fmt" + "slices" + "strings" + "sync" + + "github.com/sqlc-dev/sqlc/internal/core/catalogdb" +) + +// TypeSpec describes a type row. Name is the family's name; Expr is the +// canonical spelling of the whole expression and defaults to the name, which +// is what a family's is. +type TypeSpec struct { + Name string + Expr string + Typtype string + Category string + Preferred bool + NamespaceOID int64 + DialectOID int64 + FamilyOID int64 + ElementOID int64 + BaseOID int64 + CanonicalOID int64 + NotNull bool +} + +// TypeInfo is a type row as the catalog holds it. +type TypeInfo struct { + OID int64 + NamespaceOID int64 + Name string + Expr string + Category string + Typtype string + Preferred bool + FamilyOID int64 + ElementOID int64 + BaseOID int64 + CanonicalOID int64 + NotNull bool +} + +// IsFamily reports whether the row is a family rather than an instance. +func (t TypeInfo) IsFamily() bool { return t.FamilyOID == 0 } + +// typeCache remembers what the catalog holds about a type. A row never +// changes once written, and a restored catalog is read-only, so a cached +// answer is good for the life of the catalog. Analysis runs concurrently on +// a restored catalog, so the cache is locked. +type typeCache struct { + mu sync.RWMutex + infos map[int64]TypeInfo + exprs map[int64]*TypeExpr + namespaces map[int64]string + namespaceOIDs map[string]int64 +} + +func (c *typeCache) namespace(oid int64) (string, bool) { + c.mu.RLock() + defer c.mu.RUnlock() + name, ok := c.namespaces[oid] + return name, ok +} + +func (c *typeCache) namespaceOID(name string) (int64, bool) { + c.mu.RLock() + defer c.mu.RUnlock() + oid, ok := c.namespaceOIDs[name] + return oid, ok +} + +func (c *typeCache) putNamespace(oid int64, name string) { + c.mu.Lock() + defer c.mu.Unlock() + if c.namespaces == nil { + c.namespaces = map[int64]string{} + c.namespaceOIDs = map[string]int64{} + } + c.namespaces[oid] = name + c.namespaceOIDs[name] = oid +} + +func (c *typeCache) info(oid int64) (TypeInfo, bool) { + c.mu.RLock() + defer c.mu.RUnlock() + info, ok := c.infos[oid] + return info, ok +} + +func (c *typeCache) expr(oid int64) (*TypeExpr, bool) { + c.mu.RLock() + defer c.mu.RUnlock() + e, ok := c.exprs[oid] + return e, ok +} + +func (c *typeCache) put(info TypeInfo, expr *TypeExpr) { + c.mu.Lock() + defer c.mu.Unlock() + if c.infos == nil { + c.infos = map[int64]TypeInfo{} + c.exprs = map[int64]*TypeExpr{} + } + c.infos[info.OID] = info + if expr != nil { + c.exprs[info.OID] = expr + } +} + +func (c *Catalog) CreateType(name string) (int64, error) { + return c.CreateTypeSpec(TypeSpec{Name: name, Typtype: "b"}) +} + +// CreateTypeSpec inserts a type row. It is the raw insert: nothing is +// canonicalized and no arguments are written, so it is what the seed and +// ResolveTypeExpr build on rather than what a caller with an expression +// wants. +func (c *Catalog) CreateTypeSpec(t TypeSpec) (int64, error) { + if t.Typtype == "" { + t.Typtype = "b" + } + if t.NamespaceOID == 0 { + oid, err := c.NamespaceOID("public") + if err != nil { + return 0, fmt.Errorf("create type %q: default namespace: %w", t.Name, err) + } + t.NamespaceOID = oid + } + name := strings.ToLower(t.Name) + expr := t.Expr + if expr == "" { + expr = name + } + oid, err := c.q.CreateType(context.Background(), catalogdb.CreateTypeParams{ + Name: name, + Expr: expr, + Typtype: t.Typtype, + Category: nullString(t.Category), + Preferred: boolToInt64(t.Preferred), + NamespaceOid: t.NamespaceOID, + DialectOid: nullInt64(t.DialectOID), + FamilyOid: nullInt64(t.FamilyOID), + ElementOid: nullInt64(t.ElementOID), + BaseOid: nullInt64(t.BaseOID), + CanonicalOid: nullInt64(t.CanonicalOID), + NotNull: boolToInt64(t.NotNull), + }) + if err != nil { + return 0, fmt.Errorf("create type %q: %w", expr, err) + } + return oid, nil +} + +// ArraySuffix is the suffix a schema appends to an element type's spelling +// to name an array of it, which ParseTypeExpr reads as one array dimension. +const ArraySuffix = "[]" + +// CreateUserType registers a type family a schema declared rather than the +// dialect, such as an enum or a name the dialect's seed does not list. The +// type gains the dialect's comparison operators, so a column of it can be +// compared. +func (c *Catalog) CreateUserType(name, category string) (int64, error) { + typtype := "b" + if category == "E" { + typtype = "e" + } + nsOID, bare, err := c.declaredTypeNamespace(strings.ToLower(name)) + if err != nil { + return 0, fmt.Errorf("create type %q: %w", name, err) + } + spec := TypeSpec{ + Name: bare, + NamespaceOID: nsOID, + Typtype: typtype, + Category: category, + DialectOID: c.dialectOID, + } + // A dialect may say what an unknown spelling stands on, as SQLite's + // affinity rule does; the type then resolves through that base and + // needs no operators of its own. + if category == "U" { + baseOID, err := c.userTypeBase(bare) + if err != nil { + return 0, err + } + if baseOID != 0 { + base, err := c.LookupType(baseOID) + if err != nil { + return 0, err + } + spec.BaseOID = baseOID + spec.Category = base.Category + return c.CreateTypeSpec(spec) + } + } + oid, err := c.CreateTypeSpec(spec) + if err != nil { + return 0, err + } + if err := c.createComparisons(oid); err != nil { + return 0, err + } + return oid, nil +} + +// createComparisons gives a type the dialect's comparison operators, which the +// seed registered for the types it knew about up front. +func (c *Catalog) createComparisons(typeOID int64) error { + if c.dialectOID == 0 { + return nil + } + ops, _ := c.DialectFlag(c.dialectOID, FlagComparisonOperators) + boolName, _ := c.DialectFlag(c.dialectOID, "const."+ConstBool) + if ops == "" || boolName == "" { + return nil + } + boolOID, err := c.TypeOID(boolName) + if err != nil { + return nil + } + for _, op := range strings.Split(ops, ",") { + if op == "" { + continue + } + if _, err := c.CreateOperator(OperatorSpec{ + Name: op, + DialectOID: c.dialectOID, + LeftTypeOID: typeOID, + RightTypeOID: typeOID, + ResultTypeOID: boolOID, + }); err != nil { + return err + } + } + return nil +} + +// TypeOIDsInCategory returns the type families the catalog's dialect has in +// the named category, in the order they were created. +func (c *Catalog) TypeOIDsInCategory(category string) ([]int64, error) { + oids, err := c.q.TypeOIDsInCategory(context.Background(), catalogdb.TypeOIDsInCategoryParams{ + DialectOid: nullInt64(c.dialectOID), + Category: nullString(category), + }) + if err != nil { + return nil, fmt.Errorf("types in category %q: %w", category, err) + } + return oids, nil +} + +// TypeOID returns the family a name refers to: an alias spelling resolves to +// the type it names. +func (c *Catalog) TypeOID(name string) (int64, error) { + oid, err := c.familyOIDByName(strings.ToLower(name)) + if err != nil { + return 0, fmt.Errorf("type %q: %w", name, err) + } + return c.canonicalOID(oid) +} + +// familyOIDByName finds the family row a bare name refers to, alias rows +// included, in the default namespaces: the catalog's own, PostgreSQL's +// system catalog and the dialect's default schema, in that order of +// preference. A type in any other namespace is reached by qualifying it, +// as PostgreSQL reaches one off the search path. +func (c *Catalog) familyOIDByName(name string) (int64, error) { + nsOIDs, err := c.defaultNamespaceOIDs() + if err != nil { + return 0, err + } + rows, err := c.q.TypeOIDsByNameInNamespaces(context.Background(), catalogdb.TypeOIDsByNameInNamespacesParams{ + Name: name, + NamespaceOids: nsOIDs, + }) + if err != nil { + return 0, err + } + for _, ns := range nsOIDs { + for _, row := range rows { + if row.NamespaceOid == ns { + return row.Oid, nil + } + } + } + return 0, sql.ErrNoRows +} + +// defaultNamespaceOIDs lists the namespaces a bare type name is looked up +// in, in order of preference, skipping any the catalog does not have yet. +func (c *Catalog) defaultNamespaceOIDs() ([]int64, error) { + names := []string{"pg_catalog", "public"} + if c.dialectOID != 0 { + if name, _ := c.DialectFlag(c.dialectOID, FlagDefaultSchema); name != "" { + names = append(names, name) + } + } + out := make([]int64, 0, len(names)) + for _, name := range names { + oid, err := c.namespaceOIDByName(name) + if err != nil { + continue + } + out = append(out, oid) + } + return out, nil +} + +// namespaceOIDByName is NamespaceOID with the answer remembered, since a +// type lookup asks for the same few namespaces every time. A namespace +// created after the answer was cached is found on the next miss. +func (c *Catalog) namespaceOIDByName(name string) (int64, error) { + if oid, ok := c.types.namespaceOID(name); ok { + return oid, nil + } + oid, err := c.NamespaceOID(name) + if err != nil { + return 0, err + } + c.types.putNamespace(oid, name) + return oid, nil +} + +// familyOIDByQualifiedName is familyOIDByName for a name that may carry its +// namespace, as myschema.mood does: a qualified name is looked up in that +// namespace alone. +func (c *Catalog) familyOIDByQualifiedName(name string) (int64, error) { + ns, bare := splitQualifiedName(name) + if ns == "" { + return c.familyOIDByName(bare) + } + nsOID, err := c.namespaceOIDByName(ns) + if err != nil { + return 0, err + } + return c.q.TypeOIDByNameInNamespace(context.Background(), catalogdb.TypeOIDByNameInNamespaceParams{ + NamespaceOid: nsOID, + Name: bare, + }) +} + +// TypeDeclared reports whether a schema's CREATE TYPE would redeclare a +// type: one of that name in the namespace the name qualifies, or in the +// default namespaces for a bare name. +func (c *Catalog) TypeDeclared(name string) bool { + _, err := c.familyOIDByQualifiedName(strings.ToLower(name)) + return err == nil +} + +// splitQualifiedName splits "myschema.mood" into its namespace and name. A +// name with no dot has no namespace. +func splitQualifiedName(name string) (ns, bare string) { + if i := strings.LastIndexByte(name, '.'); i > 0 { + return name[:i], name[i+1:] + } + return "", name +} + +// declaredTypeNamespace is the namespace a declared type's row goes in: the +// one its name qualifies, created if the schema has not, or the dialect's +// default schema — dbo, main — so that a bare CREATE TYPE and a qualified +// reference to it name one row. +func (c *Catalog) declaredTypeNamespace(name string) (int64, string, error) { + ns, bare := splitQualifiedName(name) + if ns == "" { + if c.dialectOID != 0 { + ns, _ = c.DialectFlag(c.dialectOID, FlagDefaultSchema) + } + if ns == "" { + return 0, bare, nil + } + } + oid, err := c.NamespaceOID(ns) + if err != nil { + if oid, err = c.CreateNamespace(ns); err != nil { + return 0, "", err + } + } + return oid, bare, nil +} + +// CreateTypeWithArgs registers a declared type that has arguments of its own +// — a composite's fields, an enum's labels — as a family row carrying them. +// The arguments' types are interned first. +func (c *Catalog) CreateTypeWithArgs(spec TypeSpec, args []TypeArg) (int64, error) { + nsOID, bare, err := c.declaredTypeNamespace(strings.ToLower(spec.Name)) + if err != nil { + return 0, fmt.Errorf("create type %q: %w", spec.Name, err) + } + spec.Name = bare + if nsOID != 0 { + spec.NamespaceOID = nsOID + } + if spec.DialectOID == 0 { + spec.DialectOID = c.dialectOID + } + argOIDs := make([]int64, len(args)) + for i, a := range args { + if a.Type == nil { + continue + } + oid, _, err := c.internType(a.Type, func(name string) (int64, error) { + return c.CreateUserType(name, "U") + }, true) + if err != nil { + return 0, fmt.Errorf("create type %q: %w", spec.Name, err) + } + argOIDs[i] = oid + } + oid, err := c.CreateTypeSpec(spec) + if err != nil { + return 0, err + } + if err := c.createComparisons(oid); err != nil { + return 0, err + } + return oid, c.insertTypeArgs(oid, spec.Expr, args, argOIDs) +} + +// insertTypeArgs writes a type's argument rows. +func (c *Catalog) insertTypeArgs(oid int64, key string, args []TypeArg, argOIDs []int64) error { + ctx := context.Background() + for i, a := range args { + p := catalogdb.CreateTypeArgParams{TypeOid: oid, Ord: int64(i + 1), Label: a.Label} + switch { + case a.Type != nil: + p.ArgTypeOid = nullInt64(argOIDs[i]) + p.Nullable = boolToInt64(a.Type.Nullable) + case a.Int != nil: + p.IntValue = sql.NullInt64{Int64: *a.Int, Valid: true} + case a.Bool != nil: + p.BoolValue = sql.NullInt64{Int64: boolToInt64(*a.Bool), Valid: true} + case a.String != nil: + p.StringValue = sql.NullString{String: *a.String, Valid: true} + case a.Ident != nil: + p.Ident = sql.NullString{String: *a.Ident, Valid: true} + } + if err := c.q.CreateTypeArg(ctx, p); err != nil { + return fmt.Errorf("type %q: argument %d: %w", key, i+1, err) + } + } + return nil +} + +// canonicalOID follows an alias row to the row it stands for. +func (c *Catalog) canonicalOID(oid int64) (int64, error) { + for i := 0; i < 16; i++ { + info, err := c.LookupType(oid) + if err != nil { + return 0, err + } + if info.CanonicalOID == 0 { + return oid, nil + } + oid = info.CanonicalOID + } + return 0, fmt.Errorf("type oid %d: alias chain does not end", oid) +} + +// ResolutionOID is the row an operator, function or cast over the type is +// looked up on when none is registered on the type itself: an instance's +// family, an alias's canonical type, a domain's or wrapper's base. It +// returns 0 when there is nothing further to fall back to. +func (c *Catalog) ResolutionOID(oid int64) int64 { + info, err := c.LookupType(oid) + if err != nil { + return 0 + } + switch { + case info.CanonicalOID != 0: + return info.CanonicalOID + case info.FamilyOID != 0: + return info.FamilyOID + case info.BaseOID != 0: + return info.BaseOID + } + return 0 +} + +// ResolutionChain lists the type and every row resolution falls back to, in +// order, ending with the family everything about the type is registered on. +func (c *Catalog) ResolutionChain(oid int64) []int64 { + chain := []int64{oid} + for i := 0; i < 16 && oid != 0; i++ { + oid = c.ResolutionOID(oid) + if oid != 0 { + chain = append(chain, oid) + } + } + return chain +} + +// TypeName returns the family name of a type row. +func (c *Catalog) TypeName(oid int64) (string, error) { + info, err := c.LookupType(oid) + if err != nil { + return "", err + } + return info.Name, nil +} + +// LookupType returns what the catalog holds about a type row. +func (c *Catalog) LookupType(oid int64) (TypeInfo, error) { + if info, ok := c.types.info(oid); ok { + return info, nil + } + row, err := c.q.LookupType(context.Background(), oid) + if err != nil { + return TypeInfo{}, fmt.Errorf("lookup type oid %d: %w", oid, err) + } + info := TypeInfo{ + OID: row.Oid, + NamespaceOID: row.NamespaceOid, + Name: row.Name, + Expr: row.Expr, + Category: row.Category.String, + Typtype: row.Typtype, + Preferred: row.Preferred != 0, + FamilyOID: orZero(row.FamilyOid), + ElementOID: orZero(row.ElementOid), + BaseOID: orZero(row.BaseOid), + CanonicalOID: orZero(row.CanonicalOid), + NotNull: row.NotNull != 0, + } + c.types.put(info, nil) + return info, nil +} + +// namespaceName is the name of a namespace row, remembered once read. +func (c *Catalog) namespaceName(oid int64) (string, error) { + if name, ok := c.types.namespace(oid); ok { + return name, nil + } + namespaces, err := c.Namespaces() + if err != nil { + return "", err + } + for _, ns := range namespaces { + c.types.putNamespace(ns.OID, ns.Name) + } + name, _ := c.types.namespace(oid) + return name, nil +} + +// TypeExprOf is the expression a type row stands for, read back from its +// arguments: the family's name for a family, the family applied to its +// arguments for an instance. The result is the caller's to change. +func (c *Catalog) TypeExprOf(oid int64) (*TypeExpr, error) { + if e, ok := c.types.expr(oid); ok { + return e.Clone(), nil + } + info, err := c.LookupType(oid) + if err != nil { + return nil, err + } + expr := &TypeExpr{Name: c.qualifiedName(info)} + if !info.IsFamily() { + rows, err := c.q.TypeArgs(context.Background(), oid) + if err != nil { + return nil, fmt.Errorf("type oid %d: arguments: %w", oid, err) + } + for _, r := range rows { + arg := TypeArg{Label: r.Label} + switch { + case r.ArgTypeOid.Valid: + t, err := c.TypeExprOf(r.ArgTypeOid.Int64) + if err != nil { + return nil, err + } + t.Nullable = r.Nullable != 0 + arg.Type = t + case r.IntValue.Valid: + v := r.IntValue.Int64 + arg.Int = &v + case r.BoolValue.Valid: + v := r.BoolValue.Int64 != 0 + arg.Bool = &v + case r.StringValue.Valid: + v := r.StringValue.String + arg.String = &v + case r.Ident.Valid: + v := r.Ident.String + arg.Ident = &v + } + expr.Args = append(expr.Args, arg) + } + } + c.types.put(info, expr) + return expr.Clone(), nil +} + +// qualifiedName is the name a type row is known by in an expression: its +// name, qualified with its namespace when that is not one of the dialect's +// defaults, as format_type prints a type off the search path. An +// instance's key is built from these, so the array of one schema's mood is +// a row apart from the array of another's. +func (c *Catalog) qualifiedName(info TypeInfo) string { + if ns, err := c.namespaceName(info.NamespaceOID); err == nil && ns != "" && !slices.Contains(c.DefaultNamespaces(), ns) { + return ns + "." + info.Name + } + return info.Name +} + +// ResolveTypeExpr interns the type an expression names and returns its row: +// the family for a bare name, the instance for a family applied to +// arguments, each argument type interned first. Names are canonicalized, so +// integer and int4 intern to one row. A family the dialect did not seed is +// one the schema declared, and is registered as a user type. +func (c *Catalog) ResolveTypeExpr(t *TypeExpr) (int64, error) { + oid, _, err := c.internType(t, func(name string) (int64, error) { + return c.CreateUserType(name, "U") + }, true) + return oid, err +} + +// ResolvePseudoTypeExpr is ResolveTypeExpr for the type a function signature +// names. Signatures reference pseudo-types ("any", "record") and types no +// dialect bothers to list, so an unknown family is registered as an opaque +// type rather than rejected, and gets no operators of its own. +func (c *Catalog) ResolvePseudoTypeExpr(t *TypeExpr) (int64, error) { + oid, _, err := c.internType(t, func(name string) (int64, error) { + return c.CreateTypeSpec(TypeSpec{Name: name, Category: "U", DialectOID: c.dialectOID}) + }, true) + return oid, err +} + +// ResolveTypeName is ResolveTypeExpr for a type spelled as a string. +func (c *Catalog) ResolveTypeName(name string) (int64, error) { + return c.ResolveTypeExpr(ParseTypeExpr(name)) +} + +var errUnknownType = errors.New("unknown type") + +// TypeLookup is what LookupTypeExpr found for an expression. +type TypeLookup struct { + // OID is the instance row when the catalog holds one, otherwise the + // family row. + OID int64 + // FamilyOID is the family, which is OID for a family or an instance the + // catalog does not hold. + FamilyOID int64 + // Expr is the expression canonicalized: the family and every argument + // type spelled as the catalog spells them, whether or not the instance + // is a row. + Expr *TypeExpr +} + +// LookupTypeExpr finds the row an expression names without writing, and +// reports false when the family is not one the catalog holds. +func (c *Catalog) LookupTypeExpr(t *TypeExpr) (TypeLookup, bool) { + refuse := func(string) (int64, error) { return 0, errUnknownType } + oid, canonical, err := c.internType(t, refuse, false) + if errors.Is(err, errUnknownType) && canonical != nil { + // The family is known and the instance is not a row. + familyOID, _, err := c.internType(&TypeExpr{Name: canonical.Name}, refuse, false) + if err != nil { + return TypeLookup{}, false + } + return TypeLookup{OID: familyOID, FamilyOID: familyOID, Expr: canonical}, true + } + if err != nil { + return TypeLookup{}, false + } + info, err := c.LookupType(oid) + if err != nil { + return TypeLookup{}, false + } + familyOID := oid + if !info.IsFamily() { + familyOID = info.FamilyOID + } + return TypeLookup{OID: oid, FamilyOID: familyOID, Expr: canonical}, true +} + +// internType resolves an expression to its row, creating the instance row +// when there is none and write allows it, and calling newFamily for a +// family name the catalog does not hold, which may refuse. Alongside the +// row it returns the expression canonicalized; when the instance is not a +// row and writing is not allowed, the canonical expression still comes +// back with errUnknownType. +func (c *Catalog) internType(t *TypeExpr, newFamily func(name string) (int64, error), write bool) (int64, *TypeExpr, error) { + if t == nil || strings.TrimSpace(t.Name) == "" { + return 0, nil, fmt.Errorf("missing type name") + } + t, err := c.canonicalize(t) + if err != nil { + return 0, nil, err + } + name := strings.ToLower(strings.TrimSpace(t.Name)) + familyOID, err := c.familyOIDByQualifiedName(name) + if err != nil { + if name == ArrayTypeName && write { + // Every dialect has arrays, whether or not its seed lists the + // family; one that does not gets it as an array type rather + // than a user type. + familyOID, err = c.CreateTypeSpec(TypeSpec{Name: name, Category: "A", DialectOID: c.dialectOID}) + } else { + familyOID, err = newFamily(name) + } + if err != nil { + return 0, nil, fmt.Errorf("type %q: %w", name, err) + } + } + if familyOID, err = c.canonicalOID(familyOID); err != nil { + return 0, nil, err + } + family, err := c.LookupType(familyOID) + if err != nil { + return 0, nil, err + } + if len(t.Args) == 0 { + return familyOID, &TypeExpr{Name: c.qualifiedName(family)}, nil + } + + // The instance's canonical spelling is the family applied to its + // arguments as the catalog spells them, so each argument type is + // resolved first and read back. An argument whose own instance is not + // a row, in a lookup that may not write, still has a canonical + // spelling, which the whole expression's is built from. + canonical := &TypeExpr{Name: c.qualifiedName(family), Args: make([]TypeArg, len(t.Args))} + argOIDs := make([]int64, len(t.Args)) + unknown := false + for i, a := range t.Args { + canonical.Args[i] = a + if a.Type == nil { + continue + } + oid, argExpr, err := c.internType(a.Type, newFamily, write) + if err != nil { + if !errors.Is(err, errUnknownType) || argExpr == nil { + return 0, nil, err + } + unknown = true + } + argOIDs[i] = oid + argExpr.Nullable = a.Type.Nullable + canonical.Args[i].Type = argExpr + } + if unknown { + return 0, canonical, errUnknownType + } + key := canonical.Key() + ctx := context.Background() + if oid, err := c.q.TypeOIDByExprInNamespace(ctx, catalogdb.TypeOIDByExprInNamespaceParams{ + NamespaceOid: family.NamespaceOID, + Expr: key, + }); err == nil { + return oid, canonical, nil + } else if !errors.Is(err, sql.ErrNoRows) { + return 0, nil, fmt.Errorf("type %q: %w", key, err) + } + // A lookup that may not write stops here, canonical expression in hand. + if !write { + return 0, canonical, errUnknownType + } + + spec := TypeSpec{ + Name: family.Name, + Expr: key, + Typtype: family.Typtype, + Category: family.Category, + NamespaceOID: family.NamespaceOID, + DialectOID: c.dialectOID, + FamilyOID: familyOID, + } + if family.Name == ArrayTypeName && argOIDs[0] != 0 { + spec.ElementOID = argOIDs[0] + } + oid, err := c.CreateTypeSpec(spec) + if err != nil { + return 0, nil, err + } + if err := c.insertTypeArgs(oid, key, canonical.Args, argOIDs); err != nil { + return 0, nil, err + } + return oid, canonical, nil +} + +func nullableOID(oid int64) any { + if oid == 0 { + return nil + } + return oid +} + +func nullableString(s string) any { + if s == "" { + return nil + } + return s +} + +func boolToInt(b bool) int { + if b { + return 1 + } + return 0 +} + +func nullInt64(oid int64) sql.NullInt64 { + return sql.NullInt64{Int64: oid, Valid: oid != 0} +} + +func nullString(s string) sql.NullString { + return sql.NullString{String: s, Valid: s != ""} +} + +func boolToInt64(b bool) int64 { + if b { + return 1 + } + return 0 +} + +func orZero(n sql.NullInt64) int64 { + if n.Valid { + return n.Int64 + } + return 0 +} diff --git a/internal/core/types.md b/internal/core/types.md new file mode 100644 index 0000000000..771b09c9d5 --- /dev/null +++ b/internal/core/types.md @@ -0,0 +1,769 @@ +# Types in the analysis core + +How the core catalog, the analyzer and `sqlc analyze` represent a type today, +where that falls short of each engine's type system, how each engine's own +catalog represents one, and the design that closes the gap: every type the +schema or the dialect declares is a row holding its full expression, +canonicalized the way the engine would and denormalized so that a bare name +like `integer` and a structured expression like `numeric(10, 2)` both +resolve to one. + +## What a type is today + +The catalog (`catalogdef/schema.sql`) has one row per *name* in `sql_type`: +a lowercased string, a category letter, a `typtype` that is only ever `b` or +`e`, and an `element_oid` that is written for arrays but never read. A +dialect's `types.jsonl` seeds one row per type and one more per alias, then +joins every spelling of a type to every other with implicit casts. Arrays are +rows named after their element with `[]` appended, created on first use. +Anything else — a type argument, a struct field, an enum label, a domain's +base, a range's subtype — has nowhere to go: `sql_attribute` keeps the +column's verbatim spelling in `decl_type` (only SQLite and ClickHouse set it) +and has `type_length` and `type_scale` columns that no DDL path fills. + +The analyzer (`analyzer/expr.go`) types an expression as `exprType`: a type +OID, or a bare name when the catalog has no row, plus nullability. A type is +therefore a row, and a type that is not a row degrades to whatever row its +spelling's first word finds. + +The output (`TypeExpr` in `typeexpr.go`, printed by `sqlc analyze`) already +has the right shape: a name applied to labelled arguments that are types, +integers, booleans or strings, with `nullable` at any depth. It is complete +only where a source column's `decl_type` spelling exists to be parsed; every +other column and every parameter is rebuilt from the flat row name. + +## What each engine loses + +The table is what `sqlc analyze` reports today for a schema exercising each +engine's type system, against what the engine itself says the type is. + +| Engine | Declared | Reported | The engine says | +|---|---|---|---| +| PostgreSQL | `numeric(10,2)`, `varchar(255)`, `timestamp(3)`, `bit(8)` | `numeric`, `varchar`, `timestamp`, `bit` | typmods are part of the type | +| PostgreSQL | `int[][]` | `array(int4)` | two dimensions | +| PostgreSQL | `CREATE DOMAIN posint AS integer` | `posint`, category U | an integer with a constraint | +| PostgreSQL | `CREATE TYPE point2 AS (x float8, y float8)` | `point2`, category U | two named fields | +| PostgreSQL | `CREATE TYPE mood AS ENUM (...)` | `mood` | the labels | +| PostgreSQL | `CREATE TYPE floatrange AS RANGE (subtype = float8)` | `floatrange`, category U | a range over float8 | +| PostgreSQL | `myschema.mood` | `mood` for a column, `myschema.mood` for a cast: two rows, both in `public` | one type in a namespace | +| PostgreSQL | `interval day to second` | `interval` | fields are a typmod | +| MySQL | `BIGINT UNSIGNED`, `INT UNSIGNED` | `bigint`, `int` | a different value range; codegen picks `int64` over `uint64` | +| MySQL | `TINYINT(1)` | `tinyint` | the display width is how drivers and codegen spot a boolean | +| MySQL | `DECIMAL(10,2) UNSIGNED`, `DATETIME(6)`, `VARCHAR(255)` | `decimal`, `datetime`, `varchar` | precision, fractional seconds, length | +| MySQL | `ENUM('a','b')`, `SET('x','y')` | `enum`, `set` | the members | +| MySQL | `CAST(? AS CHAR(10))` | `var_string` | `char`; the parser's internal name leaks | +| SQLite | `FOO BAR(3)`, `VARCHAR(255)` | `foo bar(3)`, `varchar(255)` | correct spelling, but each is a row of category U that compares with nothing, and the affinity SQLite gives it (NUMERIC, TEXT) is not modelled | +| ClickHouse | every column type | complete | complete, from the spelling | +| ClickHouse | `CAST(x AS Nullable(String))` | `nullable` | `Nullable(String)` | +| ClickHouse | `CAST(x AS Array(UInt8))` | `array` | `Array(UInt8)` | +| ClickHouse | `toDecimal64(x, 4)`, `toDateTime64(x, 3)` | `decimal64`, `datetime64` | `Decimal(18, 4)`, `DateTime64(3)`: the result depends on an argument's value | +| ClickHouse | `SimpleAggregateFunction(sum, UInt64)` | `simpleaggregatefunction(sum, uint64)` | `sum` is a function name, which the expression reads as a type | +| ClickHouse | `n Nested(a UInt8, b String)` | one column `n` | two columns `n.a Array(UInt8)`, `n.b Array(String)` | +| DuckDB | `STRUCT(a INTEGER, b VARCHAR)`, `MAP(VARCHAR, INTEGER)`, `UNION(num INTEGER, str VARCHAR)` | `struct`, `map`, `union` | the fields | +| DuckDB | `INTEGER[]`, `INTEGER[3]`, `INTEGER[][]` | `array(integer)` for all three | LIST, fixed-size ARRAY, nested LIST | +| DuckDB | `DECIMAL(18,3)`, `VARCHAR(10)`, `ENUM('a','b')` | `decimal`, `varchar`, `enum` | arguments and members | +| GoogleSQL | `ARRAY` | a row *named* `array` | an array of int64 | +| GoogleSQL | `STRUCT`, `ARRAY>` | `struct`, `array` | the fields | +| GoogleSQL | `STRING(10)`, `NUMERIC(10,2)`, `[1, 2]`, `STRUCT(1 AS x)` | `string`, `numeric`, untyped, untyped | parameters; a constructed array and struct | +| SQL Server | `NVARCHAR(MAX)`, `VARBINARY(MAX)` | `nvarchar`, `varbinary` | MAX decides the Go type | +| SQL Server | `DECIMAL(10,2)`, `DATETIME2(3)`, `FLOAT(24)`, `VECTOR(3)` | `decimal`, `datetime2`, `float`, `vector` | arguments; `FLOAT(24)` is `real` | +| SQL Server | `CREATE TYPE dbo.PhoneNumber FROM varchar(20) NOT NULL` | `phonenumber`, category U | a `varchar(20)` that is never null, in schema `dbo` | + +Three of these are regressions against the legacy compiler rather than gaps +shared with it: the plugin protocol's `Column` carries `unsigned`, `length` +and `array_dims`, codegen reads all three (`golang/mysql_type.go` turns +`tinyint` with length 1 into `bool` and `unsigned` into `uint64`; +`golang/go_type.go` nests one slice per dimension), and the core bridge in +`compiler/parse_core.go` sets none of them from what the core reports. + +Two are broken outside column declarations only: ClickHouse's columns are +whole because the engine hands the core a spelling and the core keeps it on +the attribute. The same spelling in a cast, a function result or a typed +placeholder has no attribute to live on, so it degrades to its first word. +That is the tell: the expression belongs to the type, not to the column. + +## What each engine's own catalog says + +Each engine was asked, on a live system where one could be had, what it +records about a type, how it spells a column's type back, what it says a +query result's type is, and how it describes a function. PostgreSQL 16, +MySQL 8, SQLite 3.53, ClickHouse 25.8 and DuckDB 1.5 answered directly; SQL +Server and GoogleSQL are from their documented catalogs and the parsers +sqlc uses for them. + +**PostgreSQL** has one `pg_type` row per family, and a second row per array +type (`_int4`, with `typelem` pointing at the element). Arguments are not +part of the type: they are an opaque `int32` typmod on the use site — +`pg_attribute.atttypmod`, a domain's `typtypmod`, a function argument's +type has none — whose encoding is the type's own business and which +`format_type(oid, typmod)` decodes back into a spelling. Dimensions are +likewise on the attribute (`attndims`) and informational: `int[3]` and +`int[][]` are both the type `integer[]`. Declared types are rows with a +`typtype`: `e` with labels and their order in `pg_enum`, `c` with fields as +the attributes of a hidden relation (`typrelid`), `d` with `typbasetype`, +`typtypmod` and `typnotnull`, `r` and `m` with the subtype in `pg_range`; +pseudo-types (`anyarray`, `record`) are rows of `typtype` `p` and category +`P`. What it reports is canonical and not what was written: `int` comes back +as `integer`, `varchar(255)` as `character varying(255)`, `timestamp(3)` as +`timestamp(3) without time zone`, `int[3]` as `integer[]`, and a domain +column as the domain's name. A view keeps its columns' typmods; a prepared +statement's result types (`pg_prepared_statements.result_types`, the +protocol's RowDescription) carry the typmod only for a column read straight +from a table and `-1` for an expression, so `numeric(10,2) + 1` is +`numeric`. `pg_proc` has full signatures over families and pseudo-types, +`pg_operator` likewise, and `pg_cast` the contexts. + +**MySQL** has no catalog of types, functions or operators. What it has is +`information_schema.COLUMNS`, which describes a column twice: `DATA_TYPE` is +the family (`bigint`, `decimal`, `enum`) and `COLUMN_TYPE` is the whole +canonical spelling — `bigint unsigned`, `tinyint(1)`, `decimal(10,2) +unsigned`, `enum('a','b')`, `bigint(20) unsigned zerofill` — beside the +arguments decoded into `NUMERIC_PRECISION`, `NUMERIC_SCALE`, +`CHARACTER_MAXIMUM_LENGTH`, `DATETIME_PRECISION`, `CHARACTER_SET_NAME` and +`COLLATION_NAME`. The spelling is canonical: `BOOLEAN` becomes `tinyint(1)`, +`INTEGER` becomes `int`, `VARCHAR(10) CHARACTER SET binary` becomes +`varbinary(10)`. A view's columns show that the binder computes a full type +for every expression: `decimal(10,2) + 1` is `decimal(11,2)`, `decimal(10,2) +* decimal(10,2)` is `decimal(20,4)`, `int unsigned + 1` is `bigint +unsigned`, `CONCAT(varchar(255), 'x')` is `varchar(256)`, `SUM(int unsigned)` +is `decimal(32,0)`, `AVG(int)` is `decimal(14,4)`, `->>` is `longtext`. User +routines are described the same way in `ROUTINES` and `PARAMETERS` +(`DTD_IDENTIFIER` is `decimal(5,2)`, `bigint unsigned`); built-in functions +are not described at all. A result set on the wire is coarser than the +catalog: a storage type code (`TINY`, `LONG`, `NEWDECIMAL`, `VAR_STRING`), +a length in bytes, a decimals count and flags (`UNSIGNED`, `NOT_NULL`, +`ENUM`, `SET`, `BINARY`), so a `varchar(255)` column and `CAST(x AS +CHAR(10))` are both `VAR_STRING`, an enum is `STRING` with the `ENUM` flag, +and a `tinyint(1)` is `TINY` with length 1. That code is where the parser's +`var_string` comes from. + +**SQLite** has no catalog of types either. `pragma_table_xinfo` returns a +column's declared type verbatim — `VARCHAR(255)`, `FOO BAR(3)`, `my type`, +or nothing — and the type system is affinity: a rule over the spelling's +substrings (INT anywhere is INTEGER; CHAR, CLOB or TEXT is TEXT; BLOB or no +type is BLOB; REAL, FLOA or DOUB is REAL; anything else is NUMERIC) that +decides how a stored value is coerced, so `FOO BAR(3)` holding `'12'` +stores the integer 12. Arguments are decoration: `CAST(x AS DECIMAL(5,2))` +applies NUMERIC affinity and nothing else. A `STRICT` table admits only +`INT`, `INTEGER`, `REAL`, `TEXT`, `BLOB` and `ANY`, and rejects +`VARCHAR(10)`. An expression has no type; a value has a storage class +(`typeof()` is `integer`, `real`, `text`, `blob` or `null`), and a result +column's `sqlite3_column_decltype` is the declared spelling for a column +read from a table and nothing for anything else. `pragma_function_list` +names functions and their arity and nothing more. + +**ClickHouse** models a type as a call expression, which is why the output +shape was chosen. `system.data_type_families` lists 66 families and 73 +aliases (`INT` is an alias of `Int32`); a column's type in `system.columns` +is the whole expression, canonicalized: `Decimal32(4)` is stored as +`Decimal(9, 4)`, `Enum('a', 'b')` as `Enum8('a' = 1, 'b' = 2)`, +`Variant(String, Int64)` with its members sorted, and `Nested(a UInt8, b +String)` as two columns `n.a Array(UInt8)` and `n.b Array(String)`. +`Nullable` and `LowCardinality` are spelled as wrappers and reported as part +of the type, at any depth. Every expression has a full type computed by the +binder, from argument types with promotion — `Int8 + UInt8` is `Int16`, +`Int32 + UInt64` is `Int64`, `Int32 / Int32` is `Float64`, `Decimal(9, 4) * +Decimal(38, 10)` is `Decimal(38, 14)` — from argument values — +`toDecimal64(x, 4)` is `Decimal(18, 4)`, `toDateTime64(x, 3)` is +`DateTime64(3)` — and from literals by value: `1` is `UInt8`, `-1` is +`Int8`, `[1, NULL]` is `Array(Nullable(UInt8))`. Wrappers propagate: +`concat(lc, 'x')` is `LowCardinality(String)`, `ns = 'x'` is +`Nullable(UInt8)`, `NULL` is `Nullable(Nothing)`. A typed placeholder +`{p:Decimal(10, 2)}` is exactly its declared type. `system.functions` has a +name, an aggregate flag, an alias and a description, and no signature. + +**DuckDB** has `duckdb_types()`, one row per spelling with a `logical_type` +naming the family (`int`, `int4` and `integer` are three rows over +`INTEGER`), a category (`NUMERIC`, `STRING`, `DATETIME`, `BOOLEAN`, +`COMPOSITE`, or none for `bit` and `enum`), and `labels` for an enum, which +a `CREATE TYPE ... AS ENUM` adds to as a non-internal row in the user's +schema. `duckdb_columns().data_type` is the whole canonical expression: +`INTEGER[]`, `INTEGER[3]`, `STRUCT(a INTEGER, b VARCHAR)`, `MAP(VARCHAR, +INTEGER)`, `UNION(num INTEGER, str VARCHAR)`, `DECIMAL(18,3)`, with the +precision and scale also decoded into their own columns. Canonicalization +goes further than anywhere else: `TEXT` is `VARCHAR`, `VARCHAR(10)` is +`VARCHAR` (the length is dropped), `NUMERIC` is `DECIMAL(18,3)`, `VARINT` is +`BIGNUM`, `FLOAT4` is `FLOAT`, `JSON` keeps its name over `VARCHAR`'s id, +and a column of the named enum `mood` is reported as `ENUM('sad', 'ok')` +with the name gone. Expressions have full binder-computed types: +`DECIMAL(18,3) * DECIMAL(18,3)` is `DECIMAL(18,6)`, `1.5` is +`DECIMAL(2,1)`, `SUM(INTEGER)` is `HUGEINT`, `SUM(DECIMAL(18,3))` is +`DECIMAL(38,3)`, `INTEGER / 2` is `DOUBLE`, `[1, NULL]` is `INTEGER[]` with +no inner nullability, and `NULL` is a type of its own. `duckdb_functions()` +has signatures over families and generics — `parameter_types` are +`DECIMAL`, `INTEGER[]`, `ANY`, `T`, `K`, `V` and `return_type` a family — +so the arguments of a result are the binder's, not the catalog's. A +prepared statement's parameter types are `UNKNOWN` until bound. + +**SQL Server** describes a column in `sys.columns` as a family plus decoded +arguments: `system_type_id` and `user_type_id`, `max_length` in bytes with +`-1` for `MAX`, `precision`, `scale`, `collation_name`, `is_nullable`, +`is_identity`. `sys.types` has one row per system type — `decimal` and +`numeric` are two — and one per alias type from `CREATE TYPE ... FROM`, with +`is_user_defined`, its own `max_length`, `precision`, `scale` and +`is_nullable`, and its base's `system_type_id`; `sysname` is such a row over +`nvarchar(128)`, and CLR types like `geography` and `hierarchyid` are +assembly types sharing one `system_type_id`. Canonicalization fills in what +was left out and folds one family into another: `varchar` alone is +`varchar(1)` in a declaration and `varchar(30)` in a `CAST`, `decimal` is +`decimal(18,0)`, `datetime2` is `datetime2(7)`, `FLOAT(24)` is stored as +`real` and `FLOAT(25)` and up as `float`. `sys.all_parameters` describes a +function's parameters the same way as a column. The T-SQL parser sqlc uses +(`teesql`) reports a type as a name with a parameter list in which `MAX` is +a literal node of its own. + +**GoogleSQL** has no catalog sqlc can read offline; its two hosts describe a +column as a whole string. BigQuery's `INFORMATION_SCHEMA.COLUMNS.DATA_TYPE` +is `ARRAY>`, `NUMERIC(10, 2)` or `STRING(10)`, +and `COLUMN_FIELD_PATHS` lists every nested struct field with a path and a +`DATA_TYPE` of its own. Spanner's `SPANNER_TYPE` is `STRING(MAX)`, +`ARRAY`, `PROTO` or `ENUM`, and a column +cannot be a struct. The parser sqlc uses (`zetajones`) has a node per type +form — `SimpleType` with a `TypeParameterList`, `ArrayType`, `StructType` +with named fields, `RangeType`, `MapType`, `FunctionType` — and, as in T-SQL, +`MAX` is a literal node in the parameter list. Arrays do not nest. + +What the review settles: + +| | Unit of identity | Where arguments live | Column spelling reported | Result types | Function signatures | +|---|---|---|---|---|---| +| PostgreSQL | family row, plus one row per array type | opaque typmod and dims on the use site | canonical, decoded by `format_type` | family, typmod only for a table column | full, over families and pseudo-types | +| MySQL | none: a spelling | decoded columns beside the spelling | canonical spelling | full, computed by the binder | none for built-ins | +| SQLite | none: the declared text | none: decoration | verbatim | storage class of the value | arity only | +| ClickHouse | family, with aliases | in the spelling | canonical expression | full, computed by the binder | none | +| DuckDB | family, with aliases | in the spelling, plus decoded columns | canonical expression, some arguments dropped | full, computed by the binder | families and generics | +| SQL Server | family row and alias-type row | decoded columns on the use site | canonical, defaults filled in | family and decoded arguments | families and decoded arguments | +| GoogleSQL | none offline: a spelling | in the spelling | canonical spelling | full | none offline | + +Two conclusions follow. First, no engine keeps arguments inside its type +table: PostgreSQL and SQL Server put them on the use site and everything +else puts them in the spelling. A row per expression is nonetheless the +right shape for sqlc, because sqlc's job is to *report* the expression, and +every engine that decodes its use-site arguments decodes them into exactly +the call expression `TypeExpr` already is; PostgreSQL's typmod is a +per-type encoding that only PostgreSQL can read, so sqlc would store the +decoded form either way. Second, every engine with a catalog canonicalizes +on the way in and reports the canonical form, never the declared spelling, +and the same is true of what `goldeneye` checks the analyze cases against. +The design below changes on that point. + +## The design + +### One row per type expression + +`sql_type` keeps one row per distinct type expression. A row is either a +**family** — a name the dialect or the schema declares, such as `numeric`, +`array`, `struct`, `mood` — or an **instance**, a family applied to +arguments, such as `numeric(10, 2)`, `array(int4)` or +`struct(a: int4, b: text)`. The row's `expr` is the expression's canonical +string, which is its interning key; the row's `name` is the family's name, +so the index that turns `integer` into a row keeps working for instances, +and an instance points at its family. + +```sql +CREATE TABLE sql_type ( + oid INTEGER PRIMARY KEY AUTOINCREMENT, + namespace_oid INTEGER NOT NULL REFERENCES sql_namespace(oid), + dialect_oid INTEGER REFERENCES sql_dialect(oid), + name TEXT NOT NULL, -- the family name: 'numeric', 'array', 'mood' + expr TEXT NOT NULL, -- the whole expression, canonical: 'numeric(10, 2)'; equals name for a family + typtype TEXT NOT NULL DEFAULT 'b', -- b base, c composite, d domain, e enum, r range, p pseudo + category TEXT, + preferred INTEGER NOT NULL DEFAULT 0, + family_oid INTEGER REFERENCES sql_type(oid), -- NULL on a family; the family on an instance + element_oid INTEGER REFERENCES sql_type(oid), -- what the type holds: an array's element, a map's value, a range's subtype + base_oid INTEGER REFERENCES sql_type(oid), -- what the type stands on: a domain's or alias type's base, a wrapper's inner type, a SQLite spelling's affinity + canonical_oid INTEGER REFERENCES sql_type(oid), -- the row the engine reports this one as: integer -> int4, float(24) -> real, mood -> enum('sad', 'ok') in DuckDB + not_null INTEGER NOT NULL DEFAULT 0, -- a domain or alias type declared NOT NULL + UNIQUE (namespace_oid, expr) +); +CREATE INDEX idx_sql_type_name ON sql_type(name); + +-- sql_type_arg: the arguments of an instance, or the fields, labels or +-- members of a declared composite, enum or set, in order. Exactly one of +-- arg_type_oid, int_value, bool_value, string_value and ident is set. +CREATE TABLE sql_type_arg ( + type_oid INTEGER NOT NULL REFERENCES sql_type(oid), + ord INTEGER NOT NULL, + label TEXT NOT NULL DEFAULT '', -- a struct field, tuple element or enum label + arg_type_oid INTEGER REFERENCES sql_type(oid), + nullable INTEGER NOT NULL DEFAULT 0, -- the argument type is nullable here: Array(Nullable(String)) + int_value INTEGER, + bool_value INTEGER, + string_value TEXT, + ident TEXT, -- a bare word that is not a type: max, sum, day to second + PRIMARY KEY (type_oid, ord) +); +``` + +`size` goes: nothing reads it. `type_length` and `type_scale` leave +`sql_attribute`: they were one engine's two arguments, and now every +engine's arguments are rows. `decl_type` stays, since the verbatim spelling +is what the formatter prints back and what SQLite reports. + +The four pointer columns are the denormalization. Each is derivable by +walking `sql_type_arg`, and each is what resolution asks for in one +statement: + +- `family_oid` is what operator and function lookup fall back to when there + is no overload on the instance: `numeric(10, 2) + numeric(5, 1)` finds no + operator on either instance and resolves on `numeric`, which is exactly + what `pg_operator` and `duckdb_functions()` hold. +- `element_oid` is what a subscript, `ANY($1)`, `unnest` and a star over a + map yield, and what `IsArray` was; it is PostgreSQL's `typelem` and + `pg_range.rngsubtype`. +- `base_oid` is what a domain, an alias type, `LowCardinality(T)` or a + SQLite spelling resolves through: `posint = 1` finds no operator on + `posint` and resolves on `int4`; `FOO BAR(3) = 1` resolves on `numeric`. + It is `typbasetype`, SQL Server's `system_type_id` behind a + `user_type_id`, and SQLite's affinity rule. +- `canonical_oid` is the row the engine would report this one as. An alias + spelling points at its family (`integer` at `int4`); a declared type + points at what the engine reports instead of its name when it does so + (DuckDB's `mood` at `enum('sad', 'ok')`); an instance points at the + instance canonicalization rewrote it to when the rewrite changes the + family (SQL Server's `float(24)` at `real`). It replaces the n² implicit + casts between spellings of one type. + +A declared type is a family row with arguments of its own. `CREATE TYPE +point2 AS (x float8, y float8)` is a row named `point2`, `typtype` `c`, with +two labelled type arguments, the way PostgreSQL keeps them as the attributes +of `typrelid`; `CREATE TYPE mood AS ENUM ('sad', 'ok')` is a row with +`typtype` `e` and two string arguments in order, which is `pg_enum` and +DuckDB's `labels`; ClickHouse's `Enum8('active' = 1, 'deleted' = 2)` is an +instance of `enum8` with two labelled integer arguments and `base_oid` at +`int8`; `CREATE DOMAIN posint AS integer` and SQL Server's `CREATE TYPE +PhoneNumber FROM varchar(20) NOT NULL` are rows with `typtype` `d`, +`base_oid` at the base instance and `not_null` set. The same table holds +what the schema names and what it constructs anonymously. + +### Canonicalize on the way in; report the canonical form + +Every engine with a catalog rewrites a declared type before storing it and +reports the rewritten form, and `goldeneye` checks the analyze cases against +what the engine reports. So interning canonicalizes, in three steps that +are dialect data or dialect code: + +1. **Aliases**, which `types.jsonl` already lists: `int` and `integer` + resolve to the canonical family. This also settles what the canonical + *name* is: the one the engine reports, which for PostgreSQL is + `format_type`'s (`integer`, `bigint`, `character varying`) rather than + `pg_type`'s (`int4`, `int8`, `varchar`), so PostgreSQL's `types.jsonl` + flips which spelling is the name and which the alias. Codegen accepts + both spellings already. + + `format_type` is a string and the output is an expression, so the + spelling is read into one, and its grammar is slightly wider than + `name(args)`: the typmod may sit inside a multi-word name + (`timestamp(3) without time zone`, `time(4) with time zone`), after + trailing words (`interval day to second(3)`), or before an array suffix + (`numeric(10,2)[]`, `character varying(255)[]`), and one name is quoted + (`"char"`). The family is the words with the parenthesis lifted out, so + `timestamp(3) without time zone` is `{name: "timestamp without time + zone", args: [3]}`, `interval day to second(3)` is `interval` with an + identifier argument and an integer one, and `numeric(10,2)[]` is + `array(numeric(10, 2))`. Two spellings are the same family under + different typmods, `bpchar` and `character(5)`, and canonicalize to + `character`. The PostgreSQL goldens change with this: `bigserial` + becomes `bigint` (a serial is a default, not a type PostgreSQL reports), + `int4` becomes `integer`, `varchar` becomes `character varying`. +2. **Argument defaults and drops**, which are data: SQL Server's `varchar` + is `varchar(1)` and `decimal` is `decimal(18, 0)`; DuckDB's `numeric` is + `decimal(18, 3)` and `varchar(10)` is `varchar`; PostgreSQL's `int[3]` is + `array(int4)`. A family in `types.jsonl` may say `"defaults": [18, 0]` + or `"args": 0`. +3. **Rewrites that change the family by argument**, which are data too: an + ordered list of pattern, template and bound in `dialect.json` — + `Decimal32($1)` to `Decimal(9, $1)`, `float($1)` to `real` where `$1 <= + 24`, `boolean` to `tinyint(1)`, `sysname` to `nvarchar(128)` — that the + seed loads into a table and the catalog applies before interning. What + only a parser can do stays in the engine's converter, which every engine + has anyway: ClickHouse numbers an Enum's members and sorts a Variant's + when it spells the type, and MySQL's parser folds `varchar(n) character + set binary` into `varbinary(n)`. + +The reported type is the canonical row's expression. The declared spelling +is kept on the attribute in `decl_type`, for the formatter and for SQLite, +whose canonical form is the spelling itself. This reverses the earlier +choice of reporting a column as it was declared: the engines do not, and +the check that keeps the analyzer honest compares against the engines. + +### Nullability is not a type + +A row is never nullable. Outer nullability stays where it is: on the +attribute, on the analyzer's `exprType`, on the reported column. Inner +nullability is a flag on the argument position, so `Array(Nullable(String))` +is an instance of `array` whose one argument is `string` with `nullable` +set, and `Nullable(String)` in a cast is `string` with the expression's own +nullability set. This is what `TypeExpr` already says — `nullable` at +whatever depth it applies, never a wrapper — and it keeps `string` and +`string nullable` from being two types that need their own operators. The +review confirms only ClickHouse spells inner nullability at all: DuckDB's +`[1, NULL]` is `INTEGER[]` and PostgreSQL has no such thing. + +### Array dimensions + +PostgreSQL's type for `int[][]` is `integer[]`, with the dimensions on the +attribute and unenforced; DuckDB and ClickHouse nest, `INTEGER[][]` and +`Array(Array(UInt8))`, and DuckDB distinguishes the fixed-size +`INTEGER[3]`. The expression nests one `array` per declared dimension in +every dialect, with a fixed size as a second argument (`array(integer, 3)`), +because codegen renders one slice per dimension and a two-dimensional +PostgreSQL column has to come out `[][]int32` as it does on the legacy path. +PostgreSQL's canonicalization therefore keeps the dimensions its own +catalog drops, and a future PostgreSQL check in `goldeneye` reads `attndims` +to reproduce them. Subscripting follows the dialect: PostgreSQL yields the +innermost element however many subscripts are applied. + +### The catalog interns at schema time; the analyzer looks up at query time + +The cached catalog is opened read-only (`catalog.go` opens it with +`mode=ro&immutable=1`), and `exprType` carries a bare name precisely so that +analysis never has to write. That constraint stands, and it decides which +expressions become rows: + +- **Interned**: what the dialect seeds and what the schema declares. Every + column type, every declared type's fields and base, every function + signature's argument and return type becomes a row on load, through one + entry point, `ResolveTypeExpr(*TypeExpr) (oid, error)`, which + canonicalizes, then walks the expression bottom-up, interning each + argument type first. `ResolveType` and `ResolveTypeName` become callers + of it. +- **Looked up**: what a query writes. A cast, a constructed array or struct, + a typed placeholder and a function result are resolved by + `LookupTypeExpr(*TypeExpr) (oid, familyOID, bool)`, which canonicalizes, + finds the instance row when the schema happened to declare the same + expression and otherwise the family row, and never writes. + +`exprType` becomes the pair: + +```go +type exprType struct { + typeOID int64 // the instance row when the catalog has one, else the family row, else 0 + expr *core.TypeExpr // the whole expression, whenever anything is known about it + nullable bool + ... +} +``` + +Resolution uses `typeOID` and its `family_oid`, `base_oid` and +`canonical_oid` chain; reporting uses `expr`. The `typeName` fallback and +the `[]` suffix convention go away: an array is `array` applied to its +element, in the catalog as in the output, and `TypeNameString` is replaced +by a function that reads an `ast.TypeName` into a `TypeExpr`, folding +`Typmods` into integer arguments, `ArrayBounds` into one `array` per +dimension, `Names` into a namespace and a name, and `Spelling` through +`ParseTypeExpr`. + +### Result types: the family from the catalog, the arguments from the dialect + +MySQL, ClickHouse and DuckDB compute a full type for every expression in the +binder — `decimal(10,2) + 1` is `decimal(11,2)`, `Int8 + UInt8` is `Int16`, +`SUM(INTEGER)` is `HUGEINT` — and none of them keeps those rules in a +catalog; PostgreSQL's catalog says `numeric + numeric` is `numeric` and its +results drop the typmod. The catalog can only ever answer at the family +level, and that is the baseline every dialect gets: an operator or function +result is the family the overload names, with the arguments of an `$n` +result carried over from the argument it stands for. A result that depends +on an argument's value is a template in the seed — `"returns": "Decimal(18, +$2)"` for `toDecimal64(x, s)` — that the analyzer fills in from the call's +literals. ClickHouse needs it, since its check compares whole expressions; +MySQL's check reads the wire type, which is the family with its flags, so +the baseline passes it. Arithmetic promotion — `Int8 + UInt8` is `Int16` — +is not expressed yet. + +### What each engine hands the core + +The contract with an engine is that its `ast.TypeName` reads into a +`TypeExpr` that says everything the engine's own catalog would. Where an +engine already folds its type into a spelling, `ParseTypeExpr` reads it; +where it does not, the converter has a small change to make. + +| Engine | Form | Expression | +|---|---|---| +| PostgreSQL | `numeric(10,2)`, `varchar(255)`, `timestamp(3) with time zone` | `numeric(10, 2)`, `character varying(255)`, `timestamp with time zone(3)`: typmods become integer arguments on the canonical family, named as `format_type` names it | +| PostgreSQL | `int[]`, `int[][]`, `int[3]` | `array(integer)`, `array(array(integer))`, `array(integer)`: one per array bound, the bound itself dropped as PostgreSQL drops it | +| PostgreSQL | `interval day to second` | `interval('day to second')`: the fields are one identifier argument, as `format_type` prints them | +| PostgreSQL | domain, composite, enum, range | declared rows, as above; `CreateDomainStmt`, `CompositeTypeStmt` and `CreateRangeStmt` gain `schema.Apply` cases | +| PostgreSQL | `myschema.mood` | a row in namespace `myschema`; `Names` resolves to a namespace rather than a dotted name | +| MySQL | `BIGINT UNSIGNED`, `DECIMAL(10,2) UNSIGNED` | `bigint unsigned`, `decimal unsigned(10, 2)`: unsigned is a family of its own, as `COLUMN_TYPE` and the wire flag report it, rather than the alias of the signed type `types.jsonl` lists today; the converter puts it in the name instead of on `ColumnDef.IsUnsigned`, which the core ignores | +| MySQL | `TINYINT(1)`, `DATETIME(6)`, `VARCHAR(255)`, `BOOLEAN` | `tinyint(1)`, `datetime(6)`, `varchar(255)`, `tinyint(1)`: the converter's `Typmods` are read, and `boolean` canonicalizes as MySQL does | +| MySQL | `ENUM('a','b')`, `SET('x','y')` | `enum('a', 'b')`, `set('x', 'y')`: the converter renders `Vals` into the spelling | +| MySQL | `CAST(x AS CHAR(10))` | `char(10)`: the cast converter names the SQL type, not the wire code `var_string` | +| MySQL | `VARCHAR(10) CHARACTER SET binary` | `varbinary(10)`, as the parser folds it; collation is not part of the type | +| SQLite | any spelling | the spelling as an instance, `varchar(255)`, `foo bar(3)`, verbatim as `pragma_table_xinfo` reports it, with `base_oid` set by the affinity rule applied when the dialect resolves an unknown name; `types.jsonl`'s alias lists become the rule | +| SQLite | `STRICT` tables, `ANY` | the family rows; a strict table's column names one of them or fails, as SQLite does | +| SQLite | an expression | its storage class, `integer`, `real`, `text` or `blob`, which is what `typeof()` and the check report | +| ClickHouse | every parametric type | the spelling, read as today, now also for casts, `{p:T}` placeholders and results | +| ClickHouse | `Nullable(T)`, `LowCardinality(T)` | `T` with `nullable`; `lowcardinality(T)` with `base_oid` at `T` | +| ClickHouse | `Decimal32(4)`, `Enum('a', 'b')`, `Variant(String, Int64)`, `INT` | `decimal(9, 4)` by a rewrite, `enum8(a: 1, b: 2)` and `variant(int64, string)` by the converter, `int32` by an alias | +| ClickHouse | `SimpleAggregateFunction(sum, UInt64)` | `simpleaggregatefunction(sum, uint64)` with `sum` an identifier argument | +| ClickHouse | `toDecimal64(x, s)` | `decimal(18, s)`, by the seed's return template | +| ClickHouse | `Nested(a UInt8, b String)` | a relation-shape rule, not a type: the column becomes `n.a array(uint8)` and `n.b array(string)` on load, as `system.columns` has them | +| DuckDB | `STRUCT(a INTEGER, b VARCHAR)`, `MAP(K, V)`, `UNION(...)` | `struct(a: integer, b: varchar)`, `map(varchar, integer)`, `union(num: integer, str: varchar)`: the converter renders the darkwing type expression it already has instead of keeping its name | +| DuckDB | `INTEGER[]`, `INTEGER[3]` | `array(integer)` and `array(integer, 3)`: a list is the cross-dialect array, a fixed size is its second argument | +| DuckDB | `TEXT`, `VARCHAR(10)`, `NUMERIC`, `mood` | `varchar`, `varchar`, `decimal(18, 3)`, `enum('sad', 'ok')`, by aliases, argument rules and `canonical_oid` on the declared enum | +| GoogleSQL | `ARRAY`, `STRUCT`, `RANGE` | `array(int64)`, `struct(a: int64, b: string)`, `range(date)`: the converter renders the zetajones type node in call form, or `ParseTypeExpr` accepts `<...>` | +| GoogleSQL | `STRING(10)`, `STRING(MAX)`, `NUMERIC(10,2)`, `[1, 2]`, `STRUCT(1 AS x)` | the typmods are read, with `max` an identifier argument; the array and struct constructors are typed from their elements | +| SQL Server | `NVARCHAR(MAX)`, `VARCHAR`, `DECIMAL` | `nvarchar(max)` with `max` an identifier argument; `varchar(1)` and `decimal(18, 0)` by the defaults `sys.types` applies | +| SQL Server | `FLOAT(24)` | `real`, by a rewrite | +| SQL Server | `dbo.PhoneNumber`, `sysname` | a row in namespace `dbo`, `typtype` `d`, `base_oid` at `varchar(20)`, `not_null` set; `sysname` seeded the same way over `nvarchar(128)` | + +The `ident` argument is the one addition to `TypeExpr` and to +`goldeneye/analysis.TypeExpr`, which mirrors it. Without it `max`, `sum` and +`day to second` read as types, and today they do: `SimpleAggregateFunction` +reports `sum` as a type. Both parsers that have `MAX` model it as a literal +node, and the converters hand it over as an identifier; `ParseTypeExpr` +writes a bare word that is not a known family as an identifier only when a +dialect says so, since a struct field's type is also a bare word. + +### What the analyzer reports + +`Column` and `Parameter` in `analysis.go` keep `Type` as the expression and +`TypeOID` as the row, instance or family. `DataType` and `IsArray` stay as +the flat view for the legacy compiler bridge, and that bridge derives what +codegen reads from the expression rather than dropping it: `ArrayDims` is +the depth of `array` nesting, `Length` is the first integer argument, +`Unsigned` is a family name ending in ` unsigned`. `sqlc analyze` prints the +expression as it does today, with `ident` as a fifth argument kind. + +`TypeNameString`, `ArraySuffix`, `CreateArrayType`, `TypeLength` and +`TypeScale` are the API that goes; `ResolveTypeExpr`, `LookupTypeExpr` and +`TypeExprOf(oid)` — the expression a row stands for, read back from +`sql_type_arg` — are the API that replaces it. + +### What the seed files gain + +`types.jsonl` is unchanged for a family beyond the optional argument +defaults; an alias becomes a row with `canonical_oid` instead of a mesh of +casts. A function's argument and return types may be expressions, and the +return type may reference an argument's value as well as its type. The +category rules in `dialect.json` apply to families; an instance inherits +its family's category, which is how `numeric(10, 2)` joins the numeric +casts without being seeded. `dialect.json` also carries the dialect's +rewrites, its identifier words and positions, and its affinity rule, so +that nothing about a dialect is code. + +`goldeneye` checks the analyze cases against what each database reports, and +its answer shape is the same `TypeExpr`. ClickHouse and DuckDB report whole +expressions already. MySQL's driver reports the family, unsigned and +nullability but not precision or length, and `ColumnType.DecimalSize` and +`ColumnType.Length` can add them, with the length divided by the charset's +bytes per character since the wire reports bytes. SQLite reports a declared +spelling for a table column and a storage class for an expression, which +are an instance row and a family row respectively. A PostgreSQL check reads +`format_type(atttypid, atttypmod)` and `attndims`. Every check keeps passing +on the way, since a family with no arguments prints as it does now. + +## A worked example: an array of arrays of integers + +```sql +CREATE TABLE grids ( + id bigint PRIMARY KEY, + cells int[][] NOT NULL +); + +-- name: GetGrid :one +SELECT id, cells, cells[1][2] AS cell FROM grids WHERE cells = $1; +``` + +The PostgreSQL parser hands over `pg_catalog.int4` with two array bounds, +which reads into `array(array(int4))`; canonicalization makes it +`array(array(integer))`. Interning walks it bottom-up, so the inner array +gets its row before the outer one. With illustrative OIDs, `sql_type` +holds the seeded families and the two rows the schema added: + +| oid | name | expr | typtype | category | family_oid | element_oid | canonical_oid | +|---|---|---|---|---|---|---|---| +| 23 | integer | integer | b | N | | | | +| 24 | int4 | int4 | b | N | | | 23 | +| 20 | bigint | bigint | b | N | | | | +| 100 | array | array | b | A | | | | +| 1001 | array | array(integer) | b | A | 100 | 23 | | +| 1002 | array | array(array(integer)) | b | A | 100 | 1001 | | + +Row 1001 is what PostgreSQL calls `_int4`; row 1002 is the one PostgreSQL +does not have, since its own type collapses the dimensions onto `attndims`. +An instance takes its family's namespace. `sql_type_arg` has one row per +argument position: + +| type_oid | ord | label | arg_type_oid | nullable | +|---|---|---|---|---| +| 1001 | 1 | | 23 | 0 | +| 1002 | 1 | | 1001 | 0 | + +and `sql_attribute` points `grids.cells` at row 1002, `not_null` set, with +`int[][]` in `decl_type`. + +Analysis resolves `cells` to that attribute, so its `exprType` is +`{typeOID: 1002, expr: array(array(integer)), nullable: false}`, and the +parameter compared with it takes the same type. `cells[1][2]` follows the +dialect's subscript rule — PostgreSQL yields the innermost element however +many subscripts are applied — which is a walk down `element_oid` from 1002 +to 1001 to 23, nullable because a subscript can miss. `sqlc analyze` prints: + +```json +[ + { + "name": "GetGrid", + "cmd": ":one", + "columns": [ + { "name": "id", "type": { "name": "bigint" }, "table": "grids" }, + { + "name": "cells", + "type": { + "name": "array", + "args": [ + { "type": { "name": "array", "args": [ { "type": { "name": "integer" } } ] } } + ] + }, + "table": "grids" + }, + { "name": "cell", "type": { "name": "integer", "nullable": true } } + ], + "params": [ + { + "number": 1, + "column": { + "name": "cells", + "type": { + "name": "array", + "args": [ + { "type": { "name": "array", "args": [ { "type": { "name": "integer" } } ] } } + ] + }, + "table": "grids" + } + } + ] + } +] +``` + +Its string form is `array(array(integer))`; today the same column prints +`array(int4)`, one level, with `type_oid` pointing at a row named `int4[]`. +The legacy bridge derives `DataType` `integer` and `ArrayDims` 2 from the +nesting, so Go codegen renders `[][]int32` as the legacy path does. +DuckDB's `INTEGER[][]` and ClickHouse's `Array(Array(Int32))` produce the +same rows and output, with `int32` in ClickHouse's case. + +## As implemented + +The design above is implemented, engine by engine, with these departures +and details settled on the way: + +- What the note called hooks is data, so that an engine adds a dialect by + writing files and never by registering Go code. `dialect.json` carries + `rewrites`, an ordered list of pattern, template and optional bound — + `float($1)` to `real` where `$1 <= 24`, `decimal` to `decimal(18, 0)`, + `Decimal32($1)` to `Decimal(9, $1)`, `sysname` to `nvarchar(128)` — which + the seed loads into `sql_type_rewrite` and the catalog applies before + interning, first match winning, tried once with the name as spelled and + once with its alias resolved so that `dec` meets a rule on `decimal`; + `idents` and `ident_args`, the words and + argument positions that are identifiers rather than types, kept as dialect + flags; and `affinity`, SQLite's ordered rule for a family the seed does + not list, loaded into `sql_type_affinity` and asked when a schema + declares one. A result that depends on an argument's value is a template + in `functions.jsonl` — `"returns": "Decimal(18, $2)"` — kept on + `sql_proc.return_template` and filled in from the call's literals. What + is genuinely about parsing stays in the engine's converter: ClickHouse + numbers an Enum's members and sorts a Variant's in the canonical + rendering it hands the core, while the spelling the formatter prints stays + the author's. +- A bare type name resolves in the default namespaces only — the catalog's + own, `pg_catalog` and the dialect's default schema — and `CREATE TYPE` + deduplicates within the namespace it names, so `foo.mood` and `mood` are + two types and a bare `mood` never binds to `foo.mood`. A bare `CREATE + TYPE` lands in the dialect's default schema when it has one, so SQL + Server's `PhoneNumber` and `dbo.PhoneNumber` are one row. A type outside + the default namespaces is spelled with its namespace wherever the catalog + spells it, including inside an instance's key, so `array(foo.mood)` and + `array(mood)` are two rows. +- A lookup that may not write — the analyzer's, against the cached catalog + — still canonicalizes an expression whose instance is not a row, however + deep the missing instance sits, so `$1::varchar(10)[]` reports + `array(character varying(10))` against the `array` family. The seed + gives every dialect the `array` family for that reason, whether or not + its `types.jsonl` lists it. +- A family in `types.jsonl` may name a `base` listed before it, which is + how MySQL's unsigned families stand on their signed ones: `bigint + unsigned` is a type of its own, and resolves as a `bigint` where nothing + takes it as itself. +- SQLite's `dialect.json` says `"alias": "base"`, which makes each alias in + its `types.jsonl` a type of its own standing on the type it aliases, + rather than another spelling of it. +- An engine hands the core one of three things: a canonical rendering + (`TypeName.Canonical`, a call expression with fields labelled `a: integer`, + which DuckDB, GoogleSQL and ClickHouse write and the formatter never + prints), the author's spelling (`TypeName.Spelling`, which the formatter + prints back and SQLite hands over as its type), or a name with `Typmods` + and `ArrayBounds`, where an integer constant is an integer argument, a + bare `ast.String` is an identifier and a quoted constant a string. + `ParseTypeExpr` reads a label before a colon, a label before a space only + when a single word follows, and words after a closing parenthesis as part + of the name, as in `decimal(10,2) unsigned`. `ColumnDef.IsUnsigned` and `ColumnDef.Vals` add MySQL's unsigned + and enum members. `ParamRef.Name` carries the name a `{name:Type}` + placeholder gives itself. +- A cast is NULL when its operand is, or when its type says so, as + `Nullable(String)` does; a cast of a placeholder types the placeholder + and takes its name and source from what it is compared with. A cast to + `interval day to second` decodes the field mask the parser reports the + way a column definition does. +- ClickHouse's `LowCardinality(Nullable(T))`, the only order it accepts, + is a nullable column, and the converter and `goldeneye` both read it as + `lowcardinality(T)` with the nullability on the outside, where the + column's nullability lives. +- MySQL types `CAST(x AS CHAR(10))` as `varchar(10)` and `CAST(x AS + BINARY(8))` as `varbinary(8)`, which is what its metadata and a view over + the cast both report, rather than the `char(10)` the table above + proposed. `goldeneye` reads a table column's type from `COLUMN_TYPE`, in + the relations seed and in the analyze check, and compares an expression + by family alone, since the wire carries no arguments. +- SQLite reports a cast to a spelling that is not a storage class, such as + `DECIMAL(5,2)`, as that spelling, while the value's storage class is what + a run would show; the check's cases keep to storage classes. +- DuckDB's `JSON` is grouped under `varchar` by `duckdb_types()`'s logical + type, so a JSON column reports `varchar`; a named enum reports its name, + not its labels, since the canonicalizer cannot see the catalog. A + GoogleSQL array or struct constructor in a select list is still untyped. +- PostgreSQL's `relations.jsonl` spells an array column as its element with + the array flag, which `goldeneye` now writes from `typelem` for the + `_`-prefixed array types alone; `int2vector` and `oidvector` share the + array category but stay types of their own. MySQL's keeps the case of an + enum's members, which are values. + +## Order of work + +1. The tables and the interning entry point: `sql_type.expr`, `family_oid`, + `element_oid`, `base_oid`, `canonical_oid`, `not_null`, `sql_type_arg`, + `ResolveTypeExpr`, `LookupTypeExpr`, `TypeExprOf`, with the alias step + of canonicalization. Arrays become instances of `array`; the `[]` + convention goes. Every existing golden holds, since a bare name prints + the same. +2. The analyzer: `exprType` carries the expression; casts, constructors, + placeholders and function results report it; resolution falls back + through the pointer chain. This is where ClickHouse's casts and + parameters come right. +3. The engines, one at a time, each with an `analyze_types/` case + alongside ClickHouse's and each with its rewrites: PostgreSQL + typmods, dimensions, declared types and `format_type` names; MySQL + unsigned, typmods, members and `boolean`, plus the `var_string` leak; + DuckDB's nested types and dropped arguments; GoogleSQL's angle brackets; + SQL Server's `max`, defaults and alias types; SQLite's affinity rule. +4. The legacy bridge: `parse_core.go` derives `Unsigned`, `Length` and + `ArrayDims` from the expression, and the `experiment_coreanalyzer` cases + grow MySQL unsigned and boolean columns and a PostgreSQL two-dimensional + array, so the core path generates what the legacy path does. +5. Return templates for value-dependent results, ClickHouse first; then + MySQL's precision arithmetic once its check reads precision from the + wire. + +## Open questions + +- How far a return template goes. ClickHouse's arithmetic promotion and + `toDecimal64(x, 4)` are finite rules; `arrayMap(f, arr)` returns an array + of the lambda's result, which needs the lambda typed first. +- Whether DuckDB's dropped `VARCHAR(10)` length and reported anonymous enum + should be canonicalized away as DuckDB does, or kept because a user + declared them. The check decides for the former. diff --git a/internal/dbmanager/client.go b/internal/dbmanager/client.go new file mode 100644 index 0000000000..2c49433aef --- /dev/null +++ b/internal/dbmanager/client.go @@ -0,0 +1,150 @@ +package dbmanager + +import ( + "context" + "fmt" + "hash/fnv" + "io" + "net/url" + "strings" + + "github.com/jackc/pgx/v5" + "golang.org/x/sync/singleflight" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/pgx/poolcache" + "github.com/sqlc-dev/sqlc/internal/shfmt" +) + +type CreateDatabaseRequest struct { + Engine string + Migrations []string + Prefix string +} + +type CreateDatabaseResponse struct { + Uri string +} + +type Client interface { + CreateDatabase(context.Context, *CreateDatabaseRequest) (*CreateDatabaseResponse, error) + Close(context.Context) +} + +var flight singleflight.Group + +type ManagedClient struct { + cache *poolcache.Cache + replacer *shfmt.Replacer + servers []config.Server +} + +func dbid(migrations []string) string { + h := fnv.New64() + for _, query := range migrations { + io.WriteString(h, query) + } + return fmt.Sprintf("%x", h.Sum(nil)) +} + +func (m *ManagedClient) CreateDatabase(ctx context.Context, req *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + hash := dbid(req.Migrations) + prefix := req.Prefix + if prefix == "" { + prefix = "sqlc_managed" + } + name := fmt.Sprintf("%s_%s", prefix, hash) + + engine := config.Engine(req.Engine) + switch engine { + case config.EngineMySQL: + // pass + case config.EnginePostgreSQL: + // pass + default: + return nil, fmt.Errorf("unsupported engine: %s", engine) + } + + var base string + for _, server := range m.servers { + if server.Engine == engine { + base = server.URI + break + } + } + + if strings.TrimSpace(base) == "" { + return nil, fmt.Errorf("no PostgreSQL database server found") + } + + serverUri := m.replacer.Replace(base) + pool, err := m.cache.Open(ctx, serverUri) + if err != nil { + return nil, err + } + + uri, err := url.Parse(serverUri) + if err != nil { + return nil, err + } + uri.Path = "/" + name + + key := uri.String() + _, err, _ = flight.Do(key, func() (any, error) { + // TODO: Use a parameterized query + row := pool.QueryRow(ctx, + fmt.Sprintf(`SELECT datname FROM pg_database WHERE datname = '%s'`, name)) + + var datname string + if err := row.Scan(&datname); err == nil { + return nil, nil + } + + if _, err := pool.Exec(ctx, fmt.Sprintf(`CREATE DATABASE "%s"`, name)); err != nil { + return nil, err + } + + conn, err := pgx.Connect(ctx, uri.String()) + if err != nil { + pool.Exec(ctx, fmt.Sprintf(`DROP DATABASE IF EXISTS "%s" WITH (FORCE)`, name)) + return nil, fmt.Errorf("connect %s: %s", name, err) + } + defer conn.Close(ctx) + + var migrationErr error + for _, q := range req.Migrations { + if len(strings.TrimSpace(q)) == 0 { + continue + } + if _, err := conn.Exec(ctx, q); err != nil { + migrationErr = fmt.Errorf("%s: %s", q, err) + break + } + } + + if migrationErr != nil { + pool.Exec(ctx, fmt.Sprintf(`DROP DATABASE IF EXISTS "%s" WITH (FORCE)`, name)) + return nil, migrationErr + } + + return nil, nil + }) + + if err != nil { + return nil, err + } + + return &CreateDatabaseResponse{Uri: key}, err +} + +func (m *ManagedClient) Close(ctx context.Context) { + m.cache.Close() +} + +func NewClient(servers []config.Server) *ManagedClient { + return &ManagedClient{ + cache: poolcache.New(), + servers: servers, + replacer: shfmt.NewReplacer(nil), + } +} diff --git a/internal/debug/dump.go b/internal/debug/dump.go index 6921ecb67f..ac5eb73293 100644 --- a/internal/debug/dump.go +++ b/internal/debug/dump.go @@ -3,24 +3,18 @@ package debug import ( "encoding/json" "fmt" - "os" "github.com/davecgh/go-spew/spew" - "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" ) -var Active bool -var Debug opts.Debug +// Active reports whether SQLCDEBUG had any value set at startup. It +// remains a global so unrelated debug-spew sites that don't tie to a +// specific setting can gate their output on "is debug mode on at all". +var Active = sqlcdebug.Any() -func init() { - Active = os.Getenv("SQLCDEBUG") != "" - if Active { - Debug = opts.DebugFromEnv() - } -} - -func Dump(n ...interface{}) { +func Dump(n ...any) { if Active { spew.Dump(n) } diff --git a/internal/docs/lint.go b/internal/docs/lint.go new file mode 100644 index 0000000000..58edb91ed0 --- /dev/null +++ b/internal/docs/lint.go @@ -0,0 +1,381 @@ +// Package docs validates the documentation content contract for docs/. +// +// The docs/ directory is plain CommonMark + GitHub-flavored Markdown with no +// rendering toolchain in this repository; a separate repository consumes it +// and builds the documentation site. This package enforces the contract that +// consumer relies on: +// +// - every page parses as Markdown and starts with exactly one level-1 +// heading (the page title) +// - every relative link and image resolves to a file inside docs/, and +// anchor fragments resolve to a heading in the target page +// - every page appears exactly once in toc.yaml, either in a section or in +// the unlisted set, and every toc.yaml entry names a real page +// - no raw HTML or JSX except HTML comments +// - no MyST/Sphinx directives left over from the old toolchain +package docs + +import ( + "bytes" + "fmt" + "os" + "path" + "path/filepath" + "sort" + "strings" + "unicode" + + "github.com/yuin/goldmark" + "github.com/yuin/goldmark/ast" + "github.com/yuin/goldmark/extension" + "github.com/yuin/goldmark/text" + "gopkg.in/yaml.v3" +) + +// A Problem is a single contract violation, located by file (relative to the +// docs root) and 1-based line number. +type Problem struct { + File string + Line int + Message string +} + +func (p Problem) String() string { + return fmt.Sprintf("%s:%d: %s", p.File, p.Line, p.Message) +} + +type tocFile struct { + Index string `yaml:"index"` + Sections []struct { + Title string `yaml:"title"` + Pages []string `yaml:"pages"` + } `yaml:"sections"` + Unlisted []string `yaml:"unlisted"` +} + +type page struct { + src []byte + doc ast.Node + anchors map[string]bool +} + +// Lint validates every Markdown file under root against the content +// contract and cross-checks the set of files against root/toc.yaml. +func Lint(root string) ([]Problem, error) { + var problems []Problem + + files, err := markdownFiles(root) + if err != nil { + return nil, err + } + + md := goldmark.New(goldmark.WithExtensions(extension.GFM)) + + // First pass: parse everything and collect heading anchors, so link + // fragments can be validated against any page. + pages := make(map[string]*page, len(files)) + for _, rel := range files { + src, err := os.ReadFile(filepath.Join(root, filepath.FromSlash(rel))) + if err != nil { + return nil, err + } + doc := md.Parser().Parse(text.NewReader(src)) + pages[rel] = &page{src: src, doc: doc, anchors: headingAnchors(doc, src)} + } + + for _, rel := range files { + problems = append(problems, lintPage(rel, pages)...) + } + + problems = append(problems, lintTOC(root, files)...) + + sort.Slice(problems, func(i, j int) bool { + if problems[i].File != problems[j].File { + return problems[i].File < problems[j].File + } + return problems[i].Line < problems[j].Line + }) + return problems, nil +} + +// markdownFiles returns the slash-separated paths of all .md files under +// root, relative to root. +func markdownFiles(root string) ([]string, error) { + var files []string + err := filepath.WalkDir(root, func(p string, d os.DirEntry, err error) error { + if err != nil { + return err + } + if !d.IsDir() && strings.HasSuffix(d.Name(), ".md") { + rel, err := filepath.Rel(root, p) + if err != nil { + return err + } + files = append(files, filepath.ToSlash(rel)) + } + return nil + }) + if err != nil { + return nil, err + } + sort.Strings(files) + return files, nil +} + +func lintPage(rel string, pages map[string]*page) []Problem { + var problems []Problem + p := pages[rel] + report := func(n ast.Node, format string, args ...any) { + problems = append(problems, Problem{ + File: rel, + Line: nodeLine(n, p.src), + Message: fmt.Sprintf(format, args...), + }) + } + + var h1s int + firstBlock := true + ast.Walk(p.doc, func(n ast.Node, entering bool) (ast.WalkStatus, error) { + if !entering { + return ast.WalkContinue, nil + } + if n.Type() == ast.TypeBlock && n.Parent() == p.doc { + if firstBlock { + firstBlock = false + if h, ok := n.(*ast.Heading); !ok || h.Level != 1 { + report(n, "page must start with a level-1 heading (its title)") + } + } + } + switch n := n.(type) { + case *ast.Heading: + if n.Level == 1 { + h1s++ + if h1s == 2 { + report(n, "page has more than one level-1 heading") + } + } + case *ast.Link: + problems = append(problems, checkLink(rel, string(n.Destination), false, n, pages)...) + case *ast.Image: + problems = append(problems, checkLink(rel, string(n.Destination), true, n, pages)...) + case *ast.HTMLBlock, *ast.RawHTML: + if raw := rawHTMLText(n, p.src); !isHTMLComment(raw) { + report(n, "raw HTML is not allowed: %s", firstLine(raw)) + } + case *ast.Paragraph: + if t := nodeText(n, p.src); strings.HasPrefix(t, ":::") { + report(n, "MyST directive syntax is not allowed; use GitHub alerts (> [!NOTE]) instead") + } + case *ast.FencedCodeBlock: + if info := fenceInfo(n, p.src); strings.HasPrefix(info, "{") { + report(n, "MyST fenced directive %q is not allowed; use GitHub alerts (> [!NOTE]) instead", info) + } + } + return ast.WalkContinue, nil + }) + return problems +} + +func checkLink(rel, dest string, isImage bool, n ast.Node, pages map[string]*page) []Problem { + p := pages[rel] + problem := func(format string, args ...any) []Problem { + return []Problem{{ + File: rel, + Line: nodeLine(n, p.src), + Message: fmt.Sprintf(format, args...), + }} + } + + switch { + case dest == "": + return problem("empty link destination") + case strings.HasPrefix(dest, "http://"), strings.HasPrefix(dest, "https://"), strings.HasPrefix(dest, "mailto:"): + return nil + case strings.HasPrefix(dest, "#"): + if !p.anchors[strings.TrimPrefix(dest, "#")] { + return problem("anchor %s not found in this page", dest) + } + return nil + case strings.HasPrefix(dest, "/"): + return problem("absolute link %q; use a path relative to this file", dest) + case strings.Contains(dest, "://"): + return problem("unsupported link scheme in %q", dest) + } + + pathPart, frag, _ := strings.Cut(dest, "#") + target := path.Join(path.Dir(rel), pathPart) + if target == ".." || strings.HasPrefix(target, "../") { + return problem("link %q points outside docs/", dest) + } + + tp, ok := pages[target] + if !ok { + if isImage || !strings.HasSuffix(target, ".md") { + // Non-page assets (images, other files) just need to exist on + // disk; they were not parsed in the first pass. + return problem("link target %q does not exist", target) + } + return problem("link target %q does not exist", target) + } + if frag != "" && !tp.anchors[frag] { + return problem("anchor #%s not found in %s", frag, target) + } + return nil +} + +func lintTOC(root string, files []string) []Problem { + const tocName = "toc.yaml" + problem := func(format string, args ...any) Problem { + return Problem{File: tocName, Line: 1, Message: fmt.Sprintf(format, args...)} + } + + data, err := os.ReadFile(filepath.Join(root, tocName)) + if err != nil { + return []Problem{problem("%v", err)} + } + dec := yaml.NewDecoder(bytes.NewReader(data)) + dec.KnownFields(true) + var toc tocFile + if err := dec.Decode(&toc); err != nil { + return []Problem{problem("%v", err)} + } + + var problems []Problem + listed := make(map[string]int) + add := func(entry string) { + listed[entry]++ + } + add(toc.Index) + for _, s := range toc.Sections { + for _, pg := range s.Pages { + add(pg) + } + } + for _, pg := range toc.Unlisted { + add(pg) + } + + onDisk := make(map[string]bool, len(files)) + for _, f := range files { + onDisk[f] = true + } + for entry, count := range listed { + if count > 1 { + problems = append(problems, problem("%s is listed %d times", entry, count)) + } + if !onDisk[entry] { + problems = append(problems, problem("%s is listed but does not exist", entry)) + } + } + for _, f := range files { + if listed[f] == 0 { + problems = append(problems, problem("%s is not listed; add it to a section or to unlisted", f)) + } + } + return problems +} + +// headingAnchors returns the set of GitHub-style anchor slugs for the +// headings in doc, applying GitHub's -1, -2 suffixes for duplicates. +func headingAnchors(doc ast.Node, src []byte) map[string]bool { + anchors := make(map[string]bool) + seen := make(map[string]int) + ast.Walk(doc, func(n ast.Node, entering bool) (ast.WalkStatus, error) { + if h, ok := n.(*ast.Heading); ok && entering { + slug := slugify(nodeText(h, src)) + if c := seen[slug]; c > 0 { + anchors[fmt.Sprintf("%s-%d", slug, c)] = true + } else { + anchors[slug] = true + } + seen[slug]++ + } + return ast.WalkContinue, nil + }) + return anchors +} + +// slugify converts heading text to a GitHub-style anchor: lowercase, spaces +// become hyphens, and everything except letters, digits, hyphens and +// underscores is dropped. +func slugify(s string) string { + var b strings.Builder + for _, r := range strings.ToLower(s) { + switch { + case unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' || r == '-': + b.WriteRune(r) + case r == ' ': + b.WriteByte('-') + } + } + return b.String() +} + +func nodeText(n ast.Node, src []byte) string { + var b strings.Builder + ast.Walk(n, func(c ast.Node, entering bool) (ast.WalkStatus, error) { + if entering { + switch c := c.(type) { + case *ast.Text: + b.Write(c.Segment.Value(src)) + case *ast.String: + b.Write(c.Value) + } + } + return ast.WalkContinue, nil + }) + return b.String() +} + +func rawHTMLText(n ast.Node, src []byte) string { + var b strings.Builder + switch n := n.(type) { + case *ast.HTMLBlock: + for i := 0; i < n.Lines().Len(); i++ { + seg := n.Lines().At(i) + b.Write(seg.Value(src)) + } + if n.HasClosure() { + b.Write(n.ClosureLine.Value(src)) + } + case *ast.RawHTML: + for i := 0; i < n.Segments.Len(); i++ { + seg := n.Segments.At(i) + b.Write(seg.Value(src)) + } + } + return strings.TrimSpace(b.String()) +} + +func isHTMLComment(raw string) bool { + return strings.HasPrefix(raw, "") +} + +func fenceInfo(n *ast.FencedCodeBlock, src []byte) string { + if n.Info == nil { + return "" + } + return strings.TrimSpace(string(n.Info.Segment.Value(src))) +} + +func firstLine(s string) string { + if i := strings.IndexByte(s, '\n'); i >= 0 { + return s[:i] + } + return s +} + +// nodeLine returns the 1-based line number of n, using the nearest +// enclosing block that carries source positions. +func nodeLine(n ast.Node, src []byte) int { + if rh, ok := n.(*ast.RawHTML); ok && rh.Segments.Len() > 0 { + return 1 + bytes.Count(src[:rh.Segments.At(0).Start], []byte("\n")) + } + for cur := n; cur != nil; cur = cur.Parent() { + if cur.Type() == ast.TypeBlock && cur.Lines().Len() > 0 { + return 1 + bytes.Count(src[:cur.Lines().At(0).Start], []byte("\n")) + } + } + return 1 +} diff --git a/internal/docs/lint_test.go b/internal/docs/lint_test.go new file mode 100644 index 0000000000..dbfa9a55ef --- /dev/null +++ b/internal/docs/lint_test.go @@ -0,0 +1,116 @@ +package docs + +import ( + "os" + "path/filepath" + "runtime" + "strings" + "testing" +) + +// TestDocs validates the repository's docs/ directory against the content +// contract. This is a unit test rather than an endtoend case because the +// contract is a property of the documentation source tree, not of anything +// the sqlc CLI does: there is no command whose output could pin it down. +func TestDocs(t *testing.T) { + _, thisFile, _, ok := runtime.Caller(0) + if !ok { + t.Fatal("could not locate source file") + } + root := filepath.Join(filepath.Dir(thisFile), "..", "..", "docs") + + problems, err := Lint(root) + if err != nil { + t.Fatal(err) + } + for _, p := range problems { + t.Errorf("%s", p) + } +} + +// TestLintViolations pins down what the linter rejects, using a synthetic +// docs tree that violates each rule of the contract once. +func TestLintViolations(t *testing.T) { + root := t.TempDir() + write := func(name, content string) { + t.Helper() + p := filepath.Join(root, filepath.FromSlash(name)) + if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(p, []byte(content), 0o644); err != nil { + t.Fatal(err) + } + } + + write("toc.yaml", ` +index: index.md +sections: + - title: Guides + pages: + - sub/page.md + - sub/page.md + - ghost.md +`) + write("index.md", `# Index + +A [broken link](missing.md) and a [bad anchor](sub/page.md#nope) and +a [bad self anchor](#nowhere) and an [absolute link](/sub/page.md) and +an [escaping link](../outside.md). + +
raw html
+ + + +:::{note} +myst directive +::: + +`+"```{warning}"+` +myst fence +`+"```"+` + +# Second title +`) + write("sub/page.md", "Not a heading first.\n\n# Title\n") + write("orphan.md", "# Orphan\n") + + problems, err := Lint(root) + if err != nil { + t.Fatal(err) + } + want := []string{ + `index.md:3: link target "missing.md" does not exist`, + "index.md:3: anchor #nope not found in sub/page.md", + "index.md:3: anchor #nowhere not found in this page", + `index.md:3: absolute link "/sub/page.md"`, + `index.md:3: link "../outside.md" points outside docs/`, + "index.md:7: raw HTML is not allowed:
raw html
", + "index.md:11: MyST directive syntax is not allowed", + `index.md:16: MyST fenced directive "{warning}" is not allowed`, + "index.md:19: page has more than one level-1 heading", + "sub/page.md:1: page must start with a level-1 heading", + "toc.yaml:1: sub/page.md is listed 2 times", + "toc.yaml:1: ghost.md is listed but does not exist", + "toc.yaml:1: orphan.md is not listed", + } + var got []string + for _, p := range problems { + got = append(got, p.String()) + } + for _, w := range want { + found := false + for _, g := range got { + if strings.Contains(g, w) { + found = true + break + } + } + if !found { + t.Errorf("expected a problem containing %q, got:\n %s", w, strings.Join(got, "\n ")) + } + } + if len(got) != len(want) { + t.Errorf("got %d problems, want %d:\n %s", len(got), len(want), strings.Join(got, "\n ")) + } +} diff --git a/internal/endtoend/CLAUDE.md b/internal/endtoend/CLAUDE.md new file mode 100644 index 0000000000..b9c995c9df --- /dev/null +++ b/internal/endtoend/CLAUDE.md @@ -0,0 +1,117 @@ +# End-to-End Tests - Native Database Setup + +This document describes how to set up MySQL and PostgreSQL for running end-to-end tests in environments without Docker, particularly when using an HTTP proxy. + +## Overview + +The end-to-end tests support three methods for connecting to databases: + +1. **Environment Variables**: Set `POSTGRESQL_SERVER_URI` and `MYSQL_SERVER_URI` directly +2. **Docker**: Automatically starts containers via the docker package +3. **Native Installation**: Starts existing database services on Linux + +## Installing Databases with HTTP Proxy + +In environments where DNS doesn't work directly but an HTTP proxy is available (e.g., some CI environments), you need to configure apt to use the proxy before installing packages. + +### Configure apt Proxy + +```bash +# Check if HTTP_PROXY is set +echo $HTTP_PROXY + +# Configure apt to use the proxy +sudo tee /etc/apt/apt.conf.d/99proxy << EOF +Acquire::http::Proxy "$HTTP_PROXY"; +Acquire::https::Proxy "$HTTPS_PROXY"; +EOF + +# Update package lists +sudo apt-get update -qq +``` + +### Install PostgreSQL + +```bash +# Install PostgreSQL +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql postgresql-contrib + +# Start the service +sudo service postgresql start + +# Set password for postgres user +sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" + +# Configure pg_hba.conf for password authentication +# Find the hba_file location: +sudo -u postgres psql -t -c "SHOW hba_file;" + +# Add md5 authentication for localhost (add to the beginning of pg_hba.conf): +# host all all 127.0.0.1/32 md5 + +# Reload PostgreSQL +sudo service postgresql reload +``` + +### Install MySQL + +```bash +# Pre-configure MySQL root password +echo "mysql-server mysql-server/root_password password mysecretpassword" | sudo debconf-set-selections +echo "mysql-server mysql-server/root_password_again password mysecretpassword" | sudo debconf-set-selections + +# Install MySQL +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server + +# Start the service +sudo service mysql start + +# Verify connection +mysql -uroot -pmysecretpassword -e "SELECT 1;" +``` + +## Expected Database Credentials + +The native database support expects the following credentials: + +### PostgreSQL +- **URI**: `postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable` +- **User**: `postgres` +- **Password**: `postgres` +- **Port**: `5432` + +### MySQL +- **URI**: `root:mysecretpassword@tcp(localhost:3306)/mysql?multiStatements=true&parseTime=true` +- **User**: `root` +- **Password**: `mysecretpassword` +- **Port**: `3306` + +## Running Tests + +```bash +# Run end-to-end tests +go test -v -run TestReplay -timeout 20m ./internal/endtoend/... + +# With verbose logging +go test -v -run TestReplay -timeout 20m ./internal/endtoend/... 2>&1 | tee test.log +``` + +## Troubleshooting + +### apt-get times out or fails +- Ensure HTTP proxy is configured in `/etc/apt/apt.conf.d/99proxy` +- Check that the proxy URL is correct: `echo $HTTP_PROXY` +- Try running `sudo apt-get update` first to verify connectivity + +### MySQL connection refused +- Check if MySQL is running: `sudo service mysql status` +- Verify the password: `mysql -uroot -pmysecretpassword -e "SELECT 1;"` +- Check if MySQL is listening on TCP: `netstat -tlnp | grep 3306` + +### PostgreSQL authentication failed +- Verify pg_hba.conf has md5 authentication for localhost +- Check password: `PGPASSWORD=postgres psql -h localhost -U postgres -c "SELECT 1;"` +- Reload PostgreSQL after config changes: `sudo service postgresql reload` + +### DNS resolution fails +This is expected in some environments. Configure apt proxy as shown above. diff --git a/internal/endtoend/case_test.go b/internal/endtoend/case_test.go index 367b9dd158..3579183c4c 100644 --- a/internal/endtoend/case_test.go +++ b/internal/endtoend/case_test.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "strings" "testing" ) @@ -14,20 +15,29 @@ type Testcase struct { Path string ConfigName string Stderr []byte + Stdout []byte Exec *Exec } +type ExecMeta struct { + InvalidSchema bool `json:"invalid_schema"` +} + type Exec struct { Command string `json:"command"` + Args []string `json:"args"` Contexts []string `json:"contexts"` Process string `json:"process"` + OS []string `json:"os"` Env map[string]string `json:"env"` + Meta ExecMeta `json:"meta"` } func parseStderr(t *testing.T, dir, testctx string) []byte { t.Helper() paths := []string{ filepath.Join(dir, "stderr", fmt.Sprintf("%s.txt", testctx)), + filepath.Join(dir, fmt.Sprintf("stderr_%s.txt", runtime.GOOS)), filepath.Join(dir, "stderr.txt"), } for _, path := range paths { @@ -42,6 +52,34 @@ func parseStderr(t *testing.T, dir, testctx string) []byte { return nil } +// parseStdout reads the command's expected output: stdout.json for a +// command that prints JSON, so editors highlight it, otherwise stdout.txt. +func parseStdout(t *testing.T, dir string) []byte { + t.Helper() + for _, name := range []string{"stdout.json", "stdout.txt"} { + path := filepath.Join(dir, name) + if _, err := os.Stat(path); os.IsNotExist(err) { + continue + } + blob, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + return blob + } + return nil +} + +// hasSQLCConfig reports whether dir contains an sqlc configuration file. +func hasSQLCConfig(dir string) bool { + for _, name := range []string{"sqlc.json", "sqlc.yaml", "sqlc.yml"} { + if _, err := os.Stat(filepath.Join(dir, name)); err == nil { + return true + } + } + return false +} + func parseExec(t *testing.T, dir string) *Exec { t.Helper() path := filepath.Join(dir, "exec.json") @@ -51,10 +89,10 @@ func parseExec(t *testing.T, dir string) *Exec { var e Exec blob, err := os.ReadFile(path) if err != nil { - t.Fatal(err) + t.Fatalf("%s: %s", path, err) } if err := json.Unmarshal(blob, &e); err != nil { - t.Fatal(err) + t.Fatalf("%s: %s", path, err) } if e.Command == "" { e.Command = "generate" @@ -68,17 +106,34 @@ func FindTests(t *testing.T, root, testctx string) []*Testcase { if err != nil { return err } - if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" || info.Name() == "sqlc.yml" { + name := info.Name() + if name == "sqlc.json" || name == "sqlc.yaml" || name == "sqlc.yml" { dir := filepath.Dir(path) tcs = append(tcs, &Testcase{ Path: dir, Name: strings.TrimPrefix(dir, root+string(filepath.Separator)), - ConfigName: info.Name(), + ConfigName: name, Stderr: parseStderr(t, dir, testctx), + Stdout: parseStdout(t, dir), Exec: parseExec(t, dir), }) return filepath.SkipDir } + // Config-less command tests (e.g. parse, analyze) are discovered by + // their exec.json when no sqlc config is present in the directory. + if name == "exec.json" { + dir := filepath.Dir(path) + if !hasSQLCConfig(dir) { + tcs = append(tcs, &Testcase{ + Path: dir, + Name: strings.TrimPrefix(dir, root+string(filepath.Separator)), + Stderr: parseStderr(t, dir, testctx), + Stdout: parseStdout(t, dir), + Exec: parseExec(t, dir), + }) + return filepath.SkipDir + } + } return nil }) if err != nil { diff --git a/internal/endtoend/ddl_test.go b/internal/endtoend/ddl_test.go index 2ead5841c8..3cd66a6cb2 100644 --- a/internal/endtoend/ddl_test.go +++ b/internal/endtoend/ddl_test.go @@ -1,59 +1,30 @@ package main import ( - "context" "fmt" - "io/fs" "os" "path/filepath" - "strings" "testing" - "github.com/jackc/pgx/v5" - "github.com/sqlc-dev/sqlc/internal/config" - "github.com/sqlc-dev/sqlc/internal/migrations" - "github.com/sqlc-dev/sqlc/internal/quickdb" - pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestValidSchema(t *testing.T) { - ctx := context.Background() - - projectID := os.Getenv("CI_SQLC_PROJECT_ID") - authToken := os.Getenv("CI_SQLC_AUTH_TOKEN") - if projectID == "" || authToken == "" { - t.Skip("missing project id or auth token") - } - - client, err := quickdb.NewClient(projectID, authToken) - if err != nil { - t.Fatal(err) - } - - files := []string{} + for _, replay := range FindTests(t, "testdata", "base") { - // Find all tests that do not have a stderr.txt file - err = filepath.Walk("testdata", func(path string, info fs.FileInfo, err error) error { - if err != nil { - return err - } - if filepath.Base(path) == "sqlc.json" || filepath.Base(path) == "sqlc.yaml" || filepath.Base(path) == "sqlc.yml" { - stderr := filepath.Join(filepath.Dir(path), "stderr.txt") - if _, err := os.Stat(stderr); !os.IsNotExist(err) { - return nil + if replay.Exec != nil { + if replay.Exec.Meta.InvalidSchema { + continue } - files = append(files, path) } - return nil - }) - if err != nil { - t.Fatal(err) - } - for _, file := range files { - file := file // https://golang.org/doc/faq#closures_and_goroutines + // Config-less command tests (parse, analyze) have no schema to validate. + if replay.ConfigName == "" { + continue + } + + file := filepath.Join(replay.Path, replay.ConfigName) rd, err := os.Open(file) if err != nil { t.Fatal(err) @@ -65,61 +36,28 @@ func TestValidSchema(t *testing.T) { } for j, pkg := range conf.SQL { - j, pkg := j, pkg - if pkg.Engine != config.EnginePostgreSQL { + switch pkg.Engine { + case config.EnginePostgreSQL: + // pass + case config.EngineMySQL: + // pass + default: continue } t.Run(fmt.Sprintf("endtoend-%s-%d", file, j), func(t *testing.T) { t.Parallel() - if strings.Contains(file, "pg_dump") { - t.Skip("loading pg_dump not supported") - } - var schema []string for _, path := range pkg.Schema { schema = append(schema, filepath.Join(filepath.Dir(file), path)) } - files, err := sqlpath.Glob(schema) - if err != nil { - t.Fatal(err) - } - - var sqls []string - for _, f := range files { - contents, err := os.ReadFile(f) - if err != nil { - t.Fatalf("%s: %s", f, err) - } - // Support loading pg_dump SQL files - before := strings.ReplaceAll(string(contents), "CREATE SCHEMA public;", "CREATE SCHEMA IF NOT EXISTS public;") - sqls = append(sqls, migrations.RemoveRollbackStatements(before)) - } - - resp, err := client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{ - Engine: "postgresql", - Region: quickdb.GetClosestRegion(), - Migrations: sqls, - }) - if err != nil { - t.Fatalf("region %s: %s", quickdb.GetClosestRegion(), err) - } - - t.Cleanup(func() { - _, err = client.DropEphemeralDatabase(ctx, &pb.DropEphemeralDatabaseRequest{ - DatabaseId: resp.DatabaseId, - }) - if err != nil { - t.Fatal(err) - } - }) - - conn, err := pgx.Connect(ctx, resp.Uri) - if err != nil { - t.Fatalf("connect %s: %s", resp.Uri, err) + switch pkg.Engine { + case config.EnginePostgreSQL: + local.PostgreSQL(t, schema) + case config.EngineMySQL: + local.MySQL(t, schema) } - defer conn.Close(ctx) }) } } diff --git a/internal/endtoend/endtoend_test.go b/internal/endtoend/endtoend_test.go index 39694e9437..506552592e 100644 --- a/internal/endtoend/endtoend_test.go +++ b/internal/endtoend/endtoend_test.go @@ -3,9 +3,11 @@ package main import ( "bytes" "context" + "fmt" "os" osexec "os/exec" "path/filepath" + "runtime" "slices" "strings" "testing" @@ -16,8 +18,40 @@ import ( "github.com/sqlc-dev/sqlc/internal/cmd" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/opts" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" + "github.com/sqlc-dev/sqlc/internal/sqltest/docker" + "github.com/sqlc-dev/sqlc/internal/sqltest/native" ) +// withSQLCDEBUG installs the given SQLCDEBUG-formatted string for the +// duration of the test and restores the empty default afterwards. +// +// Callers in TestReplay are sequential, so this does not need a mutex: +// Go's test scheduler does not run TestReplay concurrently with the +// parallel top-level tests in this package. +func withSQLCDEBUG(t *testing.T, raw string) func() { + t.Helper() + if raw == "" { + return func() {} + } + sqlcdebug.Update(raw) + return func() { sqlcdebug.Update("") } +} + +func lineEndings() cmp.Option { + return cmp.Transformer("LineEndings", func(in string) string { + // Replace Windows new lines with Unix newlines + return strings.Replace(in, "\r\n", "\n", -1) + }) +} + +func stderrTransformer() cmp.Option { + return cmp.Transformer("Stderr", func(in string) string { + s := strings.Replace(in, "\r", "", -1) + return strings.Replace(s, "\\", "/", -1) + }) +} + func TestExamples(t *testing.T) { t.Parallel() ctx := context.Background() @@ -37,6 +71,9 @@ func TestExamples(t *testing.T) { continue } tc := replay.Name() + if !isExample(filepath.Join(examples, tc)) { + continue + } t.Run(tc, func(t *testing.T) { t.Parallel() path := filepath.Join(examples, tc) @@ -84,8 +121,12 @@ func BenchmarkExamples(b *testing.B) { } type textContext struct { - Mutate func(*config.Config) + Mutate func(*testing.T, string) func(*config.Config) Enabled func() bool + // Experiments names the experiments every case in this context runs + // with. A case's own SQLCEXPERIMENT is appended to these, so a case can + // still turn one back off with the "no" prefix. + Experiments func() []string } func TestReplay(t *testing.T) { @@ -96,32 +137,124 @@ func TestReplay(t *testing.T) { // t.Parallel() ctx := context.Background() + var mysqlURI, postgresURI string + + // First, check environment variables + if uri := os.Getenv("POSTGRESQL_SERVER_URI"); uri != "" { + postgresURI = uri + } + if uri := os.Getenv("MYSQL_SERVER_URI"); uri != "" { + mysqlURI = uri + } + + // Try Docker for any missing databases + if postgresURI == "" || mysqlURI == "" { + if err := docker.Installed(); err == nil { + if postgresURI == "" { + host, err := docker.StartPostgreSQLServer(ctx) + if err != nil { + t.Logf("docker postgresql startup failed: %s", err) + } else { + postgresURI = host + } + } + if mysqlURI == "" { + host, err := docker.StartMySQLServer(ctx) + if err != nil { + t.Logf("docker mysql startup failed: %s", err) + } else { + mysqlURI = host + } + } + } + } + + // Try native installation for any missing databases (Linux only) + if postgresURI == "" || mysqlURI == "" { + if err := native.Supported(); err == nil { + if postgresURI == "" { + host, err := native.StartPostgreSQLServer(ctx) + if err != nil { + t.Logf("native postgresql startup failed: %s", err) + } else { + postgresURI = host + } + } + if mysqlURI == "" { + host, err := native.StartMySQLServer(ctx) + if err != nil { + t.Logf("native mysql startup failed: %s", err) + } else { + mysqlURI = host + } + } + } + } + + // Log which databases are available + t.Logf("PostgreSQL available: %v (URI: %s)", postgresURI != "", postgresURI) + t.Logf("MySQL available: %v (URI: %s)", mysqlURI != "", mysqlURI) + contexts := map[string]textContext{ "base": { - Mutate: func(c *config.Config) {}, + Mutate: func(t *testing.T, path string) func(*config.Config) { return func(c *config.Config) {} }, Enabled: func() bool { return true }, }, "managed-db": { - Mutate: func(c *config.Config) { - c.Cloud.Project = "01HAQMMECEYQYKFJN8MP16QC41" // TODO: Read from environment - for i := range c.SQL { - c.SQL[i].Database = &config.Database{ - Managed: true, + Mutate: func(t *testing.T, path string) func(*config.Config) { + return func(c *config.Config) { + // Add all servers - tests will fail if database isn't available + c.Servers = []config.Server{ + { + Name: "postgres", + Engine: config.EnginePostgreSQL, + URI: postgresURI, + }, + { + Name: "mysql", + Engine: config.EngineMySQL, + URI: mysqlURI, + }, + } + + for i := range c.SQL { + switch c.SQL[i].Engine { + case config.EnginePostgreSQL: + c.SQL[i].Database = &config.Database{ + Managed: true, + } + case config.EngineMySQL: + c.SQL[i].Database = &config.Database{ + Managed: true, + } + case config.EngineSQLite: + c.SQL[i].Database = &config.Database{ + Managed: true, + } + default: + // pass + } } } }, Enabled: func() bool { - if len(os.Getenv("CI")) > 0 { - return false - } - return len(os.Getenv("SQLC_AUTH_TOKEN")) > 0 + // Enabled if at least one database URI is available + return postgresURI != "" || mysqlURI != "" + }, + }, + "core": { + Mutate: func(t *testing.T, path string) func(*config.Config) { return func(c *config.Config) {} }, + Experiments: func() []string { return []string{"coreanalyzer"} }, + Enabled: func() bool { + // Running the whole corpus through the analysis core is opt-in + // while the two paths still disagree. The core needs no + // database, so nothing else gates this. + return os.Getenv("SQLC_TEST_CORE") != "" }, }, } for name, testctx := range contexts { - name := name - testctx := testctx if !testctx.Enabled() { continue @@ -130,8 +263,6 @@ func TestReplay(t *testing.T) { for _, replay := range FindTests(t, "testdata", name) { tc := replay t.Run(filepath.Join(name, tc.Name), func(t *testing.T) { - t.Parallel() - var stderr bytes.Buffer var output map[string]string var err error @@ -156,15 +287,28 @@ func TestReplay(t *testing.T) { } } + if len(args.OS) > 0 { + if !slices.Contains(args.OS, runtime.GOOS) { + t.Skipf("unsupported os: %s", runtime.GOOS) + } + } + + experiments := args.Env["SQLCEXPERIMENT"] + if testctx.Experiments != nil { + experiments = strings.Join(append(testctx.Experiments(), experiments), ",") + } + opts := cmd.Options{ Env: cmd.Env{ - Debug: opts.DebugFromString(args.Env["SQLCDEBUG"]), - NoRemote: true, + Experiment: opts.ExperimentFromString(experiments), }, Stderr: &stderr, - MutateConfig: testctx.Mutate, + MutateConfig: testctx.Mutate(t, path), } + release := withSQLCDEBUG(t, args.Env["SQLCDEBUG"]) + defer release() + switch args.Command { case "diff": err = cmd.Diff(ctx, path, "", &opts) @@ -175,6 +319,29 @@ func TestReplay(t *testing.T) { } case "vet": err = cmd.Vet(ctx, path, "", &opts) + case "parse", "analyze", "fmt": + // These commands are flag-driven (fmt cases pass --diff so + // nothing is rewritten). Run them through the real CLI + // entry point from inside the test directory so file + // arguments resolve and the output stays independent of + // the absolute path. + var stdout bytes.Buffer + wd, werr := os.Getwd() + if werr != nil { + t.Fatal(werr) + } + if cerr := os.Chdir(path); cerr != nil { + t.Fatal(cerr) + } + code := cmd.Do(append([]string{args.Command}, args.Args...), nil, &stdout, &stderr) + if cerr := os.Chdir(wd); cerr != nil { + t.Fatal(cerr) + } + if code != 0 { + err = fmt.Errorf("%s exited with code %d", args.Command, code) + } else if diff := cmp.Diff(strings.TrimSpace(string(tc.Stdout)), strings.TrimSpace(stdout.String()), lineEndings()); diff != "" { + t.Errorf("stdout differed (-want +got):\n%s", diff) + } default: t.Fatalf("unknown command") } @@ -183,7 +350,11 @@ func TestReplay(t *testing.T) { t.Fatalf("sqlc %s failed: %s", args.Command, stderr.String()) } - diff := cmp.Diff(strings.TrimSpace(expected), strings.TrimSpace(stderr.String())) + diff := cmp.Diff( + strings.TrimSpace(expected), + strings.TrimSpace(stderr.String()), + stderrTransformer(), + ) if diff != "" { t.Fatalf("stderr differed (-want +got):\n%s", diff) } @@ -236,15 +407,19 @@ func cmpDirectory(t *testing.T, dir string, actual map[string]string) { t.Fatal(err) } - if !cmp.Equal(expected, actual, cmpopts.EquateEmpty()) { + opts := []cmp.Option{ + cmpopts.EquateEmpty(), + lineEndings(), + } + + if !cmp.Equal(expected, actual, opts...) { t.Errorf("%s contents differ", dir) for name, contents := range expected { - name := name if actual[name] == "" { t.Errorf("%s is empty", name) return } - if diff := cmp.Diff(contents, actual[name]); diff != "" { + if diff := cmp.Diff(contents, actual[name], opts...); diff != "" { t.Errorf("%s differed (-want +got):\n%s", name, diff) } } @@ -282,3 +457,15 @@ func BenchmarkReplay(b *testing.B) { }) } } + +// isExample reports whether a directory under examples is an example: one +// with a sqlc configuration file. The examples module also holds packages +// the examples' tests share, which have none. +func isExample(dir string) bool { + for _, name := range []string{"sqlc.yaml", "sqlc.yml", "sqlc.json"} { + if _, err := os.Stat(filepath.Join(dir, name)); err == nil { + return true + } + } + return false +} diff --git a/internal/endtoend/fmt_test.go b/internal/endtoend/fmt_test.go index 22b5f1392d..3420a8d0b1 100644 --- a/internal/endtoend/fmt_test.go +++ b/internal/endtoend/fmt_test.go @@ -3,72 +3,191 @@ package main import ( "bytes" "fmt" + "io" "os" "path/filepath" "strings" "testing" - pg_query "github.com/pganalyze/pg_query_go/v4" + "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/engine/dolphin" "github.com/sqlc-dev/sqlc/internal/engine/postgresql" + "github.com/sqlc-dev/sqlc/internal/engine/sqlite" "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/format" ) +// sqlParser is an interface for SQL parsers +type sqlParser interface { + Parse(r io.Reader) ([]ast.Statement, error) +} + +// sqlFormatter is an interface for formatters +type sqlFormatter interface { + format.Dialect +} + func TestFormat(t *testing.T) { t.Parallel() - parse := postgresql.NewParser() for _, tc := range FindTests(t, "testdata", "base") { - tc := tc - - if !strings.Contains(tc.Path, filepath.Join("pgx/v5")) { + // Config-less command tests (parse, analyze) have no config to format. + if tc.ConfigName == "" { continue } - - q := filepath.Join(tc.Path, "query.sql") - if _, err := os.Stat(q); os.IsNotExist(err) { - continue - } - t.Run(tc.Name, func(t *testing.T) { - contents, err := os.ReadFile(q) + // Parse the config file to determine the engine + configPath := filepath.Join(tc.Path, tc.ConfigName) + configFile, err := os.Open(configPath) if err != nil { t.Fatal(err) } - for i, query := range bytes.Split(bytes.TrimSpace(contents), []byte(";")) { - if len(query) <= 1 { - continue - } - query := query - t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - expected, err := pg_query.Fingerprint(string(query)) + conf, err := config.ParseConfig(configFile) + configFile.Close() + if err != nil { + t.Fatal(err) + } + + // Skip if there are no SQL packages configured + if len(conf.SQL) == 0 { + return + } + + engine := conf.SQL[0].Engine + + // Select the appropriate parser and fingerprint function based on engine + var parse sqlParser + var formatter sqlFormatter + var fingerprint func(string) (string, error) + + switch engine { + case config.EnginePostgreSQL: + pgParser := postgresql.NewParser() + parse = pgParser + formatter = pgParser + fingerprint = postgresql.Fingerprint + case config.EngineMySQL: + mysqlParser := dolphin.NewParser() + parse = mysqlParser + formatter = mysqlParser + // For MySQL, we use a "round-trip" fingerprint: parse the SQL, format it, + // and return the formatted string. This tests that our formatting produces + // valid SQL that parses to the same AST structure. + fingerprint = func(sql string) (string, error) { + stmts, err := mysqlParser.Parse(strings.NewReader(sql)) if err != nil { - t.Fatal(err) + return "", err } - stmts, err := parse.Parse(bytes.NewReader(query)) - if err != nil { - t.Fatal(err) + if len(stmts) == 0 { + return "", nil } - if len(stmts) != 1 { - t.Fatal("expected one statement") + return ast.Format(stmts[0].Raw, mysqlParser), nil + } + case config.EngineSQLite: + sqliteParser := sqlite.NewParser() + parse = sqliteParser + formatter = sqliteParser + // For SQLite, we use the same "round-trip" fingerprint strategy as MySQL: + // parse the SQL, format it, and return the formatted string. + fingerprint = func(sql string) (string, error) { + stmts, err := sqliteParser.Parse(strings.NewReader(sql)) + if err != nil { + return "", err } - if false { - r, err := pg_query.Parse(string(query)) - debug.Dump(r, err) + if len(stmts) == 0 { + return "", nil } + return strings.ToLower(ast.Format(stmts[0].Raw, sqliteParser)), nil + } + default: + // Skip unsupported engines + return + } - out := ast.Format(stmts[0].Raw) - actual, err := pg_query.Fingerprint(out) + // Find query files from config + var queryFiles []string + for _, sql := range conf.SQL { + for _, q := range sql.Queries { + queryPath := filepath.Join(tc.Path, q) + info, err := os.Stat(queryPath) if err != nil { - t.Error(err) + continue } - if expected != actual { - debug.Dump(stmts[0].Raw) - t.Errorf("- %s", expected) - t.Errorf("- %s", string(query)) - t.Errorf("+ %s", actual) - t.Errorf("+ %s", out) + if info.IsDir() { + // If it's a directory, glob for .sql files + matches, err := filepath.Glob(filepath.Join(queryPath, "*.sql")) + if err != nil { + continue + } + queryFiles = append(queryFiles, matches...) + } else { + queryFiles = append(queryFiles, queryPath) } - }) + } + } + + if len(queryFiles) == 0 { + return + } + + for _, queryFile := range queryFiles { + if _, err := os.Stat(queryFile); os.IsNotExist(err) { + continue + } + + contents, err := os.ReadFile(queryFile) + if err != nil { + t.Fatal(err) + } + + // Parse the entire file to get proper statement boundaries + stmts, err := parse.Parse(bytes.NewReader(contents)) + if err != nil { + // Skip files with parse errors (e.g., syntax_errors test cases) + return + } + + for i, stmt := range stmts { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + // Extract the original query text using statement location and length + start := stmt.Raw.StmtLocation + length := stmt.Raw.StmtLen + if length == 0 { + // If StmtLen is 0, it means the statement goes to the end of the input + length = len(contents) - start + } + query := strings.TrimSpace(string(contents[start : start+length])) + + expected, err := fingerprint(query) + if err != nil { + t.Fatal(err) + } + + if false { + r, err := postgresql.Parse(query) + debug.Dump(r, err) + } + + out := ast.Format(stmt.Raw, formatter) + // An empty rendering is the formatter's signal that + // the statement carries syntax the AST does not + // model; sqlc fmt keeps such statements as written. + if strings.TrimSpace(strings.TrimSuffix(strings.TrimSpace(out), ";")) == "" { + t.Skip("statement has no faithful rendering") + } + actual, err := fingerprint(out) + if err != nil { + t.Error(err) + } + if expected != actual { + debug.Dump(stmt.Raw) + t.Errorf("- %s", expected) + t.Errorf("- %s", query) + t.Errorf("+ %s", actual) + t.Errorf("+ %s", out) + } + }) + } } }) } diff --git a/internal/endtoend/testdata/alias/mysql/go/db.go b/internal/endtoend/testdata/alias/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/alias/mysql/go/db.go +++ b/internal/endtoend/testdata/alias/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/alias/mysql/go/models.go b/internal/endtoend/testdata/alias/mysql/go/models.go index 40001531be..9ac222a278 100644 --- a/internal/endtoend/testdata/alias/mysql/go/models.go +++ b/internal/endtoend/testdata/alias/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID uint64 } diff --git a/internal/endtoend/testdata/alias/mysql/go/query.sql.go b/internal/endtoend/testdata/alias/mysql/go/query.sql.go index f9ca2e7e4e..281c3f5fd7 100644 --- a/internal/endtoend/testdata/alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/alias/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go index 998d97b872..93fa0abd42 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go index 998d97b872..93fa0abd42 100644 --- a/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go index e876ebcb2d..2f81fed20f 100644 --- a/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/alias/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/alias/sqlite/go/db.go b/internal/endtoend/testdata/alias/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/alias/sqlite/go/db.go +++ b/internal/endtoend/testdata/alias/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/alias/sqlite/go/models.go b/internal/endtoend/testdata/alias/sqlite/go/models.go index 214487814e..bc354e040a 100644 --- a/internal/endtoend/testdata/alias/sqlite/go/models.go +++ b/internal/endtoend/testdata/alias/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/alias/sqlite/go/query.sql.go index fb40e61422..5e00770088 100644 --- a/internal/endtoend/testdata/alias/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/alias/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/analyze_arrays/googlesql/exec.json b/internal/endtoend/testdata/analyze_arrays/googlesql/exec.json new file mode 100644 index 0000000000..a53ddddc6d --- /dev/null +++ b/internal/endtoend/testdata/analyze_arrays/googlesql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_arrays/googlesql/query.sql b/internal/endtoend/testdata/analyze_arrays/googlesql/query.sql new file mode 100644 index 0000000000..5d4666d91f --- /dev/null +++ b/internal/endtoend/testdata/analyze_arrays/googlesql/query.sql @@ -0,0 +1,8 @@ +-- name: AlbumIDs :one +SELECT singer_id, ARRAY(SELECT album_id FROM albums WHERE albums.singer_id = singers.singer_id) AS album_ids +FROM singers WHERE singer_id = @singer_id; + +-- name: Literals :one +SELECT [1, 2, 3] AS ints, ARRAY['a'] AS strs, DATE '2024-01-02' AS d, + TIMESTAMP '2024-01-02 03:04:05+00' AS ts, NUMERIC '1.5' AS n, JSON '{"a": 1}' AS j, + b'abc' AS raw, INTERVAL 3 DAY AS iv; diff --git a/internal/endtoend/testdata/analyze_arrays/googlesql/schema.sql b/internal/endtoend/testdata/analyze_arrays/googlesql/schema.sql new file mode 100644 index 0000000000..667e087fb6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_arrays/googlesql/schema.sql @@ -0,0 +1,13 @@ +CREATE TABLE singers ( + singer_id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + tags ARRAY, + scores ARRAY NOT NULL, +) PRIMARY KEY (singer_id); + +CREATE TABLE albums ( + singer_id INT64 NOT NULL, + album_id INT64 NOT NULL, + title STRING(MAX), +) PRIMARY KEY (singer_id, album_id), + INTERLEAVE IN PARENT singers ON DELETE CASCADE; diff --git a/internal/endtoend/testdata/analyze_arrays/googlesql/stdout.json b/internal/endtoend/testdata/analyze_arrays/googlesql/stdout.json new file mode 100644 index 0000000000..920fc64da6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_arrays/googlesql/stdout.json @@ -0,0 +1,109 @@ +[ + { + "name": "AlbumIDs", + "cmd": ":one", + "columns": [ + { + "name": "singer_id", + "type": { + "name": "int64" + }, + "table": "singers" + }, + { + "name": "album_ids", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "singer_id", + "type": { + "name": "int64" + }, + "table": "singers" + } + } + ] + }, + { + "name": "Literals", + "cmd": ":one", + "columns": [ + { + "name": "ints", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + }, + { + "name": "strs", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string" + } + } + ] + } + }, + { + "name": "d", + "type": { + "name": "date" + } + }, + { + "name": "ts", + "type": { + "name": "timestamp" + } + }, + { + "name": "n", + "type": { + "name": "numeric" + } + }, + { + "name": "j", + "type": { + "name": "json" + } + }, + { + "name": "raw", + "type": { + "name": "bytes" + } + }, + { + "name": "iv", + "type": { + "name": "interval" + } + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_ast/postgresql/exec.json b/internal/endtoend/testdata/analyze_ast/postgresql/exec.json new file mode 100644 index 0000000000..7d04ef8cab --- /dev/null +++ b/internal/endtoend/testdata/analyze_ast/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "postgresql", "--schema", "schema.sql", "--ast", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_ast/postgresql/query.sql b/internal/endtoend/testdata/analyze_ast/postgresql/query.sql new file mode 100644 index 0000000000..17af794d2a --- /dev/null +++ b/internal/endtoend/testdata/analyze_ast/postgresql/query.sql @@ -0,0 +1,2 @@ +-- name: GetAuthorName :one +SELECT name FROM authors WHERE id = $1; diff --git a/internal/endtoend/testdata/analyze_ast/postgresql/schema.sql b/internal/endtoend/testdata/analyze_ast/postgresql/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/analyze_ast/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/analyze_ast/postgresql/stdout.json b/internal/endtoend/testdata/analyze_ast/postgresql/stdout.json new file mode 100644 index 0000000000..0ab1d7e128 --- /dev/null +++ b/internal/endtoend/testdata/analyze_ast/postgresql/stdout.json @@ -0,0 +1,136 @@ +[ + { + "name": "GetAuthorName", + "cmd": ":one", + "columns": [ + { + "name": "name", + "type": { + "name": "text" + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + } + ], + "ast": { + "tag": "RawStmt", + "stmt": { + "tag": "SelectStmt", + "distinct_clause": { + "tag": "List" + }, + "target_list": { + "tag": "List", + "items": [ + { + "tag": "ResTarget", + "indirection": { + "tag": "List" + }, + "val": { + "tag": "ColumnRef", + "name": "", + "fields": { + "tag": "List", + "items": [ + { + "tag": "String", + "str": "name" + } + ] + }, + "location": 35 + }, + "location": 35 + } + ] + }, + "from_clause": { + "tag": "List", + "items": [ + { + "tag": "RangeVar", + "relname": "authors", + "inh": true, + "relpersistence": 112, + "location": 45 + } + ] + }, + "where_clause": { + "tag": "A_Expr", + "kind": 1, + "name": { + "tag": "List", + "items": [ + { + "tag": "String", + "str": "=" + } + ] + }, + "lexpr": { + "tag": "ColumnRef", + "name": "", + "fields": { + "tag": "List", + "items": [ + { + "tag": "String", + "str": "id" + } + ] + }, + "location": 59 + }, + "rexpr": { + "tag": "ParamRef", + "number": 1, + "location": 64, + "dollar": true + }, + "location": 62 + }, + "group_clause": { + "tag": "List" + }, + "having_clause": { + "tag": "TODO" + }, + "window_clause": { + "tag": "List" + }, + "values_lists": { + "tag": "List" + }, + "sort_clause": { + "tag": "List" + }, + "limit_offset": { + "tag": "TODO" + }, + "limit_count": { + "tag": "TODO" + }, + "locking_clause": { + "tag": "List" + }, + "op": 0, + "all": false + }, + "stmt_location": 0, + "stmt_len": 66 + } + } +] diff --git a/internal/endtoend/testdata/analyze_basic/clickhouse/exec.json b/internal/endtoend/testdata/analyze_basic/clickhouse/exec.json new file mode 100644 index 0000000000..c92bfa3dab --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/clickhouse/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "clickhouse", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_basic/clickhouse/fixture.sql b/internal/endtoend/testdata/analyze_basic/clickhouse/fixture.sql new file mode 100644 index 0000000000..88c30875e9 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/clickhouse/fixture.sql @@ -0,0 +1 @@ +INSERT INTO events (id, name, tag, amount, created) VALUES (1, 'signup', NULL, 9.5, '2024-01-01 00:00:00'); diff --git a/internal/endtoend/testdata/analyze_basic/clickhouse/query.sql b/internal/endtoend/testdata/analyze_basic/clickhouse/query.sql new file mode 100644 index 0000000000..4c756ec0f8 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/clickhouse/query.sql @@ -0,0 +1,2 @@ +-- name: ListEvents :many +SELECT id, name, tag, amount, created FROM events; diff --git a/internal/endtoend/testdata/analyze_basic/clickhouse/schema.sql b/internal/endtoend/testdata/analyze_basic/clickhouse/schema.sql new file mode 100644 index 0000000000..29960ee63d --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/clickhouse/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE events ( + id UInt64, + name String, + tag Nullable(String), + amount Float64, + created DateTime +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/analyze_basic/clickhouse/stdout.json b/internal/endtoend/testdata/analyze_basic/clickhouse/stdout.json new file mode 100644 index 0000000000..ad9963d7e7 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/clickhouse/stdout.json @@ -0,0 +1,45 @@ +[ + { + "name": "ListEvents", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + }, + { + "name": "tag", + "type": { + "name": "string", + "nullable": true + }, + "table": "events" + }, + { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "events" + }, + { + "name": "created", + "type": { + "name": "datetime" + }, + "table": "events" + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_basic/duckdb/exec.json b/internal/endtoend/testdata/analyze_basic/duckdb/exec.json new file mode 100644 index 0000000000..56cb4b3fff --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/duckdb/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_basic/duckdb/query.sql b/internal/endtoend/testdata/analyze_basic/duckdb/query.sql new file mode 100644 index 0000000000..b694368ed1 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/duckdb/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT id, name, bio, royalties, created FROM authors; diff --git a/internal/endtoend/testdata/analyze_basic/duckdb/schema.sql b/internal/endtoend/testdata/analyze_basic/duckdb/schema.sql new file mode 100644 index 0000000000..dda49e8484 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/duckdb/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT, + royalties DECIMAL(10,2) NOT NULL, + created TIMESTAMP NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_basic/duckdb/stdout.json b/internal/endtoend/testdata/analyze_basic/duckdb/stdout.json new file mode 100644 index 0000000000..6459e87325 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/duckdb/stdout.json @@ -0,0 +1,53 @@ +[ + { + "name": "ListAuthors", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + }, + { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "authors" + }, + { + "name": "bio", + "type": { + "name": "varchar", + "nullable": true + }, + "table": "authors" + }, + { + "name": "royalties", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "authors" + }, + { + "name": "created", + "type": { + "name": "timestamp" + }, + "table": "authors" + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_basic/googlesql/exec.json b/internal/endtoend/testdata/analyze_basic/googlesql/exec.json new file mode 100644 index 0000000000..a53ddddc6d --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/googlesql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_basic/googlesql/query.sql b/internal/endtoend/testdata/analyze_basic/googlesql/query.sql new file mode 100644 index 0000000000..e3aba1cde2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/googlesql/query.sql @@ -0,0 +1,2 @@ +-- name: GetUser :one +SELECT id, name FROM users WHERE id = @id; diff --git a/internal/endtoend/testdata/analyze_basic/googlesql/schema.sql b/internal/endtoend/testdata/analyze_basic/googlesql/schema.sql new file mode 100644 index 0000000000..ff91a9af24 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/googlesql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + bio STRING(MAX), +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_basic/googlesql/stdout.json b/internal/endtoend/testdata/analyze_basic/googlesql/stdout.json new file mode 100644 index 0000000000..bcc63771e5 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/googlesql/stdout.json @@ -0,0 +1,39 @@ +[ + { + "name": "GetUser", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_basic/mssql/exec.json b/internal/endtoend/testdata/analyze_basic/mssql/exec.json new file mode 100644 index 0000000000..253b05abbf --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/mssql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mssql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_basic/mssql/query.sql b/internal/endtoend/testdata/analyze_basic/mssql/query.sql new file mode 100644 index 0000000000..b694368ed1 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/mssql/query.sql @@ -0,0 +1,2 @@ +-- name: ListAuthors :many +SELECT id, name, bio, royalties, created FROM authors; diff --git a/internal/endtoend/testdata/analyze_basic/mssql/schema.sql b/internal/endtoend/testdata/analyze_basic/mssql/schema.sql new file mode 100644 index 0000000000..3629635d2e --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/mssql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id BIGINT IDENTITY(1,1) PRIMARY KEY, + name NVARCHAR(100) NOT NULL, + bio NVARCHAR(MAX), + royalties DECIMAL(10,2) NOT NULL, + created DATETIME2 NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_basic/mssql/stdout.json b/internal/endtoend/testdata/analyze_basic/mssql/stdout.json new file mode 100644 index 0000000000..818c4c26d7 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/mssql/stdout.json @@ -0,0 +1,68 @@ +[ + { + "name": "ListAuthors", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + }, + { + "name": "name", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 100 + } + ] + }, + "table": "authors" + }, + { + "name": "bio", + "type": { + "name": "nvarchar", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "authors" + }, + { + "name": "royalties", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "authors" + }, + { + "name": "created", + "type": { + "name": "datetime2", + "args": [ + { + "int": 7 + } + ] + }, + "table": "authors" + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_basic/mysql/exec.json b/internal/endtoend/testdata/analyze_basic/mysql/exec.json new file mode 100644 index 0000000000..a5b24d3361 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/mysql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mysql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_basic/mysql/query.sql b/internal/endtoend/testdata/analyze_basic/mysql/query.sql new file mode 100644 index 0000000000..137c1d1a42 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: GetUser :one +SELECT id, name FROM users WHERE id = ?; diff --git a/internal/endtoend/testdata/analyze_basic/mysql/schema.sql b/internal/endtoend/testdata/analyze_basic/mysql/schema.sql new file mode 100644 index 0000000000..52f994807a --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id BIGINT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio TEXT +); diff --git a/internal/endtoend/testdata/analyze_basic/mysql/stdout.json b/internal/endtoend/testdata/analyze_basic/mysql/stdout.json new file mode 100644 index 0000000000..56ae2723c3 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/mysql/stdout.json @@ -0,0 +1,39 @@ +[ + { + "name": "GetUser", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_basic/postgresql/exec.json b/internal/endtoend/testdata/analyze_basic/postgresql/exec.json new file mode 100644 index 0000000000..b102755fb6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_basic/postgresql/query.sql b/internal/endtoend/testdata/analyze_basic/postgresql/query.sql new file mode 100644 index 0000000000..55ef1faf82 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/postgresql/query.sql @@ -0,0 +1,2 @@ +-- name: GetAuthor :one +SELECT * FROM authors WHERE id = $1; diff --git a/internal/endtoend/testdata/analyze_basic/postgresql/schema.sql b/internal/endtoend/testdata/analyze_basic/postgresql/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/postgresql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/analyze_basic/postgresql/stdout.json b/internal/endtoend/testdata/analyze_basic/postgresql/stdout.json new file mode 100644 index 0000000000..faa4c1acd1 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/postgresql/stdout.json @@ -0,0 +1,42 @@ +[ + { + "name": "GetAuthor", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "authors" + }, + { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_basic/sqlite/exec.json b/internal/endtoend/testdata/analyze_basic/sqlite/exec.json new file mode 100644 index 0000000000..aa77909cb2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/sqlite/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "sqlite", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_basic/sqlite/query.sql b/internal/endtoend/testdata/analyze_basic/sqlite/query.sql new file mode 100644 index 0000000000..137c1d1a42 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: GetUser :one +SELECT id, name FROM users WHERE id = ?; diff --git a/internal/endtoend/testdata/analyze_basic/sqlite/schema.sql b/internal/endtoend/testdata/analyze_basic/sqlite/schema.sql new file mode 100644 index 0000000000..884e5c9a77 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + age INTEGER +); diff --git a/internal/endtoend/testdata/analyze_basic/sqlite/stdout.json b/internal/endtoend/testdata/analyze_basic/sqlite/stdout.json new file mode 100644 index 0000000000..8799d17310 --- /dev/null +++ b/internal/endtoend/testdata/analyze_basic/sqlite/stdout.json @@ -0,0 +1,34 @@ +[ + { + "name": "GetUser", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_dml/duckdb/exec.json b/internal/endtoend/testdata/analyze_dml/duckdb/exec.json new file mode 100644 index 0000000000..56cb4b3fff --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/duckdb/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_dml/duckdb/query.sql b/internal/endtoend/testdata/analyze_dml/duckdb/query.sql new file mode 100644 index 0000000000..cf0165356e --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/duckdb/query.sql @@ -0,0 +1,13 @@ +-- name: CreateAuthor :one +INSERT INTO authors (id, name, bio) VALUES ($1, $2, $3) RETURNING id; + +-- name: UpdateAuthor :exec +UPDATE authors SET name = $name, bio = $bio WHERE id = $id; + +-- name: DeleteBooksByAuthor :exec +DELETE FROM books USING authors a WHERE books.author_id = a.id AND a.name = $1; + +-- name: TitlesFromBooks :many +INSERT INTO books (id, author_id, title) +SELECT id + 1000, author_id, upper(title) FROM books WHERE price > $min_price +RETURNING id, title; diff --git a/internal/endtoend/testdata/analyze_dml/duckdb/schema.sql b/internal/endtoend/testdata/analyze_dml/duckdb/schema.sql new file mode 100644 index 0000000000..7c41b6c263 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/duckdb/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +CREATE TABLE books ( + id BIGINT PRIMARY KEY, + author_id BIGINT NOT NULL, + title TEXT NOT NULL, + price DECIMAL(10,2) +); diff --git a/internal/endtoend/testdata/analyze_dml/duckdb/stdout.json b/internal/endtoend/testdata/analyze_dml/duckdb/stdout.json new file mode 100644 index 0000000000..621fdfd260 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/duckdb/stdout.json @@ -0,0 +1,144 @@ +[ + { + "name": "CreateAuthor", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + }, + { + "number": 2, + "column": { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "authors" + } + }, + { + "number": 3, + "column": { + "name": "bio", + "type": { + "name": "varchar", + "nullable": true + }, + "table": "authors" + } + } + ] + }, + { + "name": "UpdateAuthor", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "authors" + } + }, + { + "number": 2, + "column": { + "name": "bio", + "type": { + "name": "varchar", + "nullable": true + }, + "table": "authors" + } + }, + { + "number": 3, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + } + ] + }, + { + "name": "DeleteBooksByAuthor", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "authors" + } + } + ] + }, + { + "name": "TitlesFromBooks", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "books" + }, + { + "name": "title", + "type": { + "name": "varchar" + }, + "table": "books" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "price", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "books" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_dml/googlesql/exec.json b/internal/endtoend/testdata/analyze_dml/googlesql/exec.json new file mode 100644 index 0000000000..a53ddddc6d --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/googlesql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_dml/googlesql/query.sql b/internal/endtoend/testdata/analyze_dml/googlesql/query.sql new file mode 100644 index 0000000000..e35c5f5d02 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/googlesql/query.sql @@ -0,0 +1,17 @@ +-- name: CreateUser :exec +INSERT INTO users (id, name, bio) VALUES (@id, @name, @bio); + +-- name: CreateUserReturning :one +INSERT INTO users (id, name) VALUES (@id, @name) THEN RETURN id, name; + +-- name: UpdateBio :exec +UPDATE users SET bio = @bio WHERE id = @id; + +-- name: UpdateNameReturning :one +UPDATE users SET name = @name WHERE id = @id THEN RETURN id, name; + +-- name: DeleteUser :exec +DELETE FROM users WHERE id = @id; + +-- name: DeleteUserReturning :one +DELETE FROM users WHERE id = @id THEN RETURN id; diff --git a/internal/endtoend/testdata/analyze_dml/googlesql/schema.sql b/internal/endtoend/testdata/analyze_dml/googlesql/schema.sql new file mode 100644 index 0000000000..ff91a9af24 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/googlesql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + bio STRING(MAX), +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_dml/googlesql/stdout.json b/internal/endtoend/testdata/analyze_dml/googlesql/stdout.json new file mode 100644 index 0000000000..f2ee81de89 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/googlesql/stdout.json @@ -0,0 +1,229 @@ +[ + { + "name": "CreateUser", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + }, + { + "number": 3, + "column": { + "name": "bio", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + } + ] + }, + { + "name": "CreateUserReturning", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + } + ] + }, + { + "name": "UpdateBio", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "bio", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + } + } + ] + }, + { + "name": "UpdateNameReturning", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + } + } + ] + }, + { + "name": "DeleteUser", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + } + } + ] + }, + { + "name": "DeleteUserReturning", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_dml/mssql/exec.json b/internal/endtoend/testdata/analyze_dml/mssql/exec.json new file mode 100644 index 0000000000..253b05abbf --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/mssql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mssql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_dml/mssql/query.sql b/internal/endtoend/testdata/analyze_dml/mssql/query.sql new file mode 100644 index 0000000000..cdf7d9fd77 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/mssql/query.sql @@ -0,0 +1,11 @@ +-- name: CreateAuthor :one +INSERT INTO authors (name, bio) OUTPUT INSERTED.id VALUES (@name, @bio); + +-- name: UpdateAuthorAlias :exec +UPDATE a SET name = @name FROM authors a WHERE a.id = @id; + +-- name: UpdateBookPrices :exec +UPDATE b SET price = @price FROM books b JOIN authors a ON b.author_id = a.id WHERE a.name = @author; + +-- name: DeleteBooksByAuthor :exec +DELETE b FROM books b INNER JOIN authors a ON b.author_id = a.id WHERE a.name = @name; diff --git a/internal/endtoend/testdata/analyze_dml/mssql/schema.sql b/internal/endtoend/testdata/analyze_dml/mssql/schema.sql new file mode 100644 index 0000000000..5a53ca742a --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/mssql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE authors ( + id BIGINT IDENTITY(1,1) PRIMARY KEY, + name NVARCHAR(100) NOT NULL, + bio NVARCHAR(MAX) +); + +CREATE TABLE books ( + id BIGINT IDENTITY(1,1) PRIMARY KEY, + author_id BIGINT NOT NULL, + title NVARCHAR(200) NOT NULL, + price DECIMAL(10,2) +); diff --git a/internal/endtoend/testdata/analyze_dml/mssql/stdout.json b/internal/endtoend/testdata/analyze_dml/mssql/stdout.json new file mode 100644 index 0000000000..cfa4de34d1 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/mssql/stdout.json @@ -0,0 +1,143 @@ +[ + { + "name": "CreateAuthor", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 100 + } + ] + }, + "table": "authors" + } + }, + { + "number": 2, + "column": { + "name": "bio", + "type": { + "name": "nvarchar", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "authors" + } + } + ] + }, + { + "name": "UpdateAuthorAlias", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 100 + } + ] + }, + "table": "authors" + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + } + ] + }, + { + "name": "UpdateBookPrices", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "price", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "books" + } + }, + { + "number": 2, + "column": { + "name": "author", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 100 + } + ] + }, + "table": "authors" + } + } + ] + }, + { + "name": "DeleteBooksByAuthor", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 100 + } + ] + }, + "table": "authors" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_dml/mysql/exec.json b/internal/endtoend/testdata/analyze_dml/mysql/exec.json new file mode 100644 index 0000000000..a5b24d3361 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/mysql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mysql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_dml/mysql/query.sql b/internal/endtoend/testdata/analyze_dml/mysql/query.sql new file mode 100644 index 0000000000..6adfb02196 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/mysql/query.sql @@ -0,0 +1,11 @@ +-- name: CreateUser :exec +INSERT INTO users (id, name, bio) VALUES (?, ?, ?); + +-- name: UpdateBio :exec +UPDATE users SET bio = ? WHERE id = ?; + +-- name: DeleteUser :exec +DELETE FROM users WHERE id = ?; + +-- name: DeleteUserPosts :exec +DELETE p FROM posts p JOIN users u ON u.id = p.user_id WHERE u.name = ?; diff --git a/internal/endtoend/testdata/analyze_dml/mysql/schema.sql b/internal/endtoend/testdata/analyze_dml/mysql/schema.sql new file mode 100644 index 0000000000..ad0d0c1bdd --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/mysql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id BIGINT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio TEXT +); + +CREATE TABLE posts ( + id BIGINT PRIMARY KEY, + user_id BIGINT NOT NULL, + title VARCHAR(255), + created DATETIME NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_dml/mysql/stdout.json b/internal/endtoend/testdata/analyze_dml/mysql/stdout.json new file mode 100644 index 0000000000..1d5d37e41d --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/mysql/stdout.json @@ -0,0 +1,112 @@ +[ + { + "name": "CreateUser", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + } + }, + { + "number": 3, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + } + ] + }, + { + "name": "UpdateBio", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + }, + { + "name": "DeleteUser", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + }, + { + "name": "DeleteUserPosts", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_dml/postgresql/exec.json b/internal/endtoend/testdata/analyze_dml/postgresql/exec.json new file mode 100644 index 0000000000..b102755fb6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_dml/postgresql/query.sql b/internal/endtoend/testdata/analyze_dml/postgresql/query.sql new file mode 100644 index 0000000000..7039b171ea --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/postgresql/query.sql @@ -0,0 +1,14 @@ +-- name: CreateUser :one +INSERT INTO users (name, bio) VALUES ($1, $2) RETURNING *; + +-- name: UpdateBio :exec +UPDATE users SET bio = $1 WHERE id = $2; + +-- name: UpdateNameReturning :one +UPDATE users SET name = $1 WHERE id = $2 RETURNING id, name; + +-- name: DeleteUser :exec +DELETE FROM users WHERE id = $1; + +-- name: DeleteUserReturning :one +DELETE FROM users WHERE id = $1 RETURNING id; diff --git a/internal/endtoend/testdata/analyze_dml/postgresql/schema.sql b/internal/endtoend/testdata/analyze_dml/postgresql/schema.sql new file mode 100644 index 0000000000..897da6ceba --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/postgresql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE posts ( + id BIGSERIAL PRIMARY KEY, + user_id bigint NOT NULL, + title varchar(255), + created timestamptz NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_dml/postgresql/stdout.json b/internal/endtoend/testdata/analyze_dml/postgresql/stdout.json new file mode 100644 index 0000000000..e9f777ced3 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/postgresql/stdout.json @@ -0,0 +1,165 @@ +[ + { + "name": "CreateUser", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + }, + { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + } + ] + }, + { + "name": "UpdateBio", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + }, + { + "name": "UpdateNameReturning", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + }, + { + "name": "DeleteUser", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + }, + { + "name": "DeleteUserReturning", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_dml/sqlite/exec.json b/internal/endtoend/testdata/analyze_dml/sqlite/exec.json new file mode 100644 index 0000000000..aa77909cb2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/sqlite/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "sqlite", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_dml/sqlite/query.sql b/internal/endtoend/testdata/analyze_dml/sqlite/query.sql new file mode 100644 index 0000000000..43e84ac3c4 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/sqlite/query.sql @@ -0,0 +1,8 @@ +-- name: CreateUser :one +INSERT INTO users (name, bio) VALUES (?, ?) RETURNING *; + +-- name: UpdateBio :exec +UPDATE users SET bio = ? WHERE id = ?; + +-- name: DeleteUser :exec +DELETE FROM users WHERE id = ?; diff --git a/internal/endtoend/testdata/analyze_dml/sqlite/schema.sql b/internal/endtoend/testdata/analyze_dml/sqlite/schema.sql new file mode 100644 index 0000000000..7fc8892e61 --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/sqlite/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +CREATE TABLE posts ( + id INTEGER PRIMARY KEY, + user_id INTEGER NOT NULL, + title TEXT, + created TEXT NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_dml/sqlite/stdout.json b/internal/endtoend/testdata/analyze_dml/sqlite/stdout.json new file mode 100644 index 0000000000..06863367fa --- /dev/null +++ b/internal/endtoend/testdata/analyze_dml/sqlite/stdout.json @@ -0,0 +1,98 @@ +[ + { + "name": "CreateUser", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + }, + { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + } + ] + }, + { + "name": "UpdateBio", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + } + } + ] + }, + { + "name": "DeleteUser", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_exec/clickhouse/exec.json b/internal/endtoend/testdata/analyze_exec/clickhouse/exec.json new file mode 100644 index 0000000000..c92bfa3dab --- /dev/null +++ b/internal/endtoend/testdata/analyze_exec/clickhouse/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "clickhouse", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_exec/clickhouse/fixture.sql b/internal/endtoend/testdata/analyze_exec/clickhouse/fixture.sql new file mode 100644 index 0000000000..9adc5fa938 --- /dev/null +++ b/internal/endtoend/testdata/analyze_exec/clickhouse/fixture.sql @@ -0,0 +1,2 @@ +INSERT INTO events VALUES (1, 'signup', NULL, 9.5), (2, 'login', 'web', 0.5); +INSERT INTO users VALUES (1, 'a@example.com'); diff --git a/internal/endtoend/testdata/analyze_exec/clickhouse/query.sql b/internal/endtoend/testdata/analyze_exec/clickhouse/query.sql new file mode 100644 index 0000000000..a27579ef0f --- /dev/null +++ b/internal/endtoend/testdata/analyze_exec/clickhouse/query.sql @@ -0,0 +1,11 @@ +-- name: CreateUser :exec +INSERT INTO users (id, email) VALUES (?, ?); + +-- name: CreateEvent :exec +INSERT INTO events VALUES (?, ?, ?, ?); + +-- name: CreateEvents :exec +INSERT INTO events (id, name) VALUES (?, ?), (?, ?); + +-- name: DropUsers :exec +TRUNCATE TABLE users; diff --git a/internal/endtoend/testdata/analyze_exec/clickhouse/schema.sql b/internal/endtoend/testdata/analyze_exec/clickhouse/schema.sql new file mode 100644 index 0000000000..9c04e10685 --- /dev/null +++ b/internal/endtoend/testdata/analyze_exec/clickhouse/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE events ( + id UInt64, + name String, + tag Nullable(String), + amount Float64 +) ENGINE = MergeTree ORDER BY id; + +CREATE TABLE users ( + id UInt64, + email String +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/analyze_exec/clickhouse/stdout.json b/internal/endtoend/testdata/analyze_exec/clickhouse/stdout.json new file mode 100644 index 0000000000..3709c4909b --- /dev/null +++ b/internal/endtoend/testdata/analyze_exec/clickhouse/stdout.json @@ -0,0 +1,130 @@ +[ + { + "name": "CreateUser", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "email", + "type": { + "name": "string" + }, + "table": "users" + } + } + ] + }, + { + "name": "CreateEvent", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + } + }, + { + "number": 2, + "column": { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + }, + { + "number": 3, + "column": { + "name": "tag", + "type": { + "name": "string", + "nullable": true + }, + "table": "events" + } + }, + { + "number": 4, + "column": { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "events" + } + } + ] + }, + { + "name": "CreateEvents", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + } + }, + { + "number": 2, + "column": { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + }, + { + "number": 3, + "column": { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + } + }, + { + "number": 4, + "column": { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + } + ] + }, + { + "name": "DropUsers", + "cmd": ":exec", + "columns": [], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_expressions/clickhouse/exec.json b/internal/endtoend/testdata/analyze_expressions/clickhouse/exec.json new file mode 100644 index 0000000000..c92bfa3dab --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/clickhouse/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "clickhouse", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_expressions/clickhouse/fixture.sql b/internal/endtoend/testdata/analyze_expressions/clickhouse/fixture.sql new file mode 100644 index 0000000000..9adc5fa938 --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/clickhouse/fixture.sql @@ -0,0 +1,2 @@ +INSERT INTO events VALUES (1, 'signup', NULL, 9.5), (2, 'login', 'web', 0.5); +INSERT INTO users VALUES (1, 'a@example.com'); diff --git a/internal/endtoend/testdata/analyze_expressions/clickhouse/query.sql b/internal/endtoend/testdata/analyze_expressions/clickhouse/query.sql new file mode 100644 index 0000000000..dd5604e452 --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/clickhouse/query.sql @@ -0,0 +1,29 @@ +-- name: Aggregates :one +SELECT count() AS n, max(amount) AS top, sum(amount), min(tag) AS first_tag, uniq(name) +FROM events; + +-- name: Expressions :many +SELECT id + 1 AS next_id, nullIf(name, '') AS maybe, coalesce(tag, 'none') AS tag_or_none, + lower(name), toDate(now()) AS today, id > 1 AS big, if(id = 1, 'one', NULL) AS word +FROM events; + +-- name: LeftJoinDefaults :many +SELECT e.id, e.name, u.email +FROM events e +LEFT JOIN users u ON u.id = e.id; + +-- name: Positional :many +SELECT id, name FROM events WHERE name = ? AND amount > ? AND tag = ?; + +-- name: Named :many +SELECT id, name FROM events +WHERE name = sqlc.arg(name) AND tag = sqlc.narg(tag) AND (amount > sqlc.arg(amount) OR amount < sqlc.arg(amount)); + +-- name: Functions :many +SELECT id FROM events WHERE lower(name) = ? AND id IN (?) AND toDate(now()) > ?; + +-- name: Paging :many +SELECT id FROM events ORDER BY id LIMIT ? OFFSET ?; + +-- name: Projected :one +SELECT ? AS echo, 'literal' AS lit; diff --git a/internal/endtoend/testdata/analyze_expressions/clickhouse/schema.sql b/internal/endtoend/testdata/analyze_expressions/clickhouse/schema.sql new file mode 100644 index 0000000000..9c04e10685 --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/clickhouse/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE events ( + id UInt64, + name String, + tag Nullable(String), + amount Float64 +) ENGINE = MergeTree ORDER BY id; + +CREATE TABLE users ( + id UInt64, + email String +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/analyze_expressions/clickhouse/stdout.json b/internal/endtoend/testdata/analyze_expressions/clickhouse/stdout.json new file mode 100644 index 0000000000..e3e4716696 --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/clickhouse/stdout.json @@ -0,0 +1,342 @@ +[ + { + "name": "Aggregates", + "cmd": ":one", + "columns": [ + { + "name": "n", + "type": { + "name": "uint64" + } + }, + { + "name": "top", + "type": { + "name": "float64" + } + }, + { + "name": "sum(amount)", + "type": { + "name": "float64" + } + }, + { + "name": "first_tag", + "type": { + "name": "string", + "nullable": true + } + }, + { + "name": "uniq(name)", + "type": { + "name": "uint64" + } + } + ], + "params": [] + }, + { + "name": "Expressions", + "cmd": ":many", + "columns": [ + { + "name": "next_id", + "type": { + "name": "uint64" + } + }, + { + "name": "maybe", + "type": { + "name": "string", + "nullable": true + } + }, + { + "name": "tag_or_none", + "type": { + "name": "string" + } + }, + { + "name": "lower(name)", + "type": { + "name": "string" + } + }, + { + "name": "today", + "type": { + "name": "date" + } + }, + { + "name": "big", + "type": { + "name": "uint8" + } + }, + { + "name": "word", + "type": { + "name": "string", + "nullable": true + } + } + ], + "params": [] + }, + { + "name": "LeftJoinDefaults", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + }, + { + "name": "email", + "type": { + "name": "string" + }, + "table": "users" + } + ], + "params": [] + }, + { + "name": "Positional", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + }, + { + "number": 2, + "column": { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "events" + } + }, + { + "number": 3, + "column": { + "name": "tag", + "type": { + "name": "string", + "nullable": true + }, + "table": "events" + } + } + ] + }, + { + "name": "Named", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + }, + { + "number": 2, + "column": { + "name": "tag", + "type": { + "name": "string", + "nullable": true + }, + "table": "events" + } + }, + { + "number": 3, + "column": { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "events" + } + }, + { + "number": 4, + "column": { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "events" + } + } + ] + }, + { + "name": "Functions", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "lower", + "type": { + "name": "string" + } + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + } + }, + { + "number": 3, + "column": { + "name": "toDate", + "type": { + "name": "date" + } + } + } + ] + }, + { + "name": "Paging", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "", + "type": { + "name": "uint64" + } + } + }, + { + "number": 2, + "column": { + "name": "", + "type": { + "name": "uint64" + } + } + } + ] + }, + { + "name": "Projected", + "cmd": ":one", + "columns": [ + { + "name": "echo", + "type": { + "name": "nothing", + "nullable": true + } + }, + { + "name": "lit", + "type": { + "name": "string" + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "echo", + "type": { + "name": "nothing", + "nullable": true + } + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_expressions/sqlite/exec.json b/internal/endtoend/testdata/analyze_expressions/sqlite/exec.json new file mode 100644 index 0000000000..aa77909cb2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/sqlite/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "sqlite", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_expressions/sqlite/fixture.sql b/internal/endtoend/testdata/analyze_expressions/sqlite/fixture.sql new file mode 100644 index 0000000000..cda60b0180 --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/sqlite/fixture.sql @@ -0,0 +1,4 @@ +INSERT INTO users (id, name, bio, score) VALUES (1, 'ann', NULL, 1.5); +INSERT INTO users (id, name, bio, score) VALUES (2, 'bob', 'hello', 2.5); +INSERT INTO posts (id, user_id, title, created) VALUES (1, 1, 'first', '2024-01-01'); +INSERT INTO posts (id, user_id, title, created) VALUES (2, 1, NULL, '2024-01-02'); diff --git a/internal/endtoend/testdata/analyze_expressions/sqlite/query.sql b/internal/endtoend/testdata/analyze_expressions/sqlite/query.sql new file mode 100644 index 0000000000..04fdc2f8a0 --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/sqlite/query.sql @@ -0,0 +1,23 @@ +-- name: PostStats :one +SELECT count(*) AS total, max(id) AS latest, min(created) AS first +FROM posts WHERE user_id = ?; + +-- name: UserScores :one +SELECT avg(score) AS mean, sum(score) AS sum, sum(id) AS ids, group_concat(name) AS names +FROM users; + +-- name: ListUsers :many +SELECT id, lower(name) AS lname, id + 1 AS next +FROM users WHERE id IN (?, ?); + +-- name: ListPosts :many +SELECT id, title FROM posts ORDER BY created LIMIT ? OFFSET ?; + +-- name: UserPosts :many +SELECT u.name, p.title, p.created +FROM users u LEFT JOIN posts p ON p.user_id = u.id +WHERE u.name LIKE ? || '%'; + +-- name: CreatePost :one +INSERT INTO posts (user_id, title, created) VALUES (?, ?, datetime('now')) +RETURNING id, created; diff --git a/internal/endtoend/testdata/analyze_expressions/sqlite/schema.sql b/internal/endtoend/testdata/analyze_expressions/sqlite/schema.sql new file mode 100644 index 0000000000..72c6a57080 --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/sqlite/schema.sql @@ -0,0 +1,15 @@ +CREATE TABLE users ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT, + score REAL NOT NULL DEFAULT 0 +); + +CREATE TABLE posts ( + id INTEGER PRIMARY KEY, + user_id INTEGER NOT NULL REFERENCES users(id), + title TEXT, + created TEXT NOT NULL +); + +CREATE INDEX posts_user ON posts(user_id); diff --git a/internal/endtoend/testdata/analyze_expressions/sqlite/stdout.json b/internal/endtoend/testdata/analyze_expressions/sqlite/stdout.json new file mode 100644 index 0000000000..24326932cd --- /dev/null +++ b/internal/endtoend/testdata/analyze_expressions/sqlite/stdout.json @@ -0,0 +1,245 @@ +[ + { + "name": "PostStats", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "integer" + } + }, + { + "name": "latest", + "type": { + "name": "integer", + "nullable": true + } + }, + { + "name": "first", + "type": { + "name": "text", + "nullable": true + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "user_id", + "type": { + "name": "integer" + }, + "table": "posts" + } + } + ] + }, + { + "name": "UserScores", + "cmd": ":one", + "columns": [ + { + "name": "mean", + "type": { + "name": "real", + "nullable": true + } + }, + { + "name": "sum", + "type": { + "name": "real", + "nullable": true + } + }, + { + "name": "ids", + "type": { + "name": "integer", + "nullable": true + } + }, + { + "name": "names", + "type": { + "name": "text", + "nullable": true + } + } + ], + "params": [] + }, + { + "name": "ListUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + }, + { + "name": "lname", + "type": { + "name": "text" + } + }, + { + "name": "next", + "type": { + "name": "integer" + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + } + } + ] + }, + { + "name": "ListPosts", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "text", + "nullable": true + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "", + "type": { + "name": "integer" + } + } + }, + { + "number": 2, + "column": { + "name": "", + "type": { + "name": "integer" + } + } + } + ] + }, + { + "name": "UserPosts", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + }, + { + "name": "title", + "type": { + "name": "text", + "nullable": true + }, + "table": "posts" + }, + { + "name": "created", + "type": { + "name": "text" + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "", + "type": { + "name": "text" + } + } + } + ] + }, + { + "name": "CreatePost", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "posts" + }, + { + "name": "created", + "type": { + "name": "text" + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "user_id", + "type": { + "name": "integer" + }, + "table": "posts" + } + }, + { + "number": 2, + "column": { + "name": "title", + "type": { + "name": "text", + "nullable": true + }, + "table": "posts" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_extension/postgresql/exec.json b/internal/endtoend/testdata/analyze_extension/postgresql/exec.json new file mode 100644 index 0000000000..b102755fb6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_extension/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_extension/postgresql/query.sql b/internal/endtoend/testdata/analyze_extension/postgresql/query.sql new file mode 100644 index 0000000000..11387181f8 --- /dev/null +++ b/internal/endtoend/testdata/analyze_extension/postgresql/query.sql @@ -0,0 +1,8 @@ +-- name: GetUserByEmail :one +SELECT id, email FROM users WHERE email = $1; + +-- name: MatchingEmails :many +SELECT id FROM users WHERE email = name; + +-- name: RankUsers :many +SELECT id, similarity(name, $1) AS score FROM users; diff --git a/internal/endtoend/testdata/analyze_extension/postgresql/schema.sql b/internal/endtoend/testdata/analyze_extension/postgresql/schema.sql new file mode 100644 index 0000000000..acaea170fb --- /dev/null +++ b/internal/endtoend/testdata/analyze_extension/postgresql/schema.sql @@ -0,0 +1,8 @@ +CREATE EXTENSION citext; +CREATE EXTENSION pg_trgm; + +CREATE TABLE users ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + email citext NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_extension/postgresql/stdout.json b/internal/endtoend/testdata/analyze_extension/postgresql/stdout.json new file mode 100644 index 0000000000..dd4477e89a --- /dev/null +++ b/internal/endtoend/testdata/analyze_extension/postgresql/stdout.json @@ -0,0 +1,78 @@ +[ + { + "name": "GetUserByEmail", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "email", + "type": { + "name": "citext" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "email", + "type": { + "name": "citext" + }, + "table": "users" + } + } + ] + }, + { + "name": "MatchingEmails", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + ], + "params": [] + }, + { + "name": "RankUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "score", + "type": { + "name": "real" + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "", + "type": { + "name": "text" + } + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_functions/googlesql/exec.json b/internal/endtoend/testdata/analyze_functions/googlesql/exec.json new file mode 100644 index 0000000000..a53ddddc6d --- /dev/null +++ b/internal/endtoend/testdata/analyze_functions/googlesql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_functions/googlesql/query.sql b/internal/endtoend/testdata/analyze_functions/googlesql/query.sql new file mode 100644 index 0000000000..d441415585 --- /dev/null +++ b/internal/endtoend/testdata/analyze_functions/googlesql/query.sql @@ -0,0 +1,25 @@ +-- name: Strings :many +SELECT LENGTH(name) AS len, UPPER(name) AS upper_name, CONCAT(name, '!') AS shout, + SPLIT(name, ',') AS parts, STARTS_WITH(name, 'a') AS starts, TO_HEX(SHA256(name)) AS digest, + FARM_FINGERPRINT(name) AS fingerprint, REPLACE(name, 'a', 'b') AS replaced, TO_BASE64(payload) AS b64 +FROM events; + +-- name: Numbers :many +SELECT ABS(id) AS abs_id, id / 2 AS half, amount * id AS scaled, ratio + id AS shifted, + ROUND(ratio, 2) AS rounded, MOD(id, 7) AS bucket, DIV(id, 2) AS halved, COSINE_DISTANCE(embedding, embedding) AS distance +FROM events; + +-- name: Times :many +SELECT DATE_ADD(happened_on, INTERVAL 1 DAY) AS next_day, DATE_DIFF(happened_on, happened_on, DAY) AS days, + TIMESTAMP_TRUNC(happened_at, HOUR) AS hour, EXTRACT(YEAR FROM happened_at) AS year, + EXTRACT(DATE FROM happened_at) AS day, UNIX_SECONDS(happened_at) AS epoch, + FORMAT_TIMESTAMP('%Y', happened_at) AS formatted +FROM events; + +-- name: Collections :many +SELECT ARRAY_LENGTH(scores) AS n, ARRAY_REVERSE(scores) AS reversed, GENERATE_ARRAY(1, id) AS series, + TO_JSON(id) AS as_json, JSON_TYPE(details) AS json_kind +FROM events; + +-- name: Counts :one +SELECT COUNT(*) AS total, COUNT(name) AS named, COUNTIF(ratio > 0.5) AS high FROM events; diff --git a/internal/endtoend/testdata/analyze_functions/googlesql/schema.sql b/internal/endtoend/testdata/analyze_functions/googlesql/schema.sql new file mode 100644 index 0000000000..ea03d7fcef --- /dev/null +++ b/internal/endtoend/testdata/analyze_functions/googlesql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE events ( + id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + payload BYTES(MAX) NOT NULL, + amount NUMERIC NOT NULL, + ratio FLOAT64 NOT NULL, + happened_on DATE NOT NULL, + happened_at TIMESTAMP NOT NULL, + details JSON NOT NULL, + scores ARRAY NOT NULL, + embedding ARRAY NOT NULL, +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_functions/googlesql/stdout.json b/internal/endtoend/testdata/analyze_functions/googlesql/stdout.json new file mode 100644 index 0000000000..5e44b966d9 --- /dev/null +++ b/internal/endtoend/testdata/analyze_functions/googlesql/stdout.json @@ -0,0 +1,250 @@ +[ + { + "name": "Strings", + "cmd": ":many", + "columns": [ + { + "name": "len", + "type": { + "name": "int64" + } + }, + { + "name": "upper_name", + "type": { + "name": "string" + } + }, + { + "name": "shout", + "type": { + "name": "string" + } + }, + { + "name": "parts", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string" + } + } + ] + } + }, + { + "name": "starts", + "type": { + "name": "bool" + } + }, + { + "name": "digest", + "type": { + "name": "string" + } + }, + { + "name": "fingerprint", + "type": { + "name": "int64" + } + }, + { + "name": "replaced", + "type": { + "name": "string" + } + }, + { + "name": "b64", + "type": { + "name": "string" + } + } + ], + "params": [] + }, + { + "name": "Numbers", + "cmd": ":many", + "columns": [ + { + "name": "abs_id", + "type": { + "name": "int64" + } + }, + { + "name": "half", + "type": { + "name": "float64" + } + }, + { + "name": "scaled", + "type": { + "name": "numeric" + } + }, + { + "name": "shifted", + "type": { + "name": "float64" + } + }, + { + "name": "rounded", + "type": { + "name": "float64" + } + }, + { + "name": "bucket", + "type": { + "name": "int64" + } + }, + { + "name": "halved", + "type": { + "name": "int64" + } + }, + { + "name": "distance", + "type": { + "name": "float64" + } + } + ], + "params": [] + }, + { + "name": "Times", + "cmd": ":many", + "columns": [ + { + "name": "next_day", + "type": { + "name": "date" + } + }, + { + "name": "days", + "type": { + "name": "int64" + } + }, + { + "name": "hour", + "type": { + "name": "timestamp" + } + }, + { + "name": "year", + "type": { + "name": "int64" + } + }, + { + "name": "day", + "type": { + "name": "date" + } + }, + { + "name": "epoch", + "type": { + "name": "int64" + } + }, + { + "name": "formatted", + "type": { + "name": "string" + } + } + ], + "params": [] + }, + { + "name": "Collections", + "cmd": ":many", + "columns": [ + { + "name": "n", + "type": { + "name": "int64" + } + }, + { + "name": "reversed", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + }, + { + "name": "series", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + }, + { + "name": "as_json", + "type": { + "name": "json" + } + }, + { + "name": "json_kind", + "type": { + "name": "string" + } + } + ], + "params": [] + }, + { + "name": "Counts", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "int64" + } + }, + { + "name": "named", + "type": { + "name": "int64" + } + }, + { + "name": "high", + "type": { + "name": "int64" + } + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_params/clickhouse/exec.json b/internal/endtoend/testdata/analyze_params/clickhouse/exec.json new file mode 100644 index 0000000000..c92bfa3dab --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/clickhouse/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "clickhouse", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_params/clickhouse/fixture.sql b/internal/endtoend/testdata/analyze_params/clickhouse/fixture.sql new file mode 100644 index 0000000000..f13ad59a8d --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/clickhouse/fixture.sql @@ -0,0 +1,2 @@ +INSERT INTO events (id, name, tag, amount, created) VALUES (1, 'signup', NULL, 9.5, '2024-01-01 00:00:00'); +INSERT INTO events (id, name, tag, amount, created) VALUES (2, 'login', 'web', 0.5, '2024-01-02 00:00:00'); diff --git a/internal/endtoend/testdata/analyze_params/clickhouse/query.sql b/internal/endtoend/testdata/analyze_params/clickhouse/query.sql new file mode 100644 index 0000000000..5405a5baa8 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/clickhouse/query.sql @@ -0,0 +1,5 @@ +-- name: GetEvent :one +SELECT id, name FROM events WHERE id = ?; + +-- name: FilterEvents :many +SELECT id, name FROM events WHERE name = ? AND amount > ?; diff --git a/internal/endtoend/testdata/analyze_params/clickhouse/schema.sql b/internal/endtoend/testdata/analyze_params/clickhouse/schema.sql new file mode 100644 index 0000000000..29960ee63d --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/clickhouse/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE events ( + id UInt64, + name String, + tag Nullable(String), + amount Float64, + created DateTime +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/analyze_params/clickhouse/stdout.json b/internal/endtoend/testdata/analyze_params/clickhouse/stdout.json new file mode 100644 index 0000000000..548bb8b7b1 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/clickhouse/stdout.json @@ -0,0 +1,76 @@ +[ + { + "name": "GetEvent", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + } + } + ] + }, + { + "name": "FilterEvents", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + }, + { + "number": 2, + "column": { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "events" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_params/duckdb/exec.json b/internal/endtoend/testdata/analyze_params/duckdb/exec.json new file mode 100644 index 0000000000..56cb4b3fff --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/duckdb/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_params/duckdb/query.sql b/internal/endtoend/testdata/analyze_params/duckdb/query.sql new file mode 100644 index 0000000000..ed26e54842 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/duckdb/query.sql @@ -0,0 +1,8 @@ +-- name: GetAuthor :one +SELECT id, name, bio FROM authors WHERE id = $1; + +-- name: FilterAuthors :many +SELECT id, name FROM authors WHERE name = $name AND royalties > $royalties; + +-- name: SearchAuthors :many +SELECT id FROM authors WHERE name LIKE ? AND bio IS NOT NULL; diff --git a/internal/endtoend/testdata/analyze_params/duckdb/schema.sql b/internal/endtoend/testdata/analyze_params/duckdb/schema.sql new file mode 100644 index 0000000000..48e852284e --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/duckdb/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT, + royalties DECIMAL(10,2) NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_params/duckdb/stdout.json b/internal/endtoend/testdata/analyze_params/duckdb/stdout.json new file mode 100644 index 0000000000..40037c23d5 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/duckdb/stdout.json @@ -0,0 +1,117 @@ +[ + { + "name": "GetAuthor", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + }, + { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "authors" + }, + { + "name": "bio", + "type": { + "name": "varchar", + "nullable": true + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + } + ] + }, + { + "name": "FilterAuthors", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + }, + { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "authors" + } + }, + { + "number": 2, + "column": { + "name": "royalties", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "authors" + } + } + ] + }, + { + "name": "SearchAuthors", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "authors" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_params/mssql/exec.json b/internal/endtoend/testdata/analyze_params/mssql/exec.json new file mode 100644 index 0000000000..253b05abbf --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/mssql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mssql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_params/mssql/query.sql b/internal/endtoend/testdata/analyze_params/mssql/query.sql new file mode 100644 index 0000000000..c410ec569a --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/mssql/query.sql @@ -0,0 +1,5 @@ +-- name: GetAuthor :one +SELECT id, name, bio FROM authors WHERE id = @id; + +-- name: FilterAuthors :many +SELECT id, name FROM authors WHERE name = @name AND royalties > @royalties; diff --git a/internal/endtoend/testdata/analyze_params/mssql/schema.sql b/internal/endtoend/testdata/analyze_params/mssql/schema.sql new file mode 100644 index 0000000000..3629635d2e --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/mssql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id BIGINT IDENTITY(1,1) PRIMARY KEY, + name NVARCHAR(100) NOT NULL, + bio NVARCHAR(MAX), + royalties DECIMAL(10,2) NOT NULL, + created DATETIME2 NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_params/mssql/stdout.json b/internal/endtoend/testdata/analyze_params/mssql/stdout.json new file mode 100644 index 0000000000..ab55aa9823 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/mssql/stdout.json @@ -0,0 +1,112 @@ +[ + { + "name": "GetAuthor", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + }, + { + "name": "name", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 100 + } + ] + }, + "table": "authors" + }, + { + "name": "bio", + "type": { + "name": "nvarchar", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + } + } + ] + }, + { + "name": "FilterAuthors", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "authors" + }, + { + "name": "name", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 100 + } + ] + }, + "table": "authors" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 100 + } + ] + }, + "table": "authors" + } + }, + { + "number": 2, + "column": { + "name": "royalties", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "authors" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_params/mysql/exec.json b/internal/endtoend/testdata/analyze_params/mysql/exec.json new file mode 100644 index 0000000000..a5b24d3361 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/mysql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mysql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_params/mysql/query.sql b/internal/endtoend/testdata/analyze_params/mysql/query.sql new file mode 100644 index 0000000000..83088a7dc6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/mysql/query.sql @@ -0,0 +1,8 @@ +-- name: GetUser :one +SELECT id, name FROM users WHERE id = ?; + +-- name: FilterUsers :many +SELECT id, name FROM users WHERE name = sqlc.arg(name) AND bio = sqlc.narg(bio); + +-- name: UsersByID :many +SELECT id, name FROM users WHERE id IN (sqlc.slice(ids)); diff --git a/internal/endtoend/testdata/analyze_params/mysql/schema.sql b/internal/endtoend/testdata/analyze_params/mysql/schema.sql new file mode 100644 index 0000000000..ad0d0c1bdd --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/mysql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id BIGINT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio TEXT +); + +CREATE TABLE posts ( + id BIGINT PRIMARY KEY, + user_id BIGINT NOT NULL, + title VARCHAR(255), + created DATETIME NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_params/mysql/stdout.json b/internal/endtoend/testdata/analyze_params/mysql/stdout.json new file mode 100644 index 0000000000..6232a4d26e --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/mysql/stdout.json @@ -0,0 +1,129 @@ +[ + { + "name": "GetUser", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + }, + { + "name": "FilterUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + } + ] + }, + { + "name": "UsersByID", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "ids", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_params/postgresql/exec.json b/internal/endtoend/testdata/analyze_params/postgresql/exec.json new file mode 100644 index 0000000000..b102755fb6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_params/postgresql/query.sql b/internal/endtoend/testdata/analyze_params/postgresql/query.sql new file mode 100644 index 0000000000..7dd9d17280 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/postgresql/query.sql @@ -0,0 +1,11 @@ +-- name: GetUser :one +SELECT id, name FROM users WHERE id = $1; + +-- name: FilterUsers :many +SELECT id, name FROM users WHERE name = sqlc.arg(name) AND bio = sqlc.narg(bio); + +-- name: UsersByID :many +SELECT id, name FROM users WHERE id = ANY(sqlc.slice(ids)); + +-- name: PostsBetween :many +SELECT id, title FROM posts WHERE created BETWEEN $1 AND $2; diff --git a/internal/endtoend/testdata/analyze_params/postgresql/schema.sql b/internal/endtoend/testdata/analyze_params/postgresql/schema.sql new file mode 100644 index 0000000000..897da6ceba --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/postgresql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE posts ( + id BIGSERIAL PRIMARY KEY, + user_id bigint NOT NULL, + title varchar(255), + created timestamptz NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_params/postgresql/stdout.json b/internal/endtoend/testdata/analyze_params/postgresql/stdout.json new file mode 100644 index 0000000000..fd46e40a84 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/postgresql/stdout.json @@ -0,0 +1,157 @@ +[ + { + "name": "GetUser", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + }, + { + "name": "FilterUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + } + ] + }, + { + "name": "UsersByID", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "ids", + "type": { + "name": "bigint" + }, + "table": "users" + } + } + ] + }, + { + "name": "PostsBetween", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "character varying", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "created", + "type": { + "name": "timestamp with time zone" + }, + "table": "posts" + } + }, + { + "number": 2, + "column": { + "name": "created", + "type": { + "name": "timestamp with time zone" + }, + "table": "posts" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_params/sqlite/exec.json b/internal/endtoend/testdata/analyze_params/sqlite/exec.json new file mode 100644 index 0000000000..aa77909cb2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/sqlite/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "sqlite", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_params/sqlite/query.sql b/internal/endtoend/testdata/analyze_params/sqlite/query.sql new file mode 100644 index 0000000000..782c3fb71b --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/sqlite/query.sql @@ -0,0 +1,8 @@ +-- name: GetUser :one +SELECT id, name FROM users WHERE id = ?; + +-- name: FilterUsers :many +SELECT id, name FROM users WHERE name = sqlc.arg(name) AND bio = sqlc.narg(bio); + +-- name: CountPosts :one +SELECT count(*) AS total FROM posts WHERE user_id = ?; diff --git a/internal/endtoend/testdata/analyze_params/sqlite/schema.sql b/internal/endtoend/testdata/analyze_params/sqlite/schema.sql new file mode 100644 index 0000000000..7fc8892e61 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/sqlite/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +CREATE TABLE posts ( + id INTEGER PRIMARY KEY, + user_id INTEGER NOT NULL, + title TEXT, + created TEXT NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_params/sqlite/stdout.json b/internal/endtoend/testdata/analyze_params/sqlite/stdout.json new file mode 100644 index 0000000000..fd0e721573 --- /dev/null +++ b/internal/endtoend/testdata/analyze_params/sqlite/stdout.json @@ -0,0 +1,101 @@ +[ + { + "name": "GetUser", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + } + } + ] + }, + { + "name": "FilterUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + }, + { + "number": 2, + "column": { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + } + ] + }, + { + "name": "CountPosts", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "integer" + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "user_id", + "type": { + "name": "integer" + }, + "table": "posts" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_percent_offset/duckdb/exec.json b/internal/endtoend/testdata/analyze_percent_offset/duckdb/exec.json new file mode 100644 index 0000000000..56cb4b3fff --- /dev/null +++ b/internal/endtoend/testdata/analyze_percent_offset/duckdb/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_percent_offset/duckdb/query.sql b/internal/endtoend/testdata/analyze_percent_offset/duckdb/query.sql new file mode 100644 index 0000000000..7ed1e63ce2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_percent_offset/duckdb/query.sql @@ -0,0 +1,2 @@ +-- name: Page :many +SELECT id FROM readings ORDER BY id LIMIT 50% OFFSET $1; diff --git a/internal/endtoend/testdata/analyze_percent_offset/duckdb/schema.sql b/internal/endtoend/testdata/analyze_percent_offset/duckdb/schema.sql new file mode 100644 index 0000000000..3e3f10ca86 --- /dev/null +++ b/internal/endtoend/testdata/analyze_percent_offset/duckdb/schema.sql @@ -0,0 +1 @@ +CREATE TABLE readings (id INTEGER NOT NULL); diff --git a/internal/endtoend/testdata/analyze_percent_offset/duckdb/stdout.json b/internal/endtoend/testdata/analyze_percent_offset/duckdb/stdout.json new file mode 100644 index 0000000000..492b8a3ac8 --- /dev/null +++ b/internal/endtoend/testdata/analyze_percent_offset/duckdb/stdout.json @@ -0,0 +1,26 @@ +[ + { + "name": "Page", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "readings" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "", + "type": { + "name": "integer" + } + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_rowid/duckdb/exec.json b/internal/endtoend/testdata/analyze_rowid/duckdb/exec.json new file mode 100644 index 0000000000..56cb4b3fff --- /dev/null +++ b/internal/endtoend/testdata/analyze_rowid/duckdb/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_rowid/duckdb/query.sql b/internal/endtoend/testdata/analyze_rowid/duckdb/query.sql new file mode 100644 index 0000000000..3ea6c375b4 --- /dev/null +++ b/internal/endtoend/testdata/analyze_rowid/duckdb/query.sql @@ -0,0 +1,26 @@ +-- name: ListPlanRowIDs :many +SELECT rowid, id FROM plan; + +-- name: ListQualifiedPlanRowIDs :many +SELECT p.rowid, p.id FROM plan p ORDER BY p.rowid; + +-- name: GetPlanByRowID :one +SELECT id FROM plan WHERE rowid = $1; + +-- name: ListPlans :many +SELECT * FROM plan ORDER BY rowid; + +-- name: CreatePlan :exec +INSERT INTO plan VALUES ($1, $2, $3); + +-- name: UpdatePlanPrice :exec +UPDATE plan SET price = $1 WHERE rowid = $2; + +-- name: DeletePlan :one +DELETE FROM plan WHERE rowid = $1 RETURNING *; + +-- name: ListLedger :many +SELECT * FROM ledger; + +-- name: GetLedgerAmount :one +SELECT amount FROM ledger WHERE rowid = $1; diff --git a/internal/endtoend/testdata/analyze_rowid/duckdb/schema.sql b/internal/endtoend/testdata/analyze_rowid/duckdb/schema.sql new file mode 100644 index 0000000000..53d9f2ab99 --- /dev/null +++ b/internal/endtoend/testdata/analyze_rowid/duckdb/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE plan ( + id UUID NOT NULL, + ship_size VARCHAR NOT NULL, + price DOUBLE +); + +-- A declared column takes the place of the pseudo-column. +CREATE TABLE ledger ( + rowid VARCHAR NOT NULL, + amount INTEGER +); diff --git a/internal/endtoend/testdata/analyze_rowid/duckdb/stdout.json b/internal/endtoend/testdata/analyze_rowid/duckdb/stdout.json new file mode 100644 index 0000000000..aa69694d50 --- /dev/null +++ b/internal/endtoend/testdata/analyze_rowid/duckdb/stdout.json @@ -0,0 +1,257 @@ +[ + { + "name": "ListPlanRowIDs", + "cmd": ":many", + "columns": [ + { + "name": "rowid", + "type": { + "name": "bigint", + "nullable": true + }, + "table": "plan" + }, + { + "name": "id", + "type": { + "name": "uuid" + }, + "table": "plan" + } + ], + "params": [] + }, + { + "name": "ListQualifiedPlanRowIDs", + "cmd": ":many", + "columns": [ + { + "name": "rowid", + "type": { + "name": "bigint", + "nullable": true + }, + "table": "plan" + }, + { + "name": "id", + "type": { + "name": "uuid" + }, + "table": "plan" + } + ], + "params": [] + }, + { + "name": "GetPlanByRowID", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "uuid" + }, + "table": "plan" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "rowid", + "type": { + "name": "bigint", + "nullable": true + }, + "table": "plan" + } + } + ] + }, + { + "name": "ListPlans", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uuid" + }, + "table": "plan" + }, + { + "name": "ship_size", + "type": { + "name": "varchar" + }, + "table": "plan" + }, + { + "name": "price", + "type": { + "name": "double", + "nullable": true + }, + "table": "plan" + } + ], + "params": [] + }, + { + "name": "CreatePlan", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "type": { + "name": "uuid" + }, + "table": "plan" + } + }, + { + "number": 2, + "column": { + "name": "ship_size", + "type": { + "name": "varchar" + }, + "table": "plan" + } + }, + { + "number": 3, + "column": { + "name": "price", + "type": { + "name": "double", + "nullable": true + }, + "table": "plan" + } + } + ] + }, + { + "name": "UpdatePlanPrice", + "cmd": ":exec", + "columns": [], + "params": [ + { + "number": 1, + "column": { + "name": "price", + "type": { + "name": "double", + "nullable": true + }, + "table": "plan" + } + }, + { + "number": 2, + "column": { + "name": "rowid", + "type": { + "name": "bigint", + "nullable": true + }, + "table": "plan" + } + } + ] + }, + { + "name": "DeletePlan", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "uuid" + }, + "table": "plan" + }, + { + "name": "ship_size", + "type": { + "name": "varchar" + }, + "table": "plan" + }, + { + "name": "price", + "type": { + "name": "double", + "nullable": true + }, + "table": "plan" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "rowid", + "type": { + "name": "bigint", + "nullable": true + }, + "table": "plan" + } + } + ] + }, + { + "name": "ListLedger", + "cmd": ":many", + "columns": [ + { + "name": "rowid", + "type": { + "name": "varchar" + }, + "table": "ledger" + }, + { + "name": "amount", + "type": { + "name": "integer", + "nullable": true + }, + "table": "ledger" + } + ], + "params": [] + }, + { + "name": "GetLedgerAmount", + "cmd": ":one", + "columns": [ + { + "name": "amount", + "type": { + "name": "integer", + "nullable": true + }, + "table": "ledger" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "rowid", + "type": { + "name": "varchar" + }, + "table": "ledger" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_select/duckdb/exec.json b/internal/endtoend/testdata/analyze_select/duckdb/exec.json new file mode 100644 index 0000000000..56cb4b3fff --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/duckdb/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_select/duckdb/query.sql b/internal/endtoend/testdata/analyze_select/duckdb/query.sql new file mode 100644 index 0000000000..794d153640 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/duckdb/query.sql @@ -0,0 +1,16 @@ +-- name: ListUsers :many +SELECT * FROM users; + +-- name: CountUsers :one +SELECT count(*) AS total FROM users; + +-- name: ListUserPosts :many +SELECT u.name, p.* FROM users u JOIN posts p ON p.user_id = u.id WHERE u.name = $1; + +-- name: TopUsers :many +WITH counts AS ( + SELECT user_id, count(*) AS n FROM posts GROUP BY user_id +) +SELECT u.name, c.n FROM users u JOIN counts c ON c.user_id = u.id +ORDER BY c.n DESC +LIMIT 5; diff --git a/internal/endtoend/testdata/analyze_select/duckdb/schema.sql b/internal/endtoend/testdata/analyze_select/duckdb/schema.sql new file mode 100644 index 0000000000..b69cc33d22 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/duckdb/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id BIGINT NOT NULL, + name TEXT NOT NULL, + age INTEGER +); + +CREATE TABLE posts ( + id BIGINT NOT NULL, + user_id BIGINT NOT NULL, + title TEXT NOT NULL, + body TEXT +); diff --git a/internal/endtoend/testdata/analyze_select/duckdb/stdout.json b/internal/endtoend/testdata/analyze_select/duckdb/stdout.json new file mode 100644 index 0000000000..e0744b9ecd --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/duckdb/stdout.json @@ -0,0 +1,118 @@ +[ + { + "name": "ListUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "users" + }, + { + "name": "age", + "type": { + "name": "integer", + "nullable": true + }, + "table": "users" + } + ], + "params": [] + }, + { + "name": "CountUsers", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "bigint" + } + } + ], + "params": [] + }, + { + "name": "ListUserPosts", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "users" + }, + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "user_id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "varchar" + }, + "table": "posts" + }, + { + "name": "body", + "type": { + "name": "varchar", + "nullable": true + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "users" + } + } + ] + }, + { + "name": "TopUsers", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "varchar" + }, + "table": "users" + }, + { + "name": "n", + "type": { + "name": "bigint" + } + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_select/googlesql/exec.json b/internal/endtoend/testdata/analyze_select/googlesql/exec.json new file mode 100644 index 0000000000..a53ddddc6d --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/googlesql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_select/googlesql/query.sql b/internal/endtoend/testdata/analyze_select/googlesql/query.sql new file mode 100644 index 0000000000..b4e7756130 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/googlesql/query.sql @@ -0,0 +1,8 @@ +-- name: ListUsers :many +SELECT * FROM users; + +-- name: CountUsers :one +SELECT COUNT(*) AS total FROM users; + +-- name: ListUserPosts :many +SELECT u.name, p.* FROM users u JOIN posts p ON p.user_id = u.id WHERE u.name = @name; diff --git a/internal/endtoend/testdata/analyze_select/googlesql/schema.sql b/internal/endtoend/testdata/analyze_select/googlesql/schema.sql new file mode 100644 index 0000000000..0c5bc523f9 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/googlesql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + bio STRING(MAX), +) PRIMARY KEY (id); + +CREATE TABLE posts ( + id INT64 NOT NULL, + user_id INT64 NOT NULL, + title STRING(255), + created TIMESTAMP NOT NULL, +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_select/googlesql/stdout.json b/internal/endtoend/testdata/analyze_select/googlesql/stdout.json new file mode 100644 index 0000000000..919d31369c --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/googlesql/stdout.json @@ -0,0 +1,123 @@ +[ + { + "name": "ListUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + }, + { + "name": "bio", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + ], + "params": [] + }, + { + "name": "CountUsers", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "int64" + } + } + ], + "params": [] + }, + { + "name": "ListUserPosts", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + }, + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "posts" + }, + { + "name": "user_id", + "type": { + "name": "int64" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "posts" + }, + { + "name": "created", + "type": { + "name": "timestamp" + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + }, + "table": "users" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_select/mysql/exec.json b/internal/endtoend/testdata/analyze_select/mysql/exec.json new file mode 100644 index 0000000000..a5b24d3361 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/mysql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mysql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_select/mysql/query.sql b/internal/endtoend/testdata/analyze_select/mysql/query.sql new file mode 100644 index 0000000000..ff6b716b43 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/mysql/query.sql @@ -0,0 +1,17 @@ +-- name: ListUsers :many +SELECT * FROM users; + +-- name: CountUsers :one +SELECT count(*) AS total FROM users; + +-- name: ListUserPosts :many +SELECT u.name, p.* FROM users u JOIN posts p ON p.user_id = u.id WHERE u.name = ?; + +-- name: SearchPosts :many +SELECT id, title FROM posts WHERE title LIKE ? AND created > ?; + +-- name: LatestPostPerUser :many +WITH latest AS ( + SELECT user_id, max(created) AS created FROM posts GROUP BY user_id +) +SELECT u.name, latest.created FROM users u JOIN latest ON latest.user_id = u.id; diff --git a/internal/endtoend/testdata/analyze_select/mysql/schema.sql b/internal/endtoend/testdata/analyze_select/mysql/schema.sql new file mode 100644 index 0000000000..ad0d0c1bdd --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/mysql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id BIGINT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio TEXT +); + +CREATE TABLE posts ( + id BIGINT PRIMARY KEY, + user_id BIGINT NOT NULL, + title VARCHAR(255), + created DATETIME NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_select/mysql/stdout.json b/internal/endtoend/testdata/analyze_select/mysql/stdout.json new file mode 100644 index 0000000000..3e679fd261 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/mysql/stdout.json @@ -0,0 +1,198 @@ +[ + { + "name": "ListUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + }, + { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + ], + "params": [] + }, + { + "name": "CountUsers", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "bigint" + } + } + ], + "params": [] + }, + { + "name": "ListUserPosts", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + }, + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "user_id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "posts" + }, + { + "name": "created", + "type": { + "name": "datetime" + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + } + } + ] + }, + { + "name": "SearchPosts", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "title", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "posts" + } + }, + { + "number": 2, + "column": { + "name": "created", + "type": { + "name": "datetime" + }, + "table": "posts" + } + } + ] + }, + { + "name": "LatestPostPerUser", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "varchar", + "args": [ + { + "int": 255 + } + ] + }, + "table": "users" + }, + { + "name": "created", + "type": { + "name": "datetime", + "nullable": true + } + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_select/postgresql/exec.json b/internal/endtoend/testdata/analyze_select/postgresql/exec.json new file mode 100644 index 0000000000..b102755fb6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_select/postgresql/query.sql b/internal/endtoend/testdata/analyze_select/postgresql/query.sql new file mode 100644 index 0000000000..d11618b0d4 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/postgresql/query.sql @@ -0,0 +1,17 @@ +-- name: ListUsers :many +SELECT * FROM users; + +-- name: CountUsers :one +SELECT count(*) AS total FROM users; + +-- name: ListUserPosts :many +SELECT u.name, p.* FROM users u JOIN posts p ON p.user_id = u.id WHERE u.name = $1; + +-- name: SearchPosts :many +SELECT id, title FROM posts WHERE title LIKE $1 AND created > $2; + +-- name: LatestPostPerUser :many +WITH latest AS ( + SELECT user_id, max(created) AS created FROM posts GROUP BY user_id +) +SELECT u.name, latest.created FROM users u JOIN latest ON latest.user_id = u.id; diff --git a/internal/endtoend/testdata/analyze_select/postgresql/schema.sql b/internal/endtoend/testdata/analyze_select/postgresql/schema.sql new file mode 100644 index 0000000000..897da6ceba --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/postgresql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE posts ( + id BIGSERIAL PRIMARY KEY, + user_id bigint NOT NULL, + title varchar(255), + created timestamptz NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_select/postgresql/stdout.json b/internal/endtoend/testdata/analyze_select/postgresql/stdout.json new file mode 100644 index 0000000000..95f2d691a6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/postgresql/stdout.json @@ -0,0 +1,177 @@ +[ + { + "name": "ListUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + }, + { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + ], + "params": [] + }, + { + "name": "CountUsers", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "bigint" + } + } + ], + "params": [] + }, + { + "name": "ListUserPosts", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + }, + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "user_id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "character varying", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "posts" + }, + { + "name": "created", + "type": { + "name": "timestamp with time zone" + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + } + ] + }, + { + "name": "SearchPosts", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "character varying", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "title", + "type": { + "name": "character varying", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "posts" + } + }, + { + "number": 2, + "column": { + "name": "created", + "type": { + "name": "timestamp with time zone" + }, + "table": "posts" + } + } + ] + }, + { + "name": "LatestPostPerUser", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + }, + { + "name": "created", + "type": { + "name": "timestamp with time zone" + } + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_select/sqlite/exec.json b/internal/endtoend/testdata/analyze_select/sqlite/exec.json new file mode 100644 index 0000000000..aa77909cb2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/sqlite/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "sqlite", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_select/sqlite/query.sql b/internal/endtoend/testdata/analyze_select/sqlite/query.sql new file mode 100644 index 0000000000..985fc6d869 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/sqlite/query.sql @@ -0,0 +1,11 @@ +-- name: ListUsers :many +SELECT * FROM users; + +-- name: CountUsers :one +SELECT count(*) AS total FROM users; + +-- name: ListUserPosts :many +SELECT u.name, p.* FROM users u JOIN posts p ON p.user_id = u.id WHERE u.name = ?; + +-- name: SearchPosts :many +SELECT id, title FROM posts WHERE title LIKE ? AND created > ?; diff --git a/internal/endtoend/testdata/analyze_select/sqlite/schema.sql b/internal/endtoend/testdata/analyze_select/sqlite/schema.sql new file mode 100644 index 0000000000..7fc8892e61 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/sqlite/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE users ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT +); + +CREATE TABLE posts ( + id INTEGER PRIMARY KEY, + user_id INTEGER NOT NULL, + title TEXT, + created TEXT NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_select/sqlite/stdout.json b/internal/endtoend/testdata/analyze_select/sqlite/stdout.json new file mode 100644 index 0000000000..032d947426 --- /dev/null +++ b/internal/endtoend/testdata/analyze_select/sqlite/stdout.json @@ -0,0 +1,142 @@ +[ + { + "name": "ListUsers", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "users" + }, + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + }, + { + "name": "bio", + "type": { + "name": "text", + "nullable": true + }, + "table": "users" + } + ], + "params": [] + }, + { + "name": "CountUsers", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "integer" + } + } + ], + "params": [] + }, + { + "name": "ListUserPosts", + "cmd": ":many", + "columns": [ + { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + }, + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "posts" + }, + { + "name": "user_id", + "type": { + "name": "integer" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "text", + "nullable": true + }, + "table": "posts" + }, + { + "name": "created", + "type": { + "name": "text" + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "name", + "type": { + "name": "text" + }, + "table": "users" + } + } + ] + }, + { + "name": "SearchPosts", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "posts" + }, + { + "name": "title", + "type": { + "name": "text", + "nullable": true + }, + "table": "posts" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "title", + "type": { + "name": "text", + "nullable": true + }, + "table": "posts" + } + }, + { + "number": 2, + "column": { + "name": "created", + "type": { + "name": "text" + }, + "table": "posts" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_subqueries/clickhouse/exec.json b/internal/endtoend/testdata/analyze_subqueries/clickhouse/exec.json new file mode 100644 index 0000000000..c92bfa3dab --- /dev/null +++ b/internal/endtoend/testdata/analyze_subqueries/clickhouse/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "clickhouse", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_subqueries/clickhouse/fixture.sql b/internal/endtoend/testdata/analyze_subqueries/clickhouse/fixture.sql new file mode 100644 index 0000000000..9adc5fa938 --- /dev/null +++ b/internal/endtoend/testdata/analyze_subqueries/clickhouse/fixture.sql @@ -0,0 +1,2 @@ +INSERT INTO events VALUES (1, 'signup', NULL, 9.5), (2, 'login', 'web', 0.5); +INSERT INTO users VALUES (1, 'a@example.com'); diff --git a/internal/endtoend/testdata/analyze_subqueries/clickhouse/query.sql b/internal/endtoend/testdata/analyze_subqueries/clickhouse/query.sql new file mode 100644 index 0000000000..601ba8e146 --- /dev/null +++ b/internal/endtoend/testdata/analyze_subqueries/clickhouse/query.sql @@ -0,0 +1,27 @@ +-- name: Aliased :many +SELECT s.x, s.total, s.email +FROM ( + SELECT e.id AS x, sum(e.amount) AS total, any(u.email) AS email + FROM events e JOIN users u ON u.id = e.id + GROUP BY e.id +) s; + +-- name: Union :many +SELECT id, name FROM events +UNION ALL +SELECT id, email FROM users; + +-- name: ScalarSubquery :many +SELECT id, (SELECT count() FROM users) AS user_count +FROM events +WHERE id IN (SELECT id FROM users WHERE email = ?); + + +-- name: Cte :many +WITH t AS (SELECT id, tag FROM events) +SELECT t.id, t.tag, s.cnt +FROM t +JOIN (SELECT id, count() AS cnt FROM events GROUP BY id) s ON s.id = t.id; + +-- name: Star :many +SELECT * FROM users u JOIN events e ON e.id = u.id; diff --git a/internal/endtoend/testdata/analyze_subqueries/clickhouse/schema.sql b/internal/endtoend/testdata/analyze_subqueries/clickhouse/schema.sql new file mode 100644 index 0000000000..9c04e10685 --- /dev/null +++ b/internal/endtoend/testdata/analyze_subqueries/clickhouse/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE events ( + id UInt64, + name String, + tag Nullable(String), + amount Float64 +) ENGINE = MergeTree ORDER BY id; + +CREATE TABLE users ( + id UInt64, + email String +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/analyze_subqueries/clickhouse/stdout.json b/internal/endtoend/testdata/analyze_subqueries/clickhouse/stdout.json new file mode 100644 index 0000000000..bc4f0ec8e9 --- /dev/null +++ b/internal/endtoend/testdata/analyze_subqueries/clickhouse/stdout.json @@ -0,0 +1,159 @@ +[ + { + "name": "Aliased", + "cmd": ":many", + "columns": [ + { + "name": "x", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "total", + "type": { + "name": "float64" + } + }, + { + "name": "email", + "type": { + "name": "string" + } + } + ], + "params": [] + }, + { + "name": "Union", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + } + ], + "params": [] + }, + { + "name": "ScalarSubquery", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "user_count", + "type": { + "name": "uint64", + "nullable": true + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "email", + "type": { + "name": "string" + }, + "table": "users" + } + } + ] + }, + { + "name": "Cte", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "tag", + "type": { + "name": "string", + "nullable": true + }, + "table": "events" + }, + { + "name": "cnt", + "type": { + "name": "uint64" + } + } + ], + "params": [] + }, + { + "name": "Star", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "users" + }, + { + "name": "email", + "type": { + "name": "string" + }, + "table": "users" + }, + { + "name": "e.id", + "type": { + "name": "uint64" + }, + "table": "events" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "events" + }, + { + "name": "tag", + "type": { + "name": "string", + "nullable": true + }, + "table": "events" + }, + { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "events" + } + ], + "params": [] + } +] diff --git a/internal/endtoend/testdata/analyze_system_catalog/mysql/exec.json b/internal/endtoend/testdata/analyze_system_catalog/mysql/exec.json new file mode 100644 index 0000000000..a5b24d3361 --- /dev/null +++ b/internal/endtoend/testdata/analyze_system_catalog/mysql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mysql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_system_catalog/mysql/query.sql b/internal/endtoend/testdata/analyze_system_catalog/mysql/query.sql new file mode 100644 index 0000000000..9dd9fd3cef --- /dev/null +++ b/internal/endtoend/testdata/analyze_system_catalog/mysql/query.sql @@ -0,0 +1,7 @@ +-- name: ListColumns :many +SELECT table_name, column_name, data_type +FROM information_schema.columns +WHERE table_schema = ?; + +-- name: CountTables :one +SELECT count(*) AS total FROM information_schema.tables WHERE table_type = ?; diff --git a/internal/endtoend/testdata/analyze_system_catalog/mysql/schema.sql b/internal/endtoend/testdata/analyze_system_catalog/mysql/schema.sql new file mode 100644 index 0000000000..8ef7dadfce --- /dev/null +++ b/internal/endtoend/testdata/analyze_system_catalog/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name VARCHAR(255) NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_system_catalog/mysql/stdout.json b/internal/endtoend/testdata/analyze_system_catalog/mysql/stdout.json new file mode 100644 index 0000000000..134b5b11f8 --- /dev/null +++ b/internal/endtoend/testdata/analyze_system_catalog/mysql/stdout.json @@ -0,0 +1,93 @@ +[ + { + "name": "ListColumns", + "cmd": ":many", + "columns": [ + { + "name": "table_name", + "type": { + "name": "varchar", + "args": [ + { + "int": 64 + } + ] + }, + "table": "columns" + }, + { + "name": "column_name", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 64 + } + ] + }, + "table": "columns" + }, + { + "name": "data_type", + "type": { + "name": "longtext", + "nullable": true + }, + "table": "columns" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "table_schema", + "type": { + "name": "varchar", + "args": [ + { + "int": 64 + } + ] + }, + "table": "columns" + } + } + ] + }, + { + "name": "CountTables", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "bigint" + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "table_type", + "type": { + "name": "enum", + "args": [ + { + "string": "BASE TABLE" + }, + { + "string": "VIEW" + }, + { + "string": "SYSTEM VIEW" + } + ] + }, + "table": "tables" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_system_catalog/postgresql/exec.json b/internal/endtoend/testdata/analyze_system_catalog/postgresql/exec.json new file mode 100644 index 0000000000..b102755fb6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_system_catalog/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_system_catalog/postgresql/query.sql b/internal/endtoend/testdata/analyze_system_catalog/postgresql/query.sql new file mode 100644 index 0000000000..19822f9265 --- /dev/null +++ b/internal/endtoend/testdata/analyze_system_catalog/postgresql/query.sql @@ -0,0 +1,7 @@ +-- name: ListColumns :many +SELECT table_name, column_name, data_type +FROM information_schema.columns +WHERE table_schema = $1; + +-- name: CountRelations :one +SELECT count(*) AS total FROM pg_catalog.pg_class WHERE relkind = $1; diff --git a/internal/endtoend/testdata/analyze_system_catalog/postgresql/schema.sql b/internal/endtoend/testdata/analyze_system_catalog/postgresql/schema.sql new file mode 100644 index 0000000000..f05417f981 --- /dev/null +++ b/internal/endtoend/testdata/analyze_system_catalog/postgresql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL +); diff --git a/internal/endtoend/testdata/analyze_system_catalog/postgresql/stdout.json b/internal/endtoend/testdata/analyze_system_catalog/postgresql/stdout.json new file mode 100644 index 0000000000..dc48b00653 --- /dev/null +++ b/internal/endtoend/testdata/analyze_system_catalog/postgresql/stdout.json @@ -0,0 +1,69 @@ +[ + { + "name": "ListColumns", + "cmd": ":many", + "columns": [ + { + "name": "table_name", + "type": { + "name": "sql_identifier", + "nullable": true + }, + "table": "columns" + }, + { + "name": "column_name", + "type": { + "name": "sql_identifier", + "nullable": true + }, + "table": "columns" + }, + { + "name": "data_type", + "type": { + "name": "character_data", + "nullable": true + }, + "table": "columns" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "table_schema", + "type": { + "name": "sql_identifier", + "nullable": true + }, + "table": "columns" + } + } + ] + }, + { + "name": "CountRelations", + "cmd": ":one", + "columns": [ + { + "name": "total", + "type": { + "name": "bigint" + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "relkind", + "type": { + "name": "character" + }, + "table": "pg_class" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/bigquery/exec.json b/internal/endtoend/testdata/analyze_types/bigquery/exec.json new file mode 100644 index 0000000000..a53ddddc6d --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/bigquery/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/bigquery/query.sql b/internal/endtoend/testdata/analyze_types/bigquery/query.sql new file mode 100644 index 0000000000..c798e56371 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/bigquery/query.sql @@ -0,0 +1,16 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + CAST(@a AS NUMERIC(5,2)) AS a, + CAST(@b AS ARRAY) AS b, + CAST(@c AS STRUCT) AS c, + CAST(@d AS STRING(5)) AS d, + SAFE_CAST(@e AS BIGNUMERIC) AS e, + [1, 2] AS f +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE s = @s AND ai = @ai AND n = @n AND st = @st AND smax = @smax; diff --git a/internal/endtoend/testdata/analyze_types/bigquery/schema.sql b/internal/endtoend/testdata/analyze_types/bigquery/schema.sql new file mode 100644 index 0000000000..feb846800a --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/bigquery/schema.sql @@ -0,0 +1,21 @@ +CREATE TABLE things ( + id INT64 NOT NULL, + s STRING(10), + smax STRING(MAX), + n NUMERIC(10,2), + bn BIGNUMERIC, + byt BYTES(MAX), + ai ARRAY, + as2 ARRAY, + st STRUCT
, + ast ARRAY>, + ts TIMESTAMP, + d DATE, + j JSON, + g GEOGRAPHY, + iv INTERVAL, + b BOOL, + f FLOAT64, + f32 FLOAT32, + tl TOKENLIST +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_types/bigquery/stdout.json b/internal/endtoend/testdata/analyze_types/bigquery/stdout.json new file mode 100644 index 0000000000..34ebaf0b24 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/bigquery/stdout.json @@ -0,0 +1,492 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "things" + }, + { + "name": "s", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + }, + { + "name": "smax", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + }, + { + "name": "n", + "type": { + "name": "numeric", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "bn", + "type": { + "name": "bignumeric", + "nullable": true + }, + "table": "things" + }, + { + "name": "byt", + "type": { + "name": "bytes", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + }, + { + "name": "ai", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "int64" + } + } + ] + }, + "table": "things" + }, + { + "name": "as2", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "st", + "type": { + "name": "struct", + "nullable": true, + "args": [ + { + "label": "a", + "type": { + "name": "int64" + } + }, + { + "label": "b", + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "ast", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "struct", + "args": [ + { + "label": "x", + "type": { + "name": "int64" + } + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "ts", + "type": { + "name": "timestamp", + "nullable": true + }, + "table": "things" + }, + { + "name": "d", + "type": { + "name": "date", + "nullable": true + }, + "table": "things" + }, + { + "name": "j", + "type": { + "name": "json", + "nullable": true + }, + "table": "things" + }, + { + "name": "g", + "type": { + "name": "geography", + "nullable": true + }, + "table": "things" + }, + { + "name": "iv", + "type": { + "name": "interval", + "nullable": true + }, + "table": "things" + }, + { + "name": "b", + "type": { + "name": "bool", + "nullable": true + }, + "table": "things" + }, + { + "name": "f", + "type": { + "name": "float64", + "nullable": true + }, + "table": "things" + }, + { + "name": "f32", + "type": { + "name": "float32", + "nullable": true + }, + "table": "things" + }, + { + "name": "tl", + "type": { + "name": "tokenlist", + "nullable": true + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "numeric", + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + }, + { + "name": "b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + }, + { + "name": "c", + "type": { + "name": "struct", + "args": [ + { + "label": "x", + "type": { + "name": "int64" + } + } + ] + } + }, + { + "name": "d", + "type": { + "name": "string", + "args": [ + { + "int": 5 + } + ] + } + }, + { + "name": "e", + "type": { + "name": "bignumeric" + } + }, + { + "name": "f", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "a", + "type": { + "name": "numeric", + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + } + }, + { + "number": 2, + "column": { + "name": "b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + } + }, + { + "number": 3, + "column": { + "name": "c", + "type": { + "name": "struct", + "args": [ + { + "label": "x", + "type": { + "name": "int64" + } + } + ] + } + } + }, + { + "number": 4, + "column": { + "name": "d", + "type": { + "name": "string", + "args": [ + { + "int": 5 + } + ] + } + } + }, + { + "number": 5, + "column": { + "name": "e", + "type": { + "name": "bignumeric" + } + } + } + ] + }, + { + "name": "Params", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "s", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "ai", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "int64" + } + } + ] + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "n", + "type": { + "name": "numeric", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "st", + "type": { + "name": "struct", + "nullable": true, + "args": [ + { + "label": "a", + "type": { + "name": "int64" + } + }, + { + "label": "b", + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + } + }, + { + "number": 5, + "column": { + "name": "smax", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/clickhouse/exec.json b/internal/endtoend/testdata/analyze_types/clickhouse/exec.json new file mode 100644 index 0000000000..c92bfa3dab --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/clickhouse/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "clickhouse", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/clickhouse/fixture.sql b/internal/endtoend/testdata/analyze_types/clickhouse/fixture.sql new file mode 100644 index 0000000000..d4353b2dc8 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/clickhouse/fixture.sql @@ -0,0 +1 @@ +INSERT INTO things VALUES (1, 'a', NULL, 1.5, ['x'], [NULL, 'y'], [[1, 2]], 'k', '2024-01-01 00:00:00', '2024-01-01 00:00:00.123', 1.25, 'active', {'k': 1}, (1.0, 2.0), (51.5, -0.1), {'a': NULL}, '127.0.0.1', '00000000-0000-0000-0000-000000000000', 'abcd', true, 1.5, 'x', 'v', [1], ['s'], 3, 7); diff --git a/internal/endtoend/testdata/analyze_types/clickhouse/query.sql b/internal/endtoend/testdata/analyze_types/clickhouse/query.sql new file mode 100644 index 0000000000..8a4ff3e8be --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/clickhouse/query.sql @@ -0,0 +1,19 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: StarColumns :many +SELECT id, name, tag, amount, tags, labels, matrix, kind, created, updated, price, status, attrs, pos, geo, scores, ip, uid, fixed, flag, small, plain, either, n.a, n.b, total, whole FROM things; + +-- name: Casts :one +SELECT + CAST(id AS String) AS a, + toDecimal64(id, 4) AS b, + CAST(name AS Nullable(String)) AS c, + toDateTime64(created, 3) AS d, + CAST(tags AS Array(String)) AS e, + CAST(tag AS Nullable(String)) AS f +FROM things; + +-- name: Placeholders :many +SELECT id FROM things +WHERE id = {p1:UInt64} AND name = {p2:String} AND amount > {p3:Float64} AND tag = {p4:Nullable(String)} AND price = {p5:Decimal(10, 2)}; diff --git a/internal/endtoend/testdata/analyze_types/clickhouse/schema.sql b/internal/endtoend/testdata/analyze_types/clickhouse/schema.sql new file mode 100644 index 0000000000..1dddddd5c9 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/clickhouse/schema.sql @@ -0,0 +1,28 @@ +CREATE TABLE things ( + id UInt64, + name String, + tag Nullable(String), + amount Float64, + tags Array(String), + labels Array(Nullable(String)), + matrix Array(Array(UInt8)), + kind LowCardinality(Nullable(String)), + created DateTime, + updated DateTime64(3, 'UTC'), + price Decimal(10, 2), + status Enum8('active' = 1, 'deleted' = 2), + attrs Map(String, UInt32), + pos Tuple(Float64, Float64), + geo Tuple(lat Float64, lon Float64), + scores Map(String, Nullable(UInt8)), + ip IPv4, + uid UUID, + fixed FixedString(4), + flag Bool, + small Decimal32(4), + plain Enum('x', 'y'), + either Variant(String, Int64), + n Nested(a UInt8, b String), + total SimpleAggregateFunction(sum, UInt64), + whole INT +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/analyze_types/clickhouse/stdout.json b/internal/endtoend/testdata/analyze_types/clickhouse/stdout.json new file mode 100644 index 0000000000..9c597de0c0 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/clickhouse/stdout.json @@ -0,0 +1,881 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "things" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "things" + }, + { + "name": "tag", + "type": { + "name": "string", + "nullable": true + }, + "table": "things" + }, + { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "things" + }, + { + "name": "tags", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "labels", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string", + "nullable": true + } + } + ] + }, + "table": "things" + }, + { + "name": "matrix", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "uint8" + } + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "kind", + "type": { + "name": "lowcardinality", + "nullable": true, + "args": [ + { + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "created", + "type": { + "name": "datetime" + }, + "table": "things" + }, + { + "name": "updated", + "type": { + "name": "datetime64", + "args": [ + { + "int": 3 + }, + { + "string": "UTC" + } + ] + }, + "table": "things" + }, + { + "name": "price", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "status", + "type": { + "name": "enum8", + "args": [ + { + "label": "active", + "int": 1 + }, + { + "label": "deleted", + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "attrs", + "type": { + "name": "map", + "args": [ + { + "type": { + "name": "string" + } + }, + { + "type": { + "name": "uint32" + } + } + ] + }, + "table": "things" + }, + { + "name": "pos", + "type": { + "name": "tuple", + "args": [ + { + "type": { + "name": "float64" + } + }, + { + "type": { + "name": "float64" + } + } + ] + }, + "table": "things" + }, + { + "name": "geo", + "type": { + "name": "tuple", + "args": [ + { + "label": "lat", + "type": { + "name": "float64" + } + }, + { + "label": "lon", + "type": { + "name": "float64" + } + } + ] + }, + "table": "things" + }, + { + "name": "scores", + "type": { + "name": "map", + "args": [ + { + "type": { + "name": "string" + } + }, + { + "type": { + "name": "uint8", + "nullable": true + } + } + ] + }, + "table": "things" + }, + { + "name": "ip", + "type": { + "name": "ipv4" + }, + "table": "things" + }, + { + "name": "uid", + "type": { + "name": "uuid" + }, + "table": "things" + }, + { + "name": "fixed", + "type": { + "name": "fixedstring", + "args": [ + { + "int": 4 + } + ] + }, + "table": "things" + }, + { + "name": "flag", + "type": { + "name": "bool" + }, + "table": "things" + }, + { + "name": "small", + "type": { + "name": "decimal", + "args": [ + { + "int": 9 + }, + { + "int": 4 + } + ] + }, + "table": "things" + }, + { + "name": "plain", + "type": { + "name": "enum8", + "args": [ + { + "label": "x", + "int": 1 + }, + { + "label": "y", + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "either", + "type": { + "name": "variant", + "args": [ + { + "type": { + "name": "int64" + } + }, + { + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "n.a", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "uint8" + } + } + ] + }, + "table": "things" + }, + { + "name": "n.b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "total", + "type": { + "name": "simpleaggregatefunction", + "args": [ + { + "ident": "sum" + }, + { + "type": { + "name": "uint64" + } + } + ] + }, + "table": "things" + }, + { + "name": "whole", + "type": { + "name": "int32" + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "StarColumns", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "things" + }, + { + "name": "name", + "type": { + "name": "string" + }, + "table": "things" + }, + { + "name": "tag", + "type": { + "name": "string", + "nullable": true + }, + "table": "things" + }, + { + "name": "amount", + "type": { + "name": "float64" + }, + "table": "things" + }, + { + "name": "tags", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "labels", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string", + "nullable": true + } + } + ] + }, + "table": "things" + }, + { + "name": "matrix", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "uint8" + } + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "kind", + "type": { + "name": "lowcardinality", + "nullable": true, + "args": [ + { + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "created", + "type": { + "name": "datetime" + }, + "table": "things" + }, + { + "name": "updated", + "type": { + "name": "datetime64", + "args": [ + { + "int": 3 + }, + { + "string": "UTC" + } + ] + }, + "table": "things" + }, + { + "name": "price", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "status", + "type": { + "name": "enum8", + "args": [ + { + "label": "active", + "int": 1 + }, + { + "label": "deleted", + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "attrs", + "type": { + "name": "map", + "args": [ + { + "type": { + "name": "string" + } + }, + { + "type": { + "name": "uint32" + } + } + ] + }, + "table": "things" + }, + { + "name": "pos", + "type": { + "name": "tuple", + "args": [ + { + "type": { + "name": "float64" + } + }, + { + "type": { + "name": "float64" + } + } + ] + }, + "table": "things" + }, + { + "name": "geo", + "type": { + "name": "tuple", + "args": [ + { + "label": "lat", + "type": { + "name": "float64" + } + }, + { + "label": "lon", + "type": { + "name": "float64" + } + } + ] + }, + "table": "things" + }, + { + "name": "scores", + "type": { + "name": "map", + "args": [ + { + "type": { + "name": "string" + } + }, + { + "type": { + "name": "uint8", + "nullable": true + } + } + ] + }, + "table": "things" + }, + { + "name": "ip", + "type": { + "name": "ipv4" + }, + "table": "things" + }, + { + "name": "uid", + "type": { + "name": "uuid" + }, + "table": "things" + }, + { + "name": "fixed", + "type": { + "name": "fixedstring", + "args": [ + { + "int": 4 + } + ] + }, + "table": "things" + }, + { + "name": "flag", + "type": { + "name": "bool" + }, + "table": "things" + }, + { + "name": "small", + "type": { + "name": "decimal", + "args": [ + { + "int": 9 + }, + { + "int": 4 + } + ] + }, + "table": "things" + }, + { + "name": "plain", + "type": { + "name": "enum8", + "args": [ + { + "label": "x", + "int": 1 + }, + { + "label": "y", + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "either", + "type": { + "name": "variant", + "args": [ + { + "type": { + "name": "int64" + } + }, + { + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "n.a", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "uint8" + } + } + ] + }, + "table": "things" + }, + { + "name": "n.b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "total", + "type": { + "name": "simpleaggregatefunction", + "args": [ + { + "ident": "sum" + }, + { + "type": { + "name": "uint64" + } + } + ] + }, + "table": "things" + }, + { + "name": "whole", + "type": { + "name": "int32" + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "string" + } + }, + { + "name": "b", + "type": { + "name": "decimal", + "args": [ + { + "int": 18 + }, + { + "int": 4 + } + ] + } + }, + { + "name": "c", + "type": { + "name": "string", + "nullable": true + } + }, + { + "name": "d", + "type": { + "name": "datetime64", + "args": [ + { + "int": 3 + } + ] + } + }, + { + "name": "e", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "string" + } + } + ] + } + }, + { + "name": "f", + "type": { + "name": "string", + "nullable": true + } + } + ], + "params": [] + }, + { + "name": "Placeholders", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "uint64" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "p1", + "type": { + "name": "uint64" + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "p2", + "type": { + "name": "string" + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "p3", + "type": { + "name": "float64" + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "p4", + "type": { + "name": "string", + "nullable": true + }, + "table": "things" + } + }, + { + "number": 5, + "column": { + "name": "p5", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/duckdb/exec.json b/internal/endtoend/testdata/analyze_types/duckdb/exec.json new file mode 100644 index 0000000000..56cb4b3fff --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/duckdb/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/duckdb/query.sql b/internal/endtoend/testdata/analyze_types/duckdb/query.sql new file mode 100644 index 0000000000..3e232d263f --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/duckdb/query.sql @@ -0,0 +1,18 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + $1::DECIMAL(5,2) AS a, + $2::INTEGER[] AS b, + $3::STRUCT(a INTEGER) AS c, + $4::mood AS d, + CAST($5 AS VARCHAR(5)) AS e, + $6::MAP(VARCHAR, INTEGER) AS f, + $7::INTEGER[3] AS g, + $8::main.mood AS h +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE ints = $1 AND point = $2 AND price = $3 AND m = $4 AND either = $5 AND grid = $6; diff --git a/internal/endtoend/testdata/analyze_types/duckdb/schema.sql b/internal/endtoend/testdata/analyze_types/duckdb/schema.sql new file mode 100644 index 0000000000..0a8a1b4147 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/duckdb/schema.sql @@ -0,0 +1,31 @@ +CREATE TYPE mood AS ENUM ('sad', 'ok'); + +CREATE TABLE things ( + id INTEGER PRIMARY KEY, + ints INTEGER[], + fixed INTEGER[3], + point STRUCT(a INTEGER, b VARCHAR), + attrs MAP(VARCHAR, INTEGER), + either UNION(num INTEGER, str VARCHAR), + price DECIMAL(18,3), + title VARCHAR(10), + kind ENUM('a','b'), + m mood, + mm main.mood, + big HUGEINT, + ubig UHUGEINT, + data BLOB, + bits BIT, + uid UUID, + tstz TIMESTAMP WITH TIME ZONE, + tsns TIMESTAMP_NS, + iv INTERVAL, + doc JSON, + grid INTEGER[][], + vi VARINT, + f4 FLOAT4, + points STRUCT(a INTEGER)[], + lists MAP(VARCHAR, INTEGER[]), + body TEXT, + n NUMERIC +); diff --git a/internal/endtoend/testdata/analyze_types/duckdb/stdout.json b/internal/endtoend/testdata/analyze_types/duckdb/stdout.json new file mode 100644 index 0000000000..9b2170f350 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/duckdb/stdout.json @@ -0,0 +1,709 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "things" + }, + { + "name": "ints", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "integer" + } + } + ] + }, + "table": "things" + }, + { + "name": "fixed", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "integer" + } + }, + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "point", + "type": { + "name": "struct", + "nullable": true, + "args": [ + { + "label": "a", + "type": { + "name": "integer" + } + }, + { + "label": "b", + "type": { + "name": "varchar" + } + } + ] + }, + "table": "things" + }, + { + "name": "attrs", + "type": { + "name": "map", + "nullable": true, + "args": [ + { + "type": { + "name": "varchar" + } + }, + { + "type": { + "name": "integer" + } + } + ] + }, + "table": "things" + }, + { + "name": "either", + "type": { + "name": "union", + "nullable": true, + "args": [ + { + "label": "num", + "type": { + "name": "integer" + } + }, + { + "label": "str", + "type": { + "name": "varchar" + } + } + ] + }, + "table": "things" + }, + { + "name": "price", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 18 + }, + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "title", + "type": { + "name": "varchar", + "nullable": true + }, + "table": "things" + }, + { + "name": "kind", + "type": { + "name": "enum", + "nullable": true, + "args": [ + { + "string": "a" + }, + { + "string": "b" + } + ] + }, + "table": "things" + }, + { + "name": "m", + "type": { + "name": "mood", + "nullable": true + }, + "table": "things" + }, + { + "name": "mm", + "type": { + "name": "mood", + "nullable": true + }, + "table": "things" + }, + { + "name": "big", + "type": { + "name": "hugeint", + "nullable": true + }, + "table": "things" + }, + { + "name": "ubig", + "type": { + "name": "uhugeint", + "nullable": true + }, + "table": "things" + }, + { + "name": "data", + "type": { + "name": "blob", + "nullable": true + }, + "table": "things" + }, + { + "name": "bits", + "type": { + "name": "bit", + "nullable": true + }, + "table": "things" + }, + { + "name": "uid", + "type": { + "name": "uuid", + "nullable": true + }, + "table": "things" + }, + { + "name": "tstz", + "type": { + "name": "timestamp with time zone", + "nullable": true + }, + "table": "things" + }, + { + "name": "tsns", + "type": { + "name": "timestamp_ns", + "nullable": true + }, + "table": "things" + }, + { + "name": "iv", + "type": { + "name": "interval", + "nullable": true + }, + "table": "things" + }, + { + "name": "doc", + "type": { + "name": "json", + "nullable": true + }, + "table": "things" + }, + { + "name": "grid", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "vi", + "type": { + "name": "bignum", + "nullable": true + }, + "table": "things" + }, + { + "name": "f4", + "type": { + "name": "float", + "nullable": true + }, + "table": "things" + }, + { + "name": "points", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "struct", + "args": [ + { + "label": "a", + "type": { + "name": "integer" + } + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "lists", + "type": { + "name": "map", + "nullable": true, + "args": [ + { + "type": { + "name": "varchar" + } + }, + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "body", + "type": { + "name": "varchar", + "nullable": true + }, + "table": "things" + }, + { + "name": "n", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 18 + }, + { + "int": 3 + } + ] + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "decimal", + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + }, + { + "name": "b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + }, + { + "name": "c", + "type": { + "name": "struct", + "args": [ + { + "label": "a", + "type": { + "name": "integer" + } + } + ] + } + }, + { + "name": "d", + "type": { + "name": "mood" + } + }, + { + "name": "e", + "type": { + "name": "varchar" + } + }, + { + "name": "f", + "type": { + "name": "map", + "args": [ + { + "type": { + "name": "varchar" + } + }, + { + "type": { + "name": "integer" + } + } + ] + } + }, + { + "name": "g", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + }, + { + "int": 3 + } + ] + } + }, + { + "name": "h", + "type": { + "name": "mood" + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "", + "type": { + "name": "decimal", + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + } + }, + { + "number": 2, + "column": { + "name": "", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + }, + { + "number": 3, + "column": { + "name": "", + "type": { + "name": "struct", + "args": [ + { + "label": "a", + "type": { + "name": "integer" + } + } + ] + } + } + }, + { + "number": 4, + "column": { + "name": "", + "type": { + "name": "mood" + } + } + }, + { + "number": 5, + "column": { + "name": "", + "type": { + "name": "varchar" + } + } + }, + { + "number": 6, + "column": { + "name": "", + "type": { + "name": "map", + "args": [ + { + "type": { + "name": "varchar" + } + }, + { + "type": { + "name": "integer" + } + } + ] + } + } + }, + { + "number": 7, + "column": { + "name": "", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + }, + { + "int": 3 + } + ] + } + } + }, + { + "number": 8, + "column": { + "name": "", + "type": { + "name": "mood" + } + } + } + ] + }, + { + "name": "Params", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "ints", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "integer" + } + } + ] + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "point", + "type": { + "name": "struct", + "nullable": true, + "args": [ + { + "label": "a", + "type": { + "name": "integer" + } + }, + { + "label": "b", + "type": { + "name": "varchar" + } + } + ] + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "price", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 18 + }, + { + "int": 3 + } + ] + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "m", + "type": { + "name": "mood", + "nullable": true + }, + "table": "things" + } + }, + { + "number": 5, + "column": { + "name": "either", + "type": { + "name": "union", + "nullable": true, + "args": [ + { + "label": "num", + "type": { + "name": "integer" + } + }, + { + "label": "str", + "type": { + "name": "varchar" + } + } + ] + }, + "table": "things" + } + }, + { + "number": 6, + "column": { + "name": "grid", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + ] + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/googlesql/exec.json b/internal/endtoend/testdata/analyze_types/googlesql/exec.json new file mode 100644 index 0000000000..a53ddddc6d --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/googlesql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/googlesql/query.sql b/internal/endtoend/testdata/analyze_types/googlesql/query.sql new file mode 100644 index 0000000000..06cca17706 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/googlesql/query.sql @@ -0,0 +1,14 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + CAST(@a AS NUMERIC) AS a, + CAST(@b AS ARRAY) AS b, + CAST(@d AS STRING) AS d, + SAFE_CAST(@e AS FLOAT64) AS e +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE s = @s AND n = @n AND smax = @smax AND f32 = @f32; diff --git a/internal/endtoend/testdata/analyze_types/googlesql/schema.sql b/internal/endtoend/testdata/analyze_types/googlesql/schema.sql new file mode 100644 index 0000000000..176f055732 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/googlesql/schema.sql @@ -0,0 +1,16 @@ +CREATE TABLE things ( + id INT64 NOT NULL, + s STRING(10), + smax STRING(MAX), + n NUMERIC, + byt BYTES(MAX), + ai ARRAY, + as2 ARRAY, + ts TIMESTAMP, + d DATE, + j JSON, + b BOOL, + f FLOAT64, + f32 FLOAT32, + u UUID +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_types/googlesql/stdout.json b/internal/endtoend/testdata/analyze_types/googlesql/stdout.json new file mode 100644 index 0000000000..645888fd07 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/googlesql/stdout.json @@ -0,0 +1,305 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "things" + }, + { + "name": "s", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + }, + { + "name": "smax", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + }, + { + "name": "n", + "type": { + "name": "numeric", + "nullable": true + }, + "table": "things" + }, + { + "name": "byt", + "type": { + "name": "bytes", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + }, + { + "name": "ai", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "int64" + } + } + ] + }, + "table": "things" + }, + { + "name": "as2", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "ts", + "type": { + "name": "timestamp", + "nullable": true + }, + "table": "things" + }, + { + "name": "d", + "type": { + "name": "date", + "nullable": true + }, + "table": "things" + }, + { + "name": "j", + "type": { + "name": "json", + "nullable": true + }, + "table": "things" + }, + { + "name": "b", + "type": { + "name": "bool", + "nullable": true + }, + "table": "things" + }, + { + "name": "f", + "type": { + "name": "float64", + "nullable": true + }, + "table": "things" + }, + { + "name": "f32", + "type": { + "name": "float32", + "nullable": true + }, + "table": "things" + }, + { + "name": "u", + "type": { + "name": "uuid", + "nullable": true + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "numeric" + } + }, + { + "name": "b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + }, + { + "name": "d", + "type": { + "name": "string" + } + }, + { + "name": "e", + "type": { + "name": "float64" + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "a", + "type": { + "name": "numeric" + } + } + }, + { + "number": 2, + "column": { + "name": "b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + } + }, + { + "number": 3, + "column": { + "name": "d", + "type": { + "name": "string" + } + } + }, + { + "number": 4, + "column": { + "name": "e", + "type": { + "name": "float64" + } + } + } + ] + }, + { + "name": "Params", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "s", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "n", + "type": { + "name": "numeric", + "nullable": true + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "smax", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "f32", + "type": { + "name": "float32", + "nullable": true + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/mssql/exec.json b/internal/endtoend/testdata/analyze_types/mssql/exec.json new file mode 100644 index 0000000000..253b05abbf --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/mssql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mssql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/mssql/query.sql b/internal/endtoend/testdata/analyze_types/mssql/query.sql new file mode 100644 index 0000000000..e2075d7abd --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/mssql/query.sql @@ -0,0 +1,24 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + CAST(amount AS DECIMAL(5,2)) AS a, + CAST(title AS NVARCHAR(MAX)) AS b, + CAST(body AS VARCHAR(10)) AS c, + CONVERT(DATETIME2(3), updated) AS d, + CAST(amount AS MONEY) AS e, + CAST(f53 AS FLOAT(24)) AS f, + CAST(code AS CHAR(3)) AS g +FROM things +WHERE CAST(@a AS DECIMAL(5,2)) > 0 + AND CAST(@b AS NVARCHAR(MAX)) <> N'' + AND CAST(@c AS VARCHAR(10)) <> '' + AND CONVERT(DATETIME2(3), @d) > '2000-01-01' + AND CAST(@e AS MONEY) > 0 + AND TRY_CAST(@f AS FLOAT(24)) > 0 + AND CAST(@g AS CHAR(3)) <> ''; + +-- name: Params :one +SELECT id FROM things +WHERE price = @price AND body = @body AND phone = @phone AND offset_at = @offset_at; diff --git a/internal/endtoend/testdata/analyze_types/mssql/schema.sql b/internal/endtoend/testdata/analyze_types/mssql/schema.sql new file mode 100644 index 0000000000..1e65802777 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/mssql/schema.sql @@ -0,0 +1,37 @@ +CREATE TYPE dbo.PhoneNumber FROM varchar(20) NOT NULL; +CREATE TYPE Code FROM char(3); + +CREATE TABLE things ( + id BIGINT IDENTITY(1,1) PRIMARY KEY, + price DECIMAL(10,2) NOT NULL, + amount NUMERIC(18,4), + plain DECIMAL, + body NVARCHAR(MAX), + title VARCHAR(50), + code CHAR(10), + ncode NCHAR(5), + blob VARBINARY(MAX), + key16 BINARY(16), + created DATETIME2(3), + updated DATETIME2, + offset_at DATETIMEOFFSET(7), + tm TIME(4), + f FLOAT(24), + f53 FLOAT, + r REAL, + m MONEY, + b BIT, + u UNIQUEIDENTIFIER, + x XML, + j JSON, + sv SQL_VARIANT, + rv ROWVERSION, + g GEOGRAPHY, + h HIERARCHYID, + vec VECTOR(3), + sn sysname, + phone dbo.PhoneNumber, + code2 dbo.Code, + code3 Code, + bare VARCHAR +); diff --git a/internal/endtoend/testdata/analyze_types/mssql/stdout.json b/internal/endtoend/testdata/analyze_types/mssql/stdout.json new file mode 100644 index 0000000000..2d747d3085 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/mssql/stdout.json @@ -0,0 +1,600 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "things" + }, + { + "name": "price", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "amount", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 18 + }, + { + "int": 4 + } + ] + }, + "table": "things" + }, + { + "name": "plain", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 18 + }, + { + "int": 0 + } + ] + }, + "table": "things" + }, + { + "name": "body", + "type": { + "name": "nvarchar", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + }, + { + "name": "title", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 50 + } + ] + }, + "table": "things" + }, + { + "name": "code", + "type": { + "name": "char", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + }, + { + "name": "ncode", + "type": { + "name": "nchar", + "nullable": true, + "args": [ + { + "int": 5 + } + ] + }, + "table": "things" + }, + { + "name": "blob", + "type": { + "name": "varbinary", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + }, + { + "name": "key16", + "type": { + "name": "binary", + "nullable": true, + "args": [ + { + "int": 16 + } + ] + }, + "table": "things" + }, + { + "name": "created", + "type": { + "name": "datetime2", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "updated", + "type": { + "name": "datetime2", + "nullable": true, + "args": [ + { + "int": 7 + } + ] + }, + "table": "things" + }, + { + "name": "offset_at", + "type": { + "name": "datetimeoffset", + "nullable": true, + "args": [ + { + "int": 7 + } + ] + }, + "table": "things" + }, + { + "name": "tm", + "type": { + "name": "time", + "nullable": true, + "args": [ + { + "int": 4 + } + ] + }, + "table": "things" + }, + { + "name": "f", + "type": { + "name": "real", + "nullable": true + }, + "table": "things" + }, + { + "name": "f53", + "type": { + "name": "float", + "nullable": true + }, + "table": "things" + }, + { + "name": "r", + "type": { + "name": "real", + "nullable": true + }, + "table": "things" + }, + { + "name": "m", + "type": { + "name": "money", + "nullable": true + }, + "table": "things" + }, + { + "name": "b", + "type": { + "name": "bit", + "nullable": true + }, + "table": "things" + }, + { + "name": "u", + "type": { + "name": "uniqueidentifier", + "nullable": true + }, + "table": "things" + }, + { + "name": "x", + "type": { + "name": "xml", + "nullable": true + }, + "table": "things" + }, + { + "name": "j", + "type": { + "name": "json", + "nullable": true + }, + "table": "things" + }, + { + "name": "sv", + "type": { + "name": "sql_variant", + "nullable": true + }, + "table": "things" + }, + { + "name": "rv", + "type": { + "name": "rowversion" + }, + "table": "things" + }, + { + "name": "g", + "type": { + "name": "geography", + "nullable": true + }, + "table": "things" + }, + { + "name": "h", + "type": { + "name": "hierarchyid", + "nullable": true + }, + "table": "things" + }, + { + "name": "vec", + "type": { + "name": "vector", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "sn", + "type": { + "name": "nvarchar", + "args": [ + { + "int": 128 + } + ] + }, + "table": "things" + }, + { + "name": "phone", + "type": { + "name": "phonenumber" + }, + "table": "things" + }, + { + "name": "code2", + "type": { + "name": "code", + "nullable": true + }, + "table": "things" + }, + { + "name": "code3", + "type": { + "name": "code", + "nullable": true + }, + "table": "things" + }, + { + "name": "bare", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 1 + } + ] + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + }, + { + "name": "b", + "type": { + "name": "nvarchar", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + } + }, + { + "name": "c", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + } + }, + { + "name": "d", + "type": { + "name": "datetime2", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + } + }, + { + "name": "e", + "type": { + "name": "money", + "nullable": true + } + }, + { + "name": "f", + "type": { + "name": "real", + "nullable": true + } + }, + { + "name": "g", + "type": { + "name": "char", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "a", + "type": { + "name": "decimal", + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + } + }, + { + "number": 2, + "column": { + "name": "b", + "type": { + "name": "nvarchar", + "args": [ + { + "ident": "max" + } + ] + } + } + }, + { + "number": 3, + "column": { + "name": "c", + "type": { + "name": "varchar", + "args": [ + { + "int": 10 + } + ] + } + } + }, + { + "number": 4, + "column": { + "name": "d", + "type": { + "name": "datetime2", + "args": [ + { + "int": 3 + } + ] + } + } + }, + { + "number": 5, + "column": { + "name": "e", + "type": { + "name": "money" + } + } + }, + { + "number": 6, + "column": { + "name": "f", + "type": { + "name": "real" + } + } + }, + { + "number": 7, + "column": { + "name": "g", + "type": { + "name": "char", + "args": [ + { + "int": 3 + } + ] + } + } + } + ] + }, + { + "name": "Params", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "price", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "body", + "type": { + "name": "nvarchar", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "phone", + "type": { + "name": "phonenumber" + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "offset_at", + "type": { + "name": "datetimeoffset", + "nullable": true, + "args": [ + { + "int": 7 + } + ] + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/mysql/exec.json b/internal/endtoend/testdata/analyze_types/mysql/exec.json new file mode 100644 index 0000000000..a5b24d3361 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/mysql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "mysql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/mysql/query.sql b/internal/endtoend/testdata/analyze_types/mysql/query.sql new file mode 100644 index 0000000000..3b3c2a4fd1 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/mysql/query.sql @@ -0,0 +1,22 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + CAST(count AS UNSIGNED) AS a, + CAST(price AS DECIMAL(5,2)) AS b, + CAST(title AS CHAR(10)) AS c, + CAST(count AS SIGNED) AS d, + CAST(doc AS JSON) AS e, + CAST(created AS DATETIME(3)) AS f, + CAST(price AS DECIMAL) AS g, + CAST(key16 AS BINARY(8)) AS h, + CAST(d AS DOUBLE) AS i, + CAST(f AS FLOAT) AS j, + CAST(price AS DEC(6,1)) AS k, + CAST(price AS DECIMAL(5)) AS l +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE count = ? AND price = ? AND kind = ? AND flags = ? AND title = ? AND uprice = ? AND flag = ? AND created = ?; diff --git a/internal/endtoend/testdata/analyze_types/mysql/schema.sql b/internal/endtoend/testdata/analyze_types/mysql/schema.sql new file mode 100644 index 0000000000..880de33be2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/mysql/schema.sql @@ -0,0 +1,29 @@ +CREATE TABLE things ( + id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + flag TINYINT(1), + count INT UNSIGNED NOT NULL, + price DECIMAL(10,2) NOT NULL, + uprice DECIMAL(10,2) UNSIGNED, + plain DECIMAL, + dd DEC(7,2), + ratio FLOAT(7,4), + f FLOAT, + title VARCHAR(255), + code CHAR(3), + kind ENUM('a','b'), + flags SET('x','y'), + doc JSON, + key16 BINARY(16), + blob255 VARBINARY(255), + created DATETIME(6), + updated TIMESTAMP(3), + y YEAR, + bits BIT(8), + body TEXT, + bin VARCHAR(10) CHARACTER SET binary, + geo GEOMETRY, + ok BOOLEAN, + d DOUBLE, + small MEDIUMINT UNSIGNED, + i INT +); diff --git a/internal/endtoend/testdata/analyze_types/mysql/stdout.json b/internal/endtoend/testdata/analyze_types/mysql/stdout.json new file mode 100644 index 0000000000..1e031b3570 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/mysql/stdout.json @@ -0,0 +1,608 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint unsigned" + }, + "table": "things" + }, + { + "name": "flag", + "type": { + "name": "tinyint", + "nullable": true, + "args": [ + { + "int": 1 + } + ] + }, + "table": "things" + }, + { + "name": "count", + "type": { + "name": "int unsigned" + }, + "table": "things" + }, + { + "name": "price", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "uprice", + "type": { + "name": "decimal unsigned", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "plain", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 0 + } + ] + }, + "table": "things" + }, + { + "name": "dd", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 7 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "ratio", + "type": { + "name": "float", + "nullable": true, + "args": [ + { + "int": 7 + }, + { + "int": 4 + } + ] + }, + "table": "things" + }, + { + "name": "f", + "type": { + "name": "float", + "nullable": true + }, + "table": "things" + }, + { + "name": "title", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "things" + }, + { + "name": "code", + "type": { + "name": "char", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "kind", + "type": { + "name": "enum", + "nullable": true, + "args": [ + { + "string": "a" + }, + { + "string": "b" + } + ] + }, + "table": "things" + }, + { + "name": "flags", + "type": { + "name": "set", + "nullable": true, + "args": [ + { + "string": "x" + }, + { + "string": "y" + } + ] + }, + "table": "things" + }, + { + "name": "doc", + "type": { + "name": "json", + "nullable": true + }, + "table": "things" + }, + { + "name": "key16", + "type": { + "name": "binary", + "nullable": true, + "args": [ + { + "int": 16 + } + ] + }, + "table": "things" + }, + { + "name": "blob255", + "type": { + "name": "varbinary", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "things" + }, + { + "name": "created", + "type": { + "name": "datetime", + "nullable": true, + "args": [ + { + "int": 6 + } + ] + }, + "table": "things" + }, + { + "name": "updated", + "type": { + "name": "timestamp", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "y", + "type": { + "name": "year", + "nullable": true + }, + "table": "things" + }, + { + "name": "bits", + "type": { + "name": "bit", + "nullable": true, + "args": [ + { + "int": 8 + } + ] + }, + "table": "things" + }, + { + "name": "body", + "type": { + "name": "text", + "nullable": true + }, + "table": "things" + }, + { + "name": "bin", + "type": { + "name": "varbinary", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + }, + { + "name": "geo", + "type": { + "name": "geometry", + "nullable": true + }, + "table": "things" + }, + { + "name": "ok", + "type": { + "name": "tinyint", + "nullable": true, + "args": [ + { + "int": 1 + } + ] + }, + "table": "things" + }, + { + "name": "d", + "type": { + "name": "double", + "nullable": true + }, + "table": "things" + }, + { + "name": "small", + "type": { + "name": "mediumint unsigned", + "nullable": true + }, + "table": "things" + }, + { + "name": "i", + "type": { + "name": "int", + "nullable": true + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "bigint unsigned" + } + }, + { + "name": "b", + "type": { + "name": "decimal", + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + }, + { + "name": "c", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + } + }, + { + "name": "d", + "type": { + "name": "bigint" + } + }, + { + "name": "e", + "type": { + "name": "json", + "nullable": true + } + }, + { + "name": "f", + "type": { + "name": "datetime", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + } + }, + { + "name": "g", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 0 + } + ] + } + }, + { + "name": "h", + "type": { + "name": "varbinary", + "nullable": true, + "args": [ + { + "int": 8 + } + ] + } + }, + { + "name": "i", + "type": { + "name": "double", + "nullable": true + } + }, + { + "name": "j", + "type": { + "name": "float", + "nullable": true + } + }, + { + "name": "k", + "type": { + "name": "decimal", + "args": [ + { + "int": 6 + }, + { + "int": 1 + } + ] + } + }, + { + "name": "l", + "type": { + "name": "decimal", + "args": [ + { + "int": 5 + }, + { + "int": 0 + } + ] + } + } + ], + "params": [] + }, + { + "name": "Params", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint unsigned" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "count", + "type": { + "name": "int unsigned" + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "price", + "type": { + "name": "decimal", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "kind", + "type": { + "name": "enum", + "nullable": true, + "args": [ + { + "string": "a" + }, + { + "string": "b" + } + ] + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "flags", + "type": { + "name": "set", + "nullable": true, + "args": [ + { + "string": "x" + }, + { + "string": "y" + } + ] + }, + "table": "things" + } + }, + { + "number": 5, + "column": { + "name": "title", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "things" + } + }, + { + "number": 6, + "column": { + "name": "uprice", + "type": { + "name": "decimal unsigned", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + } + }, + { + "number": 7, + "column": { + "name": "flag", + "type": { + "name": "tinyint", + "nullable": true, + "args": [ + { + "int": 1 + } + ] + }, + "table": "things" + } + }, + { + "number": 8, + "column": { + "name": "created", + "type": { + "name": "datetime", + "nullable": true, + "args": [ + { + "int": 6 + } + ] + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/postgresql/exec.json b/internal/endtoend/testdata/analyze_types/postgresql/exec.json new file mode 100644 index 0000000000..b102755fb6 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/postgresql/query.sql b/internal/endtoend/testdata/analyze_types/postgresql/query.sql new file mode 100644 index 0000000000..ad7746ed08 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/postgresql/query.sql @@ -0,0 +1,25 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + $1::numeric(10,2) AS a, + $2::int[] AS b, + price::text AS c, + $3::mood AS d, + $4::varchar(20) AS e, + $5::posint AS f, + 1::int8 AS g, + $6::int4[][] AS h, + $7::numeric(5,1) AS i, + ARRAY[1, 2] AS j, + $8::myschema.mood AS k, + $9::varchar(10)[] AS l, + $10::interval day to second AS m, + $11::myschema.mood[] AS n, + $12::mood[] AS o +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE price = $1 AND ints = $2 AND m = $3 AND p = $4 AND title = $5 AND grid = $6 AND sn = $7 AND fr = $8 AND ivd = $9; diff --git a/internal/endtoend/testdata/analyze_types/postgresql/schema.sql b/internal/endtoend/testdata/analyze_types/postgresql/schema.sql new file mode 100644 index 0000000000..0db7266d6b --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/postgresql/schema.sql @@ -0,0 +1,47 @@ +CREATE EXTENSION hstore; +CREATE SCHEMA myschema; +CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy'); +CREATE TYPE myschema.mood AS ENUM ('x', 'y'); +CREATE DOMAIN posint AS integer CHECK (VALUE > 0); +CREATE DOMAIN shortname AS varchar(20) NOT NULL; +CREATE TYPE point2 AS (x float8, y float8); +CREATE TYPE floatrange AS RANGE (subtype = float8); + +CREATE TABLE things ( + id bigserial PRIMARY KEY, + price numeric(10,2) NOT NULL, + amount numeric, + title varchar(255), + code character varying(10), + tag char(5), + raw bpchar, + count pg_catalog.int4, + ints int[], + grid int[][], + bounded int[3], + words text[] NOT NULL, + prices numeric(10,2)[], + ts timestamp(3), + tstz timestamptz NOT NULL, + ttz time with time zone, + iv interval, + ivd interval day to second, + iv3 interval(3), + m mood, + mm myschema.mood, + mms myschema.mood[], + p posint, + sn shortname, + pt point2, + pts point2[], + fr floatrange, + ir int4range, + b bit(8), + vb varbit(16), + js jsonb, + u uuid, + h hstore, + moods mood[], + dp double precision, + ts2 timestamp without time zone +); diff --git a/internal/endtoend/testdata/analyze_types/postgresql/stdout.json b/internal/endtoend/testdata/analyze_types/postgresql/stdout.json new file mode 100644 index 0000000000..6091af1641 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/postgresql/stdout.json @@ -0,0 +1,921 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "things" + }, + { + "name": "price", + "type": { + "name": "numeric", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "amount", + "type": { + "name": "numeric", + "nullable": true + }, + "table": "things" + }, + { + "name": "title", + "type": { + "name": "character varying", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "things" + }, + { + "name": "code", + "type": { + "name": "character varying", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + }, + { + "name": "tag", + "type": { + "name": "character", + "nullable": true, + "args": [ + { + "int": 5 + } + ] + }, + "table": "things" + }, + { + "name": "raw", + "type": { + "name": "character", + "nullable": true + }, + "table": "things" + }, + { + "name": "count", + "type": { + "name": "integer", + "nullable": true + }, + "table": "things" + }, + { + "name": "ints", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "integer" + } + } + ] + }, + "table": "things" + }, + { + "name": "grid", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "bounded", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "integer" + } + } + ] + }, + "table": "things" + }, + { + "name": "words", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "text" + } + } + ] + }, + "table": "things" + }, + { + "name": "prices", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "numeric", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "ts", + "type": { + "name": "timestamp without time zone", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "tstz", + "type": { + "name": "timestamp with time zone" + }, + "table": "things" + }, + { + "name": "ttz", + "type": { + "name": "time with time zone", + "nullable": true + }, + "table": "things" + }, + { + "name": "iv", + "type": { + "name": "interval", + "nullable": true + }, + "table": "things" + }, + { + "name": "ivd", + "type": { + "name": "interval", + "nullable": true, + "args": [ + { + "ident": "day to second" + } + ] + }, + "table": "things" + }, + { + "name": "iv3", + "type": { + "name": "interval", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "m", + "type": { + "name": "mood", + "nullable": true + }, + "table": "things" + }, + { + "name": "mm", + "type": { + "name": "myschema.mood", + "nullable": true + }, + "table": "things" + }, + { + "name": "mms", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "myschema.mood" + } + } + ] + }, + "table": "things" + }, + { + "name": "p", + "type": { + "name": "posint", + "nullable": true + }, + "table": "things" + }, + { + "name": "sn", + "type": { + "name": "shortname" + }, + "table": "things" + }, + { + "name": "pt", + "type": { + "name": "point2", + "nullable": true + }, + "table": "things" + }, + { + "name": "pts", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "point2" + } + } + ] + }, + "table": "things" + }, + { + "name": "fr", + "type": { + "name": "floatrange", + "nullable": true + }, + "table": "things" + }, + { + "name": "ir", + "type": { + "name": "int4range", + "nullable": true + }, + "table": "things" + }, + { + "name": "b", + "type": { + "name": "bit", + "nullable": true, + "args": [ + { + "int": 8 + } + ] + }, + "table": "things" + }, + { + "name": "vb", + "type": { + "name": "bit varying", + "nullable": true, + "args": [ + { + "int": 16 + } + ] + }, + "table": "things" + }, + { + "name": "js", + "type": { + "name": "jsonb", + "nullable": true + }, + "table": "things" + }, + { + "name": "u", + "type": { + "name": "uuid", + "nullable": true + }, + "table": "things" + }, + { + "name": "h", + "type": { + "name": "hstore", + "nullable": true + }, + "table": "things" + }, + { + "name": "moods", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "mood" + } + } + ] + }, + "table": "things" + }, + { + "name": "dp", + "type": { + "name": "double precision", + "nullable": true + }, + "table": "things" + }, + { + "name": "ts2", + "type": { + "name": "timestamp without time zone", + "nullable": true + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "numeric", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + } + }, + { + "name": "b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + }, + { + "name": "c", + "type": { + "name": "text" + } + }, + { + "name": "d", + "type": { + "name": "mood" + } + }, + { + "name": "e", + "type": { + "name": "character varying", + "args": [ + { + "int": 20 + } + ] + } + }, + { + "name": "f", + "type": { + "name": "posint" + } + }, + { + "name": "g", + "type": { + "name": "bigint" + } + }, + { + "name": "h", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + ] + } + }, + { + "name": "i", + "type": { + "name": "numeric", + "args": [ + { + "int": 5 + }, + { + "int": 1 + } + ] + } + }, + { + "name": "j", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + }, + { + "name": "k", + "type": { + "name": "myschema.mood" + } + }, + { + "name": "l", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "character varying", + "args": [ + { + "int": 10 + } + ] + } + } + ] + } + }, + { + "name": "m", + "type": { + "name": "interval", + "args": [ + { + "ident": "day to second" + } + ] + } + }, + { + "name": "n", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "myschema.mood" + } + } + ] + } + }, + { + "name": "o", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "mood" + } + } + ] + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "", + "type": { + "name": "numeric", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + } + } + }, + { + "number": 2, + "column": { + "name": "", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + }, + { + "number": 3, + "column": { + "name": "", + "type": { + "name": "mood" + } + } + }, + { + "number": 4, + "column": { + "name": "", + "type": { + "name": "character varying", + "args": [ + { + "int": 20 + } + ] + } + } + }, + { + "number": 5, + "column": { + "name": "", + "type": { + "name": "posint" + } + } + }, + { + "number": 6, + "column": { + "name": "", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + ] + } + } + }, + { + "number": 7, + "column": { + "name": "", + "type": { + "name": "numeric", + "args": [ + { + "int": 5 + }, + { + "int": 1 + } + ] + } + } + }, + { + "number": 8, + "column": { + "name": "", + "type": { + "name": "myschema.mood" + } + } + }, + { + "number": 9, + "column": { + "name": "", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "character varying", + "args": [ + { + "int": 10 + } + ] + } + } + ] + } + } + }, + { + "number": 10, + "column": { + "name": "", + "type": { + "name": "interval", + "args": [ + { + "ident": "day to second" + } + ] + } + } + }, + { + "number": 11, + "column": { + "name": "", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "myschema.mood" + } + } + ] + } + } + }, + { + "number": 12, + "column": { + "name": "", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "mood" + } + } + ] + } + } + } + ] + }, + { + "name": "Params", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "bigint" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "price", + "type": { + "name": "numeric", + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "ints", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "integer" + } + } + ] + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "m", + "type": { + "name": "mood", + "nullable": true + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "p", + "type": { + "name": "posint", + "nullable": true + }, + "table": "things" + } + }, + { + "number": 5, + "column": { + "name": "title", + "type": { + "name": "character varying", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "things" + } + }, + { + "number": 6, + "column": { + "name": "grid", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "integer" + } + } + ] + } + } + ] + }, + "table": "things" + } + }, + { + "number": 7, + "column": { + "name": "sn", + "type": { + "name": "shortname" + }, + "table": "things" + } + }, + { + "number": 8, + "column": { + "name": "fr", + "type": { + "name": "floatrange", + "nullable": true + }, + "table": "things" + } + }, + { + "number": 9, + "column": { + "name": "ivd", + "type": { + "name": "interval", + "nullable": true, + "args": [ + { + "ident": "day to second" + } + ] + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/sqlite/exec.json b/internal/endtoend/testdata/analyze_types/sqlite/exec.json new file mode 100644 index 0000000000..aa77909cb2 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/sqlite/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "sqlite", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/sqlite/fixture.sql b/internal/endtoend/testdata/analyze_types/sqlite/fixture.sql new file mode 100644 index 0000000000..122acdd435 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/sqlite/fixture.sql @@ -0,0 +1,4 @@ +INSERT INTO things (id, title, code, price, flag, big, data, untyped, ratio, weird, created, n, label) +VALUES (1, 'abc', 'xy', 1.5, 1, 9000000000, x'00ff', 7, 2.5, '12', '2024-01-01 00:00:00', 3, 'ab'); +INSERT INTO strict_things (id, anything, body, amount, raw, n) VALUES (1, 'x', 'b', 1.5, x'00', 2); +INSERT INTO things (id, n) VALUES (2, 0); diff --git a/internal/endtoend/testdata/analyze_types/sqlite/query.sql b/internal/endtoend/testdata/analyze_types/sqlite/query.sql new file mode 100644 index 0000000000..315331198b --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/sqlite/query.sql @@ -0,0 +1,18 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: StrictTypes :many +SELECT * FROM strict_things; + +-- name: Casts :one +SELECT + CAST(title AS INTEGER) AS a, + CAST(n AS TEXT) AS b, + CAST(title AS REAL) AS d, + weird + 1 AS e, + title || 'x' AS f +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE title = ? AND price = ? AND untyped = ? AND weird = ? AND big = ? AND n = ?; diff --git a/internal/endtoend/testdata/analyze_types/sqlite/schema.sql b/internal/endtoend/testdata/analyze_types/sqlite/schema.sql new file mode 100644 index 0000000000..675a8d602a --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/sqlite/schema.sql @@ -0,0 +1,24 @@ +CREATE TABLE things ( + id INTEGER PRIMARY KEY, + title VARCHAR(255), + code VARYING CHARACTER(10), + price DECIMAL(10,5), + flag BOOLEAN, + big UNSIGNED BIG INT, + data BLOB, + untyped, + ratio DOUBLE PRECISION, + weird FOO BAR(3), + created DATETIME, + n INT NOT NULL, + label NCHAR(5) +); + +CREATE TABLE strict_things ( + id INTEGER, + anything ANY, + body TEXT, + amount REAL, + raw BLOB, + n INT +) STRICT; diff --git a/internal/endtoend/testdata/analyze_types/sqlite/stdout.json b/internal/endtoend/testdata/analyze_types/sqlite/stdout.json new file mode 100644 index 0000000000..7d992f9f73 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/sqlite/stdout.json @@ -0,0 +1,333 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "things" + }, + { + "name": "title", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "things" + }, + { + "name": "code", + "type": { + "name": "varying character", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + }, + { + "name": "price", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 5 + } + ] + }, + "table": "things" + }, + { + "name": "flag", + "type": { + "name": "boolean", + "nullable": true + }, + "table": "things" + }, + { + "name": "big", + "type": { + "name": "unsigned big int", + "nullable": true + }, + "table": "things" + }, + { + "name": "data", + "type": { + "name": "blob", + "nullable": true + }, + "table": "things" + }, + { + "name": "untyped", + "type": { + "name": "any", + "nullable": true + }, + "table": "things" + }, + { + "name": "ratio", + "type": { + "name": "double precision", + "nullable": true + }, + "table": "things" + }, + { + "name": "weird", + "type": { + "name": "foo bar", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + }, + "table": "things" + }, + { + "name": "created", + "type": { + "name": "datetime", + "nullable": true + }, + "table": "things" + }, + { + "name": "n", + "type": { + "name": "int" + }, + "table": "things" + }, + { + "name": "label", + "type": { + "name": "nchar", + "nullable": true, + "args": [ + { + "int": 5 + } + ] + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "StrictTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "integer", + "nullable": true + }, + "table": "strict_things" + }, + { + "name": "anything", + "type": { + "name": "any", + "nullable": true + }, + "table": "strict_things" + }, + { + "name": "body", + "type": { + "name": "text", + "nullable": true + }, + "table": "strict_things" + }, + { + "name": "amount", + "type": { + "name": "real", + "nullable": true + }, + "table": "strict_things" + }, + { + "name": "raw", + "type": { + "name": "blob", + "nullable": true + }, + "table": "strict_things" + }, + { + "name": "n", + "type": { + "name": "int", + "nullable": true + }, + "table": "strict_things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "integer", + "nullable": true + } + }, + { + "name": "b", + "type": { + "name": "text" + } + }, + { + "name": "d", + "type": { + "name": "real", + "nullable": true + } + }, + { + "name": "e", + "type": { + "name": "integer", + "nullable": true + } + }, + { + "name": "f", + "type": { + "name": "text", + "nullable": true + } + } + ], + "params": [] + }, + { + "name": "Params", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "integer" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "title", + "type": { + "name": "varchar", + "nullable": true, + "args": [ + { + "int": 255 + } + ] + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "price", + "type": { + "name": "decimal", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 5 + } + ] + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "untyped", + "type": { + "name": "any", + "nullable": true + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "weird", + "type": { + "name": "foo bar", + "nullable": true, + "args": [ + { + "int": 3 + } + ] + }, + "table": "things" + } + }, + { + "number": 5, + "column": { + "name": "big", + "type": { + "name": "unsigned big int", + "nullable": true + }, + "table": "things" + } + }, + { + "number": 6, + "column": { + "name": "n", + "type": { + "name": "int" + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/any/pgx/v4/go/db.go b/internal/endtoend/testdata/any/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/any/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/any/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/any/pgx/v4/go/models.go b/internal/endtoend/testdata/any/pgx/v4/go/models.go index 214487814e..bc354e040a 100644 --- a/internal/endtoend/testdata/any/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/any/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go index 81a44431ce..1bb2829390 100644 --- a/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/any/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -9,14 +9,14 @@ import ( "context" ) -const any = `-- name: Any :many +const any_ = `-- name: Any :many SELECT id FROM bar WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { - rows, err := q.db.Query(ctx, any, dollar_1) + rows, err := q.db.Query(ctx, any_, dollar_1) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/any/pgx/v5/go/db.go b/internal/endtoend/testdata/any/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/any/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/any/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/any/pgx/v5/go/models.go b/internal/endtoend/testdata/any/pgx/v5/go/models.go index 214487814e..bc354e040a 100644 --- a/internal/endtoend/testdata/any/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/any/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go index 81a44431ce..1bb2829390 100644 --- a/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/any/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -9,14 +9,14 @@ import ( "context" ) -const any = `-- name: Any :many +const any_ = `-- name: Any :many SELECT id FROM bar WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { - rows, err := q.db.Query(ctx, any, dollar_1) + rows, err := q.db.Query(ctx, any_, dollar_1) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/any/stdlib/go/db.go b/internal/endtoend/testdata/any/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/any/stdlib/go/db.go +++ b/internal/endtoend/testdata/any/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/any/stdlib/go/models.go b/internal/endtoend/testdata/any/stdlib/go/models.go index 214487814e..bc354e040a 100644 --- a/internal/endtoend/testdata/any/stdlib/go/models.go +++ b/internal/endtoend/testdata/any/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/any/stdlib/go/query.sql.go b/internal/endtoend/testdata/any/stdlib/go/query.sql.go index c150abffa1..240bb91f02 100644 --- a/internal/endtoend/testdata/any/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/any/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,14 +11,14 @@ import ( "github.com/lib/pq" ) -const any = `-- name: Any :many +const any_ = `-- name: Any :many SELECT id FROM bar WHERE id = ANY($1::bigint[]) ` func (q *Queries) Any(ctx context.Context, dollar_1 []int64) ([]int64, error) { - rows, err := q.db.QueryContext(ctx, any, pq.Array(dollar_1)) + rows, err := q.db.QueryContext(ctx, any_, pq.Array(dollar_1)) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/array_in/pgx/v4/go/db.go b/internal/endtoend/testdata/array_in/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_in/pgx/v4/go/models.go b/internal/endtoend/testdata/array_in/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go index 36db3eb777..0886f96148 100644 --- a/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_in/pgx/v5/go/db.go b/internal/endtoend/testdata/array_in/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_in/pgx/v5/go/models.go b/internal/endtoend/testdata/array_in/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go index 36db3eb777..0886f96148 100644 --- a/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_in/stdlib/go/db.go b/internal/endtoend/testdata/array_in/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/array_in/stdlib/go/db.go +++ b/internal/endtoend/testdata/array_in/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_in/stdlib/go/models.go b/internal/endtoend/testdata/array_in/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/array_in/stdlib/go/models.go +++ b/internal/endtoend/testdata/array_in/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go index 3badae5d44..f2355cf6bd 100644 --- a/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_in/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text/pgx/v4/go/db.go b/internal/endtoend/testdata/array_text/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_text/pgx/v4/go/models.go b/internal/endtoend/testdata/array_text/pgx/v4/go/models.go index 7ff93babe8..ac93cc01d9 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Tags []string } diff --git a/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go index 6d8593c5ea..72b852365c 100644 --- a/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text/pgx/v5/go/db.go b/internal/endtoend/testdata/array_text/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_text/pgx/v5/go/models.go b/internal/endtoend/testdata/array_text/pgx/v5/go/models.go index 7ff93babe8..ac93cc01d9 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Tags []string } diff --git a/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go index 6d8593c5ea..72b852365c 100644 --- a/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text/stdlib/go/db.go b/internal/endtoend/testdata/array_text/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/array_text/stdlib/go/db.go +++ b/internal/endtoend/testdata/array_text/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_text/stdlib/go/models.go b/internal/endtoend/testdata/array_text/stdlib/go/models.go index 7ff93babe8..ac93cc01d9 100644 --- a/internal/endtoend/testdata/array_text/stdlib/go/models.go +++ b/internal/endtoend/testdata/array_text/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Tags []string } diff --git a/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go index 70ae1c0dd5..ee4a2d19c0 100644 --- a/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_text/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go index 76e761cb44..73d590bd3d 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID string Info []string diff --git a/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go index 4eb79d9508..0bc457938f 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go b/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go b/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go index 76e761cb44..73d590bd3d 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID string Info []string diff --git a/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go index 4eb79d9508..0bc457938f 100644 --- a/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_text_join/stdlib/go/db.go b/internal/endtoend/testdata/array_text_join/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/go/db.go +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/array_text_join/stdlib/go/models.go b/internal/endtoend/testdata/array_text_join/stdlib/go/models.go index 76e761cb44..73d590bd3d 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/go/models.go +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID string Info []string diff --git a/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go b/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go index b2409c82d4..ba11aa1834 100644 --- a/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/array_text_join/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/array_unnest/googlesql/exec.json b/internal/endtoend/testdata/array_unnest/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/array_unnest/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/array_unnest/googlesql/go/db.go b/internal/endtoend/testdata/array_unnest/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/array_unnest/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/array_unnest/googlesql/go/models.go b/internal/endtoend/testdata/array_unnest/googlesql/go/models.go new file mode 100644 index 0000000000..62304209ba --- /dev/null +++ b/internal/endtoend/testdata/array_unnest/googlesql/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" + + "cloud.google.com/go/spanner" +) + +type Album struct { + SingerID int64 + AlbumID int64 + Title sql.NullString +} + +type Singer struct { + SingerID int64 + Name string + Tags []spanner.NullString + Scores []spanner.NullInt64 +} diff --git a/internal/endtoend/testdata/array_unnest/googlesql/go/query.sql.go b/internal/endtoend/testdata/array_unnest/googlesql/go/query.sql.go new file mode 100644 index 0000000000..3443ac6d1a --- /dev/null +++ b/internal/endtoend/testdata/array_unnest/googlesql/go/query.sql.go @@ -0,0 +1,144 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "cloud.google.com/go/spanner" +) + +const albumTitles = `-- name: AlbumTitles :one +SELECT singer_id, ARRAY(SELECT title FROM albums WHERE albums.singer_id = singers.singer_id) AS titles +FROM singers WHERE singer_id = @singer_id +` + +type AlbumTitlesRow struct { + SingerID int64 + Titles []spanner.NullString +} + +func (q *Queries) AlbumTitles(ctx context.Context, singerID int64) (AlbumTitlesRow, error) { + row := q.db.QueryRowContext(ctx, albumTitles, sql.Named("singer_id", singerID)) + var i AlbumTitlesRow + err := row.Scan(&i.SingerID, &i.Titles) + return i, err +} + +const firstTag = `-- name: FirstTag :one +SELECT tags[OFFSET(0)] AS first_tag, tags[SAFE_ORDINAL(@n)] AS nth_tag, scores[SAFE_OFFSET(0)] AS first_score +FROM singers WHERE singer_id = @singer_id +` + +type FirstTagParams struct { + N int64 + SingerID int64 +} + +type FirstTagRow struct { + FirstTag sql.NullString + NthTag sql.NullString + FirstScore sql.NullInt64 +} + +func (q *Queries) FirstTag(ctx context.Context, arg FirstTagParams) (FirstTagRow, error) { + row := q.db.QueryRowContext(ctx, firstTag, sql.Named("n", arg.N), sql.Named("singer_id", arg.SingerID)) + var i FirstTagRow + err := row.Scan(&i.FirstTag, &i.NthTag, &i.FirstScore) + return i, err +} + +const singerTags = `-- name: SingerTags :many +SELECT singer_id, tag FROM singers, UNNEST(tags) AS tag +` + +type SingerTagsRow struct { + SingerID int64 + Tag sql.NullString +} + +func (q *Queries) SingerTags(ctx context.Context) ([]SingerTagsRow, error) { + rows, err := q.db.QueryContext(ctx, singerTags) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SingerTagsRow + for rows.Next() { + var i SingerTagsRow + if err := rows.Scan(&i.SingerID, &i.Tag); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const singersByIDs = `-- name: SingersByIDs :many +SELECT singer_id, name FROM singers WHERE singer_id IN UNNEST(@ids) +` + +type SingersByIDsRow struct { + SingerID int64 + Name string +} + +func (q *Queries) SingersByIDs(ctx context.Context, ids []spanner.NullInt64) ([]SingersByIDsRow, error) { + rows, err := q.db.QueryContext(ctx, singersByIDs, sql.Named("ids", ids)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SingersByIDsRow + for rows.Next() { + var i SingersByIDsRow + if err := rows.Scan(&i.SingerID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const singersNotIn = `-- name: SingersNotIn :many +SELECT singer_id FROM singers WHERE singer_id NOT IN UNNEST(@ids) +` + +func (q *Queries) SingersNotIn(ctx context.Context, ids []spanner.NullInt64) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, singersNotIn, sql.Named("ids", ids)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var singer_id int64 + if err := rows.Scan(&singer_id); err != nil { + return nil, err + } + items = append(items, singer_id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/array_unnest/googlesql/query.sql b/internal/endtoend/testdata/array_unnest/googlesql/query.sql new file mode 100644 index 0000000000..caf34a04a2 --- /dev/null +++ b/internal/endtoend/testdata/array_unnest/googlesql/query.sql @@ -0,0 +1,16 @@ +-- name: SingersByIDs :many +SELECT singer_id, name FROM singers WHERE singer_id IN UNNEST(@ids); + +-- name: SingersNotIn :many +SELECT singer_id FROM singers WHERE singer_id NOT IN UNNEST(@ids); + +-- name: SingerTags :many +SELECT singer_id, tag FROM singers, UNNEST(tags) AS tag; + +-- name: AlbumTitles :one +SELECT singer_id, ARRAY(SELECT title FROM albums WHERE albums.singer_id = singers.singer_id) AS titles +FROM singers WHERE singer_id = @singer_id; + +-- name: FirstTag :one +SELECT tags[OFFSET(0)] AS first_tag, tags[SAFE_ORDINAL(@n)] AS nth_tag, scores[SAFE_OFFSET(0)] AS first_score +FROM singers WHERE singer_id = @singer_id; diff --git a/internal/endtoend/testdata/array_unnest/googlesql/schema.sql b/internal/endtoend/testdata/array_unnest/googlesql/schema.sql new file mode 100644 index 0000000000..667e087fb6 --- /dev/null +++ b/internal/endtoend/testdata/array_unnest/googlesql/schema.sql @@ -0,0 +1,13 @@ +CREATE TABLE singers ( + singer_id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + tags ARRAY, + scores ARRAY NOT NULL, +) PRIMARY KEY (singer_id); + +CREATE TABLE albums ( + singer_id INT64 NOT NULL, + album_id INT64 NOT NULL, + title STRING(MAX), +) PRIMARY KEY (singer_id, album_id), + INTERLEAVE IN PARENT singers ON DELETE CASCADE; diff --git a/internal/endtoend/testdata/array_unnest/googlesql/sqlc.json b/internal/endtoend/testdata/array_unnest/googlesql/sqlc.json new file mode 100644 index 0000000000..40d6c76211 --- /dev/null +++ b/internal/endtoend/testdata/array_unnest/googlesql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "googlesql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/bad_config/engine/query.sql b/internal/endtoend/testdata/bad_config/engine/query.sql new file mode 100644 index 0000000000..18b0c0d03c --- /dev/null +++ b/internal/endtoend/testdata/bad_config/engine/query.sql @@ -0,0 +1,2 @@ +-- name: Test :exec +SELECT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/bad_config/engine/sqlc.yaml b/internal/endtoend/testdata/bad_config/engine/sqlc.yaml new file mode 100644 index 0000000000..8f20b4eaa5 --- /dev/null +++ b/internal/endtoend/testdata/bad_config/engine/sqlc.yaml @@ -0,0 +1,8 @@ +version: 2 +sql: +- queries: query.sql + schema: query.sql + engine: "bad_engine" + gen: + go: + out: "db" \ No newline at end of file diff --git a/internal/endtoend/testdata/bad_config/engine/stderr.txt b/internal/endtoend/testdata/bad_config/engine/stderr.txt new file mode 100644 index 0000000000..9797244924 --- /dev/null +++ b/internal/endtoend/testdata/bad_config/engine/stderr.txt @@ -0,0 +1 @@ +error creating compiler: unknown engine: bad_engine \ No newline at end of file diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go index 863d96d847..9ff7203abf 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch.go package querytest @@ -32,7 +32,7 @@ type GetValuesBatchResults struct { func (q *Queries) GetValues(ctx context.Context, b []sql.NullInt32) *GetValuesBatchResults { batch := &pgx.Batch{} for _, a := range b { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(getValues, vals...) @@ -97,7 +97,7 @@ type InsertValuesParams struct { func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *InsertValuesBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.A, a.B, } @@ -148,7 +148,7 @@ type UpdateValuesParams struct { func (q *Queries) UpdateValues(ctx context.Context, arg []UpdateValuesParams) *UpdateValuesBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.A, a.B, } diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go index e28790b2ce..49b7e30271 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go index ee9c9d3d4e..fa0d29714c 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go index ddc6c6534c..aa95052ac1 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v4/go/query.sql.go @@ -1,8 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest - -import () diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go index 78b22e9016..390c85c327 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch.go package querytest @@ -32,7 +32,7 @@ type GetValuesBatchResults struct { func (q *Queries) GetValues(ctx context.Context, b []pgtype.Int4) *GetValuesBatchResults { batch := &pgx.Batch{} for _, a := range b { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(getValues, vals...) @@ -97,7 +97,7 @@ type InsertValuesParams struct { func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *InsertValuesBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.A, a.B, } @@ -148,7 +148,7 @@ type UpdateValuesParams struct { func (q *Queries) UpdateValues(ctx context.Context, arg []UpdateValuesParams) *UpdateValuesBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.A, a.B, } diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go index 21d826834a..1f79ce6197 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go index 219b82bdc2..80e1ef5a44 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go index ddc6c6534c..aa95052ac1 100644 --- a/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/batch/postgresql/pgx/v5/go/query.sql.go @@ -1,8 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest - -import () diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go index 049c0dc215..224d28743f 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch.go package querytest @@ -32,7 +32,7 @@ type GetValuesBatchResults struct { func (q *Queries) GetValues(ctx context.Context, b []sql.NullInt32) *GetValuesBatchResults { batch := &pgx.Batch{} for _, a := range b { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(getValues, vals...) @@ -97,7 +97,7 @@ type InsertValuesParams struct { func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *InsertValuesBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.A, a.B, } diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go index e28790b2ce..49b7e30271 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go index ee9c9d3d4e..fa0d29714c 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go index 979298df0a..865697d866 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go index 244080045c..65bb113d6f 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch.go package querytest @@ -32,7 +32,7 @@ type GetValuesBatchResults struct { func (q *Queries) GetValues(ctx context.Context, b []pgtype.Int4) *GetValuesBatchResults { batch := &pgx.Batch{} for _, a := range b { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(getValues, vals...) @@ -97,7 +97,7 @@ type InsertValuesParams struct { func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) *InsertValuesBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.A, a.B, } diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go index 21d826834a..1f79ce6197 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go index 219b82bdc2..80e1ef5a44 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go index f0a273303c..11c950cd9b 100644 --- a/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/batch_imports/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/batch_parameter_limit/issue.md b/internal/endtoend/testdata/batch_parameter_limit/issue.md new file mode 100644 index 0000000000..e0d6146269 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/3185 diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go new file mode 100644 index 0000000000..6d66b1275c --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/batch.go @@ -0,0 +1,71 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: batch.go + +package querytest + +import ( + "context" + "errors" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const createAuthors = `-- name: CreateAuthors :batchexec +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +` + +type CreateAuthorsBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type CreateAuthorsParams struct { + Name string + Bio pgtype.Text +} + +func (q *Queries) CreateAuthors(ctx context.Context, arg []CreateAuthorsParams) *CreateAuthorsBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []any{ + a.Name, + a.Bio, + } + batch.Queue(createAuthors, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &CreateAuthorsBatchResults{br, len(arg), false} +} + +func (b *CreateAuthorsBatchResults) Exec(f func(int, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + if b.closed { + if f != nil { + f(t, ErrBatchAlreadyClosed) + } + continue + } + _, err := b.br.Exec() + if f != nil { + f(t, err) + } + } +} + +func (b *CreateAuthorsBatchResults) Close() error { + b.closed = true + return b.br.Close() +} diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/db.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1f79ce6197 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row + SendBatch(context.Context, *pgx.Batch) pgx.BatchResults +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/models.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..4e97f66a99 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..aa95052ac1 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/go/query.sql.go @@ -0,0 +1,6 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/query.sql b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/query.sql new file mode 100644 index 0000000000..3c25c9349e --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: CreateAuthors :batchexec +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +); diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/schema.sql b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..e5eb77fa4e --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_limit/postgresql/pgx/sqlc.yaml @@ -0,0 +1,11 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" + query_parameter_limit: 2 diff --git a/internal/endtoend/testdata/batch_parameter_type/issue.md b/internal/endtoend/testdata/batch_parameter_type/issue.md new file mode 100644 index 0000000000..13bb3e6b52 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2152 diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/exec.json b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go new file mode 100644 index 0000000000..706e0bfd20 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/batch.go @@ -0,0 +1,101 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: batch.go + +package querytest + +import ( + "context" + "errors" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" +) + +var ( + ErrBatchAlreadyClosed = errors.New("batch already closed") +) + +const insertMappping = `-- name: InsertMappping :batchexec +WITH + table1 + AS ( + SELECT + version + FROM + solar_commcard_mapping + WHERE + "deviceId" = $1 + ORDER BY + "updatedAt" DESC + LIMIT + 1 + ) +INSERT +INTO + solar_commcard_mapping + ("deviceId", version, sn, "updatedAt") +SELECT + $1, $2::text, $3, $4 +WHERE + NOT + EXISTS( + SELECT + version + FROM + table1 + WHERE + table1.version = $2::text + ) + OR NOT EXISTS(SELECT version FROM table1) +` + +type InsertMapppingBatchResults struct { + br pgx.BatchResults + tot int + closed bool +} + +type InsertMapppingParams struct { + DeviceId int64 + Version string + Sn string + UpdatedAt pgtype.Timestamptz +} + +func (q *Queries) InsertMappping(ctx context.Context, arg []InsertMapppingParams) *InsertMapppingBatchResults { + batch := &pgx.Batch{} + for _, a := range arg { + vals := []any{ + a.DeviceId, + a.Version, + a.Sn, + a.UpdatedAt, + } + batch.Queue(insertMappping, vals...) + } + br := q.db.SendBatch(ctx, batch) + return &InsertMapppingBatchResults{br, len(arg), false} +} + +func (b *InsertMapppingBatchResults) Exec(f func(int, error)) { + defer b.br.Close() + for t := 0; t < b.tot; t++ { + if b.closed { + if f != nil { + f(t, ErrBatchAlreadyClosed) + } + continue + } + _, err := b.br.Exec() + if f != nil { + f(t, err) + } + } +} + +func (b *InsertMapppingBatchResults) Close() error { + b.closed = true + return b.br.Close() +} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/db.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..1f79ce6197 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/db.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row + SendBatch(context.Context, *pgx.Batch) pgx.BatchResults +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/models.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..b9991d5602 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type SolarCommcardMapping struct { + ID int64 + DeviceId int64 + Version string + Sn string + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..aa95052ac1 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/go/query.sql.go @@ -0,0 +1,6 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/query.sql b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/query.sql new file mode 100644 index 0000000000..326b9f2f46 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/query.sql @@ -0,0 +1,32 @@ +-- name: InsertMappping :batchexec +WITH + table1 + AS ( + SELECT + version + FROM + solar_commcard_mapping + WHERE + "deviceId" = $1 + ORDER BY + "updatedAt" DESC + LIMIT + 1 + ) +INSERT +INTO + solar_commcard_mapping + ("deviceId", version, sn, "updatedAt") +SELECT + $1, @version::text, $3, $4 +WHERE + NOT + EXISTS( + SELECT + * + FROM + table1 + WHERE + table1.version = @version::text + ) + OR NOT EXISTS(SELECT * FROM table1); diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/schema.sql b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..3aaa4db952 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/schema.sql @@ -0,0 +1,14 @@ +CREATE TABLE public.solar_commcard_mapping ( + id + INT8 NOT NULL, + "deviceId" + INT8 NOT NULL, + version + VARCHAR(32) DEFAULT ''::VARCHAR NOT NULL, + sn + VARCHAR(32) DEFAULT ''::VARCHAR NOT NULL, + "createdAt" + TIMESTAMPTZ DEFAULT now(), + "updatedAt" + TIMESTAMPTZ DEFAULT now() +); diff --git a/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/batch_parameter_type/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/between_args/mysql/go/db.go b/internal/endtoend/testdata/between_args/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/between_args/mysql/go/db.go +++ b/internal/endtoend/testdata/between_args/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/between_args/mysql/go/models.go b/internal/endtoend/testdata/between_args/mysql/go/models.go index 699c74d3dc..cab07990bc 100644 --- a/internal/endtoend/testdata/between_args/mysql/go/models.go +++ b/internal/endtoend/testdata/between_args/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Product struct { ID int64 Name string diff --git a/internal/endtoend/testdata/between_args/mysql/go/query.sql.go b/internal/endtoend/testdata/between_args/mysql/go/query.sql.go index d421964a55..4b357c72a3 100644 --- a/internal/endtoend/testdata/between_args/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/between_args/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/between_args/sqlite/go/db.go b/internal/endtoend/testdata/between_args/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/between_args/sqlite/go/db.go +++ b/internal/endtoend/testdata/between_args/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/between_args/sqlite/go/models.go b/internal/endtoend/testdata/between_args/sqlite/go/models.go index 9d6fdf8f18..f67b77aff3 100644 --- a/internal/endtoend/testdata/between_args/sqlite/go/models.go +++ b/internal/endtoend/testdata/between_args/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Product struct { Name string Price int64 diff --git a/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go b/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go index 8fdca27665..2083abf243 100644 --- a/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/between_args/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,9 +10,9 @@ import ( ) const getBetweenPrices = `-- name: GetBetweenPrices :many -SELECT name, price -FROM products -WHERE price BETWEEN ? AND ? +SELECT name, price +FROM products +WHERE price BETWEEN ? AND ? ` type GetBetweenPricesParams struct { @@ -44,9 +44,9 @@ func (q *Queries) GetBetweenPrices(ctx context.Context, arg GetBetweenPricesPara } const getBetweenPricesTable = `-- name: GetBetweenPricesTable :many -SELECT name, price -FROM products -WHERE products.price BETWEEN ? AND ? +SELECT name, price +FROM products +WHERE products.price BETWEEN ? AND ? ` type GetBetweenPricesTableParams struct { @@ -78,9 +78,9 @@ func (q *Queries) GetBetweenPricesTable(ctx context.Context, arg GetBetweenPrice } const getBetweenPricesTableAlias = `-- name: GetBetweenPricesTableAlias :many -SELECT name, price -FROM products as p -WHERE p.price BETWEEN ? AND ? +SELECT name, price +FROM products AS p +WHERE p.price BETWEEN ? AND ? ` type GetBetweenPricesTableAliasParams struct { diff --git a/internal/endtoend/testdata/between_args/sqlite/query.sql b/internal/endtoend/testdata/between_args/sqlite/query.sql index a7648ca582..14dd15f06f 100644 --- a/internal/endtoend/testdata/between_args/sqlite/query.sql +++ b/internal/endtoend/testdata/between_args/sqlite/query.sql @@ -1,14 +1,14 @@ -- name: GetBetweenPrices :many -SELECT * -FROM products -WHERE price BETWEEN ? AND ?; +SELECT * +FROM products +WHERE price BETWEEN ? AND ?; -- name: GetBetweenPricesTable :many -SELECT * -FROM products -WHERE products.price BETWEEN ? AND ?; +SELECT * +FROM products +WHERE products.price BETWEEN ? AND ?; -- name: GetBetweenPricesTableAlias :many -SELECT * -FROM products as p -WHERE p.price BETWEEN ? AND ?; +SELECT * +FROM products AS p +WHERE p.price BETWEEN ? AND ?; diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go index ce7ffea6a5..3dc085df43 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go index 2cc808cbe2..fe8f861ead 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go index 6fc89fd265..a53a6f8213 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go index 2cc808cbe2..fe8f861ead 100644 --- a/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go index 3b37b87855..cc3795daa1 100644 --- a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/db.go @@ -2,7 +2,7 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors @@ -12,10 +12,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go index dda79e2aef..d556159aec 100644 --- a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/models.go @@ -2,7 +2,7 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go index c647da3c9c..a3ae69a5d3 100644 --- a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/querier.go @@ -2,7 +2,7 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors diff --git a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go index e99191d560..0cb38ae2db 100644 --- a/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/build_tags/postgresql/stdlib/go/query.sql.go @@ -2,7 +2,7 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package authors diff --git a/internal/endtoend/testdata/builtins/postgresql/exec.json b/internal/endtoend/testdata/builtins/postgresql/exec.json new file mode 100644 index 0000000000..97f81fbc66 --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/builtins/postgresql/go/db.go b/internal/endtoend/testdata/builtins/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/builtins/postgresql/go/db.go +++ b/internal/endtoend/testdata/builtins/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/builtins/postgresql/go/models.go b/internal/endtoend/testdata/builtins/postgresql/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/builtins/postgresql/go/models.go +++ b/internal/endtoend/testdata/builtins/postgresql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go b/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go new file mode 100644 index 0000000000..5dd7c165fe --- /dev/null +++ b/internal/endtoend/testdata/builtins/postgresql/go/query.sql.go @@ -0,0 +1,274 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const abs = `-- name: Abs :one +SELECT abs(-17.4) +` + +func (q *Queries) Abs(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, abs) + var abs int64 + err := row.Scan(&abs) + return abs, err +} + +const cbrt = `-- name: Cbrt :one +SELECT cbrt(27.0) +` + +func (q *Queries) Cbrt(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, cbrt) + var cbrt float64 + err := row.Scan(&cbrt) + return cbrt, err +} + +const ceil = `-- name: Ceil :one +SELECT ceil(-42.8) +` + +func (q *Queries) Ceil(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, ceil) + var ceil float64 + err := row.Scan(&ceil) + return ceil, err +} + +const ceiling = `-- name: Ceiling :one +SELECT ceiling(-95.3) +` + +func (q *Queries) Ceiling(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, ceiling) + var ceiling float64 + err := row.Scan(&ceiling) + return ceiling, err +} + +const degrees = `-- name: Degrees :one +SELECT degrees(0.5) +` + +func (q *Queries) Degrees(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, degrees) + var degrees float64 + err := row.Scan(°rees) + return degrees, err +} + +const div = `-- name: Div :one +SELECT div(9,4) +` + +func (q *Queries) Div(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, div) + var div string + err := row.Scan(&div) + return div, err +} + +const exp = `-- name: Exp :one +SELECT exp(1.0) +` + +func (q *Queries) Exp(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, exp) + var exp float64 + err := row.Scan(&exp) + return exp, err +} + +const floor = `-- name: Floor :one +SELECT floor(-42.8) +` + +func (q *Queries) Floor(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, floor) + var floor float64 + err := row.Scan(&floor) + return floor, err +} + +const ln = `-- name: Ln :one +SELECT ln(2.0) +` + +func (q *Queries) Ln(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, ln) + var ln float64 + err := row.Scan(&ln) + return ln, err +} + +const log = `-- name: Log :one +SELECT log(100.0) +` + +func (q *Queries) Log(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, log) + var log float64 + err := row.Scan(&log) + return log, err +} + +const logs = `-- name: Logs :one +SELECT log(2.0, 64.0) +` + +func (q *Queries) Logs(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, logs) + var log string + err := row.Scan(&log) + return log, err +} + +const mod = `-- name: Mod :one +SELECT mod(9,4) +` + +func (q *Queries) Mod(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, mod) + var mod int64 + err := row.Scan(&mod) + return mod, err +} + +const pi = `-- name: Pi :one +SELECT pi() +` + +func (q *Queries) Pi(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, pi) + var pi float64 + err := row.Scan(&pi) + return pi, err +} + +const power = `-- name: Power :one +SELECT power(9.0, 3.0) +` + +func (q *Queries) Power(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, power) + var power float64 + err := row.Scan(&power) + return power, err +} + +const radians = `-- name: Radians :one +SELECT radians(45.0) +` + +func (q *Queries) Radians(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, radians) + var radians float64 + err := row.Scan(&radians) + return radians, err +} + +const round = `-- name: Round :one +SELECT round(42.4) +` + +func (q *Queries) Round(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, round) + var round float64 + err := row.Scan(&round) + return round, err +} + +const rounds = `-- name: Rounds :one +SELECT round(42.4382, 2) +` + +func (q *Queries) Rounds(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, rounds) + var round string + err := row.Scan(&round) + return round, err +} + +const scale = `-- name: Scale :one +SELECT scale(8.41) +` + +func (q *Queries) Scale(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, scale) + var scale int32 + err := row.Scan(&scale) + return scale, err +} + +const sign = `-- name: Sign :one +SELECT sign(-8.4) +` + +func (q *Queries) Sign(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, sign) + var sign float64 + err := row.Scan(&sign) + return sign, err +} + +const sqrt = `-- name: Sqrt :one +SELECT sqrt(2.0) +` + +func (q *Queries) Sqrt(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, sqrt) + var sqrt float64 + err := row.Scan(&sqrt) + return sqrt, err +} + +const trunc = `-- name: Trunc :one +SELECT trunc(42.8) +` + +func (q *Queries) Trunc(ctx context.Context) (float64, error) { + row := q.db.QueryRowContext(ctx, trunc) + var trunc float64 + err := row.Scan(&trunc) + return trunc, err +} + +const truncs = `-- name: Truncs :one +SELECT trunc(42.4382, 2) +` + +func (q *Queries) Truncs(ctx context.Context) (string, error) { + row := q.db.QueryRowContext(ctx, truncs) + var trunc string + err := row.Scan(&trunc) + return trunc, err +} + +const widthBucketNumerics = `-- name: WidthBucketNumerics :one +SELECT width_bucket(5.35, 0.024, 10.06, 5) +` + +func (q *Queries) WidthBucketNumerics(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, widthBucketNumerics) + var width_bucket int32 + err := row.Scan(&width_bucket) + return width_bucket, err +} + +const widthBucketTimestamps = `-- name: WidthBucketTimestamps :one +SELECT width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]) +` + +func (q *Queries) WidthBucketTimestamps(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, widthBucketTimestamps) + var width_bucket int32 + err := row.Scan(&width_bucket) + return width_bucket, err +} diff --git a/internal/endtoend/testdata/builtins/postgresql/query.sql b/internal/endtoend/testdata/builtins/postgresql/query.sql index ee4723f8ed..2c62e5f772 100644 --- a/internal/endtoend/testdata/builtins/postgresql/query.sql +++ b/internal/endtoend/testdata/builtins/postgresql/query.sql @@ -1,25 +1,48 @@ +-- name: Abs :one SELECT abs(-17.4); +-- name: Cbrt :one SELECT cbrt(27.0); +-- name: Ceil :one SELECT ceil(-42.8); +-- name: Ceiling :one SELECT ceiling(-95.3); +-- name: Degrees :one SELECT degrees(0.5); +-- name: Div :one SELECT div(9,4); +-- name: Exp :one SELECT exp(1.0); +-- name: Floor :one SELECT floor(-42.8); +-- name: Ln :one SELECT ln(2.0); +-- name: Log :one SELECT log(100.0); +-- name: Logs :one SELECT log(2.0, 64.0); +-- name: Mod :one SELECT mod(9,4); +-- name: Pi :one SELECT pi(); +-- name: Power :one SELECT power(9.0, 3.0); +-- name: Radians :one SELECT radians(45.0); +-- name: Round :one SELECT round(42.4); +-- name: Rounds :one SELECT round(42.4382, 2); +-- name: Scale :one SELECT scale(8.41); +-- name: Sign :one SELECT sign(-8.4); +-- name: Sqrt :one SELECT sqrt(2.0); +-- name: Trunc :one SELECT trunc(42.8); +-- name: Truncs :one SELECT trunc(42.4382, 2); +-- name: WidthBucketNumerics :one SELECT width_bucket(5.35, 0.024, 10.06, 5); +-- name: WidthBucketTimestamps :one SELECT width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]); -create schema if not exists sqlc; diff --git a/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go index 0cd44e32b8..de2a1fa89c 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: aggfunc.sql package querytest @@ -47,9 +47,9 @@ const getGroupConcatInt = `-- name: GetGroupConcatInt :one SELECT group_concat(int_val) FROM test ` -func (q *Queries) GetGroupConcatInt(ctx context.Context) (string, error) { +func (q *Queries) GetGroupConcatInt(ctx context.Context) (sql.NullString, error) { row := q.db.QueryRowContext(ctx, getGroupConcatInt) - var group_concat string + var group_concat sql.NullString err := row.Scan(&group_concat) return group_concat, err } @@ -58,9 +58,9 @@ const getGroupConcatInt2 = `-- name: GetGroupConcatInt2 :one SELECT group_concat(1, ':') FROM test ` -func (q *Queries) GetGroupConcatInt2(ctx context.Context) (string, error) { +func (q *Queries) GetGroupConcatInt2(ctx context.Context) (sql.NullString, error) { row := q.db.QueryRowContext(ctx, getGroupConcatInt2) - var group_concat string + var group_concat sql.NullString err := row.Scan(&group_concat) return group_concat, err } @@ -69,9 +69,9 @@ const getGroupConcatText = `-- name: GetGroupConcatText :one SELECT group_concat(text_val) FROM test ` -func (q *Queries) GetGroupConcatText(ctx context.Context) (string, error) { +func (q *Queries) GetGroupConcatText(ctx context.Context) (sql.NullString, error) { row := q.db.QueryRowContext(ctx, getGroupConcatText) - var group_concat string + var group_concat sql.NullString err := row.Scan(&group_concat) return group_concat, err } @@ -80,9 +80,9 @@ const getGroupConcatText2 = `-- name: GetGroupConcatText2 :one SELECT group_concat(text_val, ':') FROM test ` -func (q *Queries) GetGroupConcatText2(ctx context.Context) (string, error) { +func (q *Queries) GetGroupConcatText2(ctx context.Context) (sql.NullString, error) { row := q.db.QueryRowContext(ctx, getGroupConcatText2) - var group_concat string + var group_concat sql.NullString err := row.Scan(&group_concat) return group_concat, err } @@ -91,9 +91,9 @@ const getMaxInt = `-- name: GetMaxInt :one SELECT max(int_val) FROM test ` -func (q *Queries) GetMaxInt(ctx context.Context) (interface{}, error) { +func (q *Queries) GetMaxInt(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getMaxInt) - var max interface{} + var max any err := row.Scan(&max) return max, err } @@ -102,9 +102,9 @@ const getMaxText = `-- name: GetMaxText :one SELECT max(text_val) FROM test ` -func (q *Queries) GetMaxText(ctx context.Context) (interface{}, error) { +func (q *Queries) GetMaxText(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getMaxText) - var max interface{} + var max any err := row.Scan(&max) return max, err } @@ -113,9 +113,9 @@ const getMinInt = `-- name: GetMinInt :one SELECT min(int_val) FROM test ` -func (q *Queries) GetMinInt(ctx context.Context) (interface{}, error) { +func (q *Queries) GetMinInt(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getMinInt) - var min interface{} + var min any err := row.Scan(&min) return min, err } @@ -124,9 +124,9 @@ const getMinText = `-- name: GetMinText :one SELECT min(text_val) FROM test ` -func (q *Queries) GetMinText(ctx context.Context) (interface{}, error) { +func (q *Queries) GetMinText(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getMinText) - var min interface{} + var min any err := row.Scan(&min) return min, err } diff --git a/internal/endtoend/testdata/builtins/sqlite/go/db.go b/internal/endtoend/testdata/builtins/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/db.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go index f83814a94a..152d80ad46 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: mathfunc.sql package querytest @@ -10,7 +10,7 @@ import ( ) const getAcos = `-- name: GetAcos :one -select acos(1.0) +SELECT acos(1.0) ` func (q *Queries) GetAcos(ctx context.Context) (float64, error) { @@ -21,7 +21,7 @@ func (q *Queries) GetAcos(ctx context.Context) (float64, error) { } const getAcosh = `-- name: GetAcosh :one -select acosh(1.0) +SELECT acosh(1.0) ` func (q *Queries) GetAcosh(ctx context.Context) (float64, error) { @@ -32,7 +32,7 @@ func (q *Queries) GetAcosh(ctx context.Context) (float64, error) { } const getAsin = `-- name: GetAsin :one -select asin(1.0) +SELECT asin(1.0) ` func (q *Queries) GetAsin(ctx context.Context) (float64, error) { @@ -43,7 +43,7 @@ func (q *Queries) GetAsin(ctx context.Context) (float64, error) { } const getAsinh = `-- name: GetAsinh :one -select asinh(1.0) +SELECT asinh(1.0) ` func (q *Queries) GetAsinh(ctx context.Context) (float64, error) { @@ -54,7 +54,7 @@ func (q *Queries) GetAsinh(ctx context.Context) (float64, error) { } const getAtan = `-- name: GetAtan :one -select atan(1.0) +SELECT atan(1.0) ` func (q *Queries) GetAtan(ctx context.Context) (float64, error) { @@ -65,7 +65,7 @@ func (q *Queries) GetAtan(ctx context.Context) (float64, error) { } const getAtan2 = `-- name: GetAtan2 :one -select atan2(1.0, 0.5) +SELECT atan2(1.0, 0.5) ` func (q *Queries) GetAtan2(ctx context.Context) (float64, error) { @@ -76,7 +76,7 @@ func (q *Queries) GetAtan2(ctx context.Context) (float64, error) { } const getAtanh = `-- name: GetAtanh :one -select atanh(1.0) +SELECT atanh(1.0) ` func (q *Queries) GetAtanh(ctx context.Context) (float64, error) { @@ -87,29 +87,29 @@ func (q *Queries) GetAtanh(ctx context.Context) (float64, error) { } const getCeil = `-- name: GetCeil :one -select ceil(1.0) +SELECT ceil(1.0) ` -func (q *Queries) GetCeil(ctx context.Context) (int64, error) { +func (q *Queries) GetCeil(ctx context.Context) (float64, error) { row := q.db.QueryRowContext(ctx, getCeil) - var ceil int64 + var ceil float64 err := row.Scan(&ceil) return ceil, err } const getCeilin = `-- name: GetCeilin :one -select ceiling(1.0) +SELECT ceiling(1.0) ` -func (q *Queries) GetCeilin(ctx context.Context) (int64, error) { +func (q *Queries) GetCeilin(ctx context.Context) (float64, error) { row := q.db.QueryRowContext(ctx, getCeilin) - var ceiling int64 + var ceiling float64 err := row.Scan(&ceiling) return ceiling, err } const getCos = `-- name: GetCos :one -select cos(1.0) +SELECT cos(1.0) ` func (q *Queries) GetCos(ctx context.Context) (float64, error) { @@ -120,7 +120,7 @@ func (q *Queries) GetCos(ctx context.Context) (float64, error) { } const getCosh = `-- name: GetCosh :one -select cosh(1.0) +SELECT cosh(1.0) ` func (q *Queries) GetCosh(ctx context.Context) (float64, error) { @@ -131,7 +131,7 @@ func (q *Queries) GetCosh(ctx context.Context) (float64, error) { } const getDegrees = `-- name: GetDegrees :one -select degrees(1.0) +SELECT degrees(1.0) ` func (q *Queries) GetDegrees(ctx context.Context) (float64, error) { @@ -142,7 +142,7 @@ func (q *Queries) GetDegrees(ctx context.Context) (float64, error) { } const getExp = `-- name: GetExp :one -select exp(1.0) +SELECT exp(1.0) ` func (q *Queries) GetExp(ctx context.Context) (float64, error) { @@ -153,18 +153,18 @@ func (q *Queries) GetExp(ctx context.Context) (float64, error) { } const getFloor = `-- name: GetFloor :one -select floor(1.0) +SELECT floor(1.0) ` -func (q *Queries) GetFloor(ctx context.Context) (int64, error) { +func (q *Queries) GetFloor(ctx context.Context) (float64, error) { row := q.db.QueryRowContext(ctx, getFloor) - var floor int64 + var floor float64 err := row.Scan(&floor) return floor, err } const getLn = `-- name: GetLn :one -select ln(1.0) +SELECT ln(1.0) ` func (q *Queries) GetLn(ctx context.Context) (float64, error) { @@ -175,7 +175,7 @@ func (q *Queries) GetLn(ctx context.Context) (float64, error) { } const getLog = `-- name: GetLog :one -select log(1.0) +SELECT log(1.0) ` func (q *Queries) GetLog(ctx context.Context) (float64, error) { @@ -186,7 +186,7 @@ func (q *Queries) GetLog(ctx context.Context) (float64, error) { } const getLog10 = `-- name: GetLog10 :one -select log10(1.0) +SELECT log10(1.0) ` func (q *Queries) GetLog10(ctx context.Context) (float64, error) { @@ -197,7 +197,7 @@ func (q *Queries) GetLog10(ctx context.Context) (float64, error) { } const getLog2 = `-- name: GetLog2 :one -select log2(1.0) +SELECT log2(1.0) ` func (q *Queries) GetLog2(ctx context.Context) (float64, error) { @@ -208,7 +208,7 @@ func (q *Queries) GetLog2(ctx context.Context) (float64, error) { } const getLogBase = `-- name: GetLogBase :one -select log(1.0, 2.0) +SELECT log(1.0, 2.0) ` func (q *Queries) GetLogBase(ctx context.Context) (float64, error) { @@ -219,7 +219,7 @@ func (q *Queries) GetLogBase(ctx context.Context) (float64, error) { } const getMod = `-- name: GetMod :one -select mod(1, 2) +SELECT mod(1, 2) ` func (q *Queries) GetMod(ctx context.Context) (float64, error) { @@ -230,7 +230,7 @@ func (q *Queries) GetMod(ctx context.Context) (float64, error) { } const getPi = `-- name: GetPi :one -select pi() +SELECT pi() ` func (q *Queries) GetPi(ctx context.Context) (float64, error) { @@ -241,7 +241,7 @@ func (q *Queries) GetPi(ctx context.Context) (float64, error) { } const getPow = `-- name: GetPow :one -select pow(1, 2) +SELECT pow(1, 2) ` func (q *Queries) GetPow(ctx context.Context) (float64, error) { @@ -252,7 +252,7 @@ func (q *Queries) GetPow(ctx context.Context) (float64, error) { } const getPower = `-- name: GetPower :one -select power(1, 2) +SELECT power(1, 2) ` func (q *Queries) GetPower(ctx context.Context) (float64, error) { @@ -263,7 +263,7 @@ func (q *Queries) GetPower(ctx context.Context) (float64, error) { } const getRadians = `-- name: GetRadians :one -select radians(1) +SELECT radians(1) ` func (q *Queries) GetRadians(ctx context.Context) (float64, error) { @@ -274,7 +274,7 @@ func (q *Queries) GetRadians(ctx context.Context) (float64, error) { } const getSin = `-- name: GetSin :one -select sin(1.0) +SELECT sin(1.0) ` func (q *Queries) GetSin(ctx context.Context) (float64, error) { @@ -285,7 +285,7 @@ func (q *Queries) GetSin(ctx context.Context) (float64, error) { } const getSinh = `-- name: GetSinh :one -select sinh(1.0) +SELECT sinh(1.0) ` func (q *Queries) GetSinh(ctx context.Context) (float64, error) { @@ -296,7 +296,7 @@ func (q *Queries) GetSinh(ctx context.Context) (float64, error) { } const getSqrt = `-- name: GetSqrt :one -select sqrt(1.0) +SELECT sqrt(1.0) ` func (q *Queries) GetSqrt(ctx context.Context) (float64, error) { @@ -307,7 +307,7 @@ func (q *Queries) GetSqrt(ctx context.Context) (float64, error) { } const getTan = `-- name: GetTan :one -select tan(1.0) +SELECT tan(1.0) ` func (q *Queries) GetTan(ctx context.Context) (float64, error) { @@ -318,12 +318,12 @@ func (q *Queries) GetTan(ctx context.Context) (float64, error) { } const getTrunc = `-- name: GetTrunc :one -select trunc(1.0) +SELECT trunc(1.0) ` -func (q *Queries) GetTrunc(ctx context.Context) (int64, error) { +func (q *Queries) GetTrunc(ctx context.Context) (float64, error) { row := q.db.QueryRowContext(ctx, getTrunc) - var trunc int64 + var trunc float64 err := row.Scan(&trunc) return trunc, err } diff --git a/internal/endtoend/testdata/builtins/sqlite/go/models.go b/internal/endtoend/testdata/builtins/sqlite/go/models.go index 7ed428673c..c7e7054ea3 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/models.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Test struct { ID int64 IntVal int64 diff --git a/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go b/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go index a920c10b9a..06ec0436ce 100644 --- a/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go +++ b/internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: scalarfunc.sql package querytest @@ -58,9 +58,9 @@ const getCoalesce = `-- name: GetCoalesce :one SELECT coalesce(NULL, 1, 'test') ` -func (q *Queries) GetCoalesce(ctx context.Context) (interface{}, error) { +func (q *Queries) GetCoalesce(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getCoalesce) - var coalesce interface{} + var coalesce any err := row.Scan(&coalesce) return coalesce, err } @@ -69,9 +69,9 @@ const getFormat = `-- name: GetFormat :one SELECT format('Hello %s', 'world') ` -func (q *Queries) GetFormat(ctx context.Context) (sql.NullString, error) { +func (q *Queries) GetFormat(ctx context.Context) (string, error) { row := q.db.QueryRowContext(ctx, getFormat) - var format sql.NullString + var format string err := row.Scan(&format) return format, err } @@ -102,9 +102,9 @@ const getIfnull = `-- name: GetIfnull :one SELECT ifnull(1, 2) ` -func (q *Queries) GetIfnull(ctx context.Context) (interface{}, error) { +func (q *Queries) GetIfnull(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getIfnull) - var ifnull interface{} + var ifnull any err := row.Scan(&ifnull) return ifnull, err } @@ -113,9 +113,9 @@ const getIif = `-- name: GetIif :one SELECT iif(1, 2, 3) ` -func (q *Queries) GetIif(ctx context.Context) (interface{}, error) { +func (q *Queries) GetIif(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getIif) - var iif interface{} + var iif any err := row.Scan(&iif) return iif, err } @@ -124,9 +124,9 @@ const getInstr = `-- name: GetInstr :one SELECT instr('hello', 'l') ` -func (q *Queries) GetInstr(ctx context.Context) (sql.NullInt64, error) { +func (q *Queries) GetInstr(ctx context.Context) (int64, error) { row := q.db.QueryRowContext(ctx, getInstr) - var instr sql.NullInt64 + var instr int64 err := row.Scan(&instr) return instr, err } @@ -146,9 +146,9 @@ const getLength = `-- name: GetLength :one SELECT length('12345') ` -func (q *Queries) GetLength(ctx context.Context) (sql.NullInt64, error) { +func (q *Queries) GetLength(ctx context.Context) (int64, error) { row := q.db.QueryRowContext(ctx, getLength) - var length sql.NullInt64 + var length int64 err := row.Scan(&length) return length, err } @@ -179,9 +179,9 @@ const getLikelihood = `-- name: GetLikelihood :one SELECT likelihood('12345', 0.5) ` -func (q *Queries) GetLikelihood(ctx context.Context) (interface{}, error) { +func (q *Queries) GetLikelihood(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getLikelihood) - var likelihood interface{} + var likelihood any err := row.Scan(&likelihood) return likelihood, err } @@ -190,9 +190,9 @@ const getLikely = `-- name: GetLikely :one SELECT likely('12345') ` -func (q *Queries) GetLikely(ctx context.Context) (interface{}, error) { +func (q *Queries) GetLikely(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getLikely) - var likely interface{} + var likely any err := row.Scan(&likely) return likely, err } @@ -234,9 +234,9 @@ const getMax3 = `-- name: GetMax3 :one SELECT max(1, 3, 2) ` -func (q *Queries) GetMax3(ctx context.Context) (interface{}, error) { +func (q *Queries) GetMax3(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getMax3) - var max interface{} + var max any err := row.Scan(&max) return max, err } @@ -245,9 +245,9 @@ const getMin3 = `-- name: GetMin3 :one SELECT min(1, 3, 2) ` -func (q *Queries) GetMin3(ctx context.Context) (interface{}, error) { +func (q *Queries) GetMin3(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getMin3) - var min interface{} + var min any err := row.Scan(&min) return min, err } @@ -256,9 +256,9 @@ const getNullif = `-- name: GetNullif :one SELECT nullif(1, 2) ` -func (q *Queries) GetNullif(ctx context.Context) (interface{}, error) { +func (q *Queries) GetNullif(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getNullif) - var nullif interface{} + var nullif any err := row.Scan(&nullif) return nullif, err } @@ -267,9 +267,9 @@ const getPrintf = `-- name: GetPrintf :one SELECT printf('Hello %s', 'world') ` -func (q *Queries) GetPrintf(ctx context.Context) (sql.NullString, error) { +func (q *Queries) GetPrintf(ctx context.Context) (string, error) { row := q.db.QueryRowContext(ctx, getPrintf) - var printf sql.NullString + var printf string err := row.Scan(&printf) return printf, err } @@ -289,9 +289,9 @@ const getRandom = `-- name: GetRandom :one SELECT random() ` -func (q *Queries) GetRandom(ctx context.Context) (interface{}, error) { +func (q *Queries) GetRandom(ctx context.Context) (int64, error) { row := q.db.QueryRowContext(ctx, getRandom) - var random interface{} + var random int64 err := row.Scan(&random) return random, err } @@ -300,9 +300,9 @@ const getRandomBlob = `-- name: GetRandomBlob :one SELECT randomblob(16) ` -func (q *Queries) GetRandomBlob(ctx context.Context) (interface{}, error) { +func (q *Queries) GetRandomBlob(ctx context.Context) ([]byte, error) { row := q.db.QueryRowContext(ctx, getRandomBlob) - var randomblob interface{} + var randomblob []byte err := row.Scan(&randomblob) return randomblob, err } @@ -384,17 +384,6 @@ func (q *Queries) GetSQLiteCompileOptionUsed(ctx context.Context) (int64, error) return sqlite_compileoption_used, err } -const getSQLiteOffset = `-- name: GetSQLiteOffset :one -SELECT sqlite_offset(1) -` - -func (q *Queries) GetSQLiteOffset(ctx context.Context) (sql.NullInt64, error) { - row := q.db.QueryRowContext(ctx, getSQLiteOffset) - var sqlite_offset sql.NullInt64 - err := row.Scan(&sqlite_offset) - return sqlite_offset, err -} - const getSQLiteSourceID = `-- name: GetSQLiteSourceID :one SELECT sqlite_source_id() ` @@ -432,9 +421,9 @@ const getSoundex = `-- name: GetSoundex :one SELECT soundex('abc') ` -func (q *Queries) GetSoundex(ctx context.Context) (string, error) { +func (q *Queries) GetSoundex(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getSoundex) - var soundex string + var soundex any err := row.Scan(&soundex) return soundex, err } @@ -542,9 +531,9 @@ const getUnlikely = `-- name: GetUnlikely :one SELECT unlikely('12345') ` -func (q *Queries) GetUnlikely(ctx context.Context) (interface{}, error) { +func (q *Queries) GetUnlikely(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, getUnlikely) - var unlikely interface{} + var unlikely any err := row.Scan(&unlikely) return unlikely, err } diff --git a/internal/endtoend/testdata/builtins/sqlite/queries/mathfunc.sql b/internal/endtoend/testdata/builtins/sqlite/queries/mathfunc.sql index d62c2b6521..cf3e2f5c44 100644 --- a/internal/endtoend/testdata/builtins/sqlite/queries/mathfunc.sql +++ b/internal/endtoend/testdata/builtins/sqlite/queries/mathfunc.sql @@ -1,86 +1,86 @@ -- name: GetAcos :one -select acos(1.0); +SELECT acos(1.0); -- name: GetAcosh :one -select acosh(1.0); +SELECT acosh(1.0); -- name: GetAsin :one -select asin(1.0); +SELECT asin(1.0); -- name: GetAsinh :one -select asinh(1.0); +SELECT asinh(1.0); -- name: GetAtan :one -select atan(1.0); +SELECT atan(1.0); -- name: GetAtan2 :one -select atan2(1.0, 0.5); +SELECT atan2(1.0, 0.5); -- name: GetAtanh :one -select atanh(1.0); +SELECT atanh(1.0); -- name: GetCeil :one -select ceil(1.0); +SELECT ceil(1.0); -- name: GetCeilin :one -select ceiling(1.0); +SELECT ceiling(1.0); -- name: GetCos :one -select cos(1.0); +SELECT cos(1.0); -- name: GetCosh :one -select cosh(1.0); +SELECT cosh(1.0); -- name: GetDegrees :one -select degrees(1.0); +SELECT degrees(1.0); -- name: GetExp :one -select exp(1.0); +SELECT exp(1.0); -- name: GetFloor :one -select floor(1.0); +SELECT floor(1.0); -- name: GetLn :one -select ln(1.0); +SELECT ln(1.0); -- name: GetLog :one -select log(1.0); +SELECT log(1.0); -- name: GetLog10 :one -select log10(1.0); +SELECT log10(1.0); -- name: GetLogBase :one -select log(1.0, 2.0); +SELECT log(1.0, 2.0); -- name: GetLog2 :one -select log2(1.0); +SELECT log2(1.0); -- name: GetMod :one -select mod(1, 2); +SELECT mod(1, 2); -- name: GetPi :one -select pi(); +SELECT pi(); -- name: GetPow :one -select pow(1, 2); +SELECT pow(1, 2); -- name: GetPower :one -select power(1, 2); +SELECT power(1, 2); -- name: GetRadians :one -select radians(1); +SELECT radians(1); -- name: GetSin :one -select sin(1.0); +SELECT sin(1.0); -- name: GetSinh :one -select sinh(1.0); +SELECT sinh(1.0); -- name: GetSqrt :one -select sqrt(1.0); +SELECT sqrt(1.0); -- name: GetTan :one -select tan(1.0); +SELECT tan(1.0); -- name: GetTrunc :one -select trunc(1.0); +SELECT trunc(1.0); diff --git a/internal/endtoend/testdata/builtins/sqlite/queries/scalarfunc.sql b/internal/endtoend/testdata/builtins/sqlite/queries/scalarfunc.sql index 728a6be1a5..571cdb958a 100644 --- a/internal/endtoend/testdata/builtins/sqlite/queries/scalarfunc.sql +++ b/internal/endtoend/testdata/builtins/sqlite/queries/scalarfunc.sql @@ -106,9 +106,6 @@ SELECT sqlite_compileoption_get(1); -- name: GetSQLiteCompileOptionUsed :one SELECT sqlite_compileoption_used(1); --- name: GetSQLiteOffset :one -SELECT sqlite_offset(1); - -- name: GetSQLiteSourceID :one SELECT sqlite_source_id(); diff --git a/internal/endtoend/testdata/case_named_params/mysql/go/db.go b/internal/endtoend/testdata/case_named_params/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/go/db.go +++ b/internal/endtoend/testdata/case_named_params/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_named_params/mysql/go/models.go b/internal/endtoend/testdata/case_named_params/mysql/go/models.go index eeab96d306..9fa3edb9da 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/go/models.go +++ b/internal/endtoend/testdata/case_named_params/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go b/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go index e1ad20cf29..638b3aca66 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/case_named_params/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_named_params/mysql/schema.sql b/internal/endtoend/testdata/case_named_params/mysql/schema.sql index 3053802224..5e2bcfacf0 100644 --- a/internal/endtoend/testdata/case_named_params/mysql/schema.sql +++ b/internal/endtoend/testdata/case_named_params/mysql/schema.sql @@ -2,8 +2,8 @@ CREATE TABLE authors ( id BIGINT PRIMARY KEY, - username TEXT NULL, - email TEXT NULL, + username VARCHAR(10) NULL, + email VARCHAR(10) NULL, name TEXT NOT NULL, bio TEXT, UNIQUE KEY idx_username (username), diff --git a/internal/endtoend/testdata/case_named_params/postgresql/go/db.go b/internal/endtoend/testdata/case_named_params/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/go/db.go +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_named_params/postgresql/go/models.go b/internal/endtoend/testdata/case_named_params/postgresql/go/models.go index eeab96d306..9fa3edb9da 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/go/models.go +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go b/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go index ae222375ca..62c41cac6e 100644 --- a/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/case_named_params/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_named_params/sqlite/go/db.go b/internal/endtoend/testdata/case_named_params/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/case_named_params/sqlite/go/models.go b/internal/endtoend/testdata/case_named_params/sqlite/go/models.go new file mode 100644 index 0000000000..9fa3edb9da --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/go/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Username sql.NullString + Email sql.NullString + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go b/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go new file mode 100644 index 0000000000..318977f6a0 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/go/query.sql.go @@ -0,0 +1,36 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listAuthors = `-- name: ListAuthors :one +SELECT id, username, email, name, bio +FROM authors +WHERE email = CASE WHEN ?1 = '' then NULL else ?1 END + OR username = CASE WHEN ?2 = '' then NULL else ?2 END +LIMIT 1 +` + +type ListAuthorsParams struct { + Email any + Username any +} + +func (q *Queries) ListAuthors(ctx context.Context, arg ListAuthorsParams) (Author, error) { + row := q.db.QueryRowContext(ctx, listAuthors, arg.Email, arg.Username) + var i Author + err := row.Scan( + &i.ID, + &i.Username, + &i.Email, + &i.Name, + &i.Bio, + ) + return i, err +} diff --git a/internal/endtoend/testdata/case_named_params/sqlite/query.sql b/internal/endtoend/testdata/case_named_params/sqlite/query.sql new file mode 100644 index 0000000000..39d990902a --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/query.sql @@ -0,0 +1,6 @@ +-- name: ListAuthors :one +SELECT * +FROM authors +WHERE email = CASE WHEN sqlc.arg(email) = '' then NULL else sqlc.arg(email) END + OR username = CASE WHEN sqlc.arg(username) = '' then NULL else sqlc.arg(username) END +LIMIT 1; diff --git a/internal/endtoend/testdata/case_named_params/sqlite/schema.sql b/internal/endtoend/testdata/case_named_params/sqlite/schema.sql new file mode 100644 index 0000000000..0d6facced1 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE authors ( + id INTEGER PRIMARY KEY, + username TEXT NULL, + email TEXT NULL, + name TEXT NOT NULL, + bio TEXT +); + diff --git a/internal/endtoend/testdata/case_named_params/sqlite/sqlc.json b/internal/endtoend/testdata/case_named_params/sqlite/sqlc.json new file mode 100644 index 0000000000..95b9cd09c0 --- /dev/null +++ b/internal/endtoend/testdata/case_named_params/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go index cbd9b0e495..7954f731f0 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go b/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go index 9c81d090e4..a1c5a532e4 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/case_sensitive/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -12,10 +12,10 @@ import ( const insertContact = `-- name: InsertContact :exec INSERT INTO contacts ( - pid, - CustomerName + pid, + customername ) -VALUES (?,?) +VALUES (?, ?) ` type InsertContactParams struct { diff --git a/internal/endtoend/testdata/case_sensitive/sqlite/query.sql b/internal/endtoend/testdata/case_sensitive/sqlite/query.sql index 0c05277ef4..20dafb2fc3 100644 --- a/internal/endtoend/testdata/case_sensitive/sqlite/query.sql +++ b/internal/endtoend/testdata/case_sensitive/sqlite/query.sql @@ -1,7 +1,6 @@ -- name: InsertContact :exec INSERT INTO contacts ( - pid, - CustomerName + pid, + customername ) -VALUES (?,?) -; +VALUES (?, ?); diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go index 9e45f24968..247c97ed60 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go index 9e45f24968..247c97ed60 100644 --- a/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go index 323fd6a663..27996143b8 100644 --- a/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/case_stmt_bool/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_text/pgx/v4/go/db.go b/internal/endtoend/testdata/case_text/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_text/pgx/v4/go/models.go b/internal/endtoend/testdata/case_text/pgx/v4/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go index b103a40c65..20483dbf8d 100644 --- a/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_text/pgx/v5/go/db.go b/internal/endtoend/testdata/case_text/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_text/pgx/v5/go/models.go b/internal/endtoend/testdata/case_text/pgx/v5/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go index b103a40c65..20483dbf8d 100644 --- a/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_text/stdlib/go/db.go b/internal/endtoend/testdata/case_text/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/case_text/stdlib/go/db.go +++ b/internal/endtoend/testdata/case_text/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_text/stdlib/go/models.go b/internal/endtoend/testdata/case_text/stdlib/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/case_text/stdlib/go/models.go +++ b/internal/endtoend/testdata/case_text/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go b/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go index 1711b5ae08..a00177369c 100644 --- a/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/case_text/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_value_param/mysql/go/db.go b/internal/endtoend/testdata/case_value_param/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/case_value_param/mysql/go/db.go +++ b/internal/endtoend/testdata/case_value_param/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_value_param/mysql/go/models.go b/internal/endtoend/testdata/case_value_param/mysql/go/models.go index 03c6b31cef..dcf6db9f65 100644 --- a/internal/endtoend/testdata/case_value_param/mysql/go/models.go +++ b/internal/endtoend/testdata/case_value_param/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go b/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go index 97eb3800fa..b98b3cec48 100644 --- a/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/case_value_param/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/case_value_param/postgresql/exec.json b/internal/endtoend/testdata/case_value_param/postgresql/exec.json new file mode 100644 index 0000000000..97f81fbc66 --- /dev/null +++ b/internal/endtoend/testdata/case_value_param/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/case_value_param/postgresql/go/db.go b/internal/endtoend/testdata/case_value_param/postgresql/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/case_value_param/postgresql/go/db.go +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/case_value_param/postgresql/go/models.go b/internal/endtoend/testdata/case_value_param/postgresql/go/models.go index a613e35443..ca63c2db41 100644 --- a/internal/endtoend/testdata/case_value_param/postgresql/go/models.go +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go b/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go index 841cfb52b7..5050fb8a73 100644 --- a/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/case_value_param/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go index 6ce6b7507b..bda512f196 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go index a6fa331406..d867cae11b 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go index 6ce6b7507b..bda512f196 100644 --- a/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go b/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go index 5276686cc7..64c60f9dd9 100644 --- a/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cast_coalesce/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go index 14004f64b8..f92cad1f91 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go index a6fa331406..d867cae11b 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go index 1726d097ec..3951ae97f5 100644 --- a/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_null/stdlib/go/db.go b/internal/endtoend/testdata/cast_null/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/go/db.go +++ b/internal/endtoend/testdata/cast_null/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cast_null/stdlib/go/models.go b/internal/endtoend/testdata/cast_null/stdlib/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/go/models.go +++ b/internal/endtoend/testdata/cast_null/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go b/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go index d8bb47b220..773e68c6ea 100644 --- a/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cast_null/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/db.go b/internal/endtoend/testdata/cast_param/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/go/db.go +++ b/internal/endtoend/testdata/cast_param/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/models.go b/internal/endtoend/testdata/cast_param/sqlite/go/models.go index ee1c34b192..32dd99b636 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/go/models.go +++ b/internal/endtoend/testdata/cast_param/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go b/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go index 212cf5f384..9d4bcffbab 100644 --- a/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/cast_param/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go index e8c067f57e..dcc5636ffe 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go index 104beb663f..c15f2a17ed 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go index aca7bb24c1..073b2b0a97 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -9,12 +9,14 @@ import ( ) type TestTable struct { - VCidNull pgtype.Uint32 - VOidNull pgtype.Uint32 - VTidNull pgtype.TID - VXidNull pgtype.Uint32 - VCid pgtype.Uint32 - VOid pgtype.Uint32 - VTid pgtype.TID - VXid pgtype.Uint32 + VCidNull pgtype.Uint32 + VOidNull pgtype.Uint32 + VTidNull pgtype.TID + VXidNull pgtype.Uint32 + VXid8Null pgtype.Uint64 + VCid pgtype.Uint32 + VOid pgtype.Uint32 + VTid pgtype.TID + VXid pgtype.Uint32 + VXid8 pgtype.Uint64 } diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go index 104beb663f..3e3f4c0a53 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,7 +10,7 @@ import ( ) const selectTest = `-- name: SelectTest :many -SELECT v_cid_null, v_oid_null, v_tid_null, v_xid_null, v_cid, v_oid, v_tid, v_xid +SELECT v_cid_null, v_oid_null, v_tid_null, v_xid_null, v_xid8_null, v_cid, v_oid, v_tid, v_xid, v_xid8 from test_table ` @@ -28,10 +28,12 @@ func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { &i.VOidNull, &i.VTidNull, &i.VXidNull, + &i.VXid8Null, &i.VCid, &i.VOid, &i.VTid, &i.VXid, + &i.VXid8, ); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql index ecd09ac882..bd6f114255 100644 --- a/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/schema.sql @@ -4,9 +4,11 @@ CREATE TABLE test_table v_oid_null oid, v_tid_null tid, v_xid_null xid, + v_xid8_null xid8, v_cid cid not null, v_oid oid not null, v_tid tid not null, - v_xid xid not null + v_xid xid not null, + v_xid8 xid8 not null ); diff --git a/internal/endtoend/testdata/citext/pgx/go/db.go b/internal/endtoend/testdata/citext/pgx/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/citext/pgx/go/db.go +++ b/internal/endtoend/testdata/citext/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/citext/pgx/go/models.go b/internal/endtoend/testdata/citext/pgx/go/models.go index 9bec929b73..5da5060f87 100644 --- a/internal/endtoend/testdata/citext/pgx/go/models.go +++ b/internal/endtoend/testdata/citext/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/citext/pgx/go/query.sql.go b/internal/endtoend/testdata/citext/pgx/go/query.sql.go index 718a7118df..f96e754e48 100644 --- a/internal/endtoend/testdata/citext/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/citext/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/citext/stdlib/go/db.go b/internal/endtoend/testdata/citext/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/citext/stdlib/go/db.go +++ b/internal/endtoend/testdata/citext/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/citext/stdlib/go/models.go b/internal/endtoend/testdata/citext/stdlib/go/models.go index 9bec929b73..5da5060f87 100644 --- a/internal/endtoend/testdata/citext/stdlib/go/models.go +++ b/internal/endtoend/testdata/citext/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/citext/stdlib/go/query.sql.go b/internal/endtoend/testdata/citext/stdlib/go/query.sql.go index 5668027804..cf680394af 100644 --- a/internal/endtoend/testdata/citext/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/citext/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/exec.json b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/exec.json new file mode 100644 index 0000000000..f4e21983b6 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/exec.json @@ -0,0 +1 @@ +{"contexts": ["base"]} diff --git a/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/query.sql b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/query.sql new file mode 100644 index 0000000000..a1fc306349 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/query.sql @@ -0,0 +1,2 @@ +-- name: Mixed :many +SELECT id FROM events WHERE name = {name:String} AND id > sqlc.arg(min_id); diff --git a/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/schema.sql b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/schema.sql new file mode 100644 index 0000000000..cc8e44c798 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE events ( + id UInt64, + name String, + tag Nullable(String), + amount Decimal(10, 2), + uid UUID, + ip IPv4, + big Int128 +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/sqlc.yaml b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/sqlc.yaml new file mode 100644 index 0000000000..66e907a2c6 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "clickhouse" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/stderr.txt b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/stderr.txt new file mode 100644 index 0000000000..45890258be --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_mixed_placeholders/clickhouse/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:59: query mixes the named placeholder "name" with a positional one; bind every parameter by name or every one by position diff --git a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/exec.json b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/exec.json new file mode 100644 index 0000000000..f4e21983b6 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/exec.json @@ -0,0 +1 @@ +{"contexts": ["base"]} diff --git a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/db.go b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/models.go b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/models.go new file mode 100644 index 0000000000..e47c63d299 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" + "math/big" + "net" + + "github.com/google/uuid" + "github.com/shopspring/decimal" +) + +type Event struct { + ID uint64 + Name string + Tag sql.NullString + Amount decimal.Decimal + Uid uuid.UUID + Ip net.IP + Big *big.Int +} diff --git a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/query.sql.go b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/query.sql.go new file mode 100644 index 0000000000..4159107a50 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/go/query.sql.go @@ -0,0 +1,100 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertEvent = `-- name: InsertEvent :exec +INSERT INTO events (id, name, tag, amount, uid, ip, big) +VALUES ({id:UInt64}, {name:String}, {tag:Nullable(String)}, {amount:Decimal(10, 2)}, {uid:UUID}, {ip:IPv4}, {big:Int128}); +` + +type InsertEventParams struct { + ID uint64 + Name string + Tag *string + Amount string + Uid string + Ip string + Big string +} + +func (q *Queries) InsertEvent(ctx context.Context, arg InsertEventParams) error { + _, err := q.db.ExecContext(ctx, insertEvent, + sql.Named("id", arg.ID), + sql.Named("name", arg.Name), + sql.Named("tag", arg.Tag), + sql.Named("amount", arg.Amount), + sql.Named("uid", arg.Uid), + sql.Named("ip", arg.Ip), + sql.Named("big", arg.Big), + ) + return err +} + +const positionalEvent = `-- name: PositionalEvent :exec +INSERT INTO events (id, name, tag, amount, uid, ip, big) +VALUES (?, ?, ?, ?, ?, ?, ?); +` + +type PositionalEventParams struct { + ID uint64 + Name string + Tag *string + Amount string + Uid string + Ip string + Big string +} + +func (q *Queries) PositionalEvent(ctx context.Context, arg PositionalEventParams) error { + _, err := q.db.ExecContext(ctx, positionalEvent, + arg.ID, + arg.Name, + arg.Tag, + arg.Amount, + arg.Uid, + arg.Ip, + arg.Big, + ) + return err +} + +const repeatedName = `-- name: RepeatedName :many +SELECT id FROM events +WHERE name = {name:String} OR tag = {name:String} OR id = {id:UInt64}; +` + +type RepeatedNameParams struct { + Name string + ID uint64 +} + +func (q *Queries) RepeatedName(ctx context.Context, arg RepeatedNameParams) ([]uint64, error) { + rows, err := q.db.QueryContext(ctx, repeatedName, sql.Named("name", arg.Name), sql.Named("id", arg.ID)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uint64 + for rows.Next() { + var id uint64 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/query.sql b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/query.sql new file mode 100644 index 0000000000..4c38a74e40 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/query.sql @@ -0,0 +1,11 @@ +-- name: RepeatedName :many +SELECT id FROM events +WHERE name = {name:String} OR tag = {name:String} OR id = {id:UInt64}; + +-- name: InsertEvent :exec +INSERT INTO events (id, name, tag, amount, uid, ip, big) +VALUES ({id:UInt64}, {name:String}, {tag:Nullable(String)}, {amount:Decimal(10, 2)}, {uid:UUID}, {ip:IPv4}, {big:Int128}); + +-- name: PositionalEvent :exec +INSERT INTO events (id, name, tag, amount, uid, ip, big) +VALUES (?, ?, ?, ?, ?, ?, ?); diff --git a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/schema.sql b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/schema.sql new file mode 100644 index 0000000000..cc8e44c798 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE events ( + id UInt64, + name String, + tag Nullable(String), + amount Decimal(10, 2), + uid UUID, + ip IPv4, + big Int128 +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/sqlc.yaml b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/sqlc.yaml new file mode 100644 index 0000000000..66e907a2c6 --- /dev/null +++ b/internal/endtoend/testdata/clickhouse_named_placeholders/clickhouse/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "clickhouse" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/coalesce/mysql/go/db.go b/internal/endtoend/testdata/coalesce/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/db.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce/mysql/go/models.go b/internal/endtoend/testdata/coalesce/mysql/go/models.go index 9bec929b73..5da5060f87 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/models.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go index 58e848606d..c98120bf50 100644 --- a/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go index 7cfc7da78b..741f0993af 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go index b346e74da1..061579c42d 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go index 6f076520d1..30ba3e82f2 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go index e3da5f6f9b..f674fa05be 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go index 7cfc7da78b..741f0993af 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go index 78eca4fee5..2c37a8b80d 100644 --- a/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/db.go b/internal/endtoend/testdata/coalesce/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/go/db.go +++ b/internal/endtoend/testdata/coalesce/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/models.go b/internal/endtoend/testdata/coalesce/sqlite/go/models.go index 9bec929b73..5da5060f87 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/go/models.go +++ b/internal/endtoend/testdata/coalesce/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go b/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go index 58e848606d..4324a035ac 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,7 +11,7 @@ import ( ) const coalesce = `-- name: Coalesce :many -SELECT coalesce(bar, '') as login +SELECT coalesce(bar, '') AS login FROM foo ` diff --git a/internal/endtoend/testdata/coalesce/sqlite/query.sql b/internal/endtoend/testdata/coalesce/sqlite/query.sql index 4cc0de9e29..f7b1c92a05 100644 --- a/internal/endtoend/testdata/coalesce/sqlite/query.sql +++ b/internal/endtoend/testdata/coalesce/sqlite/query.sql @@ -1,5 +1,5 @@ -- name: Coalesce :many -SELECT coalesce(bar, '') as login +SELECT coalesce(bar, '') AS login FROM foo; -- name: CoalesceColumns :many diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/db.go b/internal/endtoend/testdata/coalesce_as/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/models.go b/internal/endtoend/testdata/coalesce_as/mysql/go/models.go index e3d18a55bc..7df949f816 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go index e6c5a51741..8ce06bb097 100644 --- a/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -18,7 +18,7 @@ GROUP BY 1 type SumBazRow struct { Bar sql.NullString - Quantity interface{} + Quantity any } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go index fcb8c8cb65..081444ae36 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go index b3288a3529..cd1ead7193 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pganalyze/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go index a5bacd538d..72e354fe13 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go index 2aae35c6c8..0471727c9c 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -18,7 +18,7 @@ GROUP BY 1 type SumBazRow struct { Bar sql.NullString - Quantity interface{} + Quantity any } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go index fcb8c8cb65..081444ae36 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go index cc0f787b34..cb54b62679 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -19,7 +19,7 @@ GROUP BY 1 type SumBazRow struct { Bar pgtype.Text - Quantity interface{} + Quantity any } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go index a5bacd538d..72e354fe13 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go index e6c5a51741..8ce06bb097 100644 --- a/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -18,7 +18,7 @@ GROUP BY 1 type SumBazRow struct { Bar sql.NullString - Quantity interface{} + Quantity any } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go index a5bacd538d..72e354fe13 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go index e6c5a51741..556c5b5955 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_as/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,14 +11,14 @@ import ( ) const sumBaz = `-- name: SumBaz :many -SELECT bar, coalesce(sum(baz), 0) as quantity +SELECT bar, coalesce(sum(baz), 0) AS quantity FROM foo GROUP BY 1 ` type SumBazRow struct { Bar sql.NullString - Quantity interface{} + Quantity any } func (q *Queries) SumBaz(ctx context.Context) ([]SumBazRow, error) { diff --git a/internal/endtoend/testdata/coalesce_as/sqlite/query.sql b/internal/endtoend/testdata/coalesce_as/sqlite/query.sql index 3f51061f8b..d092958fb9 100644 --- a/internal/endtoend/testdata/coalesce_as/sqlite/query.sql +++ b/internal/endtoend/testdata/coalesce_as/sqlite/query.sql @@ -1,4 +1,4 @@ -- name: SumBaz :many -SELECT bar, coalesce(sum(baz), 0) as quantity +SELECT bar, coalesce(sum(baz), 0) AS quantity FROM foo GROUP BY 1; diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go index 7a085ae7ff..00ba67c0b5 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go b/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go index 94c95de3e3..15250f9c59 100644 --- a/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_join/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/coalesce_params/mysql/exec.json b/internal/endtoend/testdata/coalesce_params/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/coalesce_params/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/coalesce_params/mysql/go/db.go b/internal/endtoend/testdata/coalesce_params/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/coalesce_params/mysql/go/db.go +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/coalesce_params/mysql/go/models.go b/internal/endtoend/testdata/coalesce_params/mysql/go/models.go index b2fc5363fd..1e9a534746 100644 --- a/internal/endtoend/testdata/coalesce_params/mysql/go/models.go +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -18,7 +18,7 @@ const ( CalendarMaincalendarFalse CalendarMaincalendar = "false" ) -func (e *CalendarMaincalendar) Scan(src interface{}) error { +func (e *CalendarMaincalendar) Scan(src any) error { switch s := src.(type) { case []byte: *e = CalendarMaincalendar(s) @@ -36,7 +36,7 @@ type NullCalendarMaincalendar struct { } // Scan implements the Scanner interface. -func (ns *NullCalendarMaincalendar) Scan(value interface{}) error { +func (ns *NullCalendarMaincalendar) Scan(value any) error { if value == nil { ns.CalendarMaincalendar, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go b/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go index 833f917be5..689806e7ee 100644 --- a/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/coalesce_params/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -23,8 +23,8 @@ INSERT INTO authors ( type AddAuthorParams struct { Address string - CalName interface{} - CalDescription interface{} + CalName any + CalDescription any } func (q *Queries) AddAuthor(ctx context.Context, arg AddAuthorParams) (int64, error) { @@ -44,7 +44,7 @@ INSERT INTO ` + "`" + `Event` + "`" + ` ( ` type AddEventParams struct { - Timezone interface{} + Timezone any CalendarIdKey string } diff --git a/internal/endtoend/testdata/coalesce_params/mysql/schema.sql b/internal/endtoend/testdata/coalesce_params/mysql/schema.sql index a0d41cbe74..0b1b34685c 100644 --- a/internal/endtoend/testdata/coalesce_params/mysql/schema.sql +++ b/internal/endtoend/testdata/coalesce_params/mysql/schema.sql @@ -14,7 +14,7 @@ CREATE TABLE `Calendar` ( KEY `Relation` (`Relation`), KEY `UniqueKey` (`UniqueKey`), KEY `IdKey` (`IdKey`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE `Event` ( @@ -32,7 +32,7 @@ CREATE TABLE `Event` ( KEY `CalendarReference` (`CalendarReference`), KEY `UniqueKey` (`UniqueKey`), KEY `IdKey` (`IdKey`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE authors ( diff --git a/internal/endtoend/testdata/codegen_json/gen/codegen.json b/internal/endtoend/testdata/codegen_json/gen/codegen.json index 5dc5b15d6a..88821b582a 100644 --- a/internal/endtoend/testdata/codegen_json/gen/codegen.json +++ b/internal/endtoend/testdata/codegen_json/gen/codegen.json @@ -8,8 +8,6 @@ "queries": [ "postgresql/query.sql" ], - "rename": {}, - "overrides": [], "codegen": { "out": "", "plugin": "", @@ -59,7 +57,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -85,7 +84,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bio", @@ -111,7 +111,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -162,7 +163,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -188,7 +190,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -214,7 +217,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -240,7 +244,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -266,7 +271,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -292,7 +298,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggfnoid", @@ -318,7 +325,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggkind", @@ -344,7 +352,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggnumdirectargs", @@ -370,7 +379,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggtransfn", @@ -396,7 +406,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggfinalfn", @@ -422,7 +433,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggcombinefn", @@ -448,7 +460,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggserialfn", @@ -474,7 +487,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggdeserialfn", @@ -500,7 +514,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmtransfn", @@ -526,7 +541,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggminvtransfn", @@ -552,7 +568,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmfinalfn", @@ -578,7 +595,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggfinalextra", @@ -604,7 +622,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmfinalextra", @@ -630,7 +649,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggfinalmodify", @@ -656,7 +676,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmfinalmodify", @@ -682,7 +703,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggsortop", @@ -708,7 +730,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggtranstype", @@ -734,7 +757,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggtransspace", @@ -760,7 +784,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmtranstype", @@ -786,7 +811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmtransspace", @@ -812,7 +838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "agginitval", @@ -838,7 +865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggminitval", @@ -864,7 +892,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -900,7 +929,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -926,7 +956,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -952,7 +983,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -978,7 +1010,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -1004,7 +1037,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -1030,7 +1064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -1056,7 +1091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amname", @@ -1082,7 +1118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amhandler", @@ -1108,7 +1145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amtype", @@ -1134,7 +1172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -1170,7 +1209,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -1196,7 +1236,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -1222,7 +1263,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -1248,7 +1290,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -1274,7 +1317,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -1300,7 +1344,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -1326,7 +1371,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopfamily", @@ -1352,7 +1398,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amoplefttype", @@ -1378,7 +1425,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amoprighttype", @@ -1404,7 +1452,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopstrategy", @@ -1430,7 +1479,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amoppurpose", @@ -1456,7 +1506,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopopr", @@ -1482,7 +1533,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopmethod", @@ -1508,7 +1560,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopsortfamily", @@ -1534,7 +1587,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -1570,7 +1624,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -1596,7 +1651,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -1622,7 +1678,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -1648,7 +1705,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -1674,7 +1732,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -1700,7 +1759,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -1726,7 +1786,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amprocfamily", @@ -1752,7 +1813,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amproclefttype", @@ -1778,7 +1840,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amprocrighttype", @@ -1804,7 +1867,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amprocnum", @@ -1830,7 +1894,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amproc", @@ -1856,7 +1921,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -1892,7 +1958,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -1918,7 +1985,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -1944,7 +2012,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -1970,7 +2039,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -1996,7 +2066,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -2022,7 +2093,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -2048,7 +2120,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "adrelid", @@ -2074,7 +2147,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "adnum", @@ -2100,7 +2174,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "adbin", @@ -2126,7 +2201,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -2162,7 +2238,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -2188,7 +2265,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -2214,7 +2292,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -2240,7 +2319,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -2266,7 +2346,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -2292,7 +2373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attrelid", @@ -2318,7 +2400,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attname", @@ -2344,7 +2427,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "atttypid", @@ -2370,33 +2454,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 - }, - { - "name": "attstattarget", - "not_null": true, - "is_array": false, - "comment": "", - "length": 4, - "is_named_param": false, - "is_func_call": false, - "scope": "", - "table": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_attribute" - }, - "table_alias": "", - "type": { - "catalog": "", - "schema": "", - "name": "int4" - }, - "is_sqlc_slice": false, - "embed_table": null, - "original_name": "", - "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attlen", @@ -2422,7 +2481,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attnum", @@ -2448,10 +2508,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "attndims", + "name": "attcacheoff", "not_null": true, "is_array": false, "comment": "", @@ -2474,10 +2535,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "attcacheoff", + "name": "atttypmod", "not_null": true, "is_array": false, "comment": "", @@ -2500,14 +2562,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "atttypmod", + "name": "attndims", "not_null": true, "is_array": false, "comment": "", - "length": 4, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -2520,13 +2583,14 @@ "type": { "catalog": "", "schema": "", - "name": "int4" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attbyval", @@ -2552,7 +2616,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attalign", @@ -2578,7 +2643,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attstorage", @@ -2604,7 +2670,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attcompression", @@ -2630,7 +2697,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attnotnull", @@ -2656,7 +2724,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "atthasdef", @@ -2682,7 +2751,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "atthasmissing", @@ -2708,7 +2778,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attidentity", @@ -2734,7 +2805,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attgenerated", @@ -2760,7 +2832,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attisdropped", @@ -2786,7 +2859,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attislocal", @@ -2812,14 +2886,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attinhcount", "not_null": true, "is_array": false, "comment": "", - "length": 4, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -2832,13 +2907,41 @@ "type": { "catalog": "", "schema": "", - "name": "int4" + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "attstattarget", + "not_null": true, + "is_array": false, + "comment": "", + "length": 2, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attcollation", @@ -2864,14 +2967,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -2884,13 +2988,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "attoptions", @@ -2910,13 +3015,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "attfdwoptions", @@ -2936,13 +3042,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "attmissingval", @@ -2968,7 +3075,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -3004,7 +3112,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -3030,7 +3139,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -3056,7 +3166,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -3082,7 +3193,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -3108,7 +3220,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -3134,7 +3247,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "oid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "roleid", @@ -3160,7 +3301,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "member", @@ -3186,7 +3328,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantor", @@ -3212,7 +3355,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "admin_option", @@ -3238,7 +3382,62 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "inherit_option", + "not_null": true, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "set_option", + "not_null": true, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -3274,7 +3473,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -3300,7 +3500,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -3326,7 +3527,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -3352,7 +3554,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -3378,7 +3581,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -3404,7 +3608,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -3430,7 +3635,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolname", @@ -3456,7 +3662,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolsuper", @@ -3482,7 +3689,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolinherit", @@ -3508,7 +3716,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcreaterole", @@ -3534,7 +3743,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcreatedb", @@ -3560,7 +3770,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcanlogin", @@ -3586,7 +3797,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolreplication", @@ -3612,7 +3824,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolbypassrls", @@ -3638,7 +3851,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolconnlimit", @@ -3664,7 +3878,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolpassword", @@ -3690,7 +3905,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolvaliduntil", @@ -3716,7 +3932,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -3752,7 +3969,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "version", @@ -3778,7 +3996,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "installed", @@ -3804,7 +4023,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "superuser", @@ -3830,7 +4050,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trusted", @@ -3856,7 +4077,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relocatable", @@ -3882,7 +4104,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schema", @@ -3908,14 +4131,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "requires", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -3928,13 +4152,14 @@ "type": { "catalog": "", "schema": "", - "name": "_name" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "comment", @@ -3960,7 +4185,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -3996,7 +4222,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_version", @@ -4022,7 +4249,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "installed_version", @@ -4048,7 +4276,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comment", @@ -4074,7 +4303,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -4110,7 +4340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ident", @@ -4136,7 +4367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parent", @@ -4162,7 +4394,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "level", @@ -4188,7 +4421,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_bytes", @@ -4214,7 +4448,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_nblocks", @@ -4240,7 +4475,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "free_bytes", @@ -4266,7 +4502,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "free_chunks", @@ -4292,7 +4529,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "used_bytes", @@ -4318,7 +4556,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -4354,7 +4593,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -4380,7 +4620,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -4406,7 +4647,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -4432,7 +4674,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -4458,7 +4701,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -4484,7 +4728,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -4510,7 +4755,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "castsource", @@ -4536,7 +4782,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "casttarget", @@ -4562,7 +4809,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "castfunc", @@ -4588,7 +4836,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "castcontext", @@ -4614,7 +4863,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "castmethod", @@ -4640,7 +4890,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -4676,7 +4927,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -4702,7 +4954,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -4728,7 +4981,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -4754,7 +5008,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -4780,7 +5035,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -4806,7 +5062,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -4832,7 +5089,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -4858,7 +5116,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relnamespace", @@ -4884,7 +5143,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reltype", @@ -4910,7 +5170,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reloftype", @@ -4936,7 +5197,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relowner", @@ -4962,7 +5224,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relam", @@ -4988,7 +5251,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relfilenode", @@ -5014,7 +5278,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reltablespace", @@ -5040,7 +5305,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relpages", @@ -5066,7 +5332,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reltuples", @@ -5092,7 +5359,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relallvisible", @@ -5118,7 +5386,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reltoastrelid", @@ -5144,7 +5413,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relhasindex", @@ -5170,7 +5440,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relisshared", @@ -5196,7 +5467,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relpersistence", @@ -5222,7 +5494,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relkind", @@ -5248,7 +5521,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relnatts", @@ -5274,7 +5548,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relchecks", @@ -5300,7 +5575,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relhasrules", @@ -5326,7 +5602,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relhastriggers", @@ -5352,7 +5629,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relhassubclass", @@ -5378,7 +5656,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relrowsecurity", @@ -5404,7 +5683,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relforcerowsecurity", @@ -5430,7 +5710,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relispopulated", @@ -5456,7 +5737,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relreplident", @@ -5482,7 +5764,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relispartition", @@ -5508,7 +5791,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relrewrite", @@ -5534,7 +5818,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relfrozenxid", @@ -5560,7 +5845,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relminmxid", @@ -5586,14 +5872,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -5606,13 +5893,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "reloptions", @@ -5632,13 +5920,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "relpartbound", @@ -5664,7 +5953,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -5700,7 +5990,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -5726,7 +6017,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -5752,7 +6044,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -5778,7 +6071,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -5804,7 +6098,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -5830,7 +6125,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -5856,7 +6152,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collname", @@ -5882,7 +6179,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collnamespace", @@ -5908,7 +6206,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collowner", @@ -5934,7 +6233,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collprovider", @@ -5960,7 +6260,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collisdeterministic", @@ -5986,7 +6287,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collencoding", @@ -6012,7 +6314,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collcollate", @@ -6038,7 +6341,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collctype", @@ -6064,7 +6368,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "colliculocale", @@ -6090,7 +6395,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "collicurules", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "collversion", @@ -6116,7 +6449,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -6152,7 +6486,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setting", @@ -6178,7 +6513,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -6214,7 +6550,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -6240,7 +6577,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -6266,7 +6604,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -6292,7 +6631,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -6318,7 +6658,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -6344,7 +6685,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -6370,7 +6712,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conname", @@ -6396,7 +6739,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "connamespace", @@ -6422,7 +6766,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "contype", @@ -6448,7 +6793,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "condeferrable", @@ -6474,7 +6820,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "condeferred", @@ -6500,7 +6847,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "convalidated", @@ -6526,7 +6874,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conrelid", @@ -6552,7 +6901,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "contypid", @@ -6578,7 +6928,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conindid", @@ -6604,7 +6955,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conparentid", @@ -6630,7 +6982,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confrelid", @@ -6656,7 +7009,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confupdtype", @@ -6682,7 +7036,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confdeltype", @@ -6708,7 +7063,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confmatchtype", @@ -6734,7 +7090,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conislocal", @@ -6760,14 +7117,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "coninhcount", "not_null": true, "is_array": false, "comment": "", - "length": 4, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6780,13 +7138,14 @@ "type": { "catalog": "", "schema": "", - "name": "int4" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "connoinherit", @@ -6812,14 +7171,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conkey", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6832,20 +7192,21 @@ "type": { "catalog": "", "schema": "", - "name": "_int2" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "confkey", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6858,20 +7219,21 @@ "type": { "catalog": "", "schema": "", - "name": "_int2" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conpfeqop", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6884,20 +7246,21 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conppeqop", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6910,20 +7273,21 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conffeqop", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6936,20 +7300,21 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "confdelsetcols", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6962,20 +7327,21 @@ "type": { "catalog": "", "schema": "", - "name": "_int2" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conexclop", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6988,13 +7354,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conbin", @@ -7020,7 +7387,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -7056,7 +7424,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -7082,7 +7451,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -7108,7 +7478,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -7134,7 +7505,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -7160,7 +7532,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -7186,7 +7559,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -7212,7 +7586,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conname", @@ -7238,7 +7613,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "connamespace", @@ -7264,7 +7640,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conowner", @@ -7290,7 +7667,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conforencoding", @@ -7316,7 +7694,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "contoencoding", @@ -7342,7 +7721,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conproc", @@ -7368,7 +7748,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "condefault", @@ -7394,7 +7775,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -7430,7 +7812,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statement", @@ -7456,7 +7839,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_holdable", @@ -7482,7 +7866,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_binary", @@ -7508,7 +7893,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_scrollable", @@ -7534,7 +7920,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "creation_time", @@ -7560,7 +7947,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -7596,7 +7984,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -7622,7 +8011,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -7648,7 +8038,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -7674,7 +8065,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -7700,7 +8092,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -7726,7 +8119,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -7752,7 +8146,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -7778,7 +8173,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datdba", @@ -7804,7 +8200,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "encoding", @@ -7830,7 +8227,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datlocprovider", @@ -7856,7 +8254,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datistemplate", @@ -7882,7 +8281,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datallowconn", @@ -7908,7 +8308,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datconnlimit", @@ -7934,7 +8335,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datfrozenxid", @@ -7960,7 +8362,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datminmxid", @@ -7986,7 +8389,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dattablespace", @@ -8012,7 +8416,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datcollate", @@ -8038,7 +8443,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datctype", @@ -8064,7 +8470,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "daticulocale", @@ -8090,7 +8497,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "daticurules", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "datcollversion", @@ -8116,14 +8551,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -8136,13 +8572,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -8178,7 +8615,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -8204,7 +8642,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -8230,7 +8669,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -8256,7 +8696,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -8282,7 +8723,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -8308,7 +8750,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setdatabase", @@ -8334,7 +8777,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setrole", @@ -8360,7 +8804,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setconfig", @@ -8380,13 +8825,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -8422,7 +8868,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -8448,7 +8895,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -8474,7 +8922,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -8500,7 +8949,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -8526,7 +8976,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -8552,7 +9003,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -8578,7 +9030,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "defaclrole", @@ -8604,7 +9057,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "defaclnamespace", @@ -8630,7 +9084,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "defaclobjtype", @@ -8656,14 +9111,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "defaclacl", "not_null": true, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -8676,13 +9132,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -8718,7 +9175,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -8744,7 +9202,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -8770,7 +9229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -8796,7 +9256,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -8822,7 +9283,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -8848,7 +9310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classid", @@ -8874,7 +9337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objid", @@ -8900,7 +9364,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -8926,7 +9391,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refclassid", @@ -8952,7 +9418,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refobjid", @@ -8978,7 +9445,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refobjsubid", @@ -9004,7 +9472,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "deptype", @@ -9030,7 +9499,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -9066,7 +9536,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -9092,7 +9563,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -9118,7 +9590,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -9144,7 +9617,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -9170,7 +9644,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -9196,7 +9671,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -9222,7 +9698,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -9248,7 +9725,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -9274,7 +9752,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "description", @@ -9300,7 +9779,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -9336,7 +9816,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -9362,7 +9843,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -9388,7 +9870,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -9414,7 +9897,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -9440,7 +9924,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -9466,7 +9951,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -9492,7 +9978,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enumtypid", @@ -9518,7 +10005,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enumsortorder", @@ -9544,7 +10032,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enumlabel", @@ -9570,7 +10059,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -9606,7 +10096,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -9632,7 +10123,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -9658,7 +10150,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -9684,7 +10177,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -9710,7 +10204,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -9736,7 +10231,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -9762,7 +10258,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtname", @@ -9788,7 +10285,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtevent", @@ -9814,7 +10312,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtowner", @@ -9840,7 +10339,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtfoid", @@ -9866,7 +10366,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtenabled", @@ -9892,7 +10393,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evttags", @@ -9912,13 +10414,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -9954,7 +10457,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -9980,7 +10484,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -10006,7 +10511,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -10032,7 +10538,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -10058,7 +10565,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -10084,7 +10592,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -10110,7 +10619,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extname", @@ -10136,7 +10646,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extowner", @@ -10162,7 +10673,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extnamespace", @@ -10188,7 +10700,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extrelocatable", @@ -10214,7 +10727,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extversion", @@ -10240,14 +10754,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extconfig", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -10260,13 +10775,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "extcondition", @@ -10286,13 +10802,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -10328,7 +10845,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sourceline", @@ -10354,7 +10872,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqno", @@ -10380,7 +10899,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -10406,7 +10926,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setting", @@ -10432,7 +10953,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "applied", @@ -10458,7 +10980,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "error", @@ -10484,7 +11007,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -10520,7 +11044,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -10546,7 +11071,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -10572,7 +11098,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -10598,7 +11125,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -10624,7 +11152,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -10650,7 +11179,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -10676,7 +11206,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwname", @@ -10702,7 +11233,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwowner", @@ -10728,7 +11260,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwhandler", @@ -10754,7 +11287,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwvalidator", @@ -10780,14 +11314,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -10800,13 +11335,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "fdwoptions", @@ -10826,13 +11362,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -10868,7 +11405,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -10894,7 +11432,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -10920,7 +11459,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -10946,7 +11486,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -10972,7 +11513,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -10998,7 +11540,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -11024,7 +11567,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvname", @@ -11050,7 +11594,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvowner", @@ -11076,7 +11621,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvfdw", @@ -11102,7 +11648,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvtype", @@ -11128,7 +11675,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvversion", @@ -11154,14 +11702,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -11174,13 +11723,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "srvoptions", @@ -11200,13 +11750,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -11242,7 +11793,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -11268,7 +11820,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -11294,7 +11847,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -11320,7 +11874,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -11346,7 +11901,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -11372,7 +11928,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ftrelid", @@ -11398,7 +11955,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ftserver", @@ -11424,7 +11982,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ftoptions", @@ -11444,13 +12003,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -11486,7 +12046,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grosysid", @@ -11512,14 +12073,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grolist", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -11532,13 +12094,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -11551,7 +12114,7 @@ }, "columns": [ { - "name": "line_number", + "name": "rule_number", "not_null": false, "is_array": false, "comment": "", @@ -11574,10 +12137,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "type", + "name": "file_name", "not_null": false, "is_array": false, "comment": "", @@ -11600,14 +12164,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "database", + "name": "line_number", "not_null": false, - "is_array": true, + "is_array": false, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -11620,18 +12185,19 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "int4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "user_name", + "name": "type", "not_null": false, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -11646,18 +12212,19 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "address", + "name": "database", "not_null": false, - "is_array": false, + "is_array": true, "comment": "", "length": -1, "is_named_param": false, @@ -11678,7 +12245,62 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null + }, + { + "name": "user_name", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 1, + "type_expr": null + }, + { + "name": "address", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "netmask", @@ -11704,7 +12326,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "auth_method", @@ -11730,7 +12353,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "options", @@ -11750,13 +12374,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "error", @@ -11782,7 +12407,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -11794,6 +12420,60 @@ "name": "pg_ident_file_mappings" }, "columns": [ + { + "name": "map_number", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ident_file_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "file_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ident_file_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, { "name": "line_number", "not_null": false, @@ -11818,7 +12498,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "map_name", @@ -11844,7 +12525,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sys_name", @@ -11870,7 +12552,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pg_username", @@ -11896,7 +12579,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "error", @@ -11922,7 +12606,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -11958,7 +12643,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -11984,7 +12670,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -12010,7 +12697,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -12036,7 +12724,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -12062,7 +12751,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -12088,7 +12778,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -12114,7 +12805,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indrelid", @@ -12140,7 +12832,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indnatts", @@ -12166,7 +12859,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indnkeyatts", @@ -12192,7 +12886,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisunique", @@ -12218,7 +12913,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indnullsnotdistinct", @@ -12244,7 +12940,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisprimary", @@ -12270,7 +12967,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisexclusion", @@ -12296,7 +12994,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indimmediate", @@ -12322,7 +13021,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisclustered", @@ -12348,7 +13048,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisvalid", @@ -12374,7 +13075,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indcheckxmin", @@ -12400,7 +13102,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisready", @@ -12426,7 +13129,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indislive", @@ -12452,7 +13156,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisreplident", @@ -12478,12 +13183,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indkey", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -12504,12 +13210,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indcollation", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -12530,12 +13237,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indclass", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -12556,12 +13264,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indoption", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -12582,7 +13291,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexprs", @@ -12608,7 +13318,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indpred", @@ -12634,7 +13345,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -12670,7 +13382,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -12696,7 +13409,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexname", @@ -12722,7 +13436,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespace", @@ -12748,7 +13463,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexdef", @@ -12774,7 +13490,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -12810,7 +13527,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -12836,7 +13554,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -12862,7 +13581,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -12888,7 +13608,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -12914,7 +13635,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -12940,7 +13662,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inhrelid", @@ -12966,7 +13689,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inhparent", @@ -12992,7 +13716,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inhseqno", @@ -13018,7 +13743,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inhdetachpending", @@ -13044,7 +13770,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -13080,7 +13807,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -13106,7 +13834,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -13132,7 +13861,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -13158,7 +13888,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -13184,7 +13915,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -13210,7 +13942,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -13236,7 +13969,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -13262,7 +13996,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -13288,7 +14023,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privtype", @@ -13314,14 +14050,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "initprivs", "not_null": true, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -13334,13 +14071,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -13376,7 +14114,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -13402,7 +14141,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -13428,7 +14168,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -13454,7 +14195,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -13480,7 +14222,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -13506,7 +14249,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -13532,7 +14276,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanname", @@ -13558,7 +14303,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanowner", @@ -13584,7 +14330,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanispl", @@ -13610,7 +14357,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanpltrusted", @@ -13636,7 +14384,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanplcallfoid", @@ -13662,7 +14411,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "laninline", @@ -13688,7 +14438,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanvalidator", @@ -13714,14 +14465,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -13734,13 +14486,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -13776,7 +14529,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -13802,7 +14556,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -13828,7 +14583,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -13854,7 +14610,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -13880,7 +14637,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -13906,7 +14664,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "loid", @@ -13932,7 +14691,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pageno", @@ -13958,7 +14718,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data", @@ -13984,7 +14745,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -14020,7 +14782,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -14046,7 +14809,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -14072,7 +14836,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -14098,7 +14863,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -14124,7 +14890,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -14150,7 +14917,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -14176,7 +14944,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lomowner", @@ -14202,14 +14971,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lomacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -14222,13 +14992,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -14264,7 +15035,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "database", @@ -14290,7 +15062,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relation", @@ -14316,7 +15089,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "page", @@ -14342,7 +15116,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuple", @@ -14368,7 +15143,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "virtualxid", @@ -14394,7 +15170,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "transactionid", @@ -14420,7 +15197,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classid", @@ -14446,7 +15224,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objid", @@ -14472,7 +15251,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -14498,7 +15278,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "virtualtransaction", @@ -14524,7 +15305,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pid", @@ -14550,7 +15332,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "mode", @@ -14576,7 +15359,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "granted", @@ -14602,7 +15386,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fastpath", @@ -14628,7 +15413,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "waitstart", @@ -14654,7 +15440,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -14690,7 +15477,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "matviewname", @@ -14716,7 +15504,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "matviewowner", @@ -14742,7 +15531,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespace", @@ -14768,7 +15558,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hasindexes", @@ -14794,7 +15585,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ispopulated", @@ -14820,7 +15612,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "definition", @@ -14846,7 +15639,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -14882,7 +15676,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -14908,7 +15703,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -14934,7 +15730,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -14960,7 +15757,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -14986,7 +15784,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -15012,7 +15811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -15038,7 +15838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "nspname", @@ -15064,7 +15865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "nspowner", @@ -15090,14 +15892,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "nspacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -15110,13 +15913,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -15152,7 +15956,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -15178,7 +15983,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -15204,7 +16010,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -15230,7 +16037,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -15256,7 +16064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -15282,7 +16091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -15308,7 +16118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcmethod", @@ -15334,7 +16145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcname", @@ -15360,7 +16172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcnamespace", @@ -15386,7 +16199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcowner", @@ -15412,7 +16226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcfamily", @@ -15438,7 +16253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcintype", @@ -15464,7 +16280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcdefault", @@ -15490,7 +16307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opckeytype", @@ -15516,7 +16334,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -15552,7 +16371,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -15578,7 +16398,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -15604,7 +16425,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -15630,7 +16452,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -15656,7 +16479,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -15682,7 +16506,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -15708,7 +16533,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprname", @@ -15734,7 +16560,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprnamespace", @@ -15760,7 +16587,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprowner", @@ -15786,7 +16614,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprkind", @@ -15812,7 +16641,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprcanmerge", @@ -15838,7 +16668,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprcanhash", @@ -15864,7 +16695,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprleft", @@ -15890,7 +16722,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprright", @@ -15916,7 +16749,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprresult", @@ -15942,7 +16776,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprcom", @@ -15968,7 +16803,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprnegate", @@ -15994,7 +16830,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprcode", @@ -16020,7 +16857,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprrest", @@ -16046,7 +16884,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprjoin", @@ -16072,7 +16911,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -16108,7 +16948,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -16134,7 +16975,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -16160,7 +17002,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -16186,7 +17029,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -16212,7 +17056,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -16238,7 +17083,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -16264,7 +17110,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opfmethod", @@ -16290,7 +17137,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opfname", @@ -16316,7 +17164,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opfnamespace", @@ -16342,7 +17191,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opfowner", @@ -16368,7 +17218,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -16404,7 +17255,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -16430,7 +17282,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -16456,7 +17309,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -16482,7 +17336,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -16508,7 +17363,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -16534,7 +17390,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -16560,7 +17417,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parname", @@ -16586,14 +17444,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "paracl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -16606,13 +17465,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -16648,7 +17508,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -16674,7 +17535,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -16700,7 +17562,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -16726,7 +17589,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -16752,7 +17616,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -16778,7 +17643,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partrelid", @@ -16804,7 +17670,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partstrat", @@ -16830,7 +17697,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partnatts", @@ -16856,7 +17724,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partdefid", @@ -16882,12 +17751,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partattrs", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -16908,12 +17778,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partclass", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -16934,12 +17805,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partcollation", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -16960,7 +17832,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partexprs", @@ -16986,7 +17859,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17022,7 +17896,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -17048,7 +17923,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "policyname", @@ -17074,7 +17950,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "permissive", @@ -17100,14 +17977,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "roles", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -17120,13 +17998,14 @@ "type": { "catalog": "", "schema": "", - "name": "_name" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "cmd", @@ -17152,7 +18031,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "qual", @@ -17178,7 +18058,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "with_check", @@ -17204,7 +18085,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17240,7 +18122,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -17266,7 +18149,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -17292,7 +18176,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -17318,7 +18203,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -17344,7 +18230,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -17370,7 +18257,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -17396,7 +18284,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polname", @@ -17422,7 +18311,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polrelid", @@ -17448,7 +18338,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polcmd", @@ -17474,7 +18365,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polpermissive", @@ -17500,14 +18392,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polroles", "not_null": true, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -17520,13 +18413,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "polqual", @@ -17552,7 +18446,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polwithcheck", @@ -17578,7 +18473,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17614,7 +18510,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statement", @@ -17640,7 +18537,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prepare_time", @@ -17666,14 +18564,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_types", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -17686,13 +18585,41 @@ "type": { "catalog": "", "schema": "", - "name": "_regtype" + "name": "regtype" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null + }, + { + "name": "result_types", + "not_null": false, + "is_array": true, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regtype" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 1, + "type_expr": null }, { "name": "from_sql", @@ -17718,7 +18645,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "generic_plans", @@ -17744,7 +18672,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "custom_plans", @@ -17770,7 +18699,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17806,7 +18736,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "gid", @@ -17832,7 +18763,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prepared", @@ -17858,7 +18790,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "owner", @@ -17884,7 +18817,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "database", @@ -17910,7 +18844,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17946,7 +18881,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -17972,7 +18908,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -17998,7 +18935,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -18024,7 +18962,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -18050,7 +18989,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -18076,7 +19016,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -18102,7 +19043,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proname", @@ -18128,7 +19070,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pronamespace", @@ -18154,7 +19097,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proowner", @@ -18180,7 +19124,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prolang", @@ -18206,7 +19151,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "procost", @@ -18232,7 +19178,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prorows", @@ -18258,7 +19205,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provariadic", @@ -18284,7 +19232,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prosupport", @@ -18310,7 +19259,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prokind", @@ -18336,7 +19286,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prosecdef", @@ -18362,7 +19313,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proleakproof", @@ -18388,7 +19340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proisstrict", @@ -18414,7 +19367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proretset", @@ -18440,7 +19394,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provolatile", @@ -18466,7 +19421,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proparallel", @@ -18492,7 +19448,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pronargs", @@ -18518,7 +19475,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pronargdefaults", @@ -18544,7 +19502,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prorettype", @@ -18570,12 +19529,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proargtypes", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -18596,14 +19556,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proallargtypes", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -18616,20 +19577,21 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "proargmodes", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 1, "is_named_param": false, "is_func_call": false, "scope": "", @@ -18642,13 +19604,14 @@ "type": { "catalog": "", "schema": "", - "name": "_char" + "name": "char" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "proargnames", @@ -18668,13 +19631,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "proargdefaults", @@ -18700,14 +19664,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "protrftypes", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -18720,13 +19685,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "prosrc", @@ -18752,7 +19718,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "probin", @@ -18778,7 +19745,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prosqlbody", @@ -18804,7 +19772,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proconfig", @@ -18824,20 +19793,21 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "proacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -18850,13 +19820,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -18892,7 +19863,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -18918,7 +19890,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -18944,7 +19917,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -18970,7 +19944,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -18996,7 +19971,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -19022,7 +19998,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -19048,7 +20025,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubname", @@ -19074,7 +20052,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubowner", @@ -19100,7 +20079,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "puballtables", @@ -19126,7 +20106,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubinsert", @@ -19152,7 +20133,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubupdate", @@ -19178,7 +20160,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubdelete", @@ -19204,7 +20187,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubtruncate", @@ -19230,7 +20214,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubviaroot", @@ -19256,7 +20241,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -19292,7 +20278,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -19318,7 +20305,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -19344,7 +20332,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -19370,7 +20359,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -19396,7 +20386,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -19422,7 +20413,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -19448,7 +20440,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pnpubid", @@ -19474,7 +20467,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pnnspid", @@ -19500,7 +20494,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -19536,7 +20531,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -19562,7 +20558,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -19588,7 +20585,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -19614,7 +20612,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -19640,7 +20639,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -19666,7 +20666,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -19692,7 +20693,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prpubid", @@ -19718,7 +20720,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prrelid", @@ -19744,7 +20747,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prqual", @@ -19770,12 +20774,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prattrs", "not_null": false, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -19796,7 +20801,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -19832,7 +20838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -19858,7 +20865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -19884,14 +20892,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attnames", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -19904,13 +20913,14 @@ "type": { "catalog": "", "schema": "", - "name": "_name" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "rowfilter", @@ -19936,7 +20946,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -19972,7 +20983,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -19998,7 +21010,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -20024,7 +21037,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -20050,7 +21064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -20076,7 +21091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -20102,7 +21118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngtypid", @@ -20128,7 +21145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngsubtype", @@ -20154,7 +21172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngmultitypid", @@ -20180,7 +21199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngcollation", @@ -20206,7 +21226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngsubopc", @@ -20232,7 +21253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngcanonical", @@ -20258,7 +21280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngsubdiff", @@ -20284,7 +21307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -20320,7 +21344,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -20346,7 +21371,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -20372,7 +21398,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -20398,7 +21425,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -20424,7 +21452,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -20450,7 +21479,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "roident", @@ -20476,7 +21506,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "roname", @@ -20502,7 +21533,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -20538,7 +21570,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "external_id", @@ -20564,7 +21597,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "remote_lsn", @@ -20590,7 +21624,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "local_lsn", @@ -20616,7 +21651,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -20652,7 +21688,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "plugin", @@ -20678,7 +21715,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "slot_type", @@ -20704,7 +21742,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datoid", @@ -20730,7 +21769,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "database", @@ -20756,7 +21796,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "temporary", @@ -20782,7 +21823,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "active", @@ -20808,7 +21850,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "active_pid", @@ -20834,7 +21877,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -20860,7 +21904,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "catalog_xmin", @@ -20886,7 +21931,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "restart_lsn", @@ -20912,7 +21958,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confirmed_flush_lsn", @@ -20938,7 +21985,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_status", @@ -20964,7 +22012,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "safe_wal_size", @@ -20990,7 +22039,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "two_phase", @@ -21016,7 +22066,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "conflicting", + "not_null": false, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -21052,7 +22130,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -21078,7 +22157,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -21104,7 +22184,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -21130,7 +22211,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -21156,7 +22238,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -21182,7 +22265,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -21208,7 +22292,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rulename", @@ -21234,7 +22319,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_class", @@ -21260,7 +22346,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_type", @@ -21286,7 +22373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_enabled", @@ -21312,7 +22400,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_instead", @@ -21338,7 +22427,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_qual", @@ -21364,7 +22454,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_action", @@ -21390,7 +22481,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -21426,7 +22518,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolsuper", @@ -21452,7 +22545,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolinherit", @@ -21478,7 +22572,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcreaterole", @@ -21504,7 +22599,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcreatedb", @@ -21530,7 +22626,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcanlogin", @@ -21556,7 +22653,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolreplication", @@ -21582,7 +22680,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolconnlimit", @@ -21608,7 +22707,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolpassword", @@ -21634,7 +22734,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolvaliduntil", @@ -21660,7 +22761,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolbypassrls", @@ -21686,7 +22788,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolconfig", @@ -21706,13 +22809,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "oid", @@ -21738,7 +22842,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -21774,7 +22879,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -21800,7 +22906,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rulename", @@ -21826,7 +22933,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "definition", @@ -21852,7 +22960,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -21888,7 +22997,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -21914,7 +23024,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -21940,7 +23051,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -21966,7 +23078,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -21992,7 +23105,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -22018,7 +23132,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -22044,7 +23159,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -22070,7 +23186,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -22096,7 +23213,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provider", @@ -22122,7 +23240,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "label", @@ -22148,7 +23267,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -22184,7 +23304,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -22210,7 +23331,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -22236,7 +23358,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objtype", @@ -22262,7 +23385,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objnamespace", @@ -22288,7 +23412,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objname", @@ -22314,7 +23439,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provider", @@ -22340,7 +23466,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "label", @@ -22366,7 +23493,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -22402,7 +23530,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -22428,7 +23557,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -22454,7 +23584,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -22480,7 +23611,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -22506,7 +23638,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -22532,7 +23665,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqrelid", @@ -22558,7 +23692,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqtypid", @@ -22584,7 +23719,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqstart", @@ -22610,7 +23746,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqincrement", @@ -22636,7 +23773,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqmax", @@ -22662,7 +23800,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqmin", @@ -22688,7 +23827,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqcache", @@ -22714,7 +23854,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqcycle", @@ -22740,7 +23881,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -22776,7 +23918,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequencename", @@ -22802,7 +23945,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequenceowner", @@ -22828,7 +23972,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -22854,7 +23999,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "start_value", @@ -22880,7 +24026,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "min_value", @@ -22906,7 +24053,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "max_value", @@ -22932,7 +24080,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "increment_by", @@ -22958,7 +24107,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cycle", @@ -22984,7 +24134,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cache_size", @@ -23010,7 +24161,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_value", @@ -23036,7 +24188,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -23072,7 +24225,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setting", @@ -23098,7 +24252,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "unit", @@ -23124,7 +24279,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "category", @@ -23150,7 +24306,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "short_desc", @@ -23176,7 +24333,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extra_desc", @@ -23202,7 +24360,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "context", @@ -23228,7 +24387,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "vartype", @@ -23254,7 +24414,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "source", @@ -23280,7 +24441,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "min_val", @@ -23306,7 +24468,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "max_val", @@ -23332,7 +24495,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enumvals", @@ -23352,13 +24516,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "boot_val", @@ -23384,7 +24549,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reset_val", @@ -23410,7 +24576,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sourcefile", @@ -23436,7 +24603,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sourceline", @@ -23462,7 +24630,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pending_restart", @@ -23488,7 +24657,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -23524,7 +24694,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesysid", @@ -23550,7 +24721,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usecreatedb", @@ -23576,7 +24748,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesuper", @@ -23602,7 +24775,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "userepl", @@ -23628,7 +24802,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usebypassrls", @@ -23654,7 +24829,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "passwd", @@ -23680,7 +24856,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "valuntil", @@ -23706,7 +24883,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "useconfig", @@ -23726,13 +24904,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -23768,7 +24947,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -23794,7 +24974,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -23820,7 +25001,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -23846,7 +25028,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -23872,7 +25055,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -23898,7 +25082,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dbid", @@ -23924,7 +25109,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classid", @@ -23950,7 +25136,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objid", @@ -23976,7 +25163,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -24002,7 +25190,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refclassid", @@ -24028,7 +25217,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refobjid", @@ -24054,7 +25244,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "deptype", @@ -24080,7 +25271,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -24116,7 +25308,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -24142,7 +25335,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -24168,7 +25362,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -24194,7 +25389,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -24220,7 +25416,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -24246,7 +25443,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -24272,7 +25470,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -24298,7 +25497,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "description", @@ -24324,7 +25524,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -24360,7 +25561,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "off", @@ -24386,7 +25588,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "size", @@ -24412,7 +25615,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "allocated_size", @@ -24438,7 +25642,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -24474,7 +25679,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -24500,7 +25706,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -24526,7 +25733,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -24552,7 +25760,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -24578,7 +25787,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -24604,7 +25814,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -24630,7 +25841,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -24656,7 +25868,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provider", @@ -24682,7 +25895,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "label", @@ -24708,7 +25922,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -24744,7 +25959,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -24770,7 +25986,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pid", @@ -24796,7 +26013,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "leader_pid", @@ -24822,7 +26040,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesysid", @@ -24848,7 +26067,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usename", @@ -24874,7 +26094,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "application_name", @@ -24900,7 +26121,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_addr", @@ -24926,7 +26148,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_hostname", @@ -24952,7 +26175,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_port", @@ -24978,7 +26202,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_start", @@ -25004,7 +26229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xact_start", @@ -25030,7 +26256,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "query_start", @@ -25056,7 +26283,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "state_change", @@ -25082,7 +26310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wait_event_type", @@ -25108,7 +26337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wait_event", @@ -25134,7 +26364,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "state", @@ -25160,7 +26391,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_xid", @@ -25186,7 +26418,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_xmin", @@ -25212,7 +26445,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "query_id", @@ -25238,7 +26472,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "query", @@ -25264,7 +26499,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_type", @@ -25290,7 +26526,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -25326,7 +26563,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -25352,7 +26590,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -25378,7 +26617,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -25404,7 +26644,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -25430,7 +26671,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -25456,7 +26698,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_read", @@ -25482,7 +26752,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -25508,7 +26779,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -25544,7 +26816,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -25570,7 +26843,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -25596,7 +26870,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -25622,7 +26897,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_seq_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -25648,7 +26951,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -25674,10 +26978,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "idx_tup_fetch", + "name": "last_idx_scan", "not_null": false, "is_array": false, "comment": "", @@ -25694,16 +26999,17 @@ "type": { "catalog": "", "schema": "", - "name": "int8" + "name": "timestamptz" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "n_tup_ins", + "name": "idx_tup_fetch", "not_null": false, "is_array": false, "comment": "", @@ -25726,10 +27032,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "n_tup_upd", + "name": "n_tup_ins", "not_null": false, "is_array": false, "comment": "", @@ -25752,7 +27059,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -25778,7 +27113,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -25804,7 +27140,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "n_live_tup", @@ -25830,7 +27194,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_dead_tup", @@ -25856,7 +27221,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_mod_since_analyze", @@ -25882,7 +27248,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_ins_since_vacuum", @@ -25908,7 +27275,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_vacuum", @@ -25934,7 +27302,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autovacuum", @@ -25960,7 +27329,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_analyze", @@ -25986,7 +27356,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autoanalyze", @@ -26012,7 +27383,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "vacuum_count", @@ -26038,7 +27410,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autovacuum_count", @@ -26064,7 +27437,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "analyze_count", @@ -26090,7 +27464,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autoanalyze_count", @@ -26116,7 +27491,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -26152,7 +27528,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_archived_wal", @@ -26178,7 +27555,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_archived_time", @@ -26204,7 +27582,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "failed_count", @@ -26230,7 +27609,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_failed_wal", @@ -26256,7 +27636,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_failed_time", @@ -26282,7 +27663,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -26308,7 +27690,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -26344,7 +27727,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checkpoints_req", @@ -26370,7 +27754,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checkpoint_write_time", @@ -26396,7 +27781,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checkpoint_sync_time", @@ -26422,7 +27808,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_checkpoint", @@ -26448,7 +27835,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_clean", @@ -26474,7 +27862,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maxwritten_clean", @@ -26500,7 +27889,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_backend", @@ -26526,7 +27916,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_backend_fsync", @@ -26552,7 +27943,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_alloc", @@ -26578,7 +27970,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -26604,7 +27997,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -26640,7 +28034,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -26666,7 +28061,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numbackends", @@ -26692,7 +28088,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xact_commit", @@ -26718,7 +28115,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xact_rollback", @@ -26744,7 +28142,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -26770,7 +28169,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -26796,7 +28196,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_returned", @@ -26822,7 +28223,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_fetched", @@ -26848,7 +28250,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_inserted", @@ -26874,7 +28277,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_updated", @@ -26900,7 +28304,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_deleted", @@ -26926,7 +28331,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conflicts", @@ -26952,7 +28358,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "temp_files", @@ -26978,7 +28385,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "temp_bytes", @@ -27004,7 +28412,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "deadlocks", @@ -27030,7 +28439,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checksum_failures", @@ -27056,7 +28466,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checksum_last_failure", @@ -27082,7 +28493,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blk_read_time", @@ -27108,7 +28520,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blk_write_time", @@ -27134,7 +28547,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "session_time", @@ -27160,7 +28574,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "active_time", @@ -27186,7 +28601,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idle_in_transaction_time", @@ -27212,7 +28628,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sessions", @@ -27238,7 +28655,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sessions_abandoned", @@ -27264,7 +28682,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sessions_fatal", @@ -27290,7 +28709,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sessions_killed", @@ -27316,7 +28736,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -27342,7 +28763,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -27378,7 +28800,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -27404,7 +28827,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_tablespace", @@ -27430,7 +28854,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_lock", @@ -27456,7 +28881,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_snapshot", @@ -27482,7 +28908,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_bufferpin", @@ -27508,7 +28935,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_deadlock", @@ -27534,7 +28962,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "confl_active_logicalslot", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_database_conflicts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -27570,7 +29026,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "gss_authenticated", @@ -27596,7 +29053,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "principal", @@ -27622,7 +29080,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "encrypted", @@ -27648,7 +29107,531 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "credentials_delegated", + "not_null": false, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_gssapi" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "columns": [ + { + "name": "backend_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "object", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "context", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "reads", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "read_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "writes", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "write_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "writebacks", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "writeback_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "extends", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "extend_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "op_bytes", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "hits", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "evictions", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "reuses", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "fsyncs", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "fsync_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "stats_reset", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -27684,7 +29667,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -27710,7 +29694,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -27736,7 +29721,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -27762,7 +29748,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -27788,7 +29775,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sample_blks_total", @@ -27814,7 +29802,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sample_blks_scanned", @@ -27840,7 +29829,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ext_stats_total", @@ -27866,7 +29856,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ext_stats_computed", @@ -27892,7 +29883,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "child_tables_total", @@ -27918,7 +29910,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "child_tables_done", @@ -27944,7 +29937,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "current_child_table_relid", @@ -27970,7 +29964,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -28006,7 +30001,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -28032,7 +30028,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backup_total", @@ -28058,7 +30055,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backup_streamed", @@ -28084,7 +30082,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespaces_total", @@ -28110,7 +30109,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespaces_streamed", @@ -28136,7 +30136,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -28172,7 +30173,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -28198,7 +30200,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -28224,7 +30227,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -28250,7 +30254,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "command", @@ -28276,7 +30281,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -28302,7 +30308,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cluster_index_relid", @@ -28328,7 +30335,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_tuples_scanned", @@ -28354,7 +30362,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_tuples_written", @@ -28380,7 +30389,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_total", @@ -28406,7 +30416,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_scanned", @@ -28432,7 +30443,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "index_rebuild_count", @@ -28458,7 +30470,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -28494,7 +30507,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -28520,7 +30534,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -28546,7 +30561,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -28572,7 +30588,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "command", @@ -28598,7 +30615,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "type", @@ -28624,7 +30642,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bytes_processed", @@ -28650,7 +30669,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bytes_total", @@ -28676,7 +30696,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuples_processed", @@ -28702,7 +30723,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuples_excluded", @@ -28728,7 +30750,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -28764,7 +30787,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -28790,7 +30814,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -28816,7 +30841,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -28842,7 +30868,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "index_relid", @@ -28868,7 +30895,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "command", @@ -28894,7 +30922,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -28920,7 +30949,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lockers_total", @@ -28946,7 +30976,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lockers_done", @@ -28972,7 +31003,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "current_locker_pid", @@ -28998,7 +31030,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blocks_total", @@ -29024,7 +31057,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blocks_done", @@ -29050,7 +31084,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuples_total", @@ -29076,7 +31111,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuples_done", @@ -29102,7 +31138,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partitions_total", @@ -29128,7 +31165,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partitions_done", @@ -29154,7 +31192,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -29190,7 +31229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -29216,7 +31256,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -29242,7 +31283,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -29268,7 +31310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -29294,7 +31337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_total", @@ -29320,7 +31364,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_scanned", @@ -29346,7 +31391,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_vacuumed", @@ -29372,7 +31418,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "index_vacuum_count", @@ -29398,7 +31445,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "max_dead_tuples", @@ -29424,7 +31472,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "num_dead_tuples", @@ -29450,7 +31499,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -29486,7 +31536,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prefetch", @@ -29512,7 +31563,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hit", @@ -29538,7 +31590,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "skip_init", @@ -29564,7 +31617,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "skip_new", @@ -29590,7 +31644,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "skip_fpw", @@ -29616,7 +31671,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "skip_rep", @@ -29642,7 +31698,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_distance", @@ -29668,7 +31725,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "block_distance", @@ -29694,7 +31752,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "io_depth", @@ -29720,7 +31779,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -29756,7 +31816,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesysid", @@ -29782,7 +31843,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usename", @@ -29808,7 +31870,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "application_name", @@ -29834,7 +31897,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_addr", @@ -29860,7 +31924,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_hostname", @@ -29886,7 +31951,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_port", @@ -29912,7 +31978,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_start", @@ -29938,7 +32005,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_xmin", @@ -29964,7 +32032,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "state", @@ -29990,7 +32059,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sent_lsn", @@ -30016,7 +32086,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "write_lsn", @@ -30042,7 +32113,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "flush_lsn", @@ -30068,7 +32140,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "replay_lsn", @@ -30094,7 +32167,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "write_lag", @@ -30120,7 +32194,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "flush_lag", @@ -30146,7 +32221,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "replay_lag", @@ -30172,7 +32248,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sync_priority", @@ -30198,7 +32275,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sync_state", @@ -30224,7 +32302,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reply_time", @@ -30250,7 +32329,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -30286,7 +32366,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spill_txns", @@ -30312,7 +32393,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spill_count", @@ -30338,7 +32420,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spill_bytes", @@ -30364,7 +32447,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stream_txns", @@ -30390,7 +32474,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stream_count", @@ -30416,7 +32501,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stream_bytes", @@ -30442,7 +32528,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_txns", @@ -30468,7 +32555,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_bytes", @@ -30494,7 +32582,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -30520,7 +32609,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -30556,7 +32646,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_zeroed", @@ -30582,7 +32673,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -30608,7 +32700,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -30634,7 +32727,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_written", @@ -30660,7 +32754,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_exists", @@ -30686,7 +32781,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "flushes", @@ -30712,7 +32808,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "truncates", @@ -30738,7 +32835,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -30764,7 +32862,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -30800,7 +32899,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ssl", @@ -30826,7 +32926,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "version", @@ -30852,7 +32953,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cipher", @@ -30878,10 +32980,129 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 - }, + "array_dims": 0, + "type_expr": null + }, + { + "name": "bits", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_ssl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "client_dn", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_ssl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "client_serial", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_ssl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "numeric" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "issuer_dn", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_ssl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_subscription" + }, + "columns": [ { - "name": "bits", + "name": "subid", "not_null": false, "is_array": false, "comment": "", @@ -30892,114 +33113,27 @@ "table": { "catalog": "pg_catalog", "schema": "pg_catalog", - "name": "pg_stat_ssl" - }, - "table_alias": "", - "type": { - "catalog": "", - "schema": "", - "name": "int4" - }, - "is_sqlc_slice": false, - "embed_table": null, - "original_name": "", - "unsigned": false, - "array_dims": 0 - }, - { - "name": "client_dn", - "not_null": false, - "is_array": false, - "comment": "", - "length": -1, - "is_named_param": false, - "is_func_call": false, - "scope": "", - "table": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_stat_ssl" - }, - "table_alias": "", - "type": { - "catalog": "", - "schema": "", - "name": "text" - }, - "is_sqlc_slice": false, - "embed_table": null, - "original_name": "", - "unsigned": false, - "array_dims": 0 - }, - { - "name": "client_serial", - "not_null": false, - "is_array": false, - "comment": "", - "length": -1, - "is_named_param": false, - "is_func_call": false, - "scope": "", - "table": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_stat_ssl" + "name": "pg_stat_subscription" }, "table_alias": "", "type": { "catalog": "", "schema": "", - "name": "numeric" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "issuer_dn", - "not_null": false, - "is_array": false, - "comment": "", - "length": -1, - "is_named_param": false, - "is_func_call": false, - "scope": "", - "table": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_stat_ssl" - }, - "table_alias": "", - "type": { - "catalog": "", - "schema": "", - "name": "text" - }, - "is_sqlc_slice": false, - "embed_table": null, - "original_name": "", - "unsigned": false, - "array_dims": 0 - } - ], - "comment": "" - }, - { - "rel": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_stat_subscription" - }, - "columns": [ - { - "name": "subid", + "name": "subname", "not_null": false, "is_array": false, "comment": "", - "length": 4, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -31012,20 +33146,21 @@ "type": { "catalog": "", "schema": "", - "name": "oid" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "subname", + "name": "pid", "not_null": false, "is_array": false, "comment": "", - "length": 64, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -31038,16 +33173,17 @@ "type": { "catalog": "", "schema": "", - "name": "name" + "name": "int4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "pid", + "name": "leader_pid", "not_null": false, "is_array": false, "comment": "", @@ -31070,7 +33206,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -31096,7 +33233,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "received_lsn", @@ -31122,7 +33260,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_msg_send_time", @@ -31148,7 +33287,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_msg_receipt_time", @@ -31174,7 +33314,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "latest_end_lsn", @@ -31200,7 +33341,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "latest_end_time", @@ -31226,7 +33368,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -31262,7 +33405,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subname", @@ -31288,7 +33432,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "apply_error_count", @@ -31314,7 +33459,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sync_error_count", @@ -31340,7 +33486,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -31366,7 +33513,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -31402,7 +33550,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -31428,7 +33577,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -31454,7 +33604,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -31480,7 +33631,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -31506,7 +33658,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -31532,7 +33685,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_read", @@ -31558,7 +33739,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -31584,7 +33766,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -31620,7 +33803,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -31646,7 +33830,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -31672,7 +33857,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -31698,7 +33884,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_seq_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -31724,7 +33938,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -31750,7 +33965,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -31776,7 +34019,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -31802,7 +34046,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -31828,7 +34073,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -31854,7 +34100,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -31880,7 +34127,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "n_live_tup", @@ -31906,7 +34181,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_dead_tup", @@ -31932,7 +34208,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_mod_since_analyze", @@ -31958,7 +34235,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_ins_since_vacuum", @@ -31984,7 +34262,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_vacuum", @@ -32010,7 +34289,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autovacuum", @@ -32036,7 +34316,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_analyze", @@ -32062,7 +34343,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autoanalyze", @@ -32088,7 +34370,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "vacuum_count", @@ -32114,7 +34397,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autovacuum_count", @@ -32140,7 +34424,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "analyze_count", @@ -32166,7 +34451,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autoanalyze_count", @@ -32192,7 +34478,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -32228,7 +34515,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -32254,7 +34542,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "funcname", @@ -32280,7 +34569,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "calls", @@ -32306,7 +34596,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_time", @@ -32332,7 +34623,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "self_time", @@ -32358,7 +34650,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -32394,7 +34687,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -32420,7 +34714,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -32446,7 +34741,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -32472,7 +34768,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -32498,7 +34795,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -32524,7 +34822,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_read", @@ -32550,7 +34876,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -32576,7 +34903,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -32612,7 +34940,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -32638,7 +34967,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -32664,7 +34994,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -32690,7 +35021,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_seq_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -32716,7 +35075,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -32742,7 +35102,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -32768,7 +35156,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -32794,7 +35183,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -32820,7 +35210,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -32846,7 +35237,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -32872,7 +35264,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "n_live_tup", @@ -32898,7 +35318,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_dead_tup", @@ -32924,7 +35345,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_mod_since_analyze", @@ -32950,7 +35372,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_ins_since_vacuum", @@ -32976,7 +35399,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_vacuum", @@ -33002,7 +35426,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autovacuum", @@ -33028,7 +35453,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_analyze", @@ -33054,7 +35480,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autoanalyze", @@ -33080,7 +35507,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "vacuum_count", @@ -33106,7 +35534,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autovacuum_count", @@ -33132,7 +35561,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "analyze_count", @@ -33158,7 +35588,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autoanalyze_count", @@ -33184,7 +35615,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -33220,7 +35652,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_fpi", @@ -33246,7 +35679,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_bytes", @@ -33272,7 +35706,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_buffers_full", @@ -33298,7 +35733,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_write", @@ -33324,7 +35760,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_sync", @@ -33350,7 +35787,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_write_time", @@ -33376,7 +35814,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_sync_time", @@ -33402,7 +35841,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -33428,7 +35868,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -33464,7 +35905,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "status", @@ -33490,7 +35932,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "receive_start_lsn", @@ -33516,7 +35959,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "receive_start_tli", @@ -33542,7 +35986,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "written_lsn", @@ -33568,7 +36013,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "flushed_lsn", @@ -33594,7 +36040,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "received_tli", @@ -33620,7 +36067,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_msg_send_time", @@ -33646,7 +36094,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_msg_receipt_time", @@ -33672,7 +36121,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "latest_end_lsn", @@ -33698,7 +36148,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "latest_end_time", @@ -33724,7 +36175,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "slot_name", @@ -33750,7 +36202,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sender_host", @@ -33776,7 +36229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sender_port", @@ -33802,7 +36256,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conninfo", @@ -33828,7 +36283,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -33864,7 +36320,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -33890,7 +36347,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -33916,7 +36374,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -33942,7 +36401,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -33968,7 +36428,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -33994,7 +36455,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -34020,7 +36482,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -34046,7 +36509,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -34072,7 +36536,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -34098,7 +36563,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -34124,7 +36590,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -34160,7 +36654,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -34186,7 +36681,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -34212,7 +36708,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -34238,7 +36735,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -34264,7 +36762,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -34290,7 +36789,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -34316,7 +36816,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -34342,7 +36843,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -34368,7 +36870,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -34394,7 +36897,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -34420,7 +36924,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -34456,7 +36988,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -34482,7 +37015,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "funcname", @@ -34508,7 +37042,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "calls", @@ -34534,7 +37069,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_time", @@ -34560,7 +37096,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "self_time", @@ -34586,7 +37123,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -34622,7 +37160,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -34648,7 +37187,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -34674,7 +37214,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -34700,7 +37241,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -34726,7 +37268,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -34752,7 +37295,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -34778,7 +37322,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -34804,7 +37349,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -34830,7 +37376,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -34856,7 +37403,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -34882,7 +37430,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -34918,7 +37494,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -34944,7 +37521,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -34970,7 +37548,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -34996,7 +37575,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -35022,7 +37602,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -35048,7 +37629,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -35074,7 +37656,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35110,7 +37693,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35136,7 +37720,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35162,7 +37747,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -35188,7 +37774,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -35214,7 +37801,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35250,7 +37838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35276,7 +37865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35302,7 +37892,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_read", @@ -35328,7 +37919,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_hit", @@ -35354,7 +37946,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -35380,7 +37973,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -35406,7 +38000,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_read", @@ -35432,7 +38027,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_hit", @@ -35458,7 +38054,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_read", @@ -35484,7 +38081,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_hit", @@ -35510,7 +38108,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35546,7 +38145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -35572,7 +38172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35598,7 +38199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35624,7 +38226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -35650,7 +38253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -35676,7 +38280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -35702,7 +38307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35738,7 +38344,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35764,7 +38371,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35790,7 +38398,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -35816,7 +38425,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -35842,7 +38452,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35878,7 +38489,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35904,7 +38516,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35930,7 +38543,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_read", @@ -35956,7 +38570,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_hit", @@ -35982,7 +38597,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -36008,7 +38624,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -36034,7 +38651,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_read", @@ -36060,7 +38678,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_hit", @@ -36086,7 +38705,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_read", @@ -36112,7 +38732,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_hit", @@ -36138,7 +38759,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -36174,7 +38796,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -36200,7 +38823,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -36226,7 +38850,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -36252,7 +38877,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -36278,7 +38904,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -36304,7 +38931,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -36330,7 +38958,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -36366,7 +38995,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -36392,7 +39022,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -36418,7 +39049,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -36444,7 +39076,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -36470,7 +39103,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -36506,7 +39140,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -36532,7 +39167,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -36558,7 +39194,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_read", @@ -36584,7 +39221,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_hit", @@ -36610,7 +39248,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -36636,7 +39275,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -36662,7 +39302,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_read", @@ -36688,7 +39329,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_hit", @@ -36714,7 +39356,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_read", @@ -36740,7 +39383,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_hit", @@ -36766,7 +39410,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -36802,7 +39447,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -36828,7 +39474,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -36854,7 +39501,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -36880,7 +39528,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -36906,7 +39555,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -36932,7 +39582,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "starelid", @@ -36958,7 +39609,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staattnum", @@ -36984,7 +39636,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stainherit", @@ -37010,7 +39663,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stanullfrac", @@ -37036,7 +39690,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stawidth", @@ -37062,7 +39717,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stadistinct", @@ -37088,7 +39744,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind1", @@ -37114,7 +39771,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind2", @@ -37140,7 +39798,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind3", @@ -37166,7 +39825,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind4", @@ -37192,7 +39852,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind5", @@ -37218,7 +39879,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop1", @@ -37244,7 +39906,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop2", @@ -37270,7 +39933,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop3", @@ -37296,7 +39960,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop4", @@ -37322,7 +39987,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop5", @@ -37348,7 +40014,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll1", @@ -37374,7 +40041,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll2", @@ -37400,7 +40068,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll3", @@ -37426,7 +40095,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll4", @@ -37452,7 +40122,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll5", @@ -37478,14 +40149,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stanumbers1", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37498,20 +40170,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stanumbers2", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37524,20 +40197,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stanumbers3", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37550,20 +40224,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stanumbers4", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37576,20 +40251,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stanumbers5", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37602,13 +40278,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stavalues1", @@ -37634,7 +40311,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stavalues2", @@ -37660,7 +40338,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stavalues3", @@ -37686,7 +40365,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stavalues4", @@ -37712,7 +40392,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stavalues5", @@ -37738,7 +40419,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -37774,7 +40456,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -37800,7 +40483,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -37826,7 +40510,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -37852,7 +40537,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -37878,7 +40564,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -37904,7 +40591,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -37930,7 +40618,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxrelid", @@ -37956,7 +40645,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxname", @@ -37982,7 +40672,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxnamespace", @@ -38008,7 +40699,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxowner", @@ -38034,7 +40726,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxstattarget", @@ -38060,12 +40753,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxkeys", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -38086,14 +40780,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxkind", "not_null": true, "is_array": true, "comment": "", - "length": -1, + "length": 1, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38106,13 +40801,14 @@ "type": { "catalog": "", "schema": "", - "name": "_char" + "name": "char" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stxexprs", @@ -38138,7 +40834,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -38174,7 +40871,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -38200,7 +40898,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -38226,7 +40925,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -38252,7 +40952,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -38278,7 +40979,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -38304,7 +41006,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxoid", @@ -38330,7 +41033,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxdinherit", @@ -38356,7 +41060,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxdndistinct", @@ -38382,7 +41087,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxddependencies", @@ -38408,7 +41114,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxdmcv", @@ -38434,7 +41141,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxdexpr", @@ -38454,13 +41162,14 @@ "type": { "catalog": "", "schema": "", - "name": "_pg_statistic" + "name": "pg_statistic" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -38496,7 +41205,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -38522,7 +41232,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attname", @@ -38548,7 +41259,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inherited", @@ -38574,7 +41286,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "null_frac", @@ -38600,7 +41313,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "avg_width", @@ -38626,7 +41340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_distinct", @@ -38652,7 +41367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_vals", @@ -38678,14 +41394,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38698,13 +41415,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "histogram_bounds", @@ -38730,7 +41448,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "correlation", @@ -38756,7 +41475,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_elems", @@ -38782,14 +41502,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_elem_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38802,20 +41523,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "elem_count_histogram", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38828,13 +41550,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -38870,7 +41593,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -38896,7 +41620,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_schemaname", @@ -38922,7 +41647,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_name", @@ -38948,7 +41674,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_owner", @@ -38974,14 +41701,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attnames", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38994,13 +41722,14 @@ "type": { "catalog": "", "schema": "", - "name": "_name" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "exprs", @@ -39020,20 +41749,21 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "kinds", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 1, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39046,13 +41776,14 @@ "type": { "catalog": "", "schema": "", - "name": "_char" + "name": "char" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "inherited", @@ -39078,7 +41809,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_distinct", @@ -39104,7 +41836,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dependencies", @@ -39130,7 +41863,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_vals", @@ -39150,20 +41884,21 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "most_common_val_nulls", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 1, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39176,20 +41911,21 @@ "type": { "catalog": "", "schema": "", - "name": "_bool" + "name": "bool" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "most_common_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 8, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39202,20 +41938,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float8" + "name": "float8" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "most_common_base_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 8, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39228,13 +41965,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float8" + "name": "float8" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -39270,7 +42008,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -39296,7 +42035,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_schemaname", @@ -39322,7 +42062,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_name", @@ -39348,7 +42089,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_owner", @@ -39374,7 +42116,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "expr", @@ -39400,7 +42143,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inherited", @@ -39426,7 +42170,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "null_frac", @@ -39452,7 +42197,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "avg_width", @@ -39478,7 +42224,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_distinct", @@ -39504,7 +42251,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_vals", @@ -39530,14 +42278,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39550,13 +42299,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "histogram_bounds", @@ -39582,7 +42332,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "correlation", @@ -39608,7 +42359,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_elems", @@ -39634,14 +42386,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_elem_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39654,20 +42407,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "elem_count_histogram", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39680,13 +42434,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -39722,7 +42477,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -39748,7 +42504,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -39774,7 +42531,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -39800,7 +42558,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -39826,7 +42585,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -39852,7 +42612,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -39878,7 +42639,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subdbid", @@ -39904,7 +42666,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subskiplsn", @@ -39930,7 +42693,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subname", @@ -39956,7 +42720,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subowner", @@ -39982,7 +42747,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subenabled", @@ -40008,7 +42774,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subbinary", @@ -40034,7 +42801,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "substream", @@ -40054,13 +42822,14 @@ "type": { "catalog": "", "schema": "", - "name": "bool" + "name": "char" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subtwophasestate", @@ -40086,7 +42855,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subdisableonerr", @@ -40112,7 +42882,62 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "subpasswordrequired", + "not_null": true, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "subrunasowner", + "not_null": true, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "subconninfo", @@ -40138,7 +42963,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subslotname", @@ -40164,7 +42990,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subsynccommit", @@ -40190,7 +43017,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subpublications", @@ -40210,13 +43038,41 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 1, + "type_expr": null + }, + { + "name": "suborigin", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -40252,7 +43108,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -40278,7 +43135,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -40304,7 +43162,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -40330,7 +43189,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -40356,7 +43216,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -40382,7 +43243,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srsubid", @@ -40408,7 +43270,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srrelid", @@ -40434,7 +43297,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srsubstate", @@ -40460,7 +43324,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srsublsn", @@ -40486,7 +43351,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -40522,7 +43388,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -40548,7 +43415,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tableowner", @@ -40574,7 +43442,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespace", @@ -40600,7 +43469,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hasindexes", @@ -40626,7 +43496,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hasrules", @@ -40652,7 +43523,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hastriggers", @@ -40678,7 +43550,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rowsecurity", @@ -40704,7 +43577,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -40740,7 +43614,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -40766,7 +43641,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -40792,7 +43668,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -40818,7 +43695,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -40844,7 +43722,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -40870,7 +43749,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -40896,7 +43776,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spcname", @@ -40922,7 +43803,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spcowner", @@ -40948,14 +43830,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spcacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -40968,13 +43851,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "spcoptions", @@ -40994,13 +43878,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -41036,7 +43921,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "utc_offset", @@ -41062,7 +43948,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_dst", @@ -41088,7 +43975,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -41124,7 +44012,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "abbrev", @@ -41150,7 +44039,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "utc_offset", @@ -41176,7 +44066,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_dst", @@ -41202,7 +44093,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -41238,7 +44130,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -41264,7 +44157,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -41290,7 +44184,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -41316,7 +44211,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -41342,7 +44238,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -41368,7 +44265,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -41394,7 +44292,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trftype", @@ -41420,7 +44319,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trflang", @@ -41446,7 +44346,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trffromsql", @@ -41472,7 +44373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trftosql", @@ -41498,7 +44400,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -41534,7 +44437,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -41560,7 +44464,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -41586,7 +44491,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -41612,7 +44518,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -41638,7 +44545,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -41664,7 +44572,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -41690,7 +44599,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgrelid", @@ -41716,7 +44626,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgparentid", @@ -41742,7 +44653,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgname", @@ -41768,7 +44680,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgfoid", @@ -41794,7 +44707,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgtype", @@ -41820,7 +44734,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgenabled", @@ -41846,7 +44761,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgisinternal", @@ -41872,7 +44788,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgconstrrelid", @@ -41898,7 +44815,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgconstrindid", @@ -41924,7 +44842,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgconstraint", @@ -41950,7 +44869,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgdeferrable", @@ -41976,7 +44896,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tginitdeferred", @@ -42002,7 +44923,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgnargs", @@ -42028,12 +44950,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgattr", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -42054,7 +44977,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgargs", @@ -42080,7 +45004,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgqual", @@ -42106,7 +45031,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgoldtable", @@ -42132,7 +45058,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgnewtable", @@ -42158,7 +45085,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -42194,7 +45122,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -42220,7 +45149,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -42246,7 +45176,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -42272,7 +45203,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -42298,7 +45230,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -42324,7 +45257,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -42350,7 +45284,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cfgname", @@ -42376,7 +45311,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cfgnamespace", @@ -42402,7 +45338,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cfgowner", @@ -42428,7 +45365,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cfgparser", @@ -42454,7 +45392,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -42490,7 +45429,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -42516,7 +45456,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -42542,7 +45483,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -42568,7 +45510,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -42594,7 +45537,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -42620,7 +45564,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "mapcfg", @@ -42646,7 +45591,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maptokentype", @@ -42672,7 +45618,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "mapseqno", @@ -42698,7 +45645,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "mapdict", @@ -42724,7 +45672,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -42760,7 +45709,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -42786,7 +45736,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -42812,7 +45763,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -42838,7 +45790,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -42864,7 +45817,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -42890,7 +45844,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -42916,7 +45871,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dictname", @@ -42942,7 +45898,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dictnamespace", @@ -42968,7 +45925,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dictowner", @@ -42994,7 +45952,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dicttemplate", @@ -43020,7 +45979,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dictinitoption", @@ -43046,7 +46006,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -43082,7 +46043,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -43108,7 +46070,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -43134,7 +46097,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -43160,7 +46124,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -43186,7 +46151,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -43212,7 +46178,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -43238,7 +46205,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsname", @@ -43264,7 +46232,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsnamespace", @@ -43290,7 +46259,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsstart", @@ -43316,7 +46286,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prstoken", @@ -43342,7 +46313,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsend", @@ -43368,7 +46340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsheadline", @@ -43394,7 +46367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prslextype", @@ -43420,7 +46394,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -43456,7 +46431,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -43482,7 +46458,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -43508,7 +46485,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -43534,7 +46512,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -43560,7 +46539,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -43586,7 +46566,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -43612,7 +46593,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tmplname", @@ -43638,7 +46620,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tmplnamespace", @@ -43664,7 +46647,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tmplinit", @@ -43690,7 +46674,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tmpllexize", @@ -43716,7 +46701,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -43752,7 +46738,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -43778,7 +46765,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -43804,7 +46792,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -43830,7 +46819,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -43856,7 +46846,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -43882,7 +46873,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -43908,7 +46900,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typname", @@ -43934,7 +46927,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typnamespace", @@ -43960,7 +46954,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typowner", @@ -43986,7 +46981,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typlen", @@ -44012,7 +47008,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typbyval", @@ -44038,7 +47035,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typtype", @@ -44064,7 +47062,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typcategory", @@ -44090,7 +47089,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typispreferred", @@ -44116,7 +47116,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typisdefined", @@ -44142,7 +47143,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typdelim", @@ -44168,7 +47170,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typrelid", @@ -44194,7 +47197,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typsubscript", @@ -44220,7 +47224,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typelem", @@ -44246,7 +47251,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typarray", @@ -44272,7 +47278,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typinput", @@ -44298,7 +47305,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typoutput", @@ -44324,7 +47332,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typreceive", @@ -44350,7 +47359,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typsend", @@ -44376,7 +47386,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typmodin", @@ -44402,7 +47413,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typmodout", @@ -44428,7 +47440,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typanalyze", @@ -44454,7 +47467,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typalign", @@ -44480,7 +47494,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typstorage", @@ -44506,7 +47521,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typnotnull", @@ -44532,7 +47548,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typbasetype", @@ -44558,7 +47575,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typtypmod", @@ -44584,7 +47602,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typndims", @@ -44610,7 +47629,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typcollation", @@ -44636,7 +47656,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typdefaultbin", @@ -44662,7 +47683,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typdefault", @@ -44688,14 +47710,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -44708,13 +47731,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -44750,7 +47774,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesysid", @@ -44776,7 +47801,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usecreatedb", @@ -44802,7 +47828,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesuper", @@ -44828,7 +47855,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "userepl", @@ -44854,7 +47882,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usebypassrls", @@ -44880,7 +47909,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "passwd", @@ -44906,7 +47936,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "valuntil", @@ -44932,7 +47963,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "useconfig", @@ -44952,13 +47984,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -44994,7 +48027,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -45020,7 +48054,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -45046,7 +48081,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -45072,7 +48108,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -45098,7 +48135,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -45124,7 +48162,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -45150,7 +48189,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umuser", @@ -45176,7 +48216,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umserver", @@ -45202,7 +48243,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umoptions", @@ -45222,13 +48264,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -45264,7 +48307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvid", @@ -45290,7 +48334,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvname", @@ -45316,7 +48361,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umuser", @@ -45342,7 +48388,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usename", @@ -45368,7 +48415,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umoptions", @@ -45388,13 +48436,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -45430,7 +48479,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "viewname", @@ -45456,7 +48506,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "viewowner", @@ -45482,7 +48533,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "definition", @@ -45508,7 +48560,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -45552,7 +48605,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwowner", @@ -45578,7 +48632,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwoptions", @@ -45598,13 +48653,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "foreign_data_wrapper_catalog", @@ -45630,7 +48686,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -45656,7 +48713,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -45682,7 +48740,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_language", @@ -45708,7 +48767,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -45744,7 +48804,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvoptions", @@ -45764,13 +48825,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -45796,7 +48858,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -45822,7 +48885,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_catalog", @@ -45848,7 +48912,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -45874,7 +48939,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_type", @@ -45900,7 +48966,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_version", @@ -45926,7 +48993,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -45952,7 +49020,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -45988,7 +49057,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -46014,7 +49084,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attname", @@ -46040,7 +49111,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attfdwoptions", @@ -46060,13 +49132,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -46102,7 +49175,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_schema", @@ -46128,7 +49202,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_name", @@ -46154,7 +49229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ftoptions", @@ -46174,13 +49250,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -46206,7 +49283,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -46232,7 +49310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -46258,7 +49337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -46294,7 +49374,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umoptions", @@ -46314,13 +49395,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "umuser", @@ -46346,7 +49428,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -46372,7 +49455,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -46398,7 +49482,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -46424,7 +49509,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvowner", @@ -46450,7 +49536,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -46486,7 +49573,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "role_name", @@ -46512,7 +49600,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -46538,7 +49627,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -46574,7 +49664,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "role_name", @@ -46600,7 +49691,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -46626,7 +49718,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -46662,7 +49755,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -46688,7 +49782,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -46714,7 +49809,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_name", @@ -46740,7 +49836,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordinal_position", @@ -46766,7 +49863,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_default", @@ -46792,7 +49890,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_nullable", @@ -46818,7 +49917,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -46844,7 +49944,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -46870,7 +49971,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -46896,7 +49998,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -46922,7 +50025,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -46948,7 +50052,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -46974,7 +50079,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -47000,7 +50106,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -47026,7 +50133,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -47052,7 +50160,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -47078,7 +50187,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -47104,7 +50214,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -47130,7 +50241,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -47156,7 +50268,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -47182,7 +50295,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -47208,7 +50322,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_udt_catalog", @@ -47234,7 +50349,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_udt_schema", @@ -47260,7 +50376,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_udt_name", @@ -47286,7 +50403,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -47312,7 +50430,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -47338,7 +50457,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -47364,7 +50484,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -47390,7 +50511,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -47416,7 +50538,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_derived_reference_attribute", @@ -47442,7 +50565,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -47478,7 +50602,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -47504,7 +50629,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -47530,7 +50656,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_repertoire", @@ -47556,7 +50683,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "form_of_use", @@ -47582,7 +50710,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_collate_catalog", @@ -47608,7 +50737,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_collate_schema", @@ -47634,7 +50764,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_collate_name", @@ -47660,7 +50791,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -47696,7 +50828,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -47722,7 +50855,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -47748,7 +50882,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -47774,7 +50909,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -47800,7 +50936,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -47826,7 +50963,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -47862,7 +51000,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -47888,7 +51027,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -47914,7 +51054,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "check_clause", @@ -47940,7 +51081,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -47976,7 +51118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -48002,7 +51145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -48028,7 +51172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -48054,7 +51199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -48080,7 +51226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -48106,7 +51253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48142,7 +51290,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -48168,7 +51317,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -48194,7 +51344,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pad_attribute", @@ -48220,7 +51371,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48256,7 +51408,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -48282,7 +51435,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -48308,7 +51462,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -48334,7 +51489,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dependent_column", @@ -48360,7 +51516,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48396,7 +51553,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -48422,7 +51580,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -48448,7 +51607,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -48474,7 +51634,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -48500,7 +51661,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -48526,7 +51688,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -48552,7 +51715,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48588,7 +51752,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -48614,7 +51779,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -48640,7 +51806,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -48666,7 +51833,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -48692,7 +51860,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -48718,7 +51887,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48754,7 +51924,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -48780,7 +51951,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -48806,7 +51978,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -48832,7 +52005,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -48858,7 +52032,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -48884,7 +52059,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -48910,7 +52086,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -48936,7 +52113,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48972,7 +52150,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -48998,7 +52177,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -49024,7 +52204,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -49050,7 +52231,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -49076,7 +52258,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -49102,7 +52285,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -49128,7 +52312,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -49164,7 +52349,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -49190,7 +52376,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -49216,7 +52403,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -49242,7 +52430,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordinal_position", @@ -49268,7 +52457,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_default", @@ -49294,7 +52484,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_nullable", @@ -49320,7 +52511,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -49346,7 +52538,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -49372,7 +52565,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -49398,7 +52592,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -49424,7 +52619,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -49450,7 +52646,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -49476,7 +52673,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -49502,7 +52700,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -49528,7 +52727,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -49554,7 +52754,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -49580,7 +52781,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -49606,7 +52808,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -49632,7 +52835,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -49658,7 +52862,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -49684,7 +52889,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -49710,7 +52916,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_catalog", @@ -49736,7 +52943,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -49762,7 +52970,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -49788,7 +52997,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -49814,7 +53024,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -49840,7 +53051,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -49866,7 +53078,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -49892,7 +53105,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -49918,7 +53132,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -49944,7 +53159,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -49970,7 +53186,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -49996,7 +53213,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_self_referencing", @@ -50022,7 +53240,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_identity", @@ -50048,7 +53267,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_generation", @@ -50074,7 +53294,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_start", @@ -50100,7 +53321,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_increment", @@ -50126,7 +53348,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_maximum", @@ -50152,7 +53375,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_minimum", @@ -50178,7 +53402,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_cycle", @@ -50204,7 +53429,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_generated", @@ -50230,7 +53456,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "generation_expression", @@ -50256,7 +53483,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_updatable", @@ -50282,7 +53510,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -50318,7 +53547,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -50344,7 +53574,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -50370,7 +53601,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -50396,7 +53628,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_catalog", @@ -50422,7 +53655,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -50448,7 +53682,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -50474,7 +53709,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -50510,7 +53746,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -50536,7 +53773,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -50562,7 +53800,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_catalog", @@ -50588,7 +53827,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -50614,7 +53854,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -50640,7 +53881,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -50676,7 +53918,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_schema", @@ -50702,7 +53945,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_name", @@ -50728,7 +53972,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_type", @@ -50754,7 +53999,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -50780,7 +54026,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -50816,7 +54063,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -50842,7 +54090,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -50868,7 +54117,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_catalog", @@ -50894,7 +54144,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -50920,7 +54171,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -50946,7 +54198,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_deferrable", @@ -50972,7 +54225,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "initially_deferred", @@ -50998,7 +54252,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -51034,7 +54289,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -51060,7 +54316,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -51086,7 +54343,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_catalog", @@ -51112,7 +54370,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -51138,7 +54397,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -51164,7 +54424,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -51200,7 +54461,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -51226,7 +54488,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -51252,7 +54515,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -51278,7 +54542,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -51304,7 +54569,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -51330,7 +54596,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -51356,7 +54623,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -51382,7 +54650,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -51408,7 +54677,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -51434,7 +54704,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -51460,7 +54731,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -51486,7 +54758,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -51512,7 +54785,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -51538,7 +54812,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -51564,7 +54839,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -51590,7 +54866,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -51616,7 +54893,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -51642,7 +54920,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_default", @@ -51668,7 +54947,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -51694,7 +54974,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -51720,7 +55001,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -51746,7 +55028,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -51772,7 +55055,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -51798,7 +55082,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -51824,7 +55109,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -51850,7 +55136,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -51876,7 +55163,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -51912,7 +55200,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_schema", @@ -51938,7 +55227,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_name", @@ -51964,7 +55254,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_type", @@ -51990,7 +55281,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collection_type_identifier", @@ -52016,7 +55308,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -52042,7 +55335,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -52068,7 +55362,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -52094,7 +55389,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -52120,7 +55416,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -52146,7 +55443,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -52172,7 +55470,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -52198,7 +55497,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -52224,7 +55524,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -52250,7 +55551,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -52276,7 +55578,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -52302,7 +55605,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -52328,7 +55632,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -52354,7 +55659,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -52380,7 +55686,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -52406,7 +55713,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_default", @@ -52432,7 +55740,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -52458,7 +55767,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -52484,7 +55794,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -52510,7 +55821,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -52536,7 +55848,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -52562,7 +55875,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -52588,7 +55902,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -52614,7 +55929,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -52640,7 +55956,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -52676,7 +55993,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -52712,7 +56030,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -52738,7 +56057,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -52764,7 +56084,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -52790,7 +56111,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -52826,7 +56148,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -52852,7 +56175,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -52878,7 +56202,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "library_name", @@ -52904,7 +56229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_language", @@ -52930,7 +56256,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -52966,7 +56293,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -52992,7 +56320,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -53018,7 +56347,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -53044,7 +56374,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53080,7 +56411,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -53106,7 +56438,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_catalog", @@ -53132,7 +56465,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -53158,7 +56492,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_type", @@ -53184,7 +56519,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_version", @@ -53210,7 +56546,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -53236,7 +56573,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53272,7 +56610,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_schema", @@ -53298,7 +56637,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_name", @@ -53324,7 +56664,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -53350,7 +56691,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -53376,7 +56718,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53412,7 +56755,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_schema", @@ -53438,7 +56782,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_name", @@ -53464,7 +56809,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -53490,7 +56836,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -53516,7 +56863,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53552,7 +56900,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53588,7 +56937,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -53614,7 +56964,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -53640,7 +56991,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -53666,7 +57018,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -53692,7 +57045,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -53718,7 +57072,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -53744,7 +57099,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordinal_position", @@ -53770,7 +57126,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "position_in_unique_constraint", @@ -53796,7 +57153,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53832,7 +57190,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -53858,7 +57217,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -53884,7 +57244,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordinal_position", @@ -53910,7 +57271,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_mode", @@ -53936,7 +57298,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_result", @@ -53962,7 +57325,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "as_locator", @@ -53988,7 +57352,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_name", @@ -54014,7 +57379,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -54040,7 +57406,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -54066,7 +57433,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -54092,7 +57460,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -54118,7 +57487,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -54144,7 +57514,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -54170,7 +57541,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -54196,7 +57568,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -54222,7 +57595,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -54248,7 +57622,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -54274,7 +57649,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -54300,7 +57676,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -54326,7 +57703,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -54352,7 +57730,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -54378,7 +57757,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -54404,7 +57784,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -54430,7 +57811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -54456,7 +57838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -54482,7 +57865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -54508,7 +57892,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -54534,7 +57919,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -54560,7 +57946,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -54586,7 +57973,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -54612,7 +58000,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_default", @@ -54638,7 +58027,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -54674,7 +58064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -54700,7 +58091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -54726,7 +58118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "unique_constraint_catalog", @@ -54752,7 +58145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "unique_constraint_schema", @@ -54778,7 +58172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "unique_constraint_name", @@ -54804,7 +58199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "match_option", @@ -54830,7 +58226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "update_rule", @@ -54856,7 +58253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "delete_rule", @@ -54882,7 +58280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -54918,7 +58317,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -54944,7 +58344,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -54970,7 +58371,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -54996,7 +58398,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -55022,7 +58425,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -55048,7 +58452,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55074,7 +58479,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55100,7 +58506,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -55136,7 +58543,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -55162,7 +58570,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -55188,7 +58597,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -55214,7 +58624,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -55240,7 +58651,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -55266,7 +58678,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -55292,7 +58705,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -55318,7 +58732,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55344,7 +58759,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55370,7 +58786,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -55406,7 +58823,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -55432,7 +58850,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -55458,7 +58877,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -55484,7 +58904,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -55510,7 +58931,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55536,7 +58958,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55562,7 +58985,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "with_hierarchy", @@ -55588,7 +59012,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -55624,7 +59049,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -55650,7 +59076,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -55676,7 +59103,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -55702,7 +59130,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -55728,7 +59157,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55754,7 +59184,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55780,7 +59211,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -55816,7 +59248,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -55842,7 +59275,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_catalog", @@ -55868,7 +59302,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_schema", @@ -55894,7 +59329,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_name", @@ -55920,7 +59356,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_type", @@ -55946,7 +59383,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55972,7 +59410,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55998,7 +59437,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56034,7 +59474,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -56060,7 +59501,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -56086,7 +59528,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -56112,7 +59555,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -56138,7 +59582,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -56164,7 +59609,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -56190,7 +59636,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -56216,7 +59663,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -56242,7 +59690,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -56268,7 +59717,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56304,7 +59754,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -56330,7 +59781,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -56356,7 +59808,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -56382,7 +59835,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -56408,7 +59862,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -56434,7 +59889,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -56460,7 +59916,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -56486,7 +59943,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -56512,7 +59970,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -56538,7 +59997,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56574,7 +60034,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -56600,7 +60061,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -56626,7 +60088,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -56652,7 +60115,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -56678,7 +60142,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -56704,7 +60169,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56740,7 +60206,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -56766,7 +60233,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -56792,7 +60260,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -56818,7 +60287,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -56844,7 +60314,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -56870,7 +60341,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_catalog", @@ -56896,7 +60368,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_schema", @@ -56922,7 +60395,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_name", @@ -56948,7 +60422,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56984,7 +60459,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -57010,7 +60486,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -57036,7 +60513,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -57062,7 +60540,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -57088,7 +60567,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -57114,7 +60594,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -57140,7 +60621,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -57166,7 +60648,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -57192,7 +60675,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -57228,7 +60712,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -57254,7 +60739,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -57280,7 +60766,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -57306,7 +60793,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -57332,7 +60820,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -57358,7 +60847,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_type", @@ -57384,7 +60874,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "module_catalog", @@ -57410,7 +60901,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "module_schema", @@ -57436,7 +60928,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "module_name", @@ -57462,7 +60955,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -57488,7 +60982,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -57514,7 +61009,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -57540,7 +61036,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -57566,7 +61063,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -57592,7 +61090,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -57618,7 +61117,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -57644,7 +61144,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -57670,7 +61171,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -57696,7 +61198,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -57722,7 +61225,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -57748,7 +61252,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -57774,7 +61279,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -57800,7 +61306,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -57826,7 +61333,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -57852,7 +61360,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -57878,7 +61387,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -57904,7 +61414,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -57930,7 +61441,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "type_udt_catalog", @@ -57956,7 +61468,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "type_udt_schema", @@ -57982,7 +61495,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "type_udt_name", @@ -58008,7 +61522,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -58034,7 +61549,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -58060,7 +61576,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -58086,7 +61603,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -58112,7 +61630,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -58138,7 +61657,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_body", @@ -58164,7 +61684,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_definition", @@ -58190,7 +61711,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "external_name", @@ -58216,7 +61738,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "external_language", @@ -58242,7 +61765,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_style", @@ -58268,7 +61792,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_deterministic", @@ -58294,7 +61819,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sql_data_access", @@ -58320,7 +61846,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_null_call", @@ -58346,7 +61873,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sql_path", @@ -58372,7 +61900,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schema_level_routine", @@ -58398,7 +61927,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "max_dynamic_result_sets", @@ -58424,7 +61954,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_user_defined_cast", @@ -58450,7 +61981,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_implicitly_invocable", @@ -58476,7 +62008,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "security_type", @@ -58502,7 +62035,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "to_sql_specific_catalog", @@ -58528,7 +62062,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "to_sql_specific_schema", @@ -58554,7 +62089,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "to_sql_specific_name", @@ -58580,7 +62116,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "as_locator", @@ -58606,7 +62143,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "created", @@ -58632,7 +62170,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_altered", @@ -58658,7 +62197,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "new_savepoint_level", @@ -58684,7 +62224,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_udt_dependent", @@ -58710,7 +62251,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_from_data_type", @@ -58736,7 +62278,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_as_locator", @@ -58762,7 +62305,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_max_length", @@ -58788,7 +62332,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_octet_length", @@ -58814,7 +62359,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_set_catalog", @@ -58840,7 +62386,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_set_schema", @@ -58866,7 +62413,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_set_name", @@ -58892,7 +62440,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_collation_catalog", @@ -58918,7 +62467,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_collation_schema", @@ -58944,7 +62494,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_collation_name", @@ -58970,7 +62521,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_numeric_precision", @@ -58996,7 +62548,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_numeric_precision_radix", @@ -59022,7 +62575,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_numeric_scale", @@ -59048,7 +62602,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_datetime_precision", @@ -59074,7 +62629,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_interval_type", @@ -59100,7 +62656,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_interval_precision", @@ -59126,7 +62683,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_type_udt_catalog", @@ -59152,7 +62710,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_type_udt_schema", @@ -59178,7 +62737,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_type_udt_name", @@ -59204,7 +62764,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_scope_catalog", @@ -59230,7 +62791,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_scope_schema", @@ -59256,7 +62818,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_scope_name", @@ -59282,7 +62845,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_maximum_cardinality", @@ -59308,7 +62872,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_dtd_identifier", @@ -59334,7 +62899,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -59370,7 +62936,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schema_name", @@ -59396,7 +62963,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schema_owner", @@ -59422,7 +62990,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_character_set_catalog", @@ -59448,7 +63017,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_character_set_schema", @@ -59474,7 +63044,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_character_set_name", @@ -59500,7 +63071,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sql_path", @@ -59526,7 +63098,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -59562,7 +63135,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_schema", @@ -59588,7 +63162,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_name", @@ -59614,7 +63189,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -59640,7 +63216,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -59666,7 +63243,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -59692,7 +63270,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -59718,7 +63297,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "start_value", @@ -59744,7 +63324,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "minimum_value", @@ -59770,7 +63351,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_value", @@ -59796,7 +63378,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "increment", @@ -59822,7 +63405,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cycle_option", @@ -59848,7 +63432,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -59884,7 +63469,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -59910,7 +63496,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -59936,7 +63523,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -59962,7 +63550,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -59988,7 +63577,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -60014,7 +63604,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "feature_id", @@ -60040,7 +63631,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "feature_name", @@ -60066,7 +63658,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sub_feature_id", @@ -60092,7 +63685,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sub_feature_name", @@ -60118,7 +63712,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_supported", @@ -60144,7 +63739,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_verified_by", @@ -60170,7 +63766,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comments", @@ -60196,7 +63793,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -60232,7 +63830,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -60258,7 +63857,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -60284,7 +63884,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -60310,7 +63911,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -60336,7 +63938,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -60362,7 +63965,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "implementation_info_id", @@ -60388,7 +63992,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "implementation_info_name", @@ -60414,7 +64019,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "integer_value", @@ -60440,7 +64046,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_value", @@ -60466,7 +64073,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comments", @@ -60492,7 +64100,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -60528,7 +64137,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -60554,7 +64164,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -60580,7 +64191,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -60606,7 +64218,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -60632,7 +64245,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -60658,7 +64272,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "feature_id", @@ -60684,7 +64299,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "feature_name", @@ -60710,7 +64326,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_supported", @@ -60736,7 +64353,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_verified_by", @@ -60762,7 +64380,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comments", @@ -60788,7 +64407,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -60824,7 +64444,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -60850,7 +64471,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -60876,7 +64498,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -60902,7 +64525,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -60928,7 +64552,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -60954,7 +64579,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sizing_id", @@ -60980,7 +64606,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sizing_name", @@ -61006,7 +64633,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "supported_value", @@ -61032,7 +64660,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comments", @@ -61058,7 +64687,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -61094,7 +64724,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -61120,7 +64751,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -61146,7 +64778,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -61172,7 +64805,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -61198,7 +64832,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -61224,7 +64859,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_type", @@ -61250,7 +64886,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_deferrable", @@ -61276,7 +64913,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "initially_deferred", @@ -61302,7 +64940,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enforced", @@ -61328,7 +64967,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "nulls_distinct", @@ -61354,7 +64994,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -61390,7 +65031,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -61416,7 +65058,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -61442,7 +65085,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -61468,7 +65112,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -61494,7 +65139,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -61520,7 +65166,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -61546,7 +65193,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "with_hierarchy", @@ -61572,7 +65220,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -61608,7 +65257,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -61634,7 +65284,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -61660,7 +65311,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_type", @@ -61686,7 +65338,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "self_referencing_column_name", @@ -61712,7 +65365,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reference_generation", @@ -61738,7 +65392,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_catalog", @@ -61764,7 +65419,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_schema", @@ -61790,7 +65446,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_name", @@ -61816,7 +65473,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_insertable_into", @@ -61842,7 +65500,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_typed", @@ -61868,7 +65527,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "commit_action", @@ -61894,7 +65554,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -61930,7 +65591,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -61956,7 +65618,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -61982,7 +65645,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -62008,7 +65672,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -62034,7 +65699,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -62060,7 +65726,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "group_name", @@ -62086,7 +65753,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "transform_type", @@ -62112,7 +65780,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -62148,7 +65817,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trigger_schema", @@ -62174,7 +65844,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trigger_name", @@ -62200,7 +65871,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_catalog", @@ -62226,7 +65898,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_schema", @@ -62252,7 +65925,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_table", @@ -62278,7 +65952,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_column", @@ -62304,7 +65979,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -62340,7 +66016,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trigger_schema", @@ -62366,7 +66043,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trigger_name", @@ -62392,7 +66070,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_manipulation", @@ -62418,7 +66097,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_catalog", @@ -62444,7 +66124,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_schema", @@ -62470,7 +66151,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_table", @@ -62496,7 +66178,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_order", @@ -62522,7 +66205,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_condition", @@ -62548,7 +66232,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_statement", @@ -62574,7 +66259,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_orientation", @@ -62600,7 +66286,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_timing", @@ -62626,7 +66313,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_reference_old_table", @@ -62652,7 +66340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_reference_new_table", @@ -62678,7 +66367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_reference_old_row", @@ -62704,7 +66394,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_reference_new_row", @@ -62730,7 +66421,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "created", @@ -62756,7 +66448,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -62792,7 +66485,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -62818,7 +66512,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -62844,7 +66539,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -62870,7 +66566,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -62896,7 +66593,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -62922,7 +66620,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -62948,7 +66647,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -62984,7 +66684,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -63010,7 +66711,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_catalog", @@ -63036,7 +66738,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_schema", @@ -63062,7 +66765,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_name", @@ -63088,7 +66792,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_type", @@ -63114,7 +66819,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -63140,7 +66846,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -63166,7 +66873,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -63202,7 +66910,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_schema", @@ -63228,7 +66937,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_name", @@ -63254,7 +66964,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_category", @@ -63280,7 +66991,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_instantiable", @@ -63306,7 +67018,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_final", @@ -63332,7 +67045,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_form", @@ -63358,7 +67072,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_category", @@ -63384,7 +67099,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_routine_catalog", @@ -63410,7 +67126,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_routine_schema", @@ -63436,7 +67153,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_routine_name", @@ -63462,7 +67180,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reference_type", @@ -63488,7 +67207,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -63514,7 +67234,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -63540,7 +67261,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -63566,7 +67288,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -63592,7 +67315,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -63618,7 +67342,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -63644,7 +67369,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -63670,7 +67396,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -63696,7 +67423,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -63722,7 +67450,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -63748,7 +67477,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -63774,7 +67504,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -63800,7 +67531,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -63826,7 +67558,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -63852,7 +67585,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -63878,7 +67612,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "source_dtd_identifier", @@ -63904,7 +67639,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ref_dtd_identifier", @@ -63930,7 +67666,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -63966,7 +67703,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -63992,7 +67730,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -64018,7 +67757,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -64044,7 +67784,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -64070,7 +67811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64106,7 +67848,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -64132,7 +67875,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -64158,7 +67902,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64194,7 +67939,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_schema", @@ -64220,7 +67966,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_name", @@ -64246,7 +67993,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -64272,7 +68020,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -64298,7 +68047,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -64324,7 +68074,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -64350,7 +68101,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64386,7 +68138,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -64412,7 +68165,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -64438,7 +68192,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -64464,7 +68219,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -64490,7 +68246,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -64516,7 +68273,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64552,7 +68310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_schema", @@ -64578,7 +68337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_name", @@ -64604,7 +68364,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -64630,7 +68391,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -64656,7 +68418,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -64682,7 +68445,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64718,7 +68482,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -64744,7 +68509,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -64770,7 +68536,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_definition", @@ -64796,7 +68563,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "check_option", @@ -64822,7 +68590,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_updatable", @@ -64848,7 +68617,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_insertable_into", @@ -64874,7 +68644,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_trigger_updatable", @@ -64900,7 +68671,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_trigger_deletable", @@ -64926,7 +68698,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_trigger_insertable_into", @@ -64952,7 +68725,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64993,7 +68767,8 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -65019,7 +68794,8 @@ "embed_table": null, "original_name": "name", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bio", @@ -65045,7 +68821,8 @@ "embed_table": null, "original_name": "bio", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "params": [ @@ -65075,8 +68852,10 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 - } + "array_dims": 0, + "type_expr": null + }, + "name": "" } ], "comments": [], @@ -65112,7 +68891,8 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -65138,7 +68918,8 @@ "embed_table": null, "original_name": "name", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bio", @@ -65164,7 +68945,8 @@ "embed_table": null, "original_name": "bio", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "params": [], @@ -65201,7 +68983,8 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -65227,7 +69010,8 @@ "embed_table": null, "original_name": "name", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bio", @@ -65253,7 +69037,8 @@ "embed_table": null, "original_name": "bio", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "params": [ @@ -65283,8 +69068,10 @@ "embed_table": null, "original_name": "name", "unsigned": false, - "array_dims": 0 - } + "array_dims": 0, + "type_expr": null + }, + "name": "" }, { "number": 2, @@ -65312,8 +69099,10 @@ "embed_table": null, "original_name": "bio", "unsigned": false, - "array_dims": 0 - } + "array_dims": 0, + "type_expr": null + }, + "name": "" } ], "comments": [], @@ -65356,8 +69145,10 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 - } + "array_dims": 0, + "type_expr": null + }, + "name": "" } ], "comments": [], @@ -65365,6 +69156,7 @@ "insert_into_table": null } ], - "sqlc_version": "v1.22.0", - "plugin_options": "eyJvdXQiOiJnZW4iLCJpbmRlbnQiOiIgICIsImZpbGVuYW1lIjoiY29kZWdlbi5qc29uIn0=" + "sqlc_version": "v1.31.1", + "plugin_options": "eyJvdXQiOiJnZW4iLCJpbmRlbnQiOiIgICIsImZpbGVuYW1lIjoiY29kZWdlbi5qc29uIn0=", + "global_options": "" } diff --git a/internal/endtoend/testdata/codegen_json_type_expr/duckdb/query.sql b/internal/endtoend/testdata/codegen_json_type_expr/duckdb/query.sql new file mode 100644 index 0000000000..292a365a98 --- /dev/null +++ b/internal/endtoend/testdata/codegen_json_type_expr/duckdb/query.sql @@ -0,0 +1,2 @@ +-- name: GetThing :one +SELECT * FROM things WHERE id = $1 AND price > $2; diff --git a/internal/endtoend/testdata/codegen_json_type_expr/duckdb/schema.sql b/internal/endtoend/testdata/codegen_json_type_expr/duckdb/schema.sql new file mode 100644 index 0000000000..61085853d4 --- /dev/null +++ b/internal/endtoend/testdata/codegen_json_type_expr/duckdb/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE things ( + id integer NOT NULL, + title varchar, + price decimal(10, 2) NOT NULL, + tags varchar[], + grid integer[][] NOT NULL, + point struct(x integer, y integer), + attrs map(varchar, integer), + fixed integer[3] +); diff --git a/internal/endtoend/testdata/codegen_json_type_expr/exec.json b/internal/endtoend/testdata/codegen_json_type_expr/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/codegen_json_type_expr/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/codegen_json_type_expr/gen/codegen.json b/internal/endtoend/testdata/codegen_json_type_expr/gen/codegen.json new file mode 100644 index 0000000000..dc0d9af357 --- /dev/null +++ b/internal/endtoend/testdata/codegen_json_type_expr/gen/codegen.json @@ -0,0 +1,810 @@ +{ + "settings": { + "version": "2", + "engine": "duckdb", + "schema": [ + "duckdb/schema.sql" + ], + "queries": [ + "duckdb/query.sql" + ], + "codegen": { + "out": "", + "plugin": "", + "options": "", + "env": [], + "process": null, + "wasm": null + } + }, + "catalog": { + "comment": "", + "default_schema": "public", + "name": "", + "schemas": [ + { + "comment": "", + "name": "public", + "tables": [], + "enums": [], + "composite_types": [] + }, + { + "comment": "", + "name": "public", + "tables": [ + { + "rel": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "columns": [ + { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "integer" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "integer", + "nullable": false, + "args": [] + } + }, + { + "name": "title", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "varchar" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "varchar", + "nullable": true, + "args": [] + } + }, + { + "name": "price", + "not_null": true, + "is_array": false, + "comment": "", + "length": 10, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "decimal" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "decimal", + "nullable": false, + "args": [ + { + "label": "", + "int_value": "10" + }, + { + "label": "", + "int_value": "2" + } + ] + } + }, + { + "name": "tags", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "varchar" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 1, + "type_expr": { + "name": "array", + "nullable": true, + "args": [ + { + "label": "", + "type": { + "name": "varchar", + "nullable": false, + "args": [] + } + } + ] + } + }, + { + "name": "grid", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "integer" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 2, + "type_expr": { + "name": "array", + "nullable": false, + "args": [ + { + "label": "", + "type": { + "name": "array", + "nullable": false, + "args": [ + { + "label": "", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + } + ] + } + } + ] + } + }, + { + "name": "point", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "struct" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "struct", + "nullable": true, + "args": [ + { + "label": "x", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + }, + { + "label": "y", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + } + ] + } + }, + { + "name": "attrs", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "map" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "map", + "nullable": true, + "args": [ + { + "label": "", + "type": { + "name": "varchar", + "nullable": false, + "args": [] + } + }, + { + "label": "", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + } + ] + } + }, + { + "name": "fixed", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "integer" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 1, + "type_expr": { + "name": "array", + "nullable": true, + "args": [ + { + "label": "", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + }, + { + "label": "", + "int_value": "3" + } + ] + } + } + ], + "comment": "" + } + ], + "enums": [], + "composite_types": [] + } + ] + }, + "queries": [ + { + "text": "SELECT id, title, price, tags, grid, point, attrs, fixed FROM things WHERE id = $1 AND price \u003e $2;", + "name": "GetThing", + "cmd": ":one", + "columns": [ + { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "integer" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "integer", + "nullable": false, + "args": [] + } + }, + { + "name": "title", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "varchar" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "title", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "varchar", + "nullable": true, + "args": [] + } + }, + { + "name": "price", + "not_null": true, + "is_array": false, + "comment": "", + "length": 10, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "decimal" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "price", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "decimal", + "nullable": false, + "args": [ + { + "label": "", + "int_value": "10" + }, + { + "label": "", + "int_value": "2" + } + ] + } + }, + { + "name": "tags", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "varchar" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "tags", + "unsigned": false, + "array_dims": 1, + "type_expr": { + "name": "array", + "nullable": true, + "args": [ + { + "label": "", + "type": { + "name": "varchar", + "nullable": false, + "args": [] + } + } + ] + } + }, + { + "name": "grid", + "not_null": true, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "integer" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "grid", + "unsigned": false, + "array_dims": 2, + "type_expr": { + "name": "array", + "nullable": false, + "args": [ + { + "label": "", + "type": { + "name": "array", + "nullable": false, + "args": [ + { + "label": "", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + } + ] + } + } + ] + } + }, + { + "name": "point", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "struct" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "point", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "struct", + "nullable": true, + "args": [ + { + "label": "x", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + }, + { + "label": "y", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + } + ] + } + }, + { + "name": "attrs", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "map" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "attrs", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "map", + "nullable": true, + "args": [ + { + "label": "", + "type": { + "name": "varchar", + "nullable": false, + "args": [] + } + }, + { + "label": "", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + } + ] + } + }, + { + "name": "fixed", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "integer" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "fixed", + "unsigned": false, + "array_dims": 1, + "type_expr": { + "name": "array", + "nullable": true, + "args": [ + { + "label": "", + "type": { + "name": "integer", + "nullable": false, + "args": [] + } + }, + { + "label": "", + "int_value": "3" + } + ] + } + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "id", + "not_null": true, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "integer" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "id", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "integer", + "nullable": false, + "args": [] + } + }, + "name": "" + }, + { + "number": 2, + "column": { + "name": "price", + "not_null": true, + "is_array": false, + "comment": "", + "length": 10, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "", + "schema": "public", + "name": "things" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "decimal" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "price", + "unsigned": false, + "array_dims": 0, + "type_expr": { + "name": "decimal", + "nullable": false, + "args": [ + { + "label": "", + "int_value": "10" + }, + { + "label": "", + "int_value": "2" + } + ] + } + }, + "name": "" + } + ], + "comments": [], + "filename": "query.sql", + "insert_into_table": null + } + ], + "sqlc_version": "v1.31.1", + "plugin_options": "eyJvdXQiOiJnZW4iLCJpbmRlbnQiOiIgICIsImZpbGVuYW1lIjoiY29kZWdlbi5qc29uIn0=", + "global_options": "" +} diff --git a/internal/endtoend/testdata/codegen_json_type_expr/sqlc.json b/internal/endtoend/testdata/codegen_json_type_expr/sqlc.json new file mode 100644 index 0000000000..054b51561e --- /dev/null +++ b/internal/endtoend/testdata/codegen_json_type_expr/sqlc.json @@ -0,0 +1,17 @@ +{ + "version": "2", + "sql": [ + { + "schema": "duckdb/schema.sql", + "queries": "duckdb/query.sql", + "engine": "duckdb", + "gen": { + "json": { + "out": "gen", + "indent": " ", + "filename": "codegen.json" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go index 084c445978..1a770e5c67 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go index e9e1b43553..5675e7c029 100644 --- a/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/codegen_struct_field_names/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/column_alias/issue.md b/internal/endtoend/testdata/column_alias/issue.md new file mode 100644 index 0000000000..fc16c2a58a --- /dev/null +++ b/internal/endtoend/testdata/column_alias/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1739 diff --git a/internal/endtoend/testdata/column_alias/stdlib/exec.json b/internal/endtoend/testdata/column_alias/stdlib/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/column_alias/stdlib/go/db.go b/internal/endtoend/testdata/column_alias/stdlib/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/column_alias/stdlib/go/models.go b/internal/endtoend/testdata/column_alias/stdlib/go/models.go new file mode 100644 index 0000000000..bdd8c70615 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "time" +) + +type User struct { + ID int32 + Fname string + Lname string + Email string + EncPasswd string + CreatedAt time.Time +} diff --git a/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go b/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go new file mode 100644 index 0000000000..a4b43d3052 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/go/query.sql.go @@ -0,0 +1,80 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const getUsers = `-- name: GetUsers :many +SELECT + users.id, + users.fname, + users.lname, + users.email, + users.created_at, + rank_email, + rank_fname, + rank_lname, + similarity +FROM + users, + to_tsvector(users.email || users.fname || users.lname) document, + to_tsquery($1::TEXT) query, + NULLIF(ts_rank(to_tsvector(users.email), query), 0) rank_email, + NULLIF(ts_rank(to_tsvector(users.fname), query), 0) rank_fname, + NULLIF(ts_rank(to_tsvector(users.lname), query), 0) rank_lname, + SIMILARITY($1::TEXT, users.email || users.fname || users.lname) similarity +WHERE query @@ document OR similarity > 0 +ORDER BY rank_email, rank_lname, rank_fname, similarity DESC NULLS LAST +` + +type GetUsersRow struct { + ID int32 + Fname string + Lname string + Email string + CreatedAt time.Time + RankEmail sql.NullFloat64 + RankFname sql.NullFloat64 + RankLname sql.NullFloat64 + Similarity sql.NullFloat64 +} + +func (q *Queries) GetUsers(ctx context.Context, searchTerm string) ([]GetUsersRow, error) { + rows, err := q.db.QueryContext(ctx, getUsers, searchTerm) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetUsersRow + for rows.Next() { + var i GetUsersRow + if err := rows.Scan( + &i.ID, + &i.Fname, + &i.Lname, + &i.Email, + &i.CreatedAt, + &i.RankEmail, + &i.RankFname, + &i.RankLname, + &i.Similarity, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/column_alias/stdlib/query.sql b/internal/endtoend/testdata/column_alias/stdlib/query.sql new file mode 100644 index 0000000000..9877fadde6 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/query.sql @@ -0,0 +1,21 @@ +-- name: GetUsers :many +SELECT + users.id, + users.fname, + users.lname, + users.email, + users.created_at, + rank_email, + rank_fname, + rank_lname, + similarity +FROM + users, + to_tsvector(users.email || users.fname || users.lname) document, + to_tsquery(@search_term::TEXT) query, + NULLIF(ts_rank(to_tsvector(users.email), query), 0) rank_email, + NULLIF(ts_rank(to_tsvector(users.fname), query), 0) rank_fname, + NULLIF(ts_rank(to_tsvector(users.lname), query), 0) rank_lname, + SIMILARITY(@search_term::TEXT, users.email || users.fname || users.lname) similarity +WHERE query @@ document OR similarity > 0 +ORDER BY rank_email, rank_lname, rank_fname, similarity DESC NULLS LAST; diff --git a/internal/endtoend/testdata/column_alias/stdlib/schema.sql b/internal/endtoend/testdata/column_alias/stdlib/schema.sql new file mode 100644 index 0000000000..9205a149e3 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/schema.sql @@ -0,0 +1,12 @@ +CREATE EXTENSION pg_trgm; +CREATE EXTENSION pgcrypto; + +CREATE TABLE users( + id INT GENERATED ALWAYS AS IDENTITY NOT NULL, + fname VARCHAR(100) NOT NULL, + lname VARCHAR(100) NOT NULL, + email VARCHAR(100) NOT NULL UNIQUE, + enc_passwd TEXT NOT NULL, + created_at TIMESTAMP WITH TIME ZONE NOT NULL default (NOW() AT TIME ZONE 'utc'), + PRIMARY KEY(id) +); diff --git a/internal/endtoend/testdata/column_alias/stdlib/sqlc.yaml b/internal/endtoend/testdata/column_alias/stdlib/sqlc.yaml new file mode 100644 index 0000000000..8c68222b49 --- /dev/null +++ b/internal/endtoend/testdata/column_alias/stdlib/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/column_as/mysql/go/db.go b/internal/endtoend/testdata/column_as/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/db.go +++ b/internal/endtoend/testdata/column_as/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/column_as/mysql/go/models.go b/internal/endtoend/testdata/column_as/mysql/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/models.go +++ b/internal/endtoend/testdata/column_as/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go index 3e772a1009..a4636a1c0c 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go index 45fe1488f3..ddaee5d60b 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go index 45fe1488f3..ddaee5d60b 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go index 3e772a1009..a4636a1c0c 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/column_as/sqlite/go/db.go b/internal/endtoend/testdata/column_as/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/db.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/column_as/sqlite/go/models.go b/internal/endtoend/testdata/column_as/sqlite/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/models.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go index 0196e2ce12..66d96ac3d9 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -26,7 +26,7 @@ func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { } const withoutAs = `-- name: WithoutAs :one -SELECT 1 x, 2 y +SELECT 1 AS x, 2 AS y ` type WithoutAsRow struct { diff --git a/internal/endtoend/testdata/column_as/sqlite/query.sql b/internal/endtoend/testdata/column_as/sqlite/query.sql index c7282d88ef..e783582d56 100644 --- a/internal/endtoend/testdata/column_as/sqlite/query.sql +++ b/internal/endtoend/testdata/column_as/sqlite/query.sql @@ -2,4 +2,4 @@ SELECT 1 AS x, 2 AS y; -- name: WithoutAs :one -SELECT 1 x, 2 y; +SELECT 1 AS x, 2 AS y; diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go index eed1aa29f9..8d1169a59a 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go index a6fa331406..d867cae11b 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go index 5fbb03309d..22975b4f51 100644 --- a/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go index baa9266939..abdbd0d68f 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go index 2c5cb462d2..7512f5a29a 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go index 378f123111..0a95f1959d 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go index a6fa331406..d867cae11b 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go index 8b45ac579b..d8d62964a4 100644 --- a/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go index a81b3a81cf..fcc9510179 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -18,7 +18,7 @@ const ( FooMoodHappy FooMood = "happy" ) -func (e *FooMood) Scan(src interface{}) error { +func (e *FooMood) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooMood(s) @@ -36,7 +36,7 @@ type NullFooMood struct { } // Scan implements the Scanner interface. -func (ns *NullFooMood) Scan(value interface{}) error { +func (ns *NullFooMood) Scan(value any) error { if value == nil { ns.FooMood, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go index b3b98a8213..0ab2b7970f 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go index a81b3a81cf..fcc9510179 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -18,7 +18,7 @@ const ( FooMoodHappy FooMood = "happy" ) -func (e *FooMood) Scan(src interface{}) error { +func (e *FooMood) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooMood(s) @@ -36,7 +36,7 @@ type NullFooMood struct { } // Scan implements the Scanner interface. -func (ns *NullFooMood) Scan(value interface{}) error { +func (ns *NullFooMood) Scan(value any) error { if value == nil { ns.FooMood, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go index b3b98a8213..0ab2b7970f 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go index a81b3a81cf..fcc9510179 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -18,7 +18,7 @@ const ( FooMoodHappy FooMood = "happy" ) -func (e *FooMood) Scan(src interface{}) error { +func (e *FooMood) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooMood(s) @@ -36,7 +36,7 @@ type NullFooMood struct { } // Scan implements the Scanner interface. -func (ns *NullFooMood) Scan(value interface{}) error { +func (ns *NullFooMood) Scan(value any) error { if value == nil { ns.FooMood, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go index 6939374ce9..c18f189785 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/db.go b/internal/endtoend/testdata/comment_syntax/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/models.go b/internal/endtoend/testdata/comment_syntax/mysql/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go index 7f4b916150..930559137e 100644 --- a/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -22,7 +22,6 @@ func (q *Queries) DoubleDash(ctx context.Context) (sql.NullString, error) { } const hash = `-- name: Hash :one -# name: Hash :one SELECT bar FROM foo LIMIT 1 ` diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go index 316e13ab14..25a38d570f 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go index a6fa331406..d867cae11b 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go index 2ba49c21a7..6b80af138e 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go index 843a34aeec..ddb7c2a409 100644 --- a/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go index 353c2b0d63..b5395d46ed 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go b/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go index 843a34aeec..ddb7c2a409 100644 --- a/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/comment_syntax/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/mysql/go/db.go b/internal/endtoend/testdata/comparisons/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/db.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comparisons/mysql/go/models.go b/internal/endtoend/testdata/comparisons/mysql/go/models.go index 40001531be..9ac222a278 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/models.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID uint64 } diff --git a/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go b/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go index 2eb41d45cc..50d2309472 100644 --- a/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go index e10054c74b..661d3db543 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go index e10054c74b..661d3db543 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go index c521a3bf65..93f785a8cb 100644 --- a/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/db.go b/internal/endtoend/testdata/comparisons/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/go/db.go +++ b/internal/endtoend/testdata/comparisons/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/models.go b/internal/endtoend/testdata/comparisons/sqlite/go/models.go index 214487814e..bc354e040a 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/go/models.go +++ b/internal/endtoend/testdata/comparisons/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go b/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go index c521a3bf65..93f785a8cb 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/comparisons/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/comparisons/sqlite/query.sql b/internal/endtoend/testdata/comparisons/sqlite/query.sql index 8763edaa62..41ea9ab1a7 100644 --- a/internal/endtoend/testdata/comparisons/sqlite/query.sql +++ b/internal/endtoend/testdata/comparisons/sqlite/query.sql @@ -18,9 +18,3 @@ SELECT count(*) <> 0 FROM bar; -- name: Equal :many SELECT count(*) = 0 FROM bar; - - - - - - diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go index a48b06e650..6e0affbca6 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go index 1d72161575..fca6954bff 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go index a48b06e650..6e0affbca6 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go index 1d72161575..fca6954bff 100644 --- a/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/db.go b/internal/endtoend/testdata/composite_type/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/go/db.go +++ b/internal/endtoend/testdata/composite_type/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/models.go b/internal/endtoend/testdata/composite_type/stdlib/go/models.go index a48b06e650..6e0affbca6 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/go/models.go +++ b/internal/endtoend/testdata/composite_type/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go b/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go index c7480ac53d..ae8a6b840b 100644 --- a/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/composite_type/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go index 4ad5e263e1..f86649ae47 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go index 47f689c354..1861778316 100644 --- a/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/conflicted_arg_name/postgresql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go index eb7e68e2d6..b5ce436565 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom.go package querytest diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/db.go b/internal/endtoend/testdata/copyfrom/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/db.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/models.go b/internal/endtoend/testdata/copyfrom/mysql/go/models.go index f7e87d8292..168ecce6b0 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/models.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go index 9b22bfba47..91bd6628f8 100644 --- a/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go index 137f0823ec..863180d4ff 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom.go package querytest @@ -28,8 +28,8 @@ func (r *iteratorForInsertSingleValue) Next() bool { return len(r.rows) > 0 } -func (r iteratorForInsertSingleValue) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForInsertSingleValue) Values() ([]any, error) { + return []any{ r.rows[0], }, nil } @@ -61,8 +61,8 @@ func (r *iteratorForInsertValues) Next() bool { return len(r.rows) > 0 } -func (r iteratorForInsertValues) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForInsertValues) Values() ([]any, error) { + return []any{ r.rows[0].A, r.rows[0].B, }, nil diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go index e3dd1539f0..f9e0a2c0ac 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) } diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go index ee9c9d3d4e..fa0d29714c 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go index f20d745bbe..7a8768bec0 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go index e481424c5e..73bde9d8a9 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go index 54d4aa9193..8e04f476eb 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom.go package querytest @@ -29,8 +29,8 @@ func (r *iteratorForInsertSingleValue) Next() bool { return len(r.rows) > 0 } -func (r iteratorForInsertSingleValue) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForInsertSingleValue) Values() ([]any, error) { + return []any{ r.rows[0], }, nil } @@ -62,8 +62,8 @@ func (r *iteratorForInsertValues) Next() bool { return len(r.rows) > 0 } -func (r iteratorForInsertValues) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForInsertValues) Values() ([]any, error) { + return []any{ r.rows[0].A, r.rows[0].B, }, nil diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go index ed7b7f5f9a..d17ab27cdc 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) } diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go index 219b82bdc2..80e1ef5a44 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go index 5b24dd55e1..6e081e70a1 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go index 0d46a845df..5f9743f647 100644 --- a/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go index 279a25d83a..1d56607c71 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom.go package querytest @@ -27,8 +27,8 @@ func (r *iteratorForInsertValues) Next() bool { return len(r.rows) > 0 } -func (r iteratorForInsertValues) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForInsertValues) Values() ([]any, error) { + return []any{ r.rows[0].A, r.rows[0].B, }, nil diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go index e3dd1539f0..f9e0a2c0ac 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) } diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go index ee9c9d3d4e..fa0d29714c 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go index 226971a5a5..582785f08f 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go index 279a25d83a..1d56607c71 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom.go package querytest @@ -27,8 +27,8 @@ func (r *iteratorForInsertValues) Next() bool { return len(r.rows) > 0 } -func (r iteratorForInsertValues) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForInsertValues) Values() ([]any, error) { + return []any{ r.rows[0].A, r.rows[0].B, }, nil diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go index ed7b7f5f9a..d17ab27cdc 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) } diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go index 219b82bdc2..80e1ef5a44 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go index 722967a951..5be522e851 100644 --- a/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_imports/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/copyfrom.go new file mode 100644 index 0000000000..662d6e1945 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/copyfrom.go @@ -0,0 +1,51 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: copyfrom.go + +package querytest + +import ( + "context" + "fmt" + "io" + "sync/atomic" + + "github.com/go-sql-driver/mysql" + "github.com/hexon/mysqltsv" +) + +var readerHandlerSequenceForInsertMultipleValues uint32 = 1 + +func convertRowsForInsertMultipleValues(w *io.PipeWriter, arg []InsertMultipleValuesParams) { + e := mysqltsv.NewEncoder(w, 2, nil) + for _, row := range arg { + e.AppendValue(row.A) + e.AppendValue(row.B) + } + w.CloseWithError(e.Close()) +} + +// InsertMultipleValues uses MySQL's LOAD DATA LOCAL INFILE and is not atomic. +// +// Errors and duplicate keys are treated as warnings and insertion will +// continue, even without an error for some cases. Use this in a transaction +// and use SHOW WARNINGS to check for any problems and roll back if you want to. +// +// Check the documentation for more information: +// https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling +func (q *Queries) InsertMultipleValues(ctx context.Context, arg []InsertMultipleValuesParams) (int64, error) { + pr, pw := io.Pipe() + defer pr.Close() + rh := fmt.Sprintf("InsertMultipleValues_%d", atomic.AddUint32(&readerHandlerSequenceForInsertMultipleValues, 1)) + mysql.RegisterReaderHandler(rh, func() io.Reader { return pr }) + defer mysql.DeregisterReaderHandler(rh) + go convertRowsForInsertMultipleValues(pw, arg) + // The string interpolation is necessary because LOAD DATA INFILE requires + // the file name to be given as a literal string. + result, err := q.db.ExecContext(ctx, fmt.Sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE `foo` %s (a, b)", "Reader::"+rh, mysqltsv.Escaping)) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/db.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/models.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/models.go new file mode 100644 index 0000000000..a26317d3fb --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go new file mode 100644 index 0000000000..83233f4f4a --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "database/sql" +) + +const insertMultipleValues = `-- name: InsertMultipleValues :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullString +} diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/query.sql b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/query.sql new file mode 100644 index 0000000000..18a13f88e6 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: InsertMultipleValues :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/schema.sql b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/schema.sql new file mode 100644 index 0000000000..dd2f6b6b50 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a text, b text); diff --git a/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/sqlc.json b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/sqlc.json new file mode 100644 index 0000000000..0990bc2fef --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_multicolumn_parameter_limit/mysql/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": 4 + } + ] +} diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/copyfrom.go index ea07c73d5d..531032b14d 100644 --- a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom.go package querytest @@ -27,8 +27,8 @@ func (r *iteratorForStageUserData) Next() bool { return len(r.rows) > 0 } -func (r iteratorForStageUserData) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForStageUserData) Values() ([]any, error) { + return []any{ r.rows[0].IDParam, r.rows[0].UserParam, }, nil diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/db.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/db.go index ed7b7f5f9a..d17ab27cdc 100644 --- a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) } diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go index 3d4986be79..80f27cb06d 100644 --- a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type UserDatum struct { ID string User string diff --git a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/query.sql.go index 1098b60c5d..bd4515df72 100644 --- a/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_named_params/postgresql/pgx/go/query.sql.go @@ -1,12 +1,10 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest -import () - type StageUserDataParams struct { IDParam string UserParam string diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go index 91864086a3..e675323f98 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom.go package querytest @@ -27,8 +27,8 @@ func (r *iteratorForCreateAuthors) Next() bool { return len(r.rows) > 0 } -func (r iteratorForCreateAuthors) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForCreateAuthors) Values() ([]any, error) { + return []any{ r.rows[0], }, nil } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go index e3dd1539f0..f9e0a2c0ac 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go index dd5cd552d2..d2e63dffc5 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Author struct { AuthorID int32 } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go index 7f195bbee9..59b1100fce 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go index ddc6c6534c..aa95052ac1 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v4/go/query.sql.go @@ -1,8 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest - -import () diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go index 91864086a3..e675323f98 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/copyfrom.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom.go package querytest @@ -27,8 +27,8 @@ func (r *iteratorForCreateAuthors) Next() bool { return len(r.rows) > 0 } -func (r iteratorForCreateAuthors) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForCreateAuthors) Values() ([]any, error) { + return []any{ r.rows[0], }, nil } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go index ed7b7f5f9a..d17ab27cdc 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go index dd5cd552d2..d2e63dffc5 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Author struct { AuthorID int32 } diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go index 7f195bbee9..59b1100fce 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go index ddc6c6534c..aa95052ac1 100644 --- a/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/copyfrom_singlecolumn/postgresql/pgx/v5/go/query.sql.go @@ -1,8 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest - -import () diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/issue.md b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/issue.md new file mode 100644 index 0000000000..4838ed77c2 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/3443 \ No newline at end of file diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/copyfrom.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/copyfrom.go new file mode 100644 index 0000000000..59dab9b109 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/copyfrom.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: copyfrom.go + +package querytest + +import ( + "context" + "fmt" + "io" + "sync/atomic" + + "github.com/go-sql-driver/mysql" + "github.com/hexon/mysqltsv" +) + +var readerHandlerSequenceForInsertSingleValue uint32 = 1 + +func convertRowsForInsertSingleValue(w *io.PipeWriter, arg []InsertSingleValueParams) { + e := mysqltsv.NewEncoder(w, 1, nil) + for _, row := range arg { + e.AppendValue(row.A) + } + w.CloseWithError(e.Close()) +} + +// InsertSingleValue uses MySQL's LOAD DATA LOCAL INFILE and is not atomic. +// +// Errors and duplicate keys are treated as warnings and insertion will +// continue, even without an error for some cases. Use this in a transaction +// and use SHOW WARNINGS to check for any problems and roll back if you want to. +// +// Check the documentation for more information: +// https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling +func (q *Queries) InsertSingleValue(ctx context.Context, arg []InsertSingleValueParams) (int64, error) { + pr, pw := io.Pipe() + defer pr.Close() + rh := fmt.Sprintf("InsertSingleValue_%d", atomic.AddUint32(&readerHandlerSequenceForInsertSingleValue, 1)) + mysql.RegisterReaderHandler(rh, func() io.Reader { return pr }) + defer mysql.DeregisterReaderHandler(rh) + go convertRowsForInsertSingleValue(pw, arg) + // The string interpolation is necessary because LOAD DATA INFILE requires + // the file name to be given as a literal string. + result, err := q.db.ExecContext(ctx, fmt.Sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE `foo` %s (a)", "Reader::"+rh, mysqltsv.Escaping)) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/db.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/models.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/models.go new file mode 100644 index 0000000000..f05c6b5688 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString +} diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go new file mode 100644 index 0000000000..68c76e940d --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/go/query.sql.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "database/sql" +) + +const insertSingleValue = `-- name: InsertSingleValue :copyfrom +INSERT INTO foo (a) VALUES (?) +` + +type InsertSingleValueParams struct { + A sql.NullString +} diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/query.sql b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/query.sql new file mode 100644 index 0000000000..091c90316b --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: InsertSingleValue :copyfrom +INSERT INTO foo (a) VALUES (?); diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/schema.sql b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/schema.sql new file mode 100644 index 0000000000..022bbd6f91 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a text); diff --git a/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/sqlc.json b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/sqlc.json new file mode 100644 index 0000000000..4a4d43c146 --- /dev/null +++ b/internal/endtoend/testdata/copyfrom_singlecolumn_struct_only/mysql/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": 0 + } + ] +} diff --git a/internal/endtoend/testdata/core_types/clickhouse/exec.json b/internal/endtoend/testdata/core_types/clickhouse/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/core_types/clickhouse/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/core_types/clickhouse/go/db.go b/internal/endtoend/testdata/core_types/clickhouse/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/core_types/clickhouse/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/core_types/clickhouse/go/models.go b/internal/endtoend/testdata/core_types/clickhouse/go/models.go new file mode 100644 index 0000000000..1f1a5fb47a --- /dev/null +++ b/internal/endtoend/testdata/core_types/clickhouse/go/models.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" + "net" + "time" + + "github.com/google/uuid" + "github.com/shopspring/decimal" +) + +type Thing struct { + ID uint64 + Name string + Tag sql.NullString + Amount float64 + Tags []string + Labels []*string + Matrix [][]uint8 + Kind *string + Created time.Time + Updated time.Time + Price decimal.Decimal + Status string + Attrs map[string]uint32 + Pos []any + Geo map[string]any + Scores map[string]*uint8 + Ip net.IP + Uid uuid.UUID + Fixed string + Flag bool + Small decimal.Decimal + Plain string + Either any + NA []uint8 + NB []string + Total uint64 + Whole int32 +} diff --git a/internal/endtoend/testdata/core_types/clickhouse/go/query.sql.go b/internal/endtoend/testdata/core_types/clickhouse/go/query.sql.go new file mode 100644 index 0000000000..de351869a7 --- /dev/null +++ b/internal/endtoend/testdata/core_types/clickhouse/go/query.sql.go @@ -0,0 +1,200 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" + + "github.com/shopspring/decimal" +) + +const allTypes = `-- name: AllTypes :many +SELECT id, name, tag, amount, tags, labels, matrix, kind, created, updated, price, status, attrs, pos, geo, scores, ip, uid, fixed, flag, small, plain, either, n.a, n.b, total, whole FROM things; +` + +func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { + rows, err := q.db.QueryContext(ctx, allTypes) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Thing + for rows.Next() { + var i Thing + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Tag, + &i.Amount, + &i.Tags, + &i.Labels, + &i.Matrix, + &i.Kind, + &i.Created, + &i.Updated, + &i.Price, + &i.Status, + &i.Attrs, + &i.Pos, + &i.Geo, + &i.Scores, + &i.Ip, + &i.Uid, + &i.Fixed, + &i.Flag, + &i.Small, + &i.Plain, + &i.Either, + &i.NA, + &i.NB, + &i.Total, + &i.Whole, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const casts = `-- name: Casts :one +SELECT + CAST(id AS String) AS a, + toDecimal64(id, 4) AS b, + CAST(name AS Nullable(String)) AS c, + toDateTime64(created, 3) AS d, + CAST(tags AS Array(String)) AS e, + CAST(tag AS Nullable(String)) AS f +FROM things; +` + +type CastsRow struct { + A string + B decimal.Decimal + C sql.NullString + D time.Time + E []string + F sql.NullString +} + +func (q *Queries) Casts(ctx context.Context) (CastsRow, error) { + row := q.db.QueryRowContext(ctx, casts) + var i CastsRow + err := row.Scan( + &i.A, + &i.B, + &i.C, + &i.D, + &i.E, + &i.F, + ) + return i, err +} + +const placeholders = `-- name: Placeholders :many +SELECT id FROM things +WHERE id = {p1:UInt64} AND name = {p2:String} AND amount > {p3:Float64} AND tag = {p4:Nullable(String)} AND price = {p5:Decimal(10, 2)}; +` + +type PlaceholdersParams struct { + P1 uint64 + P2 string + P3 float64 + P4 *string + P5 string +} + +func (q *Queries) Placeholders(ctx context.Context, arg PlaceholdersParams) ([]uint64, error) { + rows, err := q.db.QueryContext(ctx, placeholders, + sql.Named("p1", arg.P1), + sql.Named("p2", arg.P2), + sql.Named("p3", arg.P3), + sql.Named("p4", arg.P4), + sql.Named("p5", arg.P5), + ) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uint64 + for rows.Next() { + var id uint64 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starColumns = `-- name: StarColumns :many +SELECT id, name, tag, amount, tags, labels, matrix, kind, created, updated, price, status, attrs, pos, geo, scores, ip, uid, fixed, flag, small, plain, either, n.a, n.b, total, whole FROM things; +` + +func (q *Queries) StarColumns(ctx context.Context) ([]Thing, error) { + rows, err := q.db.QueryContext(ctx, starColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Thing + for rows.Next() { + var i Thing + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Tag, + &i.Amount, + &i.Tags, + &i.Labels, + &i.Matrix, + &i.Kind, + &i.Created, + &i.Updated, + &i.Price, + &i.Status, + &i.Attrs, + &i.Pos, + &i.Geo, + &i.Scores, + &i.Ip, + &i.Uid, + &i.Fixed, + &i.Flag, + &i.Small, + &i.Plain, + &i.Either, + &i.NA, + &i.NB, + &i.Total, + &i.Whole, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/core_types/clickhouse/query.sql b/internal/endtoend/testdata/core_types/clickhouse/query.sql new file mode 100644 index 0000000000..8a4ff3e8be --- /dev/null +++ b/internal/endtoend/testdata/core_types/clickhouse/query.sql @@ -0,0 +1,19 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: StarColumns :many +SELECT id, name, tag, amount, tags, labels, matrix, kind, created, updated, price, status, attrs, pos, geo, scores, ip, uid, fixed, flag, small, plain, either, n.a, n.b, total, whole FROM things; + +-- name: Casts :one +SELECT + CAST(id AS String) AS a, + toDecimal64(id, 4) AS b, + CAST(name AS Nullable(String)) AS c, + toDateTime64(created, 3) AS d, + CAST(tags AS Array(String)) AS e, + CAST(tag AS Nullable(String)) AS f +FROM things; + +-- name: Placeholders :many +SELECT id FROM things +WHERE id = {p1:UInt64} AND name = {p2:String} AND amount > {p3:Float64} AND tag = {p4:Nullable(String)} AND price = {p5:Decimal(10, 2)}; diff --git a/internal/endtoend/testdata/core_types/clickhouse/schema.sql b/internal/endtoend/testdata/core_types/clickhouse/schema.sql new file mode 100644 index 0000000000..1dddddd5c9 --- /dev/null +++ b/internal/endtoend/testdata/core_types/clickhouse/schema.sql @@ -0,0 +1,28 @@ +CREATE TABLE things ( + id UInt64, + name String, + tag Nullable(String), + amount Float64, + tags Array(String), + labels Array(Nullable(String)), + matrix Array(Array(UInt8)), + kind LowCardinality(Nullable(String)), + created DateTime, + updated DateTime64(3, 'UTC'), + price Decimal(10, 2), + status Enum8('active' = 1, 'deleted' = 2), + attrs Map(String, UInt32), + pos Tuple(Float64, Float64), + geo Tuple(lat Float64, lon Float64), + scores Map(String, Nullable(UInt8)), + ip IPv4, + uid UUID, + fixed FixedString(4), + flag Bool, + small Decimal32(4), + plain Enum('x', 'y'), + either Variant(String, Int64), + n Nested(a UInt8, b String), + total SimpleAggregateFunction(sum, UInt64), + whole INT +) ENGINE = MergeTree ORDER BY id; diff --git a/internal/endtoend/testdata/core_types/clickhouse/sqlc.yaml b/internal/endtoend/testdata/core_types/clickhouse/sqlc.yaml new file mode 100644 index 0000000000..66e907a2c6 --- /dev/null +++ b/internal/endtoend/testdata/core_types/clickhouse/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "clickhouse" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/core_types/duckdb/exec.json b/internal/endtoend/testdata/core_types/duckdb/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/core_types/duckdb/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/core_types/duckdb/go/db.go b/internal/endtoend/testdata/core_types/duckdb/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/core_types/duckdb/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/core_types/duckdb/go/models.go b/internal/endtoend/testdata/core_types/duckdb/go/models.go new file mode 100644 index 0000000000..4998652c79 --- /dev/null +++ b/internal/endtoend/testdata/core_types/duckdb/go/models.go @@ -0,0 +1,43 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" + "math/big" + + "github.com/duckdb/duckdb-go/v2" + "github.com/google/uuid" +) + +type Thing struct { + ID int32 + Ints duckdb.Composite[[]int32] + Fixed duckdb.Composite[[]int32] + Point *map[string]any + Attrs *duckdb.Map + Either any + Price *duckdb.Decimal + Title sql.NullString + Kind any + M any + Mm any + Big *big.Int + Ubig *big.Int + Data []byte + Bits *duckdb.Bit + Uid uuid.NullUUID + Tstz sql.NullTime + Tsns sql.NullTime + Iv *duckdb.Interval + Doc any + Grid duckdb.Composite[[][]int32] + Vi *big.Int + F4 sql.NullFloat64 + Points duckdb.Composite[[]map[string]any] + Lists *duckdb.Map + Body sql.NullString + N *duckdb.Decimal +} diff --git a/internal/endtoend/testdata/core_types/duckdb/go/query.sql.go b/internal/endtoend/testdata/core_types/duckdb/go/query.sql.go new file mode 100644 index 0000000000..1fdc2d244a --- /dev/null +++ b/internal/endtoend/testdata/core_types/duckdb/go/query.sql.go @@ -0,0 +1,156 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "github.com/duckdb/duckdb-go/v2" +) + +const allTypes = `-- name: AllTypes :many +SELECT id, ints, fixed, point, attrs, either, price, title, kind, m, mm, big, ubig, data, bits, uid, tstz, tsns, iv, doc, grid, vi, f4, points, lists, body, n FROM things; +` + +func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { + rows, err := q.db.QueryContext(ctx, allTypes) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Thing + for rows.Next() { + var i Thing + if err := rows.Scan( + &i.ID, + &i.Ints, + &i.Fixed, + &i.Point, + &i.Attrs, + &i.Either, + &i.Price, + &i.Title, + &i.Kind, + &i.M, + &i.Mm, + &i.Big, + &i.Ubig, + &i.Data, + &i.Bits, + &i.Uid, + &i.Tstz, + &i.Tsns, + &i.Iv, + &i.Doc, + &i.Grid, + &i.Vi, + &i.F4, + &i.Points, + &i.Lists, + &i.Body, + &i.N, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const casts = `-- name: Casts :one +SELECT + $1::DECIMAL(5,2) AS a, + $2::INTEGER[] AS b, + $3::STRUCT(a INTEGER) AS c, + $4::mood AS d, + CAST($5 AS VARCHAR(5)) AS e, + $6::MAP(VARCHAR, INTEGER) AS f, + $7::INTEGER[3] AS g, + $8::main.mood AS h +FROM things; +` + +type CastsParams struct { + Column1 string + Column2 []int32 + Column3 map[string]any + Column4 any + Column5 string + Column6 duckdb.Map + Column7 []int32 + Column8 any +} + +type CastsRow struct { + A duckdb.Decimal + B duckdb.Composite[[]int32] + C map[string]any + D any + E string + F duckdb.Map + G duckdb.Composite[[]int32] + H any +} + +func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) { + row := q.db.QueryRowContext(ctx, casts, + arg.Column1, + arg.Column2, + arg.Column3, + arg.Column4, + arg.Column5, + arg.Column6, + arg.Column7, + arg.Column8, + ) + var i CastsRow + err := row.Scan( + &i.A, + &i.B, + &i.C, + &i.D, + &i.E, + &i.F, + &i.G, + &i.H, + ) + return i, err +} + +const params = `-- name: Params :one +SELECT id FROM things +WHERE ints = $1 AND point = $2 AND price = $3 AND m = $4 AND either = $5 AND grid = $6; +` + +type ParamsParams struct { + Ints []int32 + Point any + Price sql.NullString + M any + Either any + Grid [][]int32 +} + +func (q *Queries) Params(ctx context.Context, arg ParamsParams) (int32, error) { + row := q.db.QueryRowContext(ctx, params, + arg.Ints, + arg.Point, + arg.Price, + arg.M, + arg.Either, + arg.Grid, + ) + var id int32 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/core_types/duckdb/query.sql b/internal/endtoend/testdata/core_types/duckdb/query.sql new file mode 100644 index 0000000000..3e232d263f --- /dev/null +++ b/internal/endtoend/testdata/core_types/duckdb/query.sql @@ -0,0 +1,18 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + $1::DECIMAL(5,2) AS a, + $2::INTEGER[] AS b, + $3::STRUCT(a INTEGER) AS c, + $4::mood AS d, + CAST($5 AS VARCHAR(5)) AS e, + $6::MAP(VARCHAR, INTEGER) AS f, + $7::INTEGER[3] AS g, + $8::main.mood AS h +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE ints = $1 AND point = $2 AND price = $3 AND m = $4 AND either = $5 AND grid = $6; diff --git a/internal/endtoend/testdata/core_types/duckdb/schema.sql b/internal/endtoend/testdata/core_types/duckdb/schema.sql new file mode 100644 index 0000000000..0a8a1b4147 --- /dev/null +++ b/internal/endtoend/testdata/core_types/duckdb/schema.sql @@ -0,0 +1,31 @@ +CREATE TYPE mood AS ENUM ('sad', 'ok'); + +CREATE TABLE things ( + id INTEGER PRIMARY KEY, + ints INTEGER[], + fixed INTEGER[3], + point STRUCT(a INTEGER, b VARCHAR), + attrs MAP(VARCHAR, INTEGER), + either UNION(num INTEGER, str VARCHAR), + price DECIMAL(18,3), + title VARCHAR(10), + kind ENUM('a','b'), + m mood, + mm main.mood, + big HUGEINT, + ubig UHUGEINT, + data BLOB, + bits BIT, + uid UUID, + tstz TIMESTAMP WITH TIME ZONE, + tsns TIMESTAMP_NS, + iv INTERVAL, + doc JSON, + grid INTEGER[][], + vi VARINT, + f4 FLOAT4, + points STRUCT(a INTEGER)[], + lists MAP(VARCHAR, INTEGER[]), + body TEXT, + n NUMERIC +); diff --git a/internal/endtoend/testdata/core_types/duckdb/sqlc.yaml b/internal/endtoend/testdata/core_types/duckdb/sqlc.yaml new file mode 100644 index 0000000000..07d6d9d3b8 --- /dev/null +++ b/internal/endtoend/testdata/core_types/duckdb/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "duckdb" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/core_types/googlesql/exec.json b/internal/endtoend/testdata/core_types/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/core_types/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/core_types/googlesql/go/db.go b/internal/endtoend/testdata/core_types/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/core_types/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/core_types/googlesql/go/models.go b/internal/endtoend/testdata/core_types/googlesql/go/models.go new file mode 100644 index 0000000000..21d77ab53d --- /dev/null +++ b/internal/endtoend/testdata/core_types/googlesql/go/models.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" + + "cloud.google.com/go/spanner" +) + +type Thing struct { + ID int64 + S sql.NullString + Smax sql.NullString + N spanner.NullNumeric + Byt []byte + Ai []spanner.NullInt64 + As2 []spanner.NullString + Ts sql.NullTime + D spanner.NullDate + J spanner.NullJSON + B sql.NullBool + F sql.NullFloat64 + F32 spanner.NullFloat32 + U spanner.NullUUID +} diff --git a/internal/endtoend/testdata/core_types/googlesql/go/query.sql.go b/internal/endtoend/testdata/core_types/googlesql/go/query.sql.go new file mode 100644 index 0000000000..b9ae7acb56 --- /dev/null +++ b/internal/endtoend/testdata/core_types/googlesql/go/query.sql.go @@ -0,0 +1,120 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "math/big" + + "cloud.google.com/go/spanner" +) + +const allTypes = `-- name: AllTypes :many +SELECT id, s, smax, n, byt, ai, as2, ts, d, j, b, f, f32, u FROM things +` + +func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { + rows, err := q.db.QueryContext(ctx, allTypes) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Thing + for rows.Next() { + var i Thing + if err := rows.Scan( + &i.ID, + &i.S, + &i.Smax, + &i.N, + &i.Byt, + &i.Ai, + &i.As2, + &i.Ts, + &i.D, + &i.J, + &i.B, + &i.F, + &i.F32, + &i.U, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const casts = `-- name: Casts :one +SELECT + CAST(@a AS NUMERIC) AS a, + CAST(@b AS ARRAY) AS b, + CAST(@d AS STRING) AS d, + SAFE_CAST(@e AS FLOAT64) AS e +FROM things +` + +type CastsParams struct { + A big.Rat + B []spanner.NullInt64 + D string + E float64 +} + +type CastsRow struct { + A big.Rat + B []spanner.NullInt64 + D string + E float64 +} + +func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) { + row := q.db.QueryRowContext(ctx, casts, + sql.Named("a", arg.A), + sql.Named("b", arg.B), + sql.Named("d", arg.D), + sql.Named("e", arg.E), + ) + var i CastsRow + err := row.Scan( + &i.A, + &i.B, + &i.D, + &i.E, + ) + return i, err +} + +const params = `-- name: Params :one +SELECT id FROM things +WHERE s = @s AND n = @n AND smax = @smax AND f32 = @f32 +` + +type ParamsParams struct { + S sql.NullString + N spanner.NullNumeric + Smax sql.NullString + F32 spanner.NullFloat32 +} + +func (q *Queries) Params(ctx context.Context, arg ParamsParams) (int64, error) { + row := q.db.QueryRowContext(ctx, params, + sql.Named("s", arg.S), + sql.Named("n", arg.N), + sql.Named("smax", arg.Smax), + sql.Named("f32", arg.F32), + ) + var id int64 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/core_types/googlesql/query.sql b/internal/endtoend/testdata/core_types/googlesql/query.sql new file mode 100644 index 0000000000..06cca17706 --- /dev/null +++ b/internal/endtoend/testdata/core_types/googlesql/query.sql @@ -0,0 +1,14 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + CAST(@a AS NUMERIC) AS a, + CAST(@b AS ARRAY) AS b, + CAST(@d AS STRING) AS d, + SAFE_CAST(@e AS FLOAT64) AS e +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE s = @s AND n = @n AND smax = @smax AND f32 = @f32; diff --git a/internal/endtoend/testdata/core_types/googlesql/schema.sql b/internal/endtoend/testdata/core_types/googlesql/schema.sql new file mode 100644 index 0000000000..176f055732 --- /dev/null +++ b/internal/endtoend/testdata/core_types/googlesql/schema.sql @@ -0,0 +1,16 @@ +CREATE TABLE things ( + id INT64 NOT NULL, + s STRING(10), + smax STRING(MAX), + n NUMERIC, + byt BYTES(MAX), + ai ARRAY, + as2 ARRAY, + ts TIMESTAMP, + d DATE, + j JSON, + b BOOL, + f FLOAT64, + f32 FLOAT32, + u UUID +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/core_types/googlesql/sqlc.yaml b/internal/endtoend/testdata/core_types/googlesql/sqlc.yaml new file mode 100644 index 0000000000..1efeadaa84 --- /dev/null +++ b/internal/endtoend/testdata/core_types/googlesql/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "googlesql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/core_types/mssql/exec.json b/internal/endtoend/testdata/core_types/mssql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/core_types/mssql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/core_types/mssql/go/db.go b/internal/endtoend/testdata/core_types/mssql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/core_types/mssql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/core_types/mssql/go/models.go b/internal/endtoend/testdata/core_types/mssql/go/models.go new file mode 100644 index 0000000000..db1ac4d38e --- /dev/null +++ b/internal/endtoend/testdata/core_types/mssql/go/models.go @@ -0,0 +1,46 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" + + "github.com/microsoft/go-mssqldb" +) + +type Thing struct { + ID int64 + Price string + Amount sql.NullString + Plain sql.NullString + Body sql.NullString + Title sql.NullString + Code sql.NullString + Ncode sql.NullString + Blob []byte + Key16 []byte + Created sql.NullTime + Updated sql.NullTime + OffsetAt sql.NullTime + Tm sql.NullTime + F sql.NullFloat64 + F53 sql.NullFloat64 + R sql.NullFloat64 + M sql.NullString + B sql.NullBool + U mssql.NullUniqueIdentifier + X sql.NullString + J sql.NullString + Sv any + Rv []byte + G []byte + H []byte + Vec []byte + Sn string + Phone any + Code2 any + Code3 any + Bare sql.NullString +} diff --git a/internal/endtoend/testdata/core_types/mssql/go/querier.go b/internal/endtoend/testdata/core_types/mssql/go/querier.go new file mode 100644 index 0000000000..698104dcd8 --- /dev/null +++ b/internal/endtoend/testdata/core_types/mssql/go/querier.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" +) + +type Querier interface { + AllTypes(ctx context.Context) ([]Thing, error) + Casts(ctx context.Context, arg CastsParams) (CastsRow, error) + Params(ctx context.Context, arg ParamsParams) (int64, error) +} + +var _ Querier = (*Queries)(nil) diff --git a/internal/endtoend/testdata/core_types/mssql/go/query.sql.go b/internal/endtoend/testdata/core_types/mssql/go/query.sql.go new file mode 100644 index 0000000000..1645f7911b --- /dev/null +++ b/internal/endtoend/testdata/core_types/mssql/go/query.sql.go @@ -0,0 +1,158 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const allTypes = `-- name: AllTypes :many +SELECT id, price, amount, plain, body, title, code, ncode, blob, key16, created, updated, offset_at, tm, f, f53, r, m, b, u, x, j, sv, rv, g, h, vec, sn, phone, code2, code3, bare FROM things; +` + +func (q *Queries) AllTypes(ctx context.Context) ([]Thing, error) { + rows, err := q.db.QueryContext(ctx, allTypes) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Thing + for rows.Next() { + var i Thing + if err := rows.Scan( + &i.ID, + &i.Price, + &i.Amount, + &i.Plain, + &i.Body, + &i.Title, + &i.Code, + &i.Ncode, + &i.Blob, + &i.Key16, + &i.Created, + &i.Updated, + &i.OffsetAt, + &i.Tm, + &i.F, + &i.F53, + &i.R, + &i.M, + &i.B, + &i.U, + &i.X, + &i.J, + &i.Sv, + &i.Rv, + &i.G, + &i.H, + &i.Vec, + &i.Sn, + &i.Phone, + &i.Code2, + &i.Code3, + &i.Bare, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const casts = `-- name: Casts :one +SELECT + CAST(amount AS DECIMAL(5,2)) AS a, + CAST(title AS NVARCHAR(MAX)) AS b, + CAST(body AS VARCHAR(10)) AS c, + CONVERT(DATETIME2(3), updated) AS d, + CAST(amount AS MONEY) AS e, + CAST(f53 AS FLOAT(24)) AS f, + CAST(code AS CHAR(3)) AS g +FROM things +WHERE CAST(@a AS DECIMAL(5,2)) > 0 + AND CAST(@b AS NVARCHAR(MAX)) <> N'' + AND CAST(@c AS VARCHAR(10)) <> '' + AND CONVERT(DATETIME2(3), @d) > '2000-01-01' + AND CAST(@e AS MONEY) > 0 + AND TRY_CAST(@f AS FLOAT(24)) > 0 + AND CAST(@g AS CHAR(3)) <> ''; +` + +type CastsParams struct { + A string + B string + C string + D time.Time + E string + F float32 + G string +} + +type CastsRow struct { + A sql.NullString + B sql.NullString + C sql.NullString + D sql.NullTime + E sql.NullString + F sql.NullFloat64 + G sql.NullString +} + +func (q *Queries) Casts(ctx context.Context, arg CastsParams) (CastsRow, error) { + row := q.db.QueryRowContext(ctx, casts, + sql.Named("a", arg.A), + sql.Named("b", arg.B), + sql.Named("c", arg.C), + sql.Named("d", arg.D), + sql.Named("e", arg.E), + sql.Named("f", arg.F), + sql.Named("g", arg.G), + ) + var i CastsRow + err := row.Scan( + &i.A, + &i.B, + &i.C, + &i.D, + &i.E, + &i.F, + &i.G, + ) + return i, err +} + +const params = `-- name: Params :one +SELECT id FROM things +WHERE price = @price AND body = @body AND phone = @phone AND offset_at = @offset_at; +` + +type ParamsParams struct { + Price string + Body sql.NullString + Phone any + OffsetAt sql.NullTime +} + +func (q *Queries) Params(ctx context.Context, arg ParamsParams) (int64, error) { + row := q.db.QueryRowContext(ctx, params, + sql.Named("price", arg.Price), + sql.Named("body", arg.Body), + sql.Named("phone", arg.Phone), + sql.Named("offset_at", arg.OffsetAt), + ) + var id int64 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/core_types/mssql/query.sql b/internal/endtoend/testdata/core_types/mssql/query.sql new file mode 100644 index 0000000000..e2075d7abd --- /dev/null +++ b/internal/endtoend/testdata/core_types/mssql/query.sql @@ -0,0 +1,24 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + CAST(amount AS DECIMAL(5,2)) AS a, + CAST(title AS NVARCHAR(MAX)) AS b, + CAST(body AS VARCHAR(10)) AS c, + CONVERT(DATETIME2(3), updated) AS d, + CAST(amount AS MONEY) AS e, + CAST(f53 AS FLOAT(24)) AS f, + CAST(code AS CHAR(3)) AS g +FROM things +WHERE CAST(@a AS DECIMAL(5,2)) > 0 + AND CAST(@b AS NVARCHAR(MAX)) <> N'' + AND CAST(@c AS VARCHAR(10)) <> '' + AND CONVERT(DATETIME2(3), @d) > '2000-01-01' + AND CAST(@e AS MONEY) > 0 + AND TRY_CAST(@f AS FLOAT(24)) > 0 + AND CAST(@g AS CHAR(3)) <> ''; + +-- name: Params :one +SELECT id FROM things +WHERE price = @price AND body = @body AND phone = @phone AND offset_at = @offset_at; diff --git a/internal/endtoend/testdata/core_types/mssql/schema.sql b/internal/endtoend/testdata/core_types/mssql/schema.sql new file mode 100644 index 0000000000..1e65802777 --- /dev/null +++ b/internal/endtoend/testdata/core_types/mssql/schema.sql @@ -0,0 +1,37 @@ +CREATE TYPE dbo.PhoneNumber FROM varchar(20) NOT NULL; +CREATE TYPE Code FROM char(3); + +CREATE TABLE things ( + id BIGINT IDENTITY(1,1) PRIMARY KEY, + price DECIMAL(10,2) NOT NULL, + amount NUMERIC(18,4), + plain DECIMAL, + body NVARCHAR(MAX), + title VARCHAR(50), + code CHAR(10), + ncode NCHAR(5), + blob VARBINARY(MAX), + key16 BINARY(16), + created DATETIME2(3), + updated DATETIME2, + offset_at DATETIMEOFFSET(7), + tm TIME(4), + f FLOAT(24), + f53 FLOAT, + r REAL, + m MONEY, + b BIT, + u UNIQUEIDENTIFIER, + x XML, + j JSON, + sv SQL_VARIANT, + rv ROWVERSION, + g GEOGRAPHY, + h HIERARCHYID, + vec VECTOR(3), + sn sysname, + phone dbo.PhoneNumber, + code2 dbo.Code, + code3 Code, + bare VARCHAR +); diff --git a/internal/endtoend/testdata/core_types/mssql/sqlc.yaml b/internal/endtoend/testdata/core_types/mssql/sqlc.yaml new file mode 100644 index 0000000000..f4bcb17eb4 --- /dev/null +++ b/internal/endtoend/testdata/core_types/mssql/sqlc.yaml @@ -0,0 +1,11 @@ +version: "2" +sql: + - engine: "mssql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" + emit_interface: true diff --git a/internal/endtoend/testdata/count_star/mysql/go/db.go b/internal/endtoend/testdata/count_star/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/db.go +++ b/internal/endtoend/testdata/count_star/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/count_star/mysql/go/models.go b/internal/endtoend/testdata/count_star/mysql/go/models.go index 40001531be..9ac222a278 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/models.go +++ b/internal/endtoend/testdata/count_star/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID uint64 } diff --git a/internal/endtoend/testdata/count_star/mysql/go/query.sql.go b/internal/endtoend/testdata/count_star/mysql/go/query.sql.go index b6d5b041c7..817ad88789 100644 --- a/internal/endtoend/testdata/count_star/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go index e9976577ee..b4498da0b3 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go index e9976577ee..b4498da0b3 100644 --- a/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go index b6d5b041c7..817ad88789 100644 --- a/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/count_star/sqlite/go/db.go b/internal/endtoend/testdata/count_star/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/count_star/sqlite/go/db.go +++ b/internal/endtoend/testdata/count_star/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/count_star/sqlite/go/models.go b/internal/endtoend/testdata/count_star/sqlite/go/models.go index 214487814e..bc354e040a 100644 --- a/internal/endtoend/testdata/count_star/sqlite/go/models.go +++ b/internal/endtoend/testdata/count_star/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go b/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go index b6d5b041c7..155bfc114a 100644 --- a/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/count_star/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -21,7 +21,7 @@ func (q *Queries) CountStarLower(ctx context.Context) (int64, error) { } const countStarUpper = `-- name: CountStarUpper :one -SELECT COUNT(*) FROM bar +SELECT count(*) FROM bar ` func (q *Queries) CountStarUpper(ctx context.Context) (int64, error) { diff --git a/internal/endtoend/testdata/count_star/sqlite/query.sql b/internal/endtoend/testdata/count_star/sqlite/query.sql index 6cba4363c5..4fbc6599a8 100644 --- a/internal/endtoend/testdata/count_star/sqlite/query.sql +++ b/internal/endtoend/testdata/count_star/sqlite/query.sql @@ -2,4 +2,4 @@ SELECT count(*) FROM bar; -- name: CountStarUpper :one -SELECT COUNT(*) FROM bar; +SELECT count(*) FROM bar; diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go index a262a56ba8..e72052ff0c 100644 --- a/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Val string } diff --git a/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go index f1e261b912..fab385a1e6 100644 --- a/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_materialized_view/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_table_as/postgresql/go/db.go b/internal/endtoend/testdata/create_table_as/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/create_table_as/postgresql/go/db.go +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/create_table_as/postgresql/go/models.go b/internal/endtoend/testdata/create_table_as/postgresql/go/models.go index 3fe9c3f89e..500a1d194e 100644 --- a/internal/endtoend/testdata/create_table_as/postgresql/go/models.go +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Val string } diff --git a/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go index 003e87736b..40b8cbe292 100644 --- a/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_as/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_table_like/mysql/go/db.go b/internal/endtoend/testdata/create_table_like/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/db.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/create_table_like/mysql/go/models.go b/internal/endtoend/testdata/create_table_like/mysql/go/models.go index 3c19fcb0cf..3de6994edb 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/models.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go b/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go index f9c35e648b..d354d45d45 100644 --- a/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_like/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_table_like/postgresql/go/db.go b/internal/endtoend/testdata/create_table_like/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/create_table_like/postgresql/go/db.go +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/create_table_like/postgresql/go/models.go b/internal/endtoend/testdata/create_table_like/postgresql/go/models.go index 3c19fcb0cf..3de6994edb 100644 --- a/internal/endtoend/testdata/create_table_like/postgresql/go/models.go +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go index f9c35e648b..d354d45d45 100644 --- a/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_table_like/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_view/googlesql/exec.json b/internal/endtoend/testdata/create_view/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/create_view/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/create_view/googlesql/go/db.go b/internal/endtoend/testdata/create_view/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/create_view/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/create_view/googlesql/go/models.go b/internal/endtoend/testdata/create_view/googlesql/go/models.go new file mode 100644 index 0000000000..522a07f37d --- /dev/null +++ b/internal/endtoend/testdata/create_view/googlesql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + ID int64 + Name string + City sql.NullString +} diff --git a/internal/endtoend/testdata/create_view/googlesql/go/query.sql.go b/internal/endtoend/testdata/create_view/googlesql/go/query.sql.go new file mode 100644 index 0000000000..da7ee04904 --- /dev/null +++ b/internal/endtoend/testdata/create_view/googlesql/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listVenueNames = `-- name: ListVenueNames :many +SELECT id, name, city FROM venue_names +` + +type ListVenueNamesRow struct { + ID int64 + Name string + City sql.NullString +} + +func (q *Queries) ListVenueNames(ctx context.Context) ([]ListVenueNamesRow, error) { + rows, err := q.db.QueryContext(ctx, listVenueNames) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListVenueNamesRow + for rows.Next() { + var i ListVenueNamesRow + if err := rows.Scan(&i.ID, &i.Name, &i.City); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/create_view/googlesql/query.sql b/internal/endtoend/testdata/create_view/googlesql/query.sql new file mode 100644 index 0000000000..c82210095d --- /dev/null +++ b/internal/endtoend/testdata/create_view/googlesql/query.sql @@ -0,0 +1,2 @@ +-- name: ListVenueNames :many +SELECT * FROM venue_names; diff --git a/internal/endtoend/testdata/create_view/googlesql/schema.sql b/internal/endtoend/testdata/create_view/googlesql/schema.sql new file mode 100644 index 0000000000..6919db659e --- /dev/null +++ b/internal/endtoend/testdata/create_view/googlesql/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE venues ( + id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + city STRING(MAX), +) PRIMARY KEY (id); +CREATE VIEW venue_names SQL SECURITY INVOKER AS +SELECT venues.id, venues.name FROM venues; +CREATE OR REPLACE VIEW venue_names SQL SECURITY INVOKER AS +SELECT venues.id, venues.name, venues.city FROM venues; +CREATE VIEW dropped SQL SECURITY INVOKER AS SELECT venues.id FROM venues; +DROP VIEW dropped; diff --git a/internal/endtoend/testdata/create_view/googlesql/sqlc.json b/internal/endtoend/testdata/create_view/googlesql/sqlc.json new file mode 100644 index 0000000000..40d6c76211 --- /dev/null +++ b/internal/endtoend/testdata/create_view/googlesql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "googlesql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/create_view/mysql/go/db.go b/internal/endtoend/testdata/create_view/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/create_view/mysql/go/db.go +++ b/internal/endtoend/testdata/create_view/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/create_view/mysql/go/models.go b/internal/endtoend/testdata/create_view/mysql/go/models.go index 505685e64c..a979a1a58e 100644 --- a/internal/endtoend/testdata/create_view/mysql/go/models.go +++ b/internal/endtoend/testdata/create_view/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/create_view/mysql/go/query.sql.go b/internal/endtoend/testdata/create_view/mysql/go/query.sql.go index cd1727bf88..c959a7153f 100644 --- a/internal/endtoend/testdata/create_view/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_view/postgresql/go/db.go b/internal/endtoend/testdata/create_view/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/create_view/postgresql/go/db.go +++ b/internal/endtoend/testdata/create_view/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/create_view/postgresql/go/models.go b/internal/endtoend/testdata/create_view/postgresql/go/models.go index 505685e64c..a979a1a58e 100644 --- a/internal/endtoend/testdata/create_view/postgresql/go/models.go +++ b/internal/endtoend/testdata/create_view/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go b/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go index 3c667cae75..08b6f2fa8b 100644 --- a/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/create_view/sqlite/go/db.go b/internal/endtoend/testdata/create_view/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/create_view/sqlite/go/db.go +++ b/internal/endtoend/testdata/create_view/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/create_view/sqlite/go/models.go b/internal/endtoend/testdata/create_view/sqlite/go/models.go index b48f0c9e12..2f186df72f 100644 --- a/internal/endtoend/testdata/create_view/sqlite/go/models.go +++ b/internal/endtoend/testdata/create_view/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go b/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go index 2aff222c28..0c88a4122e 100644 --- a/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/create_view/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/mysql/go/db.go b/internal/endtoend/testdata/cte_count/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cte_count/mysql/go/db.go +++ b/internal/endtoend/testdata/cte_count/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_count/mysql/go/models.go b/internal/endtoend/testdata/cte_count/mysql/go/models.go index 118ea0385c..329a25953f 100644 --- a/internal/endtoend/testdata/cte_count/mysql/go/models.go +++ b/internal/endtoend/testdata/cte_count/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go index c56a05901e..dbaccd81cd 100644 --- a/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go index 118ea0385c..329a25953f 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go index c8ccf33afe..8f46c91591 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go index 118ea0385c..329a25953f 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go index c8ccf33afe..8f46c91591 100644 --- a/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_count/stdlib/go/db.go b/internal/endtoend/testdata/cte_count/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/go/db.go +++ b/internal/endtoend/testdata/cte_count/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_count/stdlib/go/models.go b/internal/endtoend/testdata/cte_count/stdlib/go/models.go index 118ea0385c..329a25953f 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/go/models.go +++ b/internal/endtoend/testdata/cte_count/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go index c56a05901e..dbaccd81cd 100644 --- a/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_count/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_filter/mysql/go/db.go b/internal/endtoend/testdata/cte_filter/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/go/db.go +++ b/internal/endtoend/testdata/cte_filter/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_filter/mysql/go/models.go b/internal/endtoend/testdata/cte_filter/mysql/go/models.go index 118ea0385c..329a25953f 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/go/models.go +++ b/internal/endtoend/testdata/cte_filter/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go index 1bb00d4a8f..a3d95916d7 100644 --- a/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go index 118ea0385c..329a25953f 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go index 8e1f15cb64..6f1d58cb39 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go index 118ea0385c..329a25953f 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go index 8e1f15cb64..6f1d58cb39 100644 --- a/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_filter/stdlib/go/db.go b/internal/endtoend/testdata/cte_filter/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/go/db.go +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_filter/stdlib/go/models.go b/internal/endtoend/testdata/cte_filter/stdlib/go/models.go index 118ea0385c..329a25953f 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/go/models.go +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Ready bool } diff --git a/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go index 89ed958d37..62294fe4ed 100644 --- a/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_filter/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go index d5b46701f3..bdc60fa78b 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Ready bool diff --git a/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go index 64b0d46cae..0fd419b000 100644 --- a/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go index d5b46701f3..bdc60fa78b 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Ready bool diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go index 7f81cc86ce..31f9300755 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go index d5b46701f3..bdc60fa78b 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Ready bool diff --git a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go index 7f81cc86ce..31f9300755 100644 --- a/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go index d5b46701f3..bdc60fa78b 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Ready bool diff --git a/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go index e88fdf618f..fd4e4c3db2 100644 --- a/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_in_delete/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_join_self/issue.md b/internal/endtoend/testdata/cte_join_self/issue.md new file mode 100644 index 0000000000..7dcb76baed --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2132 diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..a1a6c48434 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..1238110b59 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listItems = `-- name: ListItems :one +WITH + items1 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name), + items2 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name) +SELECT + i1.id AS id1, + i2.id AS id2 +FROM + items1 i1 + JOIN items1 i2 ON 1 = 1 +` + +type ListItemsRow struct { + Id1 string + Id2 string +} + +func (q *Queries) ListItems(ctx context.Context) (ListItemsRow, error) { + row := q.db.QueryRow(ctx, listItems) + var i ListItemsRow + err := row.Scan(&i.Id1, &i.Id2) + return i, err +} diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/query.sql new file mode 100644 index 0000000000..972d8bf0d3 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/query.sql @@ -0,0 +1,10 @@ +-- name: ListItems :one +WITH + items1 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name), + items2 AS (SELECT 'id'::TEXT AS id, 'name'::TEXT AS name) +SELECT + i1.id AS id1, + i2.id AS id2 +FROM + items1 i1 + JOIN items1 i2 ON 1 = 1; diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..af3b9497d9 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/schema.sql @@ -0,0 +1 @@ +-- TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_join_self/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_join_self/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go index 0744a36cde..3ed85c9953 100644 --- a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go index 98e03ba495..64c2320add 100644 --- a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -28,11 +28,6 @@ FROM WHERE c1.name = $1 ` -type BadQueryRow struct { - Name string - Bio pgtype.Text -} - func (q *Queries) BadQuery(ctx context.Context, dollar_1 pgtype.Text) error { _, err := q.db.Exec(ctx, badQuery, dollar_1) return err diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go index 0744a36cde..3ed85c9953 100644 --- a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go index b6e66ed0be..2b4b7f76c6 100644 --- a/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_multiple_alias/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_nested_with/issue.md b/internal/endtoend/testdata/cte_nested_with/issue.md new file mode 100644 index 0000000000..40300c9c0a --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2226 diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..4e97f66a99 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..63c955bde2 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getAuthor = `-- name: GetAuthor :one +WITH person AS( + WITH summary AS( + WITH mb AS( + select + id, name, bio + from authors + ) + SELECT + bio + FROM mb + ) + SELECT + count(*) as total + FROM summary +) +select total from person +` + +func (q *Queries) GetAuthor(ctx context.Context) (pgtype.Int8, error) { + row := q.db.QueryRow(ctx, getAuthor) + var total pgtype.Int8 + err := row.Scan(&total) + return total, err +} diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/query.sql new file mode 100644 index 0000000000..947cdc2496 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/query.sql @@ -0,0 +1,17 @@ +-- name: GetAuthor :one +WITH person AS( + WITH summary AS( + WITH mb AS( + select + id, name, bio + from authors + ) + SELECT + bio + FROM mb + ) + SELECT + count(*) as total + FROM summary +) +select total from person; diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_nested_with/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_recursive/mysql/go/db.go b/internal/endtoend/testdata/cte_recursive/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/go/db.go +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_recursive/mysql/go/models.go b/internal/endtoend/testdata/cte_recursive/mysql/go/models.go index 8565bbc555..b5270e9f78 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/go/models.go +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go index 34625ec456..3fb405a017 100644 --- a/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go index 8565bbc555..b5270e9f78 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go index e96cbd6adc..97d5c2cd7c 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go index 43df80226a..cbd9a4b406 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go index 6edb407444..515bac8e58 100644 --- a/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go index 8565bbc555..b5270e9f78 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go b/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go index 18224d94bd..12419a781c 100644 --- a/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive_employees/issue.md b/internal/endtoend/testdata/cte_recursive_employees/issue.md index 2bc033582e..11f5771fd8 100644 --- a/internal/endtoend/testdata/cte_recursive_employees/issue.md +++ b/internal/endtoend/testdata/cte_recursive_employees/issue.md @@ -1 +1,2 @@ -https://github.com/sqlc-dev/sqlc/issues/1219 \ No newline at end of file +https://github.com/sqlc-dev/sqlc/issues/1219 +https://github.com/sqlc-dev/sqlc/issues/1912 diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go index 5e503d675f..8859eaf077 100644 --- a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go index e81ce16986..9bb959847b 100644 --- a/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive_employees/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go index 962822a87a..680b74c9e3 100644 --- a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go index d96dd07b08..6034af9188 100644 --- a/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive_star/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -26,7 +26,7 @@ type GetDictTreeRow struct { ParentCode string Label string Value pgtype.Text - Path pgtype.Text + Path []string Depth int32 } diff --git a/internal/endtoend/testdata/cte_recursive_subquery/issue.md b/internal/endtoend/testdata/cte_recursive_subquery/issue.md new file mode 100644 index 0000000000..98c00da500 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2644 diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..9662cea6d6 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Version struct { + ID int64 + Name pgtype.Text + PreviousVersionID int64 +} diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..60559a075c --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/go/query.sql.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getLatestVersion = `-- name: GetLatestVersion :one +WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( + SELECT base.id, base.id AS chain_id, 0 as chain_counter + FROM versions AS base + WHERE base.previous_version_id IS NULL + UNION ALL + SELECT v.id, search_tree.chain_id, search_tree.chain_counter + 1 + FROM versions AS v + INNER JOIN search_tree ON search_tree.id = v.previous_version_id +) +SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id +FROM search_tree +ORDER BY search_tree.chain_id, chain_counter DESC +` + +func (q *Queries) GetLatestVersion(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, getLatestVersion) + var id int64 + err := row.Scan(&id) + return id, err +} + +const getLatestVersionWithSubquery = `-- name: GetLatestVersionWithSubquery :one +SELECT id +FROM versions +WHERE versions.id IN ( + WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( + SELECT base.id, base.id AS chain_id, 0 as chain_counter + FROM versions AS base + WHERE versions.previous_version_id IS NULL + UNION ALL + SELECT v.id, search_tree.chain_id, search_tree.chain_counter + 1 + FROM versions AS v + INNER JOIN search_tree ON search_tree.id = v.previous_version_id + ) + SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id + FROM search_tree + ORDER BY search_tree.chain_id, chain_counter DESC +) +` + +func (q *Queries) GetLatestVersionWithSubquery(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, getLatestVersionWithSubquery) + var id int64 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/query.sql new file mode 100644 index 0000000000..021d493d84 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/query.sql @@ -0,0 +1,33 @@ +-- name: GetLatestVersion :one +WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( + SELECT base.id, base.id AS chain_id, 0 as chain_counter + FROM versions AS base + WHERE base.previous_version_id IS NULL + UNION ALL + SELECT v.id, search_tree.chain_id, search_tree.chain_counter + 1 + FROM versions AS v + INNER JOIN search_tree ON search_tree.id = v.previous_version_id +) +SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id +FROM search_tree +ORDER BY search_tree.chain_id, chain_counter DESC; + +-- name: GetLatestVersionWithSubquery :one +SELECT id +FROM versions +WHERE versions.id IN ( + WITH RECURSIVE search_tree(id, chain_id, chain_counter) AS ( + SELECT base.id, base.id AS chain_id, 0 as chain_counter + FROM versions AS base + WHERE versions.previous_version_id IS NULL + UNION ALL + SELECT v.id, search_tree.chain_id, search_tree.chain_counter + 1 + FROM versions AS v + INNER JOIN search_tree ON search_tree.id = v.previous_version_id + ) + SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id + FROM search_tree + ORDER BY search_tree.chain_id, chain_counter DESC +); diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..766adb01a8 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE versions ( + id BIGSERIAL PRIMARY KEY, + name TEXT, + previous_version_id bigint NOT NULL +); diff --git a/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..2f12715923 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_subquery/postgresql/pgx/sqlc.yaml @@ -0,0 +1,14 @@ +version: "2" +cloud: + project: "01HAQMMECEYQYKFJN8MP16QC41" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" + database: + managed: true diff --git a/internal/endtoend/testdata/cte_recursive_union/issue.md b/internal/endtoend/testdata/cte_recursive_union/issue.md new file mode 100644 index 0000000000..f87f5c14cb --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/issue.md @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..c0f1a21f17 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/models.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type CaseIntent struct { + ID int32 + CaseIntentString string + Description string + Author string +} + +type CaseIntentParentJoin struct { + CaseIntentID int64 + CaseIntentParentID int64 +} + +type CaseIntentVersion struct { + VersionID int32 + Reviewer string + CreatedAt pgtype.Timestamptz +} + +type CaseIntentVersionJoin struct { + CaseIntentID int64 + CaseIntentVersionID int32 +} diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..a60bc65d95 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const listCaseIntentHistory = `-- name: ListCaseIntentHistory :many +WITH RECURSIVE descendants AS + ( SELECT case_intent_parent_id AS parent, case_intent_id AS child, 1 AS lvl + FROM case_intent_parent_join + UNION ALL + SELECT d.parent as parent, p.case_intent_id as child, d.lvl + 1 as lvl + FROM descendants d + JOIN case_intent_parent_join p + ON d.child = p.case_intent_parent_id + ) +select distinct child, 'child' group_ +from descendants +where parent = $1 +union +select distinct parent, 'parent' group_ +from descendants +where child = $1 +ORDER BY child +` + +type ListCaseIntentHistoryRow struct { + Child int64 + Group string +} + +func (q *Queries) ListCaseIntentHistory(ctx context.Context, caseIntentID pgtype.Int8) ([]ListCaseIntentHistoryRow, error) { + rows, err := q.db.Query(ctx, listCaseIntentHistory, caseIntentID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListCaseIntentHistoryRow + for rows.Next() { + var i ListCaseIntentHistoryRow + if err := rows.Scan(&i.Child, &i.Group); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/query.sql new file mode 100644 index 0000000000..dce099df39 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/query.sql @@ -0,0 +1,18 @@ +-- name: ListCaseIntentHistory :many +WITH RECURSIVE descendants AS + ( SELECT case_intent_parent_id AS parent, case_intent_id AS child, 1 AS lvl + FROM case_intent_parent_join + UNION ALL + SELECT d.parent as parent, p.case_intent_id as child, d.lvl + 1 as lvl + FROM descendants d + JOIN case_intent_parent_join p + ON d.child = p.case_intent_parent_id + ) +select distinct child, 'child' group_ +from descendants +where parent = @case_intent_id +union +select distinct parent, 'parent' group_ +from descendants +where child = @case_intent_id +ORDER BY child; diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..a2c3a682e0 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/schema.sql @@ -0,0 +1,27 @@ +CREATE TABLE case_intent_version +( + version_id SERIAL NOT NULL PRIMARY KEY, + reviewer TEXT NOT NULL, + created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() +); +CREATE TABLE case_intent +( + id SERIAL NOT NULL PRIMARY KEY, + case_intent_string TEXT NOT NULL, + description TEXT NOT NULL, + author TEXT NOT NULL +); +CREATE TABLE case_intent_parent_join +( + case_intent_id BIGINT NOT NULL, + case_intent_parent_id BIGINT NOT NULL, + constraint fk_case_intent_id foreign key (case_intent_id) references case_intent(id), + constraint fk_case_intent_parent_id foreign key (case_intent_parent_id) references case_intent(id) +); +CREATE TABLE case_intent_version_join +( + case_intent_id BIGINT NOT NULL, + case_intent_version_id INT NOT NULL, + constraint fk_case_intent_id foreign key (case_intent_id) references case_intent(id), + constraint fk_case_intent_version_id foreign key (case_intent_version_id) references case_intent_version(version_id) +); diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go index de69b77ccc..463398c104 100644 --- a/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_select_one/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/cte_update/issue.md b/internal/endtoend/testdata/cte_update/issue.md new file mode 100644 index 0000000000..5f1a5921ed --- /dev/null +++ b/internal/endtoend/testdata/cte_update/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1515 diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_update/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f66a67cd1b --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Attribute struct { + ID int64 + Name string +} + +type AttributeValue struct { + ID int64 + Val string + Attribute int64 +} diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..3d729de8a8 --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const updateAttribute = `-- name: UpdateAttribute :one +with updated_attribute as (UPDATE attribute_value + SET + val = CASE WHEN $1::bool THEN $2 ELSE val END + WHERE attribute_value.id = $3 + RETURNING id,attribute,val) +select updated_attribute.id, val, name +from updated_attribute + left join attribute on updated_attribute.attribute = attribute.id +` + +type UpdateAttributeParams struct { + FilterValue pgtype.Bool + Value pgtype.Text + ID pgtype.Int8 +} + +type UpdateAttributeRow struct { + ID int64 + Val string + Name pgtype.Text +} + +func (q *Queries) UpdateAttribute(ctx context.Context, arg UpdateAttributeParams) (UpdateAttributeRow, error) { + row := q.db.QueryRow(ctx, updateAttribute, arg.FilterValue, arg.Value, arg.ID) + var i UpdateAttributeRow + err := row.Scan(&i.ID, &i.Val, &i.Name) + return i, err +} diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_update/postgresql/pgx/query.sql new file mode 100644 index 0000000000..6ba9aa4e7a --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/query.sql @@ -0,0 +1,9 @@ +-- name: UpdateAttribute :one +with updated_attribute as (UPDATE attribute_value + SET + val = CASE WHEN @filter_value::bool THEN @value ELSE val END + WHERE attribute_value.id = @id + RETURNING id,attribute,val) +select updated_attribute.id, val, name +from updated_attribute + left join attribute on updated_attribute.attribute = attribute.id; diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_update/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..6273c9a7e0 --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/schema.sql @@ -0,0 +1,12 @@ +create table attribute_value +( + id bigserial not null, + val text not null, + attribute bigint not null +); + +create table attribute +( + id bigserial not null, + name text not null +); diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_update/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_update_multiple/issue.md b/internal/endtoend/testdata/cte_update_multiple/issue.md new file mode 100644 index 0000000000..fc662de1ea --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1916 diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/exec.json b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..53e1984a14 --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/models.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Address struct { + ID int64 + AddressLine string + Region string + City string + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} + +type User struct { + ID int64 + Username string + Email string + Password string + Telephone int32 + DefaultPayment pgtype.Int8 + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} + +type UserAddress struct { + UserID int64 + AddressID int64 + DefaultAddress pgtype.Int8 + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..b44b0a9d2c --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/go/query.sql.go @@ -0,0 +1,83 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const updateUserAddressWithAddress = `-- name: UpdateUserAddressWithAddress :one +WITH t1 AS ( + UPDATE "address" as a + SET + address_line = COALESCE($1,address_line), + region = COALESCE($2,region), + city= COALESCE($3,city) + WHERE id = COALESCE($4,id) + RETURNING a.id, a.address_line, a.region, a.city + ), + + t2 AS ( + UPDATE "user_address" + SET + default_address = COALESCE($5,default_address) + WHERE + user_id = COALESCE($6,user_id) + AND address_id = COALESCE($7,address_id) + RETURNING user_id, address_id, default_address + ) + +SELECT +user_id, +address_id, +default_address, +address_line, +region, +city From t1,t2 +` + +type UpdateUserAddressWithAddressParams struct { + AddressLine pgtype.Text + Region pgtype.Text + City pgtype.Text + ID pgtype.Int8 + DefaultAddress pgtype.Int8 + UserID pgtype.Int8 + AddressID pgtype.Int8 +} + +type UpdateUserAddressWithAddressRow struct { + UserID int64 + AddressID int64 + DefaultAddress pgtype.Int8 + AddressLine string + Region string + City string +} + +func (q *Queries) UpdateUserAddressWithAddress(ctx context.Context, arg UpdateUserAddressWithAddressParams) (UpdateUserAddressWithAddressRow, error) { + row := q.db.QueryRow(ctx, updateUserAddressWithAddress, + arg.AddressLine, + arg.Region, + arg.City, + arg.ID, + arg.DefaultAddress, + arg.UserID, + arg.AddressID, + ) + var i UpdateUserAddressWithAddressRow + err := row.Scan( + &i.UserID, + &i.AddressID, + &i.DefaultAddress, + &i.AddressLine, + &i.Region, + &i.City, + ) + return i, err +} diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/query.sql new file mode 100644 index 0000000000..9cb15e5b69 --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/query.sql @@ -0,0 +1,28 @@ +-- name: UpdateUserAddressWithAddress :one +WITH t1 AS ( + UPDATE "address" as a + SET + address_line = COALESCE(sqlc.narg(address_line),address_line), + region = COALESCE(sqlc.narg(region),region), + city= COALESCE(sqlc.narg(city),city) + WHERE id = COALESCE(sqlc.arg(id),id) + RETURNING a.id, a.address_line, a.region, a.city + ), + + t2 AS ( + UPDATE "user_address" + SET + default_address = COALESCE(sqlc.narg(default_address),default_address) + WHERE + user_id = COALESCE(sqlc.arg(user_id),user_id) + AND address_id = COALESCE(sqlc.arg(address_id),address_id) + RETURNING user_id, address_id, default_address + ) + +SELECT +user_id, +address_id, +default_address, +address_line, +region, +city From t1,t2; diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..7ec7b1a82c --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/schema.sql @@ -0,0 +1,27 @@ +CREATE TABLE "user" ( + "id" bigserial PRIMARY KEY NOT NULL, + "username" varchar NOT NULL, + "email" varchar UNIQUE NOT NULL, + "password" varchar NOT NULL, + "telephone" int NOT NULL DEFAULT 0, + "default_payment" bigint, + "created_at" timestamptz NOT NULL DEFAULT (now()), + "updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' +); + +CREATE TABLE "address" ( + "id" bigserial PRIMARY KEY NOT NULL, + "address_line" varchar NOT NULL, + "region" varchar NOT NULL, + "city" varchar NOT NULL, + "created_at" timestamptz NOT NULL DEFAULT (now()), + "updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' +); + +CREATE TABLE "user_address" ( + "user_id" bigint NOT NULL, + "address_id" bigint UNIQUE NOT NULL, + "default_address" bigint, + "created_at" timestamptz NOT NULL DEFAULT (now()), + "updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' +); diff --git a/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/cte_update_multiple/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/cte_with_in/issue.md b/internal/endtoend/testdata/cte_with_in/issue.md new file mode 100644 index 0000000000..34fccd51ff --- /dev/null +++ b/internal/endtoend/testdata/cte_with_in/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2153 diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/db.go b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/db.go +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go index 6b81cce5f3..2eeae6b0aa 100644 --- a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go index 2cfc581465..8d9bdb7961 100644 --- a/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/cte_with_in/postgresql/pganalyze/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go b/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go b/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go index 3b575df5dc..c9881be331 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go b/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go index 5c0c0faeae..3bf45fbc2b 100644 --- a/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go index 3b05ae17d3..e58b7da4cb 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go index 32b258513b..cbe50cff67 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go index 09f37abcb8..3b11a26533 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go index 32b258513b..cbe50cff67 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go index 3b05ae17d3..e58b7da4cb 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go index 5f24651f81..69b40a8dc8 100644 --- a/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go index abb030e634..00e5da2ff6 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go b/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go index 90954d51e4..247c17182c 100644 --- a/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go +++ b/internal/endtoend/testdata/data_type_boolean/sqlite/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/datatype/mysql/go/db.go b/internal/endtoend/testdata/datatype/mysql/go/db.go index f280f77116..31b13521bd 100644 --- a/internal/endtoend/testdata/datatype/mysql/go/db.go +++ b/internal/endtoend/testdata/datatype/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/datatype/mysql/go/models.go b/internal/endtoend/testdata/datatype/mysql/go/models.go index e4b55a42fa..c0b51ba8ca 100644 --- a/internal/endtoend/testdata/datatype/mysql/go/models.go +++ b/internal/endtoend/testdata/datatype/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -54,11 +54,11 @@ type DtDatetimeNotNull struct { type DtNumeric struct { A sql.NullInt32 B sql.NullInt32 - C sql.NullInt32 - D sql.NullInt32 + C sql.NullInt16 + D sql.NullInt16 E sql.NullInt32 F sql.NullInt64 - G interface{} + G any H sql.NullString I sql.NullString J sql.NullFloat64 @@ -69,11 +69,11 @@ type DtNumeric struct { type DtNumericNotNull struct { A int32 B int32 - C int32 - D int32 + C int8 + D int16 E int32 F int64 - G interface{} + G any H string I string J float64 @@ -84,8 +84,8 @@ type DtNumericNotNull struct { type DtNumericUnsigned struct { A sql.NullInt32 B sql.NullInt32 - C sql.NullInt32 - D sql.NullInt32 + C sql.NullInt16 + D sql.NullInt16 E sql.NullInt32 F sql.NullInt64 } diff --git a/internal/endtoend/testdata/datatype/mysql/go/query.sql.go b/internal/endtoend/testdata/datatype/mysql/go/query.sql.go new file mode 100644 index 0000000000..96b4633882 --- /dev/null +++ b/internal/endtoend/testdata/datatype/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/mysql/sql/query.sql b/internal/endtoend/testdata/datatype/mysql/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/mysql/sql/query.sql +++ b/internal/endtoend/testdata/datatype/mysql/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/datatype/pgx/v4/go/db.go b/internal/endtoend/testdata/datatype/pgx/v4/go/db.go index 819b76a2d8..5cc19ed7fb 100644 --- a/internal/endtoend/testdata/datatype/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/datatype/pgx/v4/go/models.go b/internal/endtoend/testdata/datatype/pgx/v4/go/models.go index 6e6cd4181f..1408ef61bd 100644 --- a/internal/endtoend/testdata/datatype/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype diff --git a/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..29ea3c7023 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql b/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql +++ b/internal/endtoend/testdata/datatype/pgx/v4/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/datatype/pgx/v5/go/db.go b/internal/endtoend/testdata/datatype/pgx/v5/go/db.go index 628fe9c96b..b57247cdf3 100644 --- a/internal/endtoend/testdata/datatype/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/datatype/pgx/v5/go/models.go b/internal/endtoend/testdata/datatype/pgx/v5/go/models.go index a1b7649a58..26252be03a 100644 --- a/internal/endtoend/testdata/datatype/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype diff --git a/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..29ea3c7023 --- /dev/null +++ b/internal/endtoend/testdata/datatype/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql b/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql +++ b/internal/endtoend/testdata/datatype/pgx/v5/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/datatype/sqlite/go/db.go b/internal/endtoend/testdata/datatype/sqlite/go/db.go index f280f77116..31b13521bd 100644 --- a/internal/endtoend/testdata/datatype/sqlite/go/db.go +++ b/internal/endtoend/testdata/datatype/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/datatype/sqlite/go/models.go b/internal/endtoend/testdata/datatype/sqlite/go/models.go index f3eb95ff73..7354c7db3c 100644 --- a/internal/endtoend/testdata/datatype/sqlite/go/models.go +++ b/internal/endtoend/testdata/datatype/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype diff --git a/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go b/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go new file mode 100644 index 0000000000..302372424a --- /dev/null +++ b/internal/endtoend/testdata/datatype/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/sqlite/sql/character.sql b/internal/endtoend/testdata/datatype/sqlite/sql/character.sql index d4b728bdab..8c5a6ea95c 100644 --- a/internal/endtoend/testdata/datatype/sqlite/sql/character.sql +++ b/internal/endtoend/testdata/datatype/sqlite/sql/character.sql @@ -1,23 +1,23 @@ -- Character Types -- https://www.sqlite.org/datatype3.html CREATE TABLE dt_character ( - a CHARACTER(32), - b VARCHAR(32), - c VARYING CHARACTER(32), - d NCHAR(32), - e NATIVE CHARACTER(32), - f NVARCHAR(32), - g TEXT, - h CLOB + a CHARACTER(32), + b VARCHAR(32), + c VARYING CHARACTER(32), + d NCHAR(32), + e NATIVE CHARACTER(32), + f NVARCHAR(32), + g TEXT, + h CLOB ); CREATE TABLE dt_character_not_null ( - a CHARACTER(32) NOT NULL, - b VARCHAR(32) NOT NULL, - c VARYING CHARACTER(32) NOT NULL, - d NCHAR(32) NOT NULL, - e NATIVE CHARACTER(32) NOT NULL, - f NVARCHAR(32) NOT NULL, - g TEXT NOT NULL, - h CLOB NOT NULL + a CHARACTER(32) NOT NULL, + b VARCHAR(32) NOT NULL, + c VARYING CHARACTER(32) NOT NULL, + d NCHAR(32) NOT NULL, + e NATIVE CHARACTER(32) NOT NULL, + f NVARCHAR(32) NOT NULL, + g TEXT NOT NULL, + h CLOB NOT NULL ); diff --git a/internal/endtoend/testdata/datatype/sqlite/sql/datetime.sql b/internal/endtoend/testdata/datatype/sqlite/sql/datetime.sql index 6008cf6ae6..a1f91e513d 100644 --- a/internal/endtoend/testdata/datatype/sqlite/sql/datetime.sql +++ b/internal/endtoend/testdata/datatype/sqlite/sql/datetime.sql @@ -1,13 +1,13 @@ -- Date/Time Types -- https://www.sqlite.org/datatype3.html CREATE TABLE dt_datetime ( - a DATE, - b DATETIME, - c TIMESTAMP + a DATE, + b DATETIME, + c TIMESTAMP ); CREATE TABLE dt_datetime_not_null ( - a DATE NOT NULL, - b DATETIME NOT NULL, - c TIMESTAMP NOT NULL + a DATE NOT NULL, + b DATETIME NOT NULL, + c TIMESTAMP NOT NULL ); diff --git a/internal/endtoend/testdata/datatype/sqlite/sql/numeric.sql b/internal/endtoend/testdata/datatype/sqlite/sql/numeric.sql index a85b4f295b..1662cb6ce0 100644 --- a/internal/endtoend/testdata/datatype/sqlite/sql/numeric.sql +++ b/internal/endtoend/testdata/datatype/sqlite/sql/numeric.sql @@ -1,37 +1,37 @@ -- Numeric Types -- https://www.sqlite.org/datatype3.html CREATE TABLE dt_numeric ( - a INT, - b INTEGER, - c TINYINT, - d SMALLINT, - e MEDIUMINT, - f BIGINT, - g UNSIGNED BIG INT, - h INT2, - i INT8, - j REAL, - k DOUBLE, - l DOUBLE PRECISION, - m FLOAT, - n NUMERIC, - o DECIMAL(10,5) + a INT, + b INTEGER, + c TINYINT, + d SMALLINT, + e MEDIUMINT, + f BIGINT, + g UNSIGNED BIG INT, + h INT2, + i INT8, + j REAL, + k DOUBLE, + l DOUBLE PRECISION, + m FLOAT, + n NUMERIC, + o DECIMAL(10,5) ); CREATE TABLE dt_numeric_not_null ( - a INT NOT NULL, - b INTEGER NOT NULL, - c TINYINT NOT NULL, - d SMALLINT NOT NULL, - e MEDIUMINT NOT NULL, - f BIGINT NOT NULL, - g UNSIGNED BIG INT NOT NULL, - h INT2 NOT NULL, - i INT8 NOT NULL, - j REAL NOT NULL, - k DOUBLE NOT NULL, - l DOUBLE PRECISION NOT NULL, - m FLOAT NOT NULL, - n NUMERIC NOT NULL, - o DECIMAL(10,5) NOT NULL + a INT NOT NULL, + b INTEGER NOT NULL, + c TINYINT NOT NULL, + d SMALLINT NOT NULL, + e MEDIUMINT NOT NULL, + f BIGINT NOT NULL, + g UNSIGNED BIG INT NOT NULL, + h INT2 NOT NULL, + i INT8 NOT NULL, + j REAL NOT NULL, + k DOUBLE NOT NULL, + l DOUBLE PRECISION NOT NULL, + m FLOAT NOT NULL, + n NUMERIC NOT NULL, + o DECIMAL(10,5) NOT NULL ); diff --git a/internal/endtoend/testdata/datatype/sqlite/sql/query.sql b/internal/endtoend/testdata/datatype/sqlite/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/sqlite/sql/query.sql +++ b/internal/endtoend/testdata/datatype/sqlite/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/datatype/stdlib/go/db.go b/internal/endtoend/testdata/datatype/stdlib/go/db.go index f280f77116..31b13521bd 100644 --- a/internal/endtoend/testdata/datatype/stdlib/go/db.go +++ b/internal/endtoend/testdata/datatype/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/datatype/stdlib/go/models.go b/internal/endtoend/testdata/datatype/stdlib/go/models.go index c9f87be871..0dbaa9ae63 100644 --- a/internal/endtoend/testdata/datatype/stdlib/go/models.go +++ b/internal/endtoend/testdata/datatype/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -94,19 +94,19 @@ type DtNumericNotNull struct { } type DtRange struct { - A interface{} - B interface{} - C interface{} - D interface{} - E interface{} - F interface{} + A any + B any + C any + D any + E any + F any } type DtRangeNotNull struct { - A interface{} - B interface{} - C interface{} - D interface{} - E interface{} - F interface{} + A any + B any + C any + D any + E any + F any } diff --git a/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go b/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go new file mode 100644 index 0000000000..96b4633882 --- /dev/null +++ b/internal/endtoend/testdata/datatype/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/datatype/stdlib/sql/query.sql b/internal/endtoend/testdata/datatype/stdlib/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/datatype/stdlib/sql/query.sql +++ b/internal/endtoend/testdata/datatype/stdlib/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/db.go b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/models.go index 5a759a4401..c7ea43b5c5 100644 --- a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go index 3d0ab335c3..b916b596b3 100644 --- a/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_materialized_views_set_schema/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/exec.json b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/models.go new file mode 100644 index 0000000000..36f498a442 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + ID int64 + Name sql.NullString + Location sql.NullString + Size int64 +} diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/query.sql.go new file mode 100644 index 0000000000..a197546f8a --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const placeholder = `-- name: Placeholder :many +SELECT id, name, location, size FROM venues +` + +func (q *Queries) Placeholder(ctx context.Context) ([]Venue, error) { + rows, err := q.db.QueryContext(ctx, placeholder) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Venue + for rows.Next() { + var i Venue + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Location, + &i.Size, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/query.sql new file mode 100644 index 0000000000..3564511e10 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :many +SELECT * FROM venues; diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/schema.sql new file mode 100644 index 0000000000..d4a74b1bf5 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE venues ( + id INT64 NOT NULL, + name STRING(MAX), +) PRIMARY KEY (id); +ALTER TABLE venues ADD COLUMN location STRING(MAX); +ALTER TABLE venues ADD COLUMN IF NOT EXISTS size INT64 NOT NULL DEFAULT (0); diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/sqlc.json new file mode 100644 index 0000000000..40d6c76211 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/googlesql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "googlesql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go index 9629795bcd..97d9160e02 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go index 46527b502b..401bfd04b6 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go index 58ada23032..782c4c5f6e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go index 46527b502b..401bfd04b6 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go index 7c2a1538a6..cfe57d4e4c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go index 48abdeca1d..f6fb2a4b5b 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,7 +10,7 @@ import ( ) const placeholder = `-- name: Placeholder :many -SELECT name, location, size from venues +SELECT name, location, size FROM venues ` func (q *Queries) Placeholder(ctx context.Context) ([]Venue, error) { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/query.sql index 1dbfac7154..c05c2203cd 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/query.sql +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/sqlite/query.sql @@ -1,2 +1,2 @@ /* name: Placeholder :many */ -SELECT * from venues; +SELECT * FROM venues; diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go index a8b9e9c97e..a17278746e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Baz string diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go index a8b9e9c97e..a17278746e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Baz string diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go index a8b9e9c97e..a17278746e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Baz string diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_add_column_if_not_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/exec.json b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/models.go new file mode 100644 index 0000000000..8e18cbc391 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + ID int64 + Name string + Capacity int64 + Notes sql.NullString +} diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/query.sql.go new file mode 100644 index 0000000000..92690255c1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const placeholder = `-- name: Placeholder :many +SELECT id, name, capacity, notes FROM venues +` + +func (q *Queries) Placeholder(ctx context.Context) ([]Venue, error) { + rows, err := q.db.QueryContext(ctx, placeholder) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Venue + for rows.Next() { + var i Venue + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Capacity, + &i.Notes, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/query.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/query.sql new file mode 100644 index 0000000000..3564511e10 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :many +SELECT * FROM venues; diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/schema.sql new file mode 100644 index 0000000000..3571469d9e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE venues ( + id INT64 NOT NULL, + name STRING(10) NOT NULL, + capacity INT64, + notes STRING(MAX) NOT NULL, +) PRIMARY KEY (id); +ALTER TABLE venues ALTER COLUMN name STRING(MAX) NOT NULL; +ALTER TABLE venues ALTER COLUMN capacity INT64 NOT NULL DEFAULT (0); +ALTER TABLE venues ALTER COLUMN notes STRING(MAX); diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/sqlc.json new file mode 100644 index 0000000000..40d6c76211 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/googlesql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "googlesql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go index 4730871b4c..824f928df6 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go index bf6ebcb39d..dce4e35e48 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar []string } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go index bf6ebcb39d..dce4e35e48 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar []string } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go index bf6ebcb39d..dce4e35e48 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar []string } diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/models.go new file mode 100644 index 0000000000..4bda213580 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int64 + FullName sql.NullString + EmailAddress sql.NullString + CreatedAt sql.NullString +} diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go new file mode 100644 index 0000000000..43e0007167 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/go/query.sql.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const insertUser = `-- name: InsertUser :exec +INSERT INTO users (full_name, "EmailAddress", created_at) +VALUES (?, ?, ?) +` + +type InsertUserParams struct { + FullName sql.NullString + EmailAddress sql.NullString + CreatedAt sql.NullString +} + +func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) error { + _, err := q.db.ExecContext(ctx, insertUser, arg.FullName, arg.EmailAddress, arg.CreatedAt) + return err +} + +const selectUsers = `-- name: SelectUsers :many +SELECT id, full_name, "EmailAddress", created_at +FROM users +` + +func (q *Queries) SelectUsers(ctx context.Context) ([]User, error) { + rows, err := q.db.QueryContext(ctx, selectUsers) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan( + &i.ID, + &i.FullName, + &i.EmailAddress, + &i.CreatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/query.sql new file mode 100644 index 0000000000..d960ab1f07 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/query.sql @@ -0,0 +1,7 @@ +-- name: InsertUser :exec +INSERT INTO users (full_name, "EmailAddress", created_at) +VALUES (?, ?, ?); + +-- name: SelectUsers :many +SELECT id, full_name, "EmailAddress", created_at +FROM users; diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/schema.sql b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/schema.sql new file mode 100644 index 0000000000..5b8af0ac35 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/schema.sql @@ -0,0 +1,10 @@ +-- Test ALTER TABLE operations with mixed case table and column names +-- Verifies consistent handling of case sensitivity in DDL operations +CREATE TABLE Users (id integer primary key, name text, "Email" text); + +-- Test renaming columns with different case formats +ALTER TABLE Users RENAME COLUMN name TO full_name; +ALTER TABLE Users RENAME COLUMN "Email" TO "EmailAddress"; + +-- Test adding a simple column +ALTER TABLE Users ADD COLUMN created_at text; diff --git a/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_case_sensitivity/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go index e2e54f4289..1ef93ed1fb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go index e1e25d4f9f..98c9fc47e9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Baz string } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go index e1e25d4f9f..98c9fc47e9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Baz string } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go index e1e25d4f9f..98c9fc47e9 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Baz string } diff --git a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_change_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/models.go index 8354a335ab..a61eef293c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go index 8354a335ab..a61eef293c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go index 2eae5b9f1f..4f597ba1da 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go index 8354a335ab..a61eef293c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_column_drop_not_null/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/exec.json b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/models.go new file mode 100644 index 0000000000..c67630d1c3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Venue struct { + ID int64 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/query.sql.go new file mode 100644 index 0000000000..d0eefdd98e --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const placeholder = `-- name: Placeholder :many +SELECT id, name FROM venues +` + +func (q *Queries) Placeholder(ctx context.Context) ([]Venue, error) { + rows, err := q.db.QueryContext(ctx, placeholder) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Venue + for rows.Next() { + var i Venue + if err := rows.Scan(&i.ID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/query.sql new file mode 100644 index 0000000000..3564511e10 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :many +SELECT * FROM venues; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/schema.sql new file mode 100644 index 0000000000..6cd6d76fff --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE venues ( + id INT64 NOT NULL, + name STRING(MAX), + slug STRING(MAX), +) PRIMARY KEY (id); +ALTER TABLE venues DROP COLUMN slug; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/sqlc.json new file mode 100644 index 0000000000..40d6c76211 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/googlesql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "googlesql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/models.go index e2e54f4289..1ef93ed1fb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go index e2e54f4289..1ef93ed1fb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go index 2ad82f7bd8..8620cf6a87 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go index e2e54f4289..1ef93ed1fb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go index e2e54f4289..1ef93ed1fb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go index f1f74ca4ae..a0b6155ece 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,7 +10,7 @@ import ( ) const placeholder = `-- name: Placeholder :exec -SELECT baz from foo +SELECT baz FROM foo ` func (q *Queries) Placeholder(ctx context.Context) error { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/query.sql index 198b08bb8d..92dc72524c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/query.sql +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column/sqlite/query.sql @@ -1,2 +1,2 @@ -- name: Placeholder :exec -SELECT * from foo; +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/exec.json b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/models.go index c3e4850f4f..a856c9fd53 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/models.go @@ -1,10 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go index c3e4850f4f..a856c9fd53 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/models.go @@ -1,10 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go index c3e4850f4f..a856c9fd53 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/models.go @@ -1,10 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go index c3e4850f4f..a856c9fd53 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/models.go @@ -1,10 +1,8 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_column_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/exec.json b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/models.go index 7a6692ee43..4b013d4a64 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Venue struct { ID uint64 } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go index 5b6fa88c9a..2feb3c3df2 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Venue struct { ID int32 } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go index 5b6fa88c9a..2feb3c3df2 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Venue struct { ID int32 } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go index 5b6fa88c9a..2feb3c3df2 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Venue struct { ID int32 } diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go index 72f6b62d08..dfc996bb9c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go index eee6a6d496..6b1a9153c1 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go index 72f6b62d08..dfc996bb9c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/exec.json b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/models.go new file mode 100644 index 0000000000..b6eccd45e1 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Arena struct { + ID int64 +} + +type Venue struct { + ID int64 +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/query.sql.go new file mode 100644 index 0000000000..ef6ecead1f --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/go/query.sql.go @@ -0,0 +1,64 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listArenas = `-- name: ListArenas :many +SELECT id FROM arena +` + +func (q *Queries) ListArenas(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, listArenas) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listVenues = `-- name: ListVenues :many +SELECT id FROM venue +` + +func (q *Queries) ListVenues(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, listVenues) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/query.sql new file mode 100644 index 0000000000..274ee7b250 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/query.sql @@ -0,0 +1,5 @@ +-- name: ListVenues :many +SELECT * FROM venue; + +-- name: ListArenas :many +SELECT * FROM arena; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/schema.sql b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/schema.sql new file mode 100644 index 0000000000..d6da5181dd --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE venues ( + id INT64 NOT NULL, +) PRIMARY KEY (id); +CREATE TABLE arenas ( + id INT64 NOT NULL, +) PRIMARY KEY (id); +ALTER TABLE venues RENAME TO venue; +RENAME TABLE arenas TO stadiums, stadiums TO arena; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/sqlc.json b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/sqlc.json new file mode 100644 index 0000000000..40d6c76211 --- /dev/null +++ b/internal/endtoend/testdata/ddl_alter_table_rename/googlesql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "googlesql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/models.go index 21861aedbd..935e0b7cdf 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go index ca7f329592..847b2c2f87 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go index 0c5fbe7fa1..bf0cad8364 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go index ca7f329592..847b2c2f87 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go index ca7f329592..847b2c2f87 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go index 6cf0ba887a..e52ada4441 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,7 +11,7 @@ import ( ) const placeholder = `-- name: Placeholder :many -SELECT name from arenas +SELECT name FROM arenas ` func (q *Queries) Placeholder(ctx context.Context) ([]sql.NullString, error) { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/query.sql index 3cb2745388..bf777e0cb6 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/query.sql +++ b/internal/endtoend/testdata/ddl_alter_table_rename/sqlite/query.sql @@ -1,2 +1,2 @@ /* name: Placeholder :many */ -SELECT * from arenas; +SELECT * FROM arenas; diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/models.go index e2e54f4289..1ef93ed1fb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go index e2e54f4289..1ef93ed1fb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go index 2ad82f7bd8..8620cf6a87 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go index e2e54f4289..1ef93ed1fb 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go index a2b34bef24..38ba011ef8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go index cb79b21683..d8317bd784 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,7 +11,7 @@ import ( ) const placeholder = `-- name: Placeholder :many -SELECT boo from foo +SELECT boo FROM foo ` func (q *Queries) Placeholder(ctx context.Context) ([]sql.NullString, error) { diff --git a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/query.sql b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/query.sql index 43794d52b5..4b98a8146c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/query.sql +++ b/internal/endtoend/testdata/ddl_alter_table_rename_column/sqlite/query.sql @@ -1,2 +1,2 @@ /* name: Placeholder :many */ -SELECT * from foo; +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/models.go index 9e06e62360..a443e19f0f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go index 97b1844235..eab07e15bc 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go index 8d0eeaf2f3..5e178efd17 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go index 97b1844235..eab07e15bc 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/models.go index 3f44f8fd63..d324fe92ad 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go index 3f44f8fd63..d324fe92ad 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go index 3f44f8fd63..d324fe92ad 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go index 3f44f8fd63..d324fe92ad 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_not_null/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go index ad6d3d32ce..ce6ac2a818 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go index 2fac817075..3f12a3b6c2 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go index 3b18903a63..a021d20f25 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go index 6dab12b204..6f05e298b0 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go index ad6d3d32ce..ce6ac2a818 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go index 5629e049b3..880cfc64d0 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_table_set_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go index 64c1a45a19..5c53dc5fd6 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( StatusUnknown Status = "unknown" ) -func (e *Status) Scan(src interface{}) error { +func (e *Status) Scan(src any) error { switch s := src.(type) { case []byte: *e = Status(s) @@ -35,7 +35,7 @@ type NullStatus struct { } // Scan implements the Scanner interface. -func (ns *NullStatus) Scan(value interface{}) error { +func (ns *NullStatus) Scan(value any) error { if value == nil { ns.Status, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go index 64c1a45a19..5c53dc5fd6 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( StatusUnknown Status = "unknown" ) -func (e *Status) Scan(src interface{}) error { +func (e *Status) Scan(src any) error { switch s := src.(type) { case []byte: *e = Status(s) @@ -35,7 +35,7 @@ type NullStatus struct { } // Scan implements the Scanner interface. -func (ns *NullStatus) Scan(value interface{}) error { +func (ns *NullStatus) Scan(value any) error { if value == nil { ns.Status, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go index 64c1a45a19..5c53dc5fd6 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( StatusUnknown Status = "unknown" ) -func (e *Status) Scan(src interface{}) error { +func (e *Status) Scan(src any) error { switch s := src.(type) { case []byte: *e = Status(s) @@ -35,7 +35,7 @@ type NullStatus struct { } // Scan implements the Scanner interface. -func (ns *NullStatus) Scan(value interface{}) error { +func (ns *NullStatus) Scan(value any) error { if value == nil { ns.Status, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go index 3d3ddaa7f1..97a1bc3bcc 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -34,7 +34,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go index a2cc27a171..7f56a7b60b 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go index 3d3ddaa7f1..97a1bc3bcc 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -34,7 +34,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go index a2cc27a171..7f56a7b60b 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go index 3d3ddaa7f1..97a1bc3bcc 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -34,7 +34,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go index 397388e073..ac0f963c19 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go index 3d3ddaa7f1..97a1bc3bcc 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -34,7 +34,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go index a2cc27a171..7f56a7b60b 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go index 3d3ddaa7f1..97a1bc3bcc 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -34,7 +34,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go index a2cc27a171..7f56a7b60b 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go index 3d3ddaa7f1..97a1bc3bcc 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -34,7 +34,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go index 397388e073..ac0f963c19 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go index fa6aab4565..2dae43629e 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( StatusShut Status = "shut" ) -func (e *Status) Scan(src interface{}) error { +func (e *Status) Scan(src any) error { switch s := src.(type) { case []byte: *e = Status(s) @@ -34,7 +34,7 @@ type NullStatus struct { } // Scan implements the Scanner interface. -func (ns *NullStatus) Scan(value interface{}) error { +func (ns *NullStatus) Scan(value any) error { if value == nil { ns.Status, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go index fa6aab4565..2dae43629e 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( StatusShut Status = "shut" ) -func (e *Status) Scan(src interface{}) error { +func (e *Status) Scan(src any) error { switch s := src.(type) { case []byte: *e = Status(s) @@ -34,7 +34,7 @@ type NullStatus struct { } // Scan implements the Scanner interface. -func (ns *NullStatus) Scan(value interface{}) error { +func (ns *NullStatus) Scan(value any) error { if value == nil { ns.Status, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go index fa6aab4565..2dae43629e 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( StatusShut Status = "shut" ) -func (e *Status) Scan(src interface{}) error { +func (e *Status) Scan(src any) error { switch s := src.(type) { case []byte: *e = Status(s) @@ -34,7 +34,7 @@ type NullStatus struct { } // Scan implements the Scanner interface. -func (ns *NullStatus) Scan(value interface{}) error { +func (ns *NullStatus) Scan(value any) error { if value == nil { ns.Status, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go index 7fa9c3c7d0..c1311295a5 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -19,7 +19,7 @@ const ( LevelFATAL Level = "FATAL" ) -func (e *Level) Scan(src interface{}) error { +func (e *Level) Scan(src any) error { switch s := src.(type) { case []byte: *e = Level(s) @@ -37,7 +37,7 @@ type NullLevel struct { } // Scan implements the Scanner interface. -func (ns *NullLevel) Scan(value interface{}) error { +func (ns *NullLevel) Scan(value any) error { if value == nil { ns.Level, ns.Valid = "", false return nil @@ -61,7 +61,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -79,7 +79,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go index ee28f7d924..22ba6e5467 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go index 7fa9c3c7d0..c1311295a5 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -19,7 +19,7 @@ const ( LevelFATAL Level = "FATAL" ) -func (e *Level) Scan(src interface{}) error { +func (e *Level) Scan(src any) error { switch s := src.(type) { case []byte: *e = Level(s) @@ -37,7 +37,7 @@ type NullLevel struct { } // Scan implements the Scanner interface. -func (ns *NullLevel) Scan(value interface{}) error { +func (ns *NullLevel) Scan(value any) error { if value == nil { ns.Level, ns.Valid = "", false return nil @@ -61,7 +61,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -79,7 +79,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go index ee28f7d924..22ba6e5467 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go index 7fa9c3c7d0..c1311295a5 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -19,7 +19,7 @@ const ( LevelFATAL Level = "FATAL" ) -func (e *Level) Scan(src interface{}) error { +func (e *Level) Scan(src any) error { switch s := src.(type) { case []byte: *e = Level(s) @@ -37,7 +37,7 @@ type NullLevel struct { } // Scan implements the Scanner interface. -func (ns *NullLevel) Scan(value interface{}) error { +func (ns *NullLevel) Scan(value any) error { if value == nil { ns.Level, ns.Valid = "", false return nil @@ -61,7 +61,7 @@ const ( NewEventSTOP NewEvent = "STOP" ) -func (e *NewEvent) Scan(src interface{}) error { +func (e *NewEvent) Scan(src any) error { switch s := src.(type) { case []byte: *e = NewEvent(s) @@ -79,7 +79,7 @@ type NullNewEvent struct { } // Scan implements the Scanner interface. -func (ns *NullNewEvent) Scan(value interface{}) error { +func (ns *NullNewEvent) Scan(value any) error { if value == nil { ns.NewEvent, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go index 76a39e43cd..6b9793aff1 100644 --- a/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_alter_type_set_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/db.go b/internal/endtoend/testdata/ddl_comment/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/models.go b/internal/endtoend/testdata/ddl_comment/mysql/go/models.go index af1424acd8..5de5279a9c 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go index 179acb7630..0ddf446d84 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( FooBatBat FooBat = "bat" ) -func (e *FooBat) Scan(src interface{}) error { +func (e *FooBat) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooBat(s) @@ -35,7 +35,7 @@ type NullFooBat struct { } // Scan implements the Scanner interface. -func (ns *NullFooBat) Scan(value interface{}) error { +func (ns *NullFooBat) Scan(value any) error { if value == nil { ns.FooBat, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go index d89c7240ac..56ac46aa73 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -18,7 +18,7 @@ const ( FooBatBat FooBat = "bat" ) -func (e *FooBat) Scan(src interface{}) error { +func (e *FooBat) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooBat(s) @@ -36,7 +36,7 @@ type NullFooBat struct { } // Scan implements the Scanner interface. -func (ns *NullFooBat) Scan(value interface{}) error { +func (ns *NullFooBat) Scan(value any) error { if value == nil { ns.FooBat, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go index 179acb7630..0ddf446d84 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( FooBatBat FooBat = "bat" ) -func (e *FooBat) Scan(src interface{}) error { +func (e *FooBat) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooBat(s) @@ -35,7 +35,7 @@ type NullFooBat struct { } // Scan implements the Scanner interface. -func (ns *NullFooBat) Scan(value interface{}) error { +func (ns *NullFooBat) Scan(value any) error { if value == nil { ns.FooBat, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go index 44ff83236c..fe75a34b3e 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -26,7 +26,7 @@ const ( FooDigitValue11 FooDigit = "*" ) -func (e *FooDigit) Scan(src interface{}) error { +func (e *FooDigit) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooDigit(s) @@ -44,7 +44,7 @@ type NullFooDigit struct { } // Scan implements the Scanner interface. -func (ns *NullFooDigit) Scan(value interface{}) error { +func (ns *NullFooDigit) Scan(value any) error { if value == nil { ns.FooDigit, ns.Valid = "", false return nil @@ -73,7 +73,7 @@ const ( FooFoobarFoog FooFoobar = "foo!g" ) -func (e *FooFoobar) Scan(src interface{}) error { +func (e *FooFoobar) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooFoobar(s) @@ -91,7 +91,7 @@ type NullFooFoobar struct { } // Scan implements the Scanner interface. -func (ns *NullFooFoobar) Scan(value interface{}) error { +func (ns *NullFooFoobar) Scan(value any) error { if value == nil { ns.FooFoobar, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go index 8bd1cc3339..1a5a73200e 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go index f56bbc4c4a..55160bf6fd 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -26,7 +26,7 @@ const ( DigitValue11 Digit = "*" ) -func (e *Digit) Scan(src interface{}) error { +func (e *Digit) Scan(src any) error { switch s := src.(type) { case []byte: *e = Digit(s) @@ -44,7 +44,7 @@ type NullDigit struct { } // Scan implements the Scanner interface. -func (ns *NullDigit) Scan(value interface{}) error { +func (ns *NullDigit) Scan(value any) error { if value == nil { ns.Digit, ns.Valid = "", false return nil @@ -73,7 +73,7 @@ const ( FoobarFoog Foobar = "foo!g" ) -func (e *Foobar) Scan(src interface{}) error { +func (e *Foobar) Scan(src any) error { switch s := src.(type) { case []byte: *e = Foobar(s) @@ -91,7 +91,7 @@ type NullFoobar struct { } // Scan implements the Scanner interface. -func (ns *NullFoobar) Scan(value interface{}) error { +func (ns *NullFoobar) Scan(value any) error { if value == nil { ns.Foobar, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go index c1e55527b6..0b678224d9 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go index f56bbc4c4a..55160bf6fd 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -26,7 +26,7 @@ const ( DigitValue11 Digit = "*" ) -func (e *Digit) Scan(src interface{}) error { +func (e *Digit) Scan(src any) error { switch s := src.(type) { case []byte: *e = Digit(s) @@ -44,7 +44,7 @@ type NullDigit struct { } // Scan implements the Scanner interface. -func (ns *NullDigit) Scan(value interface{}) error { +func (ns *NullDigit) Scan(value any) error { if value == nil { ns.Digit, ns.Valid = "", false return nil @@ -73,7 +73,7 @@ const ( FoobarFoog Foobar = "foo!g" ) -func (e *Foobar) Scan(src interface{}) error { +func (e *Foobar) Scan(src any) error { switch s := src.(type) { case []byte: *e = Foobar(s) @@ -91,7 +91,7 @@ type NullFoobar struct { } // Scan implements the Scanner interface. -func (ns *NullFoobar) Scan(value interface{}) error { +func (ns *NullFoobar) Scan(value any) error { if value == nil { ns.Foobar, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go index c1e55527b6..0b678224d9 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go index f56bbc4c4a..55160bf6fd 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -26,7 +26,7 @@ const ( DigitValue11 Digit = "*" ) -func (e *Digit) Scan(src interface{}) error { +func (e *Digit) Scan(src any) error { switch s := src.(type) { case []byte: *e = Digit(s) @@ -44,7 +44,7 @@ type NullDigit struct { } // Scan implements the Scanner interface. -func (ns *NullDigit) Scan(value interface{}) error { +func (ns *NullDigit) Scan(value any) error { if value == nil { ns.Digit, ns.Valid = "", false return nil @@ -73,7 +73,7 @@ const ( FoobarFoog Foobar = "foo!g" ) -func (e *Foobar) Scan(src interface{}) error { +func (e *Foobar) Scan(src any) error { switch s := src.(type) { case []byte: *e = Foobar(s) @@ -91,7 +91,7 @@ type NullFoobar struct { } // Scan implements the Scanner interface. -func (ns *NullFoobar) Scan(value interface{}) error { +func (ns *NullFoobar) Scan(value any) error { if value == nil { ns.Foobar, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go index fb52339618..7c474a58e5 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_func_exists/exec.json b/internal/endtoend/testdata/ddl_create_func_exists/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_func_exists/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_args/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go index bc7405df4a..131b306c39 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go index b9d37effdf..60db046ca1 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go index bc7405df4a..131b306c39 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go index db689f1419..65ec5313d2 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go index 21e01b8039..8ed71f6a7b 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go index db689f1419..65ec5313d2 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go index bc7405df4a..131b306c39 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go index fb298cbe34..8a4bc9a6c5 100644 --- a/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_procedure/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go index 71937e08a4..a2d2dc1e32 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go index 71937e08a4..a2d2dc1e32 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go index 0b7d31316c..bea173dbc2 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go index 71937e08a4..a2d2dc1e32 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go index 71937e08a4..a2d2dc1e32 100644 --- a/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go index 1b324e0f0b..9822696749 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go index c5e69d6eaf..a911debc03 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go index 1b324e0f0b..9822696749 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_include/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go index aa2ce5bb53..5b533a69c7 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go index a7c8ebf655..4e956ff8fe 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go index 64845fa3df..dd50ec47ed 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go index a7c8ebf655..4e956ff8fe 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go index aa2ce5bb53..5b533a69c7 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go index 0a9e63d669..797e41c58c 100644 --- a/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_inherits/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/exec.json b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_invalid_inherits/postgresql/stdlib/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_create_table_like/issue.md b/internal/endtoend/testdata/ddl_create_table_like/issue.md new file mode 100644 index 0000000000..371a25581d --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/481 diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/db.go b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..5c416bd286 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Change struct { + Ranked int32 +} + +type ChangesRanked struct { + Ranked int32 + RankByEffectSize int32 + RankByAbsPercentChange int32 +} diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..c399414100 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const allRanked = `-- name: AllRanked :many +SELECT ranked, rank_by_effect_size, rank_by_abs_percent_change FROM changes_ranked +` + +func (q *Queries) AllRanked(ctx context.Context) ([]ChangesRanked, error) { + rows, err := q.db.Query(ctx, allRanked) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ChangesRanked + for rows.Next() { + var i ChangesRanked + if err := rows.Scan(&i.Ranked, &i.RankByEffectSize, &i.RankByAbsPercentChange); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/query.sql b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/query.sql new file mode 100644 index 0000000000..759ef862de --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: AllRanked :many +SELECT * FROM changes_ranked; diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/schema.sql b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..7365737bab --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE changes ( + ranked INT NOT NULL +); + +CREATE TABLE changes_ranked ( + LIKE changes INCLUDING ALL, + rank_by_effect_size INT NOT NULL, + rank_by_abs_percent_change INT NOT NULL +); diff --git a/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_like/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go index 194051cd22..a48458062b 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go index 213aa6fed6..802b9213cc 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go index 194051cd22..a48458062b 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go index 4e5797e425..7fce81d467 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go index 4e5797e425..7fce81d467 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go index e19b8ce8cc..f11f67a6ec 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go index 4e5797e425..7fce81d467 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_reserved/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go index 71937e08a4..a2d2dc1e32 100644 --- a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_strict/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/issue.md b/internal/endtoend/testdata/ddl_create_table_unknown_type/issue.md new file mode 100644 index 0000000000..39b617cc6a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1917 diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/exec.json b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/exec.json new file mode 100644 index 0000000000..abd3ab549c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["unknown"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/query.sql b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/query.sql new file mode 100644 index 0000000000..299eb45e2e --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: SelectOne :one +SELECT 1; diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/schema.sql b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..70cd3cf93a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE test_table ( + id STRING +); diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..2cfd3bad96 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_table_unknown_type/postgresql/pgx/stderr.txt @@ -0,0 +1,5 @@ +# package querytest +query.sql:1:1: rpc error: code = FailedPrecondition desc = type "string" does not exist (42704) +CREATE TABLE test_table ( + id STRING +); diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go index 150616bbf2..2dff89578a 100644 --- a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_table_without_rowid/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go index 2894e13b9d..198cfdf8ed 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go index bfa37ae88f..39e8dc760a 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go index 2894e13b9d..198cfdf8ed 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go index d164ec581b..55be7fceca 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -18,3 +18,14 @@ type CustomerAddress struct { CustID int64 CustAddr sql.NullString } + +type TriggerCustomer struct { + Name string + Address sql.NullString +} + +type TriggerOrder struct { + ID int64 + CustomerName sql.NullString + Address sql.NullString +} diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_trigger/sqlite/schema.sql b/internal/endtoend/testdata/ddl_create_trigger/sqlite/schema.sql index 9143d0c069..59df748064 100644 --- a/internal/endtoend/testdata/ddl_create_trigger/sqlite/schema.sql +++ b/internal/endtoend/testdata/ddl_create_trigger/sqlite/schema.sql @@ -1,9 +1,20 @@ /* examples copied from https://www.sqlite.org/lang_createtrigger.html only expectation in sqlc is that they parse, codegen is unaffected */ -CREATE TRIGGER update_customer_address UPDATE OF address ON customers +CREATE TABLE trigger_customers ( + name TEXT PRIMARY KEY, + address TEXT +); + +CREATE TABLE trigger_orders ( + id INTEGER PRIMARY KEY, + customer_name TEXT, + address TEXT +); + +CREATE TRIGGER update_customer_address UPDATE OF address ON trigger_customers BEGIN - UPDATE orders SET address = new.address WHERE customer_name = old.name; + UPDATE trigger_orders SET address = new.address WHERE customer_name = old.name; END; CREATE TABLE customer( diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_args/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_function_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/exec.json b/internal/endtoend/testdata/ddl_drop_schema/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_schema_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql b/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql index d2ea37a051..c0b8f00ed1 100644 --- a/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql +++ b/internal/endtoend/testdata/ddl_drop_table/sqlite/schema.sql @@ -1,2 +1,8 @@ CREATE TABLE venues (hi text); -DROP TABLE venues; \ No newline at end of file +DROP TABLE venues; + +CREATE TABLE Authors (id integer); +DROP TABLE Authors; + +CREATE TABLE "Books" (id integer); +DROP TABLE "Books"; diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_if_exists/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_table_in_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_if_exists/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_drop_type_in_schema/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go index c31f6d04d7..7dda389dca 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go index 3496b9eb8b..dde43ee2a5 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go index c31f6d04d7..7dda389dca 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_generated_columns/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/issue.md b/internal/endtoend/testdata/ddl_materialized_views_invalid/issue.md new file mode 100644 index 0000000000..21df2f08dd --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1545 diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/exec.json b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/query.sql b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/query.sql new file mode 100644 index 0000000000..b9fa4a4eb3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: GetTotalEarned :one +SELECT COALESCE(SUM(earned), 0) as total_earned +FROM grouped_kpis +WHERE day = @day; diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/schema.sql b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..d95036a96a --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE kpis ( + ts TIMESTAMPTZ, + event_id TEXT NOT NULL +); + +CREATE MATERIALIZED VIEW IF NOT EXISTS grouped_kpis AS +SELECT date_trunc('1 day', ts) as day, COUNT(*) +FROM kpis +GROUP BY 1; diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..e79676465e --- /dev/null +++ b/internal/endtoend/testdata/ddl_materialized_views_invalid/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:2:21: column "earned" does not exist diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go index 5f2dec0a83..db5ec04037 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go index cda8f80dbd..146125bc17 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go index 5dc3ab21b4..8a2db174a7 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go index 5f2dec0a83..db5ec04037 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go index dec25cb784..80e5d9bd3f 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/issue.md b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/issue.md new file mode 100644 index 0000000000..6b8f89e934 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/3371 \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/exec.json b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/db.go new file mode 100644 index 0000000000..9ca5876e4a --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..508afefacd --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} + +type AuthorsMv struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..cb67855dbb --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthorMv = `-- name: GetAuthorMv :one +SELECT id, name, bio FROM authors_mv +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthorMv(ctx context.Context, id int64) (AuthorsMv, error) { + row := q.db.QueryRow(ctx, getAuthorMv, id) + var i AuthorsMv + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/query.sql new file mode 100644 index 0000000000..752a6f4d47 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthorMv :one +SELECT * FROM authors_mv +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/schema.sql new file mode 100644 index 0000000000..3f88871f93 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE MATERIALIZED VIEW authors_mv AS ( + SELECT * FROM authors +); + +CREATE MATERIALIZED VIEW authors_mv_new AS ( + SELECT * FROM authors +); + +ALTER MATERIALIZED VIEW authors_mv RENAME TO authors_mv_old; +ALTER MATERIALIZED VIEW authors_mv_new RENAME TO authors_mv; + +DROP MATERIALIZED VIEW authors_mv_old; diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/sqlc.yaml b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/sqlc.yaml new file mode 100644 index 0000000000..3440c3f119 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v4/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v4" diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..43407702cb --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/models.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} + +type AuthorsMv struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..cb67855dbb --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthorMv = `-- name: GetAuthorMv :one +SELECT id, name, bio FROM authors_mv +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthorMv(ctx context.Context, id int64) (AuthorsMv, error) { + row := q.db.QueryRow(ctx, getAuthorMv, id) + var i AuthorsMv + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..752a6f4d47 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthorMv :one +SELECT * FROM authors_mv +WHERE id = $1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..3f88871f93 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE MATERIALIZED VIEW authors_mv AS ( + SELECT * FROM authors +); + +CREATE MATERIALIZED VIEW authors_mv_new AS ( + SELECT * FROM authors +); + +ALTER MATERIALIZED VIEW authors_mv RENAME TO authors_mv_old; +ALTER MATERIALIZED VIEW authors_mv_new RENAME TO authors_mv; + +DROP MATERIALIZED VIEW authors_mv_old; diff --git a/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/sqlc.yaml b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/ddl_rename_drop_materialized_views/postgresql/pgx/v5/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/ddl_spanner/googlesql/exec.json b/internal/endtoend/testdata/ddl_spanner/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/ddl_spanner/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/ddl_spanner/googlesql/go/db.go b/internal/endtoend/testdata/ddl_spanner/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/ddl_spanner/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/ddl_spanner/googlesql/go/models.go b/internal/endtoend/testdata/ddl_spanner/googlesql/go/models.go new file mode 100644 index 0000000000..973faeb46e --- /dev/null +++ b/internal/endtoend/testdata/ddl_spanner/googlesql/go/models.go @@ -0,0 +1,35 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" + "time" + + "cloud.google.com/go/spanner" +) + +type Album struct { + SingerID int64 + AlbumID int64 + Title sql.NullString + CreatedAt sql.NullTime +} + +type Singer struct { + SingerID int64 + FirstName sql.NullString + LastName string + FullName string + Active bool + UpdatedAt time.Time +} + +type Ticket struct { + TicketID int64 + SingerID int64 + SeatID sql.NullInt64 + Embedding []spanner.NullFloat32 +} diff --git a/internal/endtoend/testdata/ddl_spanner/googlesql/go/query.sql.go b/internal/endtoend/testdata/ddl_spanner/googlesql/go/query.sql.go new file mode 100644 index 0000000000..34ff922f61 --- /dev/null +++ b/internal/endtoend/testdata/ddl_spanner/googlesql/go/query.sql.go @@ -0,0 +1,109 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const listAlbums = `-- name: ListAlbums :many +SELECT singer_id, album_id, title, created_at FROM albums WHERE singer_id = @singer_id +` + +func (q *Queries) ListAlbums(ctx context.Context, singerID int64) ([]Album, error) { + rows, err := q.db.QueryContext(ctx, listAlbums, sql.Named("singer_id", singerID)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Album + for rows.Next() { + var i Album + if err := rows.Scan( + &i.SingerID, + &i.AlbumID, + &i.Title, + &i.CreatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listSingers = `-- name: ListSingers :many +SELECT singer_id, first_name, last_name, full_name, active, updated_at FROM singers +` + +func (q *Queries) ListSingers(ctx context.Context) ([]Singer, error) { + rows, err := q.db.QueryContext(ctx, listSingers) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Singer + for rows.Next() { + var i Singer + if err := rows.Scan( + &i.SingerID, + &i.FirstName, + &i.LastName, + &i.FullName, + &i.Active, + &i.UpdatedAt, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listTickets = `-- name: ListTickets :many +SELECT ticket_id, singer_id, seat_id, embedding FROM tickets +` + +func (q *Queries) ListTickets(ctx context.Context) ([]Ticket, error) { + rows, err := q.db.QueryContext(ctx, listTickets) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Ticket + for rows.Next() { + var i Ticket + if err := rows.Scan( + &i.TicketID, + &i.SingerID, + &i.SeatID, + &i.Embedding, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/ddl_spanner/googlesql/query.sql b/internal/endtoend/testdata/ddl_spanner/googlesql/query.sql new file mode 100644 index 0000000000..c42d016638 --- /dev/null +++ b/internal/endtoend/testdata/ddl_spanner/googlesql/query.sql @@ -0,0 +1,8 @@ +-- name: ListSingers :many +SELECT * FROM singers; + +-- name: ListAlbums :many +SELECT * FROM albums WHERE singer_id = @singer_id; + +-- name: ListTickets :many +SELECT * FROM tickets; diff --git a/internal/endtoend/testdata/ddl_spanner/googlesql/schema.sql b/internal/endtoend/testdata/ddl_spanner/googlesql/schema.sql new file mode 100644 index 0000000000..fb0203267e --- /dev/null +++ b/internal/endtoend/testdata/ddl_spanner/googlesql/schema.sql @@ -0,0 +1,42 @@ +CREATE SEQUENCE ticket_ids OPTIONS (sequence_kind = 'bit_reversed_positive'); + +CREATE TABLE singers ( + singer_id INT64 NOT NULL, + first_name STRING(1024), + last_name STRING(1024) NOT NULL, + full_name STRING(2048) NOT NULL AS (ARRAY_TO_STRING([first_name, last_name], ' ')) STORED, + active BOOL NOT NULL DEFAULT (true), + updated_at TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp = true), + name_tokens TOKENLIST AS (TOKENIZE_FULLTEXT(last_name)) HIDDEN, +) PRIMARY KEY (singer_id); + +CREATE TABLE albums ( + singer_id INT64 NOT NULL, + album_id INT64 NOT NULL, + title STRING(MAX), + created_at TIMESTAMP, + CONSTRAINT title_not_empty CHECK (title != ''), +) PRIMARY KEY (singer_id, album_id), + INTERLEAVE IN PARENT singers ON DELETE CASCADE, + ROW DELETION POLICY (OLDER_THAN(created_at, INTERVAL 30 DAY)); + +CREATE TABLE tickets ( + ticket_id INT64 NOT NULL DEFAULT (GET_NEXT_SEQUENCE_VALUE(SEQUENCE ticket_ids)), + singer_id INT64 NOT NULL, + seat_id INT64 GENERATED BY DEFAULT AS IDENTITY (BIT_REVERSED_POSITIVE), + embedding ARRAY(vector_length=>3), + CONSTRAINT fk_singer FOREIGN KEY (singer_id) REFERENCES singers (singer_id), +) PRIMARY KEY (ticket_id); + +CREATE INDEX albums_by_title ON albums(title); +CREATE UNIQUE NULL_FILTERED INDEX singers_by_last_name ON singers(last_name) STORING (first_name); +CREATE SEARCH INDEX singers_by_name_tokens ON singers(name_tokens); +CREATE VECTOR INDEX tickets_by_embedding ON tickets(embedding) WHERE embedding IS NOT NULL OPTIONS (distance_type = 'COSINE'); + +CREATE CHANGE STREAM everything FOR ALL; +CREATE CHANGE STREAM singer_changes FOR singers(first_name, last_name) OPTIONS (retention_period = '7d'); + +CREATE ROLE reader; +GRANT SELECT ON TABLE singers, albums TO ROLE reader; + +ALTER TABLE albums REPLACE ROW DELETION POLICY (OLDER_THAN(created_at, INTERVAL 60 DAY)); diff --git a/internal/endtoend/testdata/ddl_spanner/googlesql/sqlc.json b/internal/endtoend/testdata/ddl_spanner/googlesql/sqlc.json new file mode 100644 index 0000000000..40d6c76211 --- /dev/null +++ b/internal/endtoend/testdata/ddl_spanner/googlesql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "googlesql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/delete_from/mysql/go/db.go b/internal/endtoend/testdata/delete_from/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/db.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/delete_from/mysql/go/models.go b/internal/endtoend/testdata/delete_from/mysql/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/models.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go b/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go index 851d1b12f7..a314078bdd 100644 --- a/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go index 5a6226f580..e23a77b11b 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go index 5a6226f580..e23a77b11b 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go index fbc6cabb0e..f489dfe95c 100644 --- a/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_from/sqlite/go/db.go b/internal/endtoend/testdata/delete_from/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/delete_from/sqlite/go/db.go +++ b/internal/endtoend/testdata/delete_from/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/delete_from/sqlite/go/models.go b/internal/endtoend/testdata/delete_from/sqlite/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/delete_from/sqlite/go/models.go +++ b/internal/endtoend/testdata/delete_from/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go b/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go index 851d1b12f7..a314078bdd 100644 --- a/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/delete_from/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go index 437de4d444..71cdddc210 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Author struct { ID uint32 Name string diff --git a/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go b/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go index 5a867bb1bf..9755fc008b 100644 --- a/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/delete_inner_join/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/delete_join/mysql/db/db.go b/internal/endtoend/testdata/delete_join/mysql/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/delete_join/mysql/db/db.go +++ b/internal/endtoend/testdata/delete_join/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/delete_join/mysql/db/models.go b/internal/endtoend/testdata/delete_join/mysql/db/models.go index 2e43afa8ec..73ac86fe23 100644 --- a/internal/endtoend/testdata/delete_join/mysql/db/models.go +++ b/internal/endtoend/testdata/delete_join/mysql/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db -import () - type JoinTable struct { ID uint64 PrimaryTableID uint64 diff --git a/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go b/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go index c4784e2d38..8af3119a9c 100644 --- a/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/delete_join/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db @@ -30,6 +30,17 @@ func (q *Queries) DeleteJoin(ctx context.Context, arg DeleteJoinParams) error { return err } +const deleteJoinWithSubquery = `-- name: DeleteJoinWithSubquery :exec +DELETE pt +FROM primary_table pt +JOIN (SELECT 1 as id) jt ON pt.id = jt.id +` + +func (q *Queries) DeleteJoinWithSubquery(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, deleteJoinWithSubquery) + return err +} + const deleteLeftJoin = `-- name: DeleteLeftJoin :exec DELETE jt.*, pt.* diff --git a/internal/endtoend/testdata/delete_join/mysql/query.sql b/internal/endtoend/testdata/delete_join/mysql/query.sql index d802ae12f1..d29062f90e 100644 --- a/internal/endtoend/testdata/delete_join/mysql/query.sql +++ b/internal/endtoend/testdata/delete_join/mysql/query.sql @@ -26,4 +26,9 @@ FROM RIGHT JOIN primary_table as pt ON jt.primary_table_id = pt.id WHERE jt.id = ? - AND pt.user_id = ?; \ No newline at end of file + AND pt.user_id = ?; + +-- name: DeleteJoinWithSubquery :exec +DELETE pt +FROM primary_table pt +JOIN (SELECT 1 as id) jt ON pt.id = jt.id; diff --git a/internal/endtoend/testdata/delete_using/issue.md b/internal/endtoend/testdata/delete_using/issue.md new file mode 100644 index 0000000000..c3fc394ad0 --- /dev/null +++ b/internal/endtoend/testdata/delete_using/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1714 diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/exec.json b/internal/endtoend/testdata/delete_using/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/go/db.go b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/go/models.go b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..a0041d0160 --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type A struct { + AID pgtype.Text + BIDFk pgtype.Text +} + +type B struct { + BID pgtype.Text +} diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..0e5ca9c70d --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/go/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getSomeDeletedNotOk = `-- name: GetSomeDeletedNotOk :many +DELETE FROM a +USING b +WHERE a.b_id_fk = b.b_id +RETURNING b.b_id +` + +func (q *Queries) GetSomeDeletedNotOk(ctx context.Context) ([]pgtype.Text, error) { + rows, err := q.db.Query(ctx, getSomeDeletedNotOk) + if err != nil { + return nil, err + } + defer rows.Close() + var items []pgtype.Text + for rows.Next() { + var b_id pgtype.Text + if err := rows.Scan(&b_id); err != nil { + return nil, err + } + items = append(items, b_id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/query.sql b/internal/endtoend/testdata/delete_using/postgresql/pgx/query.sql new file mode 100644 index 0000000000..f660aaf95d --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/query.sql @@ -0,0 +1,5 @@ +-- name: GetSomeDeletedNotOk :many +DELETE FROM a +USING b +WHERE a.b_id_fk = b.b_id +RETURNING b.b_id; -- column "b_id" does not exist diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/schema.sql b/internal/endtoend/testdata/delete_using/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..d6380b7a5f --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE a +( + a_id TEXT, + b_id_fk TEXT +); +CREATE TABLE b +( + b_id TEXT +); diff --git a/internal/endtoend/testdata/delete_using/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/delete_using/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/delete_using/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/diff_no_output/go/db.go b/internal/endtoend/testdata/diff_no_output/go/db.go index f5d9de7305..32f660cdd7 100644 --- a/internal/endtoend/testdata/diff_no_output/go/db.go +++ b/internal/endtoend/testdata/diff_no_output/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/diff_no_output/go/models.go b/internal/endtoend/testdata/diff_no_output/go/models.go index 559ef910b8..806d699cf9 100644 --- a/internal/endtoend/testdata/diff_no_output/go/models.go +++ b/internal/endtoend/testdata/diff_no_output/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors diff --git a/internal/endtoend/testdata/diff_no_output/go/query.sql.go b/internal/endtoend/testdata/diff_no_output/go/query.sql.go index 477e08c61b..06188537ee 100644 --- a/internal/endtoend/testdata/diff_no_output/go/query.sql.go +++ b/internal/endtoend/testdata/diff_no_output/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package authors diff --git a/internal/endtoend/testdata/diff_output/go/db.go b/internal/endtoend/testdata/diff_output/go/db.go index f5d9de7305..32f660cdd7 100644 --- a/internal/endtoend/testdata/diff_output/go/db.go +++ b/internal/endtoend/testdata/diff_output/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/diff_output/go/models.go b/internal/endtoend/testdata/diff_output/go/models.go index ec61702f5a..62bacd80ae 100644 --- a/internal/endtoend/testdata/diff_output/go/models.go +++ b/internal/endtoend/testdata/diff_output/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package authors diff --git a/internal/endtoend/testdata/diff_output/go/query.sql.go b/internal/endtoend/testdata/diff_output/go/query.sql.go index a3864f0d97..3024509385 100644 --- a/internal/endtoend/testdata/diff_output/go/query.sql.go +++ b/internal/endtoend/testdata/diff_output/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package authors diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/db.go b/internal/endtoend/testdata/do/postgresql/pgx/db/db.go index bcfcc9d2f4..42578b7b5a 100644 --- a/internal/endtoend/testdata/do/postgresql/pgx/db/db.go +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/models.go b/internal/endtoend/testdata/do/postgresql/pgx/db/models.go index 62f0b05e93..761ab0cffc 100644 --- a/internal/endtoend/testdata/do/postgresql/pgx/db/models.go +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go index c3ca6625bc..06e1c1e75b 100644 --- a/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/db.go b/internal/endtoend/testdata/do/postgresql/pq/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/do/postgresql/pq/db/db.go +++ b/internal/endtoend/testdata/do/postgresql/pq/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/models.go b/internal/endtoend/testdata/do/postgresql/pq/db/models.go index f8bcd76317..56c9d4a035 100644 --- a/internal/endtoend/testdata/do/postgresql/pq/db/models.go +++ b/internal/endtoend/testdata/do/postgresql/pq/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go index 2b17e3deff..5d7824c46e 100644 --- a/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go +++ b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/duckdb_json/duckdb/exec.json b/internal/endtoend/testdata/duckdb_json/duckdb/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/duckdb_json/duckdb/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/duckdb_json/duckdb/go/db.go b/internal/endtoend/testdata/duckdb_json/duckdb/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/duckdb_json/duckdb/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/duckdb_json/duckdb/go/models.go b/internal/endtoend/testdata/duckdb_json/duckdb/go/models.go new file mode 100644 index 0000000000..8b39d96e50 --- /dev/null +++ b/internal/endtoend/testdata/duckdb_json/duckdb/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Event struct { + ID int32 + Payload any + Meta any +} diff --git a/internal/endtoend/testdata/duckdb_json/duckdb/go/query.sql.go b/internal/endtoend/testdata/duckdb_json/duckdb/go/query.sql.go new file mode 100644 index 0000000000..75cce3477f --- /dev/null +++ b/internal/endtoend/testdata/duckdb_json/duckdb/go/query.sql.go @@ -0,0 +1,92 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const createEvent = `-- name: CreateEvent :exec +INSERT INTO events (id, payload, meta) VALUES ($1, $2, $3); +` + +type CreateEventParams struct { + ID int32 + Payload string + Meta sql.NullString +} + +func (q *Queries) CreateEvent(ctx context.Context, arg CreateEventParams) error { + _, err := q.db.ExecContext(ctx, createEvent, arg.ID, arg.Payload, arg.Meta) + return err +} + +const eventKind = `-- name: EventKind :one +SELECT json_extract(payload, '$.kind') AS kind, json_extract_string(payload, '$.kind') AS kind_text +FROM events WHERE id = $1; +` + +type EventKindRow struct { + Kind any + KindText string +} + +func (q *Queries) EventKind(ctx context.Context, id int32) (EventKindRow, error) { + row := q.db.QueryRowContext(ctx, eventKind, id) + var i EventKindRow + err := row.Scan(&i.Kind, &i.KindText) + return i, err +} + +const eventsByPayload = `-- name: EventsByPayload :many +SELECT id FROM events WHERE payload = $1; +` + +func (q *Queries) EventsByPayload(ctx context.Context, payload string) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, eventsByPayload, payload) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var id int32 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const getEvent = `-- name: GetEvent :one +SELECT id, payload, meta FROM events WHERE id = $1; +` + +func (q *Queries) GetEvent(ctx context.Context, id int32) (Event, error) { + row := q.db.QueryRowContext(ctx, getEvent, id) + var i Event + err := row.Scan(&i.ID, &i.Payload, &i.Meta) + return i, err +} + +const payloadText = `-- name: PayloadText :one +SELECT CAST(payload AS VARCHAR) AS payload_text FROM events WHERE id = $1; +` + +func (q *Queries) PayloadText(ctx context.Context, id int32) (string, error) { + row := q.db.QueryRowContext(ctx, payloadText, id) + var payload_text string + err := row.Scan(&payload_text) + return payload_text, err +} diff --git a/internal/endtoend/testdata/duckdb_json/duckdb/query.sql b/internal/endtoend/testdata/duckdb_json/duckdb/query.sql new file mode 100644 index 0000000000..51fa6b4918 --- /dev/null +++ b/internal/endtoend/testdata/duckdb_json/duckdb/query.sql @@ -0,0 +1,15 @@ +-- name: CreateEvent :exec +INSERT INTO events (id, payload, meta) VALUES ($1, $2, $3); + +-- name: GetEvent :one +SELECT id, payload, meta FROM events WHERE id = $1; + +-- name: EventKind :one +SELECT json_extract(payload, '$.kind') AS kind, json_extract_string(payload, '$.kind') AS kind_text +FROM events WHERE id = $1; + +-- name: EventsByPayload :many +SELECT id FROM events WHERE payload = $1; + +-- name: PayloadText :one +SELECT CAST(payload AS VARCHAR) AS payload_text FROM events WHERE id = $1; diff --git a/internal/endtoend/testdata/duckdb_json/duckdb/schema.sql b/internal/endtoend/testdata/duckdb_json/duckdb/schema.sql new file mode 100644 index 0000000000..cdf21de7bf --- /dev/null +++ b/internal/endtoend/testdata/duckdb_json/duckdb/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE events ( + id INTEGER PRIMARY KEY, + payload JSON NOT NULL, + meta JSON +); diff --git a/internal/endtoend/testdata/duckdb_json/duckdb/sqlc.yaml b/internal/endtoend/testdata/duckdb_json/duckdb/sqlc.yaml new file mode 100644 index 0000000000..07d6d9d3b8 --- /dev/null +++ b/internal/endtoend/testdata/duckdb_json/duckdb/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "duckdb" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/duplicate_go_names/enum/query.sql b/internal/endtoend/testdata/duplicate_go_names/enum/query.sql new file mode 100644 index 0000000000..760e82582e --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/enum/query.sql @@ -0,0 +1,2 @@ +-- name: GetFoos :many +SELECT * FROM foos; \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/enum/schema.sql b/internal/endtoend/testdata/duplicate_go_names/enum/schema.sql new file mode 100644 index 0000000000..d0ac445ab1 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/enum/schema.sql @@ -0,0 +1,3 @@ +CREATE TYPE foo AS ENUM (); + +CREATE TABLE foos (); \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/enum/sqlc.yaml b/internal/endtoend/testdata/duplicate_go_names/enum/sqlc.yaml new file mode 100644 index 0000000000..48946b0279 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/enum/sqlc.yaml @@ -0,0 +1,8 @@ +version: "2" +sql: +- schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + out: "db" diff --git a/internal/endtoend/testdata/duplicate_go_names/enum/stderr.txt b/internal/endtoend/testdata/duplicate_go_names/enum/stderr.txt new file mode 100644 index 0000000000..e6d206bda7 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/enum/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: struct name conflicts with enum name: Foo diff --git a/internal/endtoend/testdata/duplicate_go_names/null_enum/query.sql b/internal/endtoend/testdata/duplicate_go_names/null_enum/query.sql new file mode 100644 index 0000000000..fcb2e75923 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/null_enum/query.sql @@ -0,0 +1,2 @@ +-- name: GetFoos :many +SELECT * FROM null_foos; \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/null_enum/schema.sql b/internal/endtoend/testdata/duplicate_go_names/null_enum/schema.sql new file mode 100644 index 0000000000..46fe734fe0 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/null_enum/schema.sql @@ -0,0 +1,3 @@ +CREATE TYPE foo AS ENUM (); + +CREATE TABLE null_foos (); \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/null_enum/sqlc.yaml b/internal/endtoend/testdata/duplicate_go_names/null_enum/sqlc.yaml new file mode 100644 index 0000000000..48946b0279 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/null_enum/sqlc.yaml @@ -0,0 +1,8 @@ +version: "2" +sql: +- schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + out: "db" diff --git a/internal/endtoend/testdata/duplicate_go_names/null_enum/stderr.txt b/internal/endtoend/testdata/duplicate_go_names/null_enum/stderr.txt new file mode 100644 index 0000000000..16321a008f --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/null_enum/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: struct name conflicts with enum name: NullFoo diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/query.sql b/internal/endtoend/testdata/duplicate_go_names/query_constant/query.sql new file mode 100644 index 0000000000..fc3436d4c5 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/query.sql @@ -0,0 +1,2 @@ +-- name: Foo :one +SELECT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/schema.sql b/internal/endtoend/testdata/duplicate_go_names/query_constant/schema.sql new file mode 100644 index 0000000000..a0ed9c3aba --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/schema.sql @@ -0,0 +1 @@ +CREATE TYPE foo AS ENUM (); diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/sqlc.yaml b/internal/endtoend/testdata/duplicate_go_names/query_constant/sqlc.yaml new file mode 100644 index 0000000000..e6314287c2 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: +- schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + out: "db" + emit_exported_queries: true diff --git a/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt b/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt new file mode 100644 index 0000000000..1a9b5f80b5 --- /dev/null +++ b/internal/endtoend/testdata/duplicate_go_names/query_constant/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: query constant name conflicts with enum name: Foo diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go index 5e04c3bea4..e6bbb97c1e 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go index 5770a261d9..f589654638 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go index 5e04c3bea4..e6bbb97c1e 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go index 2c74224c0f..aa7c5c0112 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go index 67af9a1db8..7272c08afa 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go index 2c74224c0f..aa7c5c0112 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go index 5e04c3bea4..e6bbb97c1e 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go index 5770a261d9..f589654638 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go index 1a8b9499ce..7d1ef966a0 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go index 5770a261d9..f589654638 100644 --- a/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_and_json_tags/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go index 964a80dafe..6485f84f72 100644 --- a/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go index 5770a261d9..f589654638 100644 --- a/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go index 964a80dafe..6485f84f72 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go index 2c74224c0f..aa7c5c0112 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go index 4cc4423728..80b0b6dbca 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go index 2c74224c0f..aa7c5c0112 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go index 964a80dafe..6485f84f72 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go index 5770a261d9..f589654638 100644 --- a/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go index 9926af7772..983baf7fd3 100644 --- a/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go index 5770a261d9..f589654638 100644 --- a/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_db_tags/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go index 3431141a4d..0ba10beb98 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go index 3431141a4d..0ba10beb98 100644 --- a/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go index b52125c455..5d4efe1719 100644 --- a/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_empty_slices/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go index b2a1a6f78e..8d1878bb8b 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( IpProtocolIcmp IPProtocol = "icmp" ) -func (e *IPProtocol) Scan(src interface{}) error { +func (e *IPProtocol) Scan(src any) error { switch s := src.(type) { case []byte: *e = IPProtocol(s) @@ -35,7 +35,7 @@ type NullIPProtocol struct { } // Scan implements the Scanner interface. -func (ns *NullIPProtocol) Scan(value interface{}) error { +func (ns *NullIPProtocol) Scan(value any) error { if value == nil { ns.IPProtocol, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go index 531548fbb1..98787cd712 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go index c21df985c1..6992864769 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go index c21df985c1..6992864769 100644 --- a/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go index 3dba1298f5..3863b2b816 100644 --- a/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_exported_queries/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go index 388a75dae3..fb46486d24 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go index 41d5cb689a..643ee299ff 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go index 767b1994be..4dc2b1c98d 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go index baa9266939..abdbd0d68f 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go index 41d5cb689a..643ee299ff 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go index f83fbdf078..6972686105 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go index 378f123111..0a95f1959d 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go index 98a6c710c0..116ee8ffa4 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go index f83fbdf078..6972686105 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go index 388a75dae3..fb46486d24 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go index 41d5cb689a..643ee299ff 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go index 767b1994be..4dc2b1c98d 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go index 388a75dae3..fb46486d24 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go index 8bc479df7d..deb1559140 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go index 767b1994be..4dc2b1c98d 100644 --- a/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/emit_methods_with_db_argument/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/models.go new file mode 100644 index 0000000000..cc23a28521 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/models.go @@ -0,0 +1,60 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql/driver" + "fmt" + + "github.com/jackc/pgx/v5/pgtype" +) + +type UserRole string + +const ( + UserRoleAdmin UserRole = "admin" + UserRoleUser UserRole = "user" +) + +func (e *UserRole) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = UserRole(s) + case string: + *e = UserRole(s) + default: + return fmt.Errorf("unsupported scan type for UserRole: %T", src) + } + return nil +} + +type NullUserRole struct { + UserRole UserRole + Valid bool // Valid is true if UserRole is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullUserRole) Scan(value any) error { + if value == nil { + ns.UserRole, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.UserRole.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullUserRole) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.UserRole), nil +} + +type User struct { + Role *UserRole + RequiredRole UserRole + Name pgtype.Text +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..c3459e46dc --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listUsersByRole = `-- name: ListUsersByRole :many +SELECT role, required_role, name FROM users WHERE role = $1 +` + +func (q *Queries) ListUsersByRole(ctx context.Context, role *UserRole) ([]User, error) { + rows, err := q.db.Query(ctx, listUsersByRole, role) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.Role, &i.RequiredRole, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/query.sql new file mode 100644 index 0000000000..5497d0e044 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListUsersByRole :many +SELECT * FROM users WHERE role = $1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/schema.sql new file mode 100644 index 0000000000..1bf15e4320 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/schema.sql @@ -0,0 +1,7 @@ +CREATE TYPE user_role AS ENUM ('admin', 'user'); + +CREATE TABLE users ( + role user_role, + required_role user_role NOT NULL, + name text +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/sqlc.json new file mode 100644 index 0000000000..220daad146 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optin/pgx/v5/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_pointers_for_null_enum_types": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/models.go new file mode 100644 index 0000000000..404fd3e438 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/models.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type UserRole string + +const ( + UserRoleAdmin UserRole = "admin" + UserRoleUser UserRole = "user" +) + +func (e *UserRole) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = UserRole(s) + case string: + *e = UserRole(s) + default: + return fmt.Errorf("unsupported scan type for UserRole: %T", src) + } + return nil +} + +type NullUserRole struct { + UserRole UserRole + Valid bool // Valid is true if UserRole is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullUserRole) Scan(value any) error { + if value == nil { + ns.UserRole, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.UserRole.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullUserRole) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.UserRole), nil +} + +type User struct { + Role NullUserRole + RequiredRole UserRole +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..c8928aad1a --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listUsersByRole = `-- name: ListUsersByRole :many +SELECT role, required_role FROM users WHERE role = $1 +` + +func (q *Queries) ListUsersByRole(ctx context.Context, role NullUserRole) ([]User, error) { + rows, err := q.db.Query(ctx, listUsersByRole, role) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.Role, &i.RequiredRole); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/query.sql new file mode 100644 index 0000000000..5497d0e044 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- name: ListUsersByRole :many +SELECT * FROM users WHERE role = $1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/schema.sql new file mode 100644 index 0000000000..f7d05db84c --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/schema.sql @@ -0,0 +1,6 @@ +CREATE TYPE user_role AS ENUM ('admin', 'user'); + +CREATE TABLE users ( + role user_role, + required_role user_role NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/sqlc.json new file mode 100644 index 0000000000..0798ec2257 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/optout/pgx/v5/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_pointers_for_null_types": true, + "emit_pointers_for_null_enum_types": false + } + ] +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/db.go new file mode 100644 index 0000000000..9ca5876e4a --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgconn" + "github.com/jackc/pgx/v4" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/models.go new file mode 100644 index 0000000000..650782a9f2 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/models.go @@ -0,0 +1,57 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type UserRole string + +const ( + UserRoleAdmin UserRole = "admin" + UserRoleUser UserRole = "user" +) + +func (e *UserRole) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = UserRole(s) + case string: + *e = UserRole(s) + default: + return fmt.Errorf("unsupported scan type for UserRole: %T", src) + } + return nil +} + +type NullUserRole struct { + UserRole UserRole + Valid bool // Valid is true if UserRole is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullUserRole) Scan(value any) error { + if value == nil { + ns.UserRole, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.UserRole.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullUserRole) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.UserRole), nil +} + +type User struct { + Role *UserRole + RequiredRole UserRole +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..0ba72bc7fd --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listUsersByRole = `-- name: ListUsersByRole :many +SELECT role, required_role FROM users WHERE role = $1 +` + +func (q *Queries) ListUsersByRole(ctx context.Context, role *UserRole) ([]User, error) { + rows, err := q.db.Query(ctx, listUsersByRole, role) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.Role, &i.RequiredRole); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/query.sql new file mode 100644 index 0000000000..5497d0e044 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- name: ListUsersByRole :many +SELECT * FROM users WHERE role = $1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/schema.sql b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/schema.sql new file mode 100644 index 0000000000..f7d05db84c --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/schema.sql @@ -0,0 +1,6 @@ +CREATE TYPE user_role AS ENUM ('admin', 'user'); + +CREATE TABLE users ( + role user_role, + required_role user_role NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/sqlc.json new file mode 100644 index 0000000000..2f4be0fcfe --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v4/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_pointers_for_null_types": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/models.go new file mode 100644 index 0000000000..5f1efc0514 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/models.go @@ -0,0 +1,100 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql/driver" + "fmt" +) + +type FooStatus string + +const ( + FooStatusActive FooStatus = "active" + FooStatusInactive FooStatus = "inactive" +) + +func (e *FooStatus) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = FooStatus(s) + case string: + *e = FooStatus(s) + default: + return fmt.Errorf("unsupported scan type for FooStatus: %T", src) + } + return nil +} + +type NullFooStatus struct { + FooStatus FooStatus + Valid bool // Valid is true if FooStatus is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullFooStatus) Scan(value any) error { + if value == nil { + ns.FooStatus, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.FooStatus.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullFooStatus) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.FooStatus), nil +} + +type UserRole string + +const ( + UserRoleAdmin UserRole = "admin" + UserRoleUser UserRole = "user" +) + +func (e *UserRole) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = UserRole(s) + case string: + *e = UserRole(s) + default: + return fmt.Errorf("unsupported scan type for UserRole: %T", src) + } + return nil +} + +type NullUserRole struct { + UserRole UserRole + Valid bool // Valid is true if UserRole is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullUserRole) Scan(value any) error { + if value == nil { + ns.UserRole, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.UserRole.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullUserRole) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.UserRole), nil +} + +type User struct { + Role *UserRole + RequiredRole UserRole + Status *FooStatus +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..72afc38d12 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/go/query.sql.go @@ -0,0 +1,49 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const createUser = `-- name: CreateUser :exec +INSERT INTO users (role, required_role, status) VALUES ($1, $2, $3) +` + +type CreateUserParams struct { + Role *UserRole + RequiredRole UserRole + Status *FooStatus +} + +func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) error { + _, err := q.db.Exec(ctx, createUser, arg.Role, arg.RequiredRole, arg.Status) + return err +} + +const listUsersByRole = `-- name: ListUsersByRole :many +SELECT role, required_role, status FROM users WHERE role = $1 +` + +func (q *Queries) ListUsersByRole(ctx context.Context, role *UserRole) ([]User, error) { + rows, err := q.db.Query(ctx, listUsersByRole, role) + if err != nil { + return nil, err + } + defer rows.Close() + var items []User + for rows.Next() { + var i User + if err := rows.Scan(&i.Role, &i.RequiredRole, &i.Status); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/query.sql new file mode 100644 index 0000000000..3df4ef7744 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/query.sql @@ -0,0 +1,5 @@ +-- name: ListUsersByRole :many +SELECT * FROM users WHERE role = $1; + +-- name: CreateUser :exec +INSERT INTO users (role, required_role, status) VALUES ($1, $2, $3); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/schema.sql b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/schema.sql new file mode 100644 index 0000000000..20258bd29e --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/schema.sql @@ -0,0 +1,11 @@ +CREATE TYPE user_role AS ENUM ('admin', 'user'); + +CREATE SCHEMA foo; + +CREATE TYPE foo.status AS ENUM ('active', 'inactive'); + +CREATE TABLE users ( + role user_role, + required_role user_role NOT NULL, + status foo.status +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/sqlc.json new file mode 100644 index 0000000000..9b919dfea2 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_enum_types/pgx/v5/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_pointers_for_null_types": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go index 819b76a2d8..5cc19ed7fb 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go index 2edba60558..8501ec7fb2 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..29ea3c7023 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v4/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go index 628fe9c96b..b57247cdf3 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go index 249f97e31f..23a0399fe1 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..29ea3c7023 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/pgx/v5/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/db.go new file mode 100644 index 0000000000..31b13521bd --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package datatype + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/models.go new file mode 100644 index 0000000000..1f4dda4a59 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/models.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package datatype + +import ( + "time" +) + +type DtType struct { + A *int64 + B *float64 + C *bool + D *time.Time + E *string + F *float64 +} + +type DtTypesNotNull struct { + A int64 + B float64 + C bool + D time.Time + E string + F float64 +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go new file mode 100644 index 0000000000..b8250f95de --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const noop = `-- name: Noop :one +SELECT 1 +` + +func (q *Queries) Noop(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, noop) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/query.sql new file mode 100644 index 0000000000..d32220c3d5 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/query.sql @@ -0,0 +1,2 @@ +-- name: Noop :one +SELECT 1; diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/types.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/types.sql new file mode 100644 index 0000000000..eb55c80eda --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sql/types.sql @@ -0,0 +1,18 @@ + +CREATE TABLE dt_types ( + a int, + b real, + c bool, + d date, + e text, + f numeric +); + +CREATE TABLE dt_types_not_null ( + a int NOT NULL, + b real NOT NULL, + c bool NOT NULL, + d date NOT NULL, + e text NOT NULL, + f numeric NOT NULL +); diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sqlc.json b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sqlc.json new file mode 100644 index 0000000000..9b8d7693bc --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/sqlite/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "datatype", + "schema": "sql/types.sql", + "queries": "sql/query.sql", + "emit_pointers_for_null_types": true + } + ] +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go index f280f77116..31b13521bd 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go index c9f87be871..0dbaa9ae63 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -94,19 +94,19 @@ type DtNumericNotNull struct { } type DtRange struct { - A interface{} - B interface{} - C interface{} - D interface{} - E interface{} - F interface{} + A any + B any + C any + D any + E any + F any } type DtRangeNotNull struct { - A interface{} - B interface{} - C interface{} - D interface{} - E interface{} - F interface{} + A any + B any + C any + D any + E any + F any } diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go new file mode 100644 index 0000000000..96b4633882 --- /dev/null +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package datatype + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql +++ b/internal/endtoend/testdata/emit_pointers_for_null_types/stdlib/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/models.py b/internal/endtoend/testdata/emit_pydantic_models/postgresql/models.py deleted file mode 100644 index 2b1b5abc61..0000000000 --- a/internal/endtoend/testdata/emit_pydantic_models/postgresql/models.py +++ /dev/null @@ -1,11 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import pydantic -from typing import Optional - - -class Author(pydantic.BaseModel): - id: int - name: str - bio: Optional[str] diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/query.py b/internal/endtoend/testdata/emit_pydantic_models/postgresql/query.py deleted file mode 100644 index 5a108e6530..0000000000 --- a/internal/endtoend/testdata/emit_pydantic_models/postgresql/query.py +++ /dev/null @@ -1,112 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -from typing import AsyncIterator, Iterator, Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from postgresql import models - - -CREATE_AUTHOR = """-- name: create_author \\:one -INSERT INTO authors ( - name, bio -) VALUES ( - :p1, :p2 -) -RETURNING id, name, bio -""" - - -DELETE_AUTHOR = """-- name: delete_author \\:exec -DELETE FROM authors -WHERE id = :p1 -""" - - -GET_AUTHOR = """-- name: get_author \\:one -SELECT id, name, bio FROM authors -WHERE id = :p1 LIMIT 1 -""" - - -LIST_AUTHORS = """-- name: list_authors \\:many -SELECT id, name, bio FROM authors -ORDER BY name -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Author]: - row = self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name, "p2": bio}).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - def delete_author(self, *, id: int) -> None: - self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id}) - - def get_author(self, *, id: int) -> Optional[models.Author]: - row = self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": id}).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - def list_authors(self) -> Iterator[models.Author]: - result = self._conn.execute(sqlalchemy.text(LIST_AUTHORS)) - for row in result: - yield models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(CREATE_AUTHOR), {"p1": name, "p2": bio})).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - async def delete_author(self, *, id: int) -> None: - await self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id}) - - async def get_author(self, *, id: int) -> Optional[models.Author]: - row = (await self._conn.execute(sqlalchemy.text(GET_AUTHOR), {"p1": id})).first() - if row is None: - return None - return models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) - - async def list_authors(self) -> AsyncIterator[models.Author]: - result = await self._conn.stream(sqlalchemy.text(LIST_AUTHORS)) - async for row in result: - yield models.Author( - id=row[0], - name=row[1], - bio=row[2], - ) diff --git a/internal/endtoend/testdata/emit_pydantic_models/sqlc.json b/internal/endtoend/testdata/emit_pydantic_models/sqlc.json deleted file mode 100644 index 65ca70df70..0000000000 --- a/internal/endtoend/testdata/emit_pydantic_models/sqlc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "postgresql/schema.sql", - "queries": "postgresql/query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "postgresql", - "options": { - "package": "postgresql", - "emit_sync_querier": true, - "emit_async_querier": true, - "emit_pydantic_models": true - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go index a1ac02ccf5..a3b713ffee 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go index 2d25419317..041c039b8a 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go index 2ff4a93790..e36af84dd6 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go index 85070addfc..90195fa4cd 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch.go package querytest @@ -38,7 +38,7 @@ type InsertValuesParams struct { func (q *Queries) InsertValues(ctx context.Context, arg []*InsertValuesParams) *InsertValuesBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.A, a.B, } diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go index e28790b2ce..49b7e30271 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go index a1ac02ccf5..a3b713ffee 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go index 2fa53c4382..63eca2afd1 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go index a4e330d2ce..8f9c369c5e 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/batch.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch.go package querytest @@ -38,7 +38,7 @@ type InsertValuesParams struct { func (q *Queries) InsertValues(ctx context.Context, arg []*InsertValuesParams) *InsertValuesBatchResults { batch := &pgx.Batch{} for _, a := range arg { - vals := []interface{}{ + vals := []any{ a.A, a.B, } diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go index 21d826834a..1f79ce6197 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go index 81cc7f3173..baf8c54520 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go index e1176bfd16..4b927ee755 100644 --- a/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/emit_result_and_params_struct_pointers/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/exec.json b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/exec.json new file mode 100644 index 0000000000..9f208fb2df --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "os": ["darwin", "linux"] +} diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/db.go b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/models.go b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/models.go new file mode 100644 index 0000000000..39cdf56e55 --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Bar struct { + ID int32 +} diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go new file mode 100644 index 0000000000..b3da6e1539 --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const listBar = `-- name: ListBar :many +SELECT id FROM ( + SELECT id FROM bar +) bar +` + +// Lists all bars +// +// SELECT id FROM ( +// SELECT id FROM bar +// ) bar +func (q *Queries) ListBar(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, listBar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var id int32 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const removeBar = `-- name: RemoveBar :exec +DELETE FROM bar WHERE id = $1 +` + +// RemoveBar +// +// DELETE FROM bar WHERE id = $1 +func (q *Queries) RemoveBar(ctx context.Context, id int32) error { + _, err := q.db.ExecContext(ctx, removeBar, id) + return err +} diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/query.sql b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/query.sql new file mode 100644 index 0000000000..e3551898fb --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/query.sql @@ -0,0 +1,8 @@ +-- name: ListBar :many +-- Lists all bars +SELECT id FROM ( + SELECT * FROM bar +) bar; + +-- name: RemoveBar :exec +DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/schema.sql b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/schema.sql new file mode 100644 index 0000000000..682614c578 --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (id serial not null); diff --git a/internal/endtoend/testdata/emit_sql_as_comment/stdlib/sqlc.json b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/sqlc.json new file mode 100644 index 0000000000..9464b72b2e --- /dev/null +++ b/internal/endtoend/testdata/emit_sql_as_comment/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql", + "emit_sql_as_comment": true + } + ] +} diff --git a/internal/endtoend/testdata/enum/mysql/go/db.go b/internal/endtoend/testdata/enum/mysql/go/db.go index 388a75dae3..fb46486d24 100644 --- a/internal/endtoend/testdata/enum/mysql/go/db.go +++ b/internal/endtoend/testdata/enum/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/enum/mysql/go/models.go b/internal/endtoend/testdata/enum/mysql/go/models.go index 5d3a7ddbd0..0f3d666ad3 100644 --- a/internal/endtoend/testdata/enum/mysql/go/models.go +++ b/internal/endtoend/testdata/enum/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -20,7 +20,7 @@ const ( UsersShirtSizeXLarge UsersShirtSize = "x-large" ) -func (e *UsersShirtSize) Scan(src interface{}) error { +func (e *UsersShirtSize) Scan(src any) error { switch s := src.(type) { case []byte: *e = UsersShirtSize(s) @@ -38,7 +38,7 @@ type NullUsersShirtSize struct { } // Scan implements the Scanner interface. -func (ns *NullUsersShirtSize) Scan(value interface{}) error { +func (ns *NullUsersShirtSize) Scan(value any) error { if value == nil { ns.UsersShirtSize, ns.Valid = "", false return nil @@ -65,7 +65,7 @@ const ( UsersShoeSizeXLarge UsersShoeSize = "x-large" ) -func (e *UsersShoeSize) Scan(src interface{}) error { +func (e *UsersShoeSize) Scan(src any) error { switch s := src.(type) { case []byte: *e = UsersShoeSize(s) @@ -83,7 +83,7 @@ type NullUsersShoeSize struct { } // Scan implements the Scanner interface. -func (ns *NullUsersShoeSize) Scan(value interface{}) error { +func (ns *NullUsersShoeSize) Scan(value any) error { if value == nil { ns.UsersShoeSize, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/enum/mysql/go/query.sql.go b/internal/endtoend/testdata/enum/mysql/go/query.sql.go index 67a2e4d1f3..8285426162 100644 --- a/internal/endtoend/testdata/enum/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/enum/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go index baa9266939..abdbd0d68f 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go index 410ea7ff3d..f3a6c1bee7 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -20,7 +20,7 @@ const ( SizeXLarge Size = "x-large" ) -func (e *Size) Scan(src interface{}) error { +func (e *Size) Scan(src any) error { switch s := src.(type) { case []byte: *e = Size(s) @@ -38,7 +38,7 @@ type NullSize struct { } // Scan implements the Scanner interface. -func (ns *NullSize) Scan(value interface{}) error { +func (ns *NullSize) Scan(value any) error { if value == nil { ns.Size, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go index 3d89ba41e9..c5d026827f 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go index 378f123111..0a95f1959d 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go index ca703414bb..3f2381d996 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -21,7 +21,7 @@ const ( SizeXLarge Size = "x-large" ) -func (e *Size) Scan(src interface{}) error { +func (e *Size) Scan(src any) error { switch s := src.(type) { case []byte: *e = Size(s) @@ -39,7 +39,7 @@ type NullSize struct { } // Scan implements the Scanner interface. -func (ns *NullSize) Scan(value interface{}) error { +func (ns *NullSize) Scan(value any) error { if value == nil { ns.Size, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go index d3b28468ad..f26449a7f5 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go index 388a75dae3..fb46486d24 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New() *Queries { diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go index 410ea7ff3d..f3a6c1bee7 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -20,7 +20,7 @@ const ( SizeXLarge Size = "x-large" ) -func (e *Size) Scan(src interface{}) error { +func (e *Size) Scan(src any) error { switch s := src.(type) { case []byte: *e = Size(s) @@ -38,7 +38,7 @@ type NullSize struct { } // Scan implements the Scanner interface. -func (ns *NullSize) Scan(value interface{}) error { +func (ns *NullSize) Scan(value any) error { if value == nil { ns.Size, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go index ef7aab07c0..7c6eefe6e4 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/enum_column/mysql/go/db.go b/internal/endtoend/testdata/enum_column/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/enum_column/mysql/go/db.go +++ b/internal/endtoend/testdata/enum_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/enum_column/mysql/go/models.go b/internal/endtoend/testdata/enum_column/mysql/go/models.go index 84d959387a..91aab1a5bd 100644 --- a/internal/endtoend/testdata/enum_column/mysql/go/models.go +++ b/internal/endtoend/testdata/enum_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( AuthorsAddItemAdded AuthorsAddItem = "added" ) -func (e *AuthorsAddItem) Scan(src interface{}) error { +func (e *AuthorsAddItem) Scan(src any) error { switch s := src.(type) { case []byte: *e = AuthorsAddItem(s) @@ -34,7 +34,7 @@ type NullAuthorsAddItem struct { } // Scan implements the Scanner interface. -func (ns *NullAuthorsAddItem) Scan(value interface{}) error { +func (ns *NullAuthorsAddItem) Scan(value any) error { if value == nil { ns.AuthorsAddItem, ns.Valid = "", false return nil @@ -57,7 +57,7 @@ const ( AuthorsAddedOk AuthorsAdded = "ok" ) -func (e *AuthorsAdded) Scan(src interface{}) error { +func (e *AuthorsAdded) Scan(src any) error { switch s := src.(type) { case []byte: *e = AuthorsAdded(s) @@ -75,7 +75,7 @@ type NullAuthorsAdded struct { } // Scan implements the Scanner interface. -func (ns *NullAuthorsAdded) Scan(value interface{}) error { +func (ns *NullAuthorsAdded) Scan(value any) error { if value == nil { ns.AuthorsAdded, ns.Valid = "", false return nil @@ -98,7 +98,7 @@ const ( AuthorsBarOk AuthorsBar = "ok" ) -func (e *AuthorsBar) Scan(src interface{}) error { +func (e *AuthorsBar) Scan(src any) error { switch s := src.(type) { case []byte: *e = AuthorsBar(s) @@ -116,7 +116,7 @@ type NullAuthorsBar struct { } // Scan implements the Scanner interface. -func (ns *NullAuthorsBar) Scan(value interface{}) error { +func (ns *NullAuthorsBar) Scan(value any) error { if value == nil { ns.AuthorsBar, ns.Valid = "", false return nil @@ -139,7 +139,7 @@ const ( AuthorsFooOk AuthorsFoo = "ok" ) -func (e *AuthorsFoo) Scan(src interface{}) error { +func (e *AuthorsFoo) Scan(src any) error { switch s := src.(type) { case []byte: *e = AuthorsFoo(s) @@ -157,7 +157,7 @@ type NullAuthorsFoo struct { } // Scan implements the Scanner interface. -func (ns *NullAuthorsFoo) Scan(value interface{}) error { +func (ns *NullAuthorsFoo) Scan(value any) error { if value == nil { ns.AuthorsFoo, ns.Valid = "", false return nil @@ -180,7 +180,7 @@ const ( AuthorsRemoveItemOk AuthorsRemoveItem = "ok" ) -func (e *AuthorsRemoveItem) Scan(src interface{}) error { +func (e *AuthorsRemoveItem) Scan(src any) error { switch s := src.(type) { case []byte: *e = AuthorsRemoveItem(s) @@ -198,7 +198,7 @@ type NullAuthorsRemoveItem struct { } // Scan implements the Scanner interface. -func (ns *NullAuthorsRemoveItem) Scan(value interface{}) error { +func (ns *NullAuthorsRemoveItem) Scan(value any) error { if value == nil { ns.AuthorsRemoveItem, ns.Valid = "", false return nil @@ -221,7 +221,7 @@ const ( BooksFooOk BooksFoo = "ok" ) -func (e *BooksFoo) Scan(src interface{}) error { +func (e *BooksFoo) Scan(src any) error { switch s := src.(type) { case []byte: *e = BooksFoo(s) @@ -239,7 +239,7 @@ type NullBooksFoo struct { } // Scan implements the Scanner interface. -func (ns *NullBooksFoo) Scan(value interface{}) error { +func (ns *NullBooksFoo) Scan(value any) error { if value == nil { ns.BooksFoo, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go b/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go index fc24144638..9932531a90 100644 --- a/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/enum_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go index 34ca7919a9..9bb7d6afa2 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -22,7 +22,7 @@ const ( EnumTypeAfterlast EnumType = "afterlast" ) -func (e *EnumType) Scan(src interface{}) error { +func (e *EnumType) Scan(src any) error { switch s := src.(type) { case []byte: *e = EnumType(s) @@ -40,7 +40,7 @@ type NullEnumType struct { } // Scan implements the Scanner interface. -func (ns *NullEnumType) Scan(value interface{}) error { +func (ns *NullEnumType) Scan(value any) error { if value == nil { ns.EnumType, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go index c020c0210d..218ddc8c25 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go index 740eacec8e..84b460c645 100644 --- a/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/enum_ordering/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/exec_create_table/mysql/db/db.go b/internal/endtoend/testdata/exec_create_table/mysql/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/exec_create_table/mysql/db/models.go b/internal/endtoend/testdata/exec_create_table/mysql/db/models.go new file mode 100644 index 0000000000..21f493ecbc --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/db/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db diff --git a/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go b/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go new file mode 100644 index 0000000000..99fbd91476 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/db/mysql.query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: mysql.query.sql + +package db + +import ( + "context" +) + +const createTable = `-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL) +` + +func (q *Queries) CreateTable(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, createTable) + return err +} diff --git a/internal/endtoend/testdata/exec_create_table/mysql/mysql.query.sql b/internal/endtoend/testdata/exec_create_table/mysql/mysql.query.sql new file mode 100644 index 0000000000..0a92ebb9cb --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/mysql.query.sql @@ -0,0 +1,2 @@ +-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL); diff --git a/examples/python/src/authors/__init__.py b/internal/endtoend/testdata/exec_create_table/mysql/mysql.schema.sql similarity index 100% rename from examples/python/src/authors/__init__.py rename to internal/endtoend/testdata/exec_create_table/mysql/mysql.schema.sql diff --git a/internal/endtoend/testdata/exec_create_table/mysql/sqlc.yaml b/internal/endtoend/testdata/exec_create_table/mysql/sqlc.yaml new file mode 100644 index 0000000000..bd888aabfc --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/mysql/sqlc.yaml @@ -0,0 +1,8 @@ +version: 2 +sql: +- queries: mysql.query.sql + schema: mysql.schema.sql + engine: mysql + gen: + go: + out: db diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/db/db.go b/internal/endtoend/testdata/exec_create_table/postgresql/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/db/models.go b/internal/endtoend/testdata/exec_create_table/postgresql/db/models.go new file mode 100644 index 0000000000..21f493ecbc --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/db/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go b/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go new file mode 100644 index 0000000000..0d5b9d8070 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/db/postgresql.query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: postgresql.query.sql + +package db + +import ( + "context" +) + +const createTable = `-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL) +` + +func (q *Queries) CreateTable(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, createTable) + return err +} diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.query.sql b/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.query.sql new file mode 100644 index 0000000000..0a92ebb9cb --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.query.sql @@ -0,0 +1,2 @@ +-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL); diff --git a/examples/python/src/booktest/__init__.py b/internal/endtoend/testdata/exec_create_table/postgresql/postgresql.schema.sql similarity index 100% rename from examples/python/src/booktest/__init__.py rename to internal/endtoend/testdata/exec_create_table/postgresql/postgresql.schema.sql diff --git a/internal/endtoend/testdata/exec_create_table/postgresql/sqlc.yaml b/internal/endtoend/testdata/exec_create_table/postgresql/sqlc.yaml new file mode 100644 index 0000000000..6a89eb2179 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/postgresql/sqlc.yaml @@ -0,0 +1,9 @@ +version: 2 +sql: +- queries: postgresql.query.sql + schema: postgresql.schema.sql + engine: postgresql + gen: + go: + out: db + diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/db/db.go b/internal/endtoend/testdata/exec_create_table/sqlite/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/db/models.go b/internal/endtoend/testdata/exec_create_table/sqlite/db/models.go new file mode 100644 index 0000000000..21f493ecbc --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/db/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go b/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go new file mode 100644 index 0000000000..c80f32b7a0 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/db/sqlite.query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: sqlite.query.sql + +package db + +import ( + "context" +) + +const createTable = `-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL) +` + +func (q *Queries) CreateTable(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, createTable) + return err +} diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/sqlc.yaml b/internal/endtoend/testdata/exec_create_table/sqlite/sqlc.yaml new file mode 100644 index 0000000000..bf2e6024b6 --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/sqlc.yaml @@ -0,0 +1,8 @@ +version: 2 +sql: +- queries: sqlite.query.sql + schema: sqlite.schema.sql + engine: sqlite + gen: + go: + out: db diff --git a/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.query.sql b/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.query.sql new file mode 100644 index 0000000000..0a92ebb9cb --- /dev/null +++ b/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.query.sql @@ -0,0 +1,2 @@ +-- name: CreateTable :exec +CREATE TABLE test (id INTEGER NOT NULL); diff --git a/examples/python/src/dbtest/__init__.py b/internal/endtoend/testdata/exec_create_table/sqlite/sqlite.schema.sql similarity index 100% rename from examples/python/src/dbtest/__init__.py rename to internal/endtoend/testdata/exec_create_table/sqlite/sqlite.schema.sql diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go index acd1d55f3c..7c96889ef3 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go index 70c7cdc62c..39afcf2f42 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go index ede1045539..c505de5a81 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go index 9005553d5a..32c2dd888a 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go index 70c7cdc62c..39afcf2f42 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go index ede1045539..c505de5a81 100644 --- a/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/db.go b/internal/endtoend/testdata/exec_imports/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/db.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/models.go b/internal/endtoend/testdata/exec_imports/stdlib/go/models.go index acd1d55f3c..7c96889ef3 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/models.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go b/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go index 70c7cdc62c..39afcf2f42 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go index cef76161ad..4b511a4137 100644 --- a/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_imports/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go index 88af887f16..9498197246 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go index 8ad3076d43..6aa6ca6696 100644 --- a/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_lastid/go_postgresql_stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_no_return_struct/issue.md b/internal/endtoend/testdata/exec_no_return_struct/issue.md new file mode 100644 index 0000000000..1184d6e9e3 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2970 diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/db.go b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/models.go b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..201e6f327b --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Job struct { + TaskName string + LastRun pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..e3e9074056 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const resetTaskRun = `-- name: ResetTaskRun :exec +UPDATE job +SET last_run = NOW() +FROM ( + SELECT last_run, + task_name + FROM job AS o + WHERE o.task_name = $1 + FOR UPDATE + ) AS old_values +WHERE job.task_name = $1 +RETURNING job.last_run AS this_run, + old_values.last_run AS last_run +` + +func (q *Queries) ResetTaskRun(ctx context.Context, taskName string) error { + _, err := q.db.Exec(ctx, resetTaskRun, taskName) + return err +} diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/query.sql b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/query.sql new file mode 100644 index 0000000000..968ce9f7c8 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/query.sql @@ -0,0 +1,13 @@ +-- name: ResetTaskRun :exec +UPDATE job +SET last_run = NOW() +FROM ( + SELECT last_run, + task_name + FROM job AS o + WHERE o.task_name = $1 + FOR UPDATE + ) AS old_values +WHERE job.task_name = $1 +RETURNING job.last_run AS this_run, + old_values.last_run AS last_run; diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/schema.sql b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..6dd162bed9 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS job +( + task_name text NOT NULL, + last_run timestamp with time zone DEFAULT now() NOT NULL +); diff --git a/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/exec_no_return_struct/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go index 3c79c900bb..74bb929273 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go index b1510a7166..2c403cbff0 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go index a5ed7f17be..33eaf83bda 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go index c5bb89d766..aab583009e 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go index 91db35baa4..9dfbdeb371 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go index 534465a786..173b4e845a 100644 --- a/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_result/go_postgresql_stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/python/models.py b/internal/endtoend/testdata/exec_result/python_postgresql/python/models.py deleted file mode 100644 index b8a9932385..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/python/models.py +++ /dev/null @@ -1,9 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/python/query.py b/internal/endtoend/testdata/exec_result/python_postgresql/python/query.py deleted file mode 100644 index 57901492f4..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/python/query.py +++ /dev/null @@ -1,29 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execresult -DELETE FROM bar WHERE id = :p1 -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> sqlalchemy.engine.Result: - return self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> sqlalchemy.engine.Result: - return await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/query.sql b/internal/endtoend/testdata/exec_result/python_postgresql/query.sql deleted file mode 100644 index 73917782cb..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/query.sql +++ /dev/null @@ -1,2 +0,0 @@ --- name: DeleteBarByID :execresult -DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/schema.sql b/internal/endtoend/testdata/exec_result/python_postgresql/schema.sql deleted file mode 100644 index 638370ab15..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE bar (id serial not null); - diff --git a/internal/endtoend/testdata/exec_result/python_postgresql/sqlc.json b/internal/endtoend/testdata/exec_result/python_postgresql/sqlc.json deleted file mode 100644 index 5eae79b795..0000000000 --- a/internal/endtoend/testdata/exec_result/python_postgresql/sqlc.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go index 71bbc0ee95..9adaf830f9 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go index 2f3f30560c..edcaa4be4f 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go index 71bbc0ee95..9adaf830f9 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go index 2f3f30560c..edcaa4be4f 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go index 71bbc0ee95..9adaf830f9 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go index 72fbfa1921..8d51824386 100644 --- a/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/exec_rows/go_postgresql_stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/python/models.py b/internal/endtoend/testdata/exec_rows/python_postgresql/python/models.py deleted file mode 100644 index b8a9932385..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/python/models.py +++ /dev/null @@ -1,9 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/python/query.py b/internal/endtoend/testdata/exec_rows/python_postgresql/python/query.py deleted file mode 100644 index 60447ffe27..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/python/query.py +++ /dev/null @@ -1,31 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execrows -DELETE FROM bar WHERE id = :p1 -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/query.sql b/internal/endtoend/testdata/exec_rows/python_postgresql/query.sql deleted file mode 100644 index 94d2d09f90..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/query.sql +++ /dev/null @@ -1,2 +0,0 @@ --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/schema.sql b/internal/endtoend/testdata/exec_rows/python_postgresql/schema.sql deleted file mode 100644 index 638370ab15..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE bar (id serial not null); - diff --git a/internal/endtoend/testdata/exec_rows/python_postgresql/sqlc.json b/internal/endtoend/testdata/exec_rows/python_postgresql/sqlc.json deleted file mode 100644 index 5eae79b795..0000000000 --- a/internal/endtoend/testdata/exec_rows/python_postgresql/sqlc.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/exec.json b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/exec.json new file mode 100644 index 0000000000..8da46d61b5 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "command": "generate", + "env": { + "SQLCEXPERIMENT": "coreanalyzer" + } +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/db.go b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/models.go b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/models.go new file mode 100644 index 0000000000..2208139112 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/query.sql.go b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/query.sql.go new file mode 100644 index 0000000000..69c870213b --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/go/query.sql.go @@ -0,0 +1,81 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :execresult +INSERT INTO authors (id, name, bio) +VALUES (?, ?, ?) +` + +type CreateAuthorParams struct { + ID int64 + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (sql.Result, error) { + return q.db.ExecContext(ctx, createAuthor, arg.ID, arg.Name, arg.Bio) +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ? +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = ? +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name FROM authors +ORDER BY name +` + +type ListAuthorsRow struct { + ID int64 + Name string +} + +func (q *Queries) ListAuthors(ctx context.Context) ([]ListAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListAuthorsRow + for rows.Next() { + var i ListAuthorsRow + if err := rows.Scan(&i.ID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/query.sql b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/query.sql new file mode 100644 index 0000000000..c76ee0ca8c --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/query.sql @@ -0,0 +1,15 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ?; + +-- name: ListAuthors :many +SELECT id, name FROM authors +ORDER BY name; + +-- name: CreateAuthor :execresult +INSERT INTO authors (id, name, bio) +VALUES (?, ?, ?); + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/schema.sql b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/schema.sql new file mode 100644 index 0000000000..bd03609de4 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id bigint PRIMARY KEY, + name varchar(255) NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/mysql/sqlc.json b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/exec.json b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..8da46d61b5 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/exec.json @@ -0,0 +1,6 @@ +{ + "command": "generate", + "env": { + "SQLCEXPERIMENT": "coreanalyzer" + } +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..49c67eb514 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString + Tags []string +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..2e2ced077f --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,97 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + + "github.com/lib/pq" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors (id, name, bio) +VALUES ($1, $2, $3) +RETURNING id, name, bio, tags +` + +type CreateAuthorParams struct { + ID int64 + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.ID, arg.Name, arg.Bio) + var i Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + pq.Array(&i.Tags), + ) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio, tags FROM authors +WHERE id = $1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + pq.Array(&i.Tags), + ) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name FROM authors +ORDER BY name +` + +type ListAuthorsRow struct { + ID int64 + Name string +} + +func (q *Queries) ListAuthors(ctx context.Context) ([]ListAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListAuthorsRow + for rows.Next() { + var i ListAuthorsRow + if err := rows.Scan(&i.ID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/query.sql b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..48bc0dd304 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/query.sql @@ -0,0 +1,16 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1; + +-- name: ListAuthors :many +SELECT id, name FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors (id, name, bio) +VALUES ($1, $2, $3) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..a12bc54b3e --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id bigint PRIMARY KEY, + name text NOT NULL, + bio text, + tags text[] +); diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/exec.json b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/exec.json new file mode 100644 index 0000000000..8da46d61b5 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/exec.json @@ -0,0 +1,6 @@ +{ + "command": "generate", + "env": { + "SQLCEXPERIMENT": "coreanalyzer" + } +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/db.go b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/models.go b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/models.go new file mode 100644 index 0000000000..2208139112 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/query.sql.go b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/query.sql.go new file mode 100644 index 0000000000..d26dc4d217 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/go/query.sql.go @@ -0,0 +1,87 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors (id, name, bio) +VALUES (?, ?, ?) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + ID int64 + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.ID, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ? +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio +FROM authors +WHERE id = ? +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name +FROM authors +ORDER BY name +` + +type ListAuthorsRow struct { + ID int64 + Name string +} + +func (q *Queries) ListAuthors(ctx context.Context) ([]ListAuthorsRow, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListAuthorsRow + for rows.Next() { + var i ListAuthorsRow + if err := rows.Scan(&i.ID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/query.sql b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/query.sql new file mode 100644 index 0000000000..00f0bd0746 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/query.sql @@ -0,0 +1,18 @@ +-- name: GetAuthor :one +SELECT * +FROM authors +WHERE id = ?; + +-- name: ListAuthors :many +SELECT id, name +FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors (id, name, bio) +VALUES (?, ?, ?) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = ?; diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/schema.sql b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/schema.sql new file mode 100644 index 0000000000..11599c4cf7 --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id integer PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/sqlc.json b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/experiment_coreanalyzer/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/fmt/mysql/exec.json b/internal/endtoend/testdata/fmt/mysql/exec.json new file mode 100644 index 0000000000..191cf0ccb0 --- /dev/null +++ b/internal/endtoend/testdata/fmt/mysql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "fmt", + "args": ["--diff"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/fmt/mysql/query.sql b/internal/endtoend/testdata/fmt/mysql/query.sql new file mode 100644 index 0000000000..c8afff5624 --- /dev/null +++ b/internal/endtoend/testdata/fmt/mysql/query.sql @@ -0,0 +1,72 @@ +-- name: GetAuthor :one +select id,name , bio from authors +where id = ? limit 1; + +# hash comment +-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name DESC; + +-- name: PickyQuery :many +SELECT id, -- the primary key + name, + -- computed downstream + bio +FROM authors +-- soft-deleted rows are filtered +WHERE bio IS NOT NULL + AND id > ?; + +-- name: InlineBlock :many +SELECT /* inline note */ id, name FROM authors ORDER BY name; + +-- name: CountSigils :one +SELECT count(*) FROM authors +WHERE id <> ? AND name <> @user_name; # session variable stays + +-- name: CastUnsigned :one +SELECT CAST(id AS UNSIGNED) FROM authors LIMIT 1; + +-- name: FirstTwin :one +SELECT id FROM authors LIMIT 1; + +-- name: SecondTwin :one +SELECT id FROM authors LIMIT 1; + +-- name: CreateAuthor :execresult +insert into authors ( + name, bio +) values ( + ?, ? +); + +-- name: CasePreserved :many +SELECT ID, Name FROM Authors WHERE Name <> '' ORDER BY Name; + +-- name: LiteralsSurvive :one +SELECT true AS t, false AS f, 1.50 AS score, CASE WHEN name = '' THEN NULL ELSE name END AS n FROM authors LIMIT 1; + +-- name: DistinctNames :many +SELECT DISTINCT name FROM authors; + +-- name: UnionOrdered :many +SELECT name AS foo FROM authors +UNION +SELECT bio AS foo FROM authors +ORDER BY foo; + +-- name: ConcatNames :many +SELECT group_concat(DISTINCT name ORDER BY name DESC SEPARATOR ' ') FROM authors GROUP BY bio; + +-- name: Hinted :one +SELECT /*+ MAX_EXECUTION_TIME(1000) */ id FROM authors LIMIT 1; + +-- name: UpdateWithJoin :exec +UPDATE authors AS a JOIN authors AS p ON p.id = a.id +SET a.name = ? +WHERE p.bio IS NOT NULL; + +-- name: ShowWarnings :many +SHOW WARNINGS; + +CREATE TABLE scores (points decimal(10, 5), views bigint unsigned NOT NULL); diff --git a/internal/endtoend/testdata/fmt/mysql/schema.sql b/internal/endtoend/testdata/fmt/mysql/schema.sql new file mode 100644 index 0000000000..0fb289c162 --- /dev/null +++ b/internal/endtoend/testdata/fmt/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + name varchar(255) NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/fmt/mysql/sqlc.yaml b/internal/endtoend/testdata/fmt/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/fmt/mysql/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "mysql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/fmt/mysql/stdout.txt b/internal/endtoend/testdata/fmt/mysql/stdout.txt new file mode 100644 index 0000000000..a015b7ada3 --- /dev/null +++ b/internal/endtoend/testdata/fmt/mysql/stdout.txt @@ -0,0 +1,73 @@ +--- a/query.sql ++++ b/query.sql +@@ -1,6 +1,8 @@ + -- name: GetAuthor :one ++SELECT id, name, bio ++FROM authors ++WHERE id = ? ++LIMIT 1; +-select id,name , bio from authors +-where id = ? limit 1; + + # hash comment + -- name: ListAuthors :many +@@ -7,4 +9,5 @@ ++SELECT id, name, bio ++FROM authors +-SELECT id, name, bio FROM authors + ORDER BY name DESC; + + -- name: PickyQuery :many +@@ -11,7 +14,8 @@ ++SELECT ++ id, -- the primary key ++ name, ++ -- computed downstream ++ bio +-SELECT id, -- the primary key +- name, +- -- computed downstream +- bio + FROM authors + -- soft-deleted rows are filtered + WHERE bio IS NOT NULL +@@ -21,8 +25,9 @@ + SELECT /* inline note */ id, name FROM authors ORDER BY name; + + -- name: CountSigils :one ++SELECT count(*) ++FROM authors ++WHERE id != ? AND name != @user_name; # session variable stays +-SELECT count(*) FROM authors +-WHERE id <> ? AND name <> @user_name; # session variable stays + + -- name: CastUnsigned :one + SELECT CAST(id AS UNSIGNED) FROM authors LIMIT 1; +@@ -34,14 +39,11 @@ + SELECT id FROM authors LIMIT 1; + + -- name: CreateAuthor :execresult ++INSERT INTO authors (name, bio) ++VALUES (?, ?); +-insert into authors ( +- name, bio +-) values ( +- ?, ? +-); + + -- name: CasePreserved :many ++SELECT ID, Name FROM Authors WHERE Name != '' ORDER BY Name; +-SELECT ID, Name FROM Authors WHERE Name <> '' ORDER BY Name; + + -- name: LiteralsSurvive :one + SELECT true AS t, false AS f, 1.50 AS score, CASE WHEN name = '' THEN NULL ELSE name END AS n FROM authors LIMIT 1; +@@ -62,7 +64,8 @@ + SELECT /*+ MAX_EXECUTION_TIME(1000) */ id FROM authors LIMIT 1; + + -- name: UpdateWithJoin :exec ++UPDATE authors AS a ++JOIN authors AS p ON p.id = a.id +-UPDATE authors AS a JOIN authors AS p ON p.id = a.id + SET a.name = ? + WHERE p.bio IS NOT NULL; + diff --git a/internal/endtoend/testdata/fmt/postgresql/exec.json b/internal/endtoend/testdata/fmt/postgresql/exec.json new file mode 100644 index 0000000000..191cf0ccb0 --- /dev/null +++ b/internal/endtoend/testdata/fmt/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "fmt", + "args": ["--diff"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/fmt/postgresql/query.sql b/internal/endtoend/testdata/fmt/postgresql/query.sql new file mode 100644 index 0000000000..96e8ed6ef7 --- /dev/null +++ b/internal/endtoend/testdata/fmt/postgresql/query.sql @@ -0,0 +1,33 @@ +-- name: GetAuthor :one +select id,name , bio +from authors +where id = $1 limit 1; -- the primary lookup + +/* This listing powers the admin page. + Keep it ordered by name so the UI stays stable. */ +-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: PickyQuery :many +SELECT id, -- the primary key + name +FROM authors +WHERE id > $1; + +-- name: SearchAuthors :many +SELECT id, name, bio, created_at FROM authors WHERE name LIKE $1 AND bio IS NOT NULL AND id > $2 AND name <> $3 ORDER BY name, id LIMIT $4; + +-- name: AtParamsGlued :many +SELECT name FROM authors WHERE name = @slug AND @filter::bool; + +-- name: DeleteAuthor :exec +DELETE FROM authors WHERE id = @id \ No newline at end of file diff --git a/internal/endtoend/testdata/fmt/postgresql/schema.sql b/internal/endtoend/testdata/fmt/postgresql/schema.sql new file mode 100644 index 0000000000..468ae88c5f --- /dev/null +++ b/internal/endtoend/testdata/fmt/postgresql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + created_at timestamptz NOT NULL DEFAULT now() +); diff --git a/internal/endtoend/testdata/fmt/postgresql/sqlc.yaml b/internal/endtoend/testdata/fmt/postgresql/sqlc.yaml new file mode 100644 index 0000000000..cbd1c13993 --- /dev/null +++ b/internal/endtoend/testdata/fmt/postgresql/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/fmt/postgresql/stdout.txt b/internal/endtoend/testdata/fmt/postgresql/stdout.txt new file mode 100644 index 0000000000..e58072656d --- /dev/null +++ b/internal/endtoend/testdata/fmt/postgresql/stdout.txt @@ -0,0 +1,48 @@ +--- a/query.sql ++++ b/query.sql +@@ -1,7 +1,8 @@ + -- name: GetAuthor :one +-select id,name , bio +-from authors +-where id = $1 limit 1; -- the primary lookup ++SELECT id, name, bio ++FROM authors ++WHERE id = $1 ++LIMIT 1; -- the primary lookup + + /* This listing powers the admin page. + Keep it ordered by name so the UI stays stable. */ +@@ -8,5 +9,6 @@ + -- name: ListAuthors :many +-SELECT id, name, bio FROM authors ++SELECT id, name, bio ++FROM authors + ORDER BY name; + + -- name: CreateAuthor :one +@@ -13,8 +15,5 @@ +-INSERT INTO authors ( +- name, bio +-) VALUES ( +- $1, $2 +-) ++INSERT INTO authors (name, bio) ++VALUES ($1, $2) + RETURNING *; + + -- name: PickyQuery :many +@@ -21,5 +20,6 @@ +-SELECT id, -- the primary key +- name ++SELECT ++ id, -- the primary key ++ name + FROM authors + WHERE id > $1; + +@@ -30,4 +30,4 @@ + SELECT name FROM authors WHERE name = @slug AND @filter::bool; + + -- name: DeleteAuthor :exec +-DELETE FROM authors WHERE id = @id ++DELETE FROM authors WHERE id = @id; diff --git a/internal/endtoend/testdata/fmt/sqlite/exec.json b/internal/endtoend/testdata/fmt/sqlite/exec.json new file mode 100644 index 0000000000..191cf0ccb0 --- /dev/null +++ b/internal/endtoend/testdata/fmt/sqlite/exec.json @@ -0,0 +1,5 @@ +{ + "command": "fmt", + "args": ["--diff"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/fmt/sqlite/query.sql b/internal/endtoend/testdata/fmt/sqlite/query.sql new file mode 100644 index 0000000000..2856ca935b --- /dev/null +++ b/internal/endtoend/testdata/fmt/sqlite/query.sql @@ -0,0 +1,107 @@ +-- name: GetAuthor :one +select id,name , bio from authors +where id = ? limit 1; + +-- name: PickyQuery :many +SELECT id, -- the primary key + name, + -- computed downstream + bio +FROM authors +-- soft-deleted rows are filtered +WHERE bio IS NOT NULL + AND id > ?; + +-- name: InlineBlock :many +SELECT /* inline note */ id, name FROM authors ORDER BY name; + +-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name; + +-- name: GetEvent :one +SELECT "EventName", "order" +FROM "Events" WHERE id = ? LIMIT 1; + +-- name: CountSigils :one +SELECT count(*) FROM authors +WHERE id <> @at_param AND id <> :colon_param AND id <> $dollar_param; + +-- name: TopAuthors :many +WITH ranked AS ( + SELECT id, name FROM authors +) +SELECT * FROM ranked; + +-- name: AddAuthor :exec +INSERT INTO authors (name, bio) +VALUES (?, ?); + +-- name: MakeScratch :exec +CREATE TABLE scratch ( + id INTEGER NOT NULL, + label TEXT +); + +-- name: MakeMeasurements :exec +CREATE TABLE IF NOT EXISTS measurements ( + id INTEGER PRIMARY KEY, + label VARYING CHARACTER(120), + ratio DECIMAL(10,5), + note +); + +-- name: KeepAutoinc :exec +CREATE TABLE counters (id INTEGER PRIMARY KEY AUTOINCREMENT, hits INTEGER DEFAULT 0); + +-- name: CastLabel :one +SELECT CAST(bio AS VARYING CHARACTER(120)) FROM authors LIMIT 1; + +-- name: MakeSearchIndex :exec +CREATE VIRTUAL TABLE IF NOT EXISTS notes_fts USING fts5(body, tag UNINDEXED, tokenize = 'porter'); + +-- name: MakeRecipeIndex :exec +CREATE VIRTUAL TABLE recipes_fts USING fts5( + name, + ingredients +); + +-- name: LoginName :one +SELECT COALESCE(bio, '') AS login FROM authors WHERE id = ? LIMIT 1; + +-- name: SpelledJoins :many +SELECT a.id +FROM authors AS a +INNER JOIN authors AS b ON a.id = b.id +LEFT OUTER JOIN authors AS c ON a.id = c.id +WHERE a.id != ? AND b.id == ? AND c.id <> ?; + +-- name: CommaJoin :one +SELECT count(*) FROM authors AS a, authors AS b WHERE a.id = b.id; + +-- name: PlannerHint :many +SELECT a.id FROM authors AS a CROSS JOIN authors AS b; + +-- name: NumberedParams :many +SELECT id FROM authors WHERE name = ?2 AND bio = ?1; + +-- name: NewestAndOldest :many +SELECT id FROM authors +UNION +SELECT id FROM authors; + +-- name: QuickUnion :many +SELECT id FROM authors UNION ALL SELECT id FROM authors; + +-- name: EnableForeignKeys :exec +PRAGMA foreign_keys = 1; + +-- name: UpsertAuthor :exec +INSERT INTO authors (id, name) +VALUES (?, ?) +ON CONFLICT (id) DO UPDATE SET + name = excluded.name +WHERE excluded.name <> ''; + +-- name: QuickUpsert :exec +INSERT INTO authors (id, name) VALUES (?, ?) ON CONFLICT (id) DO UPDATE SET name = excluded.name; diff --git a/internal/endtoend/testdata/fmt/sqlite/schema.sql b/internal/endtoend/testdata/fmt/sqlite/schema.sql new file mode 100644 index 0000000000..1d42f1cc18 --- /dev/null +++ b/internal/endtoend/testdata/fmt/sqlite/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE authors ( + id integer PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE TABLE "Events" ( + id integer PRIMARY KEY, + "EventName" text NOT NULL, + "order" integer NOT NULL +); diff --git a/internal/endtoend/testdata/fmt/sqlite/sqlc.yaml b/internal/endtoend/testdata/fmt/sqlite/sqlc.yaml new file mode 100644 index 0000000000..0b5a97a993 --- /dev/null +++ b/internal/endtoend/testdata/fmt/sqlite/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "sqlite" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/fmt/sqlite/stdout.txt b/internal/endtoend/testdata/fmt/sqlite/stdout.txt new file mode 100644 index 0000000000..b9201e3620 --- /dev/null +++ b/internal/endtoend/testdata/fmt/sqlite/stdout.txt @@ -0,0 +1,84 @@ +--- a/query.sql ++++ b/query.sql +@@ -1,12 +1,15 @@ + -- name: GetAuthor :one ++SELECT id, name, bio ++FROM authors ++WHERE id = ? ++LIMIT 1; +-select id,name , bio from authors +-where id = ? limit 1; + + -- name: PickyQuery :many ++SELECT ++ id, -- the primary key ++ name, ++ -- computed downstream ++ bio +-SELECT id, -- the primary key +- name, +- -- computed downstream +- bio + FROM authors + -- soft-deleted rows are filtered + WHERE bio IS NOT NULL +@@ -16,7 +19,8 @@ + SELECT /* inline note */ id, name FROM authors ORDER BY name; + + -- name: ListAuthors :many ++SELECT id, name, bio ++FROM authors +-SELECT id, name, bio FROM authors + ORDER BY name; + + -- name: GetEvent :one +@@ -23,8 +27,11 @@ + SELECT "EventName", "order" ++FROM "Events" ++WHERE id = ? ++LIMIT 1; +-FROM "Events" WHERE id = ? LIMIT 1; + + -- name: CountSigils :one ++SELECT count(*) ++FROM authors +-SELECT count(*) FROM authors + WHERE id <> @at_param AND id <> :colon_param AND id <> $dollar_param; + + -- name: TopAuthors :many +@@ -46,7 +53,7 @@ + -- name: MakeMeasurements :exec + CREATE TABLE IF NOT EXISTS measurements ( + id INTEGER PRIMARY KEY, ++ label VARYING CHARACTER(120), +- label VARYING CHARACTER(120), + ratio DECIMAL(10,5), + note + ); +@@ -58,7 +65,7 @@ + SELECT CAST(bio AS VARYING CHARACTER(120)) FROM authors LIMIT 1; + + -- name: MakeSearchIndex :exec ++CREATE VIRTUAL TABLE IF NOT EXISTS notes_fts USING fts5(body, tag UNINDEXED, tokenize = 'porter'); +-CREATE VIRTUAL TABLE IF NOT EXISTS notes_fts USING fts5(body, tag UNINDEXED, tokenize = 'porter'); + + -- name: MakeRecipeIndex :exec + CREATE VIRTUAL TABLE recipes_fts USING fts5( +@@ -67,7 +74,7 @@ + ); + + -- name: LoginName :one ++SELECT coalesce(bio, '') AS login FROM authors WHERE id = ? LIMIT 1; +-SELECT COALESCE(bio, '') AS login FROM authors WHERE id = ? LIMIT 1; + + -- name: SpelledJoins :many + SELECT a.id +@@ -74,6 +81,6 @@ + FROM authors AS a ++JOIN authors AS b ON a.id = b.id ++LEFT JOIN authors AS c ON a.id = c.id +-INNER JOIN authors AS b ON a.id = b.id +-LEFT OUTER JOIN authors AS c ON a.id = c.id + WHERE a.id != ? AND b.id == ? AND c.id <> ?; + + -- name: CommaJoin :one diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go index 7a25498414..91cfc660b9 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Author struct { ID int64 Name string diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go b/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go index fe6539a497..5f514710d8 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/full_outer_join/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,10 +11,11 @@ import ( ) const getAuthor = `-- name: GetAuthor :one -SELECT a.id, name, b.id, title FROM authors AS a -FULL OUTER JOIN books AS b - ON a.id = b.id -WHERE a.id = ? LIMIT 1 +SELECT a.id, name, b.id, title +FROM authors AS a +FULL JOIN books AS b ON a.id = b.id +WHERE a.id = ? +LIMIT 1 ` type GetAuthorRow struct { diff --git a/internal/endtoend/testdata/full_outer_join/sqlite/query.sql b/internal/endtoend/testdata/full_outer_join/sqlite/query.sql index b9feaba655..979d2557d3 100644 --- a/internal/endtoend/testdata/full_outer_join/sqlite/query.sql +++ b/internal/endtoend/testdata/full_outer_join/sqlite/query.sql @@ -1,5 +1,6 @@ -- name: GetAuthor :one -SELECT * FROM authors AS a -FULL OUTER JOIN books AS b - ON a.id = b.id -WHERE a.id = ? LIMIT 1; \ No newline at end of file +SELECT * +FROM authors AS a +FULL JOIN books AS b ON a.id = b.id +WHERE a.id = ? +LIMIT 1; diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go index 2727f2e2de..2208139112 100644 --- a/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go index ab5777dd4e..4727e1d36a 100644 --- a/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/func_aggregate/pganalyze/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go index 2727f2e2de..2208139112 100644 --- a/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go b/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go index 49595c515d..04707cb600 100644 --- a/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/func_aggregate/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -14,9 +14,9 @@ select percentile_disc(0.5) within group (order by authors.name) from authors ` -func (q *Queries) Percentile(ctx context.Context) (interface{}, error) { +func (q *Queries) Percentile(ctx context.Context) (any, error) { row := q.db.QueryRowContext(ctx, percentile) - var percentile_disc interface{} + var percentile_disc any err := row.Scan(&percentile_disc) return percentile_disc, err } diff --git a/internal/endtoend/testdata/func_args/pgx/v4/go/db.go b/internal/endtoend/testdata/func_args/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_args/pgx/v4/go/models.go b/internal/endtoend/testdata/func_args/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go index 8dd941b2f0..f520132643 100644 --- a/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args/pgx/v5/go/db.go b/internal/endtoend/testdata/func_args/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_args/pgx/v5/go/models.go b/internal/endtoend/testdata/func_args/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go index 1f236dc907..953e59d293 100644 --- a/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args/stdlib/go/db.go b/internal/endtoend/testdata/func_args/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_args/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_args/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_args/stdlib/go/models.go b/internal/endtoend/testdata/func_args/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_args/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_args/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go index 8e87563a6c..fbdc347401 100644 --- a/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_args/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go index cbbe3bb8bc..bf68c7c7b7 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go index cbbe3bb8bc..bf68c7c7b7 100644 --- a/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go index 09fda78b89..1fb02009db 100644 --- a/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_args_typecast/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_call_cast/mysql/go/db.go b/internal/endtoend/testdata/func_call_cast/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_call_cast/mysql/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_call_cast/mysql/go/models.go b/internal/endtoend/testdata/func_call_cast/mysql/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_call_cast/mysql/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go index 83504aa24e..8807bc6b96 100644 --- a/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go index d1d80d7fa1..02480c08dd 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go index e32d8a6983..9de4f9e8c7 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go index 0d22c19e45..2c648a810f 100644 --- a/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go index b81c84883b..5d39885531 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,7 +10,7 @@ import ( ) const demo = `-- name: Demo :one -SELECT CAST(CHAR(1,2,3,4,5) AS BLOB) AS col1 +SELECT CAST(char(1, 2, 3, 4, 5) AS BLOB) AS col1 ` func (q *Queries) Demo(ctx context.Context) ([]byte, error) { diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/query.sql b/internal/endtoend/testdata/func_call_cast/sqlite/query.sql index eb18aad656..2f27801ac5 100644 --- a/internal/endtoend/testdata/func_call_cast/sqlite/query.sql +++ b/internal/endtoend/testdata/func_call_cast/sqlite/query.sql @@ -1,2 +1,2 @@ -- name: Demo :one -SELECT CAST(CHAR(1,2,3,4,5) AS BLOB) AS col1 +SELECT CAST(char(1, 2, 3, 4, 5) AS BLOB) AS col1; diff --git a/internal/endtoend/testdata/func_match_types/mysql/go/db.go b/internal/endtoend/testdata/func_match_types/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_match_types/mysql/go/db.go +++ b/internal/endtoend/testdata/func_match_types/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_match_types/mysql/go/models.go b/internal/endtoend/testdata/func_match_types/mysql/go/models.go index 315221c85b..c3bea2393a 100644 --- a/internal/endtoend/testdata/func_match_types/mysql/go/models.go +++ b/internal/endtoend/testdata/func_match_types/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Book struct { ID int32 Title string diff --git a/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go b/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go index 2489a3a333..ebbde9761e 100644 --- a/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -18,7 +18,7 @@ group by author type AuthorPagesRow struct { Author string NumBooks int64 - TotalPages interface{} + TotalPages any } func (q *Queries) AuthorPages(ctx context.Context) ([]AuthorPagesRow, error) { diff --git a/internal/endtoend/testdata/func_match_types/postgresql/go/db.go b/internal/endtoend/testdata/func_match_types/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_match_types/postgresql/go/db.go +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_match_types/postgresql/go/models.go b/internal/endtoend/testdata/func_match_types/postgresql/go/models.go index 315221c85b..c3bea2393a 100644 --- a/internal/endtoend/testdata/func_match_types/postgresql/go/models.go +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Book struct { ID int32 Title string diff --git a/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go b/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go index f64610ca97..5a1be47c96 100644 --- a/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_match_types/sqlite/go/db.go b/internal/endtoend/testdata/func_match_types/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_match_types/sqlite/go/db.go +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_match_types/sqlite/go/models.go b/internal/endtoend/testdata/func_match_types/sqlite/go/models.go index 6f96b7c920..73110b7775 100644 --- a/internal/endtoend/testdata/func_match_types/sqlite/go/models.go +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Book struct { ID int64 Title string diff --git a/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go index 904ab41fd0..8e56ea38b6 100644 --- a/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/func_match_types/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,9 +11,9 @@ import ( ) const authorPages = `-- name: AuthorPages :many -select author, count(title) as num_books, sum(pages) as total_pages -from books -group by author +SELECT author, count(title) AS num_books, sum(pages) AS total_pages +FROM books +GROUP BY author ` type AuthorPagesRow struct { diff --git a/internal/endtoend/testdata/func_match_types/sqlite/query.sql b/internal/endtoend/testdata/func_match_types/sqlite/query.sql index 3452aebe01..fb20ace7c3 100644 --- a/internal/endtoend/testdata/func_match_types/sqlite/query.sql +++ b/internal/endtoend/testdata/func_match_types/sqlite/query.sql @@ -1,4 +1,4 @@ -- name: AuthorPages :many -select author, count(title) as num_books, sum(pages) as total_pages -from books -group by author; +SELECT author, count(title) AS num_books, sum(pages) AS total_pages +FROM books +GROUP BY author; diff --git a/internal/endtoend/testdata/func_nullability/googlesql/exec.json b/internal/endtoend/testdata/func_nullability/googlesql/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/func_nullability/googlesql/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/func_nullability/googlesql/go/db.go b/internal/endtoend/testdata/func_nullability/googlesql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/func_nullability/googlesql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_nullability/googlesql/go/models.go b/internal/endtoend/testdata/func_nullability/googlesql/go/models.go new file mode 100644 index 0000000000..2880a343dc --- /dev/null +++ b/internal/endtoend/testdata/func_nullability/googlesql/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" + "math/big" + "time" + + "cloud.google.com/go/spanner" +) + +type Event struct { + ID int64 + Name string + Nickname sql.NullString + Amount big.Rat + Ratio sql.NullFloat64 + HappenedAt time.Time + Details spanner.NullJSON + Scores []spanner.NullInt64 +} diff --git a/internal/endtoend/testdata/func_nullability/googlesql/go/query.sql.go b/internal/endtoend/testdata/func_nullability/googlesql/go/query.sql.go new file mode 100644 index 0000000000..62cd454cf2 --- /dev/null +++ b/internal/endtoend/testdata/func_nullability/googlesql/go/query.sql.go @@ -0,0 +1,205 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" + + "cloud.google.com/go/civil" + "cloud.google.com/go/spanner" +) + +const aggregates = `-- name: Aggregates :one +SELECT COUNT(*) AS total, SUM(amount) AS total_amount, AVG(id) AS mean_id, MAX(name) AS last_name, + ARRAY_AGG(id) AS ids, STRING_AGG(name, ',') AS names +FROM events +` + +type AggregatesRow struct { + Total int64 + TotalAmount spanner.NullNumeric + MeanID sql.NullFloat64 + LastName sql.NullString + Ids []spanner.NullInt64 + Names sql.NullString +} + +func (q *Queries) Aggregates(ctx context.Context) (AggregatesRow, error) { + row := q.db.QueryRowContext(ctx, aggregates) + var i AggregatesRow + err := row.Scan( + &i.Total, + &i.TotalAmount, + &i.MeanID, + &i.LastName, + &i.Ids, + &i.Names, + ) + return i, err +} + +const conditionals = `-- name: Conditionals :many +SELECT COALESCE(nickname, name) AS display_name, IFNULL(ratio, 0) AS ratio_or_zero, + NULLIF(name, '') AS non_empty, IF(id > 10, name, nickname) AS chosen, GREATEST(id, 1) AS at_least_one +FROM events +` + +type ConditionalsRow struct { + DisplayName string + RatioOrZero float64 + NonEmpty sql.NullString + Chosen sql.NullString + AtLeastOne int64 +} + +func (q *Queries) Conditionals(ctx context.Context) ([]ConditionalsRow, error) { + rows, err := q.db.QueryContext(ctx, conditionals) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ConditionalsRow + for rows.Next() { + var i ConditionalsRow + if err := rows.Scan( + &i.DisplayName, + &i.RatioOrZero, + &i.NonEmpty, + &i.Chosen, + &i.AtLeastOne, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const mayBeNull = `-- name: MayBeNull :many +SELECT JSON_VALUE(details, '$.kind') AS kind, REGEXP_EXTRACT(name, 'a+') AS run, + SAFE_DIVIDE(id, 0) AS ratio, SAFE.SUBSTR(name, 1, 3) AS prefix, ARRAY_FIRST(scores) AS first_score +FROM events +` + +type MayBeNullRow struct { + Kind sql.NullString + Run sql.NullString + Ratio sql.NullFloat64 + Prefix sql.NullString + FirstScore sql.NullInt64 +} + +func (q *Queries) MayBeNull(ctx context.Context) ([]MayBeNullRow, error) { + rows, err := q.db.QueryContext(ctx, mayBeNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []MayBeNullRow + for rows.Next() { + var i MayBeNullRow + if err := rows.Scan( + &i.Kind, + &i.Run, + &i.Ratio, + &i.Prefix, + &i.FirstScore, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const paramsFromFunctions = `-- name: ParamsFromFunctions :many +SELECT id FROM events +WHERE STARTS_WITH(name, @prefix) AND TIMESTAMP_TRUNC(happened_at, DAY) = @day + AND EXTRACT(DATE FROM happened_at) = @on AND ARRAY_INCLUDES(scores, @score) +` + +type ParamsFromFunctionsParams struct { + Prefix string + Day time.Time + On civil.Date + Score int64 +} + +func (q *Queries) ParamsFromFunctions(ctx context.Context, arg ParamsFromFunctionsParams) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, paramsFromFunctions, + sql.Named("prefix", arg.Prefix), + sql.Named("day", arg.Day), + sql.Named("on", arg.On), + sql.Named("score", arg.Score), + ) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const propagates = `-- name: Propagates :many +SELECT UPPER(name) AS upper_name, UPPER(nickname) AS upper_nickname, LENGTH(nickname) AS nickname_length +FROM events +` + +type PropagatesRow struct { + UpperName string + UpperNickname sql.NullString + NicknameLength sql.NullInt64 +} + +func (q *Queries) Propagates(ctx context.Context) ([]PropagatesRow, error) { + rows, err := q.db.QueryContext(ctx, propagates) + if err != nil { + return nil, err + } + defer rows.Close() + var items []PropagatesRow + for rows.Next() { + var i PropagatesRow + if err := rows.Scan(&i.UpperName, &i.UpperNickname, &i.NicknameLength); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/func_nullability/googlesql/query.sql b/internal/endtoend/testdata/func_nullability/googlesql/query.sql new file mode 100644 index 0000000000..517af79cc8 --- /dev/null +++ b/internal/endtoend/testdata/func_nullability/googlesql/query.sql @@ -0,0 +1,23 @@ +-- name: Aggregates :one +SELECT COUNT(*) AS total, SUM(amount) AS total_amount, AVG(id) AS mean_id, MAX(name) AS last_name, + ARRAY_AGG(id) AS ids, STRING_AGG(name, ',') AS names +FROM events; + +-- name: Propagates :many +SELECT UPPER(name) AS upper_name, UPPER(nickname) AS upper_nickname, LENGTH(nickname) AS nickname_length +FROM events; + +-- name: MayBeNull :many +SELECT JSON_VALUE(details, '$.kind') AS kind, REGEXP_EXTRACT(name, 'a+') AS run, + SAFE_DIVIDE(id, 0) AS ratio, SAFE.SUBSTR(name, 1, 3) AS prefix, ARRAY_FIRST(scores) AS first_score +FROM events; + +-- name: Conditionals :many +SELECT COALESCE(nickname, name) AS display_name, IFNULL(ratio, 0) AS ratio_or_zero, + NULLIF(name, '') AS non_empty, IF(id > 10, name, nickname) AS chosen, GREATEST(id, 1) AS at_least_one +FROM events; + +-- name: ParamsFromFunctions :many +SELECT id FROM events +WHERE STARTS_WITH(name, @prefix) AND TIMESTAMP_TRUNC(happened_at, DAY) = @day + AND EXTRACT(DATE FROM happened_at) = @on AND ARRAY_INCLUDES(scores, @score); diff --git a/internal/endtoend/testdata/func_nullability/googlesql/schema.sql b/internal/endtoend/testdata/func_nullability/googlesql/schema.sql new file mode 100644 index 0000000000..cce2a7cf8e --- /dev/null +++ b/internal/endtoend/testdata/func_nullability/googlesql/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE events ( + id INT64 NOT NULL, + name STRING(MAX) NOT NULL, + nickname STRING(MAX), + amount NUMERIC NOT NULL, + ratio FLOAT64, + happened_at TIMESTAMP NOT NULL, + details JSON NOT NULL, + scores ARRAY NOT NULL, +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/func_nullability/googlesql/sqlc.json b/internal/endtoend/testdata/func_nullability/googlesql/sqlc.json new file mode 100644 index 0000000000..40d6c76211 --- /dev/null +++ b/internal/endtoend/testdata/func_nullability/googlesql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "googlesql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/func_out_param/issue.md b/internal/endtoend/testdata/func_out_param/issue.md new file mode 100644 index 0000000000..1b8779f2ff --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1654 diff --git a/internal/endtoend/testdata/func_out_param/pgx/go/db.go b/internal/endtoend/testdata/func_out_param/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_out_param/pgx/go/models.go b/internal/endtoend/testdata/func_out_param/pgx/go/models.go new file mode 100644 index 0000000000..4e97f66a99 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go b/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go new file mode 100644 index 0000000000..2208cc1620 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const createAuthor = `-- name: CreateAuthor :one +SELECT id FROM add_author ( + $1, $2 +) +` + +type CreateAuthorParams struct { + Name string + Bio string +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (pgtype.Int4, error) { + row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + var id pgtype.Int4 + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/func_out_param/pgx/query.sql b/internal/endtoend/testdata/func_out_param/pgx/query.sql new file mode 100644 index 0000000000..b23c7dca49 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: CreateAuthor :one +SELECT * FROM add_author ( + sqlc.arg(name), sqlc.arg(bio) +); diff --git a/internal/endtoend/testdata/func_out_param/pgx/schema.sql b/internal/endtoend/testdata/func_out_param/pgx/schema.sql new file mode 100644 index 0000000000..97c1022d14 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/schema.sql @@ -0,0 +1,14 @@ +-- Example queries for sqlc +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); + +CREATE OR REPLACE FUNCTION add_author (name text, bio text, out id int) +AS $$ +DECLARE +BEGIN + id = 123; +END; +$$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_out_param/pgx/sqlc.yaml b/internal/endtoend/testdata/func_out_param/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_out_param/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/db.go b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/db.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go index 9597c2cdeb..00ee09a655 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go index 092a37679b..ebdc67b295 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go index e6f9c7e038..456c69230c 100644 --- a/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_date/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_return_record/issue.md b/internal/endtoend/testdata/func_return_record/issue.md new file mode 100644 index 0000000000..56e68299aa --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1979 diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/exec.json b/internal/endtoend/testdata/func_return_record/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/db.go b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/models.go b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..7d67832fd6 --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type MyTable struct { + Data []byte +} diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..48e3ea33ed --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getData = `-- name: GetData :one +SELECT key, value +FROM my_table, jsonb_each(data) +LIMIT 1 +` + +type GetDataRow struct { + Key pgtype.Text + Value []byte +} + +func (q *Queries) GetData(ctx context.Context) (GetDataRow, error) { + row := q.db.QueryRow(ctx, getData) + var i GetDataRow + err := row.Scan(&i.Key, &i.Value) + return i, err +} diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/query.sql b/internal/endtoend/testdata/func_return_record/postgresql/pgx/query.sql new file mode 100644 index 0000000000..c540b6ac53 --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: GetData :one +SELECT key, value +FROM my_table, jsonb_each(data) +LIMIT 1; diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/schema.sql b/internal/endtoend/testdata/func_return_record/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..4db45f9723 --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE my_table ( + data JSONB NOT NULL +); diff --git a/internal/endtoend/testdata/func_return_record/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/func_return_record/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_return_record/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go index 7167ba9f5b..6ada9c4632 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go index 7167ba9f5b..6ada9c4632 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go index 563fd9df33..147fc31b1b 100644 --- a/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_return_series/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/func_return_table/issue.md b/internal/endtoend/testdata/func_return_table/issue.md new file mode 100644 index 0000000000..119a3cd987 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1322 diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/exec.json b/internal/endtoend/testdata/func_return_table/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/db.go b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/models.go b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..5c6bea7efd --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Account struct { + ID int32 + Username string + Password string +} diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..f09cfb2a96 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const foo = `-- name: Foo :one +SELECT register_account FROM register_account('a', 'b') +` + +func (q *Queries) Foo(ctx context.Context) (pgtype.Int4, error) { + row := q.db.QueryRow(ctx, foo) + var register_account pgtype.Int4 + err := row.Scan(®ister_account) + return register_account, err +} diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/query.sql b/internal/endtoend/testdata/func_return_table/postgresql/pgx/query.sql new file mode 100644 index 0000000000..8a3db0f6d8 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: Foo :one +SELECT * FROM register_account('a', 'b'); diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/schema.sql b/internal/endtoend/testdata/func_return_table/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..e9ebf5e423 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/schema.sql @@ -0,0 +1,27 @@ +CREATE TABLE accounts ( + id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + username TEXT NOT NULL UNIQUE, + password TEXT NOT NULL +); + +-- this is a useless and horrifying function cause we don't hash +-- the password, this is just to repro the bug in sqlc +CREATE OR REPLACE FUNCTION register_account( + _username TEXT, + _password VARCHAR(70) +) +RETURNS TABLE ( + account_id INTEGER +) +AS $$ +BEGIN + INSERT INTO accounts (username, password) + VALUES ( + _username, + _password + ) + RETURNING id INTO account_id; + + RETURN NEXT; +END; +$$ LANGUAGE plpgsql; diff --git a/internal/endtoend/testdata/func_return_table/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/func_return_table/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_return_table_columns/issue.md b/internal/endtoend/testdata/func_return_table_columns/issue.md new file mode 100644 index 0000000000..ec4e1128f7 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2386 diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/exec.json b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/db.go b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/models.go b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..e7fce1db14 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Blog struct { + ID int32 + Name string +} diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..6d65297c96 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const testFuncSelectBlog = `-- name: TestFuncSelectBlog :many +select id, name from test_select_blog($1) +` + +type TestFuncSelectBlogRow struct { + ID pgtype.Int4 + Name pgtype.Text +} + +func (q *Queries) TestFuncSelectBlog(ctx context.Context, pID int32) ([]TestFuncSelectBlogRow, error) { + rows, err := q.db.Query(ctx, testFuncSelectBlog, pID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestFuncSelectBlogRow + for rows.Next() { + var i TestFuncSelectBlogRow + if err := rows.Scan(&i.ID, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/query.sql b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/query.sql new file mode 100644 index 0000000000..73e2396558 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: TestFuncSelectBlog :many +select id, name from test_select_blog($1); diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/schema.sql b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..ccf032e687 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/schema.sql @@ -0,0 +1,11 @@ +create table blog ( + id serial primary key, + name text not null +); + +create function test_select_blog(in p_id int) + returns table (id int, name text) AS $$ +BEGIN RETURN QUERY + select id, name from blog where id = p_id; +END; +$$ language plpgsql; diff --git a/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_return_table_columns/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_star_expansion/issue.md b/internal/endtoend/testdata/func_star_expansion/issue.md new file mode 100644 index 0000000000..c9b8798441 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2364 diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/exec.json b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/db.go b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/models.go b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..a1a6c48434 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..1072289270 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/go/query.sql.go @@ -0,0 +1,45 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const testFuncGetTime = `-- name: TestFuncGetTime :one +select test_func_get_time from test_func_get_time() +` + +func (q *Queries) TestFuncGetTime(ctx context.Context) (pgtype.Timestamp, error) { + row := q.db.QueryRow(ctx, testFuncGetTime) + var test_func_get_time pgtype.Timestamp + err := row.Scan(&test_func_get_time) + return test_func_get_time, err +} + +const testFuncSelectBlog = `-- name: TestFuncSelectBlog :one +select test_func_select_blog from test_func_select_blog($1) +` + +func (q *Queries) TestFuncSelectBlog(ctx context.Context, pID int32) (any, error) { + row := q.db.QueryRow(ctx, testFuncSelectBlog, pID) + var test_func_select_blog any + err := row.Scan(&test_func_select_blog) + return test_func_select_blog, err +} + +const testFuncSelectString = `-- name: TestFuncSelectString :one +select test_func_select_string from test_func_select_string($1) +` + +func (q *Queries) TestFuncSelectString(ctx context.Context, pString string) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, testFuncSelectString, pString) + var test_func_select_string pgtype.Text + err := row.Scan(&test_func_select_string) + return test_func_select_string, err +} diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/query.sql b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/query.sql new file mode 100644 index 0000000000..edb27a30f5 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/query.sql @@ -0,0 +1,8 @@ +-- name: TestFuncGetTime :one +select * from test_func_get_time(); + +-- name: TestFuncSelectString :one +select * from test_func_select_string($1); + +-- name: TestFuncSelectBlog :one +select * from test_func_select_blog($1); diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/schema.sql b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..eb3de78724 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/schema.sql @@ -0,0 +1,20 @@ +create function test_func_get_time () + returns timestamp AS $$ +Begin + return now(); +End; +$$ language plpgsql; + +create function test_func_select_string (in p_string text) + returns text AS $$ +Begin + return p_string; +End; +$$ language plpgsql; + +create function test_func_select_blog(in p_id int) + returns table (id int, name text, created_at timestamp, updated_at timestamp) AS $$ +BEGIN RETURN QUERY + select id, name, created_at, updated_at from blog where id = p_id; +END; +$$ language plpgsql; diff --git a/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/func_star_expansion/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go index ed6b9bda7f..866324d136 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go index 07cd383acf..cca8f98d47 100644 --- a/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/func_variadic/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/db.go b/internal/endtoend/testdata/geometric/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/models.go b/internal/endtoend/testdata/geometric/pgx/v4/go/models.go index 8075221739..99547dd3cb 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go index 5121a4e820..fdeffb2df1 100644 --- a/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/db.go b/internal/endtoend/testdata/geometric/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/models.go b/internal/endtoend/testdata/geometric/pgx/v5/go/models.go index bd1635c461..cbec285939 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go index 5121a4e820..fdeffb2df1 100644 --- a/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/geometric/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/go.mod b/internal/endtoend/testdata/go.mod index 535a3b8d29..be73d51809 100644 --- a/internal/endtoend/testdata/go.mod +++ b/internal/endtoend/testdata/go.mod @@ -1,34 +1,102 @@ module github.com/sqlc-dev/sqlc/endtoend -go 1.18 +go 1.26.0 require ( - github.com/go-sql-driver/mysql v1.7.0 - github.com/gofrs/uuid v4.0.0+incompatible - github.com/google/uuid v1.3.0 - github.com/hexon/mysqltsv v0.1.0 - github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853 - github.com/jackc/pgtype v1.6.2 - github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904 - github.com/jackc/pgx/v5 v5.0.1 - github.com/lib/pq v1.9.0 - github.com/sqlc-dev/pqtype v0.2.0 + cloud.google.com/go v0.123.0 + cloud.google.com/go/spanner v1.96.1 + github.com/duckdb/duckdb-go/v2 v2.10506.0 + github.com/go-sql-driver/mysql v1.10.1 + github.com/gofrs/uuid v4.4.0+incompatible + github.com/google/uuid v1.6.0 + github.com/hexon/mysqltsv v0.2.2 + github.com/jackc/pgconn v1.14.3 + github.com/jackc/pgtype v1.14.4 + github.com/jackc/pgx/v4 v4.18.3 + github.com/jackc/pgx/v5 v5.11.0 + github.com/lib/pq v1.12.3 + github.com/microsoft/go-mssqldb v1.11.2 + github.com/pgvector/pgvector-go v0.4.1 + github.com/shopspring/decimal v1.6.0 + github.com/sqlc-dev/pqtype v0.3.0 github.com/sqlc-dev/sqlc-testdata v1.0.0 github.com/volatiletech/null/v8 v8.1.2 gopkg.in/guregu/null.v4 v4.0.0 ) require ( + cel.dev/expr v0.25.2 // indirect + cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a // indirect + cloud.google.com/go/auth/oauth2adapt v0.3.0 // indirect + cloud.google.com/go/compute/metadata v0.10.0 // indirect + cloud.google.com/go/monitoring v1.30.0 // indirect + filippo.io/edwards25519 v1.2.0 // indirect + github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.6.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.34.0 // indirect + github.com/apache/arrow-go/v18 v18.5.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect + github.com/duckdb/duckdb-go-bindings v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/darwin-amd64 v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/darwin-arm64 v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/linux-amd64 v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/linux-arm64 v0.10506.0 // indirect + github.com/duckdb/duckdb-go-bindings/lib/windows-amd64 v0.10506.0 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.37.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect + github.com/felixge/httpsnoop v1.1.0 // indirect github.com/friendsofgo/errors v0.9.2 // indirect + github.com/go-jose/go-jose/v4 v4.1.4 // indirect + github.com/go-logr/logr v1.4.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/goccy/go-json v0.10.5 // indirect + github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/google/flatbuffers v25.12.19+incompatible // indirect + github.com/google/s2a-go v0.1.11 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.23 // indirect + github.com/googleapis/gax-go/v2 v2.26.2 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.0.1 // indirect - github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect + github.com/jackc/pgproto3/v2 v2.3.3 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/klauspost/compress v1.18.3 // indirect + github.com/klauspost/cpuid/v2 v2.3.0 // indirect + github.com/pierrec/lz4/v4 v4.1.25 // indirect + github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect + github.com/spiffe/go-spiffe/v2 v2.8.1 // indirect github.com/volatiletech/inflect v0.0.1 // indirect github.com/volatiletech/randomize v0.0.1 // indirect github.com/volatiletech/strmangle v0.0.1 // indirect - golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect + github.com/zeebo/xxh3 v1.1.0 // indirect + go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/detectors/gcp v1.44.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 // indirect + go.opentelemetry.io/otel v1.45.0 // indirect + go.opentelemetry.io/otel/metric v1.45.0 // indirect + go.opentelemetry.io/otel/sdk v1.45.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.45.0 // indirect + go.opentelemetry.io/otel/trace v1.45.0 // indirect + golang.org/x/crypto v0.58.0 // indirect + golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect + golang.org/x/mod v0.42.0 // indirect + golang.org/x/net v0.61.0 // indirect + golang.org/x/oauth2 v0.37.0 // indirect + golang.org/x/sync v0.24.0 // indirect + golang.org/x/sys v0.49.0 // indirect + golang.org/x/telemetry v0.0.0-20260924152758-ed294f943157 // indirect + golang.org/x/text v0.43.0 // indirect + golang.org/x/time v0.16.0 // indirect + golang.org/x/tools v0.51.0 // indirect + golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect + google.golang.org/api v0.304.0 // indirect + google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8 // indirect + google.golang.org/grpc v1.84.0 // indirect + google.golang.org/protobuf v1.36.12 // indirect ) diff --git a/internal/endtoend/testdata/go.sum b/internal/endtoend/testdata/go.sum index a1cc055483..2510bf5c7c 100644 --- a/internal/endtoend/testdata/go.sum +++ b/internal/endtoend/testdata/go.sum @@ -1,25 +1,160 @@ +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= +cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= +cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a h1:jW1ZLFy9oa5ai8LOI40z6s+DL1cO/L1KSm9hVGnibn8= +cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a/go.mod h1:1dmBXa9xfBvBr39ZnDUDkaaA91ccq9CcqENDgJA4d7c= +cloud.google.com/go/auth/oauth2adapt v0.3.0 h1:FY8oSZpCYoUNv6QxVODuMjQz4IlSOVeiQtZ08vLPz88= +cloud.google.com/go/auth/oauth2adapt v0.3.0/go.mod h1:7+2uCm7++XFO+/lN06c2HXpDXb/NMNn2/UwyBPbTnkk= +cloud.google.com/go/compute/metadata v0.10.0 h1:pyKMUQSwchgkIBBJGdILqQbs/BNJXqwSA7Ej6LAvvtY= +cloud.google.com/go/compute/metadata v0.10.0/go.mod h1:rGFHRrIif570kSibjFTMbt6/4/tzgJWFGI/HVol4GIk= +cloud.google.com/go/iam v1.12.0 h1:Aki3bX9aHUDKPHfnRJfDcTdVedvy6quGBQcTqx3DRXk= +cloud.google.com/go/iam v1.12.0/go.mod h1:FEZ4lXpADAC2AIpQY7LANNjjwyQ2jK439CI2VaD+sLY= +cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM= +cloud.google.com/go/longrunning v1.2.0/go.mod h1:5KMQALFGOCtFoi2xSOA1u3H7WKlhmckgiyFw7+LGQp0= +cloud.google.com/go/monitoring v1.30.0 h1:r/d+JUbyKmJ8b07iznuKfzVzrIXTWxHQ3lBRm3x2LlY= +cloud.google.com/go/monitoring v1.30.0/go.mod h1:htlUR0QWVMrjFzZmN4LGnMAve9xB/eduwjmINxVZ8RM= +cloud.google.com/go/spanner v1.96.1 h1:pLmq5/Fj+Yu6YGRBz9oMPm3ZRQIeG14FYBWFwhZZaIA= +cloud.google.com/go/spanner v1.96.1/go.mod h1:VqMSp/YlTofUq1q6ekkXBAmhAs6X860YL0I8wo7i+k0= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1 h1:zvXfGJCWvywnCA814d8ZiVyt+fm9nnTE8xSb99zRyfo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1/go.mod h1:iptorS+VYKFL2N6PnebpS91dubG35eAOEERnT4PJbQU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1 h1:u93s+zU2JD62im61Bm5CZIc1ZrOJaIAWEg0WOrMVkEo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1/go.mod h1:oXtinPO4OLj9d1DOTrqrL1oRwGhcqadvAmrl6wTeGlk= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 h1:MaKvxE6D0KkjOg6Wd9M00iqP5PR0kUxCfiezes4JweM= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0/go.mod h1:i2h9fsTFKZorh8RdV2IcSUf/Qj98GlTkrTvUbX/s8as= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 h1:Nljr4q1GRA/5vCrMONS+g4u4LRHNgOXVSh3O43J2CnI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0/go.mod h1:Y33QHnf0FfdVewFFISOGe20mkZbxX4H839o955/PoeI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.6.0 h1:BzsL0qE7LvtTEtXG7Dt5NS1EP0CQwI21HZfj9aGghhw= +github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.6.0/go.mod h1:I7kE2kM3qCr9QPT4cU4cCFYkEpVyVr16YOGUHzy+nR0= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.34.0 h1:yzIYdwuro811Z27D3T80Wkd3rqZzb0K43nner7Eh1yE= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.34.0/go.mod h1:pJTkW8hEUIIi3Pf65lPZOnn4Y81yCllX6IWk2jNXdkM= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ= +github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= +github.com/apache/arrow-go/v18 v18.5.1 h1:yaQ6zxMGgf9YCYw4/oaeOU3AULySDlAYDOcnr4LdHdI= +github.com/apache/arrow-go/v18 v18.5.1/go.mod h1:OCCJsmdq8AsRm8FkBSSmYTwL/s4zHW9CqxeBxEytkNE= +github.com/apache/thrift v0.22.0 h1:r7mTJdj51TMDe6RtcmNdQxgn9XcyfGDOzegMDRg47uc= +github.com/apache/thrift v0.22.0/go.mod h1:1e7J/O1Ae6ZQMTYdy9xa3w9k+XHWPfRvdPyJeynQ+/g= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/duckdb/duckdb-go-bindings v0.10506.0 h1:+s/v55ghAy8MV/QJnwuafD9n+ZoYQkrRd/ceSU0KReA= +github.com/duckdb/duckdb-go-bindings v0.10506.0/go.mod h1:BKswa3lVlgeqO0nzDEQdtVPqPoUbXsVM6zdjhgEDFgU= +github.com/duckdb/duckdb-go-bindings/lib/darwin-amd64 v0.10506.0 h1:bMccC8xWnr/3BjUKQfQxD8MUJPeME3GSHvddWvBKK+M= +github.com/duckdb/duckdb-go-bindings/lib/darwin-amd64 v0.10506.0/go.mod h1:EnAvZh1kNJHp5yF+M1ZHNEvapnmt6anq1xXHVrAGqMo= +github.com/duckdb/duckdb-go-bindings/lib/darwin-arm64 v0.10506.0 h1:TzekQov7ntc+Xahq/puCqVHZgJh4ApJLsqEBpOiIXSA= +github.com/duckdb/duckdb-go-bindings/lib/darwin-arm64 v0.10506.0/go.mod h1:IGLSeEcFhNeZF16aVjQCULD7TsFZKG5G7SyKJAXKp5c= +github.com/duckdb/duckdb-go-bindings/lib/linux-amd64 v0.10506.0 h1:yy2TUU+YWxiBiOQryYseUl0AcUzoFFYRmmrCGijUxiU= +github.com/duckdb/duckdb-go-bindings/lib/linux-amd64 v0.10506.0/go.mod h1:KAIynZ0GHCS7X5fRyuFnQMg/SZBPK/bS9OCOVojClxw= +github.com/duckdb/duckdb-go-bindings/lib/linux-arm64 v0.10506.0 h1:HWUiLpeaZwUFg08Rs2eSpPbbaw3yEB2t96r+5NEbAgs= +github.com/duckdb/duckdb-go-bindings/lib/linux-arm64 v0.10506.0/go.mod h1:81SGOYoEUs8qaAfSk1wRfM5oobrIJ5KI7AzYhK6/bvQ= +github.com/duckdb/duckdb-go-bindings/lib/windows-amd64 v0.10506.0 h1:6PtbnpeUum+J/iNbI56QhZmSfbvy1syhvzWsoH1NKJc= +github.com/duckdb/duckdb-go-bindings/lib/windows-amd64 v0.10506.0/go.mod h1:K25pJL26ARblGDeuAkrdblFvUen92+CwksLtPEHRqqQ= +github.com/duckdb/duckdb-go/v2 v2.10506.0 h1:mcZjUQ/kSNeZdtGCqyj5/JEDUdj7/kvILfIOUTzQIu0= +github.com/duckdb/duckdb-go/v2 v2.10506.0/go.mod h1:6pLO+4GMcb0q36+z+RlQ7h+MMxum1lL0eAVf4GsPAxs= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= +github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= github.com/friendsofgo/errors v0.9.2 h1:X6NYxef4efCBdwI7BgS820zFaN7Cphrmb+Pljdzjtgk= github.com/friendsofgo/errors v0.9.2/go.mod h1:yCvFW5AkDIL9qn7suHVLiI/gH228n7PC4Pn44IGoTOI= -github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= -github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME= +github.com/go-sql-driver/mysql v1.10.1/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= +github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= +github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.7.0-rc.1 h1:YojYx61/OLFsiv6Rw1Z96LpldJIy31o+UHmwAUMJ6/U= +github.com/golang/mock v1.7.0-rc.1/go.mod h1:s42URUywIqd+OcERslBJvOjepvNymP31m3q8d/GkuRs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= +github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/flatbuffers v25.12.19+incompatible h1:haMV2JRRJCe1998HeW/p0X9UaMTK6SDo0ffLn2+DbLs= +github.com/google/flatbuffers v25.12.19+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hexon/mysqltsv v0.1.0 h1:48wYQlsPH8ZEkKAVCdsOYzMYAlEoevw8ZWD8rqYPdlg= -github.com/hexon/mysqltsv v0.1.0/go.mod h1:p3vPBkpxebjHWF1bWKYNcXx5pFu+yAG89QZQEKSvVrY= +github.com/google/s2a-go v0.1.11 h1:7v1V1TraNGP63WptsAkNqr2w8jgm4vM6A6qx6Lsw9iM= +github.com/google/s2a-go v0.1.11/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.23 h1:J+VGF1wjAM2dU2kKUXZxJdDppRLReWP7KWcclfngQhc= +github.com/googleapis/enterprise-certificate-proxy v0.3.23/go.mod h1:Y8NO/15GNLkrXI3OR5xOFmeU3XLX1sLSdtlXgJ0zmIw= +github.com/googleapis/gax-go/v2 v2.26.2 h1:ydkmNXxj7bEmmeK5AihkKnWxyOyBR9TDebvp5L5izk8= +github.com/googleapis/gax-go/v2 v2.26.2/go.mod h1:sMKqnMesnKH+3wiRJROcttA+cJoZoGbZl1vDQ8XYtGk= +github.com/hexon/mysqltsv v0.2.2 h1:oF4pNJfgjipAy7sqyp7JVt9r5rOVQe8mQJg8z2Bf+VY= +github.com/hexon/mysqltsv v0.2.2/go.mod h1:p3vPBkpxebjHWF1bWKYNcXx5pFu+yAG89QZQEKSvVrY= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= @@ -27,14 +162,17 @@ github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgO github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= -github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk= -github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= -github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853 h1:LRlrfJW9S99uiOCY8F/qLvX1yEY1TVAaCBHFb79yHBQ= -github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= +github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= +github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w= +github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= @@ -42,79 +180,113 @@ github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.1 h1:Rdjp4NFjwHnEslx2b66FfCI2S0LhO4itac3hXz6WX9M= -github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag= +github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= -github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0= -github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po= -github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ= -github.com/jackc/pgtype v1.6.2 h1:b3pDeuhbbzBYcg5kwNmNDun4pFUD/0AAr1kLXZLeNt8= -github.com/jackc/pgtype v1.6.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= +github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= +github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.14.4 h1:fKuNiCumbKTAIxQwXfB/nsrnkEI6bPJrrSiMKgbJ2j8= +github.com/jackc/pgtype v1.14.4/go.mod h1:aKeozOde08iifGosdJpz9MBZonJOUJxqNpPBcMJTlVA= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= -github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA= -github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o= -github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904 h1:SdGWuGg+Cpxq6Z+ArXt0nafaKeTvtKGEoW+yvycspUU= -github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= -github.com/jackc/pgx/v5 v5.0.1 h1:JZu9othr7l8so2JMDAGeDUMXqERAuZpovyfl4H50tdg= -github.com/jackc/pgx/v5 v5.0.1/go.mod h1:JBbvW3Hdw77jKl9uJrEDATUZIFM2VFPzRq4RWIhkF4o= +github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= +github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/pgx/v4 v4.18.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA= +github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/pgx/v5 v5.11.0 h1:IzBBtyK9AHqf98cctWFifYSci2hgQR/cd56wB4p+ogg= +github.com/jackc/pgx/v5 v5.11.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0= +github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= +github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= +github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw= +github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= +github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= +github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.9.0 h1:L8nSXQQzAYByakOFMTwpjRoHsMJklur4Gi59b6VivR8= -github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ= +github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/microsoft/go-mssqldb v1.11.2 h1:FCgeBIK8um2+X4tbun6Q71N1KsfyCDPKY41e1yGVjSE= +github.com/microsoft/go-mssqldb v1.11.2/go.mod h1:CYgwG5AMXFojbjTg+GNP5G/y6uz1BhTyZaPqQWzkGnQ= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8DFdX7uMikMLXX4oubIzJF4kv/wI= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= +github.com/pgvector/pgvector-go v0.4.1 h1:Oaj0mC0Ky8KaTweNHHpLwyFlN6a0nUFoo1vgSFTEhPI= +github.com/pgvector/pgvector-go v0.4.1/go.mod h1:4fSXyjl1TYAIdByAql6JazKWRr2s7J0g4hcRY5cBFCk= +github.com/pierrec/lz4/v4 v4.1.25 h1:kocOqRffaIbU5djlIBr7Wh+cx82C0vtFb0fOurZHqD0= +github.com/pierrec/lz4/v4 v4.1.25/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= -github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.6.0 h1:DcTwjCj4tJPLuGZYsR9W0hyX9pQwMIkdo26Ig1T9xX4= +github.com/shopspring/decimal v1.6.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sqlc-dev/pqtype v0.2.0 h1:zfzDpAxjCU0/GO7EgZ7ELUh0w28SrMSHzO3rH5Wd3is= -github.com/sqlc-dev/pqtype v0.2.0/go.mod h1:oyUjp5981ctiL9UYvj1bVvCKi8OXkCa0u645hce7CAs= +github.com/spiffe/go-spiffe/v2 v2.8.1 h1:eXZMLsu+3MLEPJyGJkolqtVrteZfQdUpOWj6LTiDl/E= +github.com/spiffe/go-spiffe/v2 v2.8.1/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= +github.com/sqlc-dev/pqtype v0.3.0 h1:b09TewZ3cSnO5+M1Kqq05y0+OjqIptxELaSayg7bmqk= +github.com/sqlc-dev/pqtype v0.3.0/go.mod h1:oyUjp5981ctiL9UYvj1bVvCKi8OXkCa0u645hce7CAs= github.com/sqlc-dev/sqlc-testdata v1.0.0 h1:NrfFkZ3xh2XHqDNqYE6Q87hhXd1n6GQr3XE0V+CveSQ= github.com/sqlc-dev/sqlc-testdata v1.0.0/go.mod h1:Ima4gy0tylq+cNW1VSV36/NoAHMbZZKjHNs7SfM9Pns= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/volatiletech/inflect v0.0.1 h1:2a6FcMQyhmPZcLa+uet3VJ8gLn/9svWhJxJYwvE8KsU= github.com/volatiletech/inflect v0.0.1/go.mod h1:IBti31tG6phkHitLlr5j7shC5SOo//x0AjDzaJU1PLA= github.com/volatiletech/null/v8 v8.1.2 h1:kiTiX1PpwvuugKwfvUNX/SU/5A2KGZMXfGD0DUHdKEI= @@ -123,30 +295,100 @@ github.com/volatiletech/randomize v0.0.1 h1:eE5yajattWqTB2/eN8df4dw+8jwAzBtbdo5s github.com/volatiletech/randomize v0.0.1/go.mod h1:GN3U0QYqfZ9FOJ67bzax1cqZ5q2xuj2mXrXBjWaRTlY= github.com/volatiletech/strmangle v0.0.1 h1:UKQoHmY6be/R3tSvD2nQYrH41k43OJkidwEiC74KIzk= github.com/volatiletech/strmangle v0.0.1/go.mod h1:F6RA6IkB5vq0yTG4GQ0UsbbRcl3ni9P76i+JrTBKFFg= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= +github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= +github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0 h1:NmLfL734pJhM0JKaYd2Y28+nY9dPRWYAAbxhRCrKXPw= +go.opentelemetry.io/contrib/detectors/gcp v1.44.0/go.mod h1:tNAsgd8avTGke1+MndXlU5Cru4PQ9Ai/cCNWQv/ZJ/s= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI= +go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= +go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= +go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= +go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= +go.opentelemetry.io/otel/metric/x v0.67.0 h1:PcicCNZFkZ4bXfSooXdo3WN7RBOVOtjVdo1wD358Uns= +go.opentelemetry.io/otel/metric/x v0.67.0/go.mod h1:FBjCWZe6wgcqxcMtjdGiClDKXb2YxxXii0CXftE4QtI= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= +go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o= +go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= +go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= +go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= -golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20260112195511-716be5621a96 h1:Z/6YuSHTLOHfNFdb8zVZomZr7cqNgTJvA8+Qz75D8gU= +golang.org/x/exp v0.0.0-20260112195511-716be5621a96/go.mod h1:nzimsREAkjBCIEFtHiYkrJyT+2uy9YZJB7H1k68CXZU= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= +golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= +golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -154,25 +396,97 @@ golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/telemetry v0.0.0-20260924152758-ed294f943157 h1:DftxASHKl6JolFPqoN+2WrFO53JvkHwRXvFqf8gsivA= +golang.org/x/telemetry v0.0.0-20260924152758-ed294f943157/go.mod h1:i+ivNqjDnTF3WTElsdk5g9V5DTSBYgdNo7xTU9SDwYA= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE= +golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= +golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da h1:noIWHXmPHxILtqtCOPIhSt0ABwskkZKjD3bXGnZGpNY= +golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/api v0.304.0 h1:2R1dYSiIVQRGcKN901u9yPFEdJu5h90oGY5X4TcgbmA= +google.golang.org/api v0.304.0/go.mod h1:dcjRWAy1QdjGb3Z67Qu0gdBWH2gL8Qoy/RI2ZVuvdeE= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d h1:C9v1o0/4quuhOAfmRXA2j+we0PqZIp8traLdeogF3Ms= +google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d/go.mod h1:Wz2wFJntZFmLGo7pLDXZ3wYk5hyc0Mb+SkHhDDXT+lU= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d h1:QwnJwPte4XXAkhPu26LTDIahnsMSUV0kK8HkxbC+Pc4= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d/go.mod h1:WRrQ7/7N19PypuT0fxLOL5Lq0waoiRri4FbtHDEKrGE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8 h1:0SXBqli5dnuCKMjI/X3FM226zEaEa0GUcSCJtN1vL2o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0= +google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -180,5 +494,8 @@ gopkg.in/guregu/null.v4 v4.0.0 h1:1Wm3S1WEA2I26Kq+6vcW+w0gcDo44YKYD7YIEJNHDjg= gopkg.in/guregu/null.v4 v4.0.0/go.mod h1:YoQhUrADuG3i9WqesrCmpNRwm1ypAgSHYqoOcTu/JrI= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/internal/endtoend/testdata/golang_initialisms_empty/db/db.go b/internal/endtoend/testdata/golang_initialisms_empty/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/golang_initialisms_empty/db/models.go b/internal/endtoend/testdata/golang_initialisms_empty/db/models.go new file mode 100644 index 0000000000..df28836a8b --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "database/sql" +) + +type Foo struct { + BarId sql.NullString +} diff --git a/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go b/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go new file mode 100644 index 0000000000..a928562973 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/db/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const selectFoo = `-- name: SelectFoo :many +SELECT bar_id FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar_id sql.NullString + if err := rows.Scan(&bar_id); err != nil { + return nil, err + } + items = append(items, bar_id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/golang_initialisms_empty/query.sql b/internal/endtoend/testdata/golang_initialisms_empty/query.sql new file mode 100644 index 0000000000..e32e926b32 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/golang_initialisms_empty/schema.sql b/internal/endtoend/testdata/golang_initialisms_empty/schema.sql new file mode 100644 index 0000000000..fe692b6af6 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo( + bar_id text +); diff --git a/internal/endtoend/testdata/golang_initialisms_empty/sqlc.json b/internal/endtoend/testdata/golang_initialisms_empty/sqlc.json new file mode 100644 index 0000000000..02ab2e395c --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_empty/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "initialisms": [] + } + } + } + ] +} diff --git a/internal/endtoend/testdata/golang_initialisms_url/db/db.go b/internal/endtoend/testdata/golang_initialisms_url/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/golang_initialisms_url/db/models.go b/internal/endtoend/testdata/golang_initialisms_url/db/models.go new file mode 100644 index 0000000000..e30346a9f9 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/db/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "database/sql" +) + +type Foo struct { + BarID sql.NullString + SiteURL sql.NullString +} diff --git a/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go b/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go new file mode 100644 index 0000000000..da4d925c9c --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/db/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" +) + +const selectFoo = `-- name: SelectFoo :many +SELECT bar_id, site_url FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.BarID, &i.SiteURL); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/golang_initialisms_url/query.sql b/internal/endtoend/testdata/golang_initialisms_url/query.sql new file mode 100644 index 0000000000..e32e926b32 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/golang_initialisms_url/schema.sql b/internal/endtoend/testdata/golang_initialisms_url/schema.sql new file mode 100644 index 0000000000..d0b2506904 --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo ( + bar_id text, + site_url text +); diff --git a/internal/endtoend/testdata/golang_initialisms_url/sqlc.json b/internal/endtoend/testdata/golang_initialisms_url/sqlc.json new file mode 100644 index 0000000000..2b135eec3e --- /dev/null +++ b/internal/endtoend/testdata/golang_initialisms_url/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "initialisms": ["id", "url"] + } + } + } + ] +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/db/db.go b/internal/endtoend/testdata/golang_invalid_sql_driver/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/db/models.go b/internal/endtoend/testdata/golang_invalid_sql_driver/db/models.go new file mode 100644 index 0000000000..d9ddf0a81e --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go b/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go new file mode 100644 index 0000000000..1b8a297a43 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/db/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const selectFoo = `-- name: SelectFoo :many +SELECT bar FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar sql.NullString + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/query.sql b/internal/endtoend/testdata/golang_invalid_sql_driver/query.sql new file mode 100644 index 0000000000..e32e926b32 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/schema.sql b/internal/endtoend/testdata/golang_invalid_sql_driver/schema.sql new file mode 100644 index 0000000000..1bd72529f8 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo( + bar text +); diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/sqlc.json b/internal/endtoend/testdata/golang_invalid_sql_driver/sqlc.json new file mode 100644 index 0000000000..6124f178d1 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "sql_driver": "github.com/unknown/driver" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_driver/stderr.txt b/internal/endtoend/testdata/golang_invalid_sql_driver/stderr.txt new file mode 100644 index 0000000000..b71f130a2f --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_driver/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: invalid options: unknown SQL driver: github.com/unknown/driver diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/db/db.go b/internal/endtoend/testdata/golang_invalid_sql_package/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/db/models.go b/internal/endtoend/testdata/golang_invalid_sql_package/db/models.go new file mode 100644 index 0000000000..d9ddf0a81e --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go b/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go new file mode 100644 index 0000000000..1b8a297a43 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/db/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const selectFoo = `-- name: SelectFoo :many +SELECT bar FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar sql.NullString + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/query.sql b/internal/endtoend/testdata/golang_invalid_sql_package/query.sql new file mode 100644 index 0000000000..e32e926b32 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/query.sql @@ -0,0 +1,2 @@ +-- name: SelectFoo :many +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/schema.sql b/internal/endtoend/testdata/golang_invalid_sql_package/schema.sql new file mode 100644 index 0000000000..e29621be57 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo ( + bar text +); diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/sqlc.json b/internal/endtoend/testdata/golang_invalid_sql_package/sqlc.json new file mode 100644 index 0000000000..a6c726061c --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "sql_package": "pgx/5" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/golang_invalid_sql_package/stderr.txt b/internal/endtoend/testdata/golang_invalid_sql_package/stderr.txt new file mode 100644 index 0000000000..249ae167b7 --- /dev/null +++ b/internal/endtoend/testdata/golang_invalid_sql_package/stderr.txt @@ -0,0 +1,2 @@ +# package +error generating code: invalid options: unknown SQL package: pgx/5 diff --git a/internal/endtoend/testdata/having/mysql/go/db.go b/internal/endtoend/testdata/having/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/having/mysql/go/db.go +++ b/internal/endtoend/testdata/having/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/having/mysql/go/models.go b/internal/endtoend/testdata/having/mysql/go/models.go index 38eab129b5..e6b939a040 100644 --- a/internal/endtoend/testdata/having/mysql/go/models.go +++ b/internal/endtoend/testdata/having/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Weather struct { City string TempLo int32 diff --git a/internal/endtoend/testdata/having/mysql/go/query.sql.go b/internal/endtoend/testdata/having/mysql/go/query.sql.go index 19f0c86407..7bfd67d0aa 100644 --- a/internal/endtoend/testdata/having/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/having/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/having/postgresql/go/db.go b/internal/endtoend/testdata/having/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/having/postgresql/go/db.go +++ b/internal/endtoend/testdata/having/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/having/postgresql/go/models.go b/internal/endtoend/testdata/having/postgresql/go/models.go index 38eab129b5..e6b939a040 100644 --- a/internal/endtoend/testdata/having/postgresql/go/models.go +++ b/internal/endtoend/testdata/having/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Weather struct { City string TempLo int32 diff --git a/internal/endtoend/testdata/having/postgresql/go/query.sql.go b/internal/endtoend/testdata/having/postgresql/go/query.sql.go index e1847c36b5..d986320b50 100644 --- a/internal/endtoend/testdata/having/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/having/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/hstore/pgx/v4/go/db.go b/internal/endtoend/testdata/hstore/pgx/v4/go/db.go index e41a53991b..2385b69a96 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package hstore @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go b/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go index 0e92fbfeb9..8a304684e7 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/hstore.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: hstore.sql package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v4/go/models.go b/internal/endtoend/testdata/hstore/pgx/v4/go/models.go index c660d29bb8..f6c0d02090 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/hstore/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/db.go b/internal/endtoend/testdata/hstore/pgx/v5/go/db.go index 5c25c07044..7d3f0acfee 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package hstore @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go b/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go index bf4432f91a..29e48479ed 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/hstore.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: hstore.sql package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/models.go b/internal/endtoend/testdata/hstore/pgx/v5/go/models.go index 9202feb84b..60677dec71 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/hstore/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package hstore diff --git a/internal/endtoend/testdata/hstore/stdlib/go/db.go b/internal/endtoend/testdata/hstore/stdlib/go/db.go index bc8e1713d8..a47155eae0 100644 --- a/internal/endtoend/testdata/hstore/stdlib/go/db.go +++ b/internal/endtoend/testdata/hstore/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package hstore @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go b/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go index 3d1312f195..66bd5eb6da 100644 --- a/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go +++ b/internal/endtoend/testdata/hstore/stdlib/go/hstore.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: hstore.sql package hstore @@ -13,15 +13,15 @@ const listBar = `-- name: ListBar :many SELECT bar FROM foo ` -func (q *Queries) ListBar(ctx context.Context) ([]interface{}, error) { +func (q *Queries) ListBar(ctx context.Context) ([]any, error) { rows, err := q.db.QueryContext(ctx, listBar) if err != nil { return nil, err } defer rows.Close() - var items []interface{} + var items []any for rows.Next() { - var bar interface{} + var bar any if err := rows.Scan(&bar); err != nil { return nil, err } @@ -40,15 +40,15 @@ const listBaz = `-- name: ListBaz :many SELECT baz FROM foo ` -func (q *Queries) ListBaz(ctx context.Context) ([]interface{}, error) { +func (q *Queries) ListBaz(ctx context.Context) ([]any, error) { rows, err := q.db.QueryContext(ctx, listBaz) if err != nil { return nil, err } defer rows.Close() - var items []interface{} + var items []any for rows.Next() { - var baz interface{} + var baz any if err := rows.Scan(&baz); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/hstore/stdlib/go/models.go b/internal/endtoend/testdata/hstore/stdlib/go/models.go index 6b11866054..53a6053efe 100644 --- a/internal/endtoend/testdata/hstore/stdlib/go/models.go +++ b/internal/endtoend/testdata/hstore/stdlib/go/models.go @@ -1,12 +1,10 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package hstore -import () - type Foo struct { - Bar interface{} - Baz interface{} + Bar any + Baz any } diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/db.go b/internal/endtoend/testdata/identical_tables/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/db.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/models.go b/internal/endtoend/testdata/identical_tables/mysql/go/models.go index 26342a2ed7..73ea2220d8 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/models.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go b/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go index 548417408e..79b96bb8d6 100644 --- a/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go index 26342a2ed7..73ea2220d8 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go index d6c4912e1a..d09aae88dc 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go index 26342a2ed7..73ea2220d8 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go index d6c4912e1a..d09aae88dc 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go index 26342a2ed7..73ea2220d8 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go index 548417408e..79b96bb8d6 100644 --- a/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identical_tables/sqlite/go/db.go b/internal/endtoend/testdata/identical_tables/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/go/db.go +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/identical_tables/sqlite/go/models.go b/internal/endtoend/testdata/identical_tables/sqlite/go/models.go index 26342a2ed7..73ea2220d8 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/go/models.go +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID string } diff --git a/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go b/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go index 548417408e..79b96bb8d6 100644 --- a/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/identical_tables/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go index f8bcd76317..56c9d4a035 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go b/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go index f3a6ef1e3b..03a9f67e53 100644 --- a/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go +++ b/internal/endtoend/testdata/identifier_case_sensitivity/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/db.go b/internal/endtoend/testdata/identifier_dollar_sign/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/db/db.go +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/models.go b/internal/endtoend/testdata/identifier_dollar_sign/db/models.go index 929031fd0a..21f493ecbc 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/db/models.go +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db - -import () diff --git a/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go b/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go index 2924bdc819..48317c8f65 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go +++ b/internal/endtoend/testdata/identifier_dollar_sign/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/in_union/mysql/go/db.go b/internal/endtoend/testdata/in_union/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/in_union/mysql/go/models.go b/internal/endtoend/testdata/in_union/mysql/go/models.go new file mode 100644 index 0000000000..33ad6a3c49 --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/go/models.go @@ -0,0 +1,25 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int32 + Name string + Bio sql.NullString +} + +type Book1 struct { + AuthorID int32 + Name sql.NullString +} + +type Book2 struct { + AuthorID int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/in_union/mysql/go/query.sql.go b/internal/endtoend/testdata/in_union/mysql/go/query.sql.go new file mode 100644 index 0000000000..352b50a772 --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthors = `-- name: GetAuthors :many +SELECT id, name, bio FROM authors +WHERE author_id IN (SELECT author_id FROM book1 UNION SELECT author_id FROM book2) +` + +func (q *Queries) GetAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, getAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/in_union/mysql/query.sql b/internal/endtoend/testdata/in_union/mysql/query.sql new file mode 100644 index 0000000000..69606f538b --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/query.sql @@ -0,0 +1,3 @@ +-- name: GetAuthors :many +SELECT * FROM authors +WHERE author_id IN (SELECT author_id FROM book1 UNION SELECT author_id FROM book2); diff --git a/internal/endtoend/testdata/in_union/mysql/schema.sql b/internal/endtoend/testdata/in_union/mysql/schema.sql new file mode 100644 index 0000000000..47264e2bbc --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/schema.sql @@ -0,0 +1,15 @@ +CREATE TABLE authors ( + id int PRIMARY KEY, + name text NOT NULL, + bio text +); +CREATE TABLE book1 ( + author_id int PRIMARY KEY, + name text, + FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`) ON DELETE CASCADE +); +CREATE TABLE book2 ( + author_id int PRIMARY KEY, + name text, + FOREIGN KEY (`author_id`) REFERENCES `authors` (`id`) ON DELETE CASCADE +); diff --git a/internal/endtoend/testdata/in_union/mysql/sqlc.json b/internal/endtoend/testdata/in_union/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/in_union/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "mysql", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/inflection/mysql/go/db.go b/internal/endtoend/testdata/inflection/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/db.go +++ b/internal/endtoend/testdata/inflection/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/inflection/mysql/go/models.go b/internal/endtoend/testdata/inflection/mysql/go/models.go index fa74f16bdd..ba5cb02de8 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/models.go +++ b/internal/endtoend/testdata/inflection/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/mysql/go/query.sql.go b/internal/endtoend/testdata/inflection/mysql/go/query.sql.go index cc92aa1adf..ae221c6c47 100644 --- a/internal/endtoend/testdata/inflection/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -9,6 +9,33 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/mysql/query.sql b/internal/endtoend/testdata/inflection/mysql/query.sql index e3917086b9..74e1aaf8c3 100644 --- a/internal/endtoend/testdata/inflection/mysql/query.sql +++ b/internal/endtoend/testdata/inflection/mysql/query.sql @@ -9,3 +9,6 @@ SELECT * FROM product_meta; /* name: ListCalories :many */ SELECT * FROM calories; + +/* name: GetProductMetadata :many */ +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/mysql/schema.sql b/internal/endtoend/testdata/inflection/mysql/schema.sql index b0d88c8695..f7d5c7c2a5 100644 --- a/internal/endtoend/testdata/inflection/mysql/schema.sql +++ b/internal/endtoend/testdata/inflection/mysql/schema.sql @@ -2,4 +2,4 @@ CREATE TABLE campus (id text not null); CREATE TABLE students (id text not null); CREATE TABLE product_meta (id text not null); CREATE TABLE calories (id text not null); - +CREATE TABLE product_metadata (id text not null); diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go index fa74f16bdd..ba5cb02de8 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go index f4b1d37ffc..950dc18262 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -9,6 +9,30 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql index 6e2828d458..abc0da2ef2 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/query.sql @@ -9,3 +9,6 @@ SELECT * FROM product_meta; -- name: ListCalories :many SELECT * FROM calories; + +-- name: GetProductMetadata :many +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/schema.sql index b0d88c8695..ad17ad7427 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v4/schema.sql @@ -2,4 +2,4 @@ CREATE TABLE campus (id text not null); CREATE TABLE students (id text not null); CREATE TABLE product_meta (id text not null); CREATE TABLE calories (id text not null); - +CREATE TABLE product_metadata (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go index fa74f16bdd..ba5cb02de8 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go index f4b1d37ffc..950dc18262 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -9,6 +9,30 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.Query(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql index 6e2828d458..abc0da2ef2 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/query.sql @@ -9,3 +9,6 @@ SELECT * FROM product_meta; -- name: ListCalories :many SELECT * FROM calories; + +-- name: GetProductMetadata :many +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/schema.sql index b0d88c8695..ad17ad7427 100644 --- a/internal/endtoend/testdata/inflection/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/inflection/postgresql/pgx/v5/schema.sql @@ -2,4 +2,4 @@ CREATE TABLE campus (id text not null); CREATE TABLE students (id text not null); CREATE TABLE product_meta (id text not null); CREATE TABLE calories (id text not null); - +CREATE TABLE product_metadata (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go index fa74f16bdd..ba5cb02de8 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go index cc92aa1adf..ae221c6c47 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -9,6 +9,33 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql b/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql index 6e2828d458..abc0da2ef2 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/query.sql @@ -9,3 +9,6 @@ SELECT * FROM product_meta; -- name: ListCalories :many SELECT * FROM calories; + +-- name: GetProductMetadata :many +SELECT * FROM product_metadata; \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/inflection/postgresql/stdlib/schema.sql index b0d88c8695..ad17ad7427 100644 --- a/internal/endtoend/testdata/inflection/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/inflection/postgresql/stdlib/schema.sql @@ -2,4 +2,4 @@ CREATE TABLE campus (id text not null); CREATE TABLE students (id text not null); CREATE TABLE product_meta (id text not null); CREATE TABLE calories (id text not null); - +CREATE TABLE product_metadata (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection/sqlite/go/db.go b/internal/endtoend/testdata/inflection/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/inflection/sqlite/go/db.go +++ b/internal/endtoend/testdata/inflection/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/inflection/sqlite/go/models.go b/internal/endtoend/testdata/inflection/sqlite/go/models.go index fa74f16bdd..ba5cb02de8 100644 --- a/internal/endtoend/testdata/inflection/sqlite/go/models.go +++ b/internal/endtoend/testdata/inflection/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Calorie struct { ID string } @@ -14,6 +12,10 @@ type Campus struct { ID string } +type ProductMetadatum struct { + ID string +} + type ProductMetum struct { ID string } diff --git a/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go b/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go index cc92aa1adf..ae221c6c47 100644 --- a/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/inflection/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -9,6 +9,33 @@ import ( "context" ) +const getProductMetadata = `-- name: GetProductMetadata :many +SELECT id FROM product_metadata +` + +func (q *Queries) GetProductMetadata(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getProductMetadata) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listCalories = `-- name: ListCalories :many SELECT id FROM calories ` diff --git a/internal/endtoend/testdata/inflection/sqlite/query.sql b/internal/endtoend/testdata/inflection/sqlite/query.sql index e3917086b9..26fe295aba 100644 --- a/internal/endtoend/testdata/inflection/sqlite/query.sql +++ b/internal/endtoend/testdata/inflection/sqlite/query.sql @@ -9,3 +9,6 @@ SELECT * FROM product_meta; /* name: ListCalories :many */ SELECT * FROM calories; + +/* name: GetProductMetadata :many */ +SELECT * FROM product_metadata; diff --git a/internal/endtoend/testdata/inflection/sqlite/schema.sql b/internal/endtoend/testdata/inflection/sqlite/schema.sql index b0d88c8695..ad17ad7427 100644 --- a/internal/endtoend/testdata/inflection/sqlite/schema.sql +++ b/internal/endtoend/testdata/inflection/sqlite/schema.sql @@ -2,4 +2,4 @@ CREATE TABLE campus (id text not null); CREATE TABLE students (id text not null); CREATE TABLE product_meta (id text not null); CREATE TABLE calories (id text not null); - +CREATE TABLE product_metadata (id text not null); \ No newline at end of file diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go index 50f2002c8f..394289161e 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go index 1c2dbbb5e2..15a9da239b 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go index 50f2002c8f..394289161e 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go index 1c2dbbb5e2..15a9da239b 100644 --- a/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/inflection_exclude_table_names/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/models.py b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/models.py deleted file mode 100644 index 5f70f12ae1..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/models.py +++ /dev/null @@ -1,22 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int - name: str - - -@dataclasses.dataclass() -class Exclusions: - id: int - name: str - - -@dataclasses.dataclass() -class MyData: - id: int - name: str diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/query.py b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/query.py deleted file mode 100644 index f95e44bf32..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/python/query.py +++ /dev/null @@ -1,89 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -from typing import Optional - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:one -DELETE FROM bars WHERE id = :p1 RETURNING id, name -""" - - -DELETE_EXCLUSION_BY_ID = """-- name: delete_exclusion_by_id \\:one -DELETE FROM exclusions WHERE id = :p1 RETURNING id, name -""" - - -DELETE_MY_DATA_BY_ID = """-- name: delete_my_data_by_id \\:one -DELETE FROM my_data WHERE id = :p1 RETURNING id, name -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> Optional[models.Bar]: - row = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}).first() - if row is None: - return None - return models.Bar( - id=row[0], - name=row[1], - ) - - def delete_exclusion_by_id(self, *, id: int) -> Optional[models.Exclusions]: - row = self._conn.execute(sqlalchemy.text(DELETE_EXCLUSION_BY_ID), {"p1": id}).first() - if row is None: - return None - return models.Exclusions( - id=row[0], - name=row[1], - ) - - def delete_my_data_by_id(self, *, id: int) -> Optional[models.MyData]: - row = self._conn.execute(sqlalchemy.text(DELETE_MY_DATA_BY_ID), {"p1": id}).first() - if row is None: - return None - return models.MyData( - id=row[0], - name=row[1], - ) - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> Optional[models.Bar]: - row = (await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id})).first() - if row is None: - return None - return models.Bar( - id=row[0], - name=row[1], - ) - - async def delete_exclusion_by_id(self, *, id: int) -> Optional[models.Exclusions]: - row = (await self._conn.execute(sqlalchemy.text(DELETE_EXCLUSION_BY_ID), {"p1": id})).first() - if row is None: - return None - return models.Exclusions( - id=row[0], - name=row[1], - ) - - async def delete_my_data_by_id(self, *, id: int) -> Optional[models.MyData]: - row = (await self._conn.execute(sqlalchemy.text(DELETE_MY_DATA_BY_ID), {"p1": id})).first() - if row is None: - return None - return models.MyData( - id=row[0], - name=row[1], - ) diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/query.sql b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/query.sql deleted file mode 100644 index f279a10738..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/query.sql +++ /dev/null @@ -1,8 +0,0 @@ --- name: DeleteBarByID :one -DELETE FROM bars WHERE id = $1 RETURNING id, name; - --- name: DeleteMyDataByID :one -DELETE FROM my_data WHERE id = $1 RETURNING id, name; - --- name: DeleteExclusionByID :one -DELETE FROM exclusions WHERE id = $1 RETURNING id, name; diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/schema.sql b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/schema.sql deleted file mode 100644 index ea5b797e08..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/schema.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE bars (id serial not null, name text not null, primary key (id)); -CREATE TABLE my_data (id serial not null, name text not null, primary key (id)); -CREATE TABLE exclusions (id serial not null, name text not null, primary key (id)); - diff --git a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/sqlc.json b/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/sqlc.json deleted file mode 100644 index 8a8691c3a5..0000000000 --- a/internal/endtoend/testdata/inflection_exclude_table_names/python_postgresql/sqlc.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.0.0.wasm", - "sha256": "aca83e1f59f8ffdc604774c2f6f9eb321a2b23e07dc83fc12289d25305fa065b" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true, - "inflection_exclude_table_names": [ - "my_data", - "exclusions" - ] - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go index 78aa133e28..97ccea3b0b 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go index c4a74ca310..7fe4ff6eeb 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go index b4aaf069a0..6aae2a63f8 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go index 3dc7aaf24e..f22c13e3fa 100644 --- a/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/db.go b/internal/endtoend/testdata/insert_cte/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/go/db.go +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/models.go b/internal/endtoend/testdata/insert_cte/stdlib/go/models.go index 78aa133e28..97ccea3b0b 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/go/models.go +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go index c4ed76973d..b5379c448e 100644 --- a/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_cte/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/go/db.go b/internal/endtoend/testdata/insert_default_values/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/go/models.go b/internal/endtoend/testdata/insert_default_values/sqlite/go/models.go new file mode 100644 index 0000000000..870be156f5 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Workspace struct { + ID int64 +} diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go new file mode 100644 index 0000000000..26ca36f673 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertWorkspace = `-- name: InsertWorkspace :exec +INSERT INTO workspace DEFAULT VALUES +` + +func (q *Queries) InsertWorkspace(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, insertWorkspace) + return err +} diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/query.sql b/internal/endtoend/testdata/insert_default_values/sqlite/query.sql new file mode 100644 index 0000000000..89d593c9c0 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: InsertWorkspace :exec +INSERT INTO workspace DEFAULT VALUES; diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/schema.sql b/internal/endtoend/testdata/insert_default_values/sqlite/schema.sql new file mode 100644 index 0000000000..f142b7c831 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE workspace ( + id INTEGER PRIMARY KEY AUTOINCREMENT +); \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_default_values/sqlite/sqlc.json b/internal/endtoend/testdata/insert_default_values/sqlite/sqlc.json new file mode 100644 index 0000000000..f8e8051087 --- /dev/null +++ b/internal/endtoend/testdata/insert_default_values/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "sqlite", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/insert_select/mysql/go/db.go b/internal/endtoend/testdata/insert_select/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/db.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_select/mysql/go/models.go b/internal/endtoend/testdata/insert_select/mysql/go/models.go index c40078c62d..c99c5f11a6 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/models.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go index 7b69fe26c5..7b7d191166 100644 --- a/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go index c40078c62d..c99c5f11a6 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go index 7f6ade20cc..a3e177f807 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go index c40078c62d..c99c5f11a6 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go index 7f6ade20cc..a3e177f807 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go index c40078c62d..c99c5f11a6 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go index e5d9918ab7..bbf3dd7853 100644 --- a/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_select/sqlite/go/db.go b/internal/endtoend/testdata/insert_select/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/go/db.go +++ b/internal/endtoend/testdata/insert_select/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_select/sqlite/go/models.go b/internal/endtoend/testdata/insert_select/sqlite/go/models.go index c40078c62d..c99c5f11a6 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/go/models.go +++ b/internal/endtoend/testdata/insert_select/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Name string Ready bool diff --git a/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go index 7b69fe26c5..b158e67cff 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -12,7 +12,8 @@ import ( const insertSelect = `-- name: InsertSelect :exec INSERT INTO foo (name, meta) SELECT name, ? -FROM bar WHERE ready = ? +FROM bar +WHERE ready = ? ` type InsertSelectParams struct { diff --git a/internal/endtoend/testdata/insert_select/sqlite/query.sql b/internal/endtoend/testdata/insert_select/sqlite/query.sql index 880f083f9e..7707a6a32a 100644 --- a/internal/endtoend/testdata/insert_select/sqlite/query.sql +++ b/internal/endtoend/testdata/insert_select/sqlite/query.sql @@ -1,4 +1,5 @@ /* name: InsertSelect :exec */ INSERT INTO foo (name, meta) SELECT name, ? -FROM bar WHERE ready = ?; +FROM bar +WHERE ready = ?; diff --git a/internal/endtoend/testdata/insert_select_case/issue.md b/internal/endtoend/testdata/insert_select_case/issue.md new file mode 100644 index 0000000000..f4090f863a --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1646 diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/exec.json b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/db.go b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/models.go b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..c8e716eea9 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Order struct { + ID pgtype.Int8 + Name pgtype.Text +} diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..88f2aff71f --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/go/query.sql.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const insertOrders = `-- name: InsertOrders :exec +insert into Orders (id,name) +select id , CASE WHEN $1::BOOLEAN THEN $2 ELSE s.name END +from Orders s +` + +type InsertOrdersParams struct { + NameDoUpdate pgtype.Bool + Name pgtype.Text +} + +func (q *Queries) InsertOrders(ctx context.Context, arg InsertOrdersParams) error { + _, err := q.db.Exec(ctx, insertOrders, arg.NameDoUpdate, arg.Name) + return err +} diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/query.sql b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/query.sql new file mode 100644 index 0000000000..4396b7bf20 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: InsertOrders :exec +insert into Orders (id,name) +select id , CASE WHEN @name_do_update::BOOLEAN THEN @name ELSE s.name END +from Orders s ; diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/schema.sql b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..cbc21a5b7b --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE orders( + id bigserial, + name text +); diff --git a/internal/endtoend/testdata/insert_select_case/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..ee50c7b6e8 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_case/postgresql/pgx/sqlc.yaml @@ -0,0 +1,12 @@ +version: "2" +cloud: + project: "01HAQMMECEYQYKFJN8MP16QC41" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql b/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql index cfd90fe55d..3311b32009 100644 --- a/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: InsertFoo :exec INSERT INTO foo (bar) SELECT 1, ?, ?; diff --git a/internal/endtoend/testdata/insert_select_invalid/mysql/schema.sql b/internal/endtoend/testdata/insert_select_invalid/mysql/schema.sql new file mode 100644 index 0000000000..d849628fb1 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); diff --git a/internal/endtoend/testdata/insert_select_invalid/mysql/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/mysql/sqlc.json index 0657f4db83..974aa9ff9e 100644 --- a/internal/endtoend/testdata/insert_select_invalid/mysql/sqlc.json +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/sqlc.json @@ -5,7 +5,7 @@ "engine": "mysql", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt b/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt index 063b2a149a..91d0b8a06c 100644 --- a/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt +++ b/internal/endtoend/testdata/insert_select_invalid/mysql/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:4:1: INSERT has more expressions than target columns +query.sql:1:1: INSERT has more expressions than target columns diff --git a/internal/endtoend/testdata/insert_select_invalid/sqlite/exec.json b/internal/endtoend/testdata/insert_select_invalid/sqlite/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/sqlite/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/insert_select_invalid/sqlite/query.sql b/internal/endtoend/testdata/insert_select_invalid/sqlite/query.sql index cfd90fe55d..3311b32009 100644 --- a/internal/endtoend/testdata/insert_select_invalid/sqlite/query.sql +++ b/internal/endtoend/testdata/insert_select_invalid/sqlite/query.sql @@ -1,5 +1,3 @@ -CREATE TABLE foo (bar text); - -- name: InsertFoo :exec INSERT INTO foo (bar) SELECT 1, ?, ?; diff --git a/internal/endtoend/testdata/insert_select_invalid/sqlite/schema.sql b/internal/endtoend/testdata/insert_select_invalid/sqlite/schema.sql new file mode 100644 index 0000000000..d849628fb1 --- /dev/null +++ b/internal/endtoend/testdata/insert_select_invalid/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); diff --git a/internal/endtoend/testdata/insert_select_invalid/sqlite/sqlc.json b/internal/endtoend/testdata/insert_select_invalid/sqlite/sqlc.json index 13e65f3ffd..f8e8051087 100644 --- a/internal/endtoend/testdata/insert_select_invalid/sqlite/sqlc.json +++ b/internal/endtoend/testdata/insert_select_invalid/sqlite/sqlc.json @@ -5,7 +5,7 @@ "engine": "sqlite", "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/insert_select_invalid/sqlite/stderr.txt b/internal/endtoend/testdata/insert_select_invalid/sqlite/stderr.txt index 063b2a149a..20a7ac053a 100644 --- a/internal/endtoend/testdata/insert_select_invalid/sqlite/stderr.txt +++ b/internal/endtoend/testdata/insert_select_invalid/sqlite/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:4:1: INSERT has more expressions than target columns +query.sql:1:1: sqlite3: SQL logic error: 3 values for 1 columns diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/db.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go index b320134bd5..4e97f66a99 100644 --- a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go index 7bee61fcc9..eaa742192a 100644 --- a/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/insert_select_param/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/mysql/go/db.go b/internal/endtoend/testdata/insert_values/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/db.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values/mysql/go/models.go b/internal/endtoend/testdata/insert_values/mysql/go/models.go index 674ec3cb70..ee59bcd91b 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/models.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go index 1f22c5b055..90f9be9c62 100644 --- a/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go index 674ec3cb70..ee59bcd91b 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go index 7e60934302..a1db3238e0 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go index 1fc74d22e6..475f43efe5 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go index 9d184c0ac0..998054c88e 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go index 674ec3cb70..ee59bcd91b 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go index 6a14a1d0eb..aa5109e0a7 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/sqlite/go/db.go b/internal/endtoend/testdata/insert_values/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/go/db.go +++ b/internal/endtoend/testdata/insert_values/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values/sqlite/go/models.go b/internal/endtoend/testdata/insert_values/sqlite/go/models.go index 3f5303e7ab..fd51ca3d8e 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/go/models.go +++ b/internal/endtoend/testdata/insert_values/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go b/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go index ae058ecf2c..5bdada7bb8 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values/sqlite/query.sql b/internal/endtoend/testdata/insert_values/sqlite/query.sql index 774165baa8..03f37d30d9 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/query.sql +++ b/internal/endtoend/testdata/insert_values/sqlite/query.sql @@ -2,4 +2,4 @@ INSERT INTO foo (a, b) VALUES (?, ?); /* name: InsertMultipleValues :exec */ -INSERT INTO foo (a, b) VALUES (?, ?), (?, ?); \ No newline at end of file +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?); diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/db.go b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go index 84227cc11f..69c245cd66 100644 --- a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Status struct { ID int32 Name string diff --git a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go index 69ef568232..ffff33d238 100644 --- a/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_only/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values_public/mysql/go/db.go b/internal/endtoend/testdata/insert_values_public/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/go/db.go +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values_public/mysql/go/models.go b/internal/endtoend/testdata/insert_values_public/mysql/go/models.go index 674ec3cb70..ee59bcd91b 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/go/models.go +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go index 3860a045f2..1dc377d446 100644 --- a/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go index 674ec3cb70..ee59bcd91b 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go index 547c8dfde2..7146cb6696 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go index 1fc74d22e6..475f43efe5 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go index 2306531840..73457eb358 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go index 674ec3cb70..ee59bcd91b 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go index 93d444f916..b064886ba9 100644 --- a/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/insert_values_public/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/interval/pgx/v4/go/db.go b/internal/endtoend/testdata/interval/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/interval/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/interval/pgx/v4/go/models.go b/internal/endtoend/testdata/interval/pgx/v4/go/models.go index a429fb036a..05ac897c24 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/interval/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool Interval int64 diff --git a/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go index 76304205eb..18b6e70226 100644 --- a/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/interval/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/db.go b/internal/endtoend/testdata/interval/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/interval/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/models.go b/internal/endtoend/testdata/interval/pgx/v5/go/models.go index 7d3aea19b6..a2179e2dd8 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/interval/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go index 76304205eb..18b6e70226 100644 --- a/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/interval/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/interval/stdlib/go/db.go b/internal/endtoend/testdata/interval/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/interval/stdlib/go/db.go +++ b/internal/endtoend/testdata/interval/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/interval/stdlib/go/models.go b/internal/endtoend/testdata/interval/stdlib/go/models.go index a429fb036a..05ac897c24 100644 --- a/internal/endtoend/testdata/interval/stdlib/go/models.go +++ b/internal/endtoend/testdata/interval/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool Interval int64 diff --git a/internal/endtoend/testdata/interval/stdlib/go/query.sql.go b/internal/endtoend/testdata/interval/stdlib/go/query.sql.go index 9782f271eb..abdc431b60 100644 --- a/internal/endtoend/testdata/interval/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/interval/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql index 46dbe9fa2d..e92c21d811 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/base.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/base.txt index 09d46d1f95..2693a08462 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/base.txt +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/base.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:1:8: function random(unknown) does not exist +query.sql:2:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/managed-db.txt index 34430f733e..d211139c8a 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/managed-db.txt +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v4/stderr/managed-db.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:1:8: function random(integer) does not exist +query.sql:2:8: function random(integer) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql b/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql index 46dbe9fa2d..e92c21d811 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt index 09d46d1f95..2693a08462 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/base.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:1:8: function random(unknown) does not exist +query.sql:2:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/managed-db.txt index 34430f733e..d211139c8a 100644 --- a/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/managed-db.txt +++ b/internal/endtoend/testdata/invalid_func_args/pgx/v5/stderr/managed-db.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:1:8: function random(integer) does not exist +query.sql:2:8: function random(integer) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql b/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql index 46dbe9fa2d..e92c21d811 100644 --- a/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT random(1); diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt index 09d46d1f95..2693a08462 100644 --- a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/base.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:1:8: function random(unknown) does not exist +query.sql:2:8: function random(unknown) does not exist diff --git a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/managed-db.txt b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/managed-db.txt index 34430f733e..d211139c8a 100644 --- a/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/managed-db.txt +++ b/internal/endtoend/testdata/invalid_func_args/stdlib/stderr/managed-db.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:1:8: function random(integer) does not exist +query.sql:2:8: function random(integer) does not exist diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/exec.json b/internal/endtoend/testdata/invalid_group_by_reference/mysql/exec.json new file mode 100644 index 0000000000..0775566a14 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "meta": { + "invalid_schema": true + } +} + diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql b/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql index 75a8e210fd..b036fba240 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/query.sql @@ -1,10 +1,3 @@ -CREATE TABLE authors ( - id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, - name text NOT NULL, - bio text, - UNIQUE(name) -); - -- name: ListAuthors :many SELECT * FROM authors diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/schema.sql b/internal/endtoend/testdata/invalid_group_by_reference/mysql/schema.sql new file mode 100644 index 0000000000..5333d484a6 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/sqlc.json b/internal/endtoend/testdata/invalid_group_by_reference/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/mysql/sqlc.json +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt b/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt index 1fc9998d4c..d686d4f4d8 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt +++ b/internal/endtoend/testdata/invalid_group_by_reference/mysql/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:11:10: column reference "invalid_reference" not found +query.sql:4:10: column reference "invalid_reference" not found diff --git a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/exec.json b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/query.sql b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/query.sql index 41ed0cf32c..2fc4c35be3 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/query.sql +++ b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/query.sql @@ -1,11 +1,4 @@ -CREATE TABLE authors ( - id integer NOT NULL PRIMARY KEY AUTOINCREMENT, - name text NOT NULL, - bio text, - UNIQUE(name) -); - -- name: ListAuthors :many -SELECT * -FROM authors +SELECT * +FROM authors GROUP BY invalid_reference; diff --git a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/schema.sql b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/schema.sql new file mode 100644 index 0000000000..e3ed6b0dba --- /dev/null +++ b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id integer NOT NULL PRIMARY KEY AUTOINCREMENT, + name text NOT NULL, + bio text, + UNIQUE(name) +); diff --git a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/sqlc.json b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/sqlc.json +++ b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/stderr.txt b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/stderr.txt index 1fc9998d4c..d255c11c94 100644 --- a/internal/endtoend/testdata/invalid_group_by_reference/sqlite/stderr.txt +++ b/internal/endtoend/testdata/invalid_group_by_reference/sqlite/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:11:10: column reference "invalid_reference" not found +query.sql:1:1: sqlite3: SQL logic error: no such column: invalid_reference diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/db.go b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/db.go index bcfcc9d2f4..42578b7b5a 100644 --- a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/db.go +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go index 62f0b05e93..761ab0cffc 100644 --- a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go index ebde66829e..81c6870a31 100644 --- a/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go +++ b/internal/endtoend/testdata/invalid_insert_unknown_column/postgresql/pgx/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/invalid_named_params/mysql/query.sql b/internal/endtoend/testdata/invalid_named_params/mysql/query.sql index 1ea4a9e5dc..349d2c2ccb 100644 --- a/internal/endtoend/testdata/invalid_named_params/mysql/query.sql +++ b/internal/endtoend/testdata/invalid_named_params/mysql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE authors ( - id BIGINT PRIMARY KEY, - bio TEXT -); - -- name: ListAuthors :one SELECT * FROM authors diff --git a/internal/endtoend/testdata/invalid_named_params/mysql/schema.sql b/internal/endtoend/testdata/invalid_named_params/mysql/schema.sql new file mode 100644 index 0000000000..9804a5cd1b --- /dev/null +++ b/internal/endtoend/testdata/invalid_named_params/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + bio TEXT +); diff --git a/internal/endtoend/testdata/invalid_named_params/mysql/sqlc.json b/internal/endtoend/testdata/invalid_named_params/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/invalid_named_params/mysql/sqlc.json +++ b/internal/endtoend/testdata/invalid_named_params/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql index 0e98fb622d..06644a2cd3 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/query.sql @@ -15,3 +15,6 @@ UPDATE foo SET id = $2 WHERE id = $1; -- name: InsertFoo :one INSERT INTO foo (id) VALUES ($1); + +-- name: InsertFoo :batchone +INSERT INTO foo (id) VALUES ($1); diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt index 6b0840fc37..8c745b7e3b 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt @@ -1,7 +1,8 @@ # package querytest -query.sql:1:1: invalid query comment: -- name: ListFoos +query.sql:1:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos query.sql:5:1: invalid query comment: -- name: ListFoos :one :many query.sql:8:1: invalid query type: :two query.sql:11:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause query.sql:14:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:17:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause \ No newline at end of file +query.sql:17:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:20:1: query "InsertFoo" specifies parameter ":batchone" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql index 0e98fb622d..06644a2cd3 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/query.sql @@ -15,3 +15,6 @@ UPDATE foo SET id = $2 WHERE id = $1; -- name: InsertFoo :one INSERT INTO foo (id) VALUES ($1); + +-- name: InsertFoo :batchone +INSERT INTO foo (id) VALUES ($1); diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt index 6b0840fc37..8c745b7e3b 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt @@ -1,7 +1,8 @@ # package querytest -query.sql:1:1: invalid query comment: -- name: ListFoos +query.sql:1:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos query.sql:5:1: invalid query comment: -- name: ListFoos :one :many query.sql:8:1: invalid query type: :two query.sql:11:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause query.sql:14:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause -query.sql:17:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause \ No newline at end of file +query.sql:17:1: query "InsertFoo" specifies parameter ":one" without containing a RETURNING clause +query.sql:20:1: query "InsertFoo" specifies parameter ":batchone" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt index 6b0840fc37..06ec54327f 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt @@ -1,5 +1,5 @@ # package querytest -query.sql:1:1: invalid query comment: -- name: ListFoos +query.sql:1:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos query.sql:5:1: invalid query comment: -- name: ListFoos :one :many query.sql:8:1: invalid query type: :two query.sql:11:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql b/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql index 22482fb724..52f5aae051 100644 --- a/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/query.sql @@ -1,10 +1,3 @@ --- https://github.com/sqlc-dev/sqlc/issues/437 -CREATE TABLE authors ( - id INT PRIMARY KEY, - name VARCHAR(255) NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors a diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/schema.sql b/internal/endtoend/testdata/invalid_table_alias/mysql/schema.sql new file mode 100644 index 0000000000..ee27f30abe --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/schema.sql @@ -0,0 +1,7 @@ +-- https://github.com/sqlc-dev/sqlc/issues/437 +CREATE TABLE authors ( + id INT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio text +); + diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/sqlc.json b/internal/endtoend/testdata/invalid_table_alias/mysql/sqlc.json index 534b7e24e9..0390f67889 100644 --- a/internal/endtoend/testdata/invalid_table_alias/mysql/sqlc.json +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt b/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt index 810c893a70..1eddeaac99 100644 --- a/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt +++ b/internal/endtoend/testdata/invalid_table_alias/mysql/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:11:9: table alias "p" does not exist +query.sql:4:9: table alias "p" does not exist diff --git a/internal/endtoend/testdata/invalid_table_alias/postgresql/exec.json b/internal/endtoend/testdata/invalid_table_alias/postgresql/exec.json new file mode 100644 index 0000000000..9f208fb2df --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/postgresql/exec.json @@ -0,0 +1,3 @@ +{ + "os": ["darwin", "linux"] +} diff --git a/internal/endtoend/testdata/invalid_table_alias/sqlite/exec.json b/internal/endtoend/testdata/invalid_table_alias/sqlite/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/sqlite/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/invalid_table_alias/sqlite/query.sql b/internal/endtoend/testdata/invalid_table_alias/sqlite/query.sql index 22482fb724..658a966e20 100644 --- a/internal/endtoend/testdata/invalid_table_alias/sqlite/query.sql +++ b/internal/endtoend/testdata/invalid_table_alias/sqlite/query.sql @@ -1,12 +1,5 @@ --- https://github.com/sqlc-dev/sqlc/issues/437 -CREATE TABLE authors ( - id INT PRIMARY KEY, - name VARCHAR(255) NOT NULL, - bio text -); - -- name: GetAuthor :one -SELECT * -FROM authors a -WHERE p.id = ? -LIMIT 1; +SELECT * +FROM authors AS a +WHERE p.id = ? +LIMIT 1; diff --git a/internal/endtoend/testdata/invalid_table_alias/sqlite/schema.sql b/internal/endtoend/testdata/invalid_table_alias/sqlite/schema.sql new file mode 100644 index 0000000000..fe5a44f601 --- /dev/null +++ b/internal/endtoend/testdata/invalid_table_alias/sqlite/schema.sql @@ -0,0 +1,6 @@ +-- https://github.com/sqlc-dev/sqlc/issues/437 +CREATE TABLE authors ( + id INTEGER PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/invalid_table_alias/sqlite/sqlc.json b/internal/endtoend/testdata/invalid_table_alias/sqlite/sqlc.json index fcb288cb35..d4963e751f 100644 --- a/internal/endtoend/testdata/invalid_table_alias/sqlite/sqlc.json +++ b/internal/endtoend/testdata/invalid_table_alias/sqlite/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "sqlite", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/invalid_table_alias/sqlite/stderr.txt b/internal/endtoend/testdata/invalid_table_alias/sqlite/stderr.txt index 810c893a70..97e43851e0 100644 --- a/internal/endtoend/testdata/invalid_table_alias/sqlite/stderr.txt +++ b/internal/endtoend/testdata/invalid_table_alias/sqlite/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:11:9: table alias "p" does not exist +query.sql:1:1: sqlite3: SQL logic error: no such column: p.id diff --git a/internal/endtoend/testdata/join_alias/mysql/go/db.go b/internal/endtoend/testdata/join_alias/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/db.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_alias/mysql/go/models.go b/internal/endtoend/testdata/join_alias/mysql/go/models.go index 2ba276cd1f..33aa0f72f4 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/models.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go index 4d4884bcb9..ecfe1474c8 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go index ed24fefdd7..28c016a807 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go index 465f212dcc..8dc5d8f6d3 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go index 05fdb91517..c275626081 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go index 18b76d4d58..59c0c8a555 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go index ed24fefdd7..28c016a807 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go index 7c0ac02745..ae1350d799 100644 --- a/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_alias/sqlite/go/db.go b/internal/endtoend/testdata/join_alias/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_alias/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_alias/sqlite/go/models.go b/internal/endtoend/testdata/join_alias/sqlite/go/models.go index 0a79e82d73..0eafe6de1c 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_alias/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go index d6b4f43d01..c7ef880555 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -12,8 +12,8 @@ import ( const aliasExpand = `-- name: AliasExpand :many SELECT f.id, b.id, title -FROM foo f -JOIN bar b ON b.id = f.id +FROM foo AS f +JOIN bar AS b ON b.id = f.id WHERE f.id = ? ` @@ -48,8 +48,8 @@ func (q *Queries) AliasExpand(ctx context.Context, id int64) ([]AliasExpandRow, const aliasJoin = `-- name: AliasJoin :many SELECT f.id, b.title -FROM foo f -JOIN bar b ON b.id = f.id +FROM foo AS f +JOIN bar AS b ON b.id = f.id WHERE f.id = ? ` diff --git a/internal/endtoend/testdata/join_alias/sqlite/query.sql b/internal/endtoend/testdata/join_alias/sqlite/query.sql index 9b087bcae7..cfb69f01dd 100644 --- a/internal/endtoend/testdata/join_alias/sqlite/query.sql +++ b/internal/endtoend/testdata/join_alias/sqlite/query.sql @@ -1,11 +1,11 @@ -- name: AliasJoin :many SELECT f.id, b.title -FROM foo f -JOIN bar b ON b.id = f.id +FROM foo AS f +JOIN bar AS b ON b.id = f.id WHERE f.id = ?; -- name: AliasExpand :many SELECT * -FROM foo f -JOIN bar b ON b.id = f.id +FROM foo AS f +JOIN bar AS b ON b.id = f.id WHERE f.id = ?; diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go index 2446af1281..17971283c7 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type A struct { ID int64 A string diff --git a/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go index fc49e70005..e617a64d66 100644 --- a/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_clauses_order/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/mysql/go/db.go b/internal/endtoend/testdata/join_from/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/db.go +++ b/internal/endtoend/testdata/join_from/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_from/mysql/go/models.go b/internal/endtoend/testdata/join_from/mysql/go/models.go index 44dcbcf383..26f421e80c 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/models.go +++ b/internal/endtoend/testdata/join_from/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/mysql/go/query.sql.go b/internal/endtoend/testdata/join_from/mysql/go/query.sql.go index 7cc63dc953..8c391e6662 100644 --- a/internal/endtoend/testdata/join_from/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go index 44dcbcf383..26f421e80c 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go index f726c3cd9b..ec85e0a92e 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go index 44dcbcf383..26f421e80c 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go index f726c3cd9b..ec85e0a92e 100644 --- a/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go index 44dcbcf383..26f421e80c 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go index 61d5dc964e..9a69c149c6 100644 --- a/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_from/sqlite/go/db.go b/internal/endtoend/testdata/join_from/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_from/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_from/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_from/sqlite/go/models.go b/internal/endtoend/testdata/join_from/sqlite/go/models.go index 44dcbcf383..26f421e80c 100644 --- a/internal/endtoend/testdata/join_from/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_from/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Login string } diff --git a/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go index 7cc63dc953..8c391e6662 100644 --- a/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_from/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_full/postgresql/go/db.go b/internal/endtoend/testdata/join_full/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_full/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_full/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_full/postgresql/go/models.go b/internal/endtoend/testdata/join_full/postgresql/go/models.go index f09478c274..6878c1d1b7 100644 --- a/internal/endtoend/testdata/join_full/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_full/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go index 728987c725..9e631ea3cc 100644 --- a/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_full/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go index 7b21a566df..fa99fe41c6 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Email string } diff --git a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go index eb2ff54882..c9d164f846 100644 --- a/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_group_by_alias/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_inner/postgresql/go/db.go b/internal/endtoend/testdata/join_inner/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_inner/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_inner/postgresql/go/models.go b/internal/endtoend/testdata/join_inner/postgresql/go/models.go index b67846fcaf..4ad815ce14 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_inner/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go index 19584f71f6..673053362c 100644 --- a/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_inner/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left/mysql/go/db.go b/internal/endtoend/testdata/join_left/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_left/mysql/go/db.go +++ b/internal/endtoend/testdata/join_left/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_left/mysql/go/models.go b/internal/endtoend/testdata/join_left/mysql/go/models.go index de2c774a86..473543e06c 100644 --- a/internal/endtoend/testdata/join_left/mysql/go/models.go +++ b/internal/endtoend/testdata/join_left/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go index e503037773..8bf553262d 100644 --- a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left/mysql/schema.sql b/internal/endtoend/testdata/join_left/mysql/schema.sql index a73a02ca00..9b15eaea36 100644 --- a/internal/endtoend/testdata/join_left/mysql/schema.sql +++ b/internal/endtoend/testdata/join_left/mysql/schema.sql @@ -28,11 +28,11 @@ CREATE TABLE super_authors ( CREATE TABLE users_2 ( user_id INT PRIMARY KEY, user_nickname VARCHAR(30) UNIQUE NOT NULL, - user_email TEXT UNIQUE NOT NULL, + user_email VARCHAR(20) UNIQUE NOT NULL, user_display_name TEXT NOT NULL, user_password TEXT NULL, - user_google_id TEXT UNIQUE NULL, - user_apple_id TEXT UNIQUE NULL, + user_google_id VARCHAR(20) UNIQUE NULL, + user_apple_id VARCHAR(20) UNIQUE NULL, user_bio VARCHAR(160) NOT NULL DEFAULT '', user_created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, user_avatar_id INT UNIQUE NULL diff --git a/internal/endtoend/testdata/join_left/postgresql/go/db.go b/internal/endtoend/testdata/join_left/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_left/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_left/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_left/postgresql/go/models.go b/internal/endtoend/testdata/join_left/postgresql/go/models.go index 3f3538a33d..1199f5d8f0 100644 --- a/internal/endtoend/testdata/join_left/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_left/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go index 95ca61b115..f8d2316731 100644 --- a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left/sqlite/go/db.go b/internal/endtoend/testdata/join_left/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_left/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_left/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_left/sqlite/go/models.go b/internal/endtoend/testdata/join_left/sqlite/go/models.go index e73456b4d4..520b0cb2c2 100644 --- a/internal/endtoend/testdata/join_left/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_left/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go index 61b1479104..4037bc4718 100644 --- a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -12,10 +12,9 @@ import ( ) const allAuthors = `-- name: AllAuthors :many -SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id -FROM authors AS a - LEFT JOIN authors AS p - ON a.parent_id = p.id +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors AS a +LEFT JOIN authors AS p ON a.parent_id = p.id ` type AllAuthorsRow struct { @@ -58,10 +57,9 @@ func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { } const allAuthorsAliases = `-- name: AllAuthorsAliases :many -SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id -FROM authors AS a - LEFT JOIN authors AS p - ON a.parent_id = p.id +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors AS a +LEFT JOIN authors AS p ON a.parent_id = p.id ` type AllAuthorsAliasesRow struct { @@ -104,10 +102,9 @@ func (q *Queries) AllAuthorsAliases(ctx context.Context) ([]AllAuthorsAliasesRow } const allAuthorsAliases2 = `-- name: AllAuthorsAliases2 :many -SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id -FROM authors AS a - LEFT JOIN authors AS p - ON a.parent_id = p.id +SELECT a.id, a.name, a.parent_id, p.id, p.name, p.parent_id +FROM authors AS a +LEFT JOIN authors AS p ON a.parent_id = p.id ` type AllAuthorsAliases2Row struct { @@ -150,10 +147,9 @@ func (q *Queries) AllAuthorsAliases2(ctx context.Context) ([]AllAuthorsAliases2R } const allSuperAuthors = `-- name: AllSuperAuthors :many -SELECT id, name, parent_id, super_id, super_name, super_parent_id -FROM authors - LEFT JOIN super_authors - ON authors.parent_id = super_authors.super_id +SELECT id, name, parent_id, super_id, super_name, super_parent_id +FROM authors +LEFT JOIN super_authors ON authors.parent_id = super_authors.super_id ` type AllSuperAuthorsRow struct { @@ -196,10 +192,9 @@ func (q *Queries) AllSuperAuthors(ctx context.Context) ([]AllSuperAuthorsRow, er } const allSuperAuthorsAliases = `-- name: AllSuperAuthorsAliases :many -SELECT id, name, parent_id, super_id, super_name, super_parent_id -FROM authors AS a - LEFT JOIN super_authors AS sa - ON a.parent_id = sa.super_id +SELECT id, name, parent_id, super_id, super_name, super_parent_id +FROM authors AS a +LEFT JOIN super_authors AS sa ON a.parent_id = sa.super_id ` type AllSuperAuthorsAliasesRow struct { @@ -242,10 +237,9 @@ func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthors } const allSuperAuthorsAliases2 = `-- name: AllSuperAuthorsAliases2 :many -SELECT a.id, a.name, a.parent_id, sa.super_id, sa.super_name, sa.super_parent_id -FROM authors AS a - LEFT JOIN super_authors AS sa - ON a.parent_id = sa.super_id +SELECT a.id, a.name, a.parent_id, sa.super_id, sa.super_name, sa.super_parent_id +FROM authors AS a +LEFT JOIN super_authors AS sa ON a.parent_id = sa.super_id ` type AllSuperAuthorsAliases2Row struct { @@ -289,11 +283,11 @@ func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthor const getMayors = `-- name: GetMayors :many SELECT - user_id, - mayors.full_name + user_id, + mayors.full_name FROM users LEFT JOIN cities USING (city_id) -INNER JOIN mayors USING (mayor_id) +JOIN mayors USING (mayor_id) ` type GetMayorsRow struct { @@ -326,9 +320,9 @@ func (q *Queries) GetMayors(ctx context.Context) ([]GetMayorsRow, error) { const getMayorsOptional = `-- name: GetMayorsOptional :many SELECT - user_id, - cities.city_id, - mayors.full_name + user_id, + cities.city_id, + mayors.full_name FROM users LEFT JOIN cities USING (city_id) LEFT JOIN mayors USING (mayor_id) @@ -364,11 +358,10 @@ func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow } const getSuggestedUsersByID = `-- name: GetSuggestedUsersByID :many -SELECT DISTINCT u.user_id, u.user_nickname, u.user_email, u.user_display_name, u.user_password, u.user_google_id, u.user_apple_id, u.user_bio, u.user_created_at, u.user_avatar_id, m.media_id, m.media_created_at, m.media_hash, m.media_directory, m.media_author_id, m.media_width, m.media_height -FROM users_2 AS u - LEFT JOIN media AS m - ON u.user_avatar_id = m.media_id -WHERE u.user_id != ?1 +SELECT DISTINCT u.user_id, u.user_nickname, u.user_email, u.user_display_name, u.user_password, u.user_google_id, u.user_apple_id, u.user_bio, u.user_created_at, u.user_avatar_id, m.media_id, m.media_created_at, m.media_hash, m.media_directory, m.media_author_id, m.media_width, m.media_height +FROM users_2 AS u +LEFT JOIN media AS m ON u.user_avatar_id = m.media_id +WHERE u.user_id != ?1 ` type GetSuggestedUsersByIDRow struct { @@ -433,11 +426,10 @@ func (q *Queries) GetSuggestedUsersByID(ctx context.Context, userID int64) ([]Ge } const getSuggestedUsersByID2 = `-- name: GetSuggestedUsersByID2 :many -SELECT users_2.user_id -FROM users_2 - LEFT JOIN media AS m - ON user_avatar_id = m.media_id -WHERE user_id != ?1 +SELECT users_2.user_id +FROM users_2 +LEFT JOIN media AS m ON user_avatar_id = m.media_id +WHERE user_id != ?1 ` func (q *Queries) GetSuggestedUsersByID2(ctx context.Context, userID int64) ([]int64, error) { diff --git a/internal/endtoend/testdata/join_left/sqlite/query.sql b/internal/endtoend/testdata/join_left/sqlite/query.sql index d9ccaede83..863f0d294d 100644 --- a/internal/endtoend/testdata/join_left/sqlite/query.sql +++ b/internal/endtoend/testdata/join_left/sqlite/query.sql @@ -1,66 +1,58 @@ -- name: GetMayors :many SELECT - user_id, - mayors.full_name + user_id, + mayors.full_name FROM users LEFT JOIN cities USING (city_id) -INNER JOIN mayors USING (mayor_id); +JOIN mayors USING (mayor_id); -- name: GetMayorsOptional :many SELECT - user_id, - cities.city_id, - mayors.full_name + user_id, + cities.city_id, + mayors.full_name FROM users LEFT JOIN cities USING (city_id) LEFT JOIN mayors USING (mayor_id); -- name: AllAuthors :many -SELECT * -FROM authors AS a - LEFT JOIN authors AS p - ON a.parent_id = p.id; +SELECT * +FROM authors AS a +LEFT JOIN authors AS p ON a.parent_id = p.id; -- name: AllAuthorsAliases :many -SELECT * -FROM authors AS a - LEFT JOIN authors AS p - ON a.parent_id = p.id; +SELECT * +FROM authors AS a +LEFT JOIN authors AS p ON a.parent_id = p.id; -- name: AllSuperAuthors :many -SELECT * -FROM authors - LEFT JOIN super_authors - ON authors.parent_id = super_authors.super_id; +SELECT * +FROM authors +LEFT JOIN super_authors ON authors.parent_id = super_authors.super_id; -- name: AllAuthorsAliases2 :many -SELECT a.*, p.* -FROM authors AS a - LEFT JOIN authors AS p - ON a.parent_id = p.id; +SELECT a.*, p.* +FROM authors AS a +LEFT JOIN authors AS p ON a.parent_id = p.id; -- name: AllSuperAuthorsAliases :many -SELECT * -FROM authors AS a - LEFT JOIN super_authors AS sa - ON a.parent_id = sa.super_id; +SELECT * +FROM authors AS a +LEFT JOIN super_authors AS sa ON a.parent_id = sa.super_id; -- name: AllSuperAuthorsAliases2 :many -SELECT a.*, sa.* -FROM authors AS a - LEFT JOIN super_authors AS sa - ON a.parent_id = sa.super_id; +SELECT a.*, sa.* +FROM authors AS a +LEFT JOIN super_authors AS sa ON a.parent_id = sa.super_id; -- name: GetSuggestedUsersByID :many -SELECT DISTINCT u.*, m.* -FROM users_2 AS u - LEFT JOIN media AS m - ON u.user_avatar_id = m.media_id -WHERE u.user_id != @user_id; +SELECT DISTINCT u.*, m.* +FROM users_2 AS u +LEFT JOIN media AS m ON u.user_avatar_id = m.media_id +WHERE u.user_id != @user_id; -- name: GetSuggestedUsersByID2 :many -SELECT users_2.user_id -FROM users_2 - LEFT JOIN media AS m - ON user_avatar_id = m.media_id -WHERE user_id != @user_id; +SELECT users_2.user_id +FROM users_2 +LEFT JOIN media AS m ON user_avatar_id = m.media_id +WHERE user_id != @user_id; diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go b/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go b/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go index 5cd950f4e3..287c217804 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go index a5b53b7f27..65ee188518 100644 --- a/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go index 5cd950f4e3..287c217804 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go index db78621bb9..0afcffc576 100644 --- a/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/postgres/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go index 43b7d88ce8..dc6012778a 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go index d4c9ad53b4..1e566df2da 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,13 +11,13 @@ import ( ) const allAuthors = `-- name: AllAuthors :many -SELECT a.id, - a.name, - p.id as alias_id, - p.name as alias_name -FROM authors AS a - LEFT JOIN authors AS p - ON (authors.parent_id = p.id) +SELECT + a.id, + a.name, + p.id AS alias_id, + p.name AS alias_name +FROM authors AS a +LEFT JOIN authors AS p ON a.parent_id = p.id ` type AllAuthorsRow struct { diff --git a/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql b/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql index 11f6c6903b..6430a52086 100644 --- a/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql +++ b/internal/endtoend/testdata/join_left_same_table/sqlite/query.sql @@ -1,8 +1,8 @@ -- name: AllAuthors :many -SELECT a.id, - a.name, - p.id as alias_id, - p.name as alias_name -FROM authors AS a - LEFT JOIN authors AS p - ON (authors.parent_id = p.id); +SELECT + a.id, + a.name, + p.id AS alias_id, + p.name AS alias_name +FROM authors AS a +LEFT JOIN authors AS p ON a.parent_id = p.id; diff --git a/internal/endtoend/testdata/join_left_table_alias/issue.md b/internal/endtoend/testdata/join_left_table_alias/issue.md new file mode 100644 index 0000000000..77e67d1243 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1897 diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..1f8c8463a3 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Bar struct { + FooID int64 + Info string +} + +type Foo struct { + ID int64 +} diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..4f8dfac1f5 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const joinBar = `-- name: JoinBar :one +SELECT f.id, info +FROM foo f +LEFT JOIN bar b ON b.foo_id = f.id +` + +type JoinBarRow struct { + ID int64 + Info pgtype.Text +} + +func (q *Queries) JoinBar(ctx context.Context) (JoinBarRow, error) { + row := q.db.QueryRow(ctx, joinBar) + var i JoinBarRow + err := row.Scan(&i.ID, &i.Info) + return i, err +} + +const joinBarAlias = `-- name: JoinBarAlias :one +SELECT f.id, b.info +FROM foo f +LEFT JOIN bar b ON b.foo_id = f.id +` + +type JoinBarAliasRow struct { + ID int64 + Info pgtype.Text +} + +func (q *Queries) JoinBarAlias(ctx context.Context) (JoinBarAliasRow, error) { + row := q.db.QueryRow(ctx, joinBarAlias) + var i JoinBarAliasRow + err := row.Scan(&i.ID, &i.Info) + return i, err +} diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/query.sql new file mode 100644 index 0000000000..ad61f17b7b --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/query.sql @@ -0,0 +1,9 @@ +-- name: JoinBar :one +SELECT f.id, info +FROM foo f +LEFT JOIN bar b ON b.foo_id = f.id; + +-- name: JoinBarAlias :one +SELECT f.id, b.info +FROM foo f +LEFT JOIN bar b ON b.foo_id = f.id; diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..2961590998 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE foo ( + id BIGINT PRIMARY KEY +); + +CREATE TABLE bar +( + foo_id BIGINT NOT NULL, + info TEXT NOT NULL +); diff --git a/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_left_table_alias/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/join_order_by/issue.md b/internal/endtoend/testdata/join_order_by/issue.md new file mode 100644 index 0000000000..1c3c36feb8 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2538 diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/exec.json b/internal/endtoend/testdata/join_order_by/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..4e97f66a99 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..9fe80c0d96 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAuthor = `-- name: GetAuthor :one +SELECT a.name +FROM authors a JOIN authors b ON a.id = b.id +ORDER BY name +` + +func (q *Queries) GetAuthor(ctx context.Context) (string, error) { + row := q.db.QueryRow(ctx, getAuthor) + var name string + err := row.Scan(&name) + return name, err +} diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_order_by/postgresql/pgx/query.sql new file mode 100644 index 0000000000..39cf01c58b --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: GetAuthor :one +SELECT a.name +FROM authors a JOIN authors b ON a.id = b.id +ORDER BY name; diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_order_by/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/join_order_by/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_order_by/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_order_by/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go index 7b21a566df..fa99fe41c6 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Email string } diff --git a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go index 3bad17de64..2e58db30dc 100644 --- a/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_order_by_alias/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_right/mysql/go/db.go b/internal/endtoend/testdata/join_right/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_right/mysql/go/db.go +++ b/internal/endtoend/testdata/join_right/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_right/mysql/go/models.go b/internal/endtoend/testdata/join_right/mysql/go/models.go index 341e4cf911..6878c1d1b7 100644 --- a/internal/endtoend/testdata/join_right/mysql/go/models.go +++ b/internal/endtoend/testdata/join_right/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -9,10 +9,10 @@ import ( ) type Bar struct { - ID uint64 + ID int32 } type Foo struct { - ID uint64 + ID int32 BarID sql.NullInt32 } diff --git a/internal/endtoend/testdata/join_right/mysql/go/query.sql.go b/internal/endtoend/testdata/join_right/mysql/go/query.sql.go index 721dc6238c..182045a543 100644 --- a/internal/endtoend/testdata/join_right/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_right/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -18,12 +18,12 @@ WHERE f.id = ? ` type RightJoinRow struct { - ID sql.NullInt64 + ID sql.NullInt32 BarID sql.NullInt32 - ID_2 uint64 + ID_2 int32 } -func (q *Queries) RightJoin(ctx context.Context, id uint64) ([]RightJoinRow, error) { +func (q *Queries) RightJoin(ctx context.Context, id int32) ([]RightJoinRow, error) { rows, err := q.db.QueryContext(ctx, rightJoin, id) if err != nil { return nil, err diff --git a/internal/endtoend/testdata/join_right/mysql/schema.sql b/internal/endtoend/testdata/join_right/mysql/schema.sql index 0559fc8ab8..f0f2cb1685 100644 --- a/internal/endtoend/testdata/join_right/mysql/schema.sql +++ b/internal/endtoend/testdata/join_right/mysql/schema.sql @@ -1,3 +1,8 @@ -CREATE TABLE foo (id serial not null, bar_id int references bar(id)); -CREATE TABLE bar (id serial not null); +CREATE TABLE bar ( + id integer not null, + UNIQUE(id) +); + +CREATE TABLE foo (id integer not null, bar_id integer references bar(id)); + diff --git a/internal/endtoend/testdata/join_right/postgresql/go/db.go b/internal/endtoend/testdata/join_right/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_right/postgresql/go/db.go +++ b/internal/endtoend/testdata/join_right/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_right/postgresql/go/models.go b/internal/endtoend/testdata/join_right/postgresql/go/models.go index f09478c274..6878c1d1b7 100644 --- a/internal/endtoend/testdata/join_right/postgresql/go/models.go +++ b/internal/endtoend/testdata/join_right/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go index 6df6cdf634..d70da97665 100644 --- a/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_right/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_table_name/mysql/go/db.go b/internal/endtoend/testdata/join_table_name/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/db.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_table_name/mysql/go/models.go b/internal/endtoend/testdata/join_table_name/mysql/go/models.go index ca422f8bb2..b72efbb2b2 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/models.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/models.go @@ -1,16 +1,18 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () +import ( + "database/sql" +) type Bar struct { - ID uint64 + ID int32 } type Foo struct { - ID uint64 - Bar uint64 + ID int32 + Bar sql.NullInt32 } diff --git a/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go b/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go index 704f80d27f..ed04160492 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -17,13 +17,13 @@ WHERE bar.id = ? AND foo.id = ? ` type TableNameParams struct { - ID uint64 - ID_2 uint64 + ID int32 + ID_2 int32 } -func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (uint64, error) { +func (q *Queries) TableName(ctx context.Context, arg TableNameParams) (int32, error) { row := q.db.QueryRowContext(ctx, tableName, arg.ID, arg.ID_2) - var id uint64 + var id int32 err := row.Scan(&id) return id, err } diff --git a/internal/endtoend/testdata/join_table_name/mysql/schema.sql b/internal/endtoend/testdata/join_table_name/mysql/schema.sql index b0f5adf952..f54c3b485d 100644 --- a/internal/endtoend/testdata/join_table_name/mysql/schema.sql +++ b/internal/endtoend/testdata/join_table_name/mysql/schema.sql @@ -1,3 +1,7 @@ -CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE bar ( + id integer not null, + UNIQUE (id) +); + +CREATE TABLE foo (id integer not null, bar integer references bar(id)); diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go index 97645ef1cc..b72efbb2b2 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go index b792063714..975f2be114 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go index dd2bbebe37..977ceaa775 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go index b792063714..975f2be114 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go index 97645ef1cc..b72efbb2b2 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go index 9d3b717ccc..6dfba960f7 100644 --- a/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_table_name/sqlite/go/db.go b/internal/endtoend/testdata/join_table_name/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_table_name/sqlite/go/models.go b/internal/endtoend/testdata/join_table_name/sqlite/go/models.go index 0dfbc6a574..f9b758f7cc 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go index 4ee2d257c8..2e3648111d 100644 --- a/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_table_name/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/mysql/go/db.go b/internal/endtoend/testdata/join_two_tables/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_two_tables/mysql/go/models.go b/internal/endtoend/testdata/join_two_tables/mysql/go/models.go index a066284f06..500b6e8e2b 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID uint64 } @@ -16,5 +14,5 @@ type Baz struct { type Foo struct { BarID uint64 - BazID uint64 + BazID int32 } diff --git a/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go index 5927fcc016..2176a9179f 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/mysql/schema.sql b/internal/endtoend/testdata/join_two_tables/mysql/schema.sql index 86eb87a1ff..d8b5e500cf 100644 --- a/internal/endtoend/testdata/join_two_tables/mysql/schema.sql +++ b/internal/endtoend/testdata/join_two_tables/mysql/schema.sql @@ -1,4 +1,4 @@ -CREATE TABLE foo (bar_id serial not null, baz_id serial not null); +CREATE TABLE foo (bar_id serial not null, baz_id integer not null); CREATE TABLE bar (id serial not null); CREATE TABLE baz (id serial not null); diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go index 7961958e95..bb768adc93 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go index 61960d893d..e8875e15bb 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go index 7961958e95..bb768adc93 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go index 61960d893d..e8875e15bb 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go index 7961958e95..bb768adc93 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go index 5927fcc016..2176a9179f 100644 --- a/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go index f35fe8a337..fa387e28d2 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go index 5927fcc016..2176a9179f 100644 --- a/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_two_tables/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go index 6173ad232d..40ddb24add 100644 --- a/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go index 700ef45f87..1c68a2213c 100644 --- a/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/join_update/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_using/issue.md b/internal/endtoend/testdata/join_using/issue.md new file mode 100644 index 0000000000..29861d9662 --- /dev/null +++ b/internal/endtoend/testdata/join_using/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1425 diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/exec.json b/internal/endtoend/testdata/join_using/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/go/db.go b/internal/endtoend/testdata/join_using/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/go/models.go b/internal/endtoend/testdata/join_using/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..1ab7501f78 --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type T1 struct { + Fk int32 +} + +type T2 struct { + Fk int32 +} diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..132e955d20 --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const selectJoinUsing = `-- name: SelectJoinUsing :many +select t1.fk, sum(t2.fk) from t1 join t2 using (fk) group by fk +` + +type SelectJoinUsingRow struct { + Fk int32 + Sum pgtype.Int8 +} + +func (q *Queries) SelectJoinUsing(ctx context.Context) ([]SelectJoinUsingRow, error) { + rows, err := q.db.Query(ctx, selectJoinUsing) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SelectJoinUsingRow + for rows.Next() { + var i SelectJoinUsingRow + if err := rows.Scan(&i.Fk, &i.Sum); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/query.sql b/internal/endtoend/testdata/join_using/postgresql/pgx/query.sql new file mode 100644 index 0000000000..67a732e02e --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: SelectJoinUsing :many +select t1.fk, sum(t2.fk) from t1 join t2 using (fk) group by fk; diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/schema.sql b/internal/endtoend/testdata/join_using/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..1e7b5a851d --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/schema.sql @@ -0,0 +1,6 @@ +create table t1 ( + fk integer not null unique +); +create table t2 ( + fk integer not null references t1(fk) +); diff --git a/internal/endtoend/testdata/join_using/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/join_using/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/join_using/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/join_where_clause/mysql/go/db.go b/internal/endtoend/testdata/join_where_clause/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_where_clause/mysql/go/models.go b/internal/endtoend/testdata/join_where_clause/mysql/go/models.go index 803077b57c..68e5019bab 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID uint64 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go index 9111e2dd4a..cce2078ec6 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go index c85fd0e71b..5dda8f0b0a 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go index 0f103bd681..9415c40a58 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go index c85fd0e71b..5dda8f0b0a 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go index 0f103bd681..9415c40a58 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go index c85fd0e71b..5dda8f0b0a 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go index 1cc8b130a5..a3d3265a65 100644 --- a/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go index 029903e6e5..2abca21ee0 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 Owner string diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go index 2a9c98ce40..8451dbbd08 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_where_clause/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/query.sql b/internal/endtoend/testdata/join_where_clause/sqlite/query.sql index 2b5ae53b00..bdff39a5ba 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/query.sql +++ b/internal/endtoend/testdata/join_where_clause/sqlite/query.sql @@ -14,4 +14,4 @@ WHERE owner = ?; SELECT foo.* FROM foo CROSS JOIN bar -WHERE bar.id = ? AND owner = ?; \ No newline at end of file +WHERE bar.id = ? AND owner = ?; diff --git a/internal/endtoend/testdata/json/mysql/go/copyfrom.go b/internal/endtoend/testdata/json/mysql/go/copyfrom.go new file mode 100644 index 0000000000..c2989e4ff5 --- /dev/null +++ b/internal/endtoend/testdata/json/mysql/go/copyfrom.go @@ -0,0 +1,51 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: copyfrom.go + +package querytest + +import ( + "context" + "fmt" + "io" + "sync/atomic" + + "github.com/go-sql-driver/mysql" + "github.com/hexon/mysqltsv" +) + +var readerHandlerSequenceForBulkInsert uint32 = 1 + +func convertRowsForBulkInsert(w *io.PipeWriter, arg []BulkInsertParams) { + e := mysqltsv.NewEncoder(w, 2, nil) + for _, row := range arg { + e.AppendBytes(row.A) + e.AppendBytes(row.B) + } + w.CloseWithError(e.Close()) +} + +// BulkInsert uses MySQL's LOAD DATA LOCAL INFILE and is not atomic. +// +// Errors and duplicate keys are treated as warnings and insertion will +// continue, even without an error for some cases. Use this in a transaction +// and use SHOW WARNINGS to check for any problems and roll back if you want to. +// +// Check the documentation for more information: +// https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling +func (q *Queries) BulkInsert(ctx context.Context, arg []BulkInsertParams) (int64, error) { + pr, pw := io.Pipe() + defer pr.Close() + rh := fmt.Sprintf("BulkInsert_%d", atomic.AddUint32(&readerHandlerSequenceForBulkInsert, 1)) + mysql.RegisterReaderHandler(rh, func() io.Reader { return pr }) + defer mysql.DeregisterReaderHandler(rh) + go convertRowsForBulkInsert(pw, arg) + // The string interpolation is necessary because LOAD DATA INFILE requires + // the file name to be given as a literal string. + result, err := q.db.ExecContext(ctx, fmt.Sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE `foo` %s (a, b)", "Reader::"+rh, mysqltsv.Escaping)) + if err != nil { + return 0, err + } + return result.RowsAffected() +} diff --git a/internal/endtoend/testdata/json/mysql/go/db.go b/internal/endtoend/testdata/json/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/json/mysql/go/db.go +++ b/internal/endtoend/testdata/json/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json/mysql/go/models.go b/internal/endtoend/testdata/json/mysql/go/models.go index 724a1dc24c..a82d576cc1 100644 --- a/internal/endtoend/testdata/json/mysql/go/models.go +++ b/internal/endtoend/testdata/json/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json/mysql/go/query.sql.go b/internal/endtoend/testdata/json/mysql/go/query.sql.go index 7418d99ba7..f65e680d8f 100644 --- a/internal/endtoend/testdata/json/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/json/mysql/go/query.sql.go @@ -1,14 +1,24 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest import ( "context" + "encoding/json" ) +const bulkInsert = `-- name: BulkInsert :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?) +` + +type BulkInsertParams struct { + A json.RawMessage + B json.RawMessage +} + const selectFoo = `-- name: SelectFoo :exec SELECT a, b FROM foo ` diff --git a/internal/endtoend/testdata/json/mysql/query.sql b/internal/endtoend/testdata/json/mysql/query.sql index a8629cc2ae..927e597562 100644 --- a/internal/endtoend/testdata/json/mysql/query.sql +++ b/internal/endtoend/testdata/json/mysql/query.sql @@ -1,2 +1,5 @@ -- name: SelectFoo :exec SELECT * FROM foo; + +-- name: BulkInsert :copyfrom +INSERT INTO foo (a, b) VALUES (?, ?); diff --git a/internal/endtoend/testdata/json/mysql/sqlc.json b/internal/endtoend/testdata/json/mysql/sqlc.json index e41c39e8b3..b1127e200f 100644 --- a/internal/endtoend/testdata/json/mysql/sqlc.json +++ b/internal/endtoend/testdata/json/mysql/sqlc.json @@ -4,6 +4,7 @@ { "path": "go", "engine": "mysql", + "sql_driver": "github.com/go-sql-driver/mysql", "name": "querytest", "schema": "schema.sql", "queries": "query.sql" diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go index 2fb0a5d003..1387f53ecf 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go index 2b4c0c5411..76286c2699 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go index b514ee396c..9d668a25a5 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { A []byte B []byte diff --git a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go index 2b4c0c5411..76286c2699 100644 --- a/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go index 2dd39817de..c638776774 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go index 1cb5500e08..b57ef45b4c 100644 --- a/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_array_elements/issue.md b/internal/endtoend/testdata/json_array_elements/issue.md new file mode 100644 index 0000000000..d33962b191 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2731 diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/exec.json b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/db.go b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/models.go b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..2c2f3e536b --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type SysAction struct { + ID int64 + Code string + Menu string + Title string + Resources []byte +} diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..7ccbdce8f2 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/go/query.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getActionCodeByResource = `-- name: GetActionCodeByResource :one +SELECT code, arr.item_object ->> 'code' as resource_code +FROM sys_actions, + jsonb_array_elements(resources) with ordinality arr(item_object, resource) + WHERE item_object->>'resource' = $1 + LIMIT 1 +` + +type GetActionCodeByResourceRow struct { + Code string + ResourceCode pgtype.Text +} + +func (q *Queries) GetActionCodeByResource(ctx context.Context, resource pgtype.Text) (GetActionCodeByResourceRow, error) { + row := q.db.QueryRow(ctx, getActionCodeByResource, resource) + var i GetActionCodeByResourceRow + err := row.Scan(&i.Code, &i.ResourceCode) + return i, err +} diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/query.sql b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/query.sql new file mode 100644 index 0000000000..44fe758df0 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: GetActionCodeByResource :one +SELECT code, arr.item_object ->> 'code' as resource_code +FROM sys_actions, + jsonb_array_elements(resources) with ordinality arr(item_object, resource) + WHERE item_object->>'resource' = sqlc.arg('resource') + LIMIT 1; diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/schema.sql b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..b10a6c1d10 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/schema.sql @@ -0,0 +1,8 @@ +CREATE TABLE "sys_actions" ( + "id" int8 NOT NULL, + "code" varchar(20) NOT NULL, + "menu" varchar(255) NOT NULL, + "title" varchar(20) NOT NULL, + "resources" jsonb, + PRIMARY KEY ("id") +); diff --git a/internal/endtoend/testdata/json_array_elements/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/json_array_elements/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go index a17fe9c2bb..667f9dee62 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go index 82cfaf9594..02daa76dec 100644 --- a/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go index 38c7255d0e..4aba355d68 100644 --- a/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_build/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/db.go b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go index ecdaf1e0a2..cebb98fc0a 100644 --- a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int32 Metadata []byte diff --git a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go index 850280d5b2..99aef6bcc0 100644 --- a/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/json_param_type/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_param_type/sqlite/go/db.go b/internal/endtoend/testdata/json_param_type/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/json_param_type/sqlite/go/models.go b/internal/endtoend/testdata/json_param_type/sqlite/go/models.go new file mode 100644 index 0000000000..c5a402e1d0 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID sql.NullInt64 + Metadata sql.NullString +} diff --git a/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go b/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go new file mode 100644 index 0000000000..9433531784 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/go/query.sql.go @@ -0,0 +1,22 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const findByAddress = `-- name: FindByAddress :one +SELECT id, metadata FROM "user" WHERE "metadata"->>'address1' = ?1 LIMIT 1 +` + +func (q *Queries) FindByAddress(ctx context.Context, metadata sql.NullString) (User, error) { + row := q.db.QueryRowContext(ctx, findByAddress, metadata) + var i User + err := row.Scan(&i.ID, &i.Metadata) + return i, err +} diff --git a/internal/endtoend/testdata/json_param_type/sqlite/query.sql b/internal/endtoend/testdata/json_param_type/sqlite/query.sql new file mode 100644 index 0000000000..7060d6e58e --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: FindByAddress :one +SELECT * FROM "user" WHERE "metadata"->>'address1' = ?1 LIMIT 1; \ No newline at end of file diff --git a/internal/endtoend/testdata/json_param_type/sqlite/schema.sql b/internal/endtoend/testdata/json_param_type/sqlite/schema.sql new file mode 100644 index 0000000000..26c82958a4 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE "user" ( + "id" INT, + "metadata" TEXT +); diff --git a/internal/endtoend/testdata/json_param_type/sqlite/sqlc.yaml b/internal/endtoend/testdata/json_param_type/sqlite/sqlc.yaml new file mode 100644 index 0000000000..0608985da1 --- /dev/null +++ b/internal/endtoend/testdata/json_param_type/sqlite/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "sqlite" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" \ No newline at end of file diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go index 0d3b33a77d..5e60ced6da 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go index 43a8611ae7..9f094da015 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go index 932ee36a10..3b9027d13c 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go index 43a8611ae7..9f094da015 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go index 0d3b33a77d..5e60ced6da 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go index 039ea641c2..a332798542 100644 --- a/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/camel_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go index caa7df7c05..fc5a94d5e2 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go index 43a8611ae7..9f094da015 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go index 0fbe47e0c4..f3ea3af629 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go index 43a8611ae7..9f094da015 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go index caa7df7c05..fc5a94d5e2 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go index 039ea641c2..a332798542 100644 --- a/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/pascal_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go index 0335ae4cf3..37699193dc 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go index 43a8611ae7..9f094da015 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go index d52d8dd32a..0cea14a318 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go index 43a8611ae7..9f094da015 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go index 0335ae4cf3..37699193dc 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go index 039ea641c2..a332798542 100644 --- a/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags/snake_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go index 7efb945fa7..0393e3a363 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -18,7 +18,7 @@ const ( JobPostLocationTypeHybrid JobPostLocationType = "hybrid" ) -func (e *JobPostLocationType) Scan(src interface{}) error { +func (e *JobPostLocationType) Scan(src any) error { switch s := src.(type) { case []byte: *e = JobPostLocationType(s) @@ -36,7 +36,7 @@ type NullJobPostLocationType struct { } // Scan implements the Scanner interface. -func (ns *NullJobPostLocationType) Scan(value interface{}) error { +func (ns *NullJobPostLocationType) Scan(value any) error { if value == nil { ns.JobPostLocationType, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go index 1236fb79f0..9e99374a13 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/camel_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go index 3b5a95c272..a3a8f7dc0f 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -18,7 +18,7 @@ const ( JobPostLocationTypeHybrid JobPostLocationType = "hybrid" ) -func (e *JobPostLocationType) Scan(src interface{}) error { +func (e *JobPostLocationType) Scan(src any) error { switch s := src.(type) { case []byte: *e = JobPostLocationType(s) @@ -36,7 +36,7 @@ type NullJobPostLocationType struct { } // Scan implements the Scanner interface. -func (ns *NullJobPostLocationType) Scan(value interface{}) error { +func (ns *NullJobPostLocationType) Scan(value any) error { if value == nil { ns.JobPostLocationType, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go index 1236fb79f0..9e99374a13 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/none/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go index 3b0e386120..389e8d7a9c 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -18,7 +18,7 @@ const ( JobPostLocationTypeHybrid JobPostLocationType = "hybrid" ) -func (e *JobPostLocationType) Scan(src interface{}) error { +func (e *JobPostLocationType) Scan(src any) error { switch s := src.(type) { case []byte: *e = JobPostLocationType(s) @@ -36,7 +36,7 @@ type NullJobPostLocationType struct { } // Scan implements the Scanner interface. -func (ns *NullJobPostLocationType) Scan(value interface{}) error { +func (ns *NullJobPostLocationType) Scan(value any) error { if value == nil { ns.JobPostLocationType, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go index 1236fb79f0..9e99374a13 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/pascal_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go index 3b5a95c272..a3a8f7dc0f 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -18,7 +18,7 @@ const ( JobPostLocationTypeHybrid JobPostLocationType = "hybrid" ) -func (e *JobPostLocationType) Scan(src interface{}) error { +func (e *JobPostLocationType) Scan(src any) error { switch s := src.(type) { case []byte: *e = JobPostLocationType(s) @@ -36,7 +36,7 @@ type NullJobPostLocationType struct { } // Scan implements the Scanner interface. -func (ns *NullJobPostLocationType) Scan(value interface{}) error { +func (ns *NullJobPostLocationType) Scan(value any) error { if value == nil { ns.JobPostLocationType, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go index 1236fb79f0..9e99374a13 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/snake_case/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go index 3b5a95c272..a3a8f7dc0f 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -18,7 +18,7 @@ const ( JobPostLocationTypeHybrid JobPostLocationType = "hybrid" ) -func (e *JobPostLocationType) Scan(src interface{}) error { +func (e *JobPostLocationType) Scan(src any) error { switch s := src.(type) { case []byte: *e = JobPostLocationType(s) @@ -36,7 +36,7 @@ type NullJobPostLocationType struct { } // Scan implements the Scanner interface. -func (ns *NullJobPostLocationType) Scan(value interface{}) error { +func (ns *NullJobPostLocationType) Scan(value any) error { if value == nil { ns.JobPostLocationType, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go index 1236fb79f0..9e99374a13 100644 --- a/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/json_tags_null_enum/v2_config/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/jsonb/pgx/go/db.go b/internal/endtoend/testdata/jsonb/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/jsonb/pgx/go/models.go b/internal/endtoend/testdata/jsonb/pgx/go/models.go new file mode 100644 index 0000000000..9d668a25a5 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Foo struct { + A []byte + B []byte + C []byte + D []byte +} diff --git a/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go b/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go new file mode 100644 index 0000000000..9358ffe58e --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertFoo = `-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d +) VALUES ( + $1, + $2, + $3, + $4 +) RETURNING a, b, c, d +` + +type InsertFooParams struct { + A []byte + B []byte + C []byte + D []byte +} + +func (q *Queries) InsertFoo(ctx context.Context, arg InsertFooParams) error { + _, err := q.db.Exec(ctx, insertFoo, + arg.A, + arg.B, + arg.C, + arg.D, + ) + return err +} + +const selectFoo = `-- name: SelectFoo :exec +SELECT a, b, c, d FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) error { + _, err := q.db.Exec(ctx, selectFoo) + return err +} diff --git a/internal/endtoend/testdata/jsonb/pgx/query.sql b/internal/endtoend/testdata/jsonb/pgx/query.sql new file mode 100644 index 0000000000..6959bd1a70 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/query.sql @@ -0,0 +1,15 @@ +-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d +) VALUES ( + @a, + @b, + @c, + @d +) RETURNING *; + +-- name: SelectFoo :exec +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/jsonb/pgx/schema.sql b/internal/endtoend/testdata/jsonb/pgx/schema.sql new file mode 100644 index 0000000000..6b4a1bb0fd --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE foo ( + a json not null, + b jsonb not null, + c json, + d jsonb +); + diff --git a/internal/endtoend/testdata/jsonb/pgx/sqlc.json b/internal/endtoend/testdata/jsonb/pgx/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/pgx/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/jsonb/sqlite/go/db.go b/internal/endtoend/testdata/jsonb/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/jsonb/sqlite/go/models.go b/internal/endtoend/testdata/jsonb/sqlite/go/models.go new file mode 100644 index 0000000000..a19424caff --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "encoding/json" +) + +type Foo struct { + A json.RawMessage + B json.RawMessage + C json.RawMessage + D json.RawMessage + E json.RawMessage + F json.RawMessage + G json.RawMessage + H json.RawMessage +} diff --git a/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go b/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go new file mode 100644 index 0000000000..655f57af7f --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/go/query.sql.go @@ -0,0 +1,69 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "encoding/json" +) + +const insertFoo = `-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d, + e, + f, + g, + h +) +VALUES ( + ?1, + ?2, + ?3, + ?4, + ?5, + ?6, + ?7, + ?8 +) +RETURNING a, json(b), c, json(d), e, json(f), g, json(h) +` + +type InsertFooParams struct { + A json.RawMessage + B json.RawMessage + C json.RawMessage + D json.RawMessage + E json.RawMessage + F json.RawMessage + G json.RawMessage + H json.RawMessage +} + +func (q *Queries) InsertFoo(ctx context.Context, arg InsertFooParams) error { + _, err := q.db.ExecContext(ctx, insertFoo, + arg.A, + arg.B, + arg.C, + arg.D, + arg.E, + arg.F, + arg.G, + arg.H, + ) + return err +} + +const selectFoo = `-- name: SelectFoo :exec +SELECT a, json(b), c, json(d), e, json(f), g, json(h) FROM foo +` + +func (q *Queries) SelectFoo(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, selectFoo) + return err +} diff --git a/internal/endtoend/testdata/jsonb/sqlite/query.sql b/internal/endtoend/testdata/jsonb/sqlite/query.sql new file mode 100644 index 0000000000..0fe40ee2e2 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/query.sql @@ -0,0 +1,25 @@ +-- name: InsertFoo :exec +INSERT INTO foo ( + a, + b, + c, + d, + e, + f, + g, + h +) +VALUES ( + @a, + @b, + @c, + @d, + @e, + @f, + @g, + @h +) +RETURNING *; + +-- name: SelectFoo :exec +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/jsonb/sqlite/schema.sql b/internal/endtoend/testdata/jsonb/sqlite/schema.sql new file mode 100644 index 0000000000..cc237ce009 --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE foo ( + a json not null, + b jsonb not null, + c json, + d jsonb, + e JSON not null, + f JSONB not null, + g JSON, + h JSONB +); + diff --git a/internal/endtoend/testdata/jsonb/sqlite/sqlc.json b/internal/endtoend/testdata/jsonb/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/jsonb/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/limit/mysql/go/db.go b/internal/endtoend/testdata/limit/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/limit/mysql/go/db.go +++ b/internal/endtoend/testdata/limit/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/limit/mysql/go/models.go b/internal/endtoend/testdata/limit/mysql/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/limit/mysql/go/models.go +++ b/internal/endtoend/testdata/limit/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/mysql/go/query.sql.go b/internal/endtoend/testdata/limit/mysql/go/query.sql.go index de24bbd3b7..37df69d7b1 100644 --- a/internal/endtoend/testdata/limit/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/limit/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/limit/pgx/v4/go/db.go b/internal/endtoend/testdata/limit/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/limit/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/limit/pgx/v4/go/models.go b/internal/endtoend/testdata/limit/pgx/v4/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/limit/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go index a00a47af0b..d0b0b08545 100644 --- a/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/limit/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/limit/pgx/v5/go/db.go b/internal/endtoend/testdata/limit/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/limit/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/limit/pgx/v5/go/models.go b/internal/endtoend/testdata/limit/pgx/v5/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/limit/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go index a00a47af0b..d0b0b08545 100644 --- a/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/limit/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/limit/sqlite/go/db.go b/internal/endtoend/testdata/limit/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/limit/sqlite/go/db.go +++ b/internal/endtoend/testdata/limit/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/limit/sqlite/go/models.go b/internal/endtoend/testdata/limit/sqlite/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/limit/sqlite/go/models.go +++ b/internal/endtoend/testdata/limit/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/sqlite/go/query.sql.go b/internal/endtoend/testdata/limit/sqlite/go/query.sql.go index 75af7e8f64..4800120428 100644 --- a/internal/endtoend/testdata/limit/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/limit/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -9,15 +9,6 @@ import ( "context" ) -const deleteLimit = `-- name: DeleteLimit :exec -DELETE FROM foo LIMIT ? -` - -func (q *Queries) DeleteLimit(ctx context.Context, limit int64) error { - _, err := q.db.ExecContext(ctx, deleteLimit, limit) - return err -} - const limitMe = `-- name: LimitMe :many SELECT bar FROM foo LIMIT ? ` @@ -44,12 +35,3 @@ func (q *Queries) LimitMe(ctx context.Context, limit int64) ([]bool, error) { } return items, nil } - -const updateLimit = `-- name: UpdateLimit :exec -UPDATE foo SET bar='baz' LIMIT ? -` - -func (q *Queries) UpdateLimit(ctx context.Context, limit int64) error { - _, err := q.db.ExecContext(ctx, updateLimit, limit) - return err -} diff --git a/internal/endtoend/testdata/limit/sqlite/query.sql b/internal/endtoend/testdata/limit/sqlite/query.sql index 025e2a812b..8514c9b476 100644 --- a/internal/endtoend/testdata/limit/sqlite/query.sql +++ b/internal/endtoend/testdata/limit/sqlite/query.sql @@ -1,8 +1,2 @@ -- name: LimitMe :many SELECT bar FROM foo LIMIT ?; - --- name: UpdateLimit :exec -UPDATE foo SET bar='baz' LIMIT ?; - --- name: DeleteLimit :exec -DELETE FROM foo LIMIT ?; diff --git a/internal/endtoend/testdata/limit/stdlib/go/db.go b/internal/endtoend/testdata/limit/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/limit/stdlib/go/db.go +++ b/internal/endtoend/testdata/limit/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/limit/stdlib/go/models.go b/internal/endtoend/testdata/limit/stdlib/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/limit/stdlib/go/models.go +++ b/internal/endtoend/testdata/limit/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/limit/stdlib/go/query.sql.go b/internal/endtoend/testdata/limit/stdlib/go/query.sql.go index 3eec04c629..c2aa02643b 100644 --- a/internal/endtoend/testdata/limit/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/limit/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower/pgx/v4/go/db.go b/internal/endtoend/testdata/lower/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/lower/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/lower/pgx/v4/go/models.go b/internal/endtoend/testdata/lower/pgx/v4/go/models.go index d95ec0aec6..d0f806e774 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/lower/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go index f38a3464e3..4777bbf5b8 100644 --- a/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/lower/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower/pgx/v5/go/db.go b/internal/endtoend/testdata/lower/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/lower/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/lower/pgx/v5/go/models.go b/internal/endtoend/testdata/lower/pgx/v5/go/models.go index d95ec0aec6..d0f806e774 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/lower/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go index f38a3464e3..4777bbf5b8 100644 --- a/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/lower/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower/stdlib/go/db.go b/internal/endtoend/testdata/lower/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/lower/stdlib/go/db.go +++ b/internal/endtoend/testdata/lower/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/lower/stdlib/go/models.go b/internal/endtoend/testdata/lower/stdlib/go/models.go index d95ec0aec6..d0f806e774 100644 --- a/internal/endtoend/testdata/lower/stdlib/go/models.go +++ b/internal/endtoend/testdata/lower/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower/stdlib/go/query.sql.go b/internal/endtoend/testdata/lower/stdlib/go/query.sql.go index b826e926bf..9ee4b584ee 100644 --- a/internal/endtoend/testdata/lower/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/lower/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go index d95ec0aec6..d0f806e774 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go index 10ea579538..9203b1c5cf 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go index d95ec0aec6..d0f806e774 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go index 10ea579538..9203b1c5cf 100644 --- a/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go index d95ec0aec6..d0f806e774 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string Bat string diff --git a/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go b/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go index 60e022498a..b1dff8e371 100644 --- a/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/lower_switched_order/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go index a91aa246f1..3bf4c36559 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go index a1c398553e..39128f44a6 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go index f0e07f746d..6e7c968e38 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go index a1c398553e..39128f44a6 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go index a91aa246f1..3bf4c36559 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go index bef31c8b9c..1e62759aab 100644 --- a/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/materialized_views/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go index 5f59febb3f..4835d70c0c 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Num int32 } diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go index c2b7fdb255..bcc1688c13 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go index 5f59febb3f..4835d70c0c 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Num int32 } diff --git a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go index c2b7fdb255..bcc1688c13 100644 --- a/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go index 5f59febb3f..4835d70c0c 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Num int32 } diff --git a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go index 8881d216d6..038047c4ff 100644 --- a/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/mathmatical_operator/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/min_max_date/issue.md b/internal/endtoend/testdata/min_max_date/issue.md new file mode 100644 index 0000000000..73083e9651 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1574 diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/exec.json b/internal/endtoend/testdata/min_max_date/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/db.go b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/models.go b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..a9219f8b1f --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Activity struct { + AccountID int64 + EventTime pgtype.Timestamptz +} diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..49981b4181 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/go/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const activityStats = `-- name: ActivityStats :one +SELECT COUNT(*) as NumOfActivities, + MIN(event_time) as MinDate, + MAX(event_time) as MaxDate +FROM activities +WHERE account_id = $1 +` + +type ActivityStatsRow struct { + Numofactivities int64 + Mindate pgtype.Timestamptz + Maxdate pgtype.Timestamptz +} + +func (q *Queries) ActivityStats(ctx context.Context, accountID int64) (ActivityStatsRow, error) { + row := q.db.QueryRow(ctx, activityStats, accountID) + var i ActivityStatsRow + err := row.Scan(&i.Numofactivities, &i.Mindate, &i.Maxdate) + return i, err +} diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/query.sql b/internal/endtoend/testdata/min_max_date/postgresql/pgx/query.sql new file mode 100644 index 0000000000..19909d0c88 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/query.sql @@ -0,0 +1,6 @@ +-- name: ActivityStats :one +SELECT COUNT(*) as NumOfActivities, + MIN(event_time) as MinDate, + MAX(event_time) as MaxDate +FROM activities +WHERE account_id = $1; diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/schema.sql b/internal/endtoend/testdata/min_max_date/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..c75fe28fbd --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE activities ( + account_id BIGINT NOT NULL, + event_time TIMESTAMP WITH TIME ZONE NOT NULL +); diff --git a/internal/endtoend/testdata/min_max_date/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/min_max_date/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/min_max_date/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go index f5cf23b517..4dbc5a5982 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go b/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go index 18d087bac2..9520697d35 100644 --- a/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/missing_semicolon/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mix_param_types/mysql/go/db.go b/internal/endtoend/testdata/mix_param_types/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/go/db.go +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/mix_param_types/mysql/go/models.go b/internal/endtoend/testdata/mix_param_types/mysql/go/models.go index 3d650b2fb8..bf470d2565 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/go/models.go +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID uint64 Name string diff --git a/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go b/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go index 094cea055b..75ac6d3b75 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go +++ b/internal/endtoend/testdata/mix_param_types/mysql/go/test.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: test.sql package querytest diff --git a/internal/endtoend/testdata/mix_param_types/mysql/schema.sql b/internal/endtoend/testdata/mix_param_types/mysql/schema.sql new file mode 100644 index 0000000000..b515bf8d04 --- /dev/null +++ b/internal/endtoend/testdata/mix_param_types/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE bar ( + id serial not null, + name text not null, + phone text not null +); diff --git a/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json b/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json index 145f64ba3f..3e8d09d00d 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json +++ b/internal/endtoend/testdata/mix_param_types/mysql/sqlc.json @@ -4,7 +4,7 @@ { "path": "go", "name": "querytest", - "schema": "test.sql", + "schema": "schema.sql", "queries": "test.sql", "engine": "mysql" } diff --git a/internal/endtoend/testdata/mix_param_types/mysql/test.sql b/internal/endtoend/testdata/mix_param_types/mysql/test.sql index b624d3e2ea..e23f1dcb70 100644 --- a/internal/endtoend/testdata/mix_param_types/mysql/test.sql +++ b/internal/endtoend/testdata/mix_param_types/mysql/test.sql @@ -1,9 +1,3 @@ -CREATE TABLE bar ( - id serial not null, - name text not null, - phone text not null -); - -- name: CountOne :one SELECT count(1) FROM bar WHERE id = sqlc.arg(id) AND name <> ?; diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go index d449828a99..27da234918 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go b/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go index e26ff42c11..c38d8be6fc 100644 --- a/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go +++ b/internal/endtoend/testdata/mix_param_types/postgresql/go/test.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: test.sql package querytest diff --git a/internal/endtoend/testdata/mssql_named_param_case/mssql/exec.json b/internal/endtoend/testdata/mssql_named_param_case/mssql/exec.json new file mode 100644 index 0000000000..f4e21983b6 --- /dev/null +++ b/internal/endtoend/testdata/mssql_named_param_case/mssql/exec.json @@ -0,0 +1 @@ +{"contexts": ["base"]} diff --git a/internal/endtoend/testdata/mssql_named_param_case/mssql/go/db.go b/internal/endtoend/testdata/mssql_named_param_case/mssql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/mssql_named_param_case/mssql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mssql_named_param_case/mssql/go/models.go b/internal/endtoend/testdata/mssql_named_param_case/mssql/go/models.go new file mode 100644 index 0000000000..2208139112 --- /dev/null +++ b/internal/endtoend/testdata/mssql_named_param_case/mssql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/mssql_named_param_case/mssql/go/query.sql.go b/internal/endtoend/testdata/mssql_named_param_case/mssql/go/query.sql.go new file mode 100644 index 0000000000..56dfa62d40 --- /dev/null +++ b/internal/endtoend/testdata/mssql_named_param_case/mssql/go/query.sql.go @@ -0,0 +1,38 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const byName = `-- name: ByName :many +SELECT id FROM authors WHERE name = @Name OR bio = @name; +` + +func (q *Queries) ByName(ctx context.Context, name string) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, byName, sql.Named("Name", name)) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/mssql_named_param_case/mssql/query.sql b/internal/endtoend/testdata/mssql_named_param_case/mssql/query.sql new file mode 100644 index 0000000000..0a75b76359 --- /dev/null +++ b/internal/endtoend/testdata/mssql_named_param_case/mssql/query.sql @@ -0,0 +1,2 @@ +-- name: ByName :many +SELECT id FROM authors WHERE name = @Name OR bio = @name; diff --git a/internal/endtoend/testdata/mssql_named_param_case/mssql/schema.sql b/internal/endtoend/testdata/mssql_named_param_case/mssql/schema.sql new file mode 100644 index 0000000000..c273b9f8fa --- /dev/null +++ b/internal/endtoend/testdata/mssql_named_param_case/mssql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name NVARCHAR(50) NOT NULL, + bio NVARCHAR(MAX) +); diff --git a/internal/endtoend/testdata/mssql_named_param_case/mssql/sqlc.yaml b/internal/endtoend/testdata/mssql_named_param_case/mssql/sqlc.yaml new file mode 100644 index 0000000000..94b0dc8896 --- /dev/null +++ b/internal/endtoend/testdata/mssql_named_param_case/mssql/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "mssql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/exec.json b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/exec.json new file mode 100644 index 0000000000..f4e21983b6 --- /dev/null +++ b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/exec.json @@ -0,0 +1 @@ +{"contexts": ["base"]} diff --git a/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/query.sql b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/query.sql new file mode 100644 index 0000000000..57e9506621 --- /dev/null +++ b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/query.sql @@ -0,0 +1,2 @@ +-- name: GetAuthor :one +SELECT * FROM authors WHERE id = @id; diff --git a/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/schema.sql b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/schema.sql new file mode 100644 index 0000000000..c273b9f8fa --- /dev/null +++ b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name NVARCHAR(50) NOT NULL, + bio NVARCHAR(MAX) +); diff --git a/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/sqlc.yaml b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/sqlc.yaml new file mode 100644 index 0000000000..8e918d9122 --- /dev/null +++ b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "mssql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/stderr.txt b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/stderr.txt new file mode 100644 index 0000000000..b3779783f0 --- /dev/null +++ b/internal/endtoend/testdata/mssql_sql_package_pgx/mssql/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +error generating code: invalid options: engine "mssql" supports sql_package "database/sql" only, not "pgx/v5" diff --git a/internal/endtoend/testdata/multibyte_comment/sqlite/go/db.go b/internal/endtoend/testdata/multibyte_comment/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/multibyte_comment/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/multibyte_comment/sqlite/go/models.go b/internal/endtoend/testdata/multibyte_comment/sqlite/go/models.go new file mode 100644 index 0000000000..da152e22e1 --- /dev/null +++ b/internal/endtoend/testdata/multibyte_comment/sqlite/go/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Item struct { + ID int64 + Name string + CapRead string +} diff --git a/internal/endtoend/testdata/multibyte_comment/sqlite/go/query.sql.go b/internal/endtoend/testdata/multibyte_comment/sqlite/go/query.sql.go new file mode 100644 index 0000000000..0ff9f72028 --- /dev/null +++ b/internal/endtoend/testdata/multibyte_comment/sqlite/go/query.sql.go @@ -0,0 +1,87 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const createItem = `-- name: CreateItem :exec +INSERT INTO items (name, cap_read) +VALUES (?, ?) +` + +type CreateItemParams struct { + Name string + CapRead string +} + +// 当新建条目时,需要写入名称和权限 +func (q *Queries) CreateItem(ctx context.Context, arg CreateItemParams) error { + _, err := q.db.ExecContext(ctx, createItem, arg.Name, arg.CapRead) + return err +} + +const deleteItem = `-- name: DeleteItem :one +DELETE FROM items WHERE id = ? RETURNING id, name, cap_read +` + +func (q *Queries) DeleteItem(ctx context.Context, id int64) (Item, error) { + row := q.db.QueryRowContext(ctx, deleteItem, id) + var i Item + err := row.Scan(&i.ID, &i.Name, &i.CapRead) + return i, err +} + +const listItems = `-- name: ListItems :many + +SELECT id, name, cap_read +FROM items +WHERE cap_read = 'anonymous' +ORDER BY name +` + +// Multi-byte UTF-8 in comments must not shift the byte offsets used to slice +// query text out of the source file (#4523, #4235, #4372). +// an em dash right here — must not truncate the ORDER BY below +func (q *Queries) ListItems(ctx context.Context) ([]Item, error) { + rows, err := q.db.QueryContext(ctx, listItems) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Item + for rows.Next() { + var i Item + if err := rows.Scan(&i.ID, &i.Name, &i.CapRead); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const updateItem = `-- name: UpdateItem :exec + +UPDATE items SET name = ? WHERE id = ? +` + +type UpdateItemParams struct { + Name string + ID int64 +} + +// section — divider between queries +func (q *Queries) UpdateItem(ctx context.Context, arg UpdateItemParams) error { + _, err := q.db.ExecContext(ctx, updateItem, arg.Name, arg.ID) + return err +} diff --git a/internal/endtoend/testdata/multibyte_comment/sqlite/query.sql b/internal/endtoend/testdata/multibyte_comment/sqlite/query.sql new file mode 100644 index 0000000000..527d3900ca --- /dev/null +++ b/internal/endtoend/testdata/multibyte_comment/sqlite/query.sql @@ -0,0 +1,22 @@ +-- Multi-byte UTF-8 in comments must not shift the byte offsets used to slice +-- query text out of the source file (#4523, #4235, #4372). + +-- name: ListItems :many +-- an em dash right here — must not truncate the ORDER BY below +SELECT id, name, cap_read +FROM items +WHERE cap_read = 'anonymous' +ORDER BY name; + +-- section — divider between queries + +-- name: UpdateItem :exec +UPDATE items SET name = ? WHERE id = ?; + +-- name: CreateItem :exec +-- 当新建条目时,需要写入名称和权限 +INSERT INTO items (name, cap_read) +VALUES (?, ?); + +-- name: DeleteItem :one +DELETE FROM items WHERE id = ? RETURNING id, name, cap_read; diff --git a/internal/endtoend/testdata/multibyte_comment/sqlite/schema.sql b/internal/endtoend/testdata/multibyte_comment/sqlite/schema.sql new file mode 100644 index 0000000000..cb0dedc01a --- /dev/null +++ b/internal/endtoend/testdata/multibyte_comment/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE items ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + cap_read TEXT NOT NULL +); diff --git a/internal/endtoend/testdata/multibyte_comment/sqlite/sqlc.json b/internal/endtoend/testdata/multibyte_comment/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/multibyte_comment/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go index 215284a5d8..edbfbc9019 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Tags [][]string } diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go index 2c2e257146..a61f4e8074 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go index 215284a5d8..edbfbc9019 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Tags [][]string } diff --git a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go index 2c2e257146..a61f4e8074 100644 --- a/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go index 215284a5d8..edbfbc9019 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { Tags [][]string } diff --git a/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go b/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go index cef04840c1..20104c71f8 100644 --- a/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/multidimension_array/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v4/go/db.go b/internal/endtoend/testdata/multischema/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/multischema/pgx/v4/go/models.go b/internal/endtoend/testdata/multischema/pgx/v4/go/models.go index 97645ef1cc..b72efbb2b2 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go index bcdded6731..5f30601012 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/db.go b/internal/endtoend/testdata/multischema/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/models.go b/internal/endtoend/testdata/multischema/pgx/v5/go/models.go index dd2bbebe37..977ceaa775 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go index bcdded6731..5f30601012 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multischema/stdlib/go/db.go b/internal/endtoend/testdata/multischema/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/multischema/stdlib/go/db.go +++ b/internal/endtoend/testdata/multischema/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/multischema/stdlib/go/models.go b/internal/endtoend/testdata/multischema/stdlib/go/models.go index 97645ef1cc..b72efbb2b2 100644 --- a/internal/endtoend/testdata/multischema/stdlib/go/models.go +++ b/internal/endtoend/testdata/multischema/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go b/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go index 3a26f2c45e..0743124580 100644 --- a/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/multischema/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/db.go b/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/models.go b/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/models.go new file mode 100644 index 0000000000..a058e12946 --- /dev/null +++ b/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "time" +) + +type Collection struct { + ID int64 + UpdatedAt time.Time +} diff --git a/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/query.sql.go new file mode 100644 index 0000000000..f23260b2b5 --- /dev/null +++ b/internal/endtoend/testdata/mysql_ddl_routines/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getCollection = `-- name: GetCollection :one +SELECT id, updated_at FROM collections WHERE id = ? +` + +func (q *Queries) GetCollection(ctx context.Context, id int64) (Collection, error) { + row := q.db.QueryRowContext(ctx, getCollection, id) + var i Collection + err := row.Scan(&i.ID, &i.UpdatedAt) + return i, err +} diff --git a/internal/endtoend/testdata/mysql_ddl_routines/mysql/query.sql b/internal/endtoend/testdata/mysql_ddl_routines/mysql/query.sql new file mode 100644 index 0000000000..f75433b05a --- /dev/null +++ b/internal/endtoend/testdata/mysql_ddl_routines/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: GetCollection :one +SELECT id, updated_at FROM collections WHERE id = ?; diff --git a/internal/endtoend/testdata/mysql_ddl_routines/mysql/schema.sql b/internal/endtoend/testdata/mysql_ddl_routines/mysql/schema.sql new file mode 100644 index 0000000000..3c614e5d81 --- /dev/null +++ b/internal/endtoend/testdata/mysql_ddl_routines/mysql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE collections ( + id BIGINT PRIMARY KEY, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TRIGGER update_timestamp_collections BEFORE UPDATE ON collections FOR EACH ROW SET NEW.updated_at = CURRENT_TIMESTAMP; + +CREATE FUNCTION uuidv4() RETURNS CHAR(36) NO SQL RETURN LOWER(HEX(RANDOM_BYTES(4))); + +CREATE PROCEDURE touch_collections() UPDATE collections SET updated_at = NOW(); + +CREATE EVENT clear_stale_collections ON SCHEDULE EVERY 1 HOUR DO DELETE FROM collections WHERE updated_at < CURRENT_TIMESTAMP - INTERVAL 30 DAY; diff --git a/internal/endtoend/testdata/mysql_ddl_routines/mysql/sqlc.json b/internal/endtoend/testdata/mysql_ddl_routines/mysql/sqlc.json new file mode 100644 index 0000000000..7dabfeef72 --- /dev/null +++ b/internal/endtoend/testdata/mysql_ddl_routines/mysql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/mysql_default_expression/mysql/go/db.go b/internal/endtoend/testdata/mysql_default_expression/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_expression/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mysql_default_expression/mysql/go/models.go b/internal/endtoend/testdata/mysql_default_expression/mysql/go/models.go new file mode 100644 index 0000000000..87f791764e --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_expression/mysql/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "time" +) + +type Expiration struct { + ID int32 + CreatedAt time.Time + Expiry time.Time +} diff --git a/internal/endtoend/testdata/mysql_default_expression/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_default_expression/mysql/go/query.sql.go new file mode 100644 index 0000000000..1f73628489 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_expression/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getExpiration = `-- name: GetExpiration :one +SELECT id, created_at, expiry FROM expirations WHERE id = ? +` + +func (q *Queries) GetExpiration(ctx context.Context, id int32) (Expiration, error) { + row := q.db.QueryRowContext(ctx, getExpiration, id) + var i Expiration + err := row.Scan(&i.ID, &i.CreatedAt, &i.Expiry) + return i, err +} diff --git a/internal/endtoend/testdata/mysql_default_expression/mysql/query.sql b/internal/endtoend/testdata/mysql_default_expression/mysql/query.sql new file mode 100644 index 0000000000..62e0acdc8a --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_expression/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: GetExpiration :one +SELECT id, created_at, expiry FROM expirations WHERE id = ?; diff --git a/internal/endtoend/testdata/mysql_default_expression/mysql/schema.sql b/internal/endtoend/testdata/mysql_default_expression/mysql/schema.sql new file mode 100644 index 0000000000..09a7a35418 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_expression/mysql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE expirations ( + id INT NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT (UTC_TIMESTAMP()), + expiry TIMESTAMP NOT NULL DEFAULT (CURRENT_TIMESTAMP + INTERVAL 30 DAY), + PRIMARY KEY (id) +); diff --git a/internal/endtoend/testdata/mysql_default_expression/mysql/sqlc.json b/internal/endtoend/testdata/mysql_default_expression/mysql/sqlc.json new file mode 100644 index 0000000000..7dabfeef72 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_expression/mysql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/go/db.go b/internal/endtoend/testdata/mysql_default_value/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/go/models.go b/internal/endtoend/testdata/mysql_default_value/mysql/go/models.go new file mode 100644 index 0000000000..9187e5439c --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/go/models.go @@ -0,0 +1,12 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Author struct { + ID int32 + Name string + Bio string + Explanation string +} diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go new file mode 100644 index 0000000000..5878a5a2e1 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/go/query.sql.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectAuthor = `-- name: SelectAuthor :many +SELECT id, name, bio, explanation FROM authors +` + +func (q *Queries) SelectAuthor(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, selectAuthor) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Explanation, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/query.sql b/internal/endtoend/testdata/mysql_default_value/mysql/query.sql new file mode 100644 index 0000000000..00b1f3c460 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: SelectAuthor :many +SELECT * FROM authors; diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/schema.sql b/internal/endtoend/testdata/mysql_default_value/mysql/schema.sql new file mode 100644 index 0000000000..be6634420d --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE authors ( + id INT PRIMARY KEY, + name text NOT NULL, + bio text NOT NULL +); + +ALTER TABLE authors ADD COLUMN explanation text NOT NULL DEFAULT (''); diff --git a/internal/endtoend/testdata/mysql_default_value/mysql/sqlc.json b/internal/endtoend/testdata/mysql_default_value/mysql/sqlc.json new file mode 100644 index 0000000000..7dabfeef72 --- /dev/null +++ b/internal/endtoend/testdata/mysql_default_value/mysql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/mysql_json_table/mysql/go/db.go b/internal/endtoend/testdata/mysql_json_table/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/mysql_json_table/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mysql_json_table/mysql/go/models.go b/internal/endtoend/testdata/mysql_json_table/mysql/go/models.go new file mode 100644 index 0000000000..2e9aaebfd9 --- /dev/null +++ b/internal/endtoend/testdata/mysql_json_table/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Person struct { + Emails string +} + +type PersonEmail struct { + Email string +} diff --git a/internal/endtoend/testdata/mysql_json_table/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_json_table/mysql/go/query.sql.go new file mode 100644 index 0000000000..1089efbbea --- /dev/null +++ b/internal/endtoend/testdata/mysql_json_table/mysql/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getEmails = `-- name: GetEmails :many +SELECT email FROM person_email +` + +func (q *Queries) GetEmails(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, getEmails) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var email string + if err := rows.Scan(&email); err != nil { + return nil, err + } + items = append(items, email) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/mysql_json_table/mysql/query.sql b/internal/endtoend/testdata/mysql_json_table/mysql/query.sql new file mode 100644 index 0000000000..8b22b5225a --- /dev/null +++ b/internal/endtoend/testdata/mysql_json_table/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: GetEmails :many +SELECT email FROM person_email; diff --git a/internal/endtoend/testdata/mysql_json_table/mysql/schema.sql b/internal/endtoend/testdata/mysql_json_table/mysql/schema.sql new file mode 100644 index 0000000000..7e4a730f32 --- /dev/null +++ b/internal/endtoend/testdata/mysql_json_table/mysql/schema.sql @@ -0,0 +1,12 @@ +CREATE TABLE person ( + emails TEXT NOT NULL +); + +CREATE TABLE person_email ( + email TEXT NOT NULL +); + +INSERT INTO person_email (`email`) + SELECT pe.email + FROM person AS p + JOIN JSON_TABLE(p.emails, '$[*]' COLUMNS(email TEXT PATH '$')) AS pe; diff --git a/internal/endtoend/testdata/mysql_json_table/mysql/sqlc.json b/internal/endtoend/testdata/mysql_json_table/mysql/sqlc.json new file mode 100644 index 0000000000..7dabfeef72 --- /dev/null +++ b/internal/endtoend/testdata/mysql_json_table/mysql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/db.go b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/models.go b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/models.go new file mode 100644 index 0000000000..b5395d46ed --- /dev/null +++ b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/query.sql.go new file mode 100644 index 0000000000..46febc1e16 --- /dev/null +++ b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const inlineHint = `-- name: InlineHint :one +SELECT /*+ MAX_EXECUTION_TIME(1000) */ bar FROM foo LIMIT 1 +` + +func (q *Queries) InlineHint(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, inlineHint) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} + +const multilineHint = `-- name: MultilineHint :one +SELECT +/*+ MAX_EXECUTION_TIME(1000) */ +bar +FROM foo +LIMIT 1 +` + +func (q *Queries) MultilineHint(ctx context.Context) (sql.NullString, error) { + row := q.db.QueryRowContext(ctx, multilineHint) + var bar sql.NullString + err := row.Scan(&bar) + return bar, err +} diff --git a/internal/endtoend/testdata/mysql_optimizer_hints/mysql/query.sql b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/query.sql new file mode 100644 index 0000000000..fa90093b66 --- /dev/null +++ b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/query.sql @@ -0,0 +1,9 @@ +-- name: InlineHint :one +SELECT /*+ MAX_EXECUTION_TIME(1000) */ bar FROM foo LIMIT 1; + +-- name: MultilineHint :one +SELECT +/*+ MAX_EXECUTION_TIME(1000) */ +bar +FROM foo +LIMIT 1; diff --git a/internal/endtoend/testdata/mysql_optimizer_hints/mysql/schema.sql b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/schema.sql new file mode 100644 index 0000000000..d849628fb1 --- /dev/null +++ b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (bar text); diff --git a/internal/endtoend/testdata/mysql_optimizer_hints/mysql/sqlc.json b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/mysql_optimizer_hints/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go index c115594430..60f0b8c6f2 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package aggregate_functions @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go index 3495f54675..d2e9e77ebc 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: group_concat.sql package aggregate_functions diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go index 56e88d9d8d..f253c94a2c 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package aggregate_functions @@ -10,5 +10,5 @@ import ( type Student struct { StudentName sql.NullString - Score sql.NullFloat64 + TestScore sql.NullFloat64 } diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql index f1858e42fd..443253851d 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/group_concat.sql @@ -1,8 +1,3 @@ -CREATE TABLE student ( - student_name VARCHAR(255), - score DOUBLE -); - -- name: GroupConcat :many SELECT student_name, GROUP_CONCAT(test_score) FROM student diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go index 9596528638..4c1bbdac2f 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_add.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: date_add.sql package date_and_time_functions diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go index 154d157277..66f91de495 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/date_sub.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: date_sub.sql package date_and_time_functions diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go index 3e306e6605..b9a9f5da54 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package date_and_time_functions @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go index 6ad4972129..7080494f1a 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go +++ b/internal/endtoend/testdata/mysql_reference_manual/date_and_time_functions/go/models.go @@ -1,7 +1,14 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package date_and_time_functions -import () +import ( + "database/sql" +) + +type Student struct { + StudentName sql.NullString + TestScore sql.NullFloat64 +} diff --git a/internal/endtoend/testdata/mysql_reference_manual/schema.sql b/internal/endtoend/testdata/mysql_reference_manual/schema.sql new file mode 100644 index 0000000000..5dcef48427 --- /dev/null +++ b/internal/endtoend/testdata/mysql_reference_manual/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE student ( + student_name VARCHAR(255), + test_score DOUBLE +); diff --git a/internal/endtoend/testdata/mysql_reference_manual/sqlc.json b/internal/endtoend/testdata/mysql_reference_manual/sqlc.json index 26e8643999..71c8ff5aa8 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/sqlc.json +++ b/internal/endtoend/testdata/mysql_reference_manual/sqlc.json @@ -4,14 +4,14 @@ { "name": "date_and_time_functions", "path": "date_and_time_functions/go", - "schema": "date_and_time_functions", + "schema": "schema.sql", "queries": "date_and_time_functions", "engine": "mysql" }, { "name": "aggregate_functions", "path": "aggregate_functions/go", - "schema": "aggregate_functions", + "schema": "schema.sql", "queries": "aggregate_functions", "engine": "mysql" } diff --git a/internal/endtoend/testdata/mysql_vector/mysql/go/db.go b/internal/endtoend/testdata/mysql_vector/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/mysql_vector/mysql/go/models.go b/internal/endtoend/testdata/mysql_vector/mysql/go/models.go new file mode 100644 index 0000000000..031c85d702 --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Foo struct { + ID int32 + Embedding any +} diff --git a/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go b/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go new file mode 100644 index 0000000000..4c6e880c7e --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const insertVector = `-- name: InsertVector :exec +INSERT INTO foo(embedding) VALUES (STRING_TO_VECTOR('[0.1, 0.2, 0.3, 0.4]')) +` + +func (q *Queries) InsertVector(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, insertVector) + return err +} + +const selectVector = `-- name: SelectVector :many +SELECT id FROM foo +ORDER BY DISTANCE(STRING_TO_VECTOR('[1.2, 3.4, 5.6]'), embedding, 'L2_squared') +LIMIT 10 +` + +func (q *Queries) SelectVector(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, selectVector) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var id int32 + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/mysql_vector/mysql/query.sql b/internal/endtoend/testdata/mysql_vector/mysql/query.sql new file mode 100644 index 0000000000..358d69129f --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/query.sql @@ -0,0 +1,7 @@ +-- name: InsertVector :exec +INSERT INTO foo(embedding) VALUES (STRING_TO_VECTOR('[0.1, 0.2, 0.3, 0.4]')); + +-- name: SelectVector :many +SELECT id FROM foo +ORDER BY DISTANCE(STRING_TO_VECTOR('[1.2, 3.4, 5.6]'), embedding, 'L2_squared') +LIMIT 10; diff --git a/internal/endtoend/testdata/mysql_vector/mysql/schema.sql b/internal/endtoend/testdata/mysql_vector/mysql/schema.sql new file mode 100644 index 0000000000..da61ac5682 --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE foo( + id INT PRIMARY KEY auto_increment, + embedding VECTOR(4) +); diff --git a/internal/endtoend/testdata/mysql_vector/mysql/sqlc.json b/internal/endtoend/testdata/mysql_vector/mysql/sqlc.json new file mode 100644 index 0000000000..7dabfeef72 --- /dev/null +++ b/internal/endtoend/testdata/mysql_vector/mysql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "sql_package": "database/sql", + "sql_driver": "github.com/go-sql-driver/mysql", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/named_param/pgx/v4/go/db.go b/internal/endtoend/testdata/named_param/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/named_param/pgx/v4/go/models.go b/internal/endtoend/testdata/named_param/pgx/v4/go/models.go index b6afd48cfd..34d5646f99 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Bio string diff --git a/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go index ca87cb1886..6bdbc78eba 100644 --- a/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/named_param/pgx/v5/go/db.go b/internal/endtoend/testdata/named_param/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/named_param/pgx/v5/go/models.go b/internal/endtoend/testdata/named_param/pgx/v5/go/models.go index b6afd48cfd..34d5646f99 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Bio string diff --git a/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go index ca87cb1886..6bdbc78eba 100644 --- a/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/named_param/sqlite/go/db.go b/internal/endtoend/testdata/named_param/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/named_param/sqlite/go/db.go +++ b/internal/endtoend/testdata/named_param/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/named_param/sqlite/go/models.go b/internal/endtoend/testdata/named_param/sqlite/go/models.go index b6afd48cfd..34d5646f99 100644 --- a/internal/endtoend/testdata/named_param/sqlite/go/models.go +++ b/internal/endtoend/testdata/named_param/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Bio string diff --git a/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go b/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go index 4201e60618..625e79abdc 100644 --- a/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/named_param/stdlib/go/db.go b/internal/endtoend/testdata/named_param/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/named_param/stdlib/go/db.go +++ b/internal/endtoend/testdata/named_param/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/named_param/stdlib/go/models.go b/internal/endtoend/testdata/named_param/stdlib/go/models.go index b6afd48cfd..34d5646f99 100644 --- a/internal/endtoend/testdata/named_param/stdlib/go/models.go +++ b/internal/endtoend/testdata/named_param/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Bio string diff --git a/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go b/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go index 32b8b14611..017f5be962 100644 --- a/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/named_param/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go index 3cb0ee9c81..e114430818 100644 --- a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Test struct { ID int64 UpdateTime int64 diff --git a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go index 2a46b8800d..19e1864a4a 100644 --- a/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/nested_select/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/nextval/postgresql/go/db.go b/internal/endtoend/testdata/nextval/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/nextval/postgresql/go/db.go +++ b/internal/endtoend/testdata/nextval/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/nextval/postgresql/go/models.go b/internal/endtoend/testdata/nextval/postgresql/go/models.go index 7f98a929b3..b5763f0977 100644 --- a/internal/endtoend/testdata/nextval/postgresql/go/models.go +++ b/internal/endtoend/testdata/nextval/postgresql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Author struct { ID int64 } diff --git a/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go b/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go index d2e95f955a..d6c7e29f48 100644 --- a/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/nextval/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go index b813bcaec4..28ee1f135e 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/db.go b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/db.go +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go index e3c353f521..e0aedd959b 100644 --- a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db -import () - type Author struct { ID int64 } diff --git a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go index 62a6229d99..c10fa3470f 100644 --- a/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go +++ b/internal/endtoend/testdata/null_if_type/postgresql/pganalyzer/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/db.go b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/db.go +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go index e3c353f521..e0aedd959b 100644 --- a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db -import () - type Author struct { ID int64 } diff --git a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go index 0c377bcb16..46ab5047eb 100644 --- a/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go +++ b/internal/endtoend/testdata/null_if_type/postgresql/stdlib/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/omit_sqlc_version/db/db.go b/internal/endtoend/testdata/omit_sqlc_version/db/db.go new file mode 100644 index 0000000000..e19c06c30e --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/db/db.go @@ -0,0 +1,29 @@ +// Code generated by sqlc. DO NOT EDIT. + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/omit_sqlc_version/db/models.go b/internal/endtoend/testdata/omit_sqlc_version/db/models.go new file mode 100644 index 0000000000..3bc48237ef --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go b/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go new file mode 100644 index 0000000000..147cb4b15c --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/db/query.sql.go @@ -0,0 +1,80 @@ +// Code generated by sqlc. DO NOT EDIT. +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/omit_sqlc_version/query.sql b/internal/endtoend/testdata/omit_sqlc_version/query.sql new file mode 100644 index 0000000000..971b8f902d --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/omit_sqlc_version/schema.sql b/internal/endtoend/testdata/omit_sqlc_version/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/omit_sqlc_version/sqlc.json b/internal/endtoend/testdata/omit_sqlc_version/sqlc.json new file mode 100644 index 0000000000..f86d2b7b9d --- /dev/null +++ b/internal/endtoend/testdata/omit_sqlc_version/sqlc.json @@ -0,0 +1,15 @@ +{ + "version": "2", + "sql": [{ + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "omit_sqlc_version": true + } + } + }] +} + diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go index b1624997b9..a1d466f29c 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -9,6 +9,48 @@ import ( "fmt" ) +type ArrayEnum string + +const ( + ArrayEnumO ArrayEnum = "o" + ArrayEnumP ArrayEnum = "p" +) + +func (e *ArrayEnum) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = ArrayEnum(s) + case string: + *e = ArrayEnum(s) + default: + return fmt.Errorf("unsupported scan type for ArrayEnum: %T", src) + } + return nil +} + +type NullArrayEnum struct { + ArrayEnum ArrayEnum + Valid bool // Valid is true if ArrayEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullArrayEnum) Scan(value any) error { + if value == nil { + ns.ArrayEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.ArrayEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullArrayEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.ArrayEnum), nil +} + type QueryParamEnumTableEnum string const ( @@ -16,7 +58,7 @@ const ( QueryParamEnumTableEnumH QueryParamEnumTableEnum = "h" ) -func (e *QueryParamEnumTableEnum) Scan(src interface{}) error { +func (e *QueryParamEnumTableEnum) Scan(src any) error { switch s := src.(type) { case []byte: *e = QueryParamEnumTableEnum(s) @@ -34,7 +76,7 @@ type NullQueryParamEnumTableEnum struct { } // Scan implements the Scanner interface. -func (ns *NullQueryParamEnumTableEnum) Scan(value interface{}) error { +func (ns *NullQueryParamEnumTableEnum) Scan(value any) error { if value == nil { ns.QueryParamEnumTableEnum, ns.Valid = "", false return nil @@ -58,7 +100,7 @@ const ( QueryParamStructEnumTableEnumJ QueryParamStructEnumTableEnum = "j" ) -func (e *QueryParamStructEnumTableEnum) Scan(src interface{}) error { +func (e *QueryParamStructEnumTableEnum) Scan(src any) error { switch s := src.(type) { case []byte: *e = QueryParamStructEnumTableEnum(s) @@ -76,7 +118,7 @@ type NullQueryParamStructEnumTableEnum struct { } // Scan implements the Scanner interface. -func (ns *NullQueryParamStructEnumTableEnum) Scan(value interface{}) error { +func (ns *NullQueryParamStructEnumTableEnum) Scan(value any) error { if value == nil { ns.QueryParamStructEnumTableEnum, ns.Valid = "", false return nil @@ -100,7 +142,7 @@ const ( QueryReturnEnumTableEnumL QueryReturnEnumTableEnum = "l" ) -func (e *QueryReturnEnumTableEnum) Scan(src interface{}) error { +func (e *QueryReturnEnumTableEnum) Scan(src any) error { switch s := src.(type) { case []byte: *e = QueryReturnEnumTableEnum(s) @@ -118,7 +160,7 @@ type NullQueryReturnEnumTableEnum struct { } // Scan implements the Scanner interface. -func (ns *NullQueryReturnEnumTableEnum) Scan(value interface{}) error { +func (ns *NullQueryReturnEnumTableEnum) Scan(value any) error { if value == nil { ns.QueryReturnEnumTableEnum, ns.Valid = "", false return nil @@ -142,7 +184,7 @@ const ( QueryReturnFullTableEnumF QueryReturnFullTableEnum = "f" ) -func (e *QueryReturnFullTableEnum) Scan(src interface{}) error { +func (e *QueryReturnFullTableEnum) Scan(src any) error { switch s := src.(type) { case []byte: *e = QueryReturnFullTableEnum(s) @@ -160,7 +202,7 @@ type NullQueryReturnFullTableEnum struct { } // Scan implements the Scanner interface. -func (ns *NullQueryReturnFullTableEnum) Scan(value interface{}) error { +func (ns *NullQueryReturnFullTableEnum) Scan(value any) error { if value == nil { ns.QueryReturnFullTableEnum, ns.Valid = "", false return nil @@ -184,7 +226,7 @@ const ( QueryReturnStructEnumTableEnumL QueryReturnStructEnumTableEnum = "l" ) -func (e *QueryReturnStructEnumTableEnum) Scan(src interface{}) error { +func (e *QueryReturnStructEnumTableEnum) Scan(src any) error { switch s := src.(type) { case []byte: *e = QueryReturnStructEnumTableEnum(s) @@ -202,7 +244,7 @@ type NullQueryReturnStructEnumTableEnum struct { } // Scan implements the Scanner interface. -func (ns *NullQueryReturnStructEnumTableEnum) Scan(value interface{}) error { +func (ns *NullQueryReturnStructEnumTableEnum) Scan(value any) error { if value == nil { ns.QueryReturnStructEnumTableEnum, ns.Valid = "", false return nil @@ -219,6 +261,53 @@ func (ns NullQueryReturnStructEnumTableEnum) Value() (driver.Value, error) { return string(ns.QueryReturnStructEnumTableEnum), nil } +type QuerySqlcEmbedEnum string + +const ( + QuerySqlcEmbedEnumM QuerySqlcEmbedEnum = "m" + QuerySqlcEmbedEnumN QuerySqlcEmbedEnum = "n" +) + +func (e *QuerySqlcEmbedEnum) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = QuerySqlcEmbedEnum(s) + case string: + *e = QuerySqlcEmbedEnum(s) + default: + return fmt.Errorf("unsupported scan type for QuerySqlcEmbedEnum: %T", src) + } + return nil +} + +type NullQuerySqlcEmbedEnum struct { + QuerySqlcEmbedEnum QuerySqlcEmbedEnum + Valid bool // Valid is true if QuerySqlcEmbedEnum is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullQuerySqlcEmbedEnum) Scan(value any) error { + if value == nil { + ns.QuerySqlcEmbedEnum, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.QuerySqlcEmbedEnum.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullQuerySqlcEmbedEnum) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.QuerySqlcEmbedEnum), nil +} + +type ArrayEnumTable struct { + ID int32 + Value []ArrayEnum +} + type QueryParamEnumTable struct { ID int32 Other QueryParamEnumTableEnum @@ -229,3 +318,8 @@ type QueryReturnFullTable struct { ID int32 Value NullQueryReturnFullTableEnum } + +type QuerySqlcEmbedTable struct { + ID int32 + Value NullQuerySqlcEmbedEnum +} diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go index f659102696..91b4cefcff 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db @@ -8,8 +8,37 @@ package db import ( "context" "database/sql" + + "github.com/lib/pq" ) +const query_enum_array_table = `-- name: query_enum_array_table :many +SELECT id, value FROM array_enum_table +` + +func (q *Queries) query_enum_array_table(ctx context.Context) ([]ArrayEnumTable, error) { + rows, err := q.db.QueryContext(ctx, query_enum_array_table) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ArrayEnumTable + for rows.Next() { + var i ArrayEnumTable + if err := rows.Scan(&i.ID, pq.Array(&i.Value)); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const query_param_enum_table = `-- name: query_param_enum_table :one SELECT id, other, value FROM query_param_enum_table WHERE value = $1 ` @@ -90,3 +119,18 @@ func (q *Queries) query_return_struct_enum_table(ctx context.Context, id int32) err := row.Scan(&i.Value, &i.Another) return i, err } + +const query_sqlc_embed_table = `-- name: query_sqlc_embed_table :one +SELECT query_sqlc_embed_table.id, query_sqlc_embed_table.value FROM query_sqlc_embed_table WHERE id = $1 +` + +type query_sqlc_embed_tableRow struct { + QuerySqlcEmbedTable QuerySqlcEmbedTable +} + +func (q *Queries) query_sqlc_embed_table(ctx context.Context, id int32) (query_sqlc_embed_tableRow, error) { + row := q.db.QueryRowContext(ctx, query_sqlc_embed_table, id) + var i query_sqlc_embed_tableRow + err := row.Scan(&i.QuerySqlcEmbedTable.ID, &i.QuerySqlcEmbedTable.Value) + return i, err +} diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql index 1420d869d3..60104c8e9d 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/query.sql @@ -11,4 +11,10 @@ SELECT id FROM query_param_struct_enum_table WHERE id = $1 AND value = $2; SELECT value FROM query_return_enum_table WHERE id = $1; -- name: query_return_struct_enum_table :one -SELECT value, another FROM query_return_struct_enum_table WHERE id = $1; \ No newline at end of file +SELECT value, another FROM query_return_struct_enum_table WHERE id = $1; + +-- name: query_sqlc_embed_table :one +SELECT sqlc.embed(query_sqlc_embed_table) FROM query_sqlc_embed_table WHERE id = $1; + +-- name: query_enum_array_table :many +SELECT * FROM array_enum_table; diff --git a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql index cc2ae14b28..4ce59218b6 100644 --- a/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/omit_unused_structs/postgresql/stdlib/schema.sql @@ -50,4 +50,20 @@ CREATE TABLE query_return_struct_enum_table ( id INTEGER PRIMARY KEY, value query_return_struct_enum_table_enum, another INTEGER -); \ No newline at end of file +); + +CREATE TYPE query_sqlc_embed_enum AS ENUM ( + 'm', 'n' +); +CREATE TABLE query_sqlc_embed_table ( + id INTEGER PRIMARY KEY, + value query_sqlc_embed_enum +); + +CREATE TYPE array_enum AS ENUM ( + 'o', 'p' +); +CREATE TABLE array_enum_table ( + id INTEGER PRIMARY KEY, + value array_enum[] +); diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go index f8bcd76317..56c9d4a035 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go index 4400e71026..de3f8b4c44 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go index f8bcd76317..56c9d4a035 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go index d0daee3d01..cb3aa32467 100644 --- a/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/on_duplicate_key_update/postgresql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go index 20f64af83c..0ecbc7d1a4 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Demo struct { Txt string } diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go index 5225c21e02..7641d29b99 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go index 20f64af83c..0ecbc7d1a4 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Demo struct { Txt string } diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go index 5225c21e02..7641d29b99 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go index 20f64af83c..0ecbc7d1a4 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Demo struct { Txt string } diff --git a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go index 0b72579e02..624aeefb99 100644 --- a/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/operator_string_concat/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/order_by_binds/mysql/go/db.go b/internal/endtoend/testdata/order_by_binds/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/go/db.go +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/order_by_binds/mysql/go/models.go b/internal/endtoend/testdata/order_by_binds/mysql/go/models.go index 2727f2e2de..2208139112 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/go/models.go +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go index e1c28cfcc1..e135adee15 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_binds/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -17,7 +17,7 @@ ORDER BY CASE WHEN ? = 'name' THEN name END type ListAuthorsColumnSortParams struct { MinID int64 - SortColumn interface{} + SortColumn any } func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { @@ -43,6 +43,34 @@ func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColu return items, nil } +const listAuthorsColumnSortFnWtihArg = `-- name: ListAuthorsColumnSortFnWtihArg :many +SELECT id, name, bio FROM authors +ORDER BY MOD(id, ?) +` + +func (q *Queries) ListAuthorsColumnSortFnWtihArg(ctx context.Context, modArg int64) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortFnWtihArg, modArg) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listAuthorsNameSort = `-- name: ListAuthorsNameSort :many SELECT id, name, bio FROM authors WHERE id > ? diff --git a/internal/endtoend/testdata/order_by_binds/mysql/query.sql b/internal/endtoend/testdata/order_by_binds/mysql/query.sql index e662d8f06a..c43763c838 100644 --- a/internal/endtoend/testdata/order_by_binds/mysql/query.sql +++ b/internal/endtoend/testdata/order_by_binds/mysql/query.sql @@ -3,6 +3,10 @@ SELECT * FROM authors WHERE id > sqlc.arg(min_id) ORDER BY CASE WHEN sqlc.arg(sort_column) = 'name' THEN name END; +-- name: ListAuthorsColumnSortFnWtihArg :many +SELECT * FROM authors +ORDER BY MOD(id, sqlc.arg(mod_arg)); + -- name: ListAuthorsNameSort :many SELECT * FROM authors WHERE id > sqlc.arg(min_id) diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go index 2727f2e2de..2208139112 100644 --- a/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go index f3d1c12b6c..01b9d2f52f 100644 --- a/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_binds/pganalyze/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go index 2727f2e2de..2208139112 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go b/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go index 1ada686e4b..317e548090 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_binds/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -17,7 +17,7 @@ ORDER BY CASE WHEN $2 = 'name' THEN name END type ListAuthorsColumnSortParams struct { MinID int64 - SortColumn interface{} + SortColumn any } func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColumnSortParams) ([]Author, error) { @@ -43,6 +43,34 @@ func (q *Queries) ListAuthorsColumnSort(ctx context.Context, arg ListAuthorsColu return items, nil } +const listAuthorsColumnSortFnWtihArg = `-- name: ListAuthorsColumnSortFnWtihArg :many +SELECT id, name, bio FROM authors +ORDER BY MOD(id, $1) +` + +func (q *Queries) ListAuthorsColumnSortFnWtihArg(ctx context.Context, mod int64) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsColumnSortFnWtihArg, mod) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listAuthorsNameSort = `-- name: ListAuthorsNameSort :many SELECT id, name, bio FROM authors WHERE id > $1 diff --git a/internal/endtoend/testdata/order_by_binds/postgresql/query.sql b/internal/endtoend/testdata/order_by_binds/postgresql/query.sql index e662d8f06a..961d3f4e71 100644 --- a/internal/endtoend/testdata/order_by_binds/postgresql/query.sql +++ b/internal/endtoend/testdata/order_by_binds/postgresql/query.sql @@ -3,6 +3,10 @@ SELECT * FROM authors WHERE id > sqlc.arg(min_id) ORDER BY CASE WHEN sqlc.arg(sort_column) = 'name' THEN name END; +-- name: ListAuthorsColumnSortFnWtihArg :many +SELECT * FROM authors +ORDER BY MOD(id, $1); + -- name: ListAuthorsNameSort :many SELECT * FROM authors WHERE id > sqlc.arg(min_id) diff --git a/internal/endtoend/testdata/order_by_union/mysql/go/db.go b/internal/endtoend/testdata/order_by_union/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/go/db.go +++ b/internal/endtoend/testdata/order_by_union/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/order_by_union/mysql/go/models.go b/internal/endtoend/testdata/order_by_union/mysql/go/models.go index 25aeaacd9f..7b5042d877 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/go/models.go +++ b/internal/endtoend/testdata/order_by_union/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go b/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go index 9d8991e2a2..be47780e78 100644 --- a/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_union/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/order_by_union/postgresql/go/db.go b/internal/endtoend/testdata/order_by_union/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/go/db.go +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/order_by_union/postgresql/go/models.go b/internal/endtoend/testdata/order_by_union/postgresql/go/models.go index 04a70b0742..c5a0170cd3 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/go/models.go +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go b/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go index 9d8991e2a2..be47780e78 100644 --- a/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/order_by_union/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go index 16dd2320b6..81bdf96b3f 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/batch_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch_gen.go package querytest @@ -30,7 +30,7 @@ type UsersBBatchResults struct { func (q *Queries) UsersB(ctx context.Context, id []int64) *UsersBBatchResults { batch := &pgx.Batch{} for _, a := range id { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(usersB, vals...) diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go index 642676f121..672ccfd71b 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom_gen.go package querytest @@ -27,8 +27,8 @@ func (r *iteratorForUsersC) Next() bool { return len(r.rows) > 0 } -func (r iteratorForUsersC) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForUsersC) Values() ([]any, error) { + return []any{ r.rows[0], }, nil } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go index fad32942f0..a331016529 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/db_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/models_gen.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go index f79dba674d..287259c62a 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/querier_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go index 62426551e5..34274a0f9d 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go index 564d39b7eb..569eee29c8 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/batch_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: batch_gen.go package querytest @@ -30,7 +30,7 @@ type UsersBBatchResults struct { func (q *Queries) UsersB(ctx context.Context, id []int64) *UsersBBatchResults { batch := &pgx.Batch{} for _, a := range id { - vals := []interface{}{ + vals := []any{ a, } batch.Queue(usersB, vals...) diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go index 642676f121..672ccfd71b 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: copyfrom_gen.go package querytest @@ -27,8 +27,8 @@ func (r *iteratorForUsersC) Next() bool { return len(r.rows) > 0 } -func (r iteratorForUsersC) Values() ([]interface{}, error) { - return []interface{}{ +func (r iteratorForUsersC) Values() ([]any, error) { + return []any{ r.rows[0], }, nil } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go index 253ff84386..185bd2aafc 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/db_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/models_gen.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go index f79dba674d..287259c62a 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/querier_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go index 62426551e5..34274a0f9d 100644 --- a/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go b/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/db_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go b/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/models_gen.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go b/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go index ce593aa9d2..e1caa4f1fa 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/querier_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go b/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go index 2f0d4de7a8..7cd0ecd450 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/output_file_names/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go index 62426551e5..34274a0f9d 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v4/go/query.sql_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go index 62426551e5..34274a0f9d 100644 --- a/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/pgx/v5/go/query.sql_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go b/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go index 2f0d4de7a8..7cd0ecd450 100644 --- a/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go +++ b/internal/endtoend/testdata/output_files_suffix/stdlib/go/query.sql_gen.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/output_models_path/postgresql/db/db.go b/internal/endtoend/testdata/output_models_path/postgresql/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/output_models_path/postgresql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/output_models_path/postgresql/db/querier.go b/internal/endtoend/testdata/output_models_path/postgresql/db/querier.go new file mode 100644 index 0000000000..18d562cd69 --- /dev/null +++ b/internal/endtoend/testdata/output_models_path/postgresql/db/querier.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + + models "github.com/sqlc-dev/sqlc/endtoend/output_models_path/postgresql/model" +) + +type Querier interface { + CreateAuthor(ctx context.Context, arg CreateAuthorParams) (models.Author, error) + GetAuthor(ctx context.Context, id int64) (models.Author, error) + GetBook(ctx context.Context, id int64) (models.Book, error) + ListAuthors(ctx context.Context) ([]models.Author, error) + ListAuthorsByStatus(ctx context.Context, status models.Status) ([]models.Author, error) +} + +var _ Querier = (*Queries)(nil) diff --git a/internal/endtoend/testdata/output_models_path/postgresql/db/query.sql.go b/internal/endtoend/testdata/output_models_path/postgresql/db/query.sql.go new file mode 100644 index 0000000000..2e2561375c --- /dev/null +++ b/internal/endtoend/testdata/output_models_path/postgresql/db/query.sql.go @@ -0,0 +1,126 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" + "database/sql" + + models "github.com/sqlc-dev/sqlc/endtoend/output_models_path/postgresql/model" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors (name, bio, status) VALUES ($1, $2, $3) RETURNING id, name, bio, status +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString + Status models.Status +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (models.Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio, arg.Status) + var i models.Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Status, + ) + return i, err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio, status FROM authors WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (models.Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i models.Author + err := row.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Status, + ) + return i, err +} + +const getBook = `-- name: GetBook :one +SELECT id, author_id, title FROM books WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetBook(ctx context.Context, id int64) (models.Book, error) { + row := q.db.QueryRowContext(ctx, getBook, id) + var i models.Book + err := row.Scan(&i.ID, &i.AuthorID, &i.Title) + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio, status FROM authors ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]models.Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []models.Author + for rows.Next() { + var i models.Author + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Status, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listAuthorsByStatus = `-- name: ListAuthorsByStatus :many +SELECT id, name, bio, status FROM authors WHERE status = $1 ORDER BY name +` + +func (q *Queries) ListAuthorsByStatus(ctx context.Context, status models.Status) ([]models.Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsByStatus, status) + if err != nil { + return nil, err + } + defer rows.Close() + var items []models.Author + for rows.Next() { + var i models.Author + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Bio, + &i.Status, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/output_models_path/postgresql/model/models.go b/internal/endtoend/testdata/output_models_path/postgresql/model/models.go new file mode 100644 index 0000000000..82fc33d8ef --- /dev/null +++ b/internal/endtoend/testdata/output_models_path/postgresql/model/models.go @@ -0,0 +1,67 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package model + +import ( + "database/sql" + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusActive Status = "active" + StatusInactive Status = "inactive" + StatusPending Status = "pending" +) + +func (e *Status) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = Status(s) + case string: + *e = Status(s) + default: + return fmt.Errorf("unsupported scan type for Status: %T", src) + } + return nil +} + +type NullStatus struct { + Status Status + Valid bool // Valid is true if Status is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullStatus) Scan(value any) error { + if value == nil { + ns.Status, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Status.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullStatus) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Status), nil +} + +type Author struct { + ID int64 + Name string + Bio sql.NullString + Status Status +} + +type Book struct { + ID int64 + AuthorID int64 + Title string +} diff --git a/internal/endtoend/testdata/output_models_path/postgresql/query.sql b/internal/endtoend/testdata/output_models_path/postgresql/query.sql new file mode 100644 index 0000000000..5c7c377ab8 --- /dev/null +++ b/internal/endtoend/testdata/output_models_path/postgresql/query.sql @@ -0,0 +1,14 @@ +-- name: GetAuthor :one +SELECT * FROM authors WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors (name, bio, status) VALUES ($1, $2, $3) RETURNING *; + +-- name: ListAuthorsByStatus :many +SELECT * FROM authors WHERE status = $1 ORDER BY name; + +-- name: GetBook :one +SELECT * FROM books WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/output_models_path/postgresql/schema.sql b/internal/endtoend/testdata/output_models_path/postgresql/schema.sql new file mode 100644 index 0000000000..2d85828249 --- /dev/null +++ b/internal/endtoend/testdata/output_models_path/postgresql/schema.sql @@ -0,0 +1,14 @@ +CREATE TYPE status AS ENUM ('active', 'inactive', 'pending'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + status status NOT NULL DEFAULT 'active' +); + +CREATE TABLE books ( + id BIGSERIAL PRIMARY KEY, + author_id BIGINT NOT NULL REFERENCES authors(id), + title text NOT NULL +); diff --git a/internal/endtoend/testdata/output_models_path/postgresql/sqlc.json b/internal/endtoend/testdata/output_models_path/postgresql/sqlc.json new file mode 100644 index 0000000000..9fa8540070 --- /dev/null +++ b/internal/endtoend/testdata/output_models_path/postgresql/sqlc.json @@ -0,0 +1,19 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "gen": { + "go": { + "out": "db", + "package": "db", + "emit_interface": true, + "output_models_path": "model", + "output_models_import": "github.com/sqlc-dev/sqlc/endtoend/output_models_path/postgresql/model" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/model/models.go b/internal/endtoend/testdata/output_models_shared/postgresql/model/models.go new file mode 100644 index 0000000000..ac322bdf7a --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/model/models.go @@ -0,0 +1,58 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package model + +import ( + "database/sql/driver" + "fmt" +) + +type Status string + +const ( + StatusActive Status = "active" + StatusInactive Status = "inactive" +) + +func (e *Status) Scan(src any) error { + switch s := src.(type) { + case []byte: + *e = Status(s) + case string: + *e = Status(s) + default: + return fmt.Errorf("unsupported scan type for Status: %T", src) + } + return nil +} + +type NullStatus struct { + Status Status + Valid bool // Valid is true if Status is not NULL +} + +// Scan implements the Scanner interface. +func (ns *NullStatus) Scan(value any) error { + if value == nil { + ns.Status, ns.Valid = "", false + return nil + } + ns.Valid = true + return ns.Status.Scan(value) +} + +// Value implements the driver Valuer interface. +func (ns NullStatus) Value() (driver.Value, error) { + if !ns.Valid { + return nil, nil + } + return string(ns.Status), nil +} + +type Author struct { + ID int64 + Name string + Status Status +} diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/primary/db.go b/internal/endtoend/testdata/output_models_shared/postgresql/primary/db.go new file mode 100644 index 0000000000..19e576d0d4 --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/primary/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package primary + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/primary/query.sql.go b/internal/endtoend/testdata/output_models_shared/postgresql/primary/query.sql.go new file mode 100644 index 0000000000..555d40522e --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/primary/query.sql.go @@ -0,0 +1,39 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package primary + +import ( + "context" + + models "github.com/sqlc-dev/sqlc/endtoend/output_models_shared/postgresql/model" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors (name, status) VALUES ($1, $2) RETURNING id, name, status +` + +type CreateAuthorParams struct { + Name string + Status models.Status +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (models.Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Status) + var i models.Author + err := row.Scan(&i.ID, &i.Name, &i.Status) + return i, err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, status FROM authors WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (models.Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i models.Author + err := row.Scan(&i.ID, &i.Name, &i.Status) + return i, err +} diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/queries/primary/query.sql b/internal/endtoend/testdata/output_models_shared/postgresql/queries/primary/query.sql new file mode 100644 index 0000000000..b8646b5533 --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/queries/primary/query.sql @@ -0,0 +1,5 @@ +-- name: CreateAuthor :one +INSERT INTO authors (name, status) VALUES ($1, $2) RETURNING *; + +-- name: GetAuthor :one +SELECT * FROM authors WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/queries/replica/query.sql b/internal/endtoend/testdata/output_models_shared/postgresql/queries/replica/query.sql new file mode 100644 index 0000000000..b533fea924 --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/queries/replica/query.sql @@ -0,0 +1,5 @@ +-- name: ListAuthors :many +SELECT * FROM authors ORDER BY name; + +-- name: ListAuthorsByStatus :many +SELECT * FROM authors WHERE status = $1 ORDER BY name; diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/replica/db.go b/internal/endtoend/testdata/output_models_shared/postgresql/replica/db.go new file mode 100644 index 0000000000..3e0b2c2588 --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/replica/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package replica + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/replica/query.sql.go b/internal/endtoend/testdata/output_models_shared/postgresql/replica/query.sql.go new file mode 100644 index 0000000000..4831f5cd0a --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/replica/query.sql.go @@ -0,0 +1,66 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package replica + +import ( + "context" + + models "github.com/sqlc-dev/sqlc/endtoend/output_models_shared/postgresql/model" +) + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, status FROM authors ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]models.Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, err + } + defer rows.Close() + var items []models.Author + for rows.Next() { + var i models.Author + if err := rows.Scan(&i.ID, &i.Name, &i.Status); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listAuthorsByStatus = `-- name: ListAuthorsByStatus :many +SELECT id, name, status FROM authors WHERE status = $1 ORDER BY name +` + +func (q *Queries) ListAuthorsByStatus(ctx context.Context, status models.Status) ([]models.Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthorsByStatus, status) + if err != nil { + return nil, err + } + defer rows.Close() + var items []models.Author + for rows.Next() { + var i models.Author + if err := rows.Scan(&i.ID, &i.Name, &i.Status); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/schema.sql b/internal/endtoend/testdata/output_models_shared/postgresql/schema.sql new file mode 100644 index 0000000000..afb9a4e68e --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/schema.sql @@ -0,0 +1,7 @@ +CREATE TYPE status AS ENUM ('active', 'inactive'); + +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + status status NOT NULL DEFAULT 'active' +); diff --git a/internal/endtoend/testdata/output_models_shared/postgresql/sqlc.json b/internal/endtoend/testdata/output_models_shared/postgresql/sqlc.json new file mode 100644 index 0000000000..98d60f8f5e --- /dev/null +++ b/internal/endtoend/testdata/output_models_shared/postgresql/sqlc.json @@ -0,0 +1,31 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "queries/primary", + "engine": "postgresql", + "gen": { + "go": { + "out": "primary", + "package": "primary", + "output_models_path": "model", + "output_models_import": "github.com/sqlc-dev/sqlc/endtoend/output_models_shared/postgresql/model" + } + } + }, + { + "schema": "schema.sql", + "queries": "queries/replica", + "engine": "postgresql", + "gen": { + "go": { + "out": "replica", + "package": "replica", + "output_models_import": "github.com/sqlc-dev/sqlc/endtoend/output_models_shared/postgresql/model", + "output_models_emit": false + } + } + } + ] +} diff --git a/internal/endtoend/testdata/overrides/mysql/go/db.go b/internal/endtoend/testdata/overrides/mysql/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides/mysql/go/models.go b/internal/endtoend/testdata/overrides/mysql/go/models.go index 21a1a3308e..b538582471 100644 --- a/internal/endtoend/testdata/overrides/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides/mysql/go/query.sql.go new file mode 100644 index 0000000000..0a94a438a6 --- /dev/null +++ b/internal/endtoend/testdata/overrides/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/mysql/query.sql b/internal/endtoend/testdata/overrides/mysql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/mysql/query.sql +++ b/internal/endtoend/testdata/overrides/mysql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go index c6dbb043e5..6e1aea1a4b 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go index fa5a1ad177..94d18783ff 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..422e04ae9b --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v4/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go index 289d779ef2..9b9f9eea8e 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go index fa5a1ad177..94d18783ff 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..422e04ae9b --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/overrides/postgresql/pgx/v5/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go index fa5a1ad177..94d18783ff 100644 --- a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..0a94a438a6 --- /dev/null +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides/postgresql/stdlib/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides/sqlite/go/db.go b/internal/endtoend/testdata/overrides/sqlite/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides/sqlite/go/db.go +++ b/internal/endtoend/testdata/overrides/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides/sqlite/go/models.go b/internal/endtoend/testdata/overrides/sqlite/go/models.go index 21a1a3308e..b538582471 100644 --- a/internal/endtoend/testdata/overrides/sqlite/go/models.go +++ b/internal/endtoend/testdata/overrides/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go new file mode 100644 index 0000000000..185ff73624 --- /dev/null +++ b/internal/endtoend/testdata/overrides/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides/sqlite/query.sql b/internal/endtoend/testdata/overrides/sqlite/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides/sqlite/query.sql +++ b/internal/endtoend/testdata/overrides/sqlite/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go index 6b3149f60d..5bda2876b1 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package query @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go index d2207cc18b..d7e10e5f44 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go index 8b6a127076..b054454d7c 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v4/query/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go index f5f6c7e86c..f7cf1a6fe6 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package query @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go index e686b704d2..1358922c1c 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go index 8b6a127076..b054454d7c 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/pgx/v5/query/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go index a89f3caa23..095a0a73e3 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package query @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go index d2207cc18b..d7e10e5f44 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package query diff --git a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go index 1df07bcdcf..d86dd18966 100644 --- a/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go +++ b/internal/endtoend/testdata/overrides_array/postgresql/stdlib/query/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package query diff --git a/internal/endtoend/testdata/overrides_config/query.sql b/internal/endtoend/testdata/overrides_config/query.sql new file mode 100644 index 0000000000..9da604b57e --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/query.sql @@ -0,0 +1,2 @@ +-- name: Test :one +SELECT 1; diff --git a/internal/endtoend/testdata/overrides_config/schema.sql b/internal/endtoend/testdata/overrides_config/schema.sql new file mode 100644 index 0000000000..03d90e1cec --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE overrides ( + one text NOT NULL, + two bigint NOT NULL, + three text[] NOT NULL, + four bytea NOT NULL, + five text[] +); diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go new file mode 100644 index 0000000000..261e14b5a3 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go new file mode 100644 index 0000000000..5b09ecbea4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml new file mode 100644 index 0000000000..335759cfd2 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml @@ -0,0 +1,19 @@ +version: "2" +overrides: + go: + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go new file mode 100644 index 0000000000..261e14b5a3 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go new file mode 100644 index 0000000000..5b09ecbea4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml new file mode 100644 index 0000000000..62ef7e7772 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml @@ -0,0 +1,26 @@ +version: "2" +overrides: + go: + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" + rename: + one: "ONE" + overrides: + - column: "overrides.three" + go_type: + import: "invalid/import" + type: "ShouldNotSeeThis" diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go new file mode 100644 index 0000000000..261e14b5a3 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go new file mode 100644 index 0000000000..5b09ecbea4 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml new file mode 100644 index 0000000000..7847f6d08d --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml @@ -0,0 +1,17 @@ +version: "2" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" diff --git a/internal/endtoend/testdata/overrides_decimal_package/decimal/decimal.go b/internal/endtoend/testdata/overrides_decimal_package/decimal/decimal.go new file mode 100644 index 0000000000..1006fda8bb --- /dev/null +++ b/internal/endtoend/testdata/overrides_decimal_package/decimal/decimal.go @@ -0,0 +1,6 @@ +// Package decimal stands in for a decimal package other than shopspring's, +// such as github.com/govalues/decimal, whose name the generated code must +// not import twice. +package decimal + +type Decimal struct{} diff --git a/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/db.go b/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/models.go b/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/models.go new file mode 100644 index 0000000000..77e28c35a1 --- /dev/null +++ b/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/sqlc-dev/sqlc/endtoend/overrides_decimal_package/decimal" +) + +type Price struct { + ID int64 + Amount decimal.Decimal +} diff --git a/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/query.sql.go b/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/query.sql.go new file mode 100644 index 0000000000..6b6cdba685 --- /dev/null +++ b/internal/endtoend/testdata/overrides_decimal_package/postgresql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getPrice = `-- name: GetPrice :one +SELECT id, amount FROM prices WHERE id = $1 +` + +func (q *Queries) GetPrice(ctx context.Context, id int64) (Price, error) { + row := q.db.QueryRowContext(ctx, getPrice, id) + var i Price + err := row.Scan(&i.ID, &i.Amount) + return i, err +} diff --git a/internal/endtoend/testdata/overrides_decimal_package/postgresql/query.sql b/internal/endtoend/testdata/overrides_decimal_package/postgresql/query.sql new file mode 100644 index 0000000000..f536e32c94 --- /dev/null +++ b/internal/endtoend/testdata/overrides_decimal_package/postgresql/query.sql @@ -0,0 +1,2 @@ +-- name: GetPrice :one +SELECT * FROM prices WHERE id = $1; diff --git a/internal/endtoend/testdata/overrides_decimal_package/postgresql/schema.sql b/internal/endtoend/testdata/overrides_decimal_package/postgresql/schema.sql new file mode 100644 index 0000000000..8ed128605e --- /dev/null +++ b/internal/endtoend/testdata/overrides_decimal_package/postgresql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE prices ( + id bigint PRIMARY KEY, + amount numeric NOT NULL +); diff --git a/internal/endtoend/testdata/overrides_decimal_package/postgresql/sqlc.yaml b/internal/endtoend/testdata/overrides_decimal_package/postgresql/sqlc.yaml new file mode 100644 index 0000000000..90817ed96c --- /dev/null +++ b/internal/endtoend/testdata/overrides_decimal_package/postgresql/sqlc.yaml @@ -0,0 +1,12 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + overrides: + - db_type: "pg_catalog.numeric" + go_type: "github.com/sqlc-dev/sqlc/endtoend/overrides_decimal_package/decimal.Decimal" diff --git a/internal/endtoend/testdata/overrides_global_engine/mysql/db.go b/internal/endtoend/testdata/overrides_global_engine/mysql/db.go new file mode 100644 index 0000000000..8d745411c0 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/mysql/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package mysql + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_global_engine/mysql/models.go b/internal/endtoend/testdata/overrides_global_engine/mysql/models.go new file mode 100644 index 0000000000..eb70e855b8 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/mysql/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package mysql + +import ( + "database/sql" +) + +type Entry struct { + ID int32 + Value sql.NullString `backend:"mysql"` + Code []byte `backend:"mysql"` +} diff --git a/internal/endtoend/testdata/overrides_global_engine/mysql/query.sql.go b/internal/endtoend/testdata/overrides_global_engine/mysql/query.sql.go new file mode 100644 index 0000000000..8325e7d1fe --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/mysql/query.sql.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package mysql + +import ( + "context" + "database/sql" +) + +const findEntry = `-- name: FindEntry :one +SELECT id, value, code FROM entries +WHERE value = ? AND code = ? +` + +type FindEntryParams struct { + Value sql.NullString `backend:"mysql"` + Code []byte `backend:"mysql"` +} + +func (q *Queries) FindEntry(ctx context.Context, arg FindEntryParams) (Entry, error) { + row := q.db.QueryRowContext(ctx, findEntry, arg.Value, arg.Code) + var i Entry + err := row.Scan(&i.ID, &i.Value, &i.Code) + return i, err +} diff --git a/internal/endtoend/testdata/overrides_global_engine/pg/db.go b/internal/endtoend/testdata/overrides_global_engine/pg/db.go new file mode 100644 index 0000000000..6614d155e5 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/pg/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package pg + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_global_engine/pg/models.go b/internal/endtoend/testdata/overrides_global_engine/pg/models.go new file mode 100644 index 0000000000..d543e260e0 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/pg/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package pg + +import ( + "encoding/json" +) + +type Entry struct { + ID int32 + Value string `backend:"postgresql"` + Code json.RawMessage `backend:"postgresql"` +} diff --git a/internal/endtoend/testdata/overrides_global_engine/pg/query.sql.go b/internal/endtoend/testdata/overrides_global_engine/pg/query.sql.go new file mode 100644 index 0000000000..b186bff3e3 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/pg/query.sql.go @@ -0,0 +1,28 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package pg + +import ( + "context" + "encoding/json" +) + +const findEntry = `-- name: FindEntry :one +SELECT id, value, code FROM entries +WHERE value = $1 AND code = $2 +` + +type FindEntryParams struct { + Value string `backend:"postgresql"` + Code json.RawMessage `backend:"postgresql"` +} + +func (q *Queries) FindEntry(ctx context.Context, arg FindEntryParams) (Entry, error) { + row := q.db.QueryRowContext(ctx, findEntry, arg.Value, arg.Code) + var i Entry + err := row.Scan(&i.ID, &i.Value, &i.Code) + return i, err +} diff --git a/internal/endtoend/testdata/overrides_global_engine/query.sql b/internal/endtoend/testdata/overrides_global_engine/query.sql new file mode 100644 index 0000000000..09e6a55fc5 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/query.sql @@ -0,0 +1,3 @@ +-- name: FindEntry :one +SELECT id, value, code FROM entries +WHERE value = sqlc.arg(value) AND code = sqlc.arg(code); diff --git a/internal/endtoend/testdata/overrides_global_engine/schema.sql b/internal/endtoend/testdata/overrides_global_engine/schema.sql new file mode 100644 index 0000000000..3d66f2ec20 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE entries ( + id integer NOT NULL, + value text NOT NULL, + code text NOT NULL +); diff --git a/internal/endtoend/testdata/overrides_global_engine/sqlc.yaml b/internal/endtoend/testdata/overrides_global_engine/sqlc.yaml new file mode 100644 index 0000000000..0be9e6e949 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/sqlc.yaml @@ -0,0 +1,53 @@ +version: "2" +overrides: + go: + overrides: + - db_type: text + engine: postgresql + go_type: string + go_struct_tag: 'backend:"postgresql"' + - db_type: text + engine: mysql + go_type: "database/sql.NullString" + go_struct_tag: 'backend:"mysql"' + - db_type: text + engine: sqlite + go_type: + type: byte + slice: true + go_struct_tag: 'backend:"sqlite"' + - column: entries.code + engine: postgresql + go_type: + import: encoding/json + type: RawMessage + - column: entries.code + engine: mysql + go_type: + type: byte + slice: true + - column: entries.code + engine: sqlite + go_type: string +sql: + - engine: postgresql + schema: schema.sql + queries: query.sql + gen: + go: + package: pg + out: pg + - engine: mysql + schema: schema.sql + queries: query.sql + gen: + go: + package: mysql + out: mysql + - engine: sqlite + schema: schema.sql + queries: query.sql + gen: + go: + package: sqlite + out: sqlite diff --git a/internal/endtoend/testdata/overrides_global_engine/sqlite/db.go b/internal/endtoend/testdata/overrides_global_engine/sqlite/db.go new file mode 100644 index 0000000000..be3742276e --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/sqlite/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package sqlite + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_global_engine/sqlite/models.go b/internal/endtoend/testdata/overrides_global_engine/sqlite/models.go new file mode 100644 index 0000000000..031862d729 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/sqlite/models.go @@ -0,0 +1,11 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package sqlite + +type Entry struct { + ID int64 + Value []byte `backend:"sqlite"` + Code string `backend:"sqlite"` +} diff --git a/internal/endtoend/testdata/overrides_global_engine/sqlite/query.sql.go b/internal/endtoend/testdata/overrides_global_engine/sqlite/query.sql.go new file mode 100644 index 0000000000..fb70006c88 --- /dev/null +++ b/internal/endtoend/testdata/overrides_global_engine/sqlite/query.sql.go @@ -0,0 +1,27 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package sqlite + +import ( + "context" +) + +const findEntry = `-- name: FindEntry :one +SELECT id, value, code FROM entries +WHERE value = ?1 AND code = ?2 +` + +type FindEntryParams struct { + Value []byte `backend:"sqlite"` + Code string `backend:"sqlite"` +} + +func (q *Queries) FindEntry(ctx context.Context, arg FindEntryParams) (Entry, error) { + row := q.db.QueryRowContext(ctx, findEntry, arg.Value, arg.Code) + var i Entry + err := row.Scan(&i.ID, &i.Value, &i.Code) + return i, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt index cb6fb84aec..c6891c182b 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt @@ -1 +1,2 @@ -error parsing sqlc.json: bad syntax for struct tag pair +# package override +error generating code: bad syntax for struct tag pair diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go index a75be5c96a..7fc2d30290 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/models.go @@ -1,22 +1,21 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override -import () - type Bar struct { - Other string - AlsoTagged string `also:"tagged"` + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` } type Baz struct { - Other string - AlsoTagged string `also:"tagged"` + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` } type Foo struct { - Other string - Tagged string `a:"b" x:"y,z"` + Other string `utype:"notnull_text"` + Tagged string `a:"b" utype:"notnull_text" x:"y,z"` + Nulltext string `utype:"nullable_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go new file mode 100644 index 0000000000..0a94a438a6 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql index 4d5233cc37..5c9ce85545 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/schema.sql @@ -1,6 +1,7 @@ CREATE TABLE foo ( other text NOT NULL, - tagged text NOT NULL + tagged text NOT NULL, + nulltext text ); CREATE TABLE bar ( diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json index 7d92e65e69..697fe054ea 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/mysql/sqlc.json @@ -15,6 +15,16 @@ { "go_struct_tag": "also:\"tagged\"", "column": "*.also_tagged" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go index c6dbb043e5..6e1aea1a4b 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go index 8de4edf9f6..5c01d22942 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/models.go @@ -1,23 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override -import ( - "database/sql" -) - type Bar struct { - ID sql.NullString `type:"id"` - OtherID sql.NullString `type:"other_id"` - About sql.NullString - Other sql.NullString `type:"other"` + ID string `type:"id" utype:"nullable_text"` + OtherID string `type:"other_id" utype:"nullable_text"` + About string `utype:"nullable_text"` + Other string `type:"other" utype:"nullable_text"` } type Foo struct { - ID sql.NullString `source:"foo" type:"id"` - OtherID sql.NullString `type:"other_id"` - About sql.NullString `type:"about"` - Other sql.NullString `type:"this"` + ID string `source:"foo" type:"id" utype:"nullable_text"` + OtherID string `type:"other_id" utype:"nullable_text"` + About string `type:"about" utype:"nullable_text"` + Other string `type:"this" utype:"nullable_text"` + Notnulltext string `utype:"notnull_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..422e04ae9b --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql index 53739ddbb1..30b718298d 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/schema.sql @@ -2,7 +2,8 @@ CREATE TABLE foo ( id text, other_id text, about text, - other text + other text, + notnulltext text not null ); CREATE TABLE bar ( diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json index a01427c202..bc583cdad4 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/sqlc.json @@ -32,6 +32,16 @@ { "column": "foo.other", "go_struct_tag": "type:\"this\"" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go index 289d779ef2..9b9f9eea8e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go index 5f0c2ccea8..5c01d22942 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/models.go @@ -1,23 +1,20 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override -import ( - "github.com/jackc/pgx/v5/pgtype" -) - type Bar struct { - ID pgtype.Text `type:"id"` - OtherID pgtype.Text `type:"other_id"` - About pgtype.Text - Other pgtype.Text `type:"other"` + ID string `type:"id" utype:"nullable_text"` + OtherID string `type:"other_id" utype:"nullable_text"` + About string `utype:"nullable_text"` + Other string `type:"other" utype:"nullable_text"` } type Foo struct { - ID pgtype.Text `source:"foo" type:"id"` - OtherID pgtype.Text `type:"other_id"` - About pgtype.Text `type:"about"` - Other pgtype.Text `type:"this"` + ID string `source:"foo" type:"id" utype:"nullable_text"` + OtherID string `type:"other_id" utype:"nullable_text"` + About string `type:"about" utype:"nullable_text"` + Other string `type:"this" utype:"nullable_text"` + Notnulltext string `utype:"notnull_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..422e04ae9b --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRow(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql index 53739ddbb1..30b718298d 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/schema.sql @@ -2,7 +2,8 @@ CREATE TABLE foo ( id text, other_id text, about text, - other text + other text, + notnulltext text not null ); CREATE TABLE bar ( diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json index da86badcc7..df8c9de3b0 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/sqlc.json @@ -32,6 +32,16 @@ { "column": "foo.other", "go_struct_tag": "type:\"this\"" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go index f7d6221389..1e0f9e2059 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/models.go @@ -1,14 +1,11 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override -import ( - "database/sql" -) - type Foo struct { - ID sql.NullString `x:"y"` - OtherID sql.NullString + ID string `utype:"nullable_text" x:"y"` + OtherID string `utype:"nullable_text"` + Notnulltext string `utype:"notnull_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..0a94a438a6 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql index f860a58030..82698ec836 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/schema.sql @@ -1,4 +1,5 @@ CREATE TABLE foo ( id text, - other_id text + other_id text, + notnulltext text not null ); diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json index 2c6f9e8c7c..f1171fcc11 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/sqlc.json @@ -11,6 +11,16 @@ { "column": "foo.id", "go_struct_tag": "x:\"y\"" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go index 12db3b6b34..0e0c9aad5d 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/models.go @@ -1,25 +1,24 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override -import () - type Bar struct { - Other string - AlsoTagged string `also:"tagged"` - Tag3 string `tag_with_space:" it's legal!"` + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` + Tag3 string `tag_with_space:" it's legal!" utype:"notnull_text"` } type Baz struct { - Other string - AlsoTagged string `also:"tagged"` - Tag3 string `tag_with_space:" it's legal!"` + Other string `utype:"notnull_text"` + AlsoTagged string `also:"tagged" utype:"notnull_text"` + Tag3 string `tag_with_space:" it's legal!" utype:"notnull_text"` } type Foo struct { - Other string - Tagged string `a:"b" x:"y,z"` - Tag3 string `tag_with_space:" it's legal!"` + Other string `utype:"notnull_text"` + Tagged string `a:"b" utype:"notnull_text" x:"y,z"` + Tag3 string `tag_with_space:" it's legal!" utype:"notnull_text"` + Nulltext string `utype:"nullable_text"` } diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go new file mode 100644 index 0000000000..185ff73624 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql index f908060db1..e9aa9bd37a 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql @@ -1,7 +1,8 @@ CREATE TABLE foo ( other text NOT NULL, tagged text NOT NULL, - tag3 text NOT NULL + tag3 text NOT NULL, + nulltext text ); CREATE TABLE bar ( diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json index a4d54cc3df..a4ca853b6a 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json @@ -19,6 +19,16 @@ { "go_struct_tag": "tag_with_space:\" it's legal!\"", "column": "*.tag3" + }, + { + "db_type": "text", + "go_struct_tag": "utype:\"notnull_text\"" + }, + { + "db_type": "text", + "go_type": "string", + "nullable": true, + "go_struct_tag": "utype:\"nullable_text\"" } ] } diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go b/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go b/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go index 14ab966f1d..aa041ace46 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go index 574384bb3b..570aca62af 100644 --- a/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package override @@ -18,7 +18,7 @@ SELECT other, total, retyped FROM foo WHERE retyped IN (/*SLICE:paramname*/?) func (q *Queries) TestIN(ctx context.Context, paramname []pkg.CustomType) ([]Foo, error) { query := testIN - var queryParams []interface{} + var queryParams []any if len(paramname) > 0 { for _, v := range paramname { queryParams = append(queryParams, v) diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go index c6dbb043e5..6e1aea1a4b 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go index dd9674eb35..8d98c03fc3 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go index 2ec4568f89..951c4c4cd2 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go index 289d779ef2..9b9f9eea8e 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go index ed643a8a5d..84217085a3 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go index 0e7e2340fa..332661efd8 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go index a0666902a4..bc258d900b 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go index b4ef599ed1..de6dbef96c 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go index 14ab966f1d..aa041ace46 100644 --- a/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go b/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go new file mode 100644 index 0000000000..185ff73624 --- /dev/null +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int64, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int64 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql b/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql +++ b/internal/endtoend/testdata/overrides_go_types/sqlite/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go index 5371832477..21376297e5 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go index 011f716f27..4a2a7d1c9e 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go index f0c451a822..78d65bb1ea 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go index 011f716f27..4a2a7d1c9e 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go index 5371832477..21376297e5 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go index e202cc36c5..bd82726320 100644 --- a/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_nullable/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go index e1e63a7e29..1ba6645edc 100644 --- a/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go index 1c96c3161d..3e0d5a64c9 100644 --- a/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go index c6dbb043e5..6e1aea1a4b 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go index cc102c042d..4f2c2154fd 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go index 81f25585fd..6e328f6440 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go index 289d779ef2..9b9f9eea8e 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go index cc102c042d..4f2c2154fd 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go index 81f25585fd..6e328f6440 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go index cc102c042d..4f2c2154fd 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go index 2c229aa7b2..25d47d9c29 100644 --- a/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_pointers/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go index d66d804407..227745dfe9 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go index 42f812400d..3c41c7f5c1 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go index 8810c6ed7e..17a3e7b776 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go b/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go index 9317dbb40d..626c64e582 100644 --- a/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/overrides_unsigned/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/db.go b/internal/endtoend/testdata/params_duplicate/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/db.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/models.go b/internal/endtoend/testdata/params_duplicate/mysql/go/models.go index 5c2e13edf0..828a2c39a2 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/models.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,4 +12,5 @@ type User struct { ID int32 FirstName sql.NullString LastName sql.NullString + Age sql.NullInt32 } diff --git a/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go b/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go index f3530cc833..562981cc80 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,6 +10,39 @@ import ( "database/sql" ) +const selectUserByAgeCast = `-- name: SelectUserByAgeCast :many +SELECT first_name FROM users +WHERE age > CAST(? AS SIGNED) + OR age < CAST(? AS SIGNED) +` + +type SelectUserByAgeCastParams struct { + Threshold int64 +} + +func (q *Queries) SelectUserByAgeCast(ctx context.Context, arg SelectUserByAgeCastParams) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, selectUserByAgeCast, arg.Threshold, arg.Threshold) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var first_name sql.NullString + if err := rows.Scan(&first_name); err != nil { + return nil, err + } + items = append(items, first_name) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUserByID = `-- name: SelectUserByID :many SELECT first_name from users where (? = id OR ? = 0) @@ -83,7 +116,7 @@ users where (? = id OR ? = 0) type SelectUserQuestionParams struct { ID int32 - Column2 interface{} + Column2 any } func (q *Queries) SelectUserQuestion(ctx context.Context, arg SelectUserQuestionParams) ([]sql.NullString, error) { diff --git a/internal/endtoend/testdata/params_duplicate/mysql/query.sql b/internal/endtoend/testdata/params_duplicate/mysql/query.sql index cd661993c7..3924f57ad7 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/query.sql +++ b/internal/endtoend/testdata/params_duplicate/mysql/query.sql @@ -11,3 +11,8 @@ WHERE first_name = sqlc.arg(name) /* name: SelectUserQuestion :many */ SELECT first_name from users where (? = id OR ? = 0); + +/* name: SelectUserByAgeCast :many */ +SELECT first_name FROM users +WHERE age > CAST(sqlc.arg(threshold) AS SIGNED) + OR age < CAST(sqlc.arg(threshold) AS SIGNED); diff --git a/internal/endtoend/testdata/params_duplicate/mysql/schema.sql b/internal/endtoend/testdata/params_duplicate/mysql/schema.sql index e93e087e50..497fa29b7d 100644 --- a/internal/endtoend/testdata/params_duplicate/mysql/schema.sql +++ b/internal/endtoend/testdata/params_duplicate/mysql/schema.sql @@ -1,5 +1,6 @@ CREATE TABLE users ( id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name varchar(255), - last_name varchar(255) + last_name varchar(255), + age int ) ENGINE=InnoDB; diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go index 5c2e13edf0..16d7ae2b2b 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go index 5351a09c3e..56fc2d3690 100644 --- a/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/params_duplicate/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go index e857924a32..9af4bf3fc0 100644 --- a/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -34,4 +34,5 @@ type GoKeyword struct { Import pgtype.Text Return pgtype.Text Var pgtype.Text + Q pgtype.Text } diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go index 430bc74a67..d659225944 100644 --- a/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -173,6 +173,15 @@ func (q *Queries) KeywordPackage(ctx context.Context, package_ string) error { return err } +const keywordQ = `-- name: KeywordQ :exec +SELECT $1::text +` + +func (q *Queries) KeywordQ(ctx context.Context, q_ string) error { + _, err := q.db.Exec(ctx, keywordQ, q_) + return err +} + const keywordRange = `-- name: KeywordRange :exec SELECT $1::text ` @@ -434,6 +443,17 @@ func (q *Queries) SelectPackage(ctx context.Context) (pgtype.Text, error) { return package_, err } +const selectQ = `-- name: SelectQ :one +SELECT "q" FROM go_keywords +` + +func (q *Queries) SelectQ(ctx context.Context) (pgtype.Text, error) { + row := q.db.QueryRow(ctx, selectQ) + var q_ pgtype.Text + err := row.Scan(&q_) + return q_, err +} + const selectRange = `-- name: SelectRange :one SELECT "range" FROM go_keywords ` diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql b/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql index 70796e4e3e..bc45b1166f 100644 --- a/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/query.sql @@ -73,6 +73,9 @@ SELECT sqlc.arg('return')::text; -- name: KeywordVar :exec SELECT sqlc.arg('var')::text; +-- name: KeywordQ :exec +SELECT sqlc.arg('q')::text; + -- name: SelectBreak :one SELECT "break" FROM go_keywords; @@ -147,3 +150,6 @@ SELECT "return" FROM go_keywords; -- name: SelectVar :one SELECT "var" FROM go_keywords; + +-- name: SelectQ :one +SELECT "q" FROM go_keywords; diff --git a/internal/endtoend/testdata/params_go_keywords/postgresql/schema.sql b/internal/endtoend/testdata/params_go_keywords/postgresql/schema.sql index 11a04beef6..100be50211 100644 --- a/internal/endtoend/testdata/params_go_keywords/postgresql/schema.sql +++ b/internal/endtoend/testdata/params_go_keywords/postgresql/schema.sql @@ -23,5 +23,6 @@ CREATE TABLE go_keywords ( "for" TEXT, "import" TEXT, "return" TEXT, - "var" TEXT + "var" TEXT, + "q" TEXT ); diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/db/db.go b/internal/endtoend/testdata/params_in_nested_func/mysql/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/db/models.go b/internal/endtoend/testdata/params_in_nested_func/mysql/db/models.go new file mode 100644 index 0000000000..5028056c7b --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/db/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "database/sql" +) + +type Routergroup struct { + Groupid uint32 + Groupname string + Defaultconfigid sql.NullInt32 + Defaultfirmwareversion sql.NullString + Parentgroupid sql.NullInt32 + Firmwarepolicy sql.NullString + Styles sql.NullString +} diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go b/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go new file mode 100644 index 0000000000..9cdd1a58a3 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/db/query.sql.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const getGroups = `-- name: GetGroups :many +SELECT + rg.groupId, + rg.groupName +FROM + RouterGroup rg +WHERE + rg.groupName LIKE CONCAT('%', COALESCE(?, rg.groupName), '%') AND + rg.groupId = COALESCE(?, rg.groupId) +` + +type GetGroupsParams struct { + GroupName any + GroupId sql.NullInt32 +} + +type GetGroupsRow struct { + Groupid uint32 + Groupname string +} + +func (q *Queries) GetGroups(ctx context.Context, arg GetGroupsParams) ([]GetGroupsRow, error) { + rows, err := q.db.QueryContext(ctx, getGroups, arg.GroupName, arg.GroupId) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetGroupsRow + for rows.Next() { + var i GetGroupsRow + if err := rows.Scan(&i.Groupid, &i.Groupname); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/query.sql b/internal/endtoend/testdata/params_in_nested_func/mysql/query.sql new file mode 100644 index 0000000000..8a2a78fa36 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/query.sql @@ -0,0 +1,9 @@ +-- name: GetGroups :many +SELECT + rg.groupId, + rg.groupName +FROM + RouterGroup rg +WHERE + rg.groupName LIKE CONCAT('%', COALESCE(sqlc.narg('groupName'), rg.groupName), '%') AND + rg.groupId = COALESCE(sqlc.narg('groupId'), rg.groupId); diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/schema.sql b/internal/endtoend/testdata/params_in_nested_func/mysql/schema.sql new file mode 100644 index 0000000000..12e0fb3b85 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/schema.sql @@ -0,0 +1,10 @@ +create table RouterGroup +( + groupId int unsigned auto_increment primary key, + groupName varchar(100) not null, + defaultConfigId int unsigned null, + defaultFirmwareVersion varchar(12) null, + parentGroupId int unsigned null, + firmwarePolicy varchar(45) null, + styles text null +); diff --git a/internal/endtoend/testdata/params_in_nested_func/mysql/sqlc.yaml b/internal/endtoend/testdata/params_in_nested_func/mysql/sqlc.yaml new file mode 100644 index 0000000000..e8b45d313d --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/mysql/sqlc.yaml @@ -0,0 +1,8 @@ +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: mysql + gen: + go: + out: db diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/db/db.go b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/db/models.go b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/models.go new file mode 100644 index 0000000000..2c8d1b7ade --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "database/sql" +) + +type Routergroup struct { + Groupid int32 + Groupname string + Defaultconfigid sql.NullInt32 + Defaultfirmwareversion sql.NullString + Parentgroupid sql.NullInt32 + Firmwarepolicy sql.NullString + Styles sql.NullString +} diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go new file mode 100644 index 0000000000..695d59f2f0 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/db/query.sql.go @@ -0,0 +1,55 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const getGroups = `-- name: GetGroups :many +SELECT + rg.groupId, + rg.groupName +FROM + RouterGroup rg +WHERE + rg.groupName LIKE CONCAT('%', COALESCE($1::text, rg.groupName), '%') AND + rg.groupId = COALESCE($2, rg.groupId) +` + +type GetGroupsParams struct { + GroupName sql.NullString + GroupId sql.NullInt32 +} + +type GetGroupsRow struct { + Groupid int32 + Groupname string +} + +func (q *Queries) GetGroups(ctx context.Context, arg GetGroupsParams) ([]GetGroupsRow, error) { + rows, err := q.db.QueryContext(ctx, getGroups, arg.GroupName, arg.GroupId) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetGroupsRow + for rows.Next() { + var i GetGroupsRow + if err := rows.Scan(&i.Groupid, &i.Groupname); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/query.sql b/internal/endtoend/testdata/params_in_nested_func/postgresql/query.sql new file mode 100644 index 0000000000..7732269d25 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/query.sql @@ -0,0 +1,9 @@ +-- name: GetGroups :many +SELECT + rg.groupId, + rg.groupName +FROM + RouterGroup rg +WHERE + rg.groupName LIKE CONCAT('%', COALESCE(sqlc.narg('groupName')::text, rg.groupName), '%') AND + rg.groupId = COALESCE(sqlc.narg('groupId'), rg.groupId); diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/schema.sql b/internal/endtoend/testdata/params_in_nested_func/postgresql/schema.sql new file mode 100644 index 0000000000..66cfd02733 --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/schema.sql @@ -0,0 +1,10 @@ +create table RouterGroup +( + groupId serial primary key, + groupName varchar(100) not null, + defaultConfigId int null, + defaultFirmwareVersion varchar(12) null, + parentGroupId int null, + firmwarePolicy varchar(45) null, + styles text null +); diff --git a/internal/endtoend/testdata/params_in_nested_func/postgresql/sqlc.yaml b/internal/endtoend/testdata/params_in_nested_func/postgresql/sqlc.yaml new file mode 100644 index 0000000000..936b0171ee --- /dev/null +++ b/internal/endtoend/testdata/params_in_nested_func/postgresql/sqlc.yaml @@ -0,0 +1,8 @@ +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + gen: + go: + out: db diff --git a/internal/endtoend/testdata/params_location/mysql/go/db.go b/internal/endtoend/testdata/params_location/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/db.go +++ b/internal/endtoend/testdata/params_location/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_location/mysql/go/models.go b/internal/endtoend/testdata/params_location/mysql/go/models.go index b5f5c9b7ed..eee0c6dc67 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/models.go +++ b/internal/endtoend/testdata/params_location/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go index ba60001e0b..9449c9d090 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go index 512742184a..20494b09ba 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go index d8dd076226..01addb87ca 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go index d1c0243acb..e2a0512792 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go index f47e1cb237..7eeb1ff1ea 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go index b5f5c9b7ed..eee0c6dc67 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go index e9d33d8aa1..d532e304b3 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go index fb85babb6d..04930c9b73 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go index c00a46e909..76436e31d4 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go index fb85babb6d..04930c9b73 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go index 1ca8c46ddc..f117fc96f3 100644 --- a/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/params_placeholder_in_left_expr/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/mysql/go/db.go b/internal/endtoend/testdata/params_two/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/db.go +++ b/internal/endtoend/testdata/params_two/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_two/mysql/go/models.go b/internal/endtoend/testdata/params_two/mysql/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/models.go +++ b/internal/endtoend/testdata/params_two/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_two/mysql/go/query.sql.go b/internal/endtoend/testdata/params_two/mysql/go/query.sql.go index d7bac3804f..72a99915c5 100644 --- a/internal/endtoend/testdata/params_two/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go index 4ef756cc07..8294904aad 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go index fa800a9a15..463744df69 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go index 3e5e46a8ae..870986a0fc 100644 --- a/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go index 8b6700cbe2..0db559a542 100644 --- a/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/params_two/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/parse_basic/clickhouse/exec.json b/internal/endtoend/testdata/parse_basic/clickhouse/exec.json new file mode 100644 index 0000000000..9481db4c86 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/clickhouse/exec.json @@ -0,0 +1,5 @@ +{ + "command": "parse", + "args": ["--dialect", "clickhouse", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/parse_basic/clickhouse/query.sql b/internal/endtoend/testdata/parse_basic/clickhouse/query.sql new file mode 100644 index 0000000000..11dff59f08 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/clickhouse/query.sql @@ -0,0 +1,2 @@ +-- name: GetValue :one +SELECT 1; diff --git a/internal/endtoend/testdata/parse_basic/clickhouse/stdout.txt b/internal/endtoend/testdata/parse_basic/clickhouse/stdout.txt new file mode 100644 index 0000000000..0344534966 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/clickhouse/stdout.txt @@ -0,0 +1,34 @@ +[ + { + "name": "GetValue", + "cmd": ":one", + "ast": { + "tag": "RawStmt", + "stmt": { + "tag": "SelectStmt", + "target_list": { + "tag": "List", + "items": [ + { + "tag": "ResTarget", + "name": "1", + "val": { + "tag": "A_Const", + "val": { + "tag": "Integer", + "ival": 1 + }, + "location": 30 + }, + "location": 30 + } + ] + }, + "op": 0, + "all": false + }, + "stmt_location": 0, + "stmt_len": 32 + } + } +] diff --git a/internal/endtoend/testdata/parse_basic/duckdb/exec.json b/internal/endtoend/testdata/parse_basic/duckdb/exec.json new file mode 100644 index 0000000000..078d8d0b24 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/duckdb/exec.json @@ -0,0 +1,5 @@ +{ + "command": "parse", + "args": ["--dialect", "duckdb", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/parse_basic/duckdb/query.sql b/internal/endtoend/testdata/parse_basic/duckdb/query.sql new file mode 100644 index 0000000000..11dff59f08 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/duckdb/query.sql @@ -0,0 +1,2 @@ +-- name: GetValue :one +SELECT 1; diff --git a/internal/endtoend/testdata/parse_basic/duckdb/stdout.txt b/internal/endtoend/testdata/parse_basic/duckdb/stdout.txt new file mode 100644 index 0000000000..9c48f6b87e --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/duckdb/stdout.txt @@ -0,0 +1,33 @@ +[ + { + "name": "GetValue", + "cmd": ":one", + "ast": { + "tag": "RawStmt", + "stmt": { + "tag": "SelectStmt", + "target_list": { + "tag": "List", + "items": [ + { + "tag": "ResTarget", + "val": { + "tag": "A_Const", + "val": { + "tag": "Integer", + "ival": 1 + }, + "location": 30 + }, + "location": 30 + } + ] + }, + "op": 0, + "all": false + }, + "stmt_location": 0, + "stmt_len": 33 + } + } +] diff --git a/internal/endtoend/testdata/parse_basic/googlesql/exec.json b/internal/endtoend/testdata/parse_basic/googlesql/exec.json new file mode 100644 index 0000000000..6931f13662 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/googlesql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "parse", + "args": ["--dialect", "googlesql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/parse_basic/googlesql/query.sql b/internal/endtoend/testdata/parse_basic/googlesql/query.sql new file mode 100644 index 0000000000..11dff59f08 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/googlesql/query.sql @@ -0,0 +1,2 @@ +-- name: GetValue :one +SELECT 1; diff --git a/internal/endtoend/testdata/parse_basic/googlesql/stdout.txt b/internal/endtoend/testdata/parse_basic/googlesql/stdout.txt new file mode 100644 index 0000000000..f1d543432e --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/googlesql/stdout.txt @@ -0,0 +1,33 @@ +[ + { + "name": "GetValue", + "cmd": ":one", + "ast": { + "tag": "RawStmt", + "stmt": { + "tag": "SelectStmt", + "target_list": { + "tag": "List", + "items": [ + { + "tag": "ResTarget", + "val": { + "tag": "A_Const", + "val": { + "tag": "Integer", + "ival": 1 + }, + "location": 30 + }, + "location": 30 + } + ] + }, + "op": 0, + "all": false + }, + "stmt_location": 0, + "stmt_len": 31 + } + } +] diff --git a/internal/endtoend/testdata/parse_basic/mssql/exec.json b/internal/endtoend/testdata/parse_basic/mssql/exec.json new file mode 100644 index 0000000000..fb497540ad --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/mssql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "parse", + "args": ["--dialect", "mssql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/parse_basic/mssql/query.sql b/internal/endtoend/testdata/parse_basic/mssql/query.sql new file mode 100644 index 0000000000..11dff59f08 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/mssql/query.sql @@ -0,0 +1,2 @@ +-- name: GetValue :one +SELECT 1; diff --git a/internal/endtoend/testdata/parse_basic/mssql/stdout.txt b/internal/endtoend/testdata/parse_basic/mssql/stdout.txt new file mode 100644 index 0000000000..a317604268 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/mssql/stdout.txt @@ -0,0 +1,33 @@ +[ + { + "name": "GetValue", + "cmd": ":one", + "ast": { + "tag": "RawStmt", + "stmt": { + "tag": "SelectStmt", + "target_list": { + "tag": "List", + "items": [ + { + "tag": "ResTarget", + "val": { + "tag": "A_Const", + "val": { + "tag": "Integer", + "ival": 1 + }, + "location": 30 + }, + "location": 30 + } + ] + }, + "op": 0, + "all": false + }, + "stmt_location": 0, + "stmt_len": 32 + } + } +] diff --git a/internal/endtoend/testdata/parse_basic/mysql/exec.json b/internal/endtoend/testdata/parse_basic/mysql/exec.json new file mode 100644 index 0000000000..b3326c09a0 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/mysql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "parse", + "args": ["--dialect", "mysql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/parse_basic/mysql/query.sql b/internal/endtoend/testdata/parse_basic/mysql/query.sql new file mode 100644 index 0000000000..11dff59f08 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: GetValue :one +SELECT 1; diff --git a/internal/endtoend/testdata/parse_basic/mysql/stdout.txt b/internal/endtoend/testdata/parse_basic/mysql/stdout.txt new file mode 100644 index 0000000000..baad161901 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/mysql/stdout.txt @@ -0,0 +1,42 @@ +[ + { + "name": "GetValue", + "cmd": ":one", + "ast": { + "tag": "RawStmt", + "stmt": { + "tag": "SelectStmt", + "target_list": { + "tag": "List", + "items": [ + { + "tag": "ResTarget", + "val": { + "tag": "A_Const", + "val": { + "tag": "Integer", + "ival": 1 + }, + "location": 30 + }, + "location": 30 + } + ] + }, + "from_clause": { + "tag": "List" + }, + "group_clause": { + "tag": "List" + }, + "window_clause": { + "tag": "List" + }, + "op": 0, + "all": false + }, + "stmt_location": 0, + "stmt_len": 31 + } + } +] diff --git a/internal/endtoend/testdata/parse_basic/postgresql/exec.json b/internal/endtoend/testdata/parse_basic/postgresql/exec.json new file mode 100644 index 0000000000..0a75ff458d --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/postgresql/exec.json @@ -0,0 +1,5 @@ +{ + "command": "parse", + "args": ["--dialect", "postgresql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/parse_basic/postgresql/query.sql b/internal/endtoend/testdata/parse_basic/postgresql/query.sql new file mode 100644 index 0000000000..11dff59f08 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/postgresql/query.sql @@ -0,0 +1,2 @@ +-- name: GetValue :one +SELECT 1; diff --git a/internal/endtoend/testdata/parse_basic/postgresql/stdout.txt b/internal/endtoend/testdata/parse_basic/postgresql/stdout.txt new file mode 100644 index 0000000000..da9c2f9040 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/postgresql/stdout.txt @@ -0,0 +1,69 @@ +[ + { + "name": "GetValue", + "cmd": ":one", + "ast": { + "tag": "RawStmt", + "stmt": { + "tag": "SelectStmt", + "distinct_clause": { + "tag": "List" + }, + "target_list": { + "tag": "List", + "items": [ + { + "tag": "ResTarget", + "indirection": { + "tag": "List" + }, + "val": { + "tag": "A_Const", + "val": { + "tag": "Integer", + "ival": 1 + }, + "location": 30 + }, + "location": 30 + } + ] + }, + "from_clause": { + "tag": "List" + }, + "where_clause": { + "tag": "TODO" + }, + "group_clause": { + "tag": "List" + }, + "having_clause": { + "tag": "TODO" + }, + "window_clause": { + "tag": "List" + }, + "values_lists": { + "tag": "List" + }, + "sort_clause": { + "tag": "List" + }, + "limit_offset": { + "tag": "TODO" + }, + "limit_count": { + "tag": "TODO" + }, + "locking_clause": { + "tag": "List" + }, + "op": 0, + "all": false + }, + "stmt_location": 0, + "stmt_len": 31 + } + } +] diff --git a/internal/endtoend/testdata/parse_basic/sqlite/exec.json b/internal/endtoend/testdata/parse_basic/sqlite/exec.json new file mode 100644 index 0000000000..13abc589ed --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/sqlite/exec.json @@ -0,0 +1,5 @@ +{ + "command": "parse", + "args": ["--dialect", "sqlite", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/parse_basic/sqlite/query.sql b/internal/endtoend/testdata/parse_basic/sqlite/query.sql new file mode 100644 index 0000000000..11dff59f08 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: GetValue :one +SELECT 1; diff --git a/internal/endtoend/testdata/parse_basic/sqlite/stdout.txt b/internal/endtoend/testdata/parse_basic/sqlite/stdout.txt new file mode 100644 index 0000000000..8cbf077101 --- /dev/null +++ b/internal/endtoend/testdata/parse_basic/sqlite/stdout.txt @@ -0,0 +1,45 @@ +[ + { + "name": "GetValue", + "cmd": ":one", + "ast": { + "tag": "RawStmt", + "stmt": { + "tag": "SelectStmt", + "target_list": { + "tag": "List", + "items": [ + { + "tag": "ResTarget", + "val": { + "tag": "A_Const", + "val": { + "tag": "Integer", + "ival": 1 + }, + "location": 30 + }, + "location": 30 + } + ] + }, + "from_clause": { + "tag": "List" + }, + "group_clause": { + "tag": "List" + }, + "window_clause": { + "tag": "List" + }, + "values_lists": { + "tag": "List" + }, + "op": 0, + "all": false + }, + "stmt_location": 0, + "stmt_len": 31 + } + } +] diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go index 9a43a248cb..a3b9f9c752 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go b/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go index dafe665dd8..5fc53b346c 100644 --- a/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_in_expr/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pattern_matching/mysql/go/db.go b/internal/endtoend/testdata/pattern_matching/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/go/db.go +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pattern_matching/mysql/go/models.go b/internal/endtoend/testdata/pattern_matching/mysql/go/models.go index 687953c6e9..027ea49d71 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/go/models.go +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go b/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go index ecdb72e7bc..d0314c8403 100644 --- a/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_matching/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go index 687953c6e9..027ea49d71 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go b/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go index 9fe5916fe9..c7e0223107 100644 --- a/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/pattern_matching/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go index 208cd658b4..c0e470e1b5 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/exec.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: exec.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go index 5bbd7b752e..774c62f590 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -23,9 +23,9 @@ const advisoryLockOne = `-- name: AdvisoryLockOne :one SELECT pg_advisory_lock($1) ` -func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (interface{}, error) { +func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (any, error) { row := q.db.QueryRow(ctx, advisoryLockOne, pgAdvisoryLock) - var pg_advisory_lock interface{} + var pg_advisory_lock any err := row.Scan(&pg_advisory_lock) return pg_advisory_lock, err } diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go index 208cd658b4..c0e470e1b5 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/exec.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: exec.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go index 4f9de9d364..a8d448b989 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -23,9 +23,9 @@ const advisoryLockOne = `-- name: AdvisoryLockOne :one SELECT pg_advisory_lock($1) ` -func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (interface{}, error) { +func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (any, error) { row := q.db.QueryRow(ctx, advisoryLockOne, pgAdvisoryLock) - var pg_advisory_lock interface{} + var pg_advisory_lock any err := row.Scan(&pg_advisory_lock) return pg_advisory_lock, err } diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go index d3d33639a1..77bc72e688 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/exec.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: exec.sql package querytest diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go index 46761a06ef..76cb08e005 100644 --- a/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_advisory_xact_lock/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -22,9 +22,9 @@ const advisoryLockOne = `-- name: AdvisoryLockOne :one SELECT pg_advisory_lock($1) ` -func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (interface{}, error) { +func (q *Queries) AdvisoryLockOne(ctx context.Context, pgAdvisoryLock int64) (any, error) { row := q.db.QueryRowContext(ctx, advisoryLockOne, pgAdvisoryLock) - var pg_advisory_lock interface{} + var pg_advisory_lock any err := row.Scan(&pg_advisory_lock) return pg_advisory_lock, err } diff --git a/internal/endtoend/testdata/pg_dump/db/db.go b/internal/endtoend/testdata/pg_dump/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/pg_dump/db/db.go +++ b/internal/endtoend/testdata/pg_dump/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_dump/db/models.go b/internal/endtoend/testdata/pg_dump/db/models.go index f8bcd76317..56c9d4a035 100644 --- a/internal/endtoend/testdata/pg_dump/db/models.go +++ b/internal/endtoend/testdata/pg_dump/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/pg_dump/db/query.sql.go b/internal/endtoend/testdata/pg_dump/db/query.sql.go index aadac5de28..703f7512a1 100644 --- a/internal/endtoend/testdata/pg_dump/db/query.sql.go +++ b/internal/endtoend/testdata/pg_dump/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/pg_dump/exec.json b/internal/endtoend/testdata/pg_dump/exec.json index c16f123ce3..c85ca2dfa7 100644 --- a/internal/endtoend/testdata/pg_dump/exec.json +++ b/internal/endtoend/testdata/pg_dump/exec.json @@ -1,3 +1,6 @@ { - "contexts": ["base"] -} \ No newline at end of file + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/pg_dump/schema.sql b/internal/endtoend/testdata/pg_dump/schema.sql index 06bfb9d37c..ef1ab49c19 100644 --- a/internal/endtoend/testdata/pg_dump/schema.sql +++ b/internal/endtoend/testdata/pg_dump/schema.sql @@ -5,6 +5,8 @@ -- Dumped from database version 15.3 (Debian 15.3-1.pgdg120+1) -- Dumped by pg_dump version 15.3 +\restrict auwherpfqaiuwrhgp + SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; @@ -83,6 +85,8 @@ ALTER TABLE ONLY public.authors ADD CONSTRAINT authors_pkey PRIMARY KEY (id); +\unrestrict auwherpfqaiuwrhgp + -- -- PostgreSQL database dump complete -- diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go index 065559f1e4..824658e3b1 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go index 99a0550ff4..7fd7c3aa48 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go index 1f8e45fe92..1b4affecda 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go index 99a0550ff4..7fd7c3aa48 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go index 065559f1e4..824658e3b1 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go index e74999944f..efc1920bd7 100644 --- a/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_ext_ltree/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go index b90bca2424..ba7b612936 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pg_trgm.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: pg_trgm.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go index e62757fc15..5dbd345a82 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/pgcrypto.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: pgcrypto.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go index 026120ac98..448810e85f 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v4/go/uuid_ossp.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: uuid_ossp.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go index b90bca2424..ba7b612936 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pg_trgm.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: pg_trgm.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go index e62757fc15..5dbd345a82 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/pgcrypto.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: pgcrypto.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go index 5321829fce..836f0d29a6 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/pgx/v5/go/uuid_ossp.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: uuid_ossp.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go index ffc8e70064..564b9ebe0a 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pg_trgm.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: pg_trgm.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go index 161e4ccc95..4676430bb5 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/pgcrypto.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: pgcrypto.sql package querytest diff --git a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go index f9e61702b1..0bd737e6f1 100644 --- a/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go +++ b/internal/endtoend/testdata/pg_extensions/postgresql/stdlib/go/uuid_ossp.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: uuid_ossp.sql package querytest diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go index a156949e24..4502d2acb5 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go index 73d2f1855f..d0f1c56ac4 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go index 392a60099f..a386f76137 100644 --- a/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_generate_series/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go index e3cc362c0e..f263950652 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v4/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go index ee914306c5..0eb1011162 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_pgx/v5/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go index d4685e8e09..5579308f8a 100644 --- a/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go +++ b/internal/endtoend/testdata/pg_timezone_names/go_stdlib/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_timezone_names/schema.sql b/internal/endtoend/testdata/pg_timezone_names/schema.sql new file mode 100644 index 0000000000..e0ac49d1ec --- /dev/null +++ b/internal/endtoend/testdata/pg_timezone_names/schema.sql @@ -0,0 +1 @@ +SELECT 1; diff --git a/internal/endtoend/testdata/pg_timezone_names/sqlc.json b/internal/endtoend/testdata/pg_timezone_names/sqlc.json index 404ef769a9..1f0b8cd3d6 100644 --- a/internal/endtoend/testdata/pg_timezone_names/sqlc.json +++ b/internal/endtoend/testdata/pg_timezone_names/sqlc.json @@ -3,7 +3,7 @@ "sql": [ { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { @@ -15,7 +15,7 @@ }, { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { @@ -27,7 +27,7 @@ }, { "engine": "postgresql", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "gen": { "go": { diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go index 62426551e5..34274a0f9d 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go index 62426551e5..34274a0f9d 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go index 2f3b066799..4af57abca3 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type User struct { ID int64 } diff --git a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go index 2f0d4de7a8..7cd0ecd450 100644 --- a/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/pg_user_table/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/exec.json b/internal/endtoend/testdata/pg_vector/postgresql/pgx/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/db.go b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/models.go b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f6a0dc337a --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/pgvector/pgvector-go" +) + +type Item struct { + ID int64 + Embedding pgvector.Vector +} diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..d7c54c17a0 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/go/query.sql.go @@ -0,0 +1,48 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/pgvector/pgvector-go" +) + +const insertVector = `-- name: InsertVector :exec +INSERT INTO items (embedding) VALUES ($1) +` + +func (q *Queries) InsertVector(ctx context.Context, embedding pgvector.Vector) error { + _, err := q.db.Exec(ctx, insertVector, embedding) + return err +} + +const nearestNeighbor = `-- name: NearestNeighbor :many +SELECT id, embedding +FROM items +ORDER BY embedding <-> $1 +LIMIT 5 +` + +func (q *Queries) NearestNeighbor(ctx context.Context, embedding pgvector.Vector) ([]Item, error) { + rows, err := q.db.Query(ctx, nearestNeighbor, embedding) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Item + for rows.Next() { + var i Item + if err := rows.Scan(&i.ID, &i.Embedding); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/query.sql b/internal/endtoend/testdata/pg_vector/postgresql/pgx/query.sql new file mode 100644 index 0000000000..5bcc53958b --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/query.sql @@ -0,0 +1,8 @@ +-- name: InsertVector :exec +INSERT INTO items (embedding) VALUES ($1); + +-- name: NearestNeighbor :many +SELECT * +FROM items +ORDER BY embedding <-> $1 +LIMIT 5; diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/schema.sql b/internal/endtoend/testdata/pg_vector/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..a078405428 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE EXTENSION IF NOT EXISTS "vector"; + +CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3)); diff --git a/internal/endtoend/testdata/pg_vector/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/pg_vector/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/pg_vector/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go index 819b76a2d8..5cc19ed7fb 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go index 8581ab2803..35ffc14b6f 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go index 8b49c11c7d..9565609b93 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go index 628fe9c96b..b57247cdf3 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go index b5596be9ae..bb0f5dec26 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package datatype diff --git a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go index c1efa7d950..76c1c5f2ae 100644 --- a/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/pointer_type_import/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package datatype diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/db.go b/internal/endtoend/testdata/prepared_queries/mysql/go/db.go index e1fc772d90..9c72c93be7 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/go/db.go +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -11,10 +11,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -72,7 +72,7 @@ func (q *Queries) Close() error { return err } -func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (sql.Result, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) @@ -83,7 +83,7 @@ func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args . } } -func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Rows, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) @@ -94,7 +94,7 @@ func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args } } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/models.go b/internal/endtoend/testdata/prepared_queries/mysql/go/models.go index f6e40e212e..9dbd0bf1e2 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/go/models.go +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go b/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go index 77ea2263f1..f2021cb4fb 100644 --- a/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/prepared_queries/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go index e1fc772d90..9c72c93be7 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -11,10 +11,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -72,7 +72,7 @@ func (q *Queries) Close() error { return err } -func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (sql.Result, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) @@ -83,7 +83,7 @@ func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args . } } -func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Rows, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) @@ -94,7 +94,7 @@ func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args } } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go index 124f668c41..d54fc5a8e3 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go index 931a3e7e6a..f4c96a4b70 100644 --- a/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/prepared_queries/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go index c4c6078a5d..c1d9086086 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package primary_key_later @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go index 6233edc26f..0a9eae1526 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go index b4540cba7a..469dcfaf98 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v4/go/queries.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: queries.sql package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go index 6cf532a1f4..6223302b27 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package primary_key_later @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go index 4497427571..a612b37045 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go index b4540cba7a..469dcfaf98 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/pgx/v5/go/queries.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: queries.sql package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go index 14e5d88029..dd92c6e908 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package primary_key_later @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go index 6233edc26f..0a9eae1526 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package primary_key_later diff --git a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go index 5a7137dac5..2a6b8ee52b 100644 --- a/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go +++ b/internal/endtoend/testdata/primary_key_later/postgresql/stdlib/go/queries.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: queries.sql package primary_key_later diff --git a/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json index c59daa1899..09cd509f75 100644 --- a/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json @@ -43,7 +43,8 @@ "query_parameter_limit": 1, "output_batch_file_name": "", "json_tags_id_uppercase": false, - "omit_unused_structs": false + "omit_unused_structs": false, + "emit_sql_as_comment": false }, "json": { "out": "", @@ -65397,6 +65398,6 @@ "insert_into_table": null } ], - "sqlc_version": "v1.22.0", + "sqlc_version": "v1.31.1", "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" } diff --git a/internal/endtoend/testdata/process_plugin_format_json/exec.json b/internal/endtoend/testdata/process_plugin_format_json/exec.json new file mode 100644 index 0000000000..2cfb9f266d --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/exec.json @@ -0,0 +1,4 @@ +{ + "process": "test-json-process-plugin", + "os": [ "darwin", "linux" ] +} diff --git a/internal/endtoend/testdata/process_plugin_format_json/gen/hello.txt b/internal/endtoend/testdata/process_plugin_format_json/gen/hello.txt new file mode 100644 index 0000000000..05d6799f15 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/gen/hello.txt @@ -0,0 +1,12 @@ +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +SELECT id, name, bio FROM authors +ORDER BY name +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +DELETE FROM authors +WHERE id = $1 diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/query.sql b/internal/endtoend/testdata/process_plugin_format_json/query.sql similarity index 100% rename from internal/endtoend/testdata/emit_pydantic_models/postgresql/query.sql rename to internal/endtoend/testdata/process_plugin_format_json/query.sql diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/schema.sql b/internal/endtoend/testdata/process_plugin_format_json/schema.sql similarity index 100% rename from internal/endtoend/testdata/emit_pydantic_models/postgresql/schema.sql rename to internal/endtoend/testdata/process_plugin_format_json/schema.sql diff --git a/internal/endtoend/testdata/process_plugin_format_json/sqlc.json b/internal/endtoend/testdata/process_plugin_format_json/sqlc.json new file mode 100644 index 0000000000..28055fa571 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_format_json/sqlc.json @@ -0,0 +1,25 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "jsonb" + } + ] + } + ], + "plugins": [ + { + "name": "jsonb", + "process": { + "cmd": "test-json-process-plugin", + "format": "json" + } + } + ] +} diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json index 2e996ca79d..e38046cf57 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/exec.json @@ -1,3 +1,4 @@ { - "contexts": ["base"] + "contexts": ["base"], + "process": "sqlc-gen-json" } diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json index fcbceb288e..f7b88c2104 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json @@ -8,8 +8,6 @@ "queries": [ "query.sql" ], - "rename": {}, - "overrides": [], "codegen": { "out": "gen", "plugin": "jsonb", @@ -61,7 +59,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -87,7 +86,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bio", @@ -113,7 +113,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -164,7 +165,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -190,7 +192,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -216,7 +219,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -242,7 +246,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -268,7 +273,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -294,7 +300,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggfnoid", @@ -320,7 +327,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggkind", @@ -346,7 +354,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggnumdirectargs", @@ -372,7 +381,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggtransfn", @@ -398,7 +408,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggfinalfn", @@ -424,7 +435,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggcombinefn", @@ -450,7 +462,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggserialfn", @@ -476,7 +489,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggdeserialfn", @@ -502,7 +516,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmtransfn", @@ -528,7 +543,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggminvtransfn", @@ -554,7 +570,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmfinalfn", @@ -580,7 +597,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggfinalextra", @@ -606,7 +624,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmfinalextra", @@ -632,7 +651,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggfinalmodify", @@ -658,7 +678,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmfinalmodify", @@ -684,7 +705,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggsortop", @@ -710,7 +732,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggtranstype", @@ -736,7 +759,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggtransspace", @@ -762,7 +786,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmtranstype", @@ -788,7 +813,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggmtransspace", @@ -814,7 +840,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "agginitval", @@ -840,7 +867,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "aggminitval", @@ -866,7 +894,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -902,7 +931,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -928,7 +958,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -954,7 +985,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -980,7 +1012,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -1006,7 +1039,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -1032,7 +1066,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -1058,7 +1093,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amname", @@ -1084,7 +1120,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amhandler", @@ -1110,7 +1147,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amtype", @@ -1136,7 +1174,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -1172,7 +1211,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -1198,7 +1238,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -1224,7 +1265,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -1250,7 +1292,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -1276,7 +1319,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -1302,7 +1346,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -1328,7 +1373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopfamily", @@ -1354,7 +1400,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amoplefttype", @@ -1380,7 +1427,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amoprighttype", @@ -1406,7 +1454,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopstrategy", @@ -1432,7 +1481,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amoppurpose", @@ -1458,7 +1508,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopopr", @@ -1484,7 +1535,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopmethod", @@ -1510,7 +1562,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amopsortfamily", @@ -1536,7 +1589,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -1572,7 +1626,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -1598,7 +1653,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -1624,7 +1680,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -1650,7 +1707,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -1676,7 +1734,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -1702,7 +1761,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -1728,7 +1788,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amprocfamily", @@ -1754,7 +1815,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amproclefttype", @@ -1780,7 +1842,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amprocrighttype", @@ -1806,7 +1869,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amprocnum", @@ -1832,7 +1896,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "amproc", @@ -1858,7 +1923,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -1894,7 +1960,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -1920,7 +1987,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -1946,7 +2014,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -1972,7 +2041,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -1998,7 +2068,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -2024,7 +2095,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -2050,7 +2122,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "adrelid", @@ -2076,7 +2149,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "adnum", @@ -2102,7 +2176,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "adbin", @@ -2128,7 +2203,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -2164,7 +2240,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -2190,7 +2267,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -2216,7 +2294,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -2242,7 +2321,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -2268,7 +2348,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -2294,7 +2375,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attrelid", @@ -2320,7 +2402,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attname", @@ -2346,7 +2429,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "atttypid", @@ -2372,33 +2456,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 - }, - { - "name": "attstattarget", - "not_null": true, - "is_array": false, - "comment": "", - "length": 4, - "is_named_param": false, - "is_func_call": false, - "scope": "", - "table": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_attribute" - }, - "table_alias": "", - "type": { - "catalog": "", - "schema": "", - "name": "int4" - }, - "is_sqlc_slice": false, - "embed_table": null, - "original_name": "", - "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attlen", @@ -2424,7 +2483,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attnum", @@ -2450,10 +2510,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "attndims", + "name": "attcacheoff", "not_null": true, "is_array": false, "comment": "", @@ -2476,10 +2537,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "attcacheoff", + "name": "atttypmod", "not_null": true, "is_array": false, "comment": "", @@ -2502,14 +2564,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "atttypmod", + "name": "attndims", "not_null": true, "is_array": false, "comment": "", - "length": 4, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -2522,13 +2585,14 @@ "type": { "catalog": "", "schema": "", - "name": "int4" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attbyval", @@ -2554,7 +2618,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attalign", @@ -2580,7 +2645,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attstorage", @@ -2606,7 +2672,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attcompression", @@ -2632,7 +2699,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attnotnull", @@ -2658,7 +2726,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "atthasdef", @@ -2684,7 +2753,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "atthasmissing", @@ -2710,7 +2780,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attidentity", @@ -2736,7 +2807,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attgenerated", @@ -2762,7 +2834,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attisdropped", @@ -2788,7 +2861,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attislocal", @@ -2814,14 +2888,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attinhcount", "not_null": true, "is_array": false, "comment": "", - "length": 4, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -2834,13 +2909,41 @@ "type": { "catalog": "", "schema": "", - "name": "int4" + "name": "int2" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "attstattarget", + "not_null": true, + "is_array": false, + "comment": "", + "length": 2, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_attribute" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attcollation", @@ -2866,14 +2969,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -2886,13 +2990,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "attoptions", @@ -2912,13 +3017,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "attfdwoptions", @@ -2938,13 +3044,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "attmissingval", @@ -2970,7 +3077,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -3006,7 +3114,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -3032,7 +3141,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -3058,7 +3168,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -3084,7 +3195,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -3110,7 +3222,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -3136,7 +3249,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "oid", + "not_null": true, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "oid" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "roleid", @@ -3162,7 +3303,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "member", @@ -3188,7 +3330,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantor", @@ -3214,7 +3357,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "admin_option", @@ -3240,7 +3384,62 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "inherit_option", + "not_null": true, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "set_option", + "not_null": true, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_auth_members" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -3276,7 +3475,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -3302,7 +3502,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -3328,7 +3529,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -3354,7 +3556,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -3380,7 +3583,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -3406,7 +3610,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -3432,7 +3637,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolname", @@ -3458,7 +3664,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolsuper", @@ -3484,7 +3691,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolinherit", @@ -3510,7 +3718,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcreaterole", @@ -3536,7 +3745,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcreatedb", @@ -3562,7 +3772,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcanlogin", @@ -3588,7 +3799,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolreplication", @@ -3614,7 +3826,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolbypassrls", @@ -3640,7 +3853,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolconnlimit", @@ -3666,7 +3880,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolpassword", @@ -3692,7 +3907,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolvaliduntil", @@ -3718,7 +3934,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -3754,7 +3971,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "version", @@ -3780,7 +3998,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "installed", @@ -3806,7 +4025,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "superuser", @@ -3832,7 +4052,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trusted", @@ -3858,7 +4079,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relocatable", @@ -3884,7 +4106,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schema", @@ -3910,14 +4133,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "requires", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -3930,13 +4154,14 @@ "type": { "catalog": "", "schema": "", - "name": "_name" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "comment", @@ -3962,7 +4187,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -3998,7 +4224,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_version", @@ -4024,7 +4251,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "installed_version", @@ -4050,7 +4278,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comment", @@ -4076,7 +4305,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -4112,7 +4342,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ident", @@ -4138,7 +4369,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parent", @@ -4164,7 +4396,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "level", @@ -4190,7 +4423,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_bytes", @@ -4216,7 +4450,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_nblocks", @@ -4242,7 +4477,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "free_bytes", @@ -4268,7 +4504,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "free_chunks", @@ -4294,7 +4531,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "used_bytes", @@ -4320,7 +4558,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -4356,7 +4595,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -4382,7 +4622,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -4408,7 +4649,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -4434,7 +4676,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -4460,7 +4703,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -4486,7 +4730,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -4512,7 +4757,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "castsource", @@ -4538,7 +4784,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "casttarget", @@ -4564,7 +4811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "castfunc", @@ -4590,7 +4838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "castcontext", @@ -4616,7 +4865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "castmethod", @@ -4642,7 +4892,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -4678,7 +4929,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -4704,7 +4956,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -4730,7 +4983,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -4756,7 +5010,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -4782,7 +5037,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -4808,7 +5064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -4834,7 +5091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -4860,7 +5118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relnamespace", @@ -4886,7 +5145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reltype", @@ -4912,7 +5172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reloftype", @@ -4938,7 +5199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relowner", @@ -4964,7 +5226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relam", @@ -4990,7 +5253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relfilenode", @@ -5016,7 +5280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reltablespace", @@ -5042,7 +5307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relpages", @@ -5068,7 +5334,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reltuples", @@ -5094,7 +5361,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relallvisible", @@ -5120,7 +5388,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reltoastrelid", @@ -5146,7 +5415,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relhasindex", @@ -5172,7 +5442,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relisshared", @@ -5198,7 +5469,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relpersistence", @@ -5224,7 +5496,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relkind", @@ -5250,7 +5523,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relnatts", @@ -5276,7 +5550,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relchecks", @@ -5302,7 +5577,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relhasrules", @@ -5328,7 +5604,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relhastriggers", @@ -5354,7 +5631,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relhassubclass", @@ -5380,7 +5658,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relrowsecurity", @@ -5406,7 +5685,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relforcerowsecurity", @@ -5432,7 +5712,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relispopulated", @@ -5458,7 +5739,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relreplident", @@ -5484,7 +5766,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relispartition", @@ -5510,7 +5793,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relrewrite", @@ -5536,7 +5820,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relfrozenxid", @@ -5562,7 +5847,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relminmxid", @@ -5588,14 +5874,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -5608,13 +5895,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "reloptions", @@ -5634,13 +5922,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "relpartbound", @@ -5666,7 +5955,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -5702,7 +5992,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -5728,7 +6019,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -5754,7 +6046,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -5780,7 +6073,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -5806,7 +6100,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -5832,7 +6127,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -5858,7 +6154,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collname", @@ -5884,7 +6181,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collnamespace", @@ -5910,7 +6208,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collowner", @@ -5936,7 +6235,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collprovider", @@ -5962,7 +6262,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collisdeterministic", @@ -5988,7 +6289,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collencoding", @@ -6014,7 +6316,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collcollate", @@ -6040,7 +6343,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collctype", @@ -6066,7 +6370,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "colliculocale", @@ -6092,7 +6397,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "collicurules", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_collation" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "collversion", @@ -6118,7 +6451,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -6154,7 +6488,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setting", @@ -6180,7 +6515,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -6216,7 +6552,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -6242,7 +6579,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -6268,7 +6606,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -6294,7 +6633,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -6320,7 +6660,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -6346,7 +6687,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -6372,7 +6714,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conname", @@ -6398,7 +6741,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "connamespace", @@ -6424,7 +6768,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "contype", @@ -6450,7 +6795,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "condeferrable", @@ -6476,7 +6822,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "condeferred", @@ -6502,7 +6849,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "convalidated", @@ -6528,7 +6876,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conrelid", @@ -6554,7 +6903,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "contypid", @@ -6580,7 +6930,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conindid", @@ -6606,7 +6957,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conparentid", @@ -6632,7 +6984,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confrelid", @@ -6658,7 +7011,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confupdtype", @@ -6684,7 +7038,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confdeltype", @@ -6710,7 +7065,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confmatchtype", @@ -6736,7 +7092,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conislocal", @@ -6762,14 +7119,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "coninhcount", "not_null": true, "is_array": false, "comment": "", - "length": 4, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6782,13 +7140,14 @@ "type": { "catalog": "", "schema": "", - "name": "int4" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "connoinherit", @@ -6814,14 +7173,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conkey", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6834,20 +7194,21 @@ "type": { "catalog": "", "schema": "", - "name": "_int2" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "confkey", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6860,20 +7221,21 @@ "type": { "catalog": "", "schema": "", - "name": "_int2" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conpfeqop", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6886,20 +7248,21 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conppeqop", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6912,20 +7275,21 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conffeqop", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6938,20 +7302,21 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "confdelsetcols", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 2, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6964,20 +7329,21 @@ "type": { "catalog": "", "schema": "", - "name": "_int2" + "name": "int2" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conexclop", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -6990,13 +7356,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "conbin", @@ -7022,7 +7389,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -7058,7 +7426,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -7084,7 +7453,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -7110,7 +7480,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -7136,7 +7507,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -7162,7 +7534,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -7188,7 +7561,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -7214,7 +7588,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conname", @@ -7240,7 +7615,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "connamespace", @@ -7266,7 +7642,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conowner", @@ -7292,7 +7669,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conforencoding", @@ -7318,7 +7696,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "contoencoding", @@ -7344,7 +7723,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conproc", @@ -7370,7 +7750,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "condefault", @@ -7396,7 +7777,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -7432,7 +7814,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statement", @@ -7458,7 +7841,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_holdable", @@ -7484,7 +7868,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_binary", @@ -7510,7 +7895,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_scrollable", @@ -7536,7 +7922,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "creation_time", @@ -7562,7 +7949,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -7598,7 +7986,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -7624,7 +8013,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -7650,7 +8040,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -7676,7 +8067,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -7702,7 +8094,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -7728,7 +8121,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -7754,7 +8148,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -7780,7 +8175,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datdba", @@ -7806,7 +8202,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "encoding", @@ -7832,7 +8229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datlocprovider", @@ -7858,7 +8256,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datistemplate", @@ -7884,7 +8283,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datallowconn", @@ -7910,7 +8310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datconnlimit", @@ -7936,7 +8337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datfrozenxid", @@ -7962,7 +8364,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datminmxid", @@ -7988,7 +8391,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dattablespace", @@ -8014,7 +8418,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datcollate", @@ -8040,7 +8445,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datctype", @@ -8066,7 +8472,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "daticulocale", @@ -8092,7 +8499,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "daticurules", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_database" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "datcollversion", @@ -8118,14 +8553,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -8138,13 +8574,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -8180,7 +8617,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -8206,7 +8644,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -8232,7 +8671,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -8258,7 +8698,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -8284,7 +8725,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -8310,7 +8752,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setdatabase", @@ -8336,7 +8779,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setrole", @@ -8362,7 +8806,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setconfig", @@ -8382,13 +8827,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -8424,7 +8870,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -8450,7 +8897,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -8476,7 +8924,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -8502,7 +8951,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -8528,7 +8978,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -8554,7 +9005,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -8580,7 +9032,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "defaclrole", @@ -8606,7 +9059,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "defaclnamespace", @@ -8632,7 +9086,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "defaclobjtype", @@ -8658,14 +9113,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "defaclacl", "not_null": true, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -8678,13 +9134,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -8720,7 +9177,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -8746,7 +9204,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -8772,7 +9231,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -8798,7 +9258,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -8824,7 +9285,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -8850,7 +9312,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classid", @@ -8876,7 +9339,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objid", @@ -8902,7 +9366,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -8928,7 +9393,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refclassid", @@ -8954,7 +9420,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refobjid", @@ -8980,7 +9447,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refobjsubid", @@ -9006,7 +9474,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "deptype", @@ -9032,7 +9501,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -9068,7 +9538,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -9094,7 +9565,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -9120,7 +9592,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -9146,7 +9619,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -9172,7 +9646,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -9198,7 +9673,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -9224,7 +9700,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -9250,7 +9727,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -9276,7 +9754,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "description", @@ -9302,7 +9781,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -9338,7 +9818,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -9364,7 +9845,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -9390,7 +9872,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -9416,7 +9899,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -9442,7 +9926,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -9468,7 +9953,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -9494,7 +9980,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enumtypid", @@ -9520,7 +10007,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enumsortorder", @@ -9546,7 +10034,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enumlabel", @@ -9572,7 +10061,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -9608,7 +10098,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -9634,7 +10125,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -9660,7 +10152,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -9686,7 +10179,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -9712,7 +10206,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -9738,7 +10233,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -9764,7 +10260,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtname", @@ -9790,7 +10287,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtevent", @@ -9816,7 +10314,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtowner", @@ -9842,7 +10341,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtfoid", @@ -9868,7 +10368,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evtenabled", @@ -9894,7 +10395,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "evttags", @@ -9914,13 +10416,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -9956,7 +10459,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -9982,7 +10486,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -10008,7 +10513,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -10034,7 +10540,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -10060,7 +10567,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -10086,7 +10594,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -10112,7 +10621,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extname", @@ -10138,7 +10648,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extowner", @@ -10164,7 +10675,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extnamespace", @@ -10190,7 +10702,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extrelocatable", @@ -10216,7 +10729,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extversion", @@ -10242,14 +10756,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extconfig", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -10262,13 +10777,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "extcondition", @@ -10288,13 +10804,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -10330,7 +10847,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sourceline", @@ -10356,7 +10874,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqno", @@ -10382,7 +10901,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -10408,7 +10928,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setting", @@ -10434,7 +10955,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "applied", @@ -10460,7 +10982,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "error", @@ -10486,7 +11009,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -10522,7 +11046,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -10548,7 +11073,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -10574,7 +11100,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -10600,7 +11127,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -10626,7 +11154,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -10652,7 +11181,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -10678,7 +11208,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwname", @@ -10704,7 +11235,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwowner", @@ -10730,7 +11262,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwhandler", @@ -10756,7 +11289,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwvalidator", @@ -10782,14 +11316,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -10802,13 +11337,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "fdwoptions", @@ -10828,13 +11364,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -10870,7 +11407,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -10896,7 +11434,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -10922,7 +11461,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -10948,7 +11488,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -10974,7 +11515,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -11000,7 +11542,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -11026,7 +11569,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvname", @@ -11052,7 +11596,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvowner", @@ -11078,7 +11623,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvfdw", @@ -11104,7 +11650,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvtype", @@ -11130,7 +11677,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvversion", @@ -11156,14 +11704,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -11176,13 +11725,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "srvoptions", @@ -11202,13 +11752,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -11244,7 +11795,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -11270,7 +11822,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -11296,7 +11849,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -11322,7 +11876,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -11348,7 +11903,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -11374,7 +11930,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ftrelid", @@ -11400,7 +11957,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ftserver", @@ -11426,7 +11984,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ftoptions", @@ -11446,13 +12005,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -11488,7 +12048,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grosysid", @@ -11514,14 +12075,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grolist", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -11534,13 +12096,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -11553,7 +12116,7 @@ }, "columns": [ { - "name": "line_number", + "name": "rule_number", "not_null": false, "is_array": false, "comment": "", @@ -11576,10 +12139,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "type", + "name": "file_name", "not_null": false, "is_array": false, "comment": "", @@ -11602,14 +12166,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "database", + "name": "line_number", "not_null": false, - "is_array": true, + "is_array": false, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -11622,18 +12187,19 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "int4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "user_name", + "name": "type", "not_null": false, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -11648,18 +12214,19 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "address", + "name": "database", "not_null": false, - "is_array": false, + "is_array": true, "comment": "", "length": -1, "is_named_param": false, @@ -11680,7 +12247,62 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null + }, + { + "name": "user_name", + "not_null": false, + "is_array": true, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 1, + "type_expr": null + }, + { + "name": "address", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_hba_file_rules" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "netmask", @@ -11706,7 +12328,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "auth_method", @@ -11732,7 +12355,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "options", @@ -11752,13 +12376,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "error", @@ -11784,7 +12409,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -11796,6 +12422,60 @@ "name": "pg_ident_file_mappings" }, "columns": [ + { + "name": "map_number", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ident_file_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "file_name", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_ident_file_mappings" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, { "name": "line_number", "not_null": false, @@ -11820,7 +12500,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "map_name", @@ -11846,7 +12527,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sys_name", @@ -11872,7 +12554,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pg_username", @@ -11898,7 +12581,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "error", @@ -11924,7 +12608,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -11960,7 +12645,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -11986,7 +12672,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -12012,7 +12699,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -12038,7 +12726,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -12064,7 +12753,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -12090,7 +12780,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -12116,7 +12807,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indrelid", @@ -12142,7 +12834,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indnatts", @@ -12168,7 +12861,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indnkeyatts", @@ -12194,7 +12888,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisunique", @@ -12220,7 +12915,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indnullsnotdistinct", @@ -12246,7 +12942,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisprimary", @@ -12272,7 +12969,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisexclusion", @@ -12298,7 +12996,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indimmediate", @@ -12324,7 +13023,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisclustered", @@ -12350,7 +13050,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisvalid", @@ -12376,7 +13077,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indcheckxmin", @@ -12402,7 +13104,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisready", @@ -12428,7 +13131,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indislive", @@ -12454,7 +13158,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indisreplident", @@ -12480,12 +13185,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indkey", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -12506,12 +13212,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indcollation", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -12532,12 +13239,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indclass", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -12558,12 +13266,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indoption", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -12584,7 +13293,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexprs", @@ -12610,7 +13320,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indpred", @@ -12636,7 +13347,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -12672,7 +13384,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -12698,7 +13411,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexname", @@ -12724,7 +13438,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespace", @@ -12750,7 +13465,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexdef", @@ -12776,7 +13492,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -12812,7 +13529,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -12838,7 +13556,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -12864,7 +13583,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -12890,7 +13610,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -12916,7 +13637,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -12942,7 +13664,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inhrelid", @@ -12968,7 +13691,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inhparent", @@ -12994,7 +13718,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inhseqno", @@ -13020,7 +13745,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inhdetachpending", @@ -13046,7 +13772,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -13082,7 +13809,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -13108,7 +13836,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -13134,7 +13863,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -13160,7 +13890,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -13186,7 +13917,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -13212,7 +13944,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -13238,7 +13971,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -13264,7 +13998,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -13290,7 +14025,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privtype", @@ -13316,14 +14052,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "initprivs", "not_null": true, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -13336,13 +14073,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -13378,7 +14116,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -13404,7 +14143,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -13430,7 +14170,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -13456,7 +14197,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -13482,7 +14224,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -13508,7 +14251,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -13534,7 +14278,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanname", @@ -13560,7 +14305,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanowner", @@ -13586,7 +14332,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanispl", @@ -13612,7 +14359,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanpltrusted", @@ -13638,7 +14386,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanplcallfoid", @@ -13664,7 +14413,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "laninline", @@ -13690,7 +14440,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanvalidator", @@ -13716,14 +14467,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lanacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -13736,13 +14488,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -13778,7 +14531,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -13804,7 +14558,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -13830,7 +14585,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -13856,7 +14612,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -13882,7 +14639,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -13908,7 +14666,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "loid", @@ -13934,7 +14693,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pageno", @@ -13960,7 +14720,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data", @@ -13986,7 +14747,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -14022,7 +14784,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -14048,7 +14811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -14074,7 +14838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -14100,7 +14865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -14126,7 +14892,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -14152,7 +14919,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -14178,7 +14946,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lomowner", @@ -14204,14 +14973,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lomacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -14224,13 +14994,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -14266,7 +15037,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "database", @@ -14292,7 +15064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relation", @@ -14318,7 +15091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "page", @@ -14344,7 +15118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuple", @@ -14370,7 +15145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "virtualxid", @@ -14396,7 +15172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "transactionid", @@ -14422,7 +15199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classid", @@ -14448,7 +15226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objid", @@ -14474,7 +15253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -14500,7 +15280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "virtualtransaction", @@ -14526,7 +15307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pid", @@ -14552,7 +15334,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "mode", @@ -14578,7 +15361,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "granted", @@ -14604,7 +15388,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fastpath", @@ -14630,7 +15415,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "waitstart", @@ -14656,7 +15442,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -14692,7 +15479,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "matviewname", @@ -14718,7 +15506,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "matviewowner", @@ -14744,7 +15533,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespace", @@ -14770,7 +15560,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hasindexes", @@ -14796,7 +15587,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ispopulated", @@ -14822,7 +15614,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "definition", @@ -14848,7 +15641,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -14884,7 +15678,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -14910,7 +15705,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -14936,7 +15732,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -14962,7 +15759,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -14988,7 +15786,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -15014,7 +15813,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -15040,7 +15840,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "nspname", @@ -15066,7 +15867,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "nspowner", @@ -15092,14 +15894,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "nspacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -15112,13 +15915,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -15154,7 +15958,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -15180,7 +15985,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -15206,7 +16012,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -15232,7 +16039,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -15258,7 +16066,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -15284,7 +16093,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -15310,7 +16120,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcmethod", @@ -15336,7 +16147,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcname", @@ -15362,7 +16174,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcnamespace", @@ -15388,7 +16201,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcowner", @@ -15414,7 +16228,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcfamily", @@ -15440,7 +16255,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcintype", @@ -15466,7 +16282,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opcdefault", @@ -15492,7 +16309,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opckeytype", @@ -15518,7 +16336,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -15554,7 +16373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -15580,7 +16400,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -15606,7 +16427,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -15632,7 +16454,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -15658,7 +16481,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -15684,7 +16508,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -15710,7 +16535,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprname", @@ -15736,7 +16562,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprnamespace", @@ -15762,7 +16589,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprowner", @@ -15788,7 +16616,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprkind", @@ -15814,7 +16643,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprcanmerge", @@ -15840,7 +16670,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprcanhash", @@ -15866,7 +16697,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprleft", @@ -15892,7 +16724,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprright", @@ -15918,7 +16751,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprresult", @@ -15944,7 +16778,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprcom", @@ -15970,7 +16805,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprnegate", @@ -15996,7 +16832,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprcode", @@ -16022,7 +16859,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprrest", @@ -16048,7 +16886,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oprjoin", @@ -16074,7 +16913,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -16110,7 +16950,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -16136,7 +16977,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -16162,7 +17004,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -16188,7 +17031,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -16214,7 +17058,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -16240,7 +17085,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -16266,7 +17112,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opfmethod", @@ -16292,7 +17139,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opfname", @@ -16318,7 +17166,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opfnamespace", @@ -16344,7 +17193,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "opfowner", @@ -16370,7 +17220,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -16406,7 +17257,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -16432,7 +17284,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -16458,7 +17311,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -16484,7 +17338,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -16510,7 +17365,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -16536,7 +17392,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -16562,7 +17419,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parname", @@ -16588,14 +17446,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "paracl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -16608,13 +17467,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -16650,7 +17510,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -16676,7 +17537,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -16702,7 +17564,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -16728,7 +17591,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -16754,7 +17618,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -16780,7 +17645,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partrelid", @@ -16806,7 +17672,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partstrat", @@ -16832,7 +17699,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partnatts", @@ -16858,7 +17726,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partdefid", @@ -16884,12 +17753,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partattrs", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -16910,12 +17780,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partclass", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -16936,12 +17807,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partcollation", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -16962,7 +17834,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partexprs", @@ -16988,7 +17861,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17024,7 +17898,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -17050,7 +17925,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "policyname", @@ -17076,7 +17952,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "permissive", @@ -17102,14 +17979,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "roles", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -17122,13 +18000,14 @@ "type": { "catalog": "", "schema": "", - "name": "_name" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "cmd", @@ -17154,7 +18033,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "qual", @@ -17180,7 +18060,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "with_check", @@ -17206,7 +18087,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17242,7 +18124,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -17268,7 +18151,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -17294,7 +18178,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -17320,7 +18205,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -17346,7 +18232,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -17372,7 +18259,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -17398,7 +18286,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polname", @@ -17424,7 +18313,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polrelid", @@ -17450,7 +18340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polcmd", @@ -17476,7 +18367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polpermissive", @@ -17502,14 +18394,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polroles", "not_null": true, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -17522,13 +18415,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "polqual", @@ -17554,7 +18448,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "polwithcheck", @@ -17580,7 +18475,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17616,7 +18512,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statement", @@ -17642,7 +18539,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prepare_time", @@ -17668,14 +18566,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_types", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -17688,13 +18587,41 @@ "type": { "catalog": "", "schema": "", - "name": "_regtype" + "name": "regtype" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null + }, + { + "name": "result_types", + "not_null": false, + "is_array": true, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_prepared_statements" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "regtype" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 1, + "type_expr": null }, { "name": "from_sql", @@ -17720,7 +18647,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "generic_plans", @@ -17746,7 +18674,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "custom_plans", @@ -17772,7 +18701,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17808,7 +18738,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "gid", @@ -17834,7 +18765,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prepared", @@ -17860,7 +18792,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "owner", @@ -17886,7 +18819,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "database", @@ -17912,7 +18846,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -17948,7 +18883,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -17974,7 +18910,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -18000,7 +18937,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -18026,7 +18964,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -18052,7 +18991,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -18078,7 +19018,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -18104,7 +19045,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proname", @@ -18130,7 +19072,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pronamespace", @@ -18156,7 +19099,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proowner", @@ -18182,7 +19126,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prolang", @@ -18208,7 +19153,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "procost", @@ -18234,7 +19180,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prorows", @@ -18260,7 +19207,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provariadic", @@ -18286,7 +19234,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prosupport", @@ -18312,7 +19261,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prokind", @@ -18338,7 +19288,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prosecdef", @@ -18364,7 +19315,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proleakproof", @@ -18390,7 +19342,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proisstrict", @@ -18416,7 +19369,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proretset", @@ -18442,7 +19396,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provolatile", @@ -18468,7 +19423,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proparallel", @@ -18494,7 +19450,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pronargs", @@ -18520,7 +19477,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pronargdefaults", @@ -18546,7 +19504,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prorettype", @@ -18572,12 +19531,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proargtypes", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -18598,14 +19558,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proallargtypes", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -18618,20 +19579,21 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "proargmodes", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 1, "is_named_param": false, "is_func_call": false, "scope": "", @@ -18644,13 +19606,14 @@ "type": { "catalog": "", "schema": "", - "name": "_char" + "name": "char" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "proargnames", @@ -18670,13 +19633,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "proargdefaults", @@ -18702,14 +19666,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "protrftypes", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -18722,13 +19687,14 @@ "type": { "catalog": "", "schema": "", - "name": "_oid" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "prosrc", @@ -18754,7 +19720,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "probin", @@ -18780,7 +19747,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prosqlbody", @@ -18806,7 +19774,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "proconfig", @@ -18826,20 +19795,21 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "proacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -18852,13 +19822,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -18894,7 +19865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -18920,7 +19892,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -18946,7 +19919,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -18972,7 +19946,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -18998,7 +19973,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -19024,7 +20000,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -19050,7 +20027,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubname", @@ -19076,7 +20054,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubowner", @@ -19102,7 +20081,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "puballtables", @@ -19128,7 +20108,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubinsert", @@ -19154,7 +20135,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubupdate", @@ -19180,7 +20162,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubdelete", @@ -19206,7 +20189,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubtruncate", @@ -19232,7 +20216,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pubviaroot", @@ -19258,7 +20243,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -19294,7 +20280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -19320,7 +20307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -19346,7 +20334,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -19372,7 +20361,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -19398,7 +20388,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -19424,7 +20415,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -19450,7 +20442,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pnpubid", @@ -19476,7 +20469,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pnnspid", @@ -19502,7 +20496,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -19538,7 +20533,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -19564,7 +20560,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -19590,7 +20587,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -19616,7 +20614,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -19642,7 +20641,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -19668,7 +20668,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -19694,7 +20695,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prpubid", @@ -19720,7 +20722,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prrelid", @@ -19746,7 +20749,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prqual", @@ -19772,12 +20776,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prattrs", "not_null": false, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -19798,7 +20803,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -19834,7 +20840,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -19860,7 +20867,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -19886,14 +20894,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attnames", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -19906,13 +20915,14 @@ "type": { "catalog": "", "schema": "", - "name": "_name" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "rowfilter", @@ -19938,7 +20948,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -19974,7 +20985,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -20000,7 +21012,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -20026,7 +21039,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -20052,7 +21066,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -20078,7 +21093,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -20104,7 +21120,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngtypid", @@ -20130,7 +21147,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngsubtype", @@ -20156,7 +21174,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngmultitypid", @@ -20182,7 +21201,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngcollation", @@ -20208,7 +21228,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngsubopc", @@ -20234,7 +21255,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngcanonical", @@ -20260,7 +21282,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rngsubdiff", @@ -20286,7 +21309,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -20322,7 +21346,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -20348,7 +21373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -20374,7 +21400,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -20400,7 +21427,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -20426,7 +21454,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -20452,7 +21481,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "roident", @@ -20478,7 +21508,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "roname", @@ -20504,7 +21535,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -20540,7 +21572,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "external_id", @@ -20566,7 +21599,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "remote_lsn", @@ -20592,7 +21626,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "local_lsn", @@ -20618,7 +21653,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -20654,7 +21690,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "plugin", @@ -20680,7 +21717,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "slot_type", @@ -20706,7 +21744,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datoid", @@ -20732,7 +21771,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "database", @@ -20758,7 +21798,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "temporary", @@ -20784,7 +21825,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "active", @@ -20810,7 +21852,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "active_pid", @@ -20836,7 +21879,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -20862,7 +21906,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "catalog_xmin", @@ -20888,7 +21933,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "restart_lsn", @@ -20914,7 +21960,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confirmed_flush_lsn", @@ -20940,7 +21987,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_status", @@ -20966,7 +22014,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "safe_wal_size", @@ -20992,7 +22041,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "two_phase", @@ -21018,7 +22068,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "conflicting", + "not_null": false, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_replication_slots" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -21054,7 +22132,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -21080,7 +22159,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -21106,7 +22186,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -21132,7 +22213,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -21158,7 +22240,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -21184,7 +22267,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -21210,7 +22294,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rulename", @@ -21236,7 +22321,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_class", @@ -21262,7 +22348,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_type", @@ -21288,7 +22375,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_enabled", @@ -21314,7 +22402,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_instead", @@ -21340,7 +22429,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_qual", @@ -21366,7 +22456,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ev_action", @@ -21392,7 +22483,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -21428,7 +22520,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolsuper", @@ -21454,7 +22547,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolinherit", @@ -21480,7 +22574,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcreaterole", @@ -21506,7 +22601,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcreatedb", @@ -21532,7 +22628,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolcanlogin", @@ -21558,7 +22655,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolreplication", @@ -21584,7 +22682,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolconnlimit", @@ -21610,7 +22709,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolpassword", @@ -21636,7 +22736,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolvaliduntil", @@ -21662,7 +22763,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolbypassrls", @@ -21688,7 +22790,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rolconfig", @@ -21708,13 +22811,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "oid", @@ -21740,7 +22844,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -21776,7 +22881,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -21802,7 +22908,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rulename", @@ -21828,7 +22935,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "definition", @@ -21854,7 +22962,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -21890,7 +22999,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -21916,7 +23026,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -21942,7 +23053,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -21968,7 +23080,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -21994,7 +23107,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -22020,7 +23134,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -22046,7 +23161,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -22072,7 +23188,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -22098,7 +23215,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provider", @@ -22124,7 +23242,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "label", @@ -22150,7 +23269,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -22186,7 +23306,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -22212,7 +23333,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -22238,7 +23360,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objtype", @@ -22264,7 +23387,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objnamespace", @@ -22290,7 +23414,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objname", @@ -22316,7 +23441,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provider", @@ -22342,7 +23468,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "label", @@ -22368,7 +23495,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -22404,7 +23532,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -22430,7 +23559,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -22456,7 +23586,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -22482,7 +23613,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -22508,7 +23640,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -22534,7 +23667,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqrelid", @@ -22560,7 +23694,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqtypid", @@ -22586,7 +23721,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqstart", @@ -22612,7 +23748,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqincrement", @@ -22638,7 +23775,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqmax", @@ -22664,7 +23802,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqmin", @@ -22690,7 +23829,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqcache", @@ -22716,7 +23856,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seqcycle", @@ -22742,7 +23883,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -22778,7 +23920,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequencename", @@ -22804,7 +23947,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequenceowner", @@ -22830,7 +23974,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -22856,7 +24001,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "start_value", @@ -22882,7 +24028,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "min_value", @@ -22908,7 +24055,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "max_value", @@ -22934,7 +24082,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "increment_by", @@ -22960,7 +24109,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cycle", @@ -22986,7 +24136,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cache_size", @@ -23012,7 +24163,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_value", @@ -23038,7 +24190,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -23074,7 +24227,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "setting", @@ -23100,7 +24254,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "unit", @@ -23126,7 +24281,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "category", @@ -23152,7 +24308,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "short_desc", @@ -23178,7 +24335,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "extra_desc", @@ -23204,7 +24362,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "context", @@ -23230,7 +24389,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "vartype", @@ -23256,7 +24416,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "source", @@ -23282,7 +24443,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "min_val", @@ -23308,7 +24470,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "max_val", @@ -23334,7 +24497,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enumvals", @@ -23354,13 +24518,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "boot_val", @@ -23386,7 +24551,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reset_val", @@ -23412,7 +24578,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sourcefile", @@ -23438,7 +24605,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sourceline", @@ -23464,7 +24632,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pending_restart", @@ -23490,7 +24659,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -23526,7 +24696,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesysid", @@ -23552,7 +24723,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usecreatedb", @@ -23578,7 +24750,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesuper", @@ -23604,7 +24777,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "userepl", @@ -23630,7 +24804,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usebypassrls", @@ -23656,7 +24831,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "passwd", @@ -23682,7 +24858,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "valuntil", @@ -23708,7 +24885,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "useconfig", @@ -23728,13 +24906,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -23770,7 +24949,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -23796,7 +24976,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -23822,7 +25003,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -23848,7 +25030,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -23874,7 +25057,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -23900,7 +25084,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dbid", @@ -23926,7 +25111,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classid", @@ -23952,7 +25138,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objid", @@ -23978,7 +25165,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objsubid", @@ -24004,7 +25192,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refclassid", @@ -24030,7 +25219,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "refobjid", @@ -24056,7 +25246,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "deptype", @@ -24082,7 +25273,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -24118,7 +25310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -24144,7 +25337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -24170,7 +25364,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -24196,7 +25391,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -24222,7 +25418,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -24248,7 +25445,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -24274,7 +25472,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -24300,7 +25499,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "description", @@ -24326,7 +25526,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -24362,7 +25563,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "off", @@ -24388,7 +25590,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "size", @@ -24414,7 +25617,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "allocated_size", @@ -24440,7 +25644,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -24476,7 +25681,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -24502,7 +25708,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -24528,7 +25735,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -24554,7 +25762,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -24580,7 +25789,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -24606,7 +25816,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "objoid", @@ -24632,7 +25843,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "classoid", @@ -24658,7 +25870,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "provider", @@ -24684,7 +25897,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "label", @@ -24710,7 +25924,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -24746,7 +25961,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -24772,7 +25988,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pid", @@ -24798,7 +26015,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "leader_pid", @@ -24824,7 +26042,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesysid", @@ -24850,7 +26069,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usename", @@ -24876,7 +26096,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "application_name", @@ -24902,7 +26123,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_addr", @@ -24928,7 +26150,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_hostname", @@ -24954,7 +26177,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_port", @@ -24980,7 +26204,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_start", @@ -25006,7 +26231,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xact_start", @@ -25032,7 +26258,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "query_start", @@ -25058,7 +26285,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "state_change", @@ -25084,7 +26312,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wait_event_type", @@ -25110,7 +26339,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wait_event", @@ -25136,7 +26366,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "state", @@ -25162,7 +26393,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_xid", @@ -25188,7 +26420,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_xmin", @@ -25214,7 +26447,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "query_id", @@ -25240,7 +26474,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "query", @@ -25266,7 +26501,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_type", @@ -25292,7 +26528,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -25328,7 +26565,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -25354,7 +26592,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -25380,7 +26619,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -25406,7 +26646,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -25432,7 +26673,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -25458,7 +26700,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_all_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_read", @@ -25484,7 +26754,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -25510,7 +26781,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -25546,7 +26818,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -25572,7 +26845,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -25598,7 +26872,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -25624,7 +26899,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_seq_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -25650,7 +26953,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -25676,10 +26980,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "idx_tup_fetch", + "name": "last_idx_scan", "not_null": false, "is_array": false, "comment": "", @@ -25696,16 +27001,17 @@ "type": { "catalog": "", "schema": "", - "name": "int8" + "name": "timestamptz" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "n_tup_ins", + "name": "idx_tup_fetch", "not_null": false, "is_array": false, "comment": "", @@ -25728,10 +27034,11 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "n_tup_upd", + "name": "n_tup_ins", "not_null": false, "is_array": false, "comment": "", @@ -25754,7 +27061,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -25780,7 +27115,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -25806,7 +27142,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "n_live_tup", @@ -25832,7 +27196,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_dead_tup", @@ -25858,7 +27223,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_mod_since_analyze", @@ -25884,7 +27250,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_ins_since_vacuum", @@ -25910,7 +27277,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_vacuum", @@ -25936,7 +27304,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autovacuum", @@ -25962,7 +27331,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_analyze", @@ -25988,7 +27358,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autoanalyze", @@ -26014,7 +27385,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "vacuum_count", @@ -26040,7 +27412,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autovacuum_count", @@ -26066,7 +27439,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "analyze_count", @@ -26092,7 +27466,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autoanalyze_count", @@ -26118,7 +27493,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -26154,7 +27530,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_archived_wal", @@ -26180,7 +27557,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_archived_time", @@ -26206,7 +27584,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "failed_count", @@ -26232,7 +27611,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_failed_wal", @@ -26258,7 +27638,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_failed_time", @@ -26284,7 +27665,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -26310,7 +27692,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -26346,7 +27729,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checkpoints_req", @@ -26372,7 +27756,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checkpoint_write_time", @@ -26398,7 +27783,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checkpoint_sync_time", @@ -26424,7 +27810,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_checkpoint", @@ -26450,7 +27837,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_clean", @@ -26476,7 +27864,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maxwritten_clean", @@ -26502,7 +27891,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_backend", @@ -26528,7 +27918,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_backend_fsync", @@ -26554,7 +27945,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "buffers_alloc", @@ -26580,7 +27972,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -26606,7 +27999,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -26642,7 +28036,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -26668,7 +28063,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numbackends", @@ -26694,7 +28090,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xact_commit", @@ -26720,7 +28117,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xact_rollback", @@ -26746,7 +28144,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -26772,7 +28171,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -26798,7 +28198,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_returned", @@ -26824,7 +28225,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_fetched", @@ -26850,7 +28252,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_inserted", @@ -26876,7 +28279,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_updated", @@ -26902,7 +28306,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tup_deleted", @@ -26928,7 +28333,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conflicts", @@ -26954,7 +28360,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "temp_files", @@ -26980,7 +28387,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "temp_bytes", @@ -27006,7 +28414,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "deadlocks", @@ -27032,7 +28441,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checksum_failures", @@ -27058,7 +28468,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "checksum_last_failure", @@ -27084,7 +28495,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blk_read_time", @@ -27110,7 +28522,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blk_write_time", @@ -27136,7 +28549,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "session_time", @@ -27162,7 +28576,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "active_time", @@ -27188,7 +28603,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idle_in_transaction_time", @@ -27214,7 +28630,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sessions", @@ -27240,7 +28657,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sessions_abandoned", @@ -27266,7 +28684,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sessions_fatal", @@ -27292,7 +28711,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sessions_killed", @@ -27318,7 +28738,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -27344,7 +28765,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -27380,7 +28802,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -27406,7 +28829,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_tablespace", @@ -27432,7 +28856,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_lock", @@ -27458,7 +28883,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_snapshot", @@ -27484,7 +28910,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_bufferpin", @@ -27510,7 +28937,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "confl_deadlock", @@ -27536,7 +28964,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "confl_active_logicalslot", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_database_conflicts" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -27572,7 +29028,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "gss_authenticated", @@ -27598,7 +29055,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "principal", @@ -27624,7 +29082,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "encrypted", @@ -27650,7 +29109,531 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "credentials_delegated", + "not_null": false, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_gssapi" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "columns": [ + { + "name": "backend_type", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "object", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "context", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "reads", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "read_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "writes", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "write_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "writebacks", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "writeback_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "extends", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "extend_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "op_bytes", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "hits", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "evictions", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "reuses", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "fsyncs", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "fsync_time", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "float8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "stats_reset", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_io" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -27686,7 +29669,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -27712,7 +29696,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -27738,7 +29723,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -27764,7 +29750,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -27790,7 +29777,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sample_blks_total", @@ -27816,7 +29804,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sample_blks_scanned", @@ -27842,7 +29831,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ext_stats_total", @@ -27868,7 +29858,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ext_stats_computed", @@ -27894,7 +29885,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "child_tables_total", @@ -27920,7 +29912,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "child_tables_done", @@ -27946,7 +29939,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "current_child_table_relid", @@ -27972,7 +29966,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -28008,7 +30003,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -28034,7 +30030,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backup_total", @@ -28060,7 +30057,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backup_streamed", @@ -28086,7 +30084,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespaces_total", @@ -28112,7 +30111,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespaces_streamed", @@ -28138,7 +30138,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -28174,7 +30175,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -28200,7 +30202,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -28226,7 +30229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -28252,7 +30256,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "command", @@ -28278,7 +30283,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -28304,7 +30310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cluster_index_relid", @@ -28330,7 +30337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_tuples_scanned", @@ -28356,7 +30364,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_tuples_written", @@ -28382,7 +30391,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_total", @@ -28408,7 +30418,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_scanned", @@ -28434,7 +30445,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "index_rebuild_count", @@ -28460,7 +30472,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -28496,7 +30509,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -28522,7 +30536,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -28548,7 +30563,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -28574,7 +30590,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "command", @@ -28600,7 +30617,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "type", @@ -28626,7 +30644,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bytes_processed", @@ -28652,7 +30671,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bytes_total", @@ -28678,7 +30698,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuples_processed", @@ -28704,7 +30725,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuples_excluded", @@ -28730,7 +30752,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -28766,7 +30789,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -28792,7 +30816,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -28818,7 +30843,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -28844,7 +30870,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "index_relid", @@ -28870,7 +30897,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "command", @@ -28896,7 +30924,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -28922,7 +30951,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lockers_total", @@ -28948,7 +30978,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "lockers_done", @@ -28974,7 +31005,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "current_locker_pid", @@ -29000,7 +31032,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blocks_total", @@ -29026,7 +31059,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blocks_done", @@ -29052,7 +31086,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuples_total", @@ -29078,7 +31113,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tuples_done", @@ -29104,7 +31140,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partitions_total", @@ -29130,7 +31167,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "partitions_done", @@ -29156,7 +31194,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -29192,7 +31231,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datid", @@ -29218,7 +31258,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datname", @@ -29244,7 +31285,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -29270,7 +31312,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "phase", @@ -29296,7 +31339,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_total", @@ -29322,7 +31366,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_scanned", @@ -29348,7 +31393,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_vacuumed", @@ -29374,7 +31420,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "index_vacuum_count", @@ -29400,7 +31447,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "max_dead_tuples", @@ -29426,7 +31474,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "num_dead_tuples", @@ -29452,7 +31501,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -29488,7 +31538,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prefetch", @@ -29514,7 +31565,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hit", @@ -29540,7 +31592,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "skip_init", @@ -29566,7 +31619,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "skip_new", @@ -29592,7 +31646,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "skip_fpw", @@ -29618,7 +31673,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "skip_rep", @@ -29644,7 +31700,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_distance", @@ -29670,7 +31727,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "block_distance", @@ -29696,7 +31754,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "io_depth", @@ -29722,7 +31781,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -29758,7 +31818,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesysid", @@ -29784,7 +31845,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usename", @@ -29810,7 +31872,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "application_name", @@ -29836,7 +31899,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_addr", @@ -29862,7 +31926,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_hostname", @@ -29888,7 +31953,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "client_port", @@ -29914,7 +31980,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_start", @@ -29940,7 +32007,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "backend_xmin", @@ -29966,7 +32034,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "state", @@ -29992,7 +32061,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sent_lsn", @@ -30018,7 +32088,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "write_lsn", @@ -30044,7 +32115,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "flush_lsn", @@ -30070,7 +32142,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "replay_lsn", @@ -30096,7 +32169,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "write_lag", @@ -30122,7 +32196,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "flush_lag", @@ -30148,7 +32223,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "replay_lag", @@ -30174,7 +32250,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sync_priority", @@ -30200,7 +32277,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sync_state", @@ -30226,7 +32304,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reply_time", @@ -30252,7 +32331,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -30288,7 +32368,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spill_txns", @@ -30314,7 +32395,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spill_count", @@ -30340,7 +32422,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spill_bytes", @@ -30366,7 +32449,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stream_txns", @@ -30392,7 +32476,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stream_count", @@ -30418,7 +32503,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stream_bytes", @@ -30444,7 +32530,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_txns", @@ -30470,7 +32557,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_bytes", @@ -30496,7 +32584,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -30522,7 +32611,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -30558,7 +32648,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_zeroed", @@ -30584,7 +32675,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -30610,7 +32702,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -30636,7 +32729,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_written", @@ -30662,7 +32756,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_exists", @@ -30688,7 +32783,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "flushes", @@ -30714,7 +32810,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "truncates", @@ -30740,7 +32837,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -30766,7 +32864,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -30802,7 +32901,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ssl", @@ -30828,7 +32928,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "version", @@ -30854,7 +32955,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cipher", @@ -30880,10 +32982,129 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 - }, + "array_dims": 0, + "type_expr": null + }, + { + "name": "bits", + "not_null": false, + "is_array": false, + "comment": "", + "length": 4, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_ssl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int4" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "client_dn", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_ssl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "client_serial", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_ssl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "numeric" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "issuer_dn", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_ssl" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + } + ], + "comment": "" + }, + { + "rel": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_subscription" + }, + "columns": [ { - "name": "bits", + "name": "subid", "not_null": false, "is_array": false, "comment": "", @@ -30894,114 +33115,27 @@ "table": { "catalog": "pg_catalog", "schema": "pg_catalog", - "name": "pg_stat_ssl" - }, - "table_alias": "", - "type": { - "catalog": "", - "schema": "", - "name": "int4" - }, - "is_sqlc_slice": false, - "embed_table": null, - "original_name": "", - "unsigned": false, - "array_dims": 0 - }, - { - "name": "client_dn", - "not_null": false, - "is_array": false, - "comment": "", - "length": -1, - "is_named_param": false, - "is_func_call": false, - "scope": "", - "table": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_stat_ssl" - }, - "table_alias": "", - "type": { - "catalog": "", - "schema": "", - "name": "text" - }, - "is_sqlc_slice": false, - "embed_table": null, - "original_name": "", - "unsigned": false, - "array_dims": 0 - }, - { - "name": "client_serial", - "not_null": false, - "is_array": false, - "comment": "", - "length": -1, - "is_named_param": false, - "is_func_call": false, - "scope": "", - "table": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_stat_ssl" + "name": "pg_stat_subscription" }, "table_alias": "", "type": { "catalog": "", "schema": "", - "name": "numeric" + "name": "oid" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "issuer_dn", - "not_null": false, - "is_array": false, - "comment": "", - "length": -1, - "is_named_param": false, - "is_func_call": false, - "scope": "", - "table": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_stat_ssl" - }, - "table_alias": "", - "type": { - "catalog": "", - "schema": "", - "name": "text" - }, - "is_sqlc_slice": false, - "embed_table": null, - "original_name": "", - "unsigned": false, - "array_dims": 0 - } - ], - "comment": "" - }, - { - "rel": { - "catalog": "pg_catalog", - "schema": "pg_catalog", - "name": "pg_stat_subscription" - }, - "columns": [ - { - "name": "subid", + "name": "subname", "not_null": false, "is_array": false, "comment": "", - "length": 4, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -31014,20 +33148,21 @@ "type": { "catalog": "", "schema": "", - "name": "oid" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "subname", + "name": "pid", "not_null": false, "is_array": false, "comment": "", - "length": 64, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -31040,16 +33175,17 @@ "type": { "catalog": "", "schema": "", - "name": "name" + "name": "int4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { - "name": "pid", + "name": "leader_pid", "not_null": false, "is_array": false, "comment": "", @@ -31072,7 +33208,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relid", @@ -31098,7 +33235,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "received_lsn", @@ -31124,7 +33262,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_msg_send_time", @@ -31150,7 +33289,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_msg_receipt_time", @@ -31176,7 +33316,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "latest_end_lsn", @@ -31202,7 +33343,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "latest_end_time", @@ -31228,7 +33370,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -31264,7 +33407,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subname", @@ -31290,7 +33434,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "apply_error_count", @@ -31316,7 +33461,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sync_error_count", @@ -31342,7 +33488,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -31368,7 +33515,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -31404,7 +33552,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -31430,7 +33579,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -31456,7 +33606,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -31482,7 +33633,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -31508,7 +33660,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -31534,7 +33687,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_sys_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_read", @@ -31560,7 +33741,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -31586,7 +33768,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -31622,7 +33805,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -31648,7 +33832,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -31674,7 +33859,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -31700,7 +33886,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_seq_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -31726,7 +33940,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -31752,7 +33967,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -31778,7 +34021,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -31804,7 +34048,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -31830,7 +34075,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -31856,7 +34102,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -31882,7 +34129,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "n_live_tup", @@ -31908,7 +34183,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_dead_tup", @@ -31934,7 +34210,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_mod_since_analyze", @@ -31960,7 +34237,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_ins_since_vacuum", @@ -31986,7 +34264,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_vacuum", @@ -32012,7 +34291,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autovacuum", @@ -32038,7 +34318,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_analyze", @@ -32064,7 +34345,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autoanalyze", @@ -32090,7 +34372,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "vacuum_count", @@ -32116,7 +34399,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autovacuum_count", @@ -32142,7 +34426,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "analyze_count", @@ -32168,7 +34453,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autoanalyze_count", @@ -32194,7 +34480,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -32230,7 +34517,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -32256,7 +34544,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "funcname", @@ -32282,7 +34571,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "calls", @@ -32308,7 +34598,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_time", @@ -32334,7 +34625,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "self_time", @@ -32360,7 +34652,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -32396,7 +34689,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -32422,7 +34716,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -32448,7 +34743,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -32474,7 +34770,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -32500,7 +34797,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -32526,7 +34824,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_indexes" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_read", @@ -32552,7 +34878,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -32578,7 +34905,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -32614,7 +34942,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -32640,7 +34969,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -32666,7 +34996,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -32692,7 +35023,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_seq_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -32718,7 +35077,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -32744,7 +35104,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "last_idx_scan", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "timestamptz" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -32770,7 +35158,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -32796,7 +35185,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -32822,7 +35212,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -32848,7 +35239,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -32874,7 +35266,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "n_live_tup", @@ -32900,7 +35320,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_dead_tup", @@ -32926,7 +35347,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_mod_since_analyze", @@ -32952,7 +35374,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_ins_since_vacuum", @@ -32978,7 +35401,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_vacuum", @@ -33004,7 +35428,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autovacuum", @@ -33030,7 +35455,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_analyze", @@ -33056,7 +35482,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_autoanalyze", @@ -33082,7 +35509,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "vacuum_count", @@ -33108,7 +35536,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autovacuum_count", @@ -33134,7 +35563,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "analyze_count", @@ -33160,7 +35590,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "autoanalyze_count", @@ -33186,7 +35617,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -33222,7 +35654,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_fpi", @@ -33248,7 +35681,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_bytes", @@ -33274,7 +35708,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_buffers_full", @@ -33300,7 +35735,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_write", @@ -33326,7 +35762,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_sync", @@ -33352,7 +35789,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_write_time", @@ -33378,7 +35816,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "wal_sync_time", @@ -33404,7 +35843,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stats_reset", @@ -33430,7 +35870,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -33466,7 +35907,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "status", @@ -33492,7 +35934,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "receive_start_lsn", @@ -33518,7 +35961,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "receive_start_tli", @@ -33544,7 +35988,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "written_lsn", @@ -33570,7 +36015,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "flushed_lsn", @@ -33596,7 +36042,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "received_tli", @@ -33622,7 +36069,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_msg_send_time", @@ -33648,7 +36096,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_msg_receipt_time", @@ -33674,7 +36123,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "latest_end_lsn", @@ -33700,7 +36150,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "latest_end_time", @@ -33726,7 +36177,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "slot_name", @@ -33752,7 +36204,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sender_host", @@ -33778,7 +36231,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sender_port", @@ -33804,7 +36258,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "conninfo", @@ -33830,7 +36285,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -33866,7 +36322,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -33892,7 +36349,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -33918,7 +36376,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -33944,7 +36403,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -33970,7 +36430,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -33996,7 +36457,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -34022,7 +36484,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -34048,7 +36511,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -34074,7 +36538,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -34100,7 +36565,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -34126,7 +36592,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_all_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -34162,7 +36656,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -34188,7 +36683,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -34214,7 +36710,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -34240,7 +36737,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -34266,7 +36764,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -34292,7 +36791,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -34318,7 +36818,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -34344,7 +36845,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -34370,7 +36872,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -34396,7 +36899,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -34422,7 +36926,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_sys_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -34458,7 +36990,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -34484,7 +37017,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "funcname", @@ -34510,7 +37044,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "calls", @@ -34536,7 +37071,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "total_time", @@ -34562,7 +37098,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "self_time", @@ -34588,7 +37125,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -34624,7 +37162,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -34650,7 +37189,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -34676,7 +37216,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_scan", @@ -34702,7 +37243,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "seq_tup_read", @@ -34728,7 +37270,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_scan", @@ -34754,7 +37297,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_tup_fetch", @@ -34780,7 +37324,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_ins", @@ -34806,7 +37351,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_upd", @@ -34832,7 +37378,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_del", @@ -34858,7 +37405,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_tup_hot_upd", @@ -34884,7 +37432,35 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "n_tup_newpage_upd", + "not_null": false, + "is_array": false, + "comment": "", + "length": 8, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_stat_xact_user_tables" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "int8" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -34920,7 +37496,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -34946,7 +37523,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -34972,7 +37550,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -34998,7 +37577,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -35024,7 +37604,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -35050,7 +37631,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -35076,7 +37658,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35112,7 +37695,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35138,7 +37722,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35164,7 +37749,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -35190,7 +37776,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -35216,7 +37803,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35252,7 +37840,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35278,7 +37867,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35304,7 +37894,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_read", @@ -35330,7 +37921,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_hit", @@ -35356,7 +37948,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -35382,7 +37975,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -35408,7 +38002,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_read", @@ -35434,7 +38029,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_hit", @@ -35460,7 +38056,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_read", @@ -35486,7 +38083,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_hit", @@ -35512,7 +38110,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35548,7 +38147,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -35574,7 +38174,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35600,7 +38201,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35626,7 +38228,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -35652,7 +38255,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -35678,7 +38282,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -35704,7 +38309,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35740,7 +38346,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35766,7 +38373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35792,7 +38400,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -35818,7 +38427,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -35844,7 +38454,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -35880,7 +38491,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -35906,7 +38518,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -35932,7 +38545,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_read", @@ -35958,7 +38572,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_hit", @@ -35984,7 +38599,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -36010,7 +38626,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -36036,7 +38653,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_read", @@ -36062,7 +38680,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_hit", @@ -36088,7 +38707,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_read", @@ -36114,7 +38734,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_hit", @@ -36140,7 +38761,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -36176,7 +38798,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelid", @@ -36202,7 +38825,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -36228,7 +38852,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -36254,7 +38879,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "indexrelname", @@ -36280,7 +38906,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -36306,7 +38933,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -36332,7 +38960,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -36368,7 +38997,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -36394,7 +39024,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -36420,7 +39051,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_read", @@ -36446,7 +39078,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "blks_hit", @@ -36472,7 +39105,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -36508,7 +39142,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schemaname", @@ -36534,7 +39169,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -36560,7 +39196,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_read", @@ -36586,7 +39223,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "heap_blks_hit", @@ -36612,7 +39250,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_read", @@ -36638,7 +39277,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "idx_blks_hit", @@ -36664,7 +39304,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_read", @@ -36690,7 +39331,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "toast_blks_hit", @@ -36716,7 +39358,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_read", @@ -36742,7 +39385,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tidx_blks_hit", @@ -36768,7 +39412,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -36804,7 +39449,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -36830,7 +39476,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -36856,7 +39503,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -36882,7 +39530,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -36908,7 +39557,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -36934,7 +39584,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "starelid", @@ -36960,7 +39611,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staattnum", @@ -36986,7 +39638,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stainherit", @@ -37012,7 +39665,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stanullfrac", @@ -37038,7 +39692,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stawidth", @@ -37064,7 +39719,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stadistinct", @@ -37090,7 +39746,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind1", @@ -37116,7 +39773,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind2", @@ -37142,7 +39800,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind3", @@ -37168,7 +39827,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind4", @@ -37194,7 +39854,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stakind5", @@ -37220,7 +39881,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop1", @@ -37246,7 +39908,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop2", @@ -37272,7 +39935,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop3", @@ -37298,7 +39962,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop4", @@ -37324,7 +39989,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "staop5", @@ -37350,7 +40016,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll1", @@ -37376,7 +40043,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll2", @@ -37402,7 +40070,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll3", @@ -37428,7 +40097,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll4", @@ -37454,7 +40124,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stacoll5", @@ -37480,14 +40151,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stanumbers1", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37500,20 +40172,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stanumbers2", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37526,20 +40199,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stanumbers3", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37552,20 +40226,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stanumbers4", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37578,20 +40253,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stanumbers5", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -37604,13 +40280,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stavalues1", @@ -37636,7 +40313,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stavalues2", @@ -37662,7 +40340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stavalues3", @@ -37688,7 +40367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stavalues4", @@ -37714,7 +40394,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stavalues5", @@ -37740,7 +40421,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -37776,7 +40458,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -37802,7 +40485,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -37828,7 +40512,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -37854,7 +40539,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -37880,7 +40566,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -37906,7 +40593,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -37932,7 +40620,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxrelid", @@ -37958,7 +40647,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxname", @@ -37984,7 +40674,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxnamespace", @@ -38010,7 +40701,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxowner", @@ -38036,7 +40728,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxstattarget", @@ -38062,12 +40755,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxkeys", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -38088,14 +40782,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxkind", "not_null": true, "is_array": true, "comment": "", - "length": -1, + "length": 1, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38108,13 +40803,14 @@ "type": { "catalog": "", "schema": "", - "name": "_char" + "name": "char" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "stxexprs", @@ -38140,7 +40836,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -38176,7 +40873,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -38202,7 +40900,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -38228,7 +40927,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -38254,7 +40954,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -38280,7 +40981,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -38306,7 +41008,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxoid", @@ -38332,7 +41035,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxdinherit", @@ -38358,7 +41062,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxdndistinct", @@ -38384,7 +41089,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxddependencies", @@ -38410,7 +41116,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxdmcv", @@ -38436,7 +41143,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "stxdexpr", @@ -38456,13 +41164,14 @@ "type": { "catalog": "", "schema": "", - "name": "_pg_statistic" + "name": "pg_statistic" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -38498,7 +41207,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -38524,7 +41234,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attname", @@ -38550,7 +41261,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inherited", @@ -38576,7 +41288,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "null_frac", @@ -38602,7 +41315,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "avg_width", @@ -38628,7 +41342,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_distinct", @@ -38654,7 +41369,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_vals", @@ -38680,14 +41396,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38700,13 +41417,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "histogram_bounds", @@ -38732,7 +41450,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "correlation", @@ -38758,7 +41477,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_elems", @@ -38784,14 +41504,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_elem_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38804,20 +41525,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "elem_count_histogram", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38830,13 +41552,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -38872,7 +41595,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -38898,7 +41622,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_schemaname", @@ -38924,7 +41649,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_name", @@ -38950,7 +41676,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_owner", @@ -38976,14 +41703,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attnames", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 64, "is_named_param": false, "is_func_call": false, "scope": "", @@ -38996,13 +41724,14 @@ "type": { "catalog": "", "schema": "", - "name": "_name" + "name": "name" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "exprs", @@ -39022,20 +41751,21 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "kinds", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 1, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39048,13 +41778,14 @@ "type": { "catalog": "", "schema": "", - "name": "_char" + "name": "char" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "inherited", @@ -39080,7 +41811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_distinct", @@ -39106,7 +41838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dependencies", @@ -39132,7 +41865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_vals", @@ -39152,20 +41886,21 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "most_common_val_nulls", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 1, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39178,20 +41913,21 @@ "type": { "catalog": "", "schema": "", - "name": "_bool" + "name": "bool" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "most_common_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 8, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39204,20 +41940,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float8" + "name": "float8" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "most_common_base_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 8, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39230,13 +41967,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float8" + "name": "float8" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -39272,7 +42010,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -39298,7 +42037,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_schemaname", @@ -39324,7 +42064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_name", @@ -39350,7 +42091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "statistics_owner", @@ -39376,7 +42118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "expr", @@ -39402,7 +42145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "inherited", @@ -39428,7 +42172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "null_frac", @@ -39454,7 +42199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "avg_width", @@ -39480,7 +42226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "n_distinct", @@ -39506,7 +42253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_vals", @@ -39532,14 +42280,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39552,13 +42301,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "histogram_bounds", @@ -39584,7 +42334,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "correlation", @@ -39610,7 +42361,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_elems", @@ -39636,14 +42388,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "most_common_elem_freqs", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39656,20 +42409,21 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "elem_count_histogram", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 4, "is_named_param": false, "is_func_call": false, "scope": "", @@ -39682,13 +42436,14 @@ "type": { "catalog": "", "schema": "", - "name": "_float4" + "name": "float4" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -39724,7 +42479,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -39750,7 +42506,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -39776,7 +42533,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -39802,7 +42560,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -39828,7 +42587,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -39854,7 +42614,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -39880,7 +42641,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subdbid", @@ -39906,7 +42668,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subskiplsn", @@ -39932,7 +42695,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subname", @@ -39958,7 +42722,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subowner", @@ -39984,7 +42749,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subenabled", @@ -40010,7 +42776,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subbinary", @@ -40036,7 +42803,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "substream", @@ -40056,13 +42824,14 @@ "type": { "catalog": "", "schema": "", - "name": "bool" + "name": "char" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subtwophasestate", @@ -40088,7 +42857,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subdisableonerr", @@ -40114,7 +42884,62 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null + }, + { + "name": "subpasswordrequired", + "not_null": true, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null + }, + { + "name": "subrunasowner", + "not_null": true, + "is_array": false, + "comment": "", + "length": 1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "bool" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 0, + "type_expr": null }, { "name": "subconninfo", @@ -40140,7 +42965,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subslotname", @@ -40166,7 +42992,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subsynccommit", @@ -40192,7 +43019,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "subpublications", @@ -40212,13 +43040,41 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" + }, + "is_sqlc_slice": false, + "embed_table": null, + "original_name": "", + "unsigned": false, + "array_dims": 1, + "type_expr": null + }, + { + "name": "suborigin", + "not_null": false, + "is_array": false, + "comment": "", + "length": -1, + "is_named_param": false, + "is_func_call": false, + "scope": "", + "table": { + "catalog": "pg_catalog", + "schema": "pg_catalog", + "name": "pg_subscription" + }, + "table_alias": "", + "type": { + "catalog": "", + "schema": "", + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -40254,7 +43110,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -40280,7 +43137,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -40306,7 +43164,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -40332,7 +43191,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -40358,7 +43218,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -40384,7 +43245,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srsubid", @@ -40410,7 +43272,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srrelid", @@ -40436,7 +43299,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srsubstate", @@ -40462,7 +43326,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srsublsn", @@ -40488,7 +43353,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -40524,7 +43390,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablename", @@ -40550,7 +43417,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tableowner", @@ -40576,7 +43444,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tablespace", @@ -40602,7 +43471,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hasindexes", @@ -40628,7 +43498,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hasrules", @@ -40654,7 +43525,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "hastriggers", @@ -40680,7 +43552,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "rowsecurity", @@ -40706,7 +43579,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -40742,7 +43616,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -40768,7 +43643,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -40794,7 +43670,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -40820,7 +43697,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -40846,7 +43724,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -40872,7 +43751,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -40898,7 +43778,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spcname", @@ -40924,7 +43805,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spcowner", @@ -40950,14 +43832,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "spcacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -40970,13 +43853,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "spcoptions", @@ -40996,13 +43880,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -41038,7 +43923,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "utc_offset", @@ -41064,7 +43950,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_dst", @@ -41090,7 +43977,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -41126,7 +44014,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "abbrev", @@ -41152,7 +44041,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "utc_offset", @@ -41178,7 +44068,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_dst", @@ -41204,7 +44095,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -41240,7 +44132,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -41266,7 +44159,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -41292,7 +44186,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -41318,7 +44213,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -41344,7 +44240,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -41370,7 +44267,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -41396,7 +44294,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trftype", @@ -41422,7 +44321,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trflang", @@ -41448,7 +44348,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trffromsql", @@ -41474,7 +44375,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trftosql", @@ -41500,7 +44402,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -41536,7 +44439,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -41562,7 +44466,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -41588,7 +44493,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -41614,7 +44520,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -41640,7 +44547,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -41666,7 +44574,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -41692,7 +44601,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgrelid", @@ -41718,7 +44628,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgparentid", @@ -41744,7 +44655,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgname", @@ -41770,7 +44682,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgfoid", @@ -41796,7 +44709,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgtype", @@ -41822,7 +44736,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgenabled", @@ -41848,7 +44763,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgisinternal", @@ -41874,7 +44790,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgconstrrelid", @@ -41900,7 +44817,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgconstrindid", @@ -41926,7 +44844,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgconstraint", @@ -41952,7 +44871,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgdeferrable", @@ -41978,7 +44898,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tginitdeferred", @@ -42004,7 +44925,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgnargs", @@ -42030,12 +44952,13 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgattr", "not_null": true, - "is_array": true, + "is_array": false, "comment": "", "length": -1, "is_named_param": false, @@ -42056,7 +44979,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgargs", @@ -42082,7 +45006,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgqual", @@ -42108,7 +45033,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgoldtable", @@ -42134,7 +45060,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tgnewtable", @@ -42160,7 +45087,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -42196,7 +45124,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -42222,7 +45151,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -42248,7 +45178,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -42274,7 +45205,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -42300,7 +45232,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -42326,7 +45259,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -42352,7 +45286,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cfgname", @@ -42378,7 +45313,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cfgnamespace", @@ -42404,7 +45340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cfgowner", @@ -42430,7 +45367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cfgparser", @@ -42456,7 +45394,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -42492,7 +45431,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -42518,7 +45458,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -42544,7 +45485,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -42570,7 +45512,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -42596,7 +45539,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -42622,7 +45566,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "mapcfg", @@ -42648,7 +45593,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maptokentype", @@ -42674,7 +45620,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "mapseqno", @@ -42700,7 +45647,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "mapdict", @@ -42726,7 +45674,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -42762,7 +45711,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -42788,7 +45738,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -42814,7 +45765,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -42840,7 +45792,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -42866,7 +45819,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -42892,7 +45846,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -42918,7 +45873,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dictname", @@ -42944,7 +45900,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dictnamespace", @@ -42970,7 +45927,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dictowner", @@ -42996,7 +45954,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dicttemplate", @@ -43022,7 +45981,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dictinitoption", @@ -43048,7 +46008,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -43084,7 +46045,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -43110,7 +46072,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -43136,7 +46099,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -43162,7 +46126,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -43188,7 +46153,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -43214,7 +46180,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -43240,7 +46207,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsname", @@ -43266,7 +46234,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsnamespace", @@ -43292,7 +46261,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsstart", @@ -43318,7 +46288,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prstoken", @@ -43344,7 +46315,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsend", @@ -43370,7 +46342,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prsheadline", @@ -43396,7 +46369,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "prslextype", @@ -43422,7 +46396,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -43458,7 +46433,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -43484,7 +46460,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -43510,7 +46487,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -43536,7 +46514,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -43562,7 +46541,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -43588,7 +46568,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -43614,7 +46595,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tmplname", @@ -43640,7 +46622,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tmplnamespace", @@ -43666,7 +46649,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tmplinit", @@ -43692,7 +46676,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "tmpllexize", @@ -43718,7 +46703,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -43754,7 +46740,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -43780,7 +46767,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -43806,7 +46794,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -43832,7 +46821,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -43858,7 +46848,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -43884,7 +46875,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -43910,7 +46902,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typname", @@ -43936,7 +46929,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typnamespace", @@ -43962,7 +46956,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typowner", @@ -43988,7 +46983,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typlen", @@ -44014,7 +47010,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typbyval", @@ -44040,7 +47037,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typtype", @@ -44066,7 +47064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typcategory", @@ -44092,7 +47091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typispreferred", @@ -44118,7 +47118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typisdefined", @@ -44144,7 +47145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typdelim", @@ -44170,7 +47172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typrelid", @@ -44196,7 +47199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typsubscript", @@ -44222,7 +47226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typelem", @@ -44248,7 +47253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typarray", @@ -44274,7 +47280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typinput", @@ -44300,7 +47307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typoutput", @@ -44326,7 +47334,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typreceive", @@ -44352,7 +47361,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typsend", @@ -44378,7 +47388,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typmodin", @@ -44404,7 +47415,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typmodout", @@ -44430,7 +47442,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typanalyze", @@ -44456,7 +47469,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typalign", @@ -44482,7 +47496,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typstorage", @@ -44508,7 +47523,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typnotnull", @@ -44534,7 +47550,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typbasetype", @@ -44560,7 +47577,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typtypmod", @@ -44586,7 +47604,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typndims", @@ -44612,7 +47631,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typcollation", @@ -44638,7 +47658,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typdefaultbin", @@ -44664,7 +47685,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typdefault", @@ -44690,14 +47712,15 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "typacl", "not_null": false, "is_array": true, "comment": "", - "length": -1, + "length": 16, "is_named_param": false, "is_func_call": false, "scope": "", @@ -44710,13 +47733,14 @@ "type": { "catalog": "", "schema": "", - "name": "_aclitem" + "name": "aclitem" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -44752,7 +47776,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesysid", @@ -44778,7 +47803,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usecreatedb", @@ -44804,7 +47830,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usesuper", @@ -44830,7 +47857,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "userepl", @@ -44856,7 +47884,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usebypassrls", @@ -44882,7 +47911,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "passwd", @@ -44908,7 +47938,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "valuntil", @@ -44934,7 +47965,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "useconfig", @@ -44954,13 +47986,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -44996,7 +48029,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -45022,7 +48056,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -45048,7 +48083,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -45074,7 +48110,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -45100,7 +48137,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -45126,7 +48164,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "oid", @@ -45152,7 +48191,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umuser", @@ -45178,7 +48218,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umserver", @@ -45204,7 +48245,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umoptions", @@ -45224,13 +48266,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -45266,7 +48309,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvid", @@ -45292,7 +48336,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvname", @@ -45318,7 +48363,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umuser", @@ -45344,7 +48390,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "usename", @@ -45370,7 +48417,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umoptions", @@ -45390,13 +48438,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -45432,7 +48481,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "viewname", @@ -45458,7 +48508,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "viewowner", @@ -45484,7 +48535,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "definition", @@ -45510,7 +48562,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -45554,7 +48607,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwowner", @@ -45580,7 +48634,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "fdwoptions", @@ -45600,13 +48655,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "foreign_data_wrapper_catalog", @@ -45632,7 +48688,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -45658,7 +48715,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -45684,7 +48742,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_language", @@ -45710,7 +48769,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -45746,7 +48806,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvoptions", @@ -45766,13 +48827,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -45798,7 +48860,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -45824,7 +48887,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_catalog", @@ -45850,7 +48914,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -45876,7 +48941,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_type", @@ -45902,7 +48968,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_version", @@ -45928,7 +48995,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -45954,7 +49022,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -45990,7 +49059,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "relname", @@ -46016,7 +49086,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attname", @@ -46042,7 +49113,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attfdwoptions", @@ -46062,13 +49134,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null } ], "comment": "" @@ -46104,7 +49177,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_schema", @@ -46130,7 +49204,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_name", @@ -46156,7 +49231,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ftoptions", @@ -46176,13 +49252,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -46208,7 +49285,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -46234,7 +49312,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -46260,7 +49339,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -46296,7 +49376,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "umoptions", @@ -46316,13 +49397,14 @@ "type": { "catalog": "", "schema": "", - "name": "_text" + "name": "text" }, "is_sqlc_slice": false, "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 1, + "type_expr": null }, { "name": "umuser", @@ -46348,7 +49430,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -46374,7 +49457,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -46400,7 +49484,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -46426,7 +49511,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "srvowner", @@ -46452,7 +49538,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -46488,7 +49575,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "role_name", @@ -46514,7 +49602,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -46540,7 +49629,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -46576,7 +49666,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "role_name", @@ -46602,7 +49693,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -46628,7 +49720,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -46664,7 +49757,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -46690,7 +49784,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -46716,7 +49811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_name", @@ -46742,7 +49838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordinal_position", @@ -46768,7 +49865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_default", @@ -46794,7 +49892,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_nullable", @@ -46820,7 +49919,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -46846,7 +49946,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -46872,7 +49973,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -46898,7 +50000,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -46924,7 +50027,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -46950,7 +50054,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -46976,7 +50081,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -47002,7 +50108,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -47028,7 +50135,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -47054,7 +50162,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -47080,7 +50189,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -47106,7 +50216,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -47132,7 +50243,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -47158,7 +50270,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -47184,7 +50297,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -47210,7 +50324,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_udt_catalog", @@ -47236,7 +50351,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_udt_schema", @@ -47262,7 +50378,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "attribute_udt_name", @@ -47288,7 +50405,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -47314,7 +50432,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -47340,7 +50459,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -47366,7 +50486,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -47392,7 +50513,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -47418,7 +50540,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_derived_reference_attribute", @@ -47444,7 +50567,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -47480,7 +50604,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -47506,7 +50631,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -47532,7 +50658,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_repertoire", @@ -47558,7 +50685,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "form_of_use", @@ -47584,7 +50712,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_collate_catalog", @@ -47610,7 +50739,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_collate_schema", @@ -47636,7 +50766,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_collate_name", @@ -47662,7 +50793,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -47698,7 +50830,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -47724,7 +50857,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -47750,7 +50884,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -47776,7 +50911,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -47802,7 +50938,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -47828,7 +50965,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -47864,7 +51002,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -47890,7 +51029,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -47916,7 +51056,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "check_clause", @@ -47942,7 +51083,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -47978,7 +51120,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -48004,7 +51147,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -48030,7 +51174,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -48056,7 +51201,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -48082,7 +51228,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -48108,7 +51255,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48144,7 +51292,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -48170,7 +51319,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -48196,7 +51346,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "pad_attribute", @@ -48222,7 +51373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48258,7 +51410,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -48284,7 +51437,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -48310,7 +51464,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -48336,7 +51491,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dependent_column", @@ -48362,7 +51518,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48398,7 +51555,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -48424,7 +51582,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -48450,7 +51609,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -48476,7 +51636,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -48502,7 +51663,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -48528,7 +51690,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -48554,7 +51717,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48590,7 +51754,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -48616,7 +51781,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -48642,7 +51808,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -48668,7 +51835,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -48694,7 +51862,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -48720,7 +51889,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48756,7 +51926,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -48782,7 +51953,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -48808,7 +51980,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -48834,7 +52007,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -48860,7 +52034,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -48886,7 +52061,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -48912,7 +52088,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -48938,7 +52115,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -48974,7 +52152,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -49000,7 +52179,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -49026,7 +52206,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -49052,7 +52233,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -49078,7 +52260,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -49104,7 +52287,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -49130,7 +52314,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -49166,7 +52351,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -49192,7 +52378,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -49218,7 +52405,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -49244,7 +52432,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordinal_position", @@ -49270,7 +52459,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_default", @@ -49296,7 +52486,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_nullable", @@ -49322,7 +52513,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -49348,7 +52540,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -49374,7 +52567,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -49400,7 +52594,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -49426,7 +52621,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -49452,7 +52648,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -49478,7 +52675,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -49504,7 +52702,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -49530,7 +52729,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -49556,7 +52756,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -49582,7 +52783,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -49608,7 +52810,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -49634,7 +52837,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -49660,7 +52864,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -49686,7 +52891,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -49712,7 +52918,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_catalog", @@ -49738,7 +52945,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -49764,7 +52972,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -49790,7 +52999,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -49816,7 +53026,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -49842,7 +53053,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -49868,7 +53080,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -49894,7 +53107,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -49920,7 +53134,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -49946,7 +53161,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -49972,7 +53188,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -49998,7 +53215,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_self_referencing", @@ -50024,7 +53242,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_identity", @@ -50050,7 +53269,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_generation", @@ -50076,7 +53296,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_start", @@ -50102,7 +53323,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_increment", @@ -50128,7 +53350,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_maximum", @@ -50154,7 +53377,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_minimum", @@ -50180,7 +53404,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "identity_cycle", @@ -50206,7 +53431,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_generated", @@ -50232,7 +53458,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "generation_expression", @@ -50258,7 +53485,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_updatable", @@ -50284,7 +53512,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -50320,7 +53549,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -50346,7 +53576,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -50372,7 +53603,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -50398,7 +53630,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_catalog", @@ -50424,7 +53657,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -50450,7 +53684,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -50476,7 +53711,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -50512,7 +53748,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -50538,7 +53775,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -50564,7 +53802,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_catalog", @@ -50590,7 +53829,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -50616,7 +53856,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -50642,7 +53883,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -50678,7 +53920,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_schema", @@ -50704,7 +53947,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_name", @@ -50730,7 +53974,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_type", @@ -50756,7 +54001,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -50782,7 +54028,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -50818,7 +54065,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -50844,7 +54092,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -50870,7 +54119,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_catalog", @@ -50896,7 +54146,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -50922,7 +54173,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -50948,7 +54200,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_deferrable", @@ -50974,7 +54227,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "initially_deferred", @@ -51000,7 +54254,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -51036,7 +54291,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -51062,7 +54318,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -51088,7 +54345,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_catalog", @@ -51114,7 +54372,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -51140,7 +54399,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -51166,7 +54426,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -51202,7 +54463,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_schema", @@ -51228,7 +54490,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_name", @@ -51254,7 +54517,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -51280,7 +54544,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -51306,7 +54571,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -51332,7 +54598,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -51358,7 +54625,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -51384,7 +54652,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -51410,7 +54679,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -51436,7 +54706,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -51462,7 +54733,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -51488,7 +54760,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -51514,7 +54787,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -51540,7 +54814,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -51566,7 +54841,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -51592,7 +54868,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -51618,7 +54895,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -51644,7 +54922,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_default", @@ -51670,7 +54949,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -51696,7 +54976,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -51722,7 +55003,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -51748,7 +55030,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -51774,7 +55057,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -51800,7 +55084,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -51826,7 +55111,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -51852,7 +55138,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -51878,7 +55165,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -51914,7 +55202,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_schema", @@ -51940,7 +55229,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_name", @@ -51966,7 +55256,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_type", @@ -51992,7 +55283,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collection_type_identifier", @@ -52018,7 +55310,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -52044,7 +55337,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -52070,7 +55364,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -52096,7 +55391,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -52122,7 +55418,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -52148,7 +55445,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -52174,7 +55472,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -52200,7 +55499,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -52226,7 +55526,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -52252,7 +55553,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -52278,7 +55580,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -52304,7 +55607,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -52330,7 +55634,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -52356,7 +55661,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -52382,7 +55688,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -52408,7 +55715,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "domain_default", @@ -52434,7 +55742,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -52460,7 +55769,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -52486,7 +55796,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -52512,7 +55823,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -52538,7 +55850,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -52564,7 +55877,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -52590,7 +55904,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -52616,7 +55931,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -52642,7 +55958,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -52678,7 +55995,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -52714,7 +56032,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -52740,7 +56059,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -52766,7 +56086,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -52792,7 +56113,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -52828,7 +56150,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -52854,7 +56177,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -52880,7 +56204,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "library_name", @@ -52906,7 +56231,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_language", @@ -52932,7 +56258,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -52968,7 +56295,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -52994,7 +56322,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -53020,7 +56349,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -53046,7 +56376,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53082,7 +56413,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -53108,7 +56440,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_catalog", @@ -53134,7 +56467,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_data_wrapper_name", @@ -53160,7 +56494,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_type", @@ -53186,7 +56521,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_version", @@ -53212,7 +56548,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "authorization_identifier", @@ -53238,7 +56575,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53274,7 +56612,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_schema", @@ -53300,7 +56639,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_name", @@ -53326,7 +56666,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -53352,7 +56693,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -53378,7 +56720,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53414,7 +56757,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_schema", @@ -53440,7 +56784,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_table_name", @@ -53466,7 +56811,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -53492,7 +56838,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -53518,7 +56865,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53554,7 +56902,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53590,7 +56939,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -53616,7 +56966,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -53642,7 +56993,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -53668,7 +57020,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -53694,7 +57047,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -53720,7 +57074,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -53746,7 +57101,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordinal_position", @@ -53772,7 +57128,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "position_in_unique_constraint", @@ -53798,7 +57155,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -53834,7 +57192,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -53860,7 +57219,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -53886,7 +57246,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordinal_position", @@ -53912,7 +57273,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_mode", @@ -53938,7 +57300,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_result", @@ -53964,7 +57327,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "as_locator", @@ -53990,7 +57354,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_name", @@ -54016,7 +57381,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -54042,7 +57408,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -54068,7 +57435,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -54094,7 +57462,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -54120,7 +57489,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -54146,7 +57516,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -54172,7 +57543,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -54198,7 +57570,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -54224,7 +57597,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -54250,7 +57624,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -54276,7 +57651,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -54302,7 +57678,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -54328,7 +57705,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -54354,7 +57732,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -54380,7 +57759,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -54406,7 +57786,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -54432,7 +57813,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -54458,7 +57840,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -54484,7 +57867,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -54510,7 +57894,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -54536,7 +57921,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -54562,7 +57948,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -54588,7 +57975,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -54614,7 +58002,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_default", @@ -54640,7 +58029,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -54676,7 +58066,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -54702,7 +58093,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -54728,7 +58120,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "unique_constraint_catalog", @@ -54754,7 +58147,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "unique_constraint_schema", @@ -54780,7 +58174,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "unique_constraint_name", @@ -54806,7 +58201,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "match_option", @@ -54832,7 +58228,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "update_rule", @@ -54858,7 +58255,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "delete_rule", @@ -54884,7 +58282,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -54920,7 +58319,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -54946,7 +58346,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -54972,7 +58373,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -54998,7 +58400,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -55024,7 +58427,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -55050,7 +58454,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55076,7 +58481,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55102,7 +58508,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -55138,7 +58545,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -55164,7 +58572,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -55190,7 +58599,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -55216,7 +58626,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -55242,7 +58653,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -55268,7 +58680,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -55294,7 +58707,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -55320,7 +58734,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55346,7 +58761,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55372,7 +58788,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -55408,7 +58825,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -55434,7 +58852,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -55460,7 +58879,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -55486,7 +58906,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -55512,7 +58933,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55538,7 +58960,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55564,7 +58987,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "with_hierarchy", @@ -55590,7 +59014,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -55626,7 +59051,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -55652,7 +59078,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -55678,7 +59105,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -55704,7 +59132,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -55730,7 +59159,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55756,7 +59186,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -55782,7 +59213,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -55818,7 +59250,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -55844,7 +59277,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_catalog", @@ -55870,7 +59304,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_schema", @@ -55896,7 +59331,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_name", @@ -55922,7 +59358,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_type", @@ -55948,7 +59385,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -55974,7 +59412,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -56000,7 +59439,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56036,7 +59476,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -56062,7 +59503,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -56088,7 +59530,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -56114,7 +59557,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -56140,7 +59584,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -56166,7 +59611,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -56192,7 +59638,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -56218,7 +59665,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -56244,7 +59692,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -56270,7 +59719,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56306,7 +59756,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -56332,7 +59783,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -56358,7 +59810,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -56384,7 +59837,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -56410,7 +59864,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -56436,7 +59891,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -56462,7 +59918,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -56488,7 +59945,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -56514,7 +59972,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -56540,7 +59999,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56576,7 +60036,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -56602,7 +60063,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -56628,7 +60090,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -56654,7 +60117,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -56680,7 +60144,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -56706,7 +60171,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56742,7 +60208,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -56768,7 +60235,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -56794,7 +60262,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -56820,7 +60289,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -56846,7 +60316,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -56872,7 +60343,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_catalog", @@ -56898,7 +60370,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_schema", @@ -56924,7 +60397,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_name", @@ -56950,7 +60424,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -56986,7 +60461,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -57012,7 +60488,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -57038,7 +60515,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -57064,7 +60542,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -57090,7 +60569,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -57116,7 +60596,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -57142,7 +60623,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -57168,7 +60650,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -57194,7 +60677,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -57230,7 +60714,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -57256,7 +60741,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -57282,7 +60768,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_catalog", @@ -57308,7 +60795,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_schema", @@ -57334,7 +60822,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_name", @@ -57360,7 +60849,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_type", @@ -57386,7 +60876,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "module_catalog", @@ -57412,7 +60903,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "module_schema", @@ -57438,7 +60930,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "module_name", @@ -57464,7 +60957,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -57490,7 +60984,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -57516,7 +61011,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -57542,7 +61038,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -57568,7 +61065,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -57594,7 +61092,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -57620,7 +61119,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -57646,7 +61146,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -57672,7 +61173,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -57698,7 +61200,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -57724,7 +61227,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -57750,7 +61254,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -57776,7 +61281,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -57802,7 +61308,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -57828,7 +61335,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -57854,7 +61362,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -57880,7 +61389,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -57906,7 +61416,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -57932,7 +61443,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "type_udt_catalog", @@ -57958,7 +61470,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "type_udt_schema", @@ -57984,7 +61497,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "type_udt_name", @@ -58010,7 +61524,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_catalog", @@ -58036,7 +61551,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_schema", @@ -58062,7 +61578,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "scope_name", @@ -58088,7 +61605,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_cardinality", @@ -58114,7 +61632,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "dtd_identifier", @@ -58140,7 +61659,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_body", @@ -58166,7 +61686,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "routine_definition", @@ -58192,7 +61713,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "external_name", @@ -58218,7 +61740,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "external_language", @@ -58244,7 +61767,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "parameter_style", @@ -58270,7 +61794,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_deterministic", @@ -58296,7 +61821,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sql_data_access", @@ -58322,7 +61848,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_null_call", @@ -58348,7 +61875,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sql_path", @@ -58374,7 +61902,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schema_level_routine", @@ -58400,7 +61929,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "max_dynamic_result_sets", @@ -58426,7 +61956,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_user_defined_cast", @@ -58452,7 +61983,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_implicitly_invocable", @@ -58478,7 +62010,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "security_type", @@ -58504,7 +62037,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "to_sql_specific_catalog", @@ -58530,7 +62064,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "to_sql_specific_schema", @@ -58556,7 +62091,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "to_sql_specific_name", @@ -58582,7 +62118,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "as_locator", @@ -58608,7 +62145,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "created", @@ -58634,7 +62172,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "last_altered", @@ -58660,7 +62199,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "new_savepoint_level", @@ -58686,7 +62226,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_udt_dependent", @@ -58712,7 +62253,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_from_data_type", @@ -58738,7 +62280,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_as_locator", @@ -58764,7 +62307,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_max_length", @@ -58790,7 +62334,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_octet_length", @@ -58816,7 +62361,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_set_catalog", @@ -58842,7 +62388,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_set_schema", @@ -58868,7 +62415,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_char_set_name", @@ -58894,7 +62442,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_collation_catalog", @@ -58920,7 +62469,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_collation_schema", @@ -58946,7 +62496,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_collation_name", @@ -58972,7 +62523,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_numeric_precision", @@ -58998,7 +62550,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_numeric_precision_radix", @@ -59024,7 +62577,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_numeric_scale", @@ -59050,7 +62604,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_datetime_precision", @@ -59076,7 +62631,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_interval_type", @@ -59102,7 +62658,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_interval_precision", @@ -59128,7 +62685,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_type_udt_catalog", @@ -59154,7 +62712,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_type_udt_schema", @@ -59180,7 +62739,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_type_udt_name", @@ -59206,7 +62766,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_scope_catalog", @@ -59232,7 +62793,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_scope_schema", @@ -59258,7 +62820,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_scope_name", @@ -59284,7 +62847,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_maximum_cardinality", @@ -59310,7 +62874,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "result_cast_dtd_identifier", @@ -59336,7 +62901,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -59372,7 +62938,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schema_name", @@ -59398,7 +62965,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "schema_owner", @@ -59424,7 +62992,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_character_set_catalog", @@ -59450,7 +63019,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_character_set_schema", @@ -59476,7 +63046,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "default_character_set_name", @@ -59502,7 +63073,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sql_path", @@ -59528,7 +63100,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -59564,7 +63137,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_schema", @@ -59590,7 +63164,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sequence_name", @@ -59616,7 +63191,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -59642,7 +63218,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -59668,7 +63245,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -59694,7 +63272,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -59720,7 +63299,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "start_value", @@ -59746,7 +63326,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "minimum_value", @@ -59772,7 +63353,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "maximum_value", @@ -59798,7 +63380,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "increment", @@ -59824,7 +63407,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cycle_option", @@ -59850,7 +63434,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -59886,7 +63471,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -59912,7 +63498,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -59938,7 +63525,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -59964,7 +63552,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -59990,7 +63579,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -60016,7 +63606,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "feature_id", @@ -60042,7 +63633,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "feature_name", @@ -60068,7 +63660,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sub_feature_id", @@ -60094,7 +63687,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sub_feature_name", @@ -60120,7 +63714,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_supported", @@ -60146,7 +63741,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_verified_by", @@ -60172,7 +63768,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comments", @@ -60198,7 +63795,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -60234,7 +63832,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -60260,7 +63859,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -60286,7 +63886,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -60312,7 +63913,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -60338,7 +63940,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -60364,7 +63967,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "implementation_info_id", @@ -60390,7 +63994,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "implementation_info_name", @@ -60416,7 +64021,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "integer_value", @@ -60442,7 +64048,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_value", @@ -60468,7 +64075,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comments", @@ -60494,7 +64102,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -60530,7 +64139,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -60556,7 +64166,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -60582,7 +64193,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -60608,7 +64220,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -60634,7 +64247,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -60660,7 +64274,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "feature_id", @@ -60686,7 +64301,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "feature_name", @@ -60712,7 +64328,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_supported", @@ -60738,7 +64355,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_verified_by", @@ -60764,7 +64382,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comments", @@ -60790,7 +64409,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -60826,7 +64446,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmax", @@ -60852,7 +64473,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmax", @@ -60878,7 +64500,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "cmin", @@ -60904,7 +64527,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "xmin", @@ -60930,7 +64554,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ctid", @@ -60956,7 +64581,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sizing_id", @@ -60982,7 +64608,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "sizing_name", @@ -61008,7 +64635,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "supported_value", @@ -61034,7 +64662,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "comments", @@ -61060,7 +64689,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -61096,7 +64726,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_schema", @@ -61122,7 +64753,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_name", @@ -61148,7 +64780,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -61174,7 +64807,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -61200,7 +64834,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -61226,7 +64861,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "constraint_type", @@ -61252,7 +64888,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_deferrable", @@ -61278,7 +64915,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "initially_deferred", @@ -61304,7 +64942,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "enforced", @@ -61330,7 +64969,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "nulls_distinct", @@ -61356,7 +64996,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -61392,7 +65033,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -61418,7 +65060,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -61444,7 +65087,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -61470,7 +65114,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -61496,7 +65141,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -61522,7 +65168,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -61548,7 +65195,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "with_hierarchy", @@ -61574,7 +65222,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -61610,7 +65259,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -61636,7 +65286,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -61662,7 +65313,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_type", @@ -61688,7 +65340,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "self_referencing_column_name", @@ -61714,7 +65367,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reference_generation", @@ -61740,7 +65394,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_catalog", @@ -61766,7 +65421,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_schema", @@ -61792,7 +65448,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_name", @@ -61818,7 +65475,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_insertable_into", @@ -61844,7 +65502,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_typed", @@ -61870,7 +65529,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "commit_action", @@ -61896,7 +65556,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -61932,7 +65593,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -61958,7 +65620,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -61984,7 +65647,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -62010,7 +65674,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -62036,7 +65701,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -62062,7 +65728,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "group_name", @@ -62088,7 +65755,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "transform_type", @@ -62114,7 +65782,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -62150,7 +65819,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trigger_schema", @@ -62176,7 +65846,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trigger_name", @@ -62202,7 +65873,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_catalog", @@ -62228,7 +65900,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_schema", @@ -62254,7 +65927,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_table", @@ -62280,7 +65954,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_column", @@ -62306,7 +65981,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -62342,7 +66018,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trigger_schema", @@ -62368,7 +66045,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "trigger_name", @@ -62394,7 +66072,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_manipulation", @@ -62420,7 +66099,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_catalog", @@ -62446,7 +66126,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_schema", @@ -62472,7 +66153,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "event_object_table", @@ -62498,7 +66180,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_order", @@ -62524,7 +66207,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_condition", @@ -62550,7 +66234,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_statement", @@ -62576,7 +66261,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_orientation", @@ -62602,7 +66288,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_timing", @@ -62628,7 +66315,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_reference_old_table", @@ -62654,7 +66342,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_reference_new_table", @@ -62680,7 +66369,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_reference_old_row", @@ -62706,7 +66396,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "action_reference_new_row", @@ -62732,7 +66423,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "created", @@ -62758,7 +66450,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -62794,7 +66487,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -62820,7 +66514,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_catalog", @@ -62846,7 +66541,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_schema", @@ -62872,7 +66568,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "udt_name", @@ -62898,7 +66595,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -62924,7 +66622,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -62950,7 +66649,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -62986,7 +66686,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "grantee", @@ -63012,7 +66713,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_catalog", @@ -63038,7 +66740,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_schema", @@ -63064,7 +66767,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_name", @@ -63090,7 +66794,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "object_type", @@ -63116,7 +66821,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "privilege_type", @@ -63142,7 +66848,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_grantable", @@ -63168,7 +66875,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -63204,7 +66912,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_schema", @@ -63230,7 +66939,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_name", @@ -63256,7 +66966,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "user_defined_type_category", @@ -63282,7 +66993,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_instantiable", @@ -63308,7 +67020,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_final", @@ -63334,7 +67047,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_form", @@ -63360,7 +67074,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_category", @@ -63386,7 +67101,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_routine_catalog", @@ -63412,7 +67128,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_routine_schema", @@ -63438,7 +67155,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ordering_routine_name", @@ -63464,7 +67182,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "reference_type", @@ -63490,7 +67209,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "data_type", @@ -63516,7 +67236,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_maximum_length", @@ -63542,7 +67263,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_octet_length", @@ -63568,7 +67290,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_catalog", @@ -63594,7 +67317,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_schema", @@ -63620,7 +67344,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "character_set_name", @@ -63646,7 +67371,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_catalog", @@ -63672,7 +67398,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_schema", @@ -63698,7 +67425,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "collation_name", @@ -63724,7 +67452,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision", @@ -63750,7 +67479,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_precision_radix", @@ -63776,7 +67506,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "numeric_scale", @@ -63802,7 +67533,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "datetime_precision", @@ -63828,7 +67560,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_type", @@ -63854,7 +67587,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "interval_precision", @@ -63880,7 +67614,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "source_dtd_identifier", @@ -63906,7 +67641,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "ref_dtd_identifier", @@ -63932,7 +67668,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -63968,7 +67705,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -63994,7 +67732,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -64020,7 +67759,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_name", @@ -64046,7 +67786,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "option_value", @@ -64072,7 +67813,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64108,7 +67850,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_catalog", @@ -64134,7 +67877,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "foreign_server_name", @@ -64160,7 +67904,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64196,7 +67941,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_schema", @@ -64222,7 +67968,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_name", @@ -64248,7 +67995,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -64274,7 +68022,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -64300,7 +68049,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -64326,7 +68076,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "column_name", @@ -64352,7 +68103,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64388,7 +68140,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -64414,7 +68167,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -64440,7 +68194,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_catalog", @@ -64466,7 +68221,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_schema", @@ -64492,7 +68248,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "specific_name", @@ -64518,7 +68275,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64554,7 +68312,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_schema", @@ -64580,7 +68339,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_name", @@ -64606,7 +68366,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_catalog", @@ -64632,7 +68393,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -64658,7 +68420,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -64684,7 +68447,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64720,7 +68484,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_schema", @@ -64746,7 +68511,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "table_name", @@ -64772,7 +68538,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "view_definition", @@ -64798,7 +68565,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "check_option", @@ -64824,7 +68592,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_updatable", @@ -64850,7 +68619,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_insertable_into", @@ -64876,7 +68646,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_trigger_updatable", @@ -64902,7 +68673,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_trigger_deletable", @@ -64928,7 +68700,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "is_trigger_insertable_into", @@ -64954,7 +68727,8 @@ "embed_table": null, "original_name": "", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "comment": "" @@ -64995,7 +68769,8 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -65021,7 +68796,8 @@ "embed_table": null, "original_name": "name", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bio", @@ -65047,7 +68823,8 @@ "embed_table": null, "original_name": "bio", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "params": [ @@ -65077,8 +68854,10 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 - } + "array_dims": 0, + "type_expr": null + }, + "name": "" } ], "comments": [], @@ -65114,7 +68893,8 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -65140,7 +68920,8 @@ "embed_table": null, "original_name": "name", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bio", @@ -65166,7 +68947,8 @@ "embed_table": null, "original_name": "bio", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "params": [], @@ -65203,7 +68985,8 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "name", @@ -65229,7 +69012,8 @@ "embed_table": null, "original_name": "name", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null }, { "name": "bio", @@ -65255,7 +69039,8 @@ "embed_table": null, "original_name": "bio", "unsigned": false, - "array_dims": 0 + "array_dims": 0, + "type_expr": null } ], "params": [ @@ -65285,8 +69070,10 @@ "embed_table": null, "original_name": "name", "unsigned": false, - "array_dims": 0 - } + "array_dims": 0, + "type_expr": null + }, + "name": "" }, { "number": 2, @@ -65314,8 +69101,10 @@ "embed_table": null, "original_name": "bio", "unsigned": false, - "array_dims": 0 - } + "array_dims": 0, + "type_expr": null + }, + "name": "" } ], "comments": [], @@ -65358,8 +69147,10 @@ "embed_table": null, "original_name": "id", "unsigned": false, - "array_dims": 0 - } + "array_dims": 0, + "type_expr": null + }, + "name": "" } ], "comments": [], @@ -65367,6 +69158,7 @@ "insert_into_table": null } ], - "sqlc_version": "v1.22.0", - "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" + "sqlc_version": "v1.31.1", + "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=", + "global_options": "" } diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json index 7865c9ec17..1aa4920cb9 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json @@ -1,3 +1,4 @@ { - "process": "sqlc-gen-test" -} \ No newline at end of file + "process": "sqlc-gen-test", + "os": ["linux", "darwin"] +} diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json index e58a1fbef1..48e316b1b2 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json @@ -1,6 +1,6 @@ { "env": [ - "SQLC_VERSION=v1.22.0", + "SQLC_VERSION=v1.31.1", "SQLC_DUMMY_VALUE=true" ] } diff --git a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/query.sql deleted file mode 100644 index b96c66b9b3..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; - --- name: DeleteBarByIDAndName :execrows -DELETE FROM bar WHERE id = $1 AND name = $2; diff --git a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/schema.sql deleted file mode 100644 index fd3ca97902..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/schema.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE TABLE bar (id serial not null, name text not null, primary key (id)); \ No newline at end of file diff --git a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/sqlc.json deleted file mode 100644 index d431feabb5..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/sqlc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true, - "query_parameter_limit": -1 - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/stderr.txt b/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/stderr.txt deleted file mode 100644 index efed0cc10b..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/-1/python_postgresql/stderr.txt +++ /dev/null @@ -1,2 +0,0 @@ -# package py -error generating code: error generating output: invalid query parameter limit diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/models.py b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/models.py deleted file mode 100644 index b5910b4dce..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/models.py +++ /dev/null @@ -1,10 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int - name: str diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/query.py b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/query.py deleted file mode 100644 index 82183b8839..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/python/query.py +++ /dev/null @@ -1,57 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import dataclasses - -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execrows -DELETE FROM bar WHERE id = :p1 -""" - - -@dataclasses.dataclass() -class DeleteBarByIDParams: - id: int - - -DELETE_BAR_BY_ID_AND_NAME = """-- name: delete_bar_by_id_and_name \\:execrows -DELETE FROM bar WHERE id = :p1 AND name = :p2 -""" - - -@dataclasses.dataclass() -class DeleteBarByIDAndNameParams: - id: int - name: str - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, arg: DeleteBarByIDParams) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": arg.id}) - return result.rowcount - - def delete_bar_by_id_and_name(self, arg: DeleteBarByIDAndNameParams) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), {"p1": arg.id, "p2": arg.name}) - return result.rowcount - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, arg: DeleteBarByIDParams) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": arg.id}) - return result.rowcount - - async def delete_bar_by_id_and_name(self, arg: DeleteBarByIDAndNameParams) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), {"p1": arg.id, "p2": arg.name}) - return result.rowcount diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/query.sql deleted file mode 100644 index b96c66b9b3..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; - --- name: DeleteBarByIDAndName :execrows -DELETE FROM bar WHERE id = $1 AND name = $2; diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/schema.sql deleted file mode 100644 index a27c312e36..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE bar (id serial not null, name text not null, primary key (id)); - diff --git a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/sqlc.json deleted file mode 100644 index 2bda86ec51..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/0/python_postgresql/sqlc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true, - "query_parameter_limit": 0 - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/models.py b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/models.py deleted file mode 100644 index b5910b4dce..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/models.py +++ /dev/null @@ -1,10 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int - name: str diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/query.py b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/query.py deleted file mode 100644 index e7a20a42a7..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/python/query.py +++ /dev/null @@ -1,44 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execrows -DELETE FROM bar WHERE id = :p1 -""" - - -DELETE_BAR_BY_ID_AND_NAME = """-- name: delete_bar_by_id_and_name \\:execrows -DELETE FROM bar WHERE id = :p1 AND name = :p2 -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - def delete_bar_by_id_and_name(self, *, id: int, name: str) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), {"p1": id, "p2": name}) - return result.rowcount - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - async def delete_bar_by_id_and_name(self, *, id: int, name: str) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), {"p1": id, "p2": name}) - return result.rowcount diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/query.sql deleted file mode 100644 index b96c66b9b3..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/query.sql +++ /dev/null @@ -1,5 +0,0 @@ --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; - --- name: DeleteBarByIDAndName :execrows -DELETE FROM bar WHERE id = $1 AND name = $2; diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/schema.sql deleted file mode 100644 index a27c312e36..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TABLE bar (id serial not null, name text not null, primary key (id)); - diff --git a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/sqlc.json deleted file mode 100644 index a0c6fd8680..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/2/python_postgresql/sqlc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.1.0.wasm", - "sha256": "ef58f143a8c116781091441770c7166caaf361dd645f62b8f05f462e9f95c3b2" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true, - "query_parameter_limit": 2 - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/models.py b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/models.py deleted file mode 100644 index 5c79cb3ef2..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/models.py +++ /dev/null @@ -1,12 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -import dataclasses - - -@dataclasses.dataclass() -class Bar: - id: int - name1: str - name2: str - name3: str diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/query.py b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/query.py deleted file mode 100644 index cec78b563e..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/python/query.py +++ /dev/null @@ -1,58 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.22.0 -# source: query.sql -import sqlalchemy -import sqlalchemy.ext.asyncio - -from querytest import models - - -DELETE_BAR_BY_ID = """-- name: delete_bar_by_id \\:execrows -DELETE FROM bar WHERE id = :p1 -""" - - -DELETE_BAR_BY_ID_AND_NAME = """-- name: delete_bar_by_id_and_name \\:execrows -DELETE FROM bar -WHERE id = :p1 -AND name1 = :p2 -AND name2 = :p3 -AND name3 = :p4 -""" - - -class Querier: - def __init__(self, conn: sqlalchemy.engine.Connection): - self._conn = conn - - def delete_bar_by_id(self, *, id: int) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - def delete_bar_by_id_and_name(self, *, id: int, name1: str, name2: str, name3: str) -> int: - result = self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), { - "p1": id, - "p2": name1, - "p3": name2, - "p4": name3, - }) - return result.rowcount - - -class AsyncQuerier: - def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection): - self._conn = conn - - async def delete_bar_by_id(self, *, id: int) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID), {"p1": id}) - return result.rowcount - - async def delete_bar_by_id_and_name(self, *, id: int, name1: str, name2: str, name3: str) -> int: - result = await self._conn.execute(sqlalchemy.text(DELETE_BAR_BY_ID_AND_NAME), { - "p1": id, - "p2": name1, - "p3": name2, - "p4": name3, - }) - return result.rowcount diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/query.sql deleted file mode 100644 index aea85112e0..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/query.sql +++ /dev/null @@ -1,10 +0,0 @@ --- name: DeleteBarByID :execrows -DELETE FROM bar WHERE id = $1; - --- name: DeleteBarByIDAndName :execrows -DELETE FROM bar -WHERE id = $1 -AND name1 = $2 -AND name2 = $3 -AND name3 = $4 -; diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/schema.sql deleted file mode 100644 index 1d9131f472..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE bar ( - id serial not null, - name1 text not null, - name2 text not null, - name3 text not null, - primary key (id)); - diff --git a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/sqlc.json deleted file mode 100644 index c20cad43af..0000000000 --- a/internal/endtoend/testdata/query_parameter_limit/undefined/python_postgresql/sqlc.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "2", - "plugins": [ - { - "name": "py", - "wasm": { - "url": "https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.0.0.wasm", - "sha256": "aca83e1f59f8ffdc604774c2f6f9eb321a2b23e07dc83fc12289d25305fa065b" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "plugin": "py", - "out": "python", - "options": { - "package": "querytest", - "emit_sync_querier": true, - "emit_async_querier": true - } - } - ] - } - ] -} diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql index eb10e5cb4c..a71d662465 100644 --- a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/query.sql @@ -1,11 +1,3 @@ --- Example queries for sqlc -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text, - country_code CHAR(2) NOT NULL -); - -- name: GetAuthor :one SELECT * FROM authors WHERE name = $1 AND country_code = $2 LIMIT 1; diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/schema.sql b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/schema.sql new file mode 100644 index 0000000000..6027f56d97 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/schema.sql @@ -0,0 +1,6 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text, + country_code CHAR(2) NOT NULL +); diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json index 4d1fb3f94d..c473270913 100644 --- a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "query_parameter_limit": -1 } diff --git a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt index 2f0a7a559a..9e1760ffca 100644 --- a/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt +++ b/internal/endtoend/testdata/query_parameter_limit_invalid/postgresql/stderr.txt @@ -1 +1,2 @@ -error parsing sqlc.json: invalid query parameter limit +# package querytest +error generating code: invalid options: query parameter limit must not be negative diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go index 20529a3c63..093c6ff624 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go index f9db08ebd0..fff756a0f2 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go index f920f33df2..44287c0642 100644 --- a/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go index 2d0c5f461d..e70c52a47f 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go index 9dfc90e90e..971b1efa3a 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_two/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -97,7 +97,7 @@ WHERE id IN ($2) AND name = $1 func (q *Queries) DeleteAuthors(ctx context.Context, name string, ids []int64) error { query := deleteAuthors - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, name) if len(ids) > 0 { for _, v := range ids { diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go index 64fd8386cc..7b281eb955 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go index 480c4a4ca9..568101f866 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go index a4ab8a0d7d..471b1163c7 100644 --- a/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go index b4797d1b57..9182ff94b0 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Test struct { ID string } diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go index 701d79cd7c..1e5ad1ed36 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,7 +10,7 @@ import ( ) const testList = `-- name: TestList :many -SELECT id FROM "test" +SELECT id FROM test ` func (q *Queries) TestList(ctx context.Context) ([]string, error) { diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/query.sql b/internal/endtoend/testdata/quoted_colname/sqlite/query.sql index 8b8ae15e9a..10a35f0464 100644 --- a/internal/endtoend/testdata/quoted_colname/sqlite/query.sql +++ b/internal/endtoend/testdata/quoted_colname/sqlite/query.sql @@ -1,2 +1,2 @@ -- name: TestList :many -SELECT * FROM "test"; \ No newline at end of file +SELECT * FROM test; diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/go/db.go b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/go/models.go b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/models.go new file mode 100644 index 0000000000..a1a6c48434 --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go new file mode 100644 index 0000000000..80e5d9bd3f --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/go/query.sql.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const placeholder = `-- name: Placeholder :exec +SELECT 1 +` + +func (q *Queries) Placeholder(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, placeholder) + return err +} diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/query.sql b/internal/endtoend/testdata/quoted_names_complex/sqlite/query.sql new file mode 100644 index 0000000000..6520aef4b6 --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Placeholder :exec +SELECT 1; diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/schema.sql b/internal/endtoend/testdata/quoted_names_complex/sqlite/schema.sql new file mode 100644 index 0000000000..5486831199 --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/schema.sql @@ -0,0 +1,22 @@ +-- Test complex quoted table and column names with special characters +-- Covers spaces, hyphens, uppercase, and mixed operations +CREATE TABLE "user profiles" (id integer primary key, data text); +CREATE TABLE "ORDERS" (id integer primary key, data text); +CREATE TABLE products (id integer primary key, data text); +CREATE TABLE "item-categories" (id integer primary key, data text); + +-- Test ALTER statements with complex identifiers +ALTER TABLE "user profiles" RENAME COLUMN data TO "profile data"; +ALTER TABLE "ORDERS" RENAME TO "customer_orders"; +ALTER TABLE products ADD COLUMN "Price Info" text; + +-- Test mixed case operations across different statement types +INSERT INTO "user profiles" ("profile data") VALUES ('test data'); +UPDATE "customer_orders" SET data = 'updated' WHERE id = 1; +DELETE FROM products WHERE id = 1; + +-- Test DROP with various identifier formats +DROP TABLE "user profiles"; +DROP TABLE "customer_orders"; +DROP TABLE "item-categories"; +DROP TABLE products; diff --git a/internal/endtoend/testdata/quoted_names_complex/sqlite/sqlc.json b/internal/endtoend/testdata/quoted_names_complex/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/quoted_names_complex/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/go/db.go b/internal/endtoend/testdata/quoted_tablename/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/go/models.go b/internal/endtoend/testdata/quoted_tablename/sqlite/go/models.go new file mode 100644 index 0000000000..2e3921ba30 --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type User struct { + ID string +} diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go b/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go new file mode 100644 index 0000000000..6743358ec6 --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testList = `-- name: TestList :many +SELECT id FROM users +` + +func (q *Queries) TestList(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, testList) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var id string + if err := rows.Scan(&id); err != nil { + return nil, err + } + items = append(items, id) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/query.sql b/internal/endtoend/testdata/quoted_tablename/sqlite/query.sql new file mode 100644 index 0000000000..0d3b8e238b --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: TestList :many +SELECT * FROM users; diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/schema.sql b/internal/endtoend/testdata/quoted_tablename/sqlite/schema.sql new file mode 100644 index 0000000000..078fa24bf6 --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/schema.sql @@ -0,0 +1,6 @@ +-- Example queries for sqlc +CREATE TABLE "users" +( + id TEXT NOT NULL +); + diff --git a/internal/endtoend/testdata/quoted_tablename/sqlite/sqlc.json b/internal/endtoend/testdata/quoted_tablename/sqlite/sqlc.json new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/quoted_tablename/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "schema": "schema.sql", + "queries": "query.sql", + "name": "querytest" + } + ] +} \ No newline at end of file diff --git a/internal/endtoend/testdata/ranges/pgx/v5/go/db.go b/internal/endtoend/testdata/ranges/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/ranges/pgx/v5/go/models.go b/internal/endtoend/testdata/ranges/pgx/v5/go/models.go index fb526e2635..008296ca98 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go index 35df855453..e04465f181 100644 --- a/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/ranges/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go index 2fb8f72eca..f39382e45e 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Myview struct { int32 } diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go index dc2448166c..d899ee8d86 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go index 2fb8f72eca..f39382e45e 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Myview struct { int32 } diff --git a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go index dc2448166c..d899ee8d86 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go index 77aa1bbbf3..1d4f75ae5a 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( IpProtocolIcmp IPProtocol = "icmp" ) -func (e *IPProtocol) Scan(src interface{}) error { +func (e *IPProtocol) Scan(src any) error { switch s := src.(type) { case []byte: *e = IPProtocol(s) @@ -35,7 +35,7 @@ type NullIPProtocol struct { } // Scan implements the Scanner interface. -func (ns *NullIPProtocol) Scan(value interface{}) error { +func (ns *NullIPProtocol) Scan(value any) error { if value == nil { ns.IPProtocol, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go index 531548fbb1..98787cd712 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go index 77aa1bbbf3..1d4f75ae5a 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( IpProtocolIcmp IPProtocol = "icmp" ) -func (e *IPProtocol) Scan(src interface{}) error { +func (e *IPProtocol) Scan(src any) error { switch s := src.(type) { case []byte: *e = IPProtocol(s) @@ -35,7 +35,7 @@ type NullIPProtocol struct { } // Scan implements the Scanner interface. -func (ns *NullIPProtocol) Scan(value interface{}) error { +func (ns *NullIPProtocol) Scan(value any) error { if value == nil { ns.IPProtocol, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go index 531548fbb1..98787cd712 100644 --- a/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/db.go b/internal/endtoend/testdata/rename/v1/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/go/db.go +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/models.go b/internal/endtoend/testdata/rename/v1/stdlib/go/models.go index 77aa1bbbf3..1d4f75ae5a 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/go/models.go +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( IpProtocolIcmp IPProtocol = "icmp" ) -func (e *IPProtocol) Scan(src interface{}) error { +func (e *IPProtocol) Scan(src any) error { switch s := src.(type) { case []byte: *e = IPProtocol(s) @@ -35,7 +35,7 @@ type NullIPProtocol struct { } // Scan implements the Scanner interface. -func (ns *NullIPProtocol) Scan(value interface{}) error { +func (ns *NullIPProtocol) Scan(value any) error { if value == nil { ns.IPProtocol, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go b/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go index 5c5cb30ba6..cdc74673e2 100644 --- a/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v1/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go index 77aa1bbbf3..1d4f75ae5a 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( IpProtocolIcmp IPProtocol = "icmp" ) -func (e *IPProtocol) Scan(src interface{}) error { +func (e *IPProtocol) Scan(src any) error { switch s := src.(type) { case []byte: *e = IPProtocol(s) @@ -35,7 +35,7 @@ type NullIPProtocol struct { } // Scan implements the Scanner interface. -func (ns *NullIPProtocol) Scan(value interface{}) error { +func (ns *NullIPProtocol) Scan(value any) error { if value == nil { ns.IPProtocol, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go index 531548fbb1..98787cd712 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go index 77aa1bbbf3..1d4f75ae5a 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( IpProtocolIcmp IPProtocol = "icmp" ) -func (e *IPProtocol) Scan(src interface{}) error { +func (e *IPProtocol) Scan(src any) error { switch s := src.(type) { case []byte: *e = IPProtocol(s) @@ -35,7 +35,7 @@ type NullIPProtocol struct { } // Scan implements the Scanner interface. -func (ns *NullIPProtocol) Scan(value interface{}) error { +func (ns *NullIPProtocol) Scan(value any) error { if value == nil { ns.IPProtocol, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go index 531548fbb1..98787cd712 100644 --- a/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/db.go b/internal/endtoend/testdata/rename/v2/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/go/db.go +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/models.go b/internal/endtoend/testdata/rename/v2/stdlib/go/models.go index 77aa1bbbf3..1d4f75ae5a 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/go/models.go +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -17,7 +17,7 @@ const ( IpProtocolIcmp IPProtocol = "icmp" ) -func (e *IPProtocol) Scan(src interface{}) error { +func (e *IPProtocol) Scan(src any) error { switch s := src.(type) { case []byte: *e = IPProtocol(s) @@ -35,7 +35,7 @@ type NullIPProtocol struct { } // Scan implements the Scanner interface. -func (ns *NullIPProtocol) Scan(value interface{}) error { +func (ns *NullIPProtocol) Scan(value any) error { if value == nil { ns.IPProtocol, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go b/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go index 5c5cb30ba6..cdc74673e2 100644 --- a/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/rename/v2/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go index 33daba171e..4df212e5af 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go index 14304e587a..780396dec1 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go index 2e07d2e82d..b73d378e38 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go index f3a3bcc324..b11556f827 100644 --- a/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go index 33daba171e..4df212e5af 100644 --- a/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go index 3337db0e7a..a955d47fc5 100644 --- a/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/returning/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/returning/sqlite/go/db.go b/internal/endtoend/testdata/returning/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/returning/sqlite/go/db.go +++ b/internal/endtoend/testdata/returning/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/returning/sqlite/go/models.go b/internal/endtoend/testdata/returning/sqlite/go/models.go index 1962df6427..65b7a3152a 100644 --- a/internal/endtoend/testdata/returning/sqlite/go/models.go +++ b/internal/endtoend/testdata/returning/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/returning/sqlite/go/query.sql.go b/internal/endtoend/testdata/returning/sqlite/go/query.sql.go index d23c28218d..c081f1c29f 100644 --- a/internal/endtoend/testdata/returning/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/returning/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -12,8 +12,8 @@ import ( const deleteUserAndReturnID = `-- name: DeleteUserAndReturnID :one DELETE FROM users - WHERE name = ?1 - RETURNING id +WHERE name = ?1 +RETURNING id ` func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name sql.NullString) (int64, error) { @@ -25,8 +25,8 @@ func (q *Queries) DeleteUserAndReturnID(ctx context.Context, name sql.NullString const deleteUserAndReturnUser = `-- name: DeleteUserAndReturnUser :one DELETE FROM users - WHERE name = ?1 - RETURNING name, id +WHERE name = ?1 +RETURNING name, id ` func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { @@ -37,8 +37,9 @@ func (q *Queries) DeleteUserAndReturnUser(ctx context.Context, name sql.NullStri } const insertUserAndReturnID = `-- name: InsertUserAndReturnID :one -INSERT INTO users (name) VALUES (?1) - RETURNING id +INSERT INTO users (name) +VALUES (?1) +RETURNING id ` func (q *Queries) InsertUserAndReturnID(ctx context.Context, name sql.NullString) (int64, error) { @@ -49,8 +50,9 @@ func (q *Queries) InsertUserAndReturnID(ctx context.Context, name sql.NullString } const insertUserAndReturnUser = `-- name: InsertUserAndReturnUser :one -INSERT INTO users (name) VALUES (?1) - RETURNING name, id +INSERT INTO users (name) +VALUES (?1) +RETURNING name, id ` func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name sql.NullString) (User, error) { @@ -61,9 +63,10 @@ func (q *Queries) InsertUserAndReturnUser(ctx context.Context, name sql.NullStri } const updateUserAndReturnID = `-- name: UpdateUserAndReturnID :one -UPDATE users SET name = ?1 - WHERE name = ?2 - RETURNING id +UPDATE users +SET name = ?1 +WHERE name = ?2 +RETURNING id ` type UpdateUserAndReturnIDParams struct { @@ -79,9 +82,10 @@ func (q *Queries) UpdateUserAndReturnID(ctx context.Context, arg UpdateUserAndRe } const updateUserAndReturnUser = `-- name: UpdateUserAndReturnUser :one -UPDATE users SET name = ?1 - WHERE name = ?2 - RETURNING name, id +UPDATE users +SET name = ?1 +WHERE name = ?2 +RETURNING name, id ` type UpdateUserAndReturnUserParams struct { diff --git a/internal/endtoend/testdata/returning/sqlite/query.sql b/internal/endtoend/testdata/returning/sqlite/query.sql index ded7c9e810..974f37e3bf 100644 --- a/internal/endtoend/testdata/returning/sqlite/query.sql +++ b/internal/endtoend/testdata/returning/sqlite/query.sql @@ -1,27 +1,31 @@ -- name: InsertUserAndReturnID :one -INSERT INTO users (name) VALUES (?1) - RETURNING id; +INSERT INTO users (name) +VALUES (?1) +RETURNING id; -- name: InsertUserAndReturnUser :one -INSERT INTO users (name) VALUES (?1) - RETURNING *; +INSERT INTO users (name) +VALUES (?1) +RETURNING *; -- name: UpdateUserAndReturnID :one -UPDATE users SET name = ?1 - WHERE name = ?2 - RETURNING id; +UPDATE users +SET name = ?1 +WHERE name = ?2 +RETURNING id; -- name: UpdateUserAndReturnUser :one -UPDATE users SET name = ?1 - WHERE name = ?2 - RETURNING *; +UPDATE users +SET name = ?1 +WHERE name = ?2 +RETURNING *; -- name: DeleteUserAndReturnID :one DELETE FROM users - WHERE name = ?1 - RETURNING id; +WHERE name = ?1 +RETURNING id; -- name: DeleteUserAndReturnUser :one DELETE FROM users - WHERE name = ?1 - RETURNING *; +WHERE name = ?1 +RETURNING *; diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/exec.json b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..b2a355d80a --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type User struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/query.sql.go new file mode 100644 index 0000000000..1ef5f230f1 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,124 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const deleteReturningOldNew = `-- name: DeleteReturningOldNew :one +DELETE FROM users WHERE id = $1 +RETURNING old.name, new.name +` + +type DeleteReturningOldNewRow struct { + Name string + Name_2 pgtype.Text +} + +func (q *Queries) DeleteReturningOldNew(ctx context.Context, id int64) (DeleteReturningOldNewRow, error) { + row := q.db.QueryRow(ctx, deleteReturningOldNew, id) + var i DeleteReturningOldNewRow + err := row.Scan(&i.Name, &i.Name_2) + return i, err +} + +const insertReturningOldNew = `-- name: InsertReturningOldNew :one +INSERT INTO users (name) VALUES ($1) +RETURNING old.id, new.id +` + +type InsertReturningOldNewRow struct { + ID pgtype.Int8 + ID_2 int64 +} + +func (q *Queries) InsertReturningOldNew(ctx context.Context, name string) (InsertReturningOldNewRow, error) { + row := q.db.QueryRow(ctx, insertReturningOldNew, name) + var i InsertReturningOldNewRow + err := row.Scan(&i.ID, &i.ID_2) + return i, err +} + +const updateReturningOld = `-- name: UpdateReturningOld :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.name +` + +type UpdateReturningOldParams struct { + Name string + ID int64 +} + +func (q *Queries) UpdateReturningOld(ctx context.Context, arg UpdateReturningOldParams) (string, error) { + row := q.db.QueryRow(ctx, updateReturningOld, arg.Name, arg.ID) + var name string + err := row.Scan(&name) + return name, err +} + +const updateReturningOldNew = `-- name: UpdateReturningOldNew :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.name, new.name +` + +type UpdateReturningOldNewParams struct { + Name string + ID int64 +} + +type UpdateReturningOldNewRow struct { + Name string + Name_2 string +} + +func (q *Queries) UpdateReturningOldNew(ctx context.Context, arg UpdateReturningOldNewParams) (UpdateReturningOldNewRow, error) { + row := q.db.QueryRow(ctx, updateReturningOldNew, arg.Name, arg.ID) + var i UpdateReturningOldNewRow + err := row.Scan(&i.Name, &i.Name_2) + return i, err +} + +const updateReturningOldStar = `-- name: UpdateReturningOldStar :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.id, old.name, old.bio +` + +type UpdateReturningOldStarParams struct { + Name string + ID int64 +} + +func (q *Queries) UpdateReturningOldStar(ctx context.Context, arg UpdateReturningOldStarParams) (User, error) { + row := q.db.QueryRow(ctx, updateReturningOldStar, arg.Name, arg.ID) + var i User + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const updateReturningWithAliases = `-- name: UpdateReturningWithAliases :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING WITH (OLD AS o, NEW AS n) o.name, n.name +` + +type UpdateReturningWithAliasesParams struct { + Name string + ID int64 +} + +type UpdateReturningWithAliasesRow struct { + Name string + Name_2 string +} + +func (q *Queries) UpdateReturningWithAliases(ctx context.Context, arg UpdateReturningWithAliasesParams) (UpdateReturningWithAliasesRow, error) { + row := q.db.QueryRow(ctx, updateReturningWithAliases, arg.Name, arg.ID) + var i UpdateReturningWithAliasesRow + err := row.Scan(&i.Name, &i.Name_2) + return i, err +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/query.sql new file mode 100644 index 0000000000..ca465ee980 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/query.sql @@ -0,0 +1,23 @@ +-- name: UpdateReturningOld :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.name; + +-- name: UpdateReturningOldNew :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.name, new.name; + +-- name: UpdateReturningOldStar :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.*; + +-- name: InsertReturningOldNew :one +INSERT INTO users (name) VALUES ($1) +RETURNING old.id, new.id; + +-- name: DeleteReturningOldNew :one +DELETE FROM users WHERE id = $1 +RETURNING old.name, new.name; + +-- name: UpdateReturningWithAliases :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING WITH (OLD AS o, NEW AS n) o.name, n.name; diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/schema.sql new file mode 100644 index 0000000000..ad2d63a4f9 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id bigserial PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/pgx/v5/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v5", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/exec.json b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..2e996ca79d --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..b5f44f2b8b --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type User struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..ba3139ee00 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,123 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteReturningOldNew = `-- name: DeleteReturningOldNew :one +DELETE FROM users WHERE id = $1 +RETURNING old.name, new.name +` + +type DeleteReturningOldNewRow struct { + Name string + Name_2 sql.NullString +} + +func (q *Queries) DeleteReturningOldNew(ctx context.Context, id int64) (DeleteReturningOldNewRow, error) { + row := q.db.QueryRowContext(ctx, deleteReturningOldNew, id) + var i DeleteReturningOldNewRow + err := row.Scan(&i.Name, &i.Name_2) + return i, err +} + +const insertReturningOldNew = `-- name: InsertReturningOldNew :one +INSERT INTO users (name) VALUES ($1) +RETURNING old.id, new.id +` + +type InsertReturningOldNewRow struct { + ID sql.NullInt64 + ID_2 int64 +} + +func (q *Queries) InsertReturningOldNew(ctx context.Context, name string) (InsertReturningOldNewRow, error) { + row := q.db.QueryRowContext(ctx, insertReturningOldNew, name) + var i InsertReturningOldNewRow + err := row.Scan(&i.ID, &i.ID_2) + return i, err +} + +const updateReturningOld = `-- name: UpdateReturningOld :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.name +` + +type UpdateReturningOldParams struct { + Name string + ID int64 +} + +func (q *Queries) UpdateReturningOld(ctx context.Context, arg UpdateReturningOldParams) (string, error) { + row := q.db.QueryRowContext(ctx, updateReturningOld, arg.Name, arg.ID) + var name string + err := row.Scan(&name) + return name, err +} + +const updateReturningOldNew = `-- name: UpdateReturningOldNew :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.name, new.name +` + +type UpdateReturningOldNewParams struct { + Name string + ID int64 +} + +type UpdateReturningOldNewRow struct { + Name string + Name_2 string +} + +func (q *Queries) UpdateReturningOldNew(ctx context.Context, arg UpdateReturningOldNewParams) (UpdateReturningOldNewRow, error) { + row := q.db.QueryRowContext(ctx, updateReturningOldNew, arg.Name, arg.ID) + var i UpdateReturningOldNewRow + err := row.Scan(&i.Name, &i.Name_2) + return i, err +} + +const updateReturningOldStar = `-- name: UpdateReturningOldStar :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.id, old.name, old.bio +` + +type UpdateReturningOldStarParams struct { + Name string + ID int64 +} + +func (q *Queries) UpdateReturningOldStar(ctx context.Context, arg UpdateReturningOldStarParams) (User, error) { + row := q.db.QueryRowContext(ctx, updateReturningOldStar, arg.Name, arg.ID) + var i User + err := row.Scan(&i.ID, &i.Name, &i.Bio) + return i, err +} + +const updateReturningWithAliases = `-- name: UpdateReturningWithAliases :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING WITH (OLD AS o, NEW AS n) o.name, n.name +` + +type UpdateReturningWithAliasesParams struct { + Name string + ID int64 +} + +type UpdateReturningWithAliasesRow struct { + Name string + Name_2 string +} + +func (q *Queries) UpdateReturningWithAliases(ctx context.Context, arg UpdateReturningWithAliasesParams) (UpdateReturningWithAliasesRow, error) { + row := q.db.QueryRowContext(ctx, updateReturningWithAliases, arg.Name, arg.ID) + var i UpdateReturningWithAliasesRow + err := row.Scan(&i.Name, &i.Name_2) + return i, err +} diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/query.sql b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..ca465ee980 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/query.sql @@ -0,0 +1,23 @@ +-- name: UpdateReturningOld :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.name; + +-- name: UpdateReturningOldNew :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.name, new.name; + +-- name: UpdateReturningOldStar :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING old.*; + +-- name: InsertReturningOldNew :one +INSERT INTO users (name) VALUES ($1) +RETURNING old.id, new.id; + +-- name: DeleteReturningOldNew :one +DELETE FROM users WHERE id = $1 +RETURNING old.name, new.name; + +-- name: UpdateReturningWithAliases :one +UPDATE users SET name = $1 WHERE id = $2 +RETURNING WITH (OLD AS o, NEW AS n) o.name, n.name; diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..ad2d63a4f9 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE users ( + id bigserial PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/sqlc.json new file mode 100644 index 0000000000..f717ca2e66 --- /dev/null +++ b/internal/endtoend/testdata/returning_old_new/postgresql/stdlib/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_create/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go index 29a1b21425..2b9689ebb4 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID uint64 Name string diff --git a/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go index 5941bf0d70..ff8227e84a 100644 --- a/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go index b526d99ab2..44bab592e2 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go index 88f26c3de6..a6a3bbe38a 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go index b526d99ab2..44bab592e2 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go index 88f26c3de6..a6a3bbe38a 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go index b526d99ab2..44bab592e2 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go index c2942ae002..3fb8671e53 100644 --- a/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_create/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_delete/mysql/exec.json new file mode 100644 index 0000000000..a0e224b3f8 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/exec.json @@ -0,0 +1,7 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} + \ No newline at end of file diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go index f946f6c40a..850ce650ce 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID uint64 } diff --git a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go index 34c98974b9..95c5c20a80 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go index 00bc1b5ec4..8d0cb34c86 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go index 00bc1b5ec4..8d0cb34c86 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go index a8957e88ae..021d2a3d33 100644 --- a/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_delete/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go index c96d3b1ecf..9f3f95358e 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( FooTypeUserRoleUser FooTypeUserRole = "user" ) -func (e *FooTypeUserRole) Scan(src interface{}) error { +func (e *FooTypeUserRole) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooTypeUserRole(s) @@ -34,7 +34,7 @@ type NullFooTypeUserRole struct { } // Scan implements the Scanner interface. -func (ns *NullFooTypeUserRole) Scan(value interface{}) error { +func (ns *NullFooTypeUserRole) Scan(value any) error { if value == nil { ns.FooTypeUserRole, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go index 821b2770e3..46a7d0ea3a 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go index c96d3b1ecf..9f3f95358e 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( FooTypeUserRoleUser FooTypeUserRole = "user" ) -func (e *FooTypeUserRole) Scan(src interface{}) error { +func (e *FooTypeUserRole) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooTypeUserRole(s) @@ -34,7 +34,7 @@ type NullFooTypeUserRole struct { } // Scan implements the Scanner interface. -func (ns *NullFooTypeUserRole) Scan(value interface{}) error { +func (ns *NullFooTypeUserRole) Scan(value any) error { if value == nil { ns.FooTypeUserRole, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go index 821b2770e3..46a7d0ea3a 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go index c96d3b1ecf..9f3f95358e 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -16,7 +16,7 @@ const ( FooTypeUserRoleUser FooTypeUserRole = "user" ) -func (e *FooTypeUserRole) Scan(src interface{}) error { +func (e *FooTypeUserRole) Scan(src any) error { switch s := src.(type) { case []byte: *e = FooTypeUserRole(s) @@ -34,7 +34,7 @@ type NullFooTypeUserRole struct { } // Scan implements the Scanner interface. -func (ns *NullFooTypeUserRole) Scan(value interface{}) error { +func (ns *NullFooTypeUserRole) Scan(value any) error { if value == nil { ns.FooTypeUserRole, ns.Valid = "", false return nil diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go index bb85d1c959..c28c1ca8bb 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_filter/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go index f946f6c40a..850ce650ce 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID uint64 } diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go index f6ee467f9a..72a1a558a4 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql b/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql index a22ab0907d..e5cb43f4bf 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql +++ b/internal/endtoend/testdata/schema_scoped_filter/mysql/schema.sql @@ -1,3 +1,2 @@ CREATE SCHEMA foo; CREATE TABLE foo.bar (id serial not null); - diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go index 61108e9ebe..cc723edbe6 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go index 61108e9ebe..cc723edbe6 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go index 28ec2e060b..3fe07f3ae5 100644 --- a/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_filter/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_list/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go index f946f6c40a..850ce650ce 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID uint64 } diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go index 34d83be407..b724f882e0 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go index 821aedf6ec..4449bbe9d7 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go index 821aedf6ec..4449bbe9d7 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go index 1d88ec458a..5e4ee9047a 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 } diff --git a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go index a2190c6000..a7b3a49be6 100644 --- a/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_list/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/exec.json b/internal/endtoend/testdata/schema_scoped_update/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go b/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go b/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go index 29a1b21425..2b9689ebb4 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID uint64 Name string diff --git a/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go index 0c1bbdbc08..19858da3a5 100644 --- a/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go index b526d99ab2..44bab592e2 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go index 9a34e18b62..75f6672b37 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go index b526d99ab2..44bab592e2 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go index 9a34e18b62..75f6672b37 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go index b526d99ab2..44bab592e2 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type FooBar struct { ID int32 Name string diff --git a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go index c36b94b98d..e56c19fccd 100644 --- a/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/schema_scoped_update/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/schema_table_column_ref/issue.md b/internal/endtoend/testdata/schema_table_column_ref/issue.md new file mode 100644 index 0000000000..f58a7d02d1 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/2948 diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/db.go b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/models.go b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f1cc6b6de7 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/models.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type AstoriaSlackFeedback struct { + ID int64 + WorkspaceID int64 + CreatedAt pgtype.Timestamp + IssueRaised pgtype.Bool +} + +type AstoriaTicket struct { + ID int64 + WorkspaceID int64 + CreatedAt pgtype.Timestamp + Source string +} diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..ce83f76e91 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go @@ -0,0 +1,77 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getTotalSlackQueries = `-- name: GetTotalSlackQueries :one +SELECT + COUNT(*) AS count +FROM astoria.slack_feedback +WHERE astoria.slack_feedback.workspace_id = $1 +AND created_at BETWEEN $2::date AND $3::date +` + +type GetTotalSlackQueriesParams struct { + WorkspaceID int64 + Column2 pgtype.Date + Column3 pgtype.Date +} + +func (q *Queries) GetTotalSlackQueries(ctx context.Context, arg GetTotalSlackQueriesParams) (int64, error) { + row := q.db.QueryRow(ctx, getTotalSlackQueries, arg.WorkspaceID, arg.Column2, arg.Column3) + var count int64 + err := row.Scan(&count) + return count, err +} + +const getTotalSlackQueriesRequestsCreated = `-- name: GetTotalSlackQueriesRequestsCreated :one +SELECT + COUNT(*) AS count +FROM astoria.tickets +WHERE astoria.tickets.workspace_id = $1 + AND source = 'RAISED_FROM_BOT' + AND created_at BETWEEN $2::date AND $3::date +` + +type GetTotalSlackQueriesRequestsCreatedParams struct { + WorkspaceID int64 + Column2 pgtype.Date + Column3 pgtype.Date +} + +func (q *Queries) GetTotalSlackQueriesRequestsCreated(ctx context.Context, arg GetTotalSlackQueriesRequestsCreatedParams) (int64, error) { + row := q.db.QueryRow(ctx, getTotalSlackQueriesRequestsCreated, arg.WorkspaceID, arg.Column2, arg.Column3) + var count int64 + err := row.Scan(&count) + return count, err +} + +const getTotalSlackQueriesResolved = `-- name: GetTotalSlackQueriesResolved :one +SELECT + COUNT(*) AS count +FROM astoria.slack_feedback +WHERE astoria.slack_feedback.workspace_id = $1 + AND (issue_raised = false OR issue_raised IS NULL) + AND created_at BETWEEN $2::date AND $3::date +` + +type GetTotalSlackQueriesResolvedParams struct { + WorkspaceID int64 + Column2 pgtype.Date + Column3 pgtype.Date +} + +func (q *Queries) GetTotalSlackQueriesResolved(ctx context.Context, arg GetTotalSlackQueriesResolvedParams) (int64, error) { + row := q.db.QueryRow(ctx, getTotalSlackQueriesResolved, arg.WorkspaceID, arg.Column2, arg.Column3) + var count int64 + err := row.Scan(&count) + return count, err +} diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/query.sql b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/query.sql new file mode 100644 index 0000000000..3aa8ae1ca6 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/query.sql @@ -0,0 +1,22 @@ +-- name: GetTotalSlackQueries :one +SELECT + COUNT(*) AS count +FROM astoria.slack_feedback +WHERE astoria.slack_feedback.workspace_id = $1 +AND created_at BETWEEN $2::date AND $3::date; + +-- name: GetTotalSlackQueriesResolved :one +SELECT + COUNT(*) AS count +FROM astoria.slack_feedback +WHERE astoria.slack_feedback.workspace_id = $1 + AND (issue_raised = false OR issue_raised IS NULL) + AND created_at BETWEEN $2::date AND $3::date; + +-- name: GetTotalSlackQueriesRequestsCreated :one +SELECT + COUNT(*) AS count +FROM astoria.tickets +WHERE astoria.tickets.workspace_id = $1 + AND source = 'RAISED_FROM_BOT' + AND created_at BETWEEN $2::date AND $3::date; diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/schema.sql b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..48ccc12b84 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/schema.sql @@ -0,0 +1,15 @@ +CREATE SCHEMA astoria; + +CREATE TABLE astoria.slack_feedback ( + id BIGSERIAL PRIMARY KEY, + workspace_id BIGINT NOT NULL, + created_at TIMESTAMP NOT NULL, + issue_raised BOOLEAN +); + +CREATE TABLE astoria.tickets ( + id BIGSERIAL PRIMARY KEY, + workspace_id BIGINT NOT NULL, + created_at TIMESTAMP NOT NULL, + source text NOT NULL +); diff --git a/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/select_column_cast/mysql/go/db.go b/internal/endtoend/testdata/select_column_cast/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_column_cast/mysql/go/models.go b/internal/endtoend/testdata/select_column_cast/mysql/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go index f03b6cfb3d..a66217e67a 100644 --- a/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go index 40b5e175e0..54f358ea88 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go index 40b5e175e0..54f358ea88 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go index 7c0a88d72b..e2a9591731 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar bool } diff --git a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go index 341e9af764..1c5bf0417e 100644 --- a/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go index 3f44f8fd63..d324fe92ad 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Bar string } diff --git a/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go index a633322d88..a8c2742d73 100644 --- a/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_cte/sqlite/go/db.go b/internal/endtoend/testdata/select_cte/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_cte/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_cte/sqlite/go/models.go b/internal/endtoend/testdata/select_cte/sqlite/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_cte/sqlite/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go index 70174998ac..8d2b8ae6cc 100644 --- a/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_cte/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go index 2f89193ee6..97924458e6 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go index 1537644756..84a7ab51f1 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go index 23120a905a..ca7c68f46b 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go index 1537644756..84a7ab51f1 100644 --- a/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/db.go b/internal/endtoend/testdata/select_distinct/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/models.go b/internal/endtoend/testdata/select_distinct/stdlib/go/models.go index 2f89193ee6..97924458e6 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go index 6f9999a1a1..8f3b369164 100644 --- a/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_distinct/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql b/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql index 81b6ff14a1..ae6cd0c9be 100644 --- a/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/query.sql @@ -1,4 +1,2 @@ -CREATE TABLE bar (name text); - -- name: GetBars :many -SELECT FROM bar; \ No newline at end of file +SELECT FROM bar; diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/schema.sql b/internal/endtoend/testdata/select_empty_column_list/mysql/schema.sql new file mode 100644 index 0000000000..fb18b4b3a8 --- /dev/null +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE bar (name text); diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/sqlc.json b/internal/endtoend/testdata/select_empty_column_list/mysql/sqlc.json index 445bbd1589..e41c39e8b3 100644 --- a/internal/endtoend/testdata/select_empty_column_list/mysql/sqlc.json +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/sqlc.json @@ -5,7 +5,7 @@ "path": "go", "engine": "mysql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql" } ] diff --git a/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt b/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt index 11aeb304b0..2744126cd0 100644 --- a/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt +++ b/internal/endtoend/testdata/select_empty_column_list/mysql/stderr.txt @@ -1,2 +1,2 @@ # package querytest -query.sql:4:12: syntax error near "FROM bar;" " +query.sql:2:12: syntax error near "FROM bar;" diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go index 2f89193ee6..97924458e6 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go index 2597118edf..a477f23b12 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go index 23120a905a..ca7c68f46b 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go index 2597118edf..a477f23b12 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go index 2f89193ee6..97924458e6 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go index 03ee2a73aa..af2067dbe3 100644 --- a/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_empty_column_list/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go index 0c3311fe16..359df59810 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go index 0c3311fe16..359df59810 100644 --- a/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_exists/sqlite/go/db.go b/internal/endtoend/testdata/select_exists/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_exists/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_exists/sqlite/go/models.go b/internal/endtoend/testdata/select_exists/sqlite/go/models.go index 214487814e..bc354e040a 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_exists/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go index 4c76a9ddeb..d0d680408d 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,19 +11,16 @@ import ( const barExists = `-- name: BarExists :one SELECT - EXISTS ( - SELECT - 1 - FROM - bar - where - id = ? - ) + EXISTS ( + SELECT 1 + FROM bar + WHERE id = ? + ) ` -func (q *Queries) BarExists(ctx context.Context, id int64) (int64, error) { +func (q *Queries) BarExists(ctx context.Context, id int64) (bool, error) { row := q.db.QueryRowContext(ctx, barExists, id) - var column_1 int64 - err := row.Scan(&column_1) - return column_1, err + var exists bool + err := row.Scan(&exists) + return exists, err } diff --git a/internal/endtoend/testdata/select_exists/sqlite/query.sql b/internal/endtoend/testdata/select_exists/sqlite/query.sql index 5173a4418f..15ef7be358 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/query.sql +++ b/internal/endtoend/testdata/select_exists/sqlite/query.sql @@ -1,10 +1,7 @@ -- name: BarExists :one SELECT - EXISTS ( - SELECT - 1 - FROM - bar - where - id = ? - ); + EXISTS ( + SELECT 1 + FROM bar + WHERE id = ? + ); diff --git a/internal/endtoend/testdata/select_exists/sqlite/schema.sql b/internal/endtoend/testdata/select_exists/sqlite/schema.sql index 52799a37db..cf6a8b9507 100644 --- a/internal/endtoend/testdata/select_exists/sqlite/schema.sql +++ b/internal/endtoend/testdata/select_exists/sqlite/schema.sql @@ -1,2 +1 @@ -CREATE TABLE bar (id int not null primary key autoincrement); - +CREATE TABLE bar (id integer not null primary key autoincrement); diff --git a/internal/endtoend/testdata/select_exists/stdlib/go/db.go b/internal/endtoend/testdata/select_exists/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_exists/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_exists/stdlib/go/models.go b/internal/endtoend/testdata/select_exists/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_exists/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go index 6de4f44ef1..cfbcd91579 100644 --- a/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_exists/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_in_and/sqlite/go/db.go b/internal/endtoend/testdata/select_in_and/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_in_and/sqlite/go/models.go b/internal/endtoend/testdata/select_in_and/sqlite/go/models.go index 62e6f470e2..838d082dfc 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go index ee2dc8c821..3a97dad1de 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_in_and/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,24 +11,16 @@ import ( ) const deleteAuthor = `-- name: DeleteAuthor :exec -DELETE FROM - books AS b -WHERE - b.author NOT IN ( - SELECT - a.name - FROM - authors a - WHERE - a.age >= ? +DELETE FROM books AS b +WHERE NOT b.author IN ( + SELECT a.name + FROM authors AS a + WHERE a.age >= ? ) - AND b.translator NOT IN ( - SELECT - t.name - FROM - translators t - WHERE - t.age >= ? + AND NOT b.translator IN ( + SELECT t.name + FROM translators AS t + WHERE t.age >= ? ) AND b.year <= ? ` diff --git a/internal/endtoend/testdata/select_in_and/sqlite/query.sql b/internal/endtoend/testdata/select_in_and/sqlite/query.sql index 4bad135e3d..a4e760f508 100644 --- a/internal/endtoend/testdata/select_in_and/sqlite/query.sql +++ b/internal/endtoend/testdata/select_in_and/sqlite/query.sql @@ -1,21 +1,13 @@ -- name: DeleteAuthor :exec -DELETE FROM - books AS b -WHERE - b.author NOT IN ( - SELECT - a.name - FROM - authors a - WHERE - a.age >= ? +DELETE FROM books AS b +WHERE NOT b.author IN ( + SELECT a.name + FROM authors AS a + WHERE a.age >= ? ) - AND b.translator NOT IN ( - SELECT - t.name - FROM - translators t - WHERE - t.age >= ? + AND NOT b.translator IN ( + SELECT t.name + FROM translators AS t + WHERE t.age >= ? ) - AND b.year <= ?; \ No newline at end of file + AND b.year <= ?; diff --git a/internal/endtoend/testdata/select_limit/mysql/go/db.go b/internal/endtoend/testdata/select_limit/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/db.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_limit/mysql/go/models.go b/internal/endtoend/testdata/select_limit/mysql/go/models.go index 3c885fdb45..f05c6b5688 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/models.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go b/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go index 7abc25ba18..163da541ea 100644 --- a/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go index 3c885fdb45..f05c6b5688 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go index adfb76413e..e13ab388a3 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go index cfa2cb9981..94fa185f0b 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go index 526fd3cab5..95e18d4388 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go index 3c885fdb45..f05c6b5688 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go index f5e821788d..a977098ff3 100644 --- a/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_limit/sqlite/go/db.go b/internal/endtoend/testdata/select_limit/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_limit/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_limit/sqlite/go/models.go b/internal/endtoend/testdata/select_limit/sqlite/go/models.go index 3c885fdb45..f05c6b5688 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_limit/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go index d6abf8c118..8eba03c574 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_limit/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,7 +11,8 @@ import ( ) const fooLimit = `-- name: FooLimit :many -SELECT a FROM foo +SELECT a +FROM foo LIMIT ? ` @@ -39,8 +40,10 @@ func (q *Queries) FooLimit(ctx context.Context, limit int64) ([]sql.NullString, } const fooLimitOffset = `-- name: FooLimitOffset :many -SELECT a FROM foo -LIMIT ? OFFSET ? +SELECT a +FROM foo +LIMIT ? +OFFSET ? ` type FooLimitOffsetParams struct { diff --git a/internal/endtoend/testdata/select_limit/sqlite/query.sql b/internal/endtoend/testdata/select_limit/sqlite/query.sql index 1fea17c583..c2e9c39c83 100644 --- a/internal/endtoend/testdata/select_limit/sqlite/query.sql +++ b/internal/endtoend/testdata/select_limit/sqlite/query.sql @@ -1,7 +1,10 @@ /* name: FooLimit :many */ -SELECT a FROM foo +SELECT a +FROM foo LIMIT ?; /* name: FooLimitOffset :many */ -SELECT a FROM foo -LIMIT ? OFFSET ?; +SELECT a +FROM foo +LIMIT ? +OFFSET ?; diff --git a/internal/endtoend/testdata/select_nested_count/mysql/go/db.go b/internal/endtoend/testdata/select_nested_count/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/go/db.go +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_nested_count/mysql/go/models.go b/internal/endtoend/testdata/select_nested_count/mysql/go/models.go index b2ed67ddf1..4073af03ce 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/go/models.go +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go index 9106a58c74..ca978554b3 100644 --- a/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go index b2ed67ddf1..4073af03ce 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go index 9106a58c74..ca978554b3 100644 --- a/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go index b2ed67ddf1..4073af03ce 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go index 9106a58c74..0b610a9c83 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_nested_count/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,10 +11,13 @@ import ( ) const getAuthorsWithBooksCount = `-- name: GetAuthorsWithBooksCount :many -SELECT id, name, bio, ( - SELECT COUNT(id) FROM books - WHERE books.author_id = id -) AS books_count +SELECT + id, name, bio, + ( + SELECT count(id) + FROM books + WHERE books.author_id = id + ) AS books_count FROM authors ` diff --git a/internal/endtoend/testdata/select_nested_count/sqlite/query.sql b/internal/endtoend/testdata/select_nested_count/sqlite/query.sql index 3fe51959c3..90069960a4 100644 --- a/internal/endtoend/testdata/select_nested_count/sqlite/query.sql +++ b/internal/endtoend/testdata/select_nested_count/sqlite/query.sql @@ -1,6 +1,9 @@ -- name: GetAuthorsWithBooksCount :many -SELECT *, ( - SELECT COUNT(id) FROM books - WHERE books.author_id = id -) AS books_count +SELECT + *, + ( + SELECT count(id) + FROM books + WHERE books.author_id = id + ) AS books_count FROM authors; diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go index 4118d4f236..2f9ec4b003 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go index 4118d4f236..2f9ec4b003 100644 --- a/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/exec.json b/internal/endtoend/testdata/select_not_exists/sqlite/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/select_not_exists/sqlite/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go b/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go b/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go index 214487814e..bc354e040a 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int64 } diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go index 1a4696ad18..dfa8dcedcc 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,20 +10,17 @@ import ( ) const barNotExists = `-- name: BarNotExists :one -SELECT - NOT EXISTS ( - SELECT - 1 - FROM - bar - WHERE - id = ? - ) +SELECT + NOT EXISTS ( + SELECT 1 + FROM bar + WHERE id = ? + ) ` -func (q *Queries) BarNotExists(ctx context.Context) (interface{}, error) { - row := q.db.QueryRowContext(ctx, barNotExists) - var column_1 interface{} - err := row.Scan(&column_1) - return column_1, err +func (q *Queries) BarNotExists(ctx context.Context, id int64) (bool, error) { + row := q.db.QueryRowContext(ctx, barNotExists, id) + var not_exists bool + err := row.Scan(¬_exists) + return not_exists, err } diff --git a/internal/endtoend/testdata/select_not_exists/sqlite/query.sql b/internal/endtoend/testdata/select_not_exists/sqlite/query.sql index d868c64a0b..f5dab6a174 100644 --- a/internal/endtoend/testdata/select_not_exists/sqlite/query.sql +++ b/internal/endtoend/testdata/select_not_exists/sqlite/query.sql @@ -1,11 +1,7 @@ -- name: BarNotExists :one -SELECT - NOT EXISTS ( - SELECT - 1 - FROM - bar - WHERE - id = ? - ); - +SELECT + NOT EXISTS ( + SELECT 1 + FROM bar + WHERE id = ? + ); diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go index f9ee608f4b..abb293a72f 100644 --- a/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_not_exists/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_sequence/issue.md b/internal/endtoend/testdata/select_sequence/issue.md new file mode 100644 index 0000000000..38c550fe19 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1634 diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/exec.json b/internal/endtoend/testdata/select_sequence/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/db.go b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/models.go b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..a1a6c48434 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..54c86dfa91 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getLastValue = `-- name: GetLastValue :one +SELECT last_value FROM my_sequence +` + +func (q *Queries) GetLastValue(ctx context.Context) (int64, error) { + row := q.db.QueryRow(ctx, getLastValue) + var last_value int64 + err := row.Scan(&last_value) + return last_value, err +} diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/query.sql b/internal/endtoend/testdata/select_sequence/postgresql/pgx/query.sql new file mode 100644 index 0000000000..82cc9b0a5c --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/query.sql @@ -0,0 +1,2 @@ +-- name: GetLastValue :one +SELECT last_value FROM my_sequence; diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/schema.sql b/internal/endtoend/testdata/select_sequence/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..94a6932f80 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/schema.sql @@ -0,0 +1,6 @@ +CREATE SEQUENCE public.my_sequence + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; diff --git a/internal/endtoend/testdata/select_sequence/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/select_sequence/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/select_sequence/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/select_star/mysql/go/db.go b/internal/endtoend/testdata/select_star/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/db.go +++ b/internal/endtoend/testdata/select_star/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star/mysql/go/models.go b/internal/endtoend/testdata/select_star/mysql/go/models.go index 41d5cb689a..643ee299ff 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/models.go +++ b/internal/endtoend/testdata/select_star/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star/mysql/go/query.sql.go b/internal/endtoend/testdata/select_star/mysql/go/query.sql.go index ea14d720b0..bf9df75976 100644 --- a/internal/endtoend/testdata/select_star/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go index 41d5cb689a..643ee299ff 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go index 5e607a95c3..5709c64374 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go index 98a6c710c0..116ee8ffa4 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go index 5e607a95c3..5709c64374 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go index 41d5cb689a..643ee299ff 100644 --- a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go index ea14d720b0..bf9df75976 100644 --- a/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star/sqlite/go/db.go b/internal/endtoend/testdata/select_star/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star/sqlite/go/models.go b/internal/endtoend/testdata/select_star/sqlite/go/models.go index 8bc479df7d..deb1559140 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go index c8359cebcb..e9e6c25fe5 100644 --- a/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_star/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -42,7 +42,7 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { } const getIDAll = `-- name: GetIDAll :many -SELECT id FROM (SELECT id FROM users) t +SELECT id FROM (SELECT id FROM users) AS t ` func (q *Queries) GetIDAll(ctx context.Context) ([]int64, error) { diff --git a/internal/endtoend/testdata/select_star/sqlite/query.sql b/internal/endtoend/testdata/select_star/sqlite/query.sql index 0952880cac..ba7ed34469 100644 --- a/internal/endtoend/testdata/select_star/sqlite/query.sql +++ b/internal/endtoend/testdata/select_star/sqlite/query.sql @@ -2,4 +2,4 @@ SELECT * FROM users; /* name: GetIDAll :many */ -SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file +SELECT * FROM (SELECT id FROM users) AS t; diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go index 3b956750fa..6e82f4a795 100644 --- a/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go index 55dda049d3..e59023c188 100644 --- a/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go index 20cdf4811c..dd9a57d84e 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go index f44fa1c328..9bf2782abd 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go index 8260c45fd2..72efcd62b7 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go index dd3ab6771e..ad7e060d07 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go index 20cdf4811c..dd9a57d84e 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go index 2d7ba63735..d78319b0cc 100644 --- a/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_star_quoted/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_subquery/postgresql/issue.md b/internal/endtoend/testdata/select_subquery/postgresql/issue.md new file mode 100644 index 0000000000..fa59b3a57d --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/pull/2639 diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/exec.json b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..96bb6dff41 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A int32 + Alias sql.NullString +} + +type Foo struct { + A int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go new file mode 100644 index 0000000000..9dda476557 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,53 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const subquery = `-- name: Subquery :many +SELECT + a, + name, + (SELECT alias FROM bar WHERE bar.a=foo.a AND alias = $1 ORDER BY bar.a DESC limit 1) as alias +FROM FOO WHERE a = $2 +` + +type SubqueryParams struct { + Column1 sql.NullString + Column2 sql.NullInt32 +} + +type SubqueryRow struct { + A int32 + Name sql.NullString + Alias sql.NullString +} + +func (q *Queries) Subquery(ctx context.Context, arg SubqueryParams) ([]SubqueryRow, error) { + rows, err := q.db.QueryContext(ctx, subquery, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SubqueryRow + for rows.Next() { + var i SubqueryRow + if err := rows.Scan(&i.A, &i.Name, &i.Alias); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..3d9b058b05 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/query.sql @@ -0,0 +1,6 @@ +-- name: Subquery :many +SELECT + a, + name, + (SELECT alias FROM bar WHERE bar.a=foo.a AND alias = $1 ORDER BY bar.a DESC limit 1) as alias +FROM FOO WHERE a = $2; diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b256bf60ae --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/schema.sql @@ -0,0 +1,2 @@ +CREATE TABLE foo (a int not null, name text); +CREATE TABLE bar (a int not null, alias text); diff --git a/internal/endtoend/testdata/select_subquery/postgresql/stdlib/sqlc.yaml b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/sqlc.yaml new file mode 100644 index 0000000000..8c68222b49 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery/postgresql/stdlib/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/select_subquery_alias/issue.md b/internal/endtoend/testdata/select_subquery_alias/issue.md new file mode 100644 index 0000000000..1f15e67216 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1990 diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/exec.json b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/db.go b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/models.go b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..2cbaed2a4a --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Wallet struct { + ID int64 + Address string + Type string + Balance pgtype.Numeric +} diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..e35db531ab --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go @@ -0,0 +1,61 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const findWallets = `-- name: FindWallets :many +select id, address, balance, total_balance from +( + select id, address, balance, + sum(balance) over (order by balance desc rows between unbounded preceding and current row) as total_balance, + sum(balance) over (order by balance desc rows between unbounded preceding and current row) - balance as last_balance + from wallets + where type=$1 +) amounts +where amounts.last_balance < $2 +` + +type FindWalletsParams struct { + Column1 pgtype.Text + Column2 pgtype.Numeric +} + +type FindWalletsRow struct { + ID int64 + Address string + Balance pgtype.Numeric + TotalBalance pgtype.Numeric +} + +func (q *Queries) FindWallets(ctx context.Context, arg FindWalletsParams) ([]FindWalletsRow, error) { + rows, err := q.db.Query(ctx, findWallets, arg.Column1, arg.Column2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FindWalletsRow + for rows.Next() { + var i FindWalletsRow + if err := rows.Scan( + &i.ID, + &i.Address, + &i.Balance, + &i.TotalBalance, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/query.sql b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/query.sql new file mode 100644 index 0000000000..b3412234c9 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/query.sql @@ -0,0 +1,10 @@ +-- name: FindWallets :many +select id, address, balance, total_balance from +( + select id, address, balance, + sum(balance) over (order by balance desc rows between unbounded preceding and current row) as total_balance, + sum(balance) over (order by balance desc rows between unbounded preceding and current row) - balance as last_balance + from wallets + where type=$1 +) amounts +where amounts.last_balance < $2; diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/schema.sql b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..275a65e104 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE IF NOT EXISTS wallets +( + id BIGSERIAL PRIMARY KEY, + address VARCHAR(44) NOT NULL, + type VARCHAR(44) NOT NULL, + balance DECIMAL(32, 18) NULL +); diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/db.go b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/models.go b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/models.go new file mode 100644 index 0000000000..f9c03a51bf --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go new file mode 100644 index 0000000000..34bfb57035 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subquery = `-- name: Subquery :many +SELECT a, name FROM (SELECT a, name FROM foo) +` + +func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, subquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/query.sql b/internal/endtoend/testdata/select_subquery_no_alias/mysql/query.sql new file mode 100644 index 0000000000..87477e34ca --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/query.sql @@ -0,0 +1,2 @@ +-- name: Subquery :many +SELECT * FROM (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/schema.sql b/internal/endtoend/testdata/select_subquery_no_alias/mysql/schema.sql new file mode 100644 index 0000000000..3d06ae047e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a int not null, name text); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/mysql/sqlc.yaml b/internal/endtoend/testdata/select_subquery_no_alias/mysql/sqlc.yaml new file mode 100644 index 0000000000..b843ef55e3 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/mysql/sqlc.yaml @@ -0,0 +1,9 @@ +version: "2" +sql: + - engine: "mysql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/db.go b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/models.go b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/models.go new file mode 100644 index 0000000000..f9c03a51bf --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go new file mode 100644 index 0000000000..34bfb57035 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subquery = `-- name: Subquery :many +SELECT a, name FROM (SELECT a, name FROM foo) +` + +func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, subquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/query.sql b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/query.sql new file mode 100644 index 0000000000..87477e34ca --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/query.sql @@ -0,0 +1,2 @@ +-- name: Subquery :many +SELECT * FROM (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/schema.sql b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/schema.sql new file mode 100644 index 0000000000..3d06ae047e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a int not null, name text); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/sqlc.yaml b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/sqlc.yaml new file mode 100644 index 0000000000..8c68222b49 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/postgres/stdlib/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/db.go b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/models.go b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/models.go new file mode 100644 index 0000000000..9aba85a59c --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A int64 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go new file mode 100644 index 0000000000..34bfb57035 --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const subquery = `-- name: Subquery :many +SELECT a, name FROM (SELECT a, name FROM foo) +` + +func (q *Queries) Subquery(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, subquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/query.sql b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/query.sql new file mode 100644 index 0000000000..87477e34ca --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Subquery :many +SELECT * FROM (SELECT * FROM foo); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/schema.sql b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/schema.sql new file mode 100644 index 0000000000..3d06ae047e --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/schema.sql @@ -0,0 +1 @@ +CREATE TABLE foo (a int not null, name text); diff --git a/internal/endtoend/testdata/select_subquery_no_alias/sqlite/sqlc.yaml b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/sqlc.yaml new file mode 100644 index 0000000000..bd7419948d --- /dev/null +++ b/internal/endtoend/testdata/select_subquery_no_alias/sqlite/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "sqlite" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "database/sql" diff --git a/internal/endtoend/testdata/select_system/issue.md b/internal/endtoend/testdata/select_system/issue.md new file mode 100644 index 0000000000..7e536076fc --- /dev/null +++ b/internal/endtoend/testdata/select_system/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1745 diff --git a/internal/endtoend/testdata/select_system/pgx/exec.json b/internal/endtoend/testdata/select_system/pgx/exec.json new file mode 100644 index 0000000000..e5dfda7818 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/select_system/pgx/go/db.go b/internal/endtoend/testdata/select_system/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/select_system/pgx/go/models.go b/internal/endtoend/testdata/select_system/pgx/go/models.go new file mode 100644 index 0000000000..c6fcc44a1d --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Test struct { + ID pgtype.Int4 +} diff --git a/internal/endtoend/testdata/select_system/pgx/go/query.sql.go b/internal/endtoend/testdata/select_system/pgx/go/query.sql.go new file mode 100644 index 0000000000..f35c7f5d08 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/go/query.sql.go @@ -0,0 +1,41 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const getSystemColumns = `-- name: GetSystemColumns :one +SELECT + tableoid, xmin, cmin, xmax, cmax, ctid +FROM test +` + +type GetSystemColumnsRow struct { + Tableoid pgtype.Uint32 + Xmin pgtype.Uint32 + Cmin pgtype.Uint32 + Xmax pgtype.Uint32 + Cmax pgtype.Uint32 + Ctid pgtype.TID +} + +func (q *Queries) GetSystemColumns(ctx context.Context) (GetSystemColumnsRow, error) { + row := q.db.QueryRow(ctx, getSystemColumns) + var i GetSystemColumnsRow + err := row.Scan( + &i.Tableoid, + &i.Xmin, + &i.Cmin, + &i.Xmax, + &i.Cmax, + &i.Ctid, + ) + return i, err +} diff --git a/internal/endtoend/testdata/select_system/pgx/query.sql b/internal/endtoend/testdata/select_system/pgx/query.sql new file mode 100644 index 0000000000..11ddeb7495 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/query.sql @@ -0,0 +1,4 @@ +-- name: GetSystemColumns :one +SELECT + tableoid, xmin, cmin, xmax, cmax, ctid +FROM test; diff --git a/internal/endtoend/testdata/select_system/pgx/schema.sql b/internal/endtoend/testdata/select_system/pgx/schema.sql new file mode 100644 index 0000000000..7518997c95 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE test ( + id INT +); diff --git a/internal/endtoend/testdata/select_system/pgx/sqlc.yaml b/internal/endtoend/testdata/select_system/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/select_system/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go index 088c7e8320..6cde5ae2f2 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go b/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go b/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go index 088c7e8320..6cde5ae2f2 100644 --- a/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_text_array/stdlib/go/db.go b/internal/endtoend/testdata/select_text_array/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_text_array/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_text_array/stdlib/go/models.go b/internal/endtoend/testdata/select_text_array/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/select_text_array/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go index af2aca6635..5ce044c912 100644 --- a/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_text_array/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_union/mysql/go/db.go b/internal/endtoend/testdata/select_union/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/db.go +++ b/internal/endtoend/testdata/select_union/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_union/mysql/go/models.go b/internal/endtoend/testdata/select_union/mysql/go/models.go index 9a43a248cb..a3b9f9c752 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/models.go +++ b/internal/endtoend/testdata/select_union/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_union/mysql/go/query.sql.go b/internal/endtoend/testdata/select_union/mysql/go/query.sql.go index 432dadd44e..5d5560ac49 100644 --- a/internal/endtoend/testdata/select_union/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -96,6 +96,35 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } +const selectUnionAliased = `-- name: SelectUnionAliased :many +(SELECT a, b FROM foo) +UNION +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionAliased) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUnionOther = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION diff --git a/internal/endtoend/testdata/select_union/mysql/query.sql b/internal/endtoend/testdata/select_union/mysql/query.sql index d607aa7222..c706921bc3 100644 --- a/internal/endtoend/testdata/select_union/mysql/query.sql +++ b/internal/endtoend/testdata/select_union/mysql/query.sql @@ -22,4 +22,9 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go index 9a43a248cb..a3b9f9c752 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go index e25fddae93..d7e818b09a 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -87,6 +87,32 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } +const selectUnionAliased = `-- name: SelectUnionAliased :many +(SELECT a, b FROM foo) +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionAliased) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUnionOther = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql index 107aee02d2..f44f1fd2af 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql @@ -22,4 +22,9 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go index 280391175b..9ab4919d5c 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go index e25fddae93..d7e818b09a 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -87,6 +87,32 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } +const selectUnionAliased = `-- name: SelectUnionAliased :many +(SELECT a, b FROM foo) +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionAliased) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUnionOther = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION diff --git a/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql b/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql index 107aee02d2..f44f1fd2af 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql @@ -22,4 +22,9 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go index 9a43a248cb..a3b9f9c752 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go index f5dc7319ab..0d0ff61d58 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -96,6 +96,35 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { return items, nil } +const selectUnionAliased = `-- name: SelectUnionAliased :many +(SELECT a, b FROM foo) +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnionAliased(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionAliased) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const selectUnionOther = `-- name: SelectUnionOther :many SELECT a, b FROM foo UNION diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql b/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql index 107aee02d2..f44f1fd2af 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql @@ -22,4 +22,9 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; + +-- name: SelectUnionAliased :many +(SELECT * FROM foo) +UNION +SELECT * FROM foo; diff --git a/internal/endtoend/testdata/select_union/sqlite/go/db.go b/internal/endtoend/testdata/select_union/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_union/sqlite/go/db.go +++ b/internal/endtoend/testdata/select_union/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_union/sqlite/go/models.go b/internal/endtoend/testdata/select_union/sqlite/go/models.go index 9a43a248cb..a3b9f9c752 100644 --- a/internal/endtoend/testdata/select_union/sqlite/go/models.go +++ b/internal/endtoend/testdata/select_union/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go index 667d63bfa6..42d9cde73d 100644 --- a/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -129,7 +129,8 @@ const selectUnionWithLimit = `-- name: SelectUnionWithLimit :many SELECT a, b FROM foo UNION SELECT a, b FROM foo -LIMIT ? OFFSET ? +LIMIT ? +OFFSET ? ` type SelectUnionWithLimitParams struct { diff --git a/internal/endtoend/testdata/select_union/sqlite/query.sql b/internal/endtoend/testdata/select_union/sqlite/query.sql index d607aa7222..1880a56d21 100644 --- a/internal/endtoend/testdata/select_union/sqlite/query.sql +++ b/internal/endtoend/testdata/select_union/sqlite/query.sql @@ -7,7 +7,8 @@ SELECT * FROM foo; SELECT * FROM foo UNION SELECT * FROM foo -LIMIT ? OFFSET ?; +LIMIT ? +OFFSET ?; -- name: SelectExcept :many SELECT * FROM foo @@ -22,4 +23,4 @@ SELECT * FROM foo; -- name: SelectUnionOther :many SELECT * FROM foo UNION -SELECT * FROM bar; \ No newline at end of file +SELECT * FROM bar; diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go index f5cf23b517..4dbc5a5982 100644 --- a/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go b/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go index 198565e2a0..8fa694749d 100644 --- a/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/select_union_subquery/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go index 4338b41c91..cdb82d094d 100644 --- a/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go b/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go index 5e3335c0d6..56780c4d05 100644 --- a/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/select_union_subquery/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/db.go b/internal/endtoend/testdata/selectstatic/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/selectstatic/mysql/go/db.go +++ b/internal/endtoend/testdata/selectstatic/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/models.go b/internal/endtoend/testdata/selectstatic/mysql/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/selectstatic/mysql/go/models.go +++ b/internal/endtoend/testdata/selectstatic/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go b/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go index bb07496a99..c48efce46c 100644 --- a/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/selectstatic/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -17,7 +17,7 @@ type SelectStaticRow struct { Column1 string B string Num int32 - Truefield int32 + Truefield bool Floater float64 } diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/db.go b/internal/endtoend/testdata/show_warnings/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/show_warnings/mysql/go/db.go +++ b/internal/endtoend/testdata/show_warnings/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/models.go b/internal/endtoend/testdata/show_warnings/mysql/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/show_warnings/mysql/go/models.go +++ b/internal/endtoend/testdata/show_warnings/mysql/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go b/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go index c85d3a0577..d8c5962115 100644 --- a/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/show_warnings/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go index 71d0c8f717..1a1f2ca90a 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go index e94c513e46..71681b3ba8 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -32,8 +32,9 @@ LIMIT 1 func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRowContext(ctx, getAuthorIDByID, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } const getUser = `-- name: GetUser :one @@ -45,6 +46,7 @@ LIMIT 1 func (q *Queries) GetUser(ctx context.Context, sub string) (string, error) { row := q.db.QueryRowContext(ctx, getUser, sub) - err := row.Scan(&sub) - return sub, err + var sub_2 string + err := row.Scan(&sub_2) + return sub_2, err } diff --git a/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql b/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql index 376329e101..2f49d219f3 100644 --- a/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql +++ b/internal/endtoend/testdata/single_param_conflict/mysql/schema.sql @@ -7,5 +7,5 @@ CREATE TABLE authors ( -- https://github.com/sqlc-dev/sqlc/issues/1290 CREATE TABLE users ( - sub TEXT PRIMARY KEY + sub VARCHAR(10) PRIMARY KEY ); diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go index 687547d89e..907d9860ab 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go index fa0c265bbd..8f5f9f0322 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -34,8 +34,9 @@ LIMIT 1 func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRow(ctx, getAuthorIDByID, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } const getUser = `-- name: GetUser :one @@ -47,8 +48,9 @@ LIMIT 1 func (q *Queries) GetUser(ctx context.Context, sub uuid.UUID) (uuid.UUID, error) { row := q.db.QueryRow(ctx, getUser, sub) - err := row.Scan(&sub) - return sub, err + var sub_2 uuid.UUID + err := row.Scan(&sub_2) + return sub_2, err } const setDefaultName = `-- name: SetDefaultName :one @@ -62,6 +64,7 @@ RETURNING id // https://github.com/sqlc-dev/sqlc/issues/1235 func (q *Queries) SetDefaultName(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRow(ctx, setDefaultName, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go index 3dd0b394a8..35aa9ca322 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go index 9e8923565e..e6b88eec75 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -34,8 +34,9 @@ LIMIT 1 func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRow(ctx, getAuthorIDByID, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } const getUser = `-- name: GetUser :one @@ -47,8 +48,9 @@ LIMIT 1 func (q *Queries) GetUser(ctx context.Context, sub pgtype.UUID) (pgtype.UUID, error) { row := q.db.QueryRow(ctx, getUser, sub) - err := row.Scan(&sub) - return sub, err + var sub_2 pgtype.UUID + err := row.Scan(&sub_2) + return sub_2, err } const setDefaultName = `-- name: SetDefaultName :one @@ -62,6 +64,7 @@ RETURNING id // https://github.com/sqlc-dev/sqlc/issues/1235 func (q *Queries) SetDefaultName(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRow(ctx, setDefaultName, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go index 687547d89e..907d9860ab 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go index be987b8417..4df9667636 100644 --- a/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -34,8 +34,9 @@ LIMIT 1 func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRowContext(ctx, getAuthorIDByID, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } const getUser = `-- name: GetUser :one @@ -47,8 +48,9 @@ LIMIT 1 func (q *Queries) GetUser(ctx context.Context, sub uuid.UUID) (uuid.UUID, error) { row := q.db.QueryRowContext(ctx, getUser, sub) - err := row.Scan(&sub) - return sub, err + var sub_2 uuid.UUID + err := row.Scan(&sub_2) + return sub_2, err } const setDefaultName = `-- name: SetDefaultName :one @@ -62,6 +64,7 @@ RETURNING id // https://github.com/sqlc-dev/sqlc/issues/1235 func (q *Queries) SetDefaultName(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRowContext(ctx, setDefaultName, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go index 71d0c8f717..1a1f2ca90a 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go b/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go index e94c513e46..0499ffb86d 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,10 +10,10 @@ import ( ) const getAuthorByID = `-- name: GetAuthorByID :one -SELECT id, name, bio -FROM authors -WHERE id = ? -LIMIT 1 +SELECT id, name, bio +FROM authors +WHERE id = ? +LIMIT 1 ` func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { @@ -24,27 +24,29 @@ func (q *Queries) GetAuthorByID(ctx context.Context, id int64) (Author, error) { } const getAuthorIDByID = `-- name: GetAuthorIDByID :one -SELECT id -FROM authors -WHERE id = ? -LIMIT 1 +SELECT id +FROM authors +WHERE id = ? +LIMIT 1 ` func (q *Queries) GetAuthorIDByID(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRowContext(ctx, getAuthorIDByID, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } const getUser = `-- name: GetUser :one -SELECT sub -FROM users -WHERE sub = ? -LIMIT 1 +SELECT sub +FROM users +WHERE sub = ? +LIMIT 1 ` func (q *Queries) GetUser(ctx context.Context, sub string) (string, error) { row := q.db.QueryRowContext(ctx, getUser, sub) - err := row.Scan(&sub) - return sub, err + var sub_2 string + err := row.Scan(&sub_2) + return sub_2, err } diff --git a/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql b/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql index 23b454dac0..504f77945f 100644 --- a/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql +++ b/internal/endtoend/testdata/single_param_conflict/sqlite/query.sql @@ -1,17 +1,17 @@ -- name: GetAuthorIDByID :one -SELECT id -FROM authors -WHERE id = ? -LIMIT 1; +SELECT id +FROM authors +WHERE id = ? +LIMIT 1; -- name: GetAuthorByID :one -SELECT id, name, bio -FROM authors -WHERE id = ? -LIMIT 1; +SELECT id, name, bio +FROM authors +WHERE id = ? +LIMIT 1; -- name: GetUser :one -SELECT sub -FROM users -WHERE sub = ? -LIMIT 1; +SELECT sub +FROM users +WHERE sub = ? +LIMIT 1; diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go index fd2b0914c3..9e8369a034 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go index fd2b0914c3..9e8369a034 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go index 172574ab22..a1a6c48434 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/models.go @@ -1,7 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest - -import () diff --git a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go index 3ecc521b9a..b5af495f9e 100644 --- a/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sql_syntax_calling_funcs/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go index 60a7e7ea71..78dff94bf2 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go index 6f3a626e57..cacea70a2e 100644 --- a/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go index 60a7e7ea71..78dff94bf2 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go index 25bab121c3..eed0d84a77 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go index 60a7e7ea71..78dff94bf2 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go index 25bab121c3..eed0d84a77 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go index 60a7e7ea71..78dff94bf2 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go index b5cc396dfd..aede74f4f9 100644 --- a/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go index 60a7e7ea71..78dff94bf2 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string } diff --git a/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go index b02657284d..c24bd6c30f 100644 --- a/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_arg/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql index 3e46d7204b..80d171b2c2 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/query.sql @@ -1,8 +1,3 @@ -CREATE TABLE users ( - id serial, - first_name text not null -); - -- name: WrongFunc :one select id, first_name from users where id = sqlc.argh(target_id); diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/schema.sql b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/schema.sql new file mode 100644 index 0000000000..b11bfef310 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE users ( + id serial, + first_name text not null +); diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/sqlc.json b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/sqlc.json index bfbd23e211..a9e7b055a4 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/sqlc.json +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/sqlc.json @@ -4,7 +4,7 @@ { "name": "querytest", "path": "go", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "engine": "mysql" } diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt index be38c8b505..6e2cf1379b 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt +++ b/internal/endtoend/testdata/sqlc_arg_invalid/mysql/stderr.txt @@ -1,6 +1,6 @@ # package querytest -query.sql:7:1: function "sqlc.argh" does not exist -query.sql:10:45: expected 1 parameter to sqlc.arg; got 2 -query.sql:13:45: expected 1 parameter to sqlc.arg; got 0 -query.sql:16:45: expected parameter to sqlc.arg to be string or reference; got *ast.FuncCall -query.sql:19:45: expected parameter to sqlc.arg to be string or reference; got *ast.ParamRef +query.sql:2:45: function "sqlc.argh" does not exist +query.sql:5:45: expected 1 parameter to sqlc.arg; got 2 +query.sql:8:45: expected 1 parameter to sqlc.arg; got 0 +query.sql:11:45: expected parameter to sqlc.arg to be string or reference; got "sqlc.arg(target_id)" +query.sql:14:45: expected parameter to sqlc.arg to be string or reference; got "?" diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt index 8dbea1f949..2bc3407422 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt +++ b/internal/endtoend/testdata/sqlc_arg_invalid/postgresql/stderr.txt @@ -1,7 +1,6 @@ # package querytest -query.sql:1:1: function "sqlc.argh" does not exist +query.sql:2:45: function "sqlc.argh" does not exist query.sql:5:45: expected 1 parameter to sqlc.arg; got 2 query.sql:8:45: expected 1 parameter to sqlc.arg; got 0 -query.sql:11:45: expected parameter to sqlc.arg to be string or reference; got *ast.FuncCall -query.sql:14:45: expected parameter to sqlc.arg to be string or reference; got *ast.ParamRef - +query.sql:11:45: expected parameter to sqlc.arg to be string or reference; got "sqlc.arg(target_id)" +query.sql:14:45: expected parameter to sqlc.arg to be string or reference; got "$1" diff --git a/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt index be38c8b505..4cf898bcfb 100644 --- a/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt +++ b/internal/endtoend/testdata/sqlc_arg_invalid/sqlite/stderr.txt @@ -1,6 +1,6 @@ # package querytest -query.sql:7:1: function "sqlc.argh" does not exist +query.sql:7:45: function "sqlc.argh" does not exist query.sql:10:45: expected 1 parameter to sqlc.arg; got 2 query.sql:13:45: expected 1 parameter to sqlc.arg; got 0 -query.sql:16:45: expected parameter to sqlc.arg to be string or reference; got *ast.FuncCall -query.sql:19:45: expected parameter to sqlc.arg to be string or reference; got *ast.ParamRef +query.sql:16:45: expected parameter to sqlc.arg to be string or reference; got "sqlc.arg(target_id)" +query.sql:19:45: expected parameter to sqlc.arg to be string or reference; got "?" diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/exec.json b/internal/endtoend/testdata/sqlc_embed/mysql/exec.json new file mode 100644 index 0000000000..c85ca2dfa7 --- /dev/null +++ b/internal/endtoend/testdata/sqlc_embed/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "contexts": ["base"], + "meta": { + "invalid_schema": true + } +} diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go index c6a50d65da..ee1256c3c2 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go index 7cc6e16ad5..f2f4deccc2 100644 --- a/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go index b04b0b9162..2ff46075c0 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go index a431c6a210..e627e8d37d 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go index 680de73cb6..99a2072262 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go index 9b1b076ff5..09eebcea36 100644 --- a/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go index 2f45e7e9c2..e093aaa357 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go index fafac02949..ff1dd53f4b 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -35,7 +35,7 @@ func (q *Queries) Duplicate(ctx context.Context) (DuplicateRow, error) { const join = `-- name: Join :one SELECT u.id, u.name, u.age, p.id, p.user_id FROM posts AS p -INNER JOIN users AS u ON p.user_id = u.users.id +INNER JOIN users AS u ON p.user_id = u.id ` type JoinRow struct { diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql b/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql index 4b999b5629..1d0a02f109 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/query.sql @@ -15,7 +15,7 @@ SELECT sqlc.embed(users), sqlc.embed(users) FROM users; -- name: Join :one SELECT sqlc.embed(u), sqlc.embed(p) FROM posts AS p -INNER JOIN users AS u ON p.user_id = u.users.id; +INNER JOIN users AS u ON p.user_id = u.id; -- name: WithSchema :one SELECT sqlc.embed(bu) FROM baz.users AS bu; diff --git a/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql b/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql index a67026ba33..5a1d371b7e 100644 --- a/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql +++ b/internal/endtoend/testdata/sqlc_embed/sqlite/schema.sql @@ -1,4 +1,4 @@ -ATTACH 'baz.db' AS baz; +ATTACH ':memory:' AS baz; CREATE TABLE users ( id integer PRIMARY KEY, diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go index 7a1056b129..31a60f1ff7 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go index 83515bde55..e3b4bb8538 100644 --- a/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go index 7a1056b129..31a60f1ff7 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go index c6bfe4f9af..aa6e821698 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go index 81f62c09bc..b1df5a4e92 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go index aa230b1fc6..ca55c35d3c 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go index 7a1056b129..31a60f1ff7 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go index be00339eae..a982882a1e 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go index 341078e23c..b205553101 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest_strict @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go index fa58758ce9..8c0b3d3bb9 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest_strict diff --git a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go index 85ac408e00..1feb465be7 100644 --- a/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest_strict diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go index 7a1056b129..31a60f1ff7 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go index 69f76c570a..a5fd45abe3 100644 --- a/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_narg/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go index f074aa6496..b16319692b 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go index 4d944cd4cf..0d213c5db6 100644 --- a/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -20,7 +20,7 @@ WHERE id IN (/*SLICE:favourites*/?) func (q *Queries) FuncNullable(ctx context.Context, favourites []int32) ([]sql.NullString, error) { query := funcNullable - var queryParams []interface{} + var queryParams []any if len(favourites) > 0 { for _, v := range favourites { queryParams = append(queryParams, v) @@ -58,7 +58,7 @@ WHERE id NOT IN (/*SLICE:favourites*/?) func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int32) ([]sql.NullString, error) { query := funcNullableNot - var queryParams []interface{} + var queryParams []any if len(favourites) > 0 { for _, v := range favourites { queryParams = append(queryParams, v) @@ -102,7 +102,7 @@ type FuncParamIdentParams struct { func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { query := funcParamIdent - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { @@ -141,7 +141,7 @@ WHERE id IN (/*SLICE:favourites*/?) func (q *Queries) FuncParamSoloArg(ctx context.Context, favourites []int32) ([]string, error) { query := funcParamSoloArg - var queryParams []interface{} + var queryParams []any if len(favourites) > 0 { for _, v := range favourites { queryParams = append(queryParams, v) @@ -185,7 +185,7 @@ type FuncParamStringParams struct { func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { query := funcParamString - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { @@ -229,7 +229,7 @@ type SliceExecParams struct { func (q *Queries) SliceExec(ctx context.Context, arg SliceExecParams) error { query := sliceExec - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { @@ -250,7 +250,7 @@ WHERE mystr IN (/*SLICE:mystr*/?) func (q *Queries) TypedMyStr(ctx context.Context, mystr []mysql.ID) ([]sql.NullString, error) { query := typedMyStr - var queryParams []interface{} + var queryParams []any if len(mystr) > 0 { for _, v := range mystr { queryParams = append(queryParams, v) diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go index 60a7e7ea71..9399612d43 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/models.go @@ -1,11 +1,10 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { + ID int32 Name string } diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go index 25bab121c3..e3f3dd5816 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,10 +11,16 @@ import ( const funcParamIdent = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = $1 + AND id IN ($2) ` -func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamIdent, slug) +type FuncParamIdentParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { + rows, err := q.db.Query(ctx, funcParamIdent, arg.Slug, arg.Favourites) if err != nil { return nil, err } @@ -35,10 +41,16 @@ func (q *Queries) FuncParamIdent(ctx context.Context, slug string) ([]string, er const funcParamString = `-- name: FuncParamString :many SELECT name FROM foo WHERE name = $1 + AND id IN ($2) ` -func (q *Queries) FuncParamString(ctx context.Context, slug string) ([]string, error) { - rows, err := q.db.Query(ctx, funcParamString, slug) +type FuncParamStringParams struct { + Slug string + Favourites []int32 +} + +func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { + rows, err := q.db.Query(ctx, funcParamString, arg.Slug, arg.Favourites) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql index 2dfaa9cd5c..2a5fccf1fc 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/query.sql @@ -1,5 +1,7 @@ -- name: FuncParamIdent :many -SELECT name FROM foo WHERE name = sqlc.arg(slug); +SELECT name FROM foo WHERE name = sqlc.arg(slug) + AND id IN (sqlc.slice(favourites)); -- name: FuncParamString :many -SELECT name FROM foo WHERE name = sqlc.arg('slug'); +SELECT name FROM foo WHERE name = sqlc.arg('slug') + AND id IN (sqlc.slice('favourites')); diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/schema.sql b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/schema.sql index ec46e55ccb..43e6433e30 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/schema.sql +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/pgx/schema.sql @@ -1,2 +1,2 @@ -CREATE TABLE foo (name text not null); +CREATE TABLE foo (id int not null, name text not null); diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go index 43d5fbb255..9399612d43 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID int32 Name string diff --git a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go index 241df7a9be..1c72c365eb 100644 --- a/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -23,7 +23,7 @@ type FuncParamIdentParams struct { func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { query := funcParamIdent - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { @@ -68,7 +68,7 @@ type FuncParamStringParams struct { func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { query := funcParamString - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go index 1490d65f0a..22b127ce7a 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go index 4f87b49c57..2f36290c93 100644 --- a/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -18,7 +18,7 @@ WHERE id IN (/*SLICE:favourites*/?) func (q *Queries) FuncNullable(ctx context.Context, favourites []int64) ([]sql.NullString, error) { query := funcNullable - var queryParams []interface{} + var queryParams []any if len(favourites) > 0 { for _, v := range favourites { queryParams = append(queryParams, v) @@ -56,7 +56,7 @@ WHERE id NOT IN (/*SLICE:favourites*/?) func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int64) ([]sql.NullString, error) { query := funcNullableNot - var queryParams []interface{} + var queryParams []any if len(favourites) > 0 { for _, v := range favourites { queryParams = append(queryParams, v) @@ -100,7 +100,7 @@ type FuncParamIdentParams struct { func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { query := funcParamIdent - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { @@ -139,7 +139,7 @@ WHERE id IN (/*SLICE:favourites*/?) func (q *Queries) FuncParamSoloArg(ctx context.Context, favourites []int64) ([]string, error) { query := funcParamSoloArg - var queryParams []interface{} + var queryParams []any if len(favourites) > 0 { for _, v := range favourites { queryParams = append(queryParams, v) @@ -183,7 +183,7 @@ type FuncParamStringParams struct { func (q *Queries) FuncParamString(ctx context.Context, arg FuncParamStringParams) ([]string, error) { query := funcParamString - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { @@ -227,7 +227,7 @@ type SliceExecParams struct { func (q *Queries) SliceExec(ctx context.Context, arg SliceExecParams) error { query := sliceExec - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go index d38ee8ce1d..9ebfe37cf6 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -11,10 +11,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { @@ -40,7 +40,7 @@ func (q *Queries) Close() error { return err } -func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) { +func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (sql.Result, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...) @@ -51,7 +51,7 @@ func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args . } } -func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) { +func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Rows, error) { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...) @@ -62,7 +62,7 @@ func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args } } -func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row { +func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) *sql.Row { switch { case stmt != nil && q.tx != nil: return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...) diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go index 1490d65f0a..22b127ce7a 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go index d50e1c87fb..aec6437c84 100644 --- a/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlc_slice_prepared/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -23,7 +23,7 @@ type FuncParamIdentParams struct { func (q *Queries) FuncParamIdent(ctx context.Context, arg FuncParamIdentParams) ([]string, error) { query := funcParamIdent - var queryParams []interface{} + var queryParams []any queryParams = append(queryParams, arg.Slug) if len(arg.Favourites) > 0 { for _, v := range arg.Favourites { diff --git a/internal/endtoend/testdata/sqlite_skip_todo/db/db.go b/internal/endtoend/testdata/sqlite_skip_todo/db/db.go new file mode 100644 index 0000000000..93a0b7e23b --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/sqlite_skip_todo/db/models.go b/internal/endtoend/testdata/sqlite_skip_todo/db/models.go new file mode 100644 index 0000000000..d9ddf0a81e --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/db/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package db + +import ( + "database/sql" +) + +type Foo struct { + Bar sql.NullString +} diff --git a/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go b/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go new file mode 100644 index 0000000000..27211722b5 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/db/query.sql.go @@ -0,0 +1,67 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package db + +import ( + "context" + "database/sql" +) + +const getFoo = `-- name: GetFoo :many +SELECT bar +FROM foo +WHERE bar = ? +` + +func (q *Queries) GetFoo(ctx context.Context, bar sql.NullString) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, getFoo, bar) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar sql.NullString + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listFoo = `-- name: ListFoo :many +SELECT bar FROM foo +` + +func (q *Queries) ListFoo(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, listFoo) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var bar sql.NullString + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/sqlite_skip_todo/query.sql b/internal/endtoend/testdata/sqlite_skip_todo/query.sql new file mode 100644 index 0000000000..5e055229fa --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/query.sql @@ -0,0 +1,16 @@ +-- name: PragmaForeignKeysEnable :exec +PRAGMA foreign_keys = 1; + +-- name: ListFoo :many +SELECT * FROM foo; + +-- name: PragmaForeignKeysDisable :exec +PRAGMA foreign_keys = 0; + +-- name: PragmaForeignKeysGet :one +PRAGMA foreign_keys; + +-- name: GetFoo :many +SELECT * +FROM foo +WHERE bar = ?; diff --git a/internal/endtoend/testdata/sqlite_skip_todo/schema.sql b/internal/endtoend/testdata/sqlite_skip_todo/schema.sql new file mode 100644 index 0000000000..010d09e16f --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo ( + bar text +); diff --git a/internal/endtoend/testdata/sqlite_skip_todo/sqlc.json b/internal/endtoend/testdata/sqlite_skip_todo/sqlc.json new file mode 100644 index 0000000000..cbd787d930 --- /dev/null +++ b/internal/endtoend/testdata/sqlite_skip_todo/sqlc.json @@ -0,0 +1,16 @@ +{ + "version": "2", + "sql": [ + { + "engine": "sqlite", + "queries": "query.sql", + "schema": "schema.sql", + "gen": { + "go": { + "package": "db", + "out": "db" + } + } + } + ] +} diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go index 511d959cb0..8d40f61736 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go index 4a0b107b70..6f1e81df90 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,8 +10,10 @@ import ( ) const getAuthor = `-- name: GetAuthor :one -SELECT id, name, bio FROM authors1 -WHERE id = ?1 LIMIT 1 +SELECT id, name, bio +FROM authors1 +WHERE id = ?1 +LIMIT 1 ` func (q *Queries) GetAuthor(ctx context.Context, id int64) (Authors1, error) { diff --git a/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql b/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql index 749f91601d..2fe76dc099 100644 --- a/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql +++ b/internal/endtoend/testdata/sqlite_table_options/sqlite/query.sql @@ -1,3 +1,5 @@ -- name: GetAuthor :one -SELECT * FROM authors1 -WHERE id = ?1 LIMIT 1; +SELECT * +FROM authors1 +WHERE id = ?1 +LIMIT 1; diff --git a/internal/endtoend/testdata/star_expansion/mysql/go/db.go b/internal/endtoend/testdata/star_expansion/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion/mysql/go/models.go b/internal/endtoend/testdata/star_expansion/mysql/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go index 236f756cc2..b8abfb7ca3 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go index a7ac000d70..5f01bff758 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go index fa800a9a15..463744df69 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go index 1acdbb1c53..4a3ce47f74 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go index f3c21bb7b7..b56411ca25 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/db.go b/internal/endtoend/testdata/star_expansion/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/go/db.go +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/models.go b/internal/endtoend/testdata/star_expansion/sqlite/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/go/models.go +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go index f3c21bb7b7..47308250ae 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -54,7 +54,7 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) } const starQuotedExpansion = `-- name: StarQuotedExpansion :many -SELECT t.a, t.b FROM foo "t" +SELECT t.a, t.b FROM foo AS t ` func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { diff --git a/internal/endtoend/testdata/star_expansion/sqlite/query.sql b/internal/endtoend/testdata/star_expansion/sqlite/query.sql index 6249bb48b7..1afa2b3996 100644 --- a/internal/endtoend/testdata/star_expansion/sqlite/query.sql +++ b/internal/endtoend/testdata/star_expansion/sqlite/query.sql @@ -2,4 +2,4 @@ SELECT *, *, foo.* FROM foo; -- name: StarQuotedExpansion :many -SELECT "t".* FROM foo "t"; +SELECT t.* FROM foo AS t; diff --git a/internal/endtoend/testdata/star_expansion_core/mysql/exec.json b/internal/endtoend/testdata/star_expansion_core/mysql/exec.json new file mode 100644 index 0000000000..8da46d61b5 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/mysql/exec.json @@ -0,0 +1,6 @@ +{ + "command": "generate", + "env": { + "SQLCEXPERIMENT": "coreanalyzer" + } +} diff --git a/internal/endtoend/testdata/star_expansion_core/mysql/go/db.go b/internal/endtoend/testdata/star_expansion_core/mysql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/star_expansion_core/mysql/go/models.go b/internal/endtoend/testdata/star_expansion_core/mysql/go/models.go new file mode 100644 index 0000000000..3e874b1005 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/mysql/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A sql.NullString + C sql.NullString +} + +type Baz struct { + Z sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString + Group sql.NullString +} diff --git a/internal/endtoend/testdata/star_expansion_core/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_core/mysql/go/query.sql.go new file mode 100644 index 0000000000..10c1e7be16 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/mysql/go/query.sql.go @@ -0,0 +1,209 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansion = `-- name: StarExpansion :many +SELECT a, b, ` + "`" + `group` + "`" + `, a, b, ` + "`" + `group` + "`" + `, foo.a, foo.b, foo.` + "`" + `group` + "`" + ` FROM foo +` + +type StarExpansionRow struct { + A sql.NullString + B sql.NullString + Group sql.NullString + A_2 sql.NullString + B_2 sql.NullString + Group_2 sql.NullString + A_3 sql.NullString + B_3 sql.NullString + Group_3 sql.NullString +} + +func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { + rows, err := q.db.QueryContext(ctx, starExpansion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionRow + for rows.Next() { + var i StarExpansionRow + if err := rows.Scan( + &i.A, + &i.B, + &i.Group, + &i.A_2, + &i.B_2, + &i.Group_2, + &i.A_3, + &i.B_3, + &i.Group_3, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionAliasedSubquery = `-- name: StarExpansionAliasedSubquery :many +SELECT (SELECT z FROM baz LIMIT 1) AS x FROM foo GROUP BY x +` + +func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var x sql.NullString + if err := rows.Scan(&x); err != nil { + return nil, err + } + items = append(items, x) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH t AS (SELECT a, c FROM bar) SELECT a, c FROM t +` + +func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, starExpansionCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.A, &i.C); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionJoin = `-- name: StarExpansionJoin :many +SELECT foo.a, b, ` + "`" + `group` + "`" + `, bar.a, c FROM foo, bar +` + +type StarExpansionJoinRow struct { + A sql.NullString + B sql.NullString + Group sql.NullString + A_2 sql.NullString + C sql.NullString +} + +func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { + rows, err := q.db.QueryContext(ctx, starExpansionJoin) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionJoinRow + for rows.Next() { + var i StarExpansionJoinRow + if err := rows.Scan( + &i.A, + &i.B, + &i.Group, + &i.A_2, + &i.C, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionSubquery = `-- name: StarExpansionSubquery :many +SELECT a, c FROM (SELECT a, c FROM bar) sub +` + +func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.A, &i.C); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b, t.` + "`" + `group` + "`" + ` FROM foo ` + "`" + `t` + "`" + ` +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B, &i.Group); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/star_expansion_core/mysql/query.sql b/internal/endtoend/testdata/star_expansion_core/mysql/query.sql new file mode 100644 index 0000000000..89c1b257b0 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/mysql/query.sql @@ -0,0 +1,17 @@ +-- name: StarExpansion :many +SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT `t`.* FROM foo `t`; + +-- name: StarExpansionJoin :many +SELECT * FROM foo, bar; + +-- name: StarExpansionSubquery :many +SELECT * FROM (SELECT * FROM bar) sub; + +-- name: StarExpansionCTE :many +WITH t AS (SELECT * FROM bar) SELECT * FROM t; + +-- name: StarExpansionAliasedSubquery :many +SELECT (SELECT * FROM baz LIMIT 1) AS x FROM foo GROUP BY x; diff --git a/internal/endtoend/testdata/star_expansion_core/mysql/schema.sql b/internal/endtoend/testdata/star_expansion_core/mysql/schema.sql new file mode 100644 index 0000000000..1a6957d981 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/mysql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text, `group` text); +CREATE TABLE bar (a text, c text); +CREATE TABLE baz (z text); diff --git a/internal/endtoend/testdata/star_expansion_core/mysql/sqlc.json b/internal/endtoend/testdata/star_expansion_core/mysql/sqlc.json new file mode 100644 index 0000000000..974aa9ff9e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "mysql", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/star_expansion_core/postgresql/exec.json b/internal/endtoend/testdata/star_expansion_core/postgresql/exec.json new file mode 100644 index 0000000000..8da46d61b5 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/postgresql/exec.json @@ -0,0 +1,6 @@ +{ + "command": "generate", + "env": { + "SQLCEXPERIMENT": "coreanalyzer" + } +} diff --git a/internal/endtoend/testdata/star_expansion_core/postgresql/go/db.go b/internal/endtoend/testdata/star_expansion_core/postgresql/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/star_expansion_core/postgresql/go/models.go b/internal/endtoend/testdata/star_expansion_core/postgresql/go/models.go new file mode 100644 index 0000000000..3e874b1005 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/postgresql/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A sql.NullString + C sql.NullString +} + +type Baz struct { + Z sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString + Group sql.NullString +} diff --git a/internal/endtoend/testdata/star_expansion_core/postgresql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_core/postgresql/go/query.sql.go new file mode 100644 index 0000000000..3a688f9404 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/postgresql/go/query.sql.go @@ -0,0 +1,225 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansion = `-- name: StarExpansion :many +SELECT a, b, "group", a, b, "group", foo.a, foo.b, foo."group" FROM foo +` + +type StarExpansionRow struct { + A sql.NullString + B sql.NullString + Group sql.NullString + A_2 sql.NullString + B_2 sql.NullString + Group_2 sql.NullString + A_3 sql.NullString + B_3 sql.NullString + Group_3 sql.NullString +} + +func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { + rows, err := q.db.QueryContext(ctx, starExpansion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionRow + for rows.Next() { + var i StarExpansionRow + if err := rows.Scan( + &i.A, + &i.B, + &i.Group, + &i.A_2, + &i.B_2, + &i.Group_2, + &i.A_3, + &i.B_3, + &i.Group_3, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionAliasedSubquery = `-- name: StarExpansionAliasedSubquery :many +SELECT (SELECT z FROM baz LIMIT 1) AS x FROM foo GROUP BY x +` + +func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var x sql.NullString + if err := rows.Scan(&x); err != nil { + return nil, err + } + items = append(items, x) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH t AS (SELECT a, c FROM bar) SELECT a, c FROM t +` + +func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, starExpansionCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.A, &i.C); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionJoin = `-- name: StarExpansionJoin :many +SELECT foo.a, b, "group", bar.a, c FROM foo, bar +` + +type StarExpansionJoinRow struct { + A sql.NullString + B sql.NullString + Group sql.NullString + A_2 sql.NullString + C sql.NullString +} + +func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { + rows, err := q.db.QueryContext(ctx, starExpansionJoin) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionJoinRow + for rows.Next() { + var i StarExpansionJoinRow + if err := rows.Scan( + &i.A, + &i.B, + &i.Group, + &i.A_2, + &i.C, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionReturning = `-- name: StarExpansionReturning :one +INSERT INTO bar (a, c) VALUES ($1, $2) RETURNING a, c +` + +type StarExpansionReturningParams struct { + A sql.NullString + C sql.NullString +} + +func (q *Queries) StarExpansionReturning(ctx context.Context, arg StarExpansionReturningParams) (Bar, error) { + row := q.db.QueryRowContext(ctx, starExpansionReturning, arg.A, arg.C) + var i Bar + err := row.Scan(&i.A, &i.C) + return i, err +} + +const starExpansionSubquery = `-- name: StarExpansionSubquery :many +SELECT a, c FROM (SELECT a, c FROM bar) sub +` + +func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.A, &i.C); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b, t."group" FROM foo "t" +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B, &i.Group); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/star_expansion_core/postgresql/query.sql b/internal/endtoend/testdata/star_expansion_core/postgresql/query.sql new file mode 100644 index 0000000000..099f54dc6d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/postgresql/query.sql @@ -0,0 +1,20 @@ +-- name: StarExpansion :many +SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; + +-- name: StarExpansionJoin :many +SELECT * FROM foo, bar; + +-- name: StarExpansionSubquery :many +SELECT * FROM (SELECT * FROM bar) sub; + +-- name: StarExpansionCTE :many +WITH t AS (SELECT * FROM bar) SELECT * FROM t; + +-- name: StarExpansionReturning :one +INSERT INTO bar (a, c) VALUES ($1, $2) RETURNING *; + +-- name: StarExpansionAliasedSubquery :many +SELECT (SELECT * FROM baz LIMIT 1) AS x FROM foo GROUP BY x; diff --git a/internal/endtoend/testdata/star_expansion_core/postgresql/schema.sql b/internal/endtoend/testdata/star_expansion_core/postgresql/schema.sql new file mode 100644 index 0000000000..126783157b --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/postgresql/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE foo (a text, b text, "group" text); +CREATE TABLE bar (a text, c text); +CREATE TABLE baz (z text); diff --git a/internal/endtoend/testdata/star_expansion_core/postgresql/sqlc.json b/internal/endtoend/testdata/star_expansion_core/postgresql/sqlc.json new file mode 100644 index 0000000000..cd518671ac --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/postgresql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "postgresql", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/star_expansion_core/sqlite/exec.json b/internal/endtoend/testdata/star_expansion_core/sqlite/exec.json new file mode 100644 index 0000000000..8da46d61b5 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/sqlite/exec.json @@ -0,0 +1,6 @@ +{ + "command": "generate", + "env": { + "SQLCEXPERIMENT": "coreanalyzer" + } +} diff --git a/internal/endtoend/testdata/star_expansion_core/sqlite/go/db.go b/internal/endtoend/testdata/star_expansion_core/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/star_expansion_core/sqlite/go/models.go b/internal/endtoend/testdata/star_expansion_core/sqlite/go/models.go new file mode 100644 index 0000000000..c19552a0ab --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/sqlite/go/models.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A sql.NullString + C sql.NullString +} + +type Baz struct { + Z sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString + Group sql.NullString +} + +type Recipe struct { + ID int64 + Name string +} + +type RecipesFt struct { + Name string +} diff --git a/internal/endtoend/testdata/star_expansion_core/sqlite/go/query.sql.go b/internal/endtoend/testdata/star_expansion_core/sqlite/go/query.sql.go new file mode 100644 index 0000000000..4ed292f831 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/sqlite/go/query.sql.go @@ -0,0 +1,279 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansion = `-- name: StarExpansion :many +SELECT a, b, "group", a, b, "group", foo.a, foo.b, foo."group" FROM foo +` + +type StarExpansionRow struct { + A sql.NullString + B sql.NullString + Group sql.NullString + A_2 sql.NullString + B_2 sql.NullString + Group_2 sql.NullString + A_3 sql.NullString + B_3 sql.NullString + Group_3 sql.NullString +} + +func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { + rows, err := q.db.QueryContext(ctx, starExpansion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionRow + for rows.Next() { + var i StarExpansionRow + if err := rows.Scan( + &i.A, + &i.B, + &i.Group, + &i.A_2, + &i.B_2, + &i.Group_2, + &i.A_3, + &i.B_3, + &i.Group_3, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionAliasedSubquery = `-- name: StarExpansionAliasedSubquery :many +SELECT (SELECT z FROM baz LIMIT 1) AS x FROM foo GROUP BY x +` + +func (q *Queries) StarExpansionAliasedSubquery(ctx context.Context) ([]sql.NullString, error) { + rows, err := q.db.QueryContext(ctx, starExpansionAliasedSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []sql.NullString + for rows.Next() { + var x sql.NullString + if err := rows.Scan(&x); err != nil { + return nil, err + } + items = append(items, x) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionCTE = `-- name: StarExpansionCTE :many +WITH t AS (SELECT a, c FROM bar) SELECT a, c FROM t +` + +func (q *Queries) StarExpansionCTE(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, starExpansionCTE) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.A, &i.C); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionHiddenColumns = `-- name: StarExpansionHiddenColumns :many +SELECT name FROM recipes_fts +` + +func (q *Queries) StarExpansionHiddenColumns(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, starExpansionHiddenColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var name string + if err := rows.Scan(&name); err != nil { + return nil, err + } + items = append(items, name) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionJoin = `-- name: StarExpansionJoin :many +SELECT foo.a, b, "group", bar.a, c FROM foo, bar +` + +type StarExpansionJoinRow struct { + A sql.NullString + B sql.NullString + Group sql.NullString + A_2 sql.NullString + C sql.NullString +} + +func (q *Queries) StarExpansionJoin(ctx context.Context) ([]StarExpansionJoinRow, error) { + rows, err := q.db.QueryContext(ctx, starExpansionJoin) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionJoinRow + for rows.Next() { + var i StarExpansionJoinRow + if err := rows.Scan( + &i.A, + &i.B, + &i.Group, + &i.A_2, + &i.C, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionQualifiedHiddenColumns = `-- name: StarExpansionQualifiedHiddenColumns :many +SELECT recipes_fts.name FROM recipes_fts +` + +func (q *Queries) StarExpansionQualifiedHiddenColumns(ctx context.Context) ([]string, error) { + rows, err := q.db.QueryContext(ctx, starExpansionQualifiedHiddenColumns) + if err != nil { + return nil, err + } + defer rows.Close() + var items []string + for rows.Next() { + var name string + if err := rows.Scan(&name); err != nil { + return nil, err + } + items = append(items, name) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starExpansionReturning = `-- name: StarExpansionReturning :one +INSERT INTO bar (a, c) VALUES (?, ?) RETURNING a, c +` + +type StarExpansionReturningParams struct { + A sql.NullString + C sql.NullString +} + +func (q *Queries) StarExpansionReturning(ctx context.Context, arg StarExpansionReturningParams) (Bar, error) { + row := q.db.QueryRowContext(ctx, starExpansionReturning, arg.A, arg.C) + var i Bar + err := row.Scan(&i.A, &i.C) + return i, err +} + +const starExpansionSubquery = `-- name: StarExpansionSubquery :many +SELECT a, c FROM (SELECT a, c FROM bar) AS sub +` + +func (q *Queries) StarExpansionSubquery(ctx context.Context) ([]Bar, error) { + rows, err := q.db.QueryContext(ctx, starExpansionSubquery) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Bar + for rows.Next() { + var i Bar + if err := rows.Scan(&i.A, &i.C); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b, t."group" FROM foo AS t +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Foo + for rows.Next() { + var i Foo + if err := rows.Scan(&i.A, &i.B, &i.Group); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/star_expansion_core/sqlite/query.sql b/internal/endtoend/testdata/star_expansion_core/sqlite/query.sql new file mode 100644 index 0000000000..2fb7ec1b7f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/sqlite/query.sql @@ -0,0 +1,26 @@ +-- name: StarExpansion :many +SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT t.* FROM foo AS t; + +-- name: StarExpansionJoin :many +SELECT * FROM foo, bar; + +-- name: StarExpansionSubquery :many +SELECT * FROM (SELECT * FROM bar) AS sub; + +-- name: StarExpansionCTE :many +WITH t AS (SELECT * FROM bar) SELECT * FROM t; + +-- name: StarExpansionReturning :one +INSERT INTO bar (a, c) VALUES (?, ?) RETURNING *; + +-- name: StarExpansionAliasedSubquery :many +SELECT (SELECT * FROM baz LIMIT 1) AS x FROM foo GROUP BY x; + +-- name: StarExpansionHiddenColumns :many +SELECT * FROM recipes_fts; + +-- name: StarExpansionQualifiedHiddenColumns :many +SELECT recipes_fts.* FROM recipes_fts; diff --git a/internal/endtoend/testdata/star_expansion_core/sqlite/schema.sql b/internal/endtoend/testdata/star_expansion_core/sqlite/schema.sql new file mode 100644 index 0000000000..0442abfdfc --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE foo (a text, b text, "group" text); +CREATE TABLE bar (a text, c text); +CREATE TABLE baz (z text); +CREATE TABLE recipes (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL); +CREATE VIRTUAL TABLE recipes_fts USING FTS5 (name, content='recipes', content_rowid='id'); diff --git a/internal/endtoend/testdata/star_expansion_core/sqlite/sqlc.json b/internal/endtoend/testdata/star_expansion_core/sqlite/sqlc.json new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_core/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "sqlite", + "path": "go", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go index d38098e5d7..9f22e00e9c 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go index 892754dba8..740b103fa7 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go index c959615772..516fecffb7 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go index 5efa43c5f1..db22d0bd04 100644 --- a/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go index d38098e5d7..9f22e00e9c 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go index cf95d167cb..1fe02a3dcf 100644 --- a/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_cte/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/exec.json b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/db.go b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/models.go b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..9662cea6d6 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Version struct { + ID int64 + Name pgtype.Text + PreviousVersionID int64 +} diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..2782a00139 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/go/query.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getLatestVersionWithSubquery = `-- name: GetLatestVersionWithSubquery :one +SELECT * +FROM versions +WHERE versions.id IN ( + WITH RECURSIVE search_tree(id) AS ( + SELECT id, 0 as chain_id, 0 as chain_counter + FROM versions + ) + SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id + FROM search_tree + ORDER BY search_tree.chain_id, chain_counter DESC +) +` + +func (q *Queries) GetLatestVersionWithSubquery(ctx context.Context) (Version, error) { + row := q.db.QueryRow(ctx, getLatestVersionWithSubquery) + var i Version + err := row.Scan(&i.ID, &i.Name, &i.PreviousVersionID) + return i, err +} diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/query.sql b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/query.sql new file mode 100644 index 0000000000..4a667243fd --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/query.sql @@ -0,0 +1,13 @@ +-- name: GetLatestVersionWithSubquery :one +SELECT * +FROM versions +WHERE versions.id IN ( + WITH RECURSIVE search_tree(id) AS ( + SELECT id, 0 as chain_id, 0 as chain_counter + FROM versions + ) + SELECT DISTINCT ON (search_tree.chain_id) + search_tree.id + FROM search_tree + ORDER BY search_tree.chain_id, chain_counter DESC +); diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/schema.sql b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..1825de4f8f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/schema.sql @@ -0,0 +1,6 @@ +-- Example queries for sqlc +CREATE TABLE versions ( + id BIGSERIAL PRIMARY KEY, + name TEXT, + previous_version_id bigint NOT NULL +); diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/stderr.txt new file mode 100644 index 0000000000..2a064b8184 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_failed/postgresql/pgx/stderr.txt @@ -0,0 +1,2 @@ +# package querytest +query.sql:1:1: star expansion failed for query diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go index d38098e5d7..9f22e00e9c 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go index 515779748b..6f269946bb 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go index c959615772..516fecffb7 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go index 2c21522d96..480bec0176 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go index d38098e5d7..9f22e00e9c 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go index a4a6fed9f0..cc764fc05e 100644 --- a/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_from_cte/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go b/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go b/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go index d38098e5d7..9f22e00e9c 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go index 330c67cead..364a39a6b5 100644 --- a/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go index d38098e5d7..9f22e00e9c 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go index 85a8696dc2..b1c4a10aab 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go index c959615772..516fecffb7 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go index 8220f9de26..ffb00f684d 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go index d38098e5d7..9f22e00e9c 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go index 330c67cead..364a39a6b5 100644 --- a/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_join/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go index 607ecae53e..f1cb8da4a5 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go index 7fdc7c9a7d..3f9cd7a481 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go index 607ecae53e..f1cb8da4a5 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go index 707da6cc40..614cde97b4 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go index 3a66cc6236..49f34e6bf3 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go index 707da6cc40..614cde97b4 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go index 607ecae53e..f1cb8da4a5 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go index f3cb141420..d3cee046ce 100644 --- a/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_reserved/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_series/issue.md b/internal/endtoend/testdata/star_expansion_series/issue.md new file mode 100644 index 0000000000..72e3e3aa9f --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1995 diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/db.go b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/models.go b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..4135201b23 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Alertreport struct { + Eventdate pgtype.Date +} diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..4da9cb4121 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/go/query.sql.go @@ -0,0 +1,56 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +const countAlertReportBy = `-- name: CountAlertReportBy :many +select DATE_TRUNC($1,ts)::text as datetime,coalesce(count,0) as count from +( + SELECT DATE_TRUNC($1,eventdate) as hr ,count(*) + FROM alertreport + where eventdate between $2 and $3 + GROUP BY 1 +) AS cnt +right outer join ( SELECT ts FROM generate_series ( $2, $3, CONCAT('1 ',$1)::interval) AS ts ) as dte +on DATE_TRUNC($1, ts ) = cnt.hr +order by 1 asc +` + +type CountAlertReportByParams struct { + DateTrunc string + Eventdate pgtype.Date + Eventdate_2 pgtype.Date +} + +type CountAlertReportByRow struct { + Datetime string + Count int64 +} + +func (q *Queries) CountAlertReportBy(ctx context.Context, arg CountAlertReportByParams) ([]CountAlertReportByRow, error) { + rows, err := q.db.Query(ctx, countAlertReportBy, arg.DateTrunc, arg.Eventdate, arg.Eventdate_2) + if err != nil { + return nil, err + } + defer rows.Close() + var items []CountAlertReportByRow + for rows.Next() { + var i CountAlertReportByRow + if err := rows.Scan(&i.Datetime, &i.Count); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/query.sql b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/query.sql new file mode 100644 index 0000000000..df13ae9a96 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/query.sql @@ -0,0 +1,11 @@ +-- name: CountAlertReportBy :many +select DATE_TRUNC($1,ts)::text as datetime,coalesce(count,0) as count from +( + SELECT DATE_TRUNC($1,eventdate) as hr ,count(*) + FROM alertreport + where eventdate between $2 and $3 + GROUP BY 1 +) AS cnt +right outer join ( SELECT * FROM generate_series ( $2, $3, CONCAT('1 ',$1)::interval) AS ts ) as dte +on DATE_TRUNC($1, ts ) = cnt.hr +order by 1 asc; diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/schema.sql b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..533757a462 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/schema.sql @@ -0,0 +1,3 @@ +CREATE TABLE alertreport ( + eventdate date +); diff --git a/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion_series/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go index caa5b7cff2..5dff54cbe5 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go index 9104f3064a..a44019cc62 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go index fa800a9a15..463744df69 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go index 9104f3064a..a44019cc62 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go index bd0fa15100..a26317d3fb 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go index caa5b7cff2..5dff54cbe5 100644 --- a/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/star_expansion_subquery/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go index a1ac02ccf5..a3b713ffee 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go index 34959e0396..1b7b4ef7a9 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go index a1ac02ccf5..a3b713ffee 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go index aec34a3382..3e5eac58e9 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go index 81cc7f3173..baf8c54520 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go index aec34a3382..3e5eac58e9 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go index a1ac02ccf5..a3b713ffee 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go index 34959e0396..1b7b4ef7a9 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go index b024264998..90e3dcd8fa 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go index 086d1cb7a8..6e09c33be3 100644 --- a/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/subquery_calculated_column/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go index 39fe1356af..933c3cb19b 100644 --- a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go index 33f9e045aa..af828e1d45 100644 --- a/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/sum_type/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go index 6f38d05c40..3d963fd261 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go index 783392c21b..1766c85261 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go index b4ee022e62..9e0054c59a 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Transaction struct { ID int64 Uri string diff --git a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go index 21e32608e7..1b791bcb61 100644 --- a/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go index 62525257f0..dd9fffbe4d 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go index 2b9fa93fe7..5cd9637531 100644 --- a/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/table_function/sqlite/go/db.go b/internal/endtoend/testdata/table_function/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/table_function/sqlite/go/db.go +++ b/internal/endtoend/testdata/table_function/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/table_function/sqlite/go/models.go b/internal/endtoend/testdata/table_function/sqlite/go/models.go index 0b93217d84..1b78427b8f 100644 --- a/internal/endtoend/testdata/table_function/sqlite/go/models.go +++ b/internal/endtoend/testdata/table_function/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Transaction struct { Uri string ProgramID string diff --git a/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go index bdfec65de1..345333f3f7 100644 --- a/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,15 +11,12 @@ import ( const getTransaction = `-- name: GetTransaction :many SELECT - json_extract(transactions.data, '$.transaction.signatures[0]'), - json_group_array(instructions.value) -FROM - transactions, - json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions -WHERE - transactions.program_id = ? - AND json_extract(transactions.data, '$.transaction.signatures[0]') > ? - AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id + json_extract(transactions.data, '$.transaction.signatures[0]'), + json_group_array(instructions.value) +FROM transactions, json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions +WHERE transactions.program_id = ? + AND json_extract(transactions.data, '$.transaction.signatures[0]') > ? + AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id GROUP BY transactions.rowid LIMIT ? ` @@ -31,8 +28,8 @@ type GetTransactionParams struct { } type GetTransactionRow struct { - JsonExtract interface{} - JsonGroupArray interface{} + JsonExtract any + JsonGroupArray string } func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) ([]GetTransactionRow, error) { diff --git a/internal/endtoend/testdata/table_function/sqlite/query.sql b/internal/endtoend/testdata/table_function/sqlite/query.sql index 867e1114cb..6b79cdca84 100644 --- a/internal/endtoend/testdata/table_function/sqlite/query.sql +++ b/internal/endtoend/testdata/table_function/sqlite/query.sql @@ -1,13 +1,10 @@ /* name: GetTransaction :many */ SELECT - json_extract(transactions.data, '$.transaction.signatures[0]'), - json_group_array(instructions.value) -FROM - transactions, - json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions -WHERE - transactions.program_id = ? - AND json_extract(transactions.data, '$.transaction.signatures[0]') > ? - AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id + json_extract(transactions.data, '$.transaction.signatures[0]'), + json_group_array(instructions.value) +FROM transactions, json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions +WHERE transactions.program_id = ? + AND json_extract(transactions.data, '$.transaction.signatures[0]') > ? + AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id GROUP BY transactions.rowid LIMIT ?; diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/db.go b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/models.go b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/models.go new file mode 100644 index 0000000000..b1b575c69a --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/models.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name sql.NullString +} + +type Book struct { + ID int64 + Title sql.NullString +} + +type User struct { + ID int64 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go new file mode 100644 index 0000000000..6963209e6b --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go @@ -0,0 +1,183 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const deleteAuthor = `-- name: DeleteAuthor :exec +DELETE FROM "Authors" WHERE id = ? +` + +func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthor, id) + return err +} + +const deleteBook = `-- name: DeleteBook :exec +DELETE FROM books WHERE id = ? +` + +func (q *Queries) DeleteBook(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteBook, id) + return err +} + +const deleteUser = `-- name: DeleteUser :exec +DELETE FROM users WHERE id = ? +` + +func (q *Queries) DeleteUser(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteUser, id) + return err +} + +const deleteUserMixedCase = `-- name: DeleteUserMixedCase :exec +DELETE FROM users WHERE id = ? +` + +func (q *Queries) DeleteUserMixedCase(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteUserMixedCase, id) + return err +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name FROM "Authors" WHERE id = ? +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const getBook = `-- name: GetBook :one +SELECT id, title FROM books WHERE id = ? +` + +func (q *Queries) GetBook(ctx context.Context, id int64) (Book, error) { + row := q.db.QueryRowContext(ctx, getBook, id) + var i Book + err := row.Scan(&i.ID, &i.Title) + return i, err +} + +const getUser = `-- name: GetUser :one +SELECT id, name FROM users WHERE id = ? +` + +func (q *Queries) GetUser(ctx context.Context, id int64) (User, error) { + row := q.db.QueryRowContext(ctx, getUser, id) + var i User + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const getUserMixedCase = `-- name: GetUserMixedCase :one +SELECT id, name FROM users WHERE id = ? +` + +func (q *Queries) GetUserMixedCase(ctx context.Context, id int64) (User, error) { + row := q.db.QueryRowContext(ctx, getUserMixedCase, id) + var i User + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const insertAuthor = `-- name: InsertAuthor :exec +INSERT INTO "Authors" (name) VALUES (?) +` + +func (q *Queries) InsertAuthor(ctx context.Context, name sql.NullString) error { + _, err := q.db.ExecContext(ctx, insertAuthor, name) + return err +} + +const insertBook = `-- name: InsertBook :exec +INSERT INTO books (title) VALUES (?) +` + +func (q *Queries) InsertBook(ctx context.Context, title sql.NullString) error { + _, err := q.db.ExecContext(ctx, insertBook, title) + return err +} + +const insertUser = `-- name: InsertUser :exec +INSERT INTO users (name) VALUES (?) +` + +func (q *Queries) InsertUser(ctx context.Context, name sql.NullString) error { + _, err := q.db.ExecContext(ctx, insertUser, name) + return err +} + +const insertUserMixedCase = `-- name: InsertUserMixedCase :exec +INSERT INTO users (name) VALUES (?) +` + +func (q *Queries) InsertUserMixedCase(ctx context.Context, name sql.NullString) error { + _, err := q.db.ExecContext(ctx, insertUserMixedCase, name) + return err +} + +const updateAuthor = `-- name: UpdateAuthor :exec +UPDATE "Authors" SET name = ? WHERE id = ? +` + +type UpdateAuthorParams struct { + Name sql.NullString + ID int64 +} + +func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) error { + _, err := q.db.ExecContext(ctx, updateAuthor, arg.Name, arg.ID) + return err +} + +const updateBook = `-- name: UpdateBook :exec +UPDATE books SET title = ? WHERE id = ? +` + +type UpdateBookParams struct { + Title sql.NullString + ID int64 +} + +func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error { + _, err := q.db.ExecContext(ctx, updateBook, arg.Title, arg.ID) + return err +} + +const updateUser = `-- name: UpdateUser :exec +UPDATE users SET name = ? WHERE id = ? +` + +type UpdateUserParams struct { + Name sql.NullString + ID int64 +} + +func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error { + _, err := q.db.ExecContext(ctx, updateUser, arg.Name, arg.ID) + return err +} + +const updateUserMixedCase = `-- name: UpdateUserMixedCase :exec +UPDATE users SET name = ? WHERE id = ? +` + +type UpdateUserMixedCaseParams struct { + Name sql.NullString + ID int64 +} + +func (q *Queries) UpdateUserMixedCase(ctx context.Context, arg UpdateUserMixedCaseParams) error { + _, err := q.db.ExecContext(ctx, updateUserMixedCase, arg.Name, arg.ID) + return err +} diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/query.sql b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/query.sql new file mode 100644 index 0000000000..daaa164168 --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/query.sql @@ -0,0 +1,47 @@ +-- name: InsertUser :exec +INSERT INTO users (name) VALUES (?); + +-- name: InsertUserMixedCase :exec +INSERT INTO users (name) VALUES (?); + +-- name: InsertAuthor :exec +INSERT INTO "Authors" (name) VALUES (?); + +-- name: InsertBook :exec +INSERT INTO books (title) VALUES (?); + +-- name: UpdateUser :exec +UPDATE users SET name = ? WHERE id = ?; + +-- name: UpdateUserMixedCase :exec +UPDATE users SET name = ? WHERE id = ?; + +-- name: UpdateAuthor :exec +UPDATE "Authors" SET name = ? WHERE id = ?; + +-- name: UpdateBook :exec +UPDATE books SET title = ? WHERE id = ?; + +-- name: DeleteUser :exec +DELETE FROM users WHERE id = ?; + +-- name: DeleteUserMixedCase :exec +DELETE FROM users WHERE id = ?; + +-- name: DeleteAuthor :exec +DELETE FROM "Authors" WHERE id = ?; + +-- name: DeleteBook :exec +DELETE FROM books WHERE id = ?; + +-- name: GetUser :one +SELECT * FROM users WHERE id = ?; + +-- name: GetUserMixedCase :one +SELECT * FROM users WHERE id = ?; + +-- name: GetAuthor :one +SELECT * FROM "Authors" WHERE id = ?; + +-- name: GetBook :one +SELECT * FROM books WHERE id = ?; diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/schema.sql b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/schema.sql new file mode 100644 index 0000000000..3c43ae1d5d --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/schema.sql @@ -0,0 +1,13 @@ +-- Test table name case sensitivity handling across different SQLite operations +-- Create tables with different case patterns to verify consistent name resolution +CREATE TABLE users (id integer primary key, name text); +CREATE TABLE "Authors" (id integer primary key, name text); +CREATE TABLE Books (id integer primary key, title text); + +-- Create a temporary table to test drop operations +CREATE TABLE temp_orders (id integer primary key); +DROP TABLE temp_orders; + +-- Create another temp table with quoted identifier +CREATE TABLE "temp_products" (id integer primary key); +DROP TABLE "temp_products"; diff --git a/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/sqlc.json b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/sqlc.json new file mode 100644 index 0000000000..cd66df063b --- /dev/null +++ b/internal/endtoend/testdata/table_name_case_sensitivity/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "sqlite", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} diff --git a/internal/endtoend/testdata/truncate/mysql/go/db.go b/internal/endtoend/testdata/truncate/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/db.go +++ b/internal/endtoend/testdata/truncate/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/truncate/mysql/go/models.go b/internal/endtoend/testdata/truncate/mysql/go/models.go index 40001531be..9ac222a278 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/models.go +++ b/internal/endtoend/testdata/truncate/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID uint64 } diff --git a/internal/endtoend/testdata/truncate/mysql/go/query.sql.go b/internal/endtoend/testdata/truncate/mysql/go/query.sql.go index 2fcc425a8e..b0369ef304 100644 --- a/internal/endtoend/testdata/truncate/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go index ce7211d88a..606112035d 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go index ce7211d88a..606112035d 100644 --- a/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go index cad733c5a3..39cdf56e55 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Bar struct { ID int32 } diff --git a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go index 2fcc425a8e..b0369ef304 100644 --- a/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/truncate/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go index f695e853a7..4c24667a58 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go index 270705c890..2f36a6e4e9 100644 --- a/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/types_uuid/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go index a10206b354..617353d689 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -13,7 +13,7 @@ const listFoos = `-- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1) ` -func (q *Queries) ListFoos(ctx context.Context, frobnicate interface{}) (string, error) { +func (q *Queries) ListFoos(ctx context.Context, frobnicate any) (string, error) { row := q.db.QueryRow(ctx, listFoos, frobnicate) var id string err := row.Scan(&id) diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go index a10206b354..617353d689 100644 --- a/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -13,7 +13,7 @@ const listFoos = `-- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1) ` -func (q *Queries) ListFoos(ctx context.Context, frobnicate interface{}) (string, error) { +func (q *Queries) ListFoos(ctx context.Context, frobnicate any) (string, error) { row := q.db.QueryRow(ctx, listFoos, frobnicate) var id string err := row.Scan(&id) diff --git a/internal/endtoend/testdata/unknown_func/stdlib/go/db.go b/internal/endtoend/testdata/unknown_func/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/go/db.go +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unknown_func/stdlib/go/models.go b/internal/endtoend/testdata/unknown_func/stdlib/go/models.go index 91961addfb..e954fe132f 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/go/models.go +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID string } diff --git a/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go b/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go index 4e1e3d7a31..79dce10350 100644 --- a/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unknown_func/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -13,7 +13,7 @@ const listFoos = `-- name: ListFoos :one SELECT id FROM foo WHERE id = frobnicate($1) ` -func (q *Queries) ListFoos(ctx context.Context, frobnicate interface{}) (string, error) { +func (q *Queries) ListFoos(ctx context.Context, frobnicate any) (string, error) { row := q.db.QueryRowContext(ctx, listFoos, frobnicate) var id string err := row.Scan(&id) diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go index 94225e9086..7d9643ebee 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go index 00a20e6651..4d4e005bcf 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go index 74b828466d..9296f7be0e 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go index a39478b0b9..07a26f89f9 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go index 0748493e6c..9df09c94a2 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go index b0e40e1bc4..0b4d28807e 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go index 94225e9086..7d9643ebee 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go index 00a20e6651..4d4e005bcf 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go index bff552d8d7..110208dcbf 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go index 9f0b7ce585..858f2fd786 100644 --- a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Item struct { ItemID int64 } diff --git a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go index cf64948cd8..fc8ca8ecdd 100644 --- a/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_star/postgresql/pgx/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go index e3e3c259ab..82ed0a7936 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type ArrayValue struct { ID int64 Values []string diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go index ea93152266..f92fe57d52 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go index 0902286ab0..bebb7c94af 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go index e3e3c259ab..82ed0a7936 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type ArrayValue struct { ID int64 Values []string diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go index ea93152266..f92fe57d52 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go index 0902286ab0..bebb7c94af 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go index e3e3c259ab..82ed0a7936 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type ArrayValue struct { ID int64 Values []string diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go index ea93152266..f92fe57d52 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go index fd1e2c489d..8578cc6874 100644 --- a/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/unnest_with_ordinality/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unsigned_params/mysql/go/db.go b/internal/endtoend/testdata/unsigned_params/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/go/db.go +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/unsigned_params/mysql/go/models.go b/internal/endtoend/testdata/unsigned_params/mysql/go/models.go index a2799f1b8f..574d298429 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/go/models.go +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { ID uint32 } diff --git a/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go b/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go index f1a77bb3ba..6b29bebdc1 100644 --- a/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/unsigned_params/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go index 8ff2474e60..4f5ee4e006 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/models.go @@ -1,13 +1,11 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db -import () - type Repro struct { - ID interface{} - Name interface{} - Seq interface{} + ID any + Name any + Seq any } diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go index 3e921027a9..faef31678f 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db @@ -10,10 +10,10 @@ import ( ) const getRepro = `-- name: GetRepro :one -select id, name, seq from repro where id = ? limit 1 +SELECT id, name, seq FROM repro WHERE id = ? LIMIT 1 ` -func (q *Queries) GetRepro(ctx context.Context, id interface{}) (Repro, error) { +func (q *Queries) GetRepro(ctx context.Context, id any) (Repro, error) { row := q.db.QueryRowContext(ctx, getRepro, id) var i Repro err := row.Scan(&i.ID, &i.Name, &i.Seq) diff --git a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql index b90ec62481..b3923f261f 100644 --- a/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql +++ b/internal/endtoend/testdata/untyped_columns/sqlite/stdlib/query.sql @@ -1,2 +1,2 @@ -- name: GetRepro :one -select * from repro where id = ? limit 1; \ No newline at end of file +SELECT * FROM repro WHERE id = ? LIMIT 1; diff --git a/internal/endtoend/testdata/update_array_index/issue.md b/internal/endtoend/testdata/update_array_index/issue.md new file mode 100644 index 0000000000..d86fb5d2a4 --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/issue.md @@ -0,0 +1 @@ +https://github.com/sqlc-dev/sqlc/issues/1532 diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/exec.json b/internal/endtoend/testdata/update_array_index/postgresql/pgx/exec.json new file mode 100644 index 0000000000..ee1b7ecd9e --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["managed-db"] +} diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/db.go b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..2666c1c05d --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/models.go b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..f7de8cde85 --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Author struct { + ID int64 + Names []string +} diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..3ec440777f --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/go/query.sql.go @@ -0,0 +1,30 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" +) + +const updateAuthor = `-- name: UpdateAuthor :one +update authors +set names[$1] = $2 +where id=$3 +RETURNING id, names +` + +type UpdateAuthorParams struct { + Names int32 + Names_2 string + ID int64 +} + +func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) (Author, error) { + row := q.db.QueryRow(ctx, updateAuthor, arg.Names, arg.Names_2, arg.ID) + var i Author + err := row.Scan(&i.ID, &i.Names) + return i, err +} diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/query.sql b/internal/endtoend/testdata/update_array_index/postgresql/pgx/query.sql new file mode 100644 index 0000000000..32b4e9c148 --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/query.sql @@ -0,0 +1,5 @@ +-- name: UpdateAuthor :one +update authors +set names[$1] = $2 +where id=$3 +RETURNING *; diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/schema.sql b/internal/endtoend/testdata/update_array_index/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..286ab791fa --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/schema.sql @@ -0,0 +1,4 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + names text[] NOT NULL +); diff --git a/internal/endtoend/testdata/update_array_index/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/update_array_index/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5dc63e3f91 --- /dev/null +++ b/internal/endtoend/testdata/update_array_index/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go b/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go b/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go index 78aa133e28..97ccea3b0b 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go index 7bbfbed0e2..9325d9a3b8 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go index b4aaf069a0..6aae2a63f8 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go index 4691c94350..cabcf2f35a 100644 --- a/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_cte/stdlib/go/db.go b/internal/endtoend/testdata/update_cte/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/go/db.go +++ b/internal/endtoend/testdata/update_cte/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_cte/stdlib/go/models.go b/internal/endtoend/testdata/update_cte/stdlib/go/models.go index 78aa133e28..97ccea3b0b 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/go/models.go +++ b/internal/endtoend/testdata/update_cte/stdlib/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go index af1ed471c4..b62455f764 100644 --- a/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_cte/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_inner_join/db/db.go b/internal/endtoend/testdata/update_inner_join/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/update_inner_join/db/db.go +++ b/internal/endtoend/testdata/update_inner_join/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_inner_join/db/models.go b/internal/endtoend/testdata/update_inner_join/db/models.go index 8d26589029..7be04ecc89 100644 --- a/internal/endtoend/testdata/update_inner_join/db/models.go +++ b/internal/endtoend/testdata/update_inner_join/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db diff --git a/internal/endtoend/testdata/update_inner_join/db/query.sql.go b/internal/endtoend/testdata/update_inner_join/db/query.sql.go index c7067807f5..7ffb4ae638 100644 --- a/internal/endtoend/testdata/update_inner_join/db/query.sql.go +++ b/internal/endtoend/testdata/update_inner_join/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/update_join/mysql/db/db.go b/internal/endtoend/testdata/update_join/mysql/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/update_join/mysql/db/db.go +++ b/internal/endtoend/testdata/update_join/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_join/mysql/db/models.go b/internal/endtoend/testdata/update_join/mysql/db/models.go index 2e43afa8ec..73ac86fe23 100644 --- a/internal/endtoend/testdata/update_join/mysql/db/models.go +++ b/internal/endtoend/testdata/update_join/mysql/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db -import () - type JoinTable struct { ID uint64 PrimaryTableID uint64 diff --git a/internal/endtoend/testdata/update_join/mysql/db/query.sql.go b/internal/endtoend/testdata/update_join/mysql/db/query.sql.go index e0907e13c5..0450bfe3ee 100644 --- a/internal/endtoend/testdata/update_join/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/update_join/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/update_join/postgresql/db/db.go b/internal/endtoend/testdata/update_join/postgresql/db/db.go index 3d2b5bf3a3..93a0b7e23b 100644 --- a/internal/endtoend/testdata/update_join/postgresql/db/db.go +++ b/internal/endtoend/testdata/update_join/postgresql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_join/postgresql/db/models.go b/internal/endtoend/testdata/update_join/postgresql/db/models.go index 43f32c8a13..35a88fb300 100644 --- a/internal/endtoend/testdata/update_join/postgresql/db/models.go +++ b/internal/endtoend/testdata/update_join/postgresql/db/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package db -import () - type JoinTable struct { ID int32 PrimaryTableID int32 diff --git a/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go b/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go index d8dcadfac5..0e1edda0ef 100644 --- a/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go +++ b/internal/endtoend/testdata/update_join/postgresql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package db diff --git a/internal/endtoend/testdata/update_set/myql/go/db.go b/internal/endtoend/testdata/update_set/myql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/update_set/myql/go/db.go +++ b/internal/endtoend/testdata/update_set/myql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set/myql/go/models.go b/internal/endtoend/testdata/update_set/myql/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set/myql/go/models.go +++ b/internal/endtoend/testdata/update_set/myql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/myql/go/query.sql.go b/internal/endtoend/testdata/update_set/myql/go/query.sql.go index c70697aabd..bf7810ddad 100644 --- a/internal/endtoend/testdata/update_set/myql/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/myql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go index f45481b0af..4849f16186 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go index f45481b0af..4849f16186 100644 --- a/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go index 9e85c38853..f9b0709b6c 100644 --- a/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set/sqlite/go/db.go b/internal/endtoend/testdata/update_set/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/update_set/sqlite/go/db.go +++ b/internal/endtoend/testdata/update_set/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set/sqlite/go/models.go b/internal/endtoend/testdata/update_set/sqlite/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set/sqlite/go/models.go +++ b/internal/endtoend/testdata/update_set/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go b/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go index c70697aabd..bf7810ddad 100644 --- a/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/update_set/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go b/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go b/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go index 2ebe8db8ff..b39667eb5e 100644 --- a/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go index 312ca8c296..9ca5876e4a 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go index 07d19d3bb6..9afe0b297f 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v4/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go index 8a010ccc48..2666c1c05d 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -12,9 +12,9 @@ import ( ) type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go index 07d19d3bb6..9afe0b297f 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/pgx/v5/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go index 5e841d2062..cbbf9094f3 100644 --- a/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/postgresql/stdlib/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go index 5870a7e6fe..d6f5637286 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Foo struct { Name string Slug string diff --git a/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go b/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go index 2ebe8db8ff..b39667eb5e 100644 --- a/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/update_set_multiple/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/exec.json b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/exec.json index ee1b7ecd9e..2e996ca79d 100644 --- a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/exec.json +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/exec.json @@ -1,3 +1,3 @@ { - "contexts": ["managed-db"] + "contexts": ["base"] } diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/query.sql b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/query.sql index 3f9e9d9b86..2484d998b6 100644 --- a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/query.sql +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/query.sql @@ -1,4 +1,23 @@ --- name: UpsertServer :exec -INSERT INTO servers(code, name) VALUES ($1, $2) -ON CONFLICT (code) -DO UPDATE SET name_typo = 1111; \ No newline at end of file +-- name: UpsertServerSetColumnTypo :exec +INSERT INTO servers(code, name) VALUES ($1, $2) +ON CONFLICT (code) +DO UPDATE SET name_typo = 1111; + +-- name: UpsertServerConflictTargetTypo :exec +INSERT INTO servers(code, name) VALUES ($1, $2) +ON CONFLICT (code_typo) +DO UPDATE SET name = 1111; + +-- name: UpsertServerExcludedColumnTypo :exec +INSERT INTO servers(code, name) VALUES ($1, $2) +ON CONFLICT (code) +DO UPDATE SET name = EXCLUDED.name_typo; + +-- name: UpsertServerMissingConflictTarget :exec +INSERT INTO servers(code, name) VALUES ($1, $2) +ON CONFLICT DO UPDATE SET name = EXCLUDED.name; + +-- name: UpsertServerOnConstraintExcludedTypo :exec +INSERT INTO servers(code, name) VALUES ($1, $2) +ON CONFLICT ON CONSTRAINT servers_pkey DO UPDATE SET name = EXCLUDED.name_typo; + diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/schema.sql b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/schema.sql index 3ff1ccd6b3..c3dec12e49 100644 --- a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/schema.sql +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/schema.sql @@ -1,4 +1,4 @@ CREATE TABLE servers ( - code varchar PRIMARY KEY, - name text NOT NULL -); \ No newline at end of file + code varchar PRIMARY KEY, + name text NOT NULL +); diff --git a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/stderr.txt b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/stderr.txt index adbb13a418..b9692daa64 100644 --- a/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/stderr.txt +++ b/internal/endtoend/testdata/update_set_on_conflict/postgresql/pgx/stderr.txt @@ -1,2 +1,6 @@ # package querytest -query.sql:4:15: column "name_typo" of relation "servers" does not exist \ No newline at end of file +query.sql:4:15: column "name_typo" of relation "servers" does not exist +query.sql:8:13: column "code_typo" of relation "servers" does not exist +query.sql:14:22: column "name_typo" of relation "EXCLUDED" does not exist +query.sql:17:1: ON CONFLICT DO UPDATE requires inference specification or constraint name +query.sql:22:61: column "name_typo" of relation "EXCLUDED" does not exist diff --git a/internal/endtoend/testdata/update_two_table/mysql/go/db.go b/internal/endtoend/testdata/update_two_table/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/go/db.go +++ b/internal/endtoend/testdata/update_two_table/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/update_two_table/mysql/go/models.go b/internal/endtoend/testdata/update_two_table/mysql/go/models.go index 95c9c412cb..84bd886033 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/go/models.go +++ b/internal/endtoend/testdata/update_two_table/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go b/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go index 41b2aba1c2..208379091b 100644 --- a/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/update_two_table/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/upsert/sqlite/go/db.go b/internal/endtoend/testdata/upsert/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/upsert/sqlite/go/db.go +++ b/internal/endtoend/testdata/upsert/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/upsert/sqlite/go/models.go b/internal/endtoend/testdata/upsert/sqlite/go/models.go index 7b5405f24d..fe22d3db68 100644 --- a/internal/endtoend/testdata/upsert/sqlite/go/models.go +++ b/internal/endtoend/testdata/upsert/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Location struct { ID int64 Name string diff --git a/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go b/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go index 3b24b641c3..8a5227da4e 100644 --- a/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/upsert/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -11,19 +11,19 @@ import ( const upsertLocation = `-- name: UpsertLocation :exec INSERT INTO locations ( - name, - address, - zip_code, - latitude, - longitude + name, + address, + zip_code, + latitude, + longitude ) VALUES (?, ?, ?, ?, ?) -ON CONFLICT(name) DO UPDATE SET - name = excluded.name, - address = excluded.address, - zip_code = excluded.zip_code, - latitude = excluded.latitude, - longitude = excluded.longitude +ON CONFLICT (name) DO UPDATE SET + name = excluded.name, + address = excluded.address, + zip_code = excluded.zip_code, + latitude = excluded.latitude, + longitude = excluded.longitude ` type UpsertLocationParams struct { diff --git a/internal/endtoend/testdata/upsert/sqlite/query.sql b/internal/endtoend/testdata/upsert/sqlite/query.sql index c34d70b407..2bcc90219b 100644 --- a/internal/endtoend/testdata/upsert/sqlite/query.sql +++ b/internal/endtoend/testdata/upsert/sqlite/query.sql @@ -1,15 +1,15 @@ /* name: UpsertLocation :exec */ INSERT INTO locations ( - name, - address, - zip_code, - latitude, - longitude + name, + address, + zip_code, + latitude, + longitude ) VALUES (?, ?, ?, ?, ?) -ON CONFLICT(name) DO UPDATE SET - name = excluded.name, - address = excluded.address, - zip_code = excluded.zip_code, - latitude = excluded.latitude, - longitude = excluded.longitude; +ON CONFLICT (name) DO UPDATE SET + name = excluded.name, + address = excluded.address, + zip_code = excluded.zip_code, + latitude = excluded.latitude, + longitude = excluded.longitude; diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go index ff5f263f68..a448d73232 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go index 4f8bd6bd41..ca1bd3e382 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -83,9 +83,9 @@ ORDER BY bucket DESC ` type ListMetricsRow struct { - Bucket interface{} + Bucket any CityName sql.NullString - Avg interface{} + Avg any } func (q *Queries) ListMetrics(ctx context.Context) ([]ListMetricsRow, error) { diff --git a/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql b/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql index 69a38e0417..db03e0d24a 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql +++ b/internal/endtoend/testdata/valid_group_by_reference/mysql/schema.sql @@ -1,8 +1,7 @@ CREATE TABLE authors ( - id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, - name text NOT NULL, - bio text, - UNIQUE(name) + id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(10) NOT NULL, + bio text ); CREATE TABLE IF NOT EXISTS weather_metrics diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/db.go b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/db.go +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go index ff5f263f68..a448d73232 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go index 81a9cad7df..71edbc94d6 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go +++ b/internal/endtoend/testdata/valid_group_by_reference/pganalyzer/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go index ff5f263f68..a448d73232 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go index a32cf68206..712d116ac0 100644 --- a/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/valid_group_by_reference/postgresql/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/vet_disable/query.sql b/internal/endtoend/testdata/vet_disable/query.sql index c1eb8d2219..50052de26b 100644 --- a/internal/endtoend/testdata/vet_disable/query.sql +++ b/internal/endtoend/testdata/vet_disable/query.sql @@ -1,6 +1,29 @@ --- name: SkipVet :exec +-- name: RunVetAll :exec +SELECT true; + +-- name: SkipVetAll :exec -- @sqlc-vet-disable SELECT true; --- name: RunVet :exec +-- name: SkipVetSingleLine :exec +-- @sqlc-vet-disable always-fail no-exec +SELECT true; + +-- name: SkipVetMultiLine :exec +-- @sqlc-vet-disable always-fail +-- @sqlc-vet-disable no-exec +SELECT true; + +-- name: SkipVet_always_fail :exec +-- @sqlc-vet-disable always-fail +SELECT true; + +-- name: SkipVet_no_exec :exec +-- @sqlc-vet-disable no-exec +SELECT true; + +-- name: SkipVetInvalidRule :exec +-- @sqlc-vet-disable always-fail +-- @sqlc-vet-disable block-delete +-- @sqlc-vet-disable no-exec SELECT true; \ No newline at end of file diff --git a/internal/endtoend/testdata/vet_disable/sqlc.yaml b/internal/endtoend/testdata/vet_disable/sqlc.yaml index ff7c1b5200..1e53bd7f2f 100644 --- a/internal/endtoend/testdata/vet_disable/sqlc.yaml +++ b/internal/endtoend/testdata/vet_disable/sqlc.yaml @@ -9,7 +9,13 @@ sql: out: "db" rules: - always-fail + - no-exec rules: - name: always-fail message: "Fail" rule: "true" + + - name: no-exec + message: "don't use exec" + rule: | + query.cmd == "exec" diff --git a/internal/endtoend/testdata/vet_disable/stderr.txt b/internal/endtoend/testdata/vet_disable/stderr.txt index 9acbb8b34b..3d9a6169f8 100644 --- a/internal/endtoend/testdata/vet_disable/stderr.txt +++ b/internal/endtoend/testdata/vet_disable/stderr.txt @@ -1 +1,5 @@ -query.sql: RunVet: always-fail: Fail +query.sql: RunVetAll: always-fail: Fail +query.sql: RunVetAll: no-exec: don't use exec +query.sql: SkipVet_always_fail: no-exec: don't use exec +query.sql: SkipVet_no_exec: always-fail: Fail +query.sql: SkipVetInvalidRule: rule-check error: rule "block-delete" does not exist in the config file \ No newline at end of file diff --git a/internal/endtoend/testdata/vet_explain/mysql/db/db.go b/internal/endtoend/testdata/vet_explain/mysql/db/db.go index c63a85a448..bd61ca7416 100644 --- a/internal/endtoend/testdata/vet_explain/mysql/db/db.go +++ b/internal/endtoend/testdata/vet_explain/mysql/db/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package test @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/vet_explain/mysql/db/models.go b/internal/endtoend/testdata/vet_explain/mysql/db/models.go index 31980e18a7..204359ec7c 100644 --- a/internal/endtoend/testdata/vet_explain/mysql/db/models.go +++ b/internal/endtoend/testdata/vet_explain/mysql/db/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package test @@ -19,7 +19,7 @@ const ( DebugCenumThree DebugCenum = "three" ) -func (e *DebugCenum) Scan(src interface{}) error { +func (e *DebugCenum) Scan(src any) error { switch s := src.(type) { case []byte: *e = DebugCenum(s) @@ -37,7 +37,7 @@ type NullDebugCenum struct { } // Scan implements the Scanner interface. -func (ns *NullDebugCenum) Scan(value interface{}) error { +func (ns *NullDebugCenum) Scan(value any) error { if value == nil { ns.DebugCenum, ns.Valid = "", false return nil @@ -62,7 +62,7 @@ const ( DebugCsetThree DebugCset = "three" ) -func (e *DebugCset) Scan(src interface{}) error { +func (e *DebugCset) Scan(src any) error { switch s := src.(type) { case []byte: *e = DebugCset(s) @@ -80,7 +80,7 @@ type NullDebugCset struct { } // Scan implements the Scanner interface. -func (ns *NullDebugCset) Scan(value interface{}) error { +func (ns *NullDebugCset) Scan(value any) error { if value == nil { ns.DebugCset, ns.Valid = "", false return nil @@ -99,7 +99,7 @@ func (ns NullDebugCset) Value() (driver.Value, error) { type Debug struct { ID int64 - Csmallint int32 + Csmallint int16 Cint int32 Cinteger int32 Cdecimal string @@ -110,15 +110,15 @@ type Debug struct { Cdouble float64 Cdec string Cfixed string - Ctinyint int32 + Ctinyint int8 Cbool bool Cmediumint int32 - Cbit interface{} + Cbit any Cdate time.Time Cdatetime time.Time Ctimestamp time.Time Ctime time.Time - Cyear int32 + Cyear int16 Cchar string Cvarchar string Cbinary []byte diff --git a/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go b/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go index 2b9c98158a..8fe59c296b 100644 --- a/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go +++ b/internal/endtoend/testdata/vet_explain/mysql/db/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package test @@ -28,7 +28,7 @@ SELECT id FROM debug WHERE Cbit = ? LIMIT 1 ` -func (q *Queries) SelectByCbit(ctx context.Context, cbit interface{}) (int64, error) { +func (q *Queries) SelectByCbit(ctx context.Context, cbit any) (int64, error) { row := q.db.QueryRowContext(ctx, selectByCbit, cbit) var id int64 err := row.Scan(&id) @@ -316,7 +316,7 @@ SELECT id FROM debug WHERE Csmallint = ? LIMIT 1 ` -func (q *Queries) SelectByCsmallint(ctx context.Context, csmallint int32) (int64, error) { +func (q *Queries) SelectByCsmallint(ctx context.Context, csmallint int16) (int64, error) { row := q.db.QueryRowContext(ctx, selectByCsmallint, csmallint) var id int64 err := row.Scan(&id) @@ -376,7 +376,7 @@ SELECT id FROM debug WHERE Ctinyint = ? LIMIT 1 ` -func (q *Queries) SelectByCtinyint(ctx context.Context, ctinyint int32) (int64, error) { +func (q *Queries) SelectByCtinyint(ctx context.Context, ctinyint int8) (int64, error) { row := q.db.QueryRowContext(ctx, selectByCtinyint, ctinyint) var id int64 err := row.Scan(&id) @@ -424,7 +424,7 @@ SELECT id FROM debug WHERE Cyear = ? LIMIT 1 ` -func (q *Queries) SelectByCyear(ctx context.Context, cyear int32) (int64, error) { +func (q *Queries) SelectByCyear(ctx context.Context, cyear int16) (int64, error) { row := q.db.QueryRowContext(ctx, selectByCyear, cyear) var id int64 err := row.Scan(&id) @@ -438,6 +438,7 @@ WHERE id = ? LIMIT 1 func (q *Queries) SelectById(ctx context.Context, id int64) (int64, error) { row := q.db.QueryRowContext(ctx, selectById, id) - err := row.Scan(&id) - return id, err + var id_2 int64 + err := row.Scan(&id_2) + return id_2, err } diff --git a/internal/endtoend/testdata/vet_failures/query.sql b/internal/endtoend/testdata/vet_failures/query.sql index 718f3395c0..75e38b2caf 100644 --- a/internal/endtoend/testdata/vet_failures/query.sql +++ b/internal/endtoend/testdata/vet_failures/query.sql @@ -1,9 +1,3 @@ -CREATE TABLE authors ( - id BIGSERIAL PRIMARY KEY, - name text NOT NULL, - bio text -); - -- name: GetAuthor :one SELECT * FROM authors WHERE id = $1 LIMIT 1; diff --git a/internal/endtoend/testdata/vet_failures/sqlc.yaml b/internal/endtoend/testdata/vet_failures/sqlc.yaml index 10d5246f8b..b1cff78c30 100644 --- a/internal/endtoend/testdata/vet_failures/sqlc.yaml +++ b/internal/endtoend/testdata/vet_failures/sqlc.yaml @@ -1,6 +1,6 @@ version: 2 sql: - - schema: "query.sql" + - schema: "schema.sql" queries: "query.sql" engine: "postgresql" gen: diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/db.go b/internal/endtoend/testdata/virtual_table/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/virtual_table/sqlite/go/db.go +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/models.go b/internal/endtoend/testdata/virtual_table/sqlite/go/models.go index 4e29cf5582..9c0bffb7f6 100644 --- a/internal/endtoend/testdata/virtual_table/sqlite/go/models.go +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest diff --git a/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go b/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go index ed1718f1ff..b042473394 100644 --- a/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/virtual_table/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -19,7 +19,7 @@ func (q *Queries) DeleteTblFt(ctx context.Context, b string) error { } const insertTblFt = `-- name: InsertTblFt :exec -INSERT INTO tbl_ft(b, c) VALUES(?, ?) +INSERT INTO tbl_ft (b, c) VALUES (?, ?) ` type InsertTblFtParams struct { @@ -33,7 +33,8 @@ func (q *Queries) InsertTblFt(ctx context.Context, arg InsertTblFtParams) error } const selectAllColsFt = `-- name: SelectAllColsFt :many -SELECT b FROM ft +SELECT b +FROM ft WHERE b MATCH ? ` @@ -61,7 +62,8 @@ func (q *Queries) SelectAllColsFt(ctx context.Context, b string) ([]string, erro } const selectAllColsTblFt = `-- name: SelectAllColsTblFt :many -SELECT b, c FROM tbl_ft +SELECT b, c +FROM tbl_ft WHERE b MATCH ? ` @@ -89,8 +91,10 @@ func (q *Queries) SelectAllColsTblFt(ctx context.Context, b string) ([]TblFt, er } const selectBm25Func = `-- name: SelectBm25Func :many -SELECT b, c, bm25(tbl_ft, 2.0) FROM tbl_ft -WHERE b MATCH ? ORDER BY bm25(tbl_ft) +SELECT b, c, bm25(tbl_ft, 2.0) +FROM tbl_ft +WHERE b MATCH ? +ORDER BY bm25(tbl_ft) ` type SelectBm25FuncRow struct { @@ -123,7 +127,8 @@ func (q *Queries) SelectBm25Func(ctx context.Context, b string) ([]SelectBm25Fun } const selectHightlighFunc = `-- name: SelectHightlighFunc :many -SELECT highlight(tbl_ft, 0, '', '') FROM tbl_ft +SELECT highlight(tbl_ft, 0, '', '') +FROM tbl_ft WHERE b MATCH ? ` @@ -151,7 +156,8 @@ func (q *Queries) SelectHightlighFunc(ctx context.Context, b string) ([]string, } const selectOneColFt = `-- name: SelectOneColFt :many -SELECT b FROM ft +SELECT b +FROM ft WHERE b = ? ` @@ -179,7 +185,8 @@ func (q *Queries) SelectOneColFt(ctx context.Context, b string) ([]string, error } const selectOneColTblFt = `-- name: SelectOneColTblFt :many -SELECT c FROM tbl_ft +SELECT c +FROM tbl_ft WHERE b = ? ` diff --git a/internal/endtoend/testdata/virtual_table/sqlite/query.sql b/internal/endtoend/testdata/virtual_table/sqlite/query.sql index ad8eeeae40..002e90f887 100644 --- a/internal/endtoend/testdata/virtual_table/sqlite/query.sql +++ b/internal/endtoend/testdata/virtual_table/sqlite/query.sql @@ -1,29 +1,36 @@ -- name: SelectAllColsFt :many -SELECT b FROM ft +SELECT b +FROM ft WHERE b MATCH ?; -- name: SelectAllColsTblFt :many -SELECT b, c FROM tbl_ft +SELECT b, c +FROM tbl_ft WHERE b MATCH ?; -- name: SelectOneColFt :many -SELECT b FROM ft +SELECT b +FROM ft WHERE b = ?; -- name: SelectOneColTblFt :many -SELECT c FROM tbl_ft +SELECT c +FROM tbl_ft WHERE b = ?; -- name: SelectHightlighFunc :many -SELECT highlight(tbl_ft, 0, '', '') FROM tbl_ft +SELECT highlight(tbl_ft, 0, '', '') +FROM tbl_ft WHERE b MATCH ?; -- name: SelectSnippetFunc :many SELECT snippet(tbl_ft, 0, '', '', 'aa', ?) FROM tbl_ft; -- name: SelectBm25Func :many -SELECT *, bm25(tbl_ft, 2.0) FROM tbl_ft -WHERE b MATCH ? ORDER BY bm25(tbl_ft); +SELECT b, c, bm25(tbl_ft, 2.0) +FROM tbl_ft +WHERE b MATCH ? +ORDER BY bm25(tbl_ft); -- name: UpdateTblFt :exec UPDATE tbl_ft SET c = ? WHERE b = ?; @@ -32,4 +39,4 @@ UPDATE tbl_ft SET c = ? WHERE b = ?; DELETE FROM tbl_ft WHERE b = ?; -- name: InsertTblFt :exec -INSERT INTO tbl_ft(b, c) VALUES(?, ?); +INSERT INTO tbl_ft (b, c) VALUES (?, ?); diff --git a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/exec.json b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/exec.json new file mode 100644 index 0000000000..8a7ecd291e --- /dev/null +++ b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/exec.json @@ -0,0 +1,3 @@ +{ + "contexts": ["core"] +} diff --git a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/db.go b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/db.go new file mode 100644 index 0000000000..32faa9f2b8 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/models.go b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/models.go new file mode 100644 index 0000000000..98b7ec9dd9 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package querytest + +type Recipe struct { + ID int64 + Name string +} + +type RecipesFt struct { + Name string +} diff --git a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/query.sql.go b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/query.sql.go new file mode 100644 index 0000000000..7fe6d32f15 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/go/query.sql.go @@ -0,0 +1,81 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const searchRecipes = `-- name: SearchRecipes :many +SELECT rowid, name +FROM recipes_fts +WHERE recipes_fts MATCH ? +` + +type SearchRecipesRow struct { + Rowid int64 + Name string +} + +func (q *Queries) SearchRecipes(ctx context.Context, recipesFts string) ([]SearchRecipesRow, error) { + rows, err := q.db.QueryContext(ctx, searchRecipes, recipesFts) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SearchRecipesRow + for rows.Next() { + var i SearchRecipesRow + if err := rows.Scan(&i.Rowid, &i.Name); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const searchRecipesRanked = `-- name: SearchRecipesRanked :many +SELECT rowid, name, rank +FROM recipes_fts +WHERE recipes_fts MATCH ? +ORDER BY rank +` + +type SearchRecipesRankedRow struct { + Rowid int64 + Name string + Rank sql.NullFloat64 +} + +func (q *Queries) SearchRecipesRanked(ctx context.Context, recipesFts string) ([]SearchRecipesRankedRow, error) { + rows, err := q.db.QueryContext(ctx, searchRecipesRanked, recipesFts) + if err != nil { + return nil, err + } + defer rows.Close() + var items []SearchRecipesRankedRow + for rows.Next() { + var i SearchRecipesRankedRow + if err := rows.Scan(&i.Rowid, &i.Name, &i.Rank); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/query.sql b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/query.sql new file mode 100644 index 0000000000..0b5785ac55 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/query.sql @@ -0,0 +1,10 @@ +-- name: SearchRecipes :many +SELECT rowid, name +FROM recipes_fts +WHERE recipes_fts MATCH ?; + +-- name: SearchRecipesRanked :many +SELECT rowid, name, rank +FROM recipes_fts +WHERE recipes_fts MATCH ? +ORDER BY rank; diff --git a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/schema.sql b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/schema.sql new file mode 100644 index 0000000000..498824eba6 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/schema.sql @@ -0,0 +1,10 @@ +CREATE TABLE recipes ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL +); + +CREATE VIRTUAL TABLE recipes_fts USING FTS5 ( + name, + content='recipes', + content_rowid='id' +); diff --git a/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/sqlc.yaml b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/sqlc.yaml new file mode 100644 index 0000000000..77e7a3daa2 --- /dev/null +++ b/internal/endtoend/testdata/virtual_table_fts5_hidden/sqlite/sqlc.yaml @@ -0,0 +1,9 @@ +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: sqlite + gen: + go: + package: querytest + out: go diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json index e58a1fbef1..48e316b1b2 100644 --- a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json @@ -1,6 +1,6 @@ { "env": [ - "SQLC_VERSION=v1.22.0", + "SQLC_VERSION=v1.31.1", "SQLC_DUMMY_VALUE=true" ] } diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/query.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/query.sql @@ -0,0 +1,19 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthor :exec +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/schema.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/sqlc.json b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/sqlc.json new file mode 100644 index 0000000000..bb84bddebf --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/sqlc.json @@ -0,0 +1,25 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "test" + } + ] + } + ], + "plugins": [ + { + "name": "test", + "wasm": { + "url": "https://github.com/sqlc-dev/sqlc-gen-unsafe-paths/releases/download/v0.1.1/sqlc-gen-unsafe-paths.wasm", + "sha256": "e53ac951dd41b1e4c365e757d9735886f7c8e92f2056ce0be9a5cfcf677c45d9" + } + } + ] +} diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr.txt b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr.txt new file mode 100644 index 0000000000..8d664b0612 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr.txt @@ -0,0 +1,2 @@ +# package test +error generating code: invalid file output path: /tmp/unsafe.txt diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr_windows.txt b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr_windows.txt new file mode 100644 index 0000000000..33d32af53a --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_unsafe_paths/stderr_windows.txt @@ -0,0 +1,2 @@ +# package test +error generating code: invalid file output path: D:/tmp/unsafe.txt diff --git a/internal/endtoend/testdata/where_collate/sqlite/go/db.go b/internal/endtoend/testdata/where_collate/sqlite/go/db.go index a457fb76b2..32faa9f2b8 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/go/db.go +++ b/internal/endtoend/testdata/where_collate/sqlite/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/where_collate/sqlite/go/models.go b/internal/endtoend/testdata/where_collate/sqlite/go/models.go index 18db6be849..9ae248604f 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/go/models.go +++ b/internal/endtoend/testdata/where_collate/sqlite/go/models.go @@ -1,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package querytest -import () - type Account struct { ID string Name string diff --git a/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go b/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go index beb5919ab4..1f40224e16 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 // source: query.sql package querytest @@ -10,8 +10,9 @@ import ( ) const getAccountByName = `-- name: GetAccountByName :one -SELECT id, name FROM accounts -WHERE name = ? COLLATE NOCASE +SELECT id, name +FROM accounts +WHERE name = ? COLLATE nocase LIMIT 1 ` diff --git a/internal/endtoend/testdata/where_collate/sqlite/query.sql b/internal/endtoend/testdata/where_collate/sqlite/query.sql index 647c3ebc07..88568bf0b9 100644 --- a/internal/endtoend/testdata/where_collate/sqlite/query.sql +++ b/internal/endtoend/testdata/where_collate/sqlite/query.sql @@ -1,4 +1,5 @@ -- name: GetAccountByName :one -SELECT * FROM accounts -WHERE name = ? COLLATE NOCASE -LIMIT 1; \ No newline at end of file +SELECT * +FROM accounts +WHERE name = ? COLLATE nocase +LIMIT 1; diff --git a/internal/endtoend/testdata/wrap_errors/mysql/db/db.go b/internal/endtoend/testdata/wrap_errors/mysql/db/db.go new file mode 100644 index 0000000000..32f660cdd7 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/wrap_errors/mysql/db/models.go b/internal/endtoend/testdata/wrap_errors/mysql/db/models.go new file mode 100644 index 0000000000..62bacd80ae --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go new file mode 100644 index 0000000000..cd9e3a04c9 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/db/query.sql.go @@ -0,0 +1,123 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" + "fmt" +) + +const createAuthor = `-- name: CreateAuthor :execlastid +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +` + +func (q *Queries) CreateAuthor(ctx context.Context) (int64, error) { + result, err := q.db.ExecContext(ctx, createAuthor) + if err != nil { + return 0, fmt.Errorf("query CreateAuthor: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExec(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, deleteAuthorExec) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExec: %w", err) + } + return err +} + +const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecLastID(ctx context.Context) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecResult(ctx context.Context) (sql.Result, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecResult) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) + } + return result, err +} + +const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecRows(ctx context.Context) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecRows) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) + } + return result.RowsAffected() +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query GetAuthor: %w", err) + } + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + return items, nil +} diff --git a/internal/endtoend/testdata/wrap_errors/mysql/query.sql b/internal/endtoend/testdata/wrap_errors/mysql/query.sql new file mode 100644 index 0000000000..3f9971d942 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/query.sql @@ -0,0 +1,30 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :execlastid +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +); + +-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/wrap_errors/mysql/schema.sql b/internal/endtoend/testdata/wrap_errors/mysql/schema.sql new file mode 100644 index 0000000000..8d65cdb7b5 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wrap_errors/mysql/sqlc.yaml b/internal/endtoend/testdata/wrap_errors/mysql/sqlc.yaml new file mode 100644 index 0000000000..5b3b1ddc10 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/mysql/sqlc.yaml @@ -0,0 +1,10 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "mysql" + gen: + go: + package: "authors" + out: "db" + wrap_errors: true diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/db.go b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/db.go new file mode 100644 index 0000000000..fc39ddade6 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...any) (pgconn.CommandTag, error) + Query(context.Context, string, ...any) (pgx.Rows, error) + QueryRow(context.Context, string, ...any) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/models.go b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/models.go new file mode 100644 index 0000000000..d3f6eaab75 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type Author struct { + ID int64 + Name string + Bio pgtype.Text +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go new file mode 100644 index 0000000000..e11566eb17 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/db/query.sql.go @@ -0,0 +1,122 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package authors + +import ( + "context" + "fmt" + + "github.com/jackc/pgx/v5/pgconn" + "github.com/jackc/pgx/v5/pgtype" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + Name string + Bio pgtype.Text +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query CreateAuthor: %w", err) + } + return i, err +} + +const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { + _, err := q.db.Exec(ctx, deleteAuthorExec, id) + if err != nil { + return fmt.Errorf("query DeleteAuthorExec: %w", err) + } + return nil +} + +const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1 +` + +const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (pgconn.CommandTag, error) { + result, err := q.db.Exec(ctx, deleteAuthorExecResult, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) + } + return result, err +} + +const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { + result, err := q.db.Exec(ctx, deleteAuthorExecRows, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) + } + return result.RowsAffected(), nil +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRow(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query GetAuthor: %w", err) + } + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.Query(ctx, listAuthors) + if err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + return items, nil +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/query.sql b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/query.sql new file mode 100644 index 0000000000..e0310a2257 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/query.sql @@ -0,0 +1,31 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/schema.sql b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..5a2adcda8e --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/pgx/sqlc.yaml @@ -0,0 +1,11 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + sql_package: "pgx/v5" + out: "db" + wrap_errors: true diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/db.go b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/db.go new file mode 100644 index 0000000000..32f660cdd7 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/models.go b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/models.go new file mode 100644 index 0000000000..62bacd80ae --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go new file mode 100644 index 0000000000..b954a613a8 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/db/query.sql.go @@ -0,0 +1,131 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" + "fmt" +) + +const createAuthor = `-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING id, name, bio +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) { + row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query CreateAuthor: %w", err) + } + return i, err +} + +const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthorExec, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExec: %w", err) + } + return err +} + +const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecLastID(ctx context.Context, id int64) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (sql.Result, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecResult, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) + } + return result, err +} + +const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1 +` + +func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecRows, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) + } + return result.RowsAffected() +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = $1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query GetAuthor: %w", err) + } + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + return items, nil +} diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/query.sql b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..e0310a2257 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/query.sql @@ -0,0 +1,31 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = $1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :one +INSERT INTO authors ( + name, bio +) VALUES ( + $1, $2 +) +RETURNING *; + +-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = $1; + +-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = $1; diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/sqlc.yaml b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/sqlc.yaml new file mode 100644 index 0000000000..6827bf778a --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/postgresql/stdlib/sqlc.yaml @@ -0,0 +1,10 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + wrap_errors: true diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/db/db.go b/internal/endtoend/testdata/wrap_errors/sqlite/db/db.go new file mode 100644 index 0000000000..32f660cdd7 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...any) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/db/models.go b/internal/endtoend/testdata/wrap_errors/sqlite/db/models.go new file mode 100644 index 0000000000..62bacd80ae --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 + +package authors + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go b/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go new file mode 100644 index 0000000000..11b72d8491 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/db/query.sql.go @@ -0,0 +1,128 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package authors + +import ( + "context" + "database/sql" + "fmt" +) + +const createAuthor = `-- name: CreateAuthor :execlastid +INSERT INTO authors ( + name, bio +) VALUES ( + ?1, ?2 +) +` + +type CreateAuthorParams struct { + Name string + Bio sql.NullString +} + +func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (int64, error) { + result, err := q.db.ExecContext(ctx, createAuthor, arg.Name, arg.Bio) + if err != nil { + return 0, fmt.Errorf("query CreateAuthor: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExec = `-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = ?1 +` + +func (q *Queries) DeleteAuthorExec(ctx context.Context, id int64) error { + _, err := q.db.ExecContext(ctx, deleteAuthorExec, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExec: %w", err) + } + return err +} + +const deleteAuthorExecLastID = `-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = ?1 +` + +func (q *Queries) DeleteAuthorExecLastID(ctx context.Context, id int64) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecLastID, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecLastID: %w", err) + } + return result.LastInsertId() +} + +const deleteAuthorExecResult = `-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = ?1 +` + +func (q *Queries) DeleteAuthorExecResult(ctx context.Context, id int64) (sql.Result, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecResult, id) + if err != nil { + err = fmt.Errorf("query DeleteAuthorExecResult: %w", err) + } + return result, err +} + +const deleteAuthorExecRows = `-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = ?1 +` + +func (q *Queries) DeleteAuthorExecRows(ctx context.Context, id int64) (int64, error) { + result, err := q.db.ExecContext(ctx, deleteAuthorExecRows, id) + if err != nil { + return 0, fmt.Errorf("query DeleteAuthorExecRows: %w", err) + } + return result.RowsAffected() +} + +const getAuthor = `-- name: GetAuthor :one +SELECT id, name, bio FROM authors +WHERE id = ?1 LIMIT 1 +` + +func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) { + row := q.db.QueryRowContext(ctx, getAuthor, id) + var i Author + err := row.Scan(&i.ID, &i.Name, &i.Bio) + if err != nil { + err = fmt.Errorf("query GetAuthor: %w", err) + } + return i, err +} + +const listAuthors = `-- name: ListAuthors :many +SELECT id, name, bio FROM authors +ORDER BY name +` + +func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) { + rows, err := q.db.QueryContext(ctx, listAuthors) + if err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + defer rows.Close() + var items []Author + for rows.Next() { + var i Author + if err := rows.Scan(&i.ID, &i.Name, &i.Bio); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("query ListAuthors: %w", err) + } + return items, nil +} diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/query.sql b/internal/endtoend/testdata/wrap_errors/sqlite/query.sql new file mode 100644 index 0000000000..2db6403c8b --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/query.sql @@ -0,0 +1,30 @@ +-- name: GetAuthor :one +SELECT * FROM authors +WHERE id = ?1 LIMIT 1; + +-- name: ListAuthors :many +SELECT * FROM authors +ORDER BY name; + +-- name: CreateAuthor :execlastid +INSERT INTO authors ( + name, bio +) VALUES ( + ?1, ?2 +); + +-- name: DeleteAuthorExec :exec +DELETE FROM authors +WHERE id = ?1; + +-- name: DeleteAuthorExecRows :execrows +DELETE FROM authors +WHERE id = ?1; + +-- name: DeleteAuthorExecLastID :execlastid +DELETE FROM authors +WHERE id = ?1; + +-- name: DeleteAuthorExecResult :execresult +DELETE FROM authors +WHERE id = ?1; diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/schema.sql b/internal/endtoend/testdata/wrap_errors/sqlite/schema.sql new file mode 100644 index 0000000000..8d65cdb7b5 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE authors ( + id BIGINT PRIMARY KEY, + name text NOT NULL, + bio text +); diff --git a/internal/endtoend/testdata/wrap_errors/sqlite/sqlc.yaml b/internal/endtoend/testdata/wrap_errors/sqlite/sqlc.yaml new file mode 100644 index 0000000000..de726297c7 --- /dev/null +++ b/internal/endtoend/testdata/wrap_errors/sqlite/sqlc.yaml @@ -0,0 +1,10 @@ +version: 2 +sql: + - schema: "schema.sql" + queries: "query.sql" + engine: "sqlite" + gen: + go: + package: "authors" + out: "db" + wrap_errors: true diff --git a/internal/endtoend/testdata/yaml_overrides/go/db.go b/internal/endtoend/testdata/yaml_overrides/go/db.go index d0eacb407b..3e4ebb9aaa 100644 --- a/internal/endtoend/testdata/yaml_overrides/go/db.go +++ b/internal/endtoend/testdata/yaml_overrides/go/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override @@ -10,10 +10,10 @@ import ( ) type DBTX interface { - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row + QueryContext(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...any) *sql.Row } func New(db DBTX) *Queries { diff --git a/internal/endtoend/testdata/yaml_overrides/go/models.go b/internal/endtoend/testdata/yaml_overrides/go/models.go index fa5a1ad177..94d18783ff 100644 --- a/internal/endtoend/testdata/yaml_overrides/go/models.go +++ b/internal/endtoend/testdata/yaml_overrides/go/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.22.0 +// sqlc v1.31.1 package override diff --git a/internal/endtoend/testdata/yaml_overrides/go/query.sql.go b/internal/endtoend/testdata/yaml_overrides/go/query.sql.go new file mode 100644 index 0000000000..0a94a438a6 --- /dev/null +++ b/internal/endtoend/testdata/yaml_overrides/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.31.1 +// source: query.sql + +package override + +import ( + "context" +) + +const test = `-- name: Test :one +SELECT 1 +` + +func (q *Queries) Test(ctx context.Context) (int32, error) { + row := q.db.QueryRowContext(ctx, test) + var column_1 int32 + err := row.Scan(&column_1) + return column_1, err +} diff --git a/internal/endtoend/testdata/yaml_overrides/sql/query.sql b/internal/endtoend/testdata/yaml_overrides/sql/query.sql index e0ac49d1ec..9da604b57e 100644 --- a/internal/endtoend/testdata/yaml_overrides/sql/query.sql +++ b/internal/endtoend/testdata/yaml_overrides/sql/query.sql @@ -1 +1,2 @@ +-- name: Test :one SELECT 1; diff --git a/internal/endtoend/vet_test.go b/internal/endtoend/vet_test.go index 56b5837ed3..19bf8df8bc 100644 --- a/internal/endtoend/vet_test.go +++ b/internal/endtoend/vet_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package main @@ -9,10 +8,12 @@ import ( "fmt" "os" "path/filepath" + "strings" "testing" "github.com/sqlc-dev/sqlc/internal/cmd" "github.com/sqlc-dev/sqlc/internal/sqltest" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func findSchema(t *testing.T, path string) (string, bool) { @@ -31,11 +32,6 @@ func TestExamplesVet(t *testing.T) { t.Parallel() ctx := context.Background() - authToken := os.Getenv("SQLC_AUTH_TOKEN") - if authToken == "" { - t.Skip("missing auth token") - } - examples, err := filepath.Abs(filepath.Join("..", "..", "examples")) if err != nil { t.Fatal(err) @@ -51,22 +47,28 @@ func TestExamplesVet(t *testing.T) { continue } tc := replay.Name() + if !isExample(filepath.Join(examples, tc)) { + continue + } t.Run(tc, func(t *testing.T) { t.Parallel() path := filepath.Join(examples, tc) if tc != "kotlin" && tc != "python" { - if s, found := findSchema(t, filepath.Join(path, "mysql")); found { - db, cleanup := sqltest.CreateMySQLDatabase(t, tc, []string{s}) - defer db.Close() - defer cleanup() - } if s, found := findSchema(t, filepath.Join(path, "sqlite")); found { dsn := fmt.Sprintf("file:%s?mode=memory&cache=shared", tc) db, cleanup := sqltest.CreateSQLiteDatabase(t, dsn, []string{s}) defer db.Close() defer cleanup() } + if s, found := findSchema(t, filepath.Join(path, "mysql")); found { + uri := local.MySQL(t, []string{s}) + os.Setenv(fmt.Sprintf("VET_TEST_EXAMPLES_MYSQL_%s", strings.ToUpper(tc)), uri) + } + if s, found := findSchema(t, filepath.Join(path, "postgresql")); found { + uri := local.PostgreSQL(t, []string{s}) + os.Setenv(fmt.Sprintf("VET_TEST_EXAMPLES_POSTGRES_%s", strings.ToUpper(tc)), uri) + } } var stderr bytes.Buffer diff --git a/internal/engine/clickhouse/catalog.go b/internal/engine/clickhouse/catalog.go new file mode 100644 index 0000000000..fb0511f72e --- /dev/null +++ b/internal/engine/clickhouse/catalog.go @@ -0,0 +1,16 @@ +package clickhouse + +import ( + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +func NewCatalog() *catalog.Catalog { + def := "default" // ClickHouse default database + return &catalog.Catalog{ + DefaultSchema: def, + Schemas: []*catalog.Schema{ + defaultSchema(def), + }, + Extensions: map[string]struct{}{}, + } +} diff --git a/internal/engine/clickhouse/convert.go b/internal/engine/clickhouse/convert.go new file mode 100644 index 0000000000..3450a2f10d --- /dev/null +++ b/internal/engine/clickhouse/convert.go @@ -0,0 +1,1411 @@ +package clickhouse + +import ( + "fmt" + "sort" + "strconv" + "strings" + + chast "github.com/sqlc-dev/doubleclick/ast" + "github.com/sqlc-dev/doubleclick/token" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +type cc struct { + paramCount int + // named maps the name of each {name:Type} placeholder to its number: + // the query binds a name once, however many times it uses it. + named map[string]int +} + +// pos is a node's byte offset in the query. doubleclick counts positions +// from one; the rest of sqlc counts from zero. +func pos(n interface{ Pos() token.Position }) int { + if n == nil { + return 0 + } + if off := n.Pos().Offset; off > 0 { + return off - 1 + } + return 0 +} + +func (c *cc) convert(node chast.Node) ast.Node { + switch n := node.(type) { + case *chast.SelectWithUnionQuery: + return c.convertSelectWithUnionQuery(n) + case *chast.SelectQuery: + return c.convertSelectQuery(n) + case *chast.InsertQuery: + return c.convertInsertQuery(n) + case *chast.CreateQuery: + return c.convertCreateQuery(n) + case *chast.UpdateQuery: + return c.convertUpdateQuery(n) + case *chast.DeleteQuery: + return c.convertDeleteQuery(n) + case *chast.DropQuery: + return c.convertDropQuery(n) + case *chast.AlterQuery: + return c.convertAlterQuery(n) + case *chast.TruncateQuery: + return c.convertTruncateQuery(n) + default: + return todo(n) + } +} + +func (c *cc) convertSelectWithUnionQuery(n *chast.SelectWithUnionQuery) ast.Node { + if len(n.Selects) == 0 { + return &ast.TODO{} + } + + // Single select without union + if len(n.Selects) == 1 { + return c.convert(n.Selects[0]) + } + + // Build a chain of SelectStmt with UNION operations + var result *ast.SelectStmt + for i, sel := range n.Selects { + stmt, ok := c.convert(sel).(*ast.SelectStmt) + if !ok { + continue + } + if i == 0 { + result = stmt + } else { + unionMode := ast.Union + if i-1 < len(n.UnionModes) { + switch strings.ToUpper(n.UnionModes[i-1]) { + case "ALL": + unionMode = ast.Union + case "DISTINCT": + unionMode = ast.Union + } + } + result = &ast.SelectStmt{ + Op: unionMode, + All: n.UnionAll || (i-1 < len(n.UnionModes) && strings.ToUpper(n.UnionModes[i-1]) == "ALL"), + Larg: result, + Rarg: stmt, + } + } + } + return result +} + +func (c *cc) convertSelectQuery(n *chast.SelectQuery) *ast.SelectStmt { + stmt := &ast.SelectStmt{} + + // Convert target list (SELECT columns) + if len(n.Columns) > 0 { + stmt.TargetList = &ast.List{} + for _, col := range n.Columns { + target := c.convertToResTarget(col) + if target != nil { + stmt.TargetList.Items = append(stmt.TargetList.Items, target) + } + } + } + + // Convert FROM clause + if n.From != nil { + stmt.FromClause = c.convertTablesInSelectQuery(n.From) + } + + // Convert WHERE clause + if n.Where != nil { + stmt.WhereClause = c.convertExpr(n.Where) + } + + // Convert GROUP BY clause + if len(n.GroupBy) > 0 { + stmt.GroupClause = &ast.List{} + for _, expr := range n.GroupBy { + stmt.GroupClause.Items = append(stmt.GroupClause.Items, c.convertExpr(expr)) + } + } + + // Convert HAVING clause + if n.Having != nil { + stmt.HavingClause = c.convertExpr(n.Having) + } + + // Convert ORDER BY clause + if len(n.OrderBy) > 0 { + stmt.SortClause = &ast.List{} + for _, orderBy := range n.OrderBy { + stmt.SortClause.Items = append(stmt.SortClause.Items, c.convertOrderByElement(orderBy)) + } + } + + // Convert LIMIT clause + if n.Limit != nil { + stmt.LimitCount = c.convertExpr(n.Limit) + } + + // Convert OFFSET clause + if n.Offset != nil { + stmt.LimitOffset = c.convertExpr(n.Offset) + } + + // Convert DISTINCT clause + if n.Distinct { + stmt.DistinctClause = &ast.List{} + } + + // Convert DISTINCT ON clause + if len(n.DistinctOn) > 0 { + stmt.DistinctClause = &ast.List{} + for _, expr := range n.DistinctOn { + stmt.DistinctClause.Items = append(stmt.DistinctClause.Items, c.convertExpr(expr)) + } + } + + // Convert WITH clause (CTEs) + if len(n.With) > 0 { + stmt.WithClause = &ast.WithClause{ + Ctes: &ast.List{}, + } + for _, cte := range n.With { + var name string + var query chast.Expression + switch w := cte.(type) { + case *chast.WithElement: + // "name AS (SELECT ...)" or a scalar "(expr) AS name". + name, query = w.Name, w.Query + case *chast.AliasedExpr: + name, query = w.Alias, w.Expr + default: + continue + } + cteNode := &ast.CommonTableExpr{Ctename: &name} + if subq, ok := query.(*chast.Subquery); ok { + cteNode.Ctequery = c.convert(subq.Query) + } else { + cteNode.Ctequery = c.convertExpr(query) + } + stmt.WithClause.Ctes.Items = append(stmt.WithClause.Ctes.Items, cteNode) + } + } + + return stmt +} + +func (c *cc) convertToResTarget(expr chast.Expression) *ast.ResTarget { + res := &ast.ResTarget{ + Location: pos(expr), + } + + switch e := expr.(type) { + case *chast.Asterisk: + if e.Table != "" { + // table.* + res.Val = &ast.ColumnRef{ + Fields: &ast.List{ + Items: []ast.Node{ + NewIdentifier(e.Table), + &ast.A_Star{}, + }, + }, + } + } else { + // Just * + res.Val = &ast.ColumnRef{ + Fields: &ast.List{ + Items: []ast.Node{&ast.A_Star{}}, + }, + } + } + return res + case *chast.AliasedExpr: + res.Name = &e.Alias + res.Val = c.convertExpr(e.Expr) + return res + case *chast.Identifier: + if e.Alias != "" { + res.Name = &e.Alias + } + res.Val = c.convertIdentifier(e) + return res + } + + res.Val = c.convertExpr(expr) + if alias := exprAlias(expr); alias != "" { + res.Name = &alias + } else if name := columnName(expr); name != "" { + // ClickHouse names an unaliased expression column after the + // expression itself, written in its canonical function form. + res.Name = &name + } + return res +} + +// exprAlias returns the alias the parser attached to an expression, for +// the node kinds that carry one directly. +func exprAlias(expr chast.Expression) string { + switch e := expr.(type) { + case *chast.AliasedExpr: + return e.Alias + case *chast.Identifier: + return e.Alias + case *chast.FunctionCall: + return e.Alias + case *chast.CaseExpr: + return e.Alias + case *chast.CastExpr: + return e.Alias + case *chast.LikeExpr: + return e.Alias + case *chast.ExtractExpr: + return e.Alias + case *chast.Subquery: + return e.Alias + } + return "" +} + +// binaryFunctions are the function names ClickHouse gives its operators when +// it names a column after an expression. +var binaryFunctions = map[string]string{ + "+": "plus", "-": "minus", "*": "multiply", "/": "divide", "%": "modulo", + "=": "equals", "==": "equals", "!=": "notEquals", "<>": "notEquals", + "<": "less", ">": "greater", "<=": "lessOrEquals", ">=": "greaterOrEquals", + "AND": "and", "OR": "or", "||": "concat", +} + +// columnName writes an expression the way ClickHouse names a result column +// that has no alias: a function call with its arguments, an operator as the +// function it stands for, an identifier or literal as written. It returns "" +// for an expression it cannot write, which then keeps sqlc's own name. +func columnName(expr chast.Expression) string { + switch e := expr.(type) { + case *chast.Identifier: + return e.Name() + case *chast.Literal: + return literalText(e) + case *chast.FunctionCall: + if e.Over != nil || e.Filter != nil || e.Distinct { + return "" + } + var params, args []string + for _, p := range e.Parameters { + s := columnName(p) + if s == "" { + return "" + } + params = append(params, s) + } + for _, a := range e.Arguments { + s := columnName(a) + if s == "" { + return "" + } + args = append(args, s) + } + name := e.Name + if len(e.Parameters) > 0 { + name += "(" + strings.Join(params, ", ") + ")" + } + return name + "(" + strings.Join(args, ", ") + ")" + case *chast.BinaryExpr: + fn, ok := binaryFunctions[strings.ToUpper(e.Op)] + if !ok { + return "" + } + left, right := columnName(e.Left), columnName(e.Right) + if left == "" || right == "" { + return "" + } + return fn + "(" + left + ", " + right + ")" + case *chast.UnaryExpr: + operand := columnName(e.Operand) + if operand == "" { + return "" + } + switch strings.ToUpper(e.Op) { + case "-": + return "negate(" + operand + ")" + case "NOT": + return "not(" + operand + ")" + } + return "" + case *chast.IsNullExpr: + arg := columnName(e.Expr) + if arg == "" { + return "" + } + if e.Not { + return "isNotNull(" + arg + ")" + } + return "isNull(" + arg + ")" + case *chast.TernaryExpr: + cond, then, els := columnName(e.Condition), columnName(e.Then), columnName(e.Else) + if cond == "" || then == "" || els == "" { + return "" + } + return "if(" + cond + ", " + then + ", " + els + ")" + } + return "" +} + +// literalText writes a literal as ClickHouse prints it in a column name. +func literalText(l *chast.Literal) string { + switch l.Type { + case chast.LiteralString: + return quoteString(fmt.Sprint(l.Value)) + case chast.LiteralNull: + return "NULL" + case chast.LiteralBoolean: + return fmt.Sprint(l.Value) + case chast.LiteralInteger, chast.LiteralFloat: + if l.Source != "" { + return l.Source + } + return fmt.Sprint(l.Value) + } + return "" +} + +func quoteString(s string) string { + s = strings.ReplaceAll(s, `\`, `\\`) + s = strings.ReplaceAll(s, "'", `\'`) + return "'" + s + "'" +} + +func (c *cc) convertTablesInSelectQuery(n *chast.TablesInSelectQuery) *ast.List { + if n == nil || len(n.Tables) == 0 { + return nil + } + + result := &ast.List{} + + for i, elem := range n.Tables { + if elem.Table != nil { + tableExpr := c.convertTableExpression(elem.Table) + if i == 0 { + result.Items = append(result.Items, tableExpr) + } else if elem.Join != nil { + // This element has a join + joinExpr := c.convertTableJoin(elem.Join, result.Items[len(result.Items)-1], tableExpr) + result.Items[len(result.Items)-1] = joinExpr + } else { + result.Items = append(result.Items, tableExpr) + } + } else if elem.Join != nil && len(result.Items) > 0 { + // Join without table (should not happen normally) + continue + } + } + + return result +} + +func (c *cc) convertTableExpression(n *chast.TableExpression) ast.Node { + var result ast.Node + + switch t := n.Table.(type) { + case *chast.TableIdentifier: + rv := parseTableIdentifierToRangeVar(t) + if n.Alias != "" { + alias := n.Alias + rv.Alias = &ast.Alias{Aliasname: &alias} + } + result = rv + case *chast.Subquery: + subselect := &ast.RangeSubselect{ + Subquery: c.convert(t.Query), + } + alias := n.Alias + if alias == "" && t.Alias != "" { + alias = t.Alias + } + if alias != "" { + subselect.Alias = &ast.Alias{Aliasname: &alias} + } + result = subselect + case *chast.FunctionCall: + // Table function like file(), url(), etc. + rf := &ast.RangeFunction{ + Functions: &ast.List{ + Items: []ast.Node{c.convertFunctionCall(t)}, + }, + } + if n.Alias != "" { + alias := n.Alias + rf.Alias = &ast.Alias{Aliasname: &alias} + } + result = rf + default: + result = &ast.TODO{} + } + + return result +} + +func (c *cc) convertTableJoin(n *chast.TableJoin, left, right ast.Node) *ast.JoinExpr { + join := &ast.JoinExpr{ + Larg: left, + Rarg: right, + } + + // Convert join type + switch n.Type { + case chast.JoinInner: + join.Jointype = ast.JoinTypeInner + case chast.JoinLeft: + join.Jointype = ast.JoinTypeLeft + case chast.JoinRight: + join.Jointype = ast.JoinTypeRight + case chast.JoinFull: + join.Jointype = ast.JoinTypeFull + case chast.JoinCross: + join.Jointype = ast.JoinTypeInner + join.IsNatural = false + default: + join.Jointype = ast.JoinTypeInner + } + + // Convert ON clause + if n.On != nil { + join.Quals = c.convertExpr(n.On) + } + + // Convert USING clause + if len(n.Using) > 0 { + join.UsingClause = &ast.List{} + for _, u := range n.Using { + if id, ok := u.(*chast.Identifier); ok { + join.UsingClause.Items = append(join.UsingClause.Items, NewIdentifier(id.Name())) + } + } + } + + return join +} + +func (c *cc) convertExpr(expr chast.Expression) ast.Node { + if expr == nil { + return nil + } + + switch e := expr.(type) { + case *chast.Identifier: + return c.convertIdentifier(e) + case *chast.Literal: + return c.convertLiteral(e) + case *chast.BinaryExpr: + return c.convertBinaryExpr(e) + case *chast.FunctionCall: + switch strings.ToLower(e.Name) { + case "coalesce", "ifnull": + // COALESCE is null only when every argument is, which a seeded + // function signature cannot say. + args := &ast.List{} + for _, arg := range e.Arguments { + args.Items = append(args.Items, c.convertExpr(arg)) + } + return &ast.CoalesceExpr{Args: args, Location: pos(e)} + } + return c.convertFunctionCall(e) + case *chast.ExistsExpr: + return &ast.SubLink{ + SubLinkType: ast.EXISTS_SUBLINK, + Subselect: c.convert(e.Query), + Location: pos(e), + } + case *chast.AliasedExpr: + return c.convertExpr(e.Expr) + case *chast.Parameter: + return c.convertParameter(e) + case *chast.Asterisk: + return c.convertAsterisk(e) + case *chast.CaseExpr: + return c.convertCaseExpr(e) + case *chast.CastExpr: + return c.convertCastExpr(e) + case *chast.BetweenExpr: + return c.convertBetweenExpr(e) + case *chast.InExpr: + return c.convertInExpr(e) + case *chast.IsNullExpr: + return c.convertIsNullExpr(e) + case *chast.LikeExpr: + return c.convertLikeExpr(e) + case *chast.Subquery: + return c.convertSubquery(e) + case *chast.ArrayAccess: + return c.convertArrayAccess(e) + case *chast.UnaryExpr: + return c.convertUnaryExpr(e) + case *chast.Lambda: + // Lambda expressions are ClickHouse-specific, return as-is for now + return &ast.TODO{} + default: + return &ast.TODO{} + } +} + +func (c *cc) convertIdentifier(n *chast.Identifier) *ast.ColumnRef { + fields := &ast.List{} + for _, part := range n.Parts { + fields.Items = append(fields.Items, NewIdentifier(part)) + } + return &ast.ColumnRef{ + Fields: fields, + Location: pos(n), + } +} + +func (c *cc) convertLiteral(n *chast.Literal) *ast.A_Const { + switch n.Type { + case chast.LiteralString: + str := n.Value.(string) + return &ast.A_Const{ + Val: &ast.String{Str: str}, + Location: pos(n), + } + case chast.LiteralInteger: + var ival int64 + switch v := n.Value.(type) { + case int64: + ival = v + case int: + ival = int64(v) + case float64: + ival = int64(v) + case string: + ival, _ = strconv.ParseInt(v, 10, 64) + } + return &ast.A_Const{ + Val: &ast.Integer{Ival: ival}, + Location: pos(n), + } + case chast.LiteralFloat: + var fval float64 + switch v := n.Value.(type) { + case float64: + fval = v + case string: + fval, _ = strconv.ParseFloat(v, 64) + } + str := strconv.FormatFloat(fval, 'f', -1, 64) + return &ast.A_Const{ + Val: &ast.Float{Str: str}, + Location: pos(n), + } + case chast.LiteralBoolean: + // ClickHouse booleans are typically 0/1 + bval := n.Value.(bool) + if bval { + return &ast.A_Const{ + Val: &ast.Integer{Ival: 1}, + Location: pos(n), + } + } + return &ast.A_Const{ + Val: &ast.Integer{Ival: 0}, + Location: pos(n), + } + case chast.LiteralNull: + return &ast.A_Const{ + Val: &ast.Null{}, + Location: pos(n), + } + default: + return &ast.A_Const{ + Location: pos(n), + } + } +} + +func (c *cc) convertBinaryExpr(n *chast.BinaryExpr) ast.Node { + op := strings.ToUpper(n.Op) + + // Handle logical operators + if op == "AND" || op == "OR" { + var boolop ast.BoolExprType + if op == "AND" { + boolop = ast.BoolExprTypeAnd + } else { + boolop = ast.BoolExprTypeOr + } + return &ast.BoolExpr{ + Boolop: boolop, + Args: &ast.List{ + Items: []ast.Node{ + c.convertExpr(n.Left), + c.convertExpr(n.Right), + }, + }, + Location: pos(n), + } + } + + // Handle other operators + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: n.Op}}, + }, + Lexpr: c.convertExpr(n.Left), + Rexpr: c.convertExpr(n.Right), + Location: pos(n), + } +} + +func (c *cc) convertFunctionCall(n *chast.FunctionCall) *ast.FuncCall { + fc := &ast.FuncCall{ + Funcname: &ast.List{ + Items: []ast.Node{&ast.String{Str: n.Name}}, + }, + Location: pos(n), + AggDistinct: n.Distinct, + } + + // Convert arguments + if len(n.Arguments) > 0 { + fc.Args = &ast.List{} + for _, arg := range n.Arguments { + fc.Args.Items = append(fc.Args.Items, c.convertExpr(arg)) + } + } + + // Convert window function + if n.Over != nil { + fc.Over = &ast.WindowDef{} + if len(n.Over.PartitionBy) > 0 { + fc.Over.PartitionClause = &ast.List{} + for _, p := range n.Over.PartitionBy { + fc.Over.PartitionClause.Items = append(fc.Over.PartitionClause.Items, c.convertExpr(p)) + } + } + if len(n.Over.OrderBy) > 0 { + fc.Over.OrderClause = &ast.List{} + for _, o := range n.Over.OrderBy { + fc.Over.OrderClause.Items = append(fc.Over.OrderClause.Items, c.convertOrderByElement(o)) + } + } + } + + return fc +} + +func (c *cc) convertParameter(n *chast.Parameter) ast.Node { + number, ok := c.named[n.Name] + if !ok || n.Name == "" { + c.paramCount++ + number = c.paramCount + if n.Name != "" { + if c.named == nil { + c.named = map[string]int{} + } + c.named[n.Name] = number + } + } + ref := &ast.ParamRef{ + Number: number, + Name: n.Name, + Location: pos(n), + } + // A parameter written {name:Type} declares its type, which is what a + // cast of a placeholder says. + if n.Type != nil { + spelling := renderDataType(n.Type) + base, _, _ := unwrapTypeString(spelling) + return &ast.TypeCast{ + Arg: ref, + TypeName: &ast.TypeName{Name: base, Spelling: spelling, Canonical: canonicalDataType(n.Type)}, + Location: pos(n), + } + } + return ref +} + +func (c *cc) convertAsterisk(n *chast.Asterisk) *ast.ColumnRef { + fields := &ast.List{} + if n.Table != "" { + fields.Items = append(fields.Items, NewIdentifier(n.Table)) + } + fields.Items = append(fields.Items, &ast.A_Star{}) + return &ast.ColumnRef{ + Fields: fields, + Location: pos(n), + } +} + +func (c *cc) convertCaseExpr(n *chast.CaseExpr) *ast.CaseExpr { + ce := &ast.CaseExpr{ + Location: pos(n), + } + + // Convert test expression (CASE expr WHEN ...) + if n.Operand != nil { + ce.Arg = c.convertExpr(n.Operand) + } + + // Convert WHEN clauses + if len(n.Whens) > 0 { + ce.Args = &ast.List{} + for _, when := range n.Whens { + caseWhen := &ast.CaseWhen{ + Expr: c.convertExpr(when.Condition), + Result: c.convertExpr(when.Result), + } + ce.Args.Items = append(ce.Args.Items, caseWhen) + } + } + + // Convert ELSE clause + if n.Else != nil { + ce.Defresult = c.convertExpr(n.Else) + } + + return ce +} + +func (c *cc) convertCastExpr(n *chast.CastExpr) *ast.TypeCast { + tc := &ast.TypeCast{ + Arg: c.convertExpr(n.Expr), + Location: pos(n), + } + + if n.Type != nil { + // The whole type is handed over as its spelling, arguments and + // nesting included, the way a column's is. + spelling := renderDataType(n.Type) + base, _, _ := unwrapTypeString(spelling) + tc.TypeName = &ast.TypeName{Name: base, Spelling: spelling, Canonical: canonicalDataType(n.Type)} + } + + return tc +} + +func (c *cc) convertBetweenExpr(n *chast.BetweenExpr) *ast.BetweenExpr { + return &ast.BetweenExpr{ + Expr: c.convertExpr(n.Expr), + Left: c.convertExpr(n.Low), + Right: c.convertExpr(n.High), + Not: n.Not, + Location: pos(n), + } +} + +func (c *cc) convertInExpr(n *chast.InExpr) *ast.In { + in := &ast.In{ + Expr: c.convertExpr(n.Expr), + Not: n.Not, + Location: pos(n), + } + + // Convert the list + if len(n.List) > 0 { + in.List = make([]ast.Node, 0, len(n.List)) + for _, item := range n.List { + in.List = append(in.List, c.convertExpr(item)) + } + } + + // Handle subquery + if n.Query != nil { + in.Sel = c.convert(n.Query) + } + + return in +} + +func (c *cc) convertIsNullExpr(n *chast.IsNullExpr) *ast.NullTest { + nullTest := &ast.NullTest{ + Arg: c.convertExpr(n.Expr), + Location: pos(n), + } + if n.Not { + nullTest.Nulltesttype = ast.NullTestTypeIsNotNull + } else { + nullTest.Nulltesttype = ast.NullTestTypeIsNull + } + return nullTest +} + +func (c *cc) convertLikeExpr(n *chast.LikeExpr) *ast.A_Expr { + kind := ast.A_Expr_Kind(0) + opName := "~~" + if n.CaseInsensitive { + opName = "~~*" + } + if n.Not { + opName = "!~~" + if n.CaseInsensitive { + opName = "!~~*" + } + } + + return &ast.A_Expr{ + Kind: kind, + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: opName}}, + }, + Lexpr: c.convertExpr(n.Expr), + Rexpr: c.convertExpr(n.Pattern), + Location: pos(n), + } +} + +// convertSubquery converts a subquery used as a value: a scalar subquery. +// EXISTS is its own node. +func (c *cc) convertSubquery(n *chast.Subquery) *ast.SubLink { + return &ast.SubLink{ + SubLinkType: ast.EXPR_SUBLINK, + Subselect: c.convert(n.Query), + Location: pos(n), + } +} + +func (c *cc) convertArrayAccess(n *chast.ArrayAccess) *ast.A_Indirection { + return &ast.A_Indirection{ + Arg: c.convertExpr(n.Array), + Indirection: &ast.List{ + Items: []ast.Node{ + &ast.A_Indices{ + Uidx: c.convertExpr(n.Index), + }, + }, + }, + } +} + +func (c *cc) convertUnaryExpr(n *chast.UnaryExpr) ast.Node { + op := strings.ToUpper(n.Op) + + if op == "NOT" { + return &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{ + Items: []ast.Node{c.convertExpr(n.Operand)}, + }, + Location: pos(n), + } + } + + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: n.Op}}, + }, + Rexpr: c.convertExpr(n.Operand), + Location: pos(n), + } +} + +func (c *cc) convertOrderByElement(n *chast.OrderByElement) *ast.SortBy { + sortBy := &ast.SortBy{ + Node: c.convertExpr(n.Expression), + Location: pos(n.Expression), + } + + if n.Descending { + sortBy.SortbyDir = ast.SortByDirDesc + } else { + sortBy.SortbyDir = ast.SortByDirAsc + } + + if n.NullsFirst != nil { + if *n.NullsFirst { + sortBy.SortbyNulls = ast.SortByNullsFirst + } else { + sortBy.SortbyNulls = ast.SortByNullsLast + } + } + + return sortBy +} + +func (c *cc) convertInsertQuery(n *chast.InsertQuery) *ast.InsertStmt { + stmt := &ast.InsertStmt{ + Relation: &ast.RangeVar{ + Relname: &n.Table, + }, + } + + if n.Database != "" { + stmt.Relation.Schemaname = &n.Database + } + + // Convert column list + if len(n.Columns) > 0 { + stmt.Cols = &ast.List{} + for _, col := range n.Columns { + name := col.Name() + stmt.Cols.Items = append(stmt.Cols.Items, &ast.ResTarget{ + Name: &name, + }) + } + } + + // Convert SELECT subquery if present + if n.Select != nil { + stmt.SelectStmt = c.convert(n.Select) + } + + // Convert VALUES clause + if len(n.Values) > 0 { + selectStmt := &ast.SelectStmt{ + ValuesLists: &ast.List{}, + } + for _, row := range n.Values { + rowList := &ast.List{} + for _, val := range row { + rowList.Items = append(rowList.Items, c.convertExpr(val)) + } + selectStmt.ValuesLists.Items = append(selectStmt.ValuesLists.Items, rowList) + } + stmt.SelectStmt = selectStmt + } + + return stmt +} + +func (c *cc) convertCreateQuery(n *chast.CreateQuery) ast.Node { + // Handle CREATE DATABASE + if n.CreateDatabase { + return &ast.CreateSchemaStmt{ + Name: &n.Database, + IfNotExists: n.IfNotExists, + } + } + + // Handle CREATE TABLE + if n.Table != "" { + stmt := &ast.CreateTableStmt{ + Name: &ast.TableName{ + Name: identifier(n.Table), + }, + IfNotExists: n.IfNotExists, + } + + if n.Database != "" { + stmt.Name.Schema = identifier(n.Database) + } + + // Convert columns. A Nested column is what ClickHouse stores as + // one array column per element, named n.a, and reports as those. + for _, col := range n.Columns { + if cols, ok := c.convertNestedColumn(col); ok { + stmt.Cols = append(stmt.Cols, cols...) + continue + } + colDef := c.convertColumnDeclaration(col) + stmt.Cols = append(stmt.Cols, colDef) + } + + // Convert AS SELECT + if n.AsSelect != nil { + // This is a CREATE TABLE ... AS SELECT + // The AsSelect field contains the SELECT statement + } + + return stmt + } + + // Handle CREATE VIEW + if n.View != "" { + return &ast.ViewStmt{ + View: &ast.RangeVar{ + Relname: &n.View, + }, + Query: c.convert(n.AsSelect), + Replace: n.OrReplace, + } + } + + return &ast.TODO{} +} + +// convertNestedColumn expands a column declared Nested(a T, b U) into the +// columns n.a Array(T) and n.b Array(U), which is how ClickHouse's +// system.columns lists it and what a query selects. +func (c *cc) convertNestedColumn(n *chast.ColumnDeclaration) ([]*ast.ColumnDef, bool) { + if n.Type == nil || !strings.EqualFold(n.Type.Name, "Nested") { + return nil, false + } + var cols []*ast.ColumnDef + for _, p := range n.Type.Parameters { + pair, ok := p.(*chast.NameTypePair) + if !ok { + continue + } + spelling := "Array(" + renderDataType(pair.Type) + ")" + cols = append(cols, &ast.ColumnDef{ + Colname: identifier(n.Name) + "." + identifier(pair.Name), + TypeName: &ast.TypeName{Name: "array", Spelling: spelling, Canonical: "Array(" + canonicalDataType(pair.Type) + ")"}, + IsArray: true, + IsNotNull: true, + }) + } + return cols, len(cols) > 0 +} + +func (c *cc) convertColumnDeclaration(n *chast.ColumnDeclaration) *ast.ColumnDef { + colDef := &ast.ColumnDef{ + Colname: identifier(n.Name), + IsNotNull: isNotNull(n), + } + + if n.Type != nil { + spelling := renderDataType(n.Type) + base, isArray, nullable := unwrapTypeString(spelling) + // The catalog resolves the base type; the full spelling, with its + // arguments and nesting, is kept for the analysis to report. + colDef.TypeName = &ast.TypeName{Name: base, Spelling: spelling, Canonical: canonicalDataType(n.Type)} + colDef.IsArray = isArray + if nullable { + colDef.IsNotNull = false + } + } + + // Handle PRIMARY KEY constraint + if n.PrimaryKey { + colDef.PrimaryKey = true + } + + // Handle DEFAULT + if n.Default != nil { + // colDef.RawDefault = c.convertExpr(n.Default) + } + + // Handle comment + if n.Comment != "" { + colDef.Comment = n.Comment + } + + return colDef +} + +// renderDataType spells a type as the author wrote it, which the formatter +// prints back. +func renderDataType(dt *chast.DataType) string { + return renderType(dt, false) +} + +// canonicalDataType spells a type the way ClickHouse stores it, which the +// analysis core reads: an Enum's members are numbered and the family +// sized by their count, a Variant's members are sorted, and a named +// element is written label first, so that Enum('a', 'b') is Enum8('a' = +// 1, 'b' = 2), Variant(String, Int64) is Variant(Int64, String) and +// Tuple(lat Float64) is Tuple(lat: Float64). +func canonicalDataType(dt *chast.DataType) string { + return renderType(dt, true) +} + +func renderType(dt *chast.DataType, canonical bool) string { + if dt == nil { + return "" + } + if len(dt.Parameters) == 0 { + return dt.Name + } + name := dt.Name + parts := make([]string, 0, len(dt.Parameters)) + switch lower := strings.ToLower(name); { + case canonical && (lower == "enum" || lower == "enum8" || lower == "enum16"): + if lower == "enum" { + name = "Enum8" + if len(dt.Parameters) > 127 { + name = "Enum16" + } + } + next := int64(1) + for _, p := range dt.Parameters { + switch v := p.(type) { + case *chast.BinaryExpr: + // 'a' = 3 numbers itself, and the next bare member follows it. + parts = append(parts, renderParam(v, canonical)) + if lit, ok := v.Right.(*chast.Literal); ok { + if n, err := strconv.ParseInt(fmt.Sprint(lit.Value), 10, 64); err == nil { + next = n + 1 + } + } + default: + parts = append(parts, renderParam(p, canonical)+" = "+strconv.FormatInt(next, 10)) + next++ + } + } + case canonical && lower == "lowcardinality" && len(dt.Parameters) == 1: + // ClickHouse spells a nullable low-cardinality column as + // LowCardinality(Nullable(T)), the only order it accepts. The + // nullability is the column's, so the canonical form is + // Nullable(LowCardinality(T)), which reads as a nullable + // LowCardinality(T). + if inner, ok := dt.Parameters[0].(*chast.DataType); ok && strings.EqualFold(inner.Name, "nullable") && len(inner.Parameters) == 1 { + return "Nullable(LowCardinality(" + renderParam(inner.Parameters[0], canonical) + "))" + } + parts = append(parts, renderParam(dt.Parameters[0], canonical)) + case canonical && lower == "variant": + for _, p := range dt.Parameters { + parts = append(parts, renderParam(p, canonical)) + } + sort.Strings(parts) + default: + for _, p := range dt.Parameters { + parts = append(parts, renderParam(p, canonical)) + } + } + return name + "(" + strings.Join(parts, ", ") + ")" +} + +func renderTypeParam(e chast.Expression) string { + return renderParam(e, false) +} + +func renderParam(e chast.Expression, canonical bool) string { + switch v := e.(type) { + case *chast.DataType: + return renderType(v, canonical) + case *chast.Literal: + if v.Type == chast.LiteralString { + return quoteString(fmt.Sprint(v.Value)) + } + if v.Source != "" { + return v.Source + } + return fmt.Sprintf("%v", v.Value) + case *chast.Identifier: + return strings.Join(v.Parts, ".") + case *chast.NameTypePair: + // A named tuple or nested element: `lat Float64`, or `lat: Float64` + // in the canonical form. + if canonical { + return v.Name + ": " + renderType(v.Type, canonical) + } + return v.Name + " " + renderType(v.Type, canonical) + case *chast.BinaryExpr: + // An enum member: `'active' = 1`. + return renderParam(v.Left, canonical) + " " + v.Op + " " + renderParam(v.Right, canonical) + default: + return "" + } +} + +func unwrapTypeString(s string) (name string, isArray, nullable bool) { + base, args := splitType(s) + switch strings.ToLower(base) { + case "nullable": + if len(args) == 1 { + inner, arr, _ := unwrapTypeString(args[0]) + return inner, arr, true + } + return strings.ToLower(base), false, true + case "lowcardinality": + // LowCardinality is an encoding of the type it wraps, and a + // column of LowCardinality(Nullable(String)) holds NULLs. + if len(args) == 1 { + return unwrapTypeString(args[0]) + } + return strings.ToLower(base), false, false + case "array": + if len(args) == 1 { + inner, _, _ := unwrapTypeString(args[0]) + return inner, true, false + } + return strings.ToLower(base), true, false + default: + if strings.TrimSpace(base) == "" { + return "nothing", false, false + } + return strings.ToLower(base), false, false + } +} + +func splitType(s string) (base string, args []string) { + s = strings.TrimSpace(s) + open := strings.IndexByte(s, '(') + if open < 0 || !strings.HasSuffix(s, ")") { + return s, nil + } + base = strings.TrimSpace(s[:open]) + inner := s[open+1 : len(s)-1] + depth, start := 0, 0 + for i := 0; i < len(inner); i++ { + switch inner[i] { + case '(': + depth++ + case ')': + depth-- + case ',': + if depth == 0 { + args = append(args, strings.TrimSpace(inner[start:i])) + start = i + 1 + } + } + } + if last := strings.TrimSpace(inner[start:]); last != "" { + args = append(args, last) + } + return base, args +} + +func (c *cc) convertUpdateQuery(n *chast.UpdateQuery) *ast.UpdateStmt { + rv := &ast.RangeVar{ + Relname: &n.Table, + } + if n.Database != "" { + rv.Schemaname = &n.Database + } + stmt := &ast.UpdateStmt{ + Relations: &ast.List{ + Items: []ast.Node{rv}, + }, + } + + // Convert assignments + if len(n.Assignments) > 0 { + stmt.TargetList = &ast.List{} + for _, assign := range n.Assignments { + name := identifier(assign.Column) + stmt.TargetList.Items = append(stmt.TargetList.Items, &ast.ResTarget{ + Name: &name, + Val: c.convertExpr(assign.Value), + }) + } + } + + // Convert WHERE clause + if n.Where != nil { + stmt.WhereClause = c.convertExpr(n.Where) + } + + return stmt +} + +func (c *cc) convertDeleteQuery(n *chast.DeleteQuery) *ast.DeleteStmt { + rv := &ast.RangeVar{ + Relname: &n.Table, + } + if n.Database != "" { + rv.Schemaname = &n.Database + } + stmt := &ast.DeleteStmt{ + Relations: &ast.List{ + Items: []ast.Node{rv}, + }, + } + + // Convert WHERE clause + if n.Where != nil { + stmt.WhereClause = c.convertExpr(n.Where) + } + + return stmt +} + +func (c *cc) convertDropQuery(n *chast.DropQuery) ast.Node { + // Handle DROP TABLE + if n.Table != "" { + tableName := &ast.TableName{ + Name: identifier(n.Table), + } + if n.Database != "" { + tableName.Schema = identifier(n.Database) + } + return &ast.DropTableStmt{ + IfExists: n.IfExists, + Tables: []*ast.TableName{tableName}, + } + } + + // Handle DROP TABLE with multiple tables + if len(n.Tables) > 0 { + tables := make([]*ast.TableName, 0, len(n.Tables)) + for _, t := range n.Tables { + tables = append(tables, parseTableName(t)) + } + return &ast.DropTableStmt{ + IfExists: n.IfExists, + Tables: tables, + } + } + + // Handle DROP DATABASE - return TODO for now + // Handle DROP VIEW - return TODO for now + return &ast.TODO{} +} + +func (c *cc) convertAlterQuery(n *chast.AlterQuery) ast.Node { + alt := &ast.AlterTableStmt{ + Table: &ast.TableName{ + Name: identifier(n.Table), + }, + Cmds: &ast.List{}, + } + + if n.Database != "" { + alt.Table.Schema = identifier(n.Database) + } + + for _, cmd := range n.Commands { + switch cmd.Type { + case chast.AlterAddColumn: + if cmd.Column != nil { + name := cmd.Column.Name + alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_AddColumn, + Def: c.convertColumnDeclaration(cmd.Column), + }) + } + case chast.AlterDropColumn: + name := cmd.ColumnName + alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_DropColumn, + MissingOk: cmd.IfExists, + }) + case chast.AlterModifyColumn: + if cmd.Column != nil { + name := cmd.Column.Name + // Drop and re-add to simulate modify + alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_DropColumn, + }) + alt.Cmds.Items = append(alt.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_AddColumn, + Def: c.convertColumnDeclaration(cmd.Column), + }) + } + case chast.AlterRenameColumn: + oldName := cmd.ColumnName + newName := cmd.NewName + return &ast.RenameColumnStmt{ + Table: alt.Table, + Col: &ast.ColumnRef{Name: oldName}, + NewName: &newName, + } + } + } + + return alt +} + +func (c *cc) convertTruncateQuery(n *chast.TruncateQuery) *ast.TruncateStmt { + stmt := &ast.TruncateStmt{ + Relations: &ast.List{}, + } + + tableName := n.Table + schemaName := n.Database + + rv := &ast.RangeVar{ + Relname: &tableName, + } + if schemaName != "" { + rv.Schemaname = &schemaName + } + + stmt.Relations.Items = append(stmt.Relations.Items, rv) + + return stmt +} diff --git a/internal/engine/clickhouse/dialect/dialect.json b/internal/engine/clickhouse/dialect/dialect.json new file mode 100644 index 0000000000..51cb0b641a --- /dev/null +++ b/internal/engine/clickhouse/dialect/dialect.json @@ -0,0 +1,41 @@ +{ + "dialect": "clickhouse", + "default_schema": "default", + "const": { + "integer": "Int64", + "float": "Float64", + "string": "String", + "bool": "Bool" + }, + "bool": "UInt8", + "limit": "UInt64", + "untyped": "Nothing", + "propagate_nullable": true, + "qualify_duplicate_columns": true, + "comparison": ["=", "==", "<>", "!=", "<", "<=", ">", ">="], + "comparison_categories": "NBSDU", + "arithmetic": ["+", "-", "*", "/", "%"], + "arithmetic_categories": "N", + "rewrites": [ + { + "from": "Decimal32($1)", + "to": "Decimal(9, $1)" + }, + { + "from": "Decimal64($1)", + "to": "Decimal(18, $1)" + }, + { + "from": "Decimal128($1)", + "to": "Decimal(38, $1)" + }, + { + "from": "Decimal256($1)", + "to": "Decimal(76, $1)" + } + ], + "ident_args": { + "AggregateFunction": [1], + "SimpleAggregateFunction": [1] + } +} diff --git a/internal/engine/clickhouse/dialect/functions.jsonl b/internal/engine/clickhouse/dialect/functions.jsonl new file mode 100644 index 0000000000..c0ca1406c1 --- /dev/null +++ b/internal/engine/clickhouse/dialect/functions.jsonl @@ -0,0 +1,581 @@ +{"name": "count", "kind": "a", "returns": "UInt64", "never_null": true} +{"name": "count", "kind": "a", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "countIf", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "sum", "kind": "a", "args": [{"type": "UInt8"}], "returns": "UInt64"} +{"name": "sum", "kind": "a", "args": [{"type": "UInt16"}], "returns": "UInt64"} +{"name": "sum", "kind": "a", "args": [{"type": "UInt32"}], "returns": "UInt64"} +{"name": "sum", "kind": "a", "args": [{"type": "Int8"}], "returns": "Int64"} +{"name": "sum", "kind": "a", "args": [{"type": "Int16"}], "returns": "Int64"} +{"name": "sum", "kind": "a", "args": [{"type": "Int32"}], "returns": "Int64"} +{"name": "sum", "kind": "a", "args": [{"type": "Float32"}], "returns": "Float64"} +{"name": "sum", "kind": "a", "args": [{"type": "any"}], "returns": "$1"} +{"name": "sumIf", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "avg", "kind": "a", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "avgIf", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "min", "kind": "a", "args": [{"type": "any"}], "returns": "$1"} +{"name": "max", "kind": "a", "args": [{"type": "any"}], "returns": "$1"} +{"name": "any", "kind": "a", "args": [{"type": "any"}], "returns": "$1"} +{"name": "anyLast", "kind": "a", "args": [{"type": "any"}], "returns": "$1"} +{"name": "minIf", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "maxIf", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "anyIf", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "uniq", "kind": "a", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "uniqExact", "kind": "a", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "uniqCombined", "kind": "a", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "uniqHLL12", "kind": "a", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "uniqIf", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "argMin", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "argMax", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "stddevPop", "kind": "a", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "stddevSamp", "kind": "a", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "varPop", "kind": "a", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "varSamp", "kind": "a", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "median", "kind": "a", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "quantile", "kind": "a", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "quantile", "kind": "a", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "row_number", "kind": "w", "returns": "UInt64", "never_null": true} +{"name": "rank", "kind": "w", "returns": "UInt64", "never_null": true} +{"name": "dense_rank", "kind": "w", "returns": "UInt64", "never_null": true} +{"name": "plus", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "minus", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "multiply", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "intDiv", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "intDivOrZero", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "modulo", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "moduloOrZero", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "gcd", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "lcm", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "bitAnd", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "bitOr", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "bitXor", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "bitShiftLeft", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "bitShiftRight", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "greatest", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "least", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "divide", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "negate", "args": [{"type": "any"}], "returns": "$1"} +{"name": "abs", "args": [{"type": "any"}], "returns": "$1"} +{"name": "round", "args": [{"type": "any"}], "returns": "$1"} +{"name": "floor", "args": [{"type": "any"}], "returns": "$1"} +{"name": "ceil", "args": [{"type": "any"}], "returns": "$1"} +{"name": "ceiling", "args": [{"type": "any"}], "returns": "$1"} +{"name": "trunc", "args": [{"type": "any"}], "returns": "$1"} +{"name": "truncate", "args": [{"type": "any"}], "returns": "$1"} +{"name": "identity", "args": [{"type": "any"}], "returns": "$1"} +{"name": "bitNot", "args": [{"type": "any"}], "returns": "$1"} +{"name": "round", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "floor", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "ceil", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "trunc", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "exp", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "log", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "ln", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "exp2", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "log2", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "exp10", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "log10", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "sqrt", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "cbrt", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "sin", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "cos", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "tan", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "asin", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "acos", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "atan", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "sigmoid", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "erf", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "lgamma", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "tgamma", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "pow", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "power", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "atan2", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "hypot", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "e", "returns": "Float64", "never_null": true} +{"name": "pi", "returns": "Float64", "never_null": true} +{"name": "sign", "args": [{"type": "any"}], "returns": "Int8"} +{"name": "isFinite", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "isInfinite", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "isNaN", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "rand", "returns": "UInt32", "never_null": true} +{"name": "rand32", "returns": "UInt32", "never_null": true} +{"name": "rand64", "returns": "UInt64", "never_null": true} +{"name": "randCanonical", "returns": "Float64", "never_null": true} +{"name": "equals", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "notEquals", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "less", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "greater", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "lessOrEquals", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "greaterOrEquals", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "and", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "or", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "xor", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "like", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "notLike", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "ilike", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "notILike", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "match", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "startsWith", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "endsWith", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "has", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "hasAll", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "hasAny", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "mapContains", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "multiSearchAny", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "in", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "notIn", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "not", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "isNull", "args": [{"type": "any"}], "returns": "UInt8", "never_null": true} +{"name": "isNotNull", "args": [{"type": "any"}], "returns": "UInt8", "never_null": true} +{"name": "isZeroOrNull", "args": [{"type": "any"}], "returns": "UInt8", "never_null": true} +{"name": "assumeNotNull", "args": [{"type": "any"}], "returns": "$1", "never_null": true} +{"name": "toNullable", "args": [{"type": "any"}], "returns": "$1", "nullable": true} +{"name": "nullIf", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1", "nullable": true} +{"name": "if", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$2"} +{"name": "empty", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "notEmpty", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "length", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "lengthUTF8", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "char_length", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "character_length", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "position", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "positionUTF8", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "positionCaseInsensitive", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "countSubstrings", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "indexOf", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "countEqual", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "ngramSearch", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "lower", "args": [{"type": "any"}], "returns": "String"} +{"name": "upper", "args": [{"type": "any"}], "returns": "String"} +{"name": "lowerUTF8", "args": [{"type": "any"}], "returns": "String"} +{"name": "upperUTF8", "args": [{"type": "any"}], "returns": "String"} +{"name": "toString", "args": [{"type": "any"}], "returns": "String"} +{"name": "toValidUTF8", "args": [{"type": "any"}], "returns": "String"} +{"name": "trim", "args": [{"type": "any"}], "returns": "String"} +{"name": "trimLeft", "args": [{"type": "any"}], "returns": "String"} +{"name": "trimRight", "args": [{"type": "any"}], "returns": "String"} +{"name": "trimBoth", "args": [{"type": "any"}], "returns": "String"} +{"name": "ltrim", "args": [{"type": "any"}], "returns": "String"} +{"name": "rtrim", "args": [{"type": "any"}], "returns": "String"} +{"name": "hex", "args": [{"type": "any"}], "returns": "String"} +{"name": "unhex", "args": [{"type": "any"}], "returns": "String"} +{"name": "bin", "args": [{"type": "any"}], "returns": "String"} +{"name": "base64Encode", "args": [{"type": "any"}], "returns": "String"} +{"name": "base64Decode", "args": [{"type": "any"}], "returns": "String"} +{"name": "tryBase64Decode", "args": [{"type": "any"}], "returns": "String"} +{"name": "reverseUTF8", "args": [{"type": "any"}], "returns": "String"} +{"name": "initcap", "args": [{"type": "any"}], "returns": "String"} +{"name": "normalizeQuery", "args": [{"type": "any"}], "returns": "String"} +{"name": "typeName", "args": [{"type": "any"}], "returns": "String"} +{"name": "dumpColumnStructure", "args": [{"type": "any"}], "returns": "String"} +{"name": "urlDecode", "args": [{"type": "any"}], "returns": "String"} +{"name": "encodeURLComponent", "args": [{"type": "any"}], "returns": "String"} +{"name": "decodeURLComponent", "args": [{"type": "any"}], "returns": "String"} +{"name": "domain", "args": [{"type": "any"}], "returns": "String"} +{"name": "topLevelDomain", "args": [{"type": "any"}], "returns": "String"} +{"name": "path", "args": [{"type": "any"}], "returns": "String"} +{"name": "pathFull", "args": [{"type": "any"}], "returns": "String"} +{"name": "protocol", "args": [{"type": "any"}], "returns": "String"} +{"name": "queryString", "args": [{"type": "any"}], "returns": "String"} +{"name": "fragment", "args": [{"type": "any"}], "returns": "String"} +{"name": "cutQueryString", "args": [{"type": "any"}], "returns": "String"} +{"name": "cutFragment", "args": [{"type": "any"}], "returns": "String"} +{"name": "cutWWW", "args": [{"type": "any"}], "returns": "String"} +{"name": "firstSignificantSubdomain", "args": [{"type": "any"}], "returns": "String"} +{"name": "IPv4NumToString", "args": [{"type": "any"}], "returns": "String"} +{"name": "IPv6NumToString", "args": [{"type": "any"}], "returns": "String"} +{"name": "formatReadableSize", "args": [{"type": "any"}], "returns": "String"} +{"name": "formatReadableQuantity", "args": [{"type": "any"}], "returns": "String"} +{"name": "formatReadableDecimalSize", "args": [{"type": "any"}], "returns": "String"} +{"name": "formatReadableTimeDelta", "args": [{"type": "any"}], "returns": "String"} +{"name": "toDecimalString", "args": [{"type": "any"}], "returns": "String"} +{"name": "monthName", "args": [{"type": "any"}], "returns": "String"} +{"name": "toJSONString", "args": [{"type": "any"}], "returns": "String"} +{"name": "toTypeName", "args": [{"type": "any"}], "returns": "String", "never_null": true} +{"name": "hostName", "returns": "String", "never_null": true} +{"name": "version", "returns": "String", "never_null": true} +{"name": "currentDatabase", "returns": "String", "never_null": true} +{"name": "currentUser", "returns": "String", "never_null": true} +{"name": "FQDN", "returns": "String", "never_null": true} +{"name": "queryID", "returns": "String", "never_null": true} +{"name": "generateULID", "returns": "String", "never_null": true} +{"name": "concat", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "substring", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "substr", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "mid", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "substringUTF8", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "repeat", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "leftPad", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "rightPad", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "left", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "right", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "extract", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "formatDateTime", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "formatDateTimeInJodaSyntax", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "dateName", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "JSONExtractString", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "JSONExtractRaw", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "visitParamExtractString", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "simpleJSONExtractString", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "arrayStringConcat", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "regexpExtract", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "translate", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "format", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "toDecimalString", "args": [{"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "concat", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "substring", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "substr", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "mid", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "substringUTF8", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "leftPad", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "rightPad", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "replaceOne", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "replaceAll", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "replaceRegexpOne", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "replaceRegexpAll", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "translate", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "format", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "concatWithSeparator", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "regexpExtract", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "formatDateTime", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "JSONExtractString", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "JSONExtractRaw", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "concat", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "concat", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "concat", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "arrayStringConcat", "args": [{"type": "any"}], "returns": "String"} +{"name": "splitByChar", "args": [{"type": "any"}, {"type": "any"}], "returns": "Array(String)"} +{"name": "splitByString", "args": [{"type": "any"}, {"type": "any"}], "returns": "Array(String)"} +{"name": "splitByRegexp", "args": [{"type": "any"}, {"type": "any"}], "returns": "Array(String)"} +{"name": "splitByWhitespace", "args": [{"type": "any"}, {"type": "any"}], "returns": "Array(String)"} +{"name": "alphaTokens", "args": [{"type": "any"}, {"type": "any"}], "returns": "Array(String)"} +{"name": "extractAll", "args": [{"type": "any"}, {"type": "any"}], "returns": "Array(String)"} +{"name": "tokens", "args": [{"type": "any"}, {"type": "any"}], "returns": "Array(String)"} +{"name": "splitByWhitespace", "args": [{"type": "any"}], "returns": "Array(String)"} +{"name": "alphaTokens", "args": [{"type": "any"}], "returns": "Array(String)"} +{"name": "tokens", "args": [{"type": "any"}], "returns": "Array(String)"} +{"name": "reverse", "args": [{"type": "any"}], "returns": "$1"} +{"name": "md5", "args": [{"type": "any"}], "returns": "FixedString(16)"} +{"name": "MD5", "args": [{"type": "any"}], "returns": "FixedString(16)"} +{"name": "sipHash128", "args": [{"type": "any"}], "returns": "FixedString(16)"} +{"name": "murmurHash3_128", "args": [{"type": "any"}], "returns": "FixedString(16)"} +{"name": "cityHash128", "args": [{"type": "any"}], "returns": "FixedString(16)"} +{"name": "SHA1", "args": [{"type": "any"}], "returns": "FixedString(20)"} +{"name": "SHA224", "args": [{"type": "any"}], "returns": "FixedString(28)"} +{"name": "SHA256", "args": [{"type": "any"}], "returns": "FixedString(32)"} +{"name": "SHA512", "args": [{"type": "any"}], "returns": "FixedString(64)"} +{"name": "sipHash64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "cityHash64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "xxHash64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "halfMD5", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "farmHash64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "javaHash", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "intHash64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "murmurHash2_64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "murmurHash3_64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "metroHash64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "xxh3", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "wyHash64", "args": [{"type": "any"}], "returns": "UInt64", "never_null": true} +{"name": "xxHash32", "args": [{"type": "any"}], "returns": "UInt32", "never_null": true} +{"name": "intHash32", "args": [{"type": "any"}], "returns": "UInt32", "never_null": true} +{"name": "murmurHash2_32", "args": [{"type": "any"}], "returns": "UInt32", "never_null": true} +{"name": "murmurHash3_32", "args": [{"type": "any"}], "returns": "UInt32", "never_null": true} +{"name": "crc32", "args": [{"type": "any"}], "returns": "UInt32", "never_null": true} +{"name": "CRC32", "args": [{"type": "any"}], "returns": "UInt32", "never_null": true} +{"name": "javaHash", "args": [{"type": "any"}], "returns": "UInt32", "never_null": true} +{"name": "levenshteinDistance", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "editDistance", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "ngramDistance", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float32"} +{"name": "ngramSearch", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float32"} +{"name": "jaroSimilarity", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float32"} +{"name": "jaroWinklerSimilarity", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float32"} +{"name": "toInt8", "args": [{"type": "any"}], "returns": "Int8"} +{"name": "toInt8OrZero", "args": [{"type": "any"}], "returns": "Int8"} +{"name": "toInt8OrNull", "args": [{"type": "any"}], "returns": "Int8", "nullable": true} +{"name": "toInt16", "args": [{"type": "any"}], "returns": "Int16"} +{"name": "toInt16OrZero", "args": [{"type": "any"}], "returns": "Int16"} +{"name": "toInt16OrNull", "args": [{"type": "any"}], "returns": "Int16", "nullable": true} +{"name": "toInt32", "args": [{"type": "any"}], "returns": "Int32"} +{"name": "toInt32OrZero", "args": [{"type": "any"}], "returns": "Int32"} +{"name": "toInt32OrNull", "args": [{"type": "any"}], "returns": "Int32", "nullable": true} +{"name": "toInt64", "args": [{"type": "any"}], "returns": "Int64"} +{"name": "toInt64OrZero", "args": [{"type": "any"}], "returns": "Int64"} +{"name": "toInt64OrNull", "args": [{"type": "any"}], "returns": "Int64", "nullable": true} +{"name": "toInt128", "args": [{"type": "any"}], "returns": "Int128"} +{"name": "toInt128OrZero", "args": [{"type": "any"}], "returns": "Int128"} +{"name": "toInt128OrNull", "args": [{"type": "any"}], "returns": "Int128", "nullable": true} +{"name": "toInt256", "args": [{"type": "any"}], "returns": "Int256"} +{"name": "toInt256OrZero", "args": [{"type": "any"}], "returns": "Int256"} +{"name": "toInt256OrNull", "args": [{"type": "any"}], "returns": "Int256", "nullable": true} +{"name": "toUInt8", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toUInt8OrZero", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toUInt8OrNull", "args": [{"type": "any"}], "returns": "UInt8", "nullable": true} +{"name": "toUInt16", "args": [{"type": "any"}], "returns": "UInt16"} +{"name": "toUInt16OrZero", "args": [{"type": "any"}], "returns": "UInt16"} +{"name": "toUInt16OrNull", "args": [{"type": "any"}], "returns": "UInt16", "nullable": true} +{"name": "toUInt32", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toUInt32OrZero", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toUInt32OrNull", "args": [{"type": "any"}], "returns": "UInt32", "nullable": true} +{"name": "toUInt64", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "toUInt64OrZero", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "toUInt64OrNull", "args": [{"type": "any"}], "returns": "UInt64", "nullable": true} +{"name": "toUInt128", "args": [{"type": "any"}], "returns": "UInt128"} +{"name": "toUInt128OrZero", "args": [{"type": "any"}], "returns": "UInt128"} +{"name": "toUInt128OrNull", "args": [{"type": "any"}], "returns": "UInt128", "nullable": true} +{"name": "toUInt256", "args": [{"type": "any"}], "returns": "UInt256"} +{"name": "toUInt256OrZero", "args": [{"type": "any"}], "returns": "UInt256"} +{"name": "toUInt256OrNull", "args": [{"type": "any"}], "returns": "UInt256", "nullable": true} +{"name": "toFloat32", "args": [{"type": "any"}], "returns": "Float32"} +{"name": "toFloat32OrZero", "args": [{"type": "any"}], "returns": "Float32"} +{"name": "toFloat32OrNull", "args": [{"type": "any"}], "returns": "Float32", "nullable": true} +{"name": "toFloat64", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "toFloat64OrZero", "args": [{"type": "any"}], "returns": "Float64"} +{"name": "toFloat64OrNull", "args": [{"type": "any"}], "returns": "Float64", "nullable": true} +{"name": "toDate", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toDateOrZero", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toDateOrNull", "args": [{"type": "any"}], "returns": "Date", "nullable": true} +{"name": "toDate32", "args": [{"type": "any"}], "returns": "Date32"} +{"name": "toDate32OrZero", "args": [{"type": "any"}], "returns": "Date32"} +{"name": "toDate32OrNull", "args": [{"type": "any"}], "returns": "Date32", "nullable": true} +{"name": "toDateTime", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toDateTimeOrZero", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toDateTimeOrNull", "args": [{"type": "any"}], "returns": "DateTime", "nullable": true} +{"name": "toUUID", "args": [{"type": "any"}], "returns": "UUID"} +{"name": "toUUIDOrZero", "args": [{"type": "any"}], "returns": "UUID"} +{"name": "toUUIDOrNull", "args": [{"type": "any"}], "returns": "UUID", "nullable": true} +{"name": "toIPv4", "args": [{"type": "any"}], "returns": "IPv4"} +{"name": "toIPv4OrZero", "args": [{"type": "any"}], "returns": "IPv4"} +{"name": "toIPv4OrNull", "args": [{"type": "any"}], "returns": "IPv4", "nullable": true} +{"name": "toIPv6", "args": [{"type": "any"}], "returns": "IPv6"} +{"name": "toIPv6OrZero", "args": [{"type": "any"}], "returns": "IPv6"} +{"name": "toIPv6OrNull", "args": [{"type": "any"}], "returns": "IPv6", "nullable": true} +{"name": "toBool", "args": [{"type": "any"}], "returns": "Bool"} +{"name": "toString", "args": [{"type": "any"}], "returns": "String"} +{"name": "toDateTime", "args": [{"type": "any"}, {"type": "any"}], "returns": "DateTime"} +{"name": "toDate", "args": [{"type": "any"}, {"type": "any"}], "returns": "Date"} +{"name": "toDateTime64", "args": [{"type": "any"}, {"type": "any"}], "returns": "DateTime64($2)"} +{"name": "toDateTime64", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "DateTime64($2, $3)"} +{"name": "toDecimal32", "args": [{"type": "any"}, {"type": "any"}], "returns": "Decimal(9, $2)"} +{"name": "toDecimal64", "args": [{"type": "any"}, {"type": "any"}], "returns": "Decimal(18, $2)"} +{"name": "toDecimal128", "args": [{"type": "any"}, {"type": "any"}], "returns": "Decimal(38, $2)"} +{"name": "toDecimal256", "args": [{"type": "any"}, {"type": "any"}], "returns": "Decimal(76, $2)"} +{"name": "toFixedString", "args": [{"type": "any"}, {"type": "any"}], "returns": "FixedString"} +{"name": "toStringCutToZero", "args": [{"type": "any"}], "returns": "String"} +{"name": "reinterpretAsString", "args": [{"type": "any"}], "returns": "String"} +{"name": "reinterpretAsUInt64", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "toUnixTimestamp", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toUnixTimestamp", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt32"} +{"name": "fromUnixTimestamp", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toUUIDOrNull", "args": [{"type": "any"}], "returns": "UUID", "nullable": true} +{"name": "toUUIDOrZero", "args": [{"type": "any"}], "returns": "UUID"} +{"name": "generateUUIDv4", "returns": "UUID", "never_null": true} +{"name": "generateUUIDv7", "returns": "UUID", "never_null": true} +{"name": "toIntervalSecond", "args": [{"type": "any"}], "returns": "IntervalSecond"} +{"name": "toIntervalMinute", "args": [{"type": "any"}], "returns": "IntervalMinute"} +{"name": "toIntervalHour", "args": [{"type": "any"}], "returns": "IntervalHour"} +{"name": "toIntervalDay", "args": [{"type": "any"}], "returns": "IntervalDay"} +{"name": "toIntervalWeek", "args": [{"type": "any"}], "returns": "IntervalWeek"} +{"name": "toIntervalMonth", "args": [{"type": "any"}], "returns": "IntervalMonth"} +{"name": "toIntervalYear", "args": [{"type": "any"}], "returns": "IntervalYear"} +{"name": "now", "returns": "DateTime", "never_null": true} +{"name": "now", "args": [{"type": "any"}], "returns": "DateTime", "never_null": true} +{"name": "now64", "returns": "DateTime64", "never_null": true} +{"name": "now64", "args": [{"type": "any"}], "returns": "DateTime64", "never_null": true} +{"name": "today", "returns": "Date", "never_null": true} +{"name": "yesterday", "returns": "Date", "never_null": true} +{"name": "timeZone", "returns": "String", "never_null": true} +{"name": "serverTimezone", "returns": "String", "never_null": true} +{"name": "toYear", "args": [{"type": "any"}], "returns": "UInt16"} +{"name": "toISOYear", "args": [{"type": "any"}], "returns": "UInt16"} +{"name": "toDayOfYear", "args": [{"type": "any"}], "returns": "UInt16"} +{"name": "toRelativeYearNum", "args": [{"type": "any"}], "returns": "UInt16"} +{"name": "toWeek", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toISOWeek", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toYearWeek", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toQuarter", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toMonth", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toDayOfMonth", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toDayOfWeek", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toHour", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toMinute", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toSecond", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toMillisecond", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "toYYYYMM", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toYYYYMMDD", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toYYYYMMDDhhmmss", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "toStartOfDay", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toStartOfHour", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toStartOfMinute", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toStartOfFiveMinutes", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toStartOfFifteenMinutes", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toStartOfTenMinutes", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toTime", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "timeSlot", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toLastDayOfMonth", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "toLastDayOfMonth", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toStartOfMonth", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toStartOfQuarter", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toStartOfYear", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toStartOfWeek", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toMonday", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toStartOfISOYear", "args": [{"type": "any"}], "returns": "Date"} +{"name": "toStartOfWeek", "args": [{"type": "any"}, {"type": "any"}], "returns": "Date"} +{"name": "toStartOfInterval", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addYears", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addQuarters", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addMonths", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addWeeks", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addDays", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addHours", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addMinutes", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addSeconds", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addMilliseconds", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractYears", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractQuarters", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractMonths", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractWeeks", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractDays", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractHours", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractMinutes", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractSeconds", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "addInterval", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "subtractInterval", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "dateDiff", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "date_diff", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "timestampDiff", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "timestamp_diff", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "age", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "dateAdd", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$3"} +{"name": "date_add", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$3"} +{"name": "dateSub", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$3"} +{"name": "date_sub", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$3"} +{"name": "timestampAdd", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$3"} +{"name": "timestampSub", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$3"} +{"name": "dateTrunc", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$3"} +{"name": "date_trunc", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$3"} +{"name": "dateTrunc", "args": [{"type": "any"}, {"type": "any"}], "returns": "$2"} +{"name": "date_trunc", "args": [{"type": "any"}, {"type": "any"}], "returns": "$2"} +{"name": "toRelativeDayNum", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toRelativeHourNum", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toRelativeMinuteNum", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toRelativeSecondNum", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toRelativeMonthNum", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toRelativeWeekNum", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "toTimeZone", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "toTimezone", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "parseDateTimeBestEffort", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "parseDateTimeBestEffortOrNull", "args": [{"type": "any"}], "returns": "DateTime", "nullable": true} +{"name": "parseDateTimeBestEffortOrZero", "args": [{"type": "any"}], "returns": "DateTime"} +{"name": "parseDateTime", "args": [{"type": "any"}, {"type": "any"}], "returns": "DateTime"} +{"name": "parseDateTime64BestEffort", "args": [{"type": "any"}], "returns": "DateTime64"} +{"name": "makeDate", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Date"} +{"name": "makeDateTime", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "DateTime"} +{"name": "arrayConcat", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayConcat", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayConcat", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayDistinct", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayDistinct", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayDistinct", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arraySort", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arraySort", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arraySort", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayReverseSort", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayReverseSort", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayReverseSort", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayReverse", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayReverse", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayReverse", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arraySlice", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arraySlice", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arraySlice", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayResize", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayResize", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayResize", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayPushBack", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayPushBack", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayPushBack", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayPushFront", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayPushFront", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayPushFront", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayPopBack", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayPopBack", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayPopBack", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayPopFront", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayPopFront", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayPopFront", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayFlatten", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayFlatten", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayFlatten", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayCompact", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayCompact", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayCompact", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayIntersect", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayIntersect", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayIntersect", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayUnion", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayUnion", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayUnion", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayShuffle", "args": [{"type": "any"}], "returns": "$1"} +{"name": "arrayShuffle", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayShuffle", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "arrayCount", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "arrayCount", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt32"} +{"name": "arrayUniq", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "arrayExists", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "arrayAll", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "hasSubstr", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "arrayEnumerate", "args": [{"type": "any"}], "returns": "Array(UInt32)"} +{"name": "arrayEnumerateUniq", "args": [{"type": "any"}], "returns": "Array(UInt32)"} +{"name": "range", "args": [{"type": "any"}], "returns": "Array(UInt64)"} +{"name": "range", "args": [{"type": "any"}, {"type": "any"}], "returns": "Array(UInt64)"} +{"name": "range", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Array(UInt64)"} +{"name": "mapKeys", "args": [{"type": "any"}], "returns": "$1"} +{"name": "mapValues", "args": [{"type": "any"}], "returns": "$1"} +{"name": "length", "args": [{"type": "any"}], "returns": "UInt64"} +{"name": "JSONExtractInt", "args": [{"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "JSONExtractInt64", "args": [{"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "JSONExtractUInt", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "JSONExtractFloat", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "JSONExtractBool", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "JSONHas", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "JSONLength", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "JSONType", "args": [{"type": "any"}, {"type": "any"}], "returns": "Enum8"} +{"name": "isValidJSON", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "JSONArrayLength", "args": [{"type": "any"}], "returns": "UInt64", "nullable": true} +{"name": "simpleJSONExtractInt", "args": [{"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "simpleJSONExtractUInt", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "simpleJSONExtractFloat", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "simpleJSONExtractBool", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "simpleJSONHas", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "visitParamExtractInt", "args": [{"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "visitParamExtractUInt", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "visitParamExtractFloat", "args": [{"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "visitParamExtractBool", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "visitParamHas", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "IPv4StringToNum", "args": [{"type": "any"}], "returns": "UInt32"} +{"name": "IPv4StringToNumOrNull", "args": [{"type": "any"}], "returns": "UInt32", "nullable": true} +{"name": "IPv6StringToNum", "args": [{"type": "any"}], "returns": "FixedString(16)"} +{"name": "isIPv4String", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "isIPv6String", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "sleep", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "blockSize", "returns": "UInt64", "never_null": true} +{"name": "rowNumberInAllBlocks", "returns": "UInt64", "never_null": true} +{"name": "materialize", "args": [{"type": "any"}], "returns": "$1"} +{"name": "ignore", "args": [{"type": "any"}], "returns": "UInt8", "never_null": true} +{"name": "ifNotFinite", "args": [{"type": "any"}, {"type": "any"}], "returns": "$1"} +{"name": "throwIf", "args": [{"type": "any"}], "returns": "UInt8"} +{"name": "transform", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$4"} +{"name": "bar", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "bar", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "dictGetString", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "String"} +{"name": "dictGetUInt64", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "UInt64"} +{"name": "dictGetInt64", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Int64"} +{"name": "dictGetFloat64", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Float64"} +{"name": "dictGetDate", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "Date"} +{"name": "dictGetDateTime", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "DateTime"} +{"name": "dictHas", "args": [{"type": "any"}, {"type": "any"}], "returns": "UInt8"} +{"name": "tuple", "args": [{"type": "any"}], "returns": "Tuple"} +{"name": "tupleElement", "args": [{"type": "any"}, {"type": "any"}], "returns": "any"} +{"name": "map", "args": [{"type": "any"}, {"type": "any"}], "returns": "Map"} +{"name": "multiIf", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$2"} +{"name": "multiIf", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$2"} +{"name": "multiIf", "args": [{"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}, {"type": "any"}], "returns": "$2"} diff --git a/internal/engine/clickhouse/dialect/types.jsonl b/internal/engine/clickhouse/dialect/types.jsonl new file mode 100644 index 0000000000..eb1b00e1da --- /dev/null +++ b/internal/engine/clickhouse/dialect/types.jsonl @@ -0,0 +1,66 @@ +{"name":"AggregateFunction","category":"U"} +{"name":"Array","category":"A"} +{"name":"BFloat16","category":"N"} +{"name":"Bool","category":"B","aliases":["boolean"]} +{"name":"Date","category":"D"} +{"name":"Date32","category":"D"} +{"name":"DateTime","category":"D","aliases":["TIMESTAMP"]} +{"name":"DateTime32","category":"D"} +{"name":"DateTime64","category":"D"} +{"name":"Decimal","category":"N","aliases":["DEC","FIXED","NUMERIC"]} +{"name":"Decimal128","category":"N"} +{"name":"Decimal256","category":"N"} +{"name":"Decimal32","category":"N"} +{"name":"Decimal64","category":"N"} +{"name":"Dynamic","category":"U"} +{"name":"Enum","category":"U"} +{"name":"Enum16","category":"U"} +{"name":"Enum8","category":"U"} +{"name":"FixedString","category":"S","aliases":["BINARY"]} +{"name":"Float32","category":"N","aliases":["FLOAT","REAL","SINGLE"]} +{"name":"Float64","category":"N","aliases":["DOUBLE","DOUBLE PRECISION"]} +{"name":"IPv4","category":"S","aliases":["INET4"]} +{"name":"IPv6","category":"S","aliases":["INET6"]} +{"name":"Int128","category":"N"} +{"name":"Int16","category":"N","aliases":["SMALLINT","SMALLINT SIGNED"]} +{"name":"Int256","category":"N"} +{"name":"Int32","category":"N","aliases":["INT","INT SIGNED","INTEGER","INTEGER SIGNED","MEDIUMINT","MEDIUMINT SIGNED"]} +{"name":"Int64","category":"N","aliases":["BIGINT","BIGINT SIGNED","SIGNED"]} +{"name":"Int8","category":"N","aliases":["BYTE","INT1","INT1 SIGNED","TINYINT","TINYINT SIGNED"]} +{"name":"IntervalDay","category":"T"} +{"name":"IntervalHour","category":"T"} +{"name":"IntervalMicrosecond","category":"T"} +{"name":"IntervalMillisecond","category":"T"} +{"name":"IntervalMinute","category":"T"} +{"name":"IntervalMonth","category":"T"} +{"name":"IntervalNanosecond","category":"T"} +{"name":"IntervalQuarter","category":"T"} +{"name":"IntervalSecond","category":"T"} +{"name":"IntervalWeek","category":"T"} +{"name":"IntervalYear","category":"T"} +{"name":"JSON","category":"U"} +{"name":"LineString","category":"U"} +{"name":"LowCardinality","category":"U"} +{"name":"Map","category":"U"} +{"name":"MultiLineString","category":"U"} +{"name":"MultiPolygon","category":"U"} +{"name":"Nested","category":"U"} +{"name":"Nothing","category":"U"} +{"name":"Nullable","category":"U"} +{"name":"Object","category":"U"} +{"name":"Point","category":"U"} +{"name":"Polygon","category":"U"} +{"name":"Ring","category":"U"} +{"name":"SimpleAggregateFunction","category":"U"} +{"name":"String","category":"S","aliases":["BINARY LARGE OBJECT","BINARY VARYING","BLOB","BYTEA","CHAR","CHAR LARGE OBJECT","CHAR VARYING","CHARACTER","CHARACTER LARGE OBJECT","CHARACTER VARYING","CLOB","GEOMETRY","LONGBLOB","LONGTEXT","MEDIUMBLOB","MEDIUMTEXT","NATIONAL CHAR","NATIONAL CHAR VARYING","NATIONAL CHARACTER","NATIONAL CHARACTER LARGE OBJECT","NATIONAL CHARACTER VARYING","NCHAR","NCHAR LARGE OBJECT","NCHAR VARYING","NVARCHAR","TEXT","TINYBLOB","TINYTEXT","VARBINARY","VARCHAR","VARCHAR2"]} +{"name":"Time","category":"D"} +{"name":"Time64","category":"D"} +{"name":"Tuple","category":"U"} +{"name":"UInt128","category":"N"} +{"name":"UInt16","category":"N","aliases":["SMALLINT UNSIGNED","YEAR"]} +{"name":"UInt256","category":"N"} +{"name":"UInt32","category":"N","aliases":["INT UNSIGNED","INTEGER UNSIGNED","MEDIUMINT UNSIGNED"]} +{"name":"UInt64","category":"N","aliases":["BIGINT UNSIGNED","BIT","SET","UNSIGNED"]} +{"name":"UInt8","category":"N","aliases":["INT1 UNSIGNED","TINYINT UNSIGNED"]} +{"name":"UUID","category":"S"} +{"name":"Variant","category":"U"} diff --git a/internal/engine/clickhouse/format.go b/internal/engine/clickhouse/format.go new file mode 100644 index 0000000000..5d3cf1090b --- /dev/null +++ b/internal/engine/clickhouse/format.go @@ -0,0 +1,29 @@ +package clickhouse + +// QuoteIdent returns a quoted identifier if it needs quoting. +// ClickHouse uses backticks or double quotes for quoting identifiers. +func (p *Parser) QuoteIdent(s string) string { + // For now, don't quote - can be extended to quote when necessary + return s +} + +// TypeName returns the SQL type name for the given namespace and name. +func (p *Parser) TypeName(ns, name string) string { + if ns != "" { + return ns + "." + name + } + return name +} + +// Param returns the parameter placeholder for the given number. +// ClickHouse uses {name:Type} for named parameters, but for positional +// parameters we use ? which is supported by the clickhouse-go driver. +func (p *Parser) Param(n int, numbered bool) string { + return "?" +} + +// Cast returns a type cast expression. +// ClickHouse uses CAST(expr AS type) syntax, same as MySQL. +func (p *Parser) Cast(arg, typeName string) string { + return "CAST(" + arg + " AS " + typeName + ")" +} diff --git a/internal/engine/clickhouse/parse.go b/internal/engine/clickhouse/parse.go new file mode 100644 index 0000000000..fa77fd91ef --- /dev/null +++ b/internal/engine/clickhouse/parse.go @@ -0,0 +1,125 @@ +package clickhouse + +import ( + "bytes" + "context" + "io" + + "github.com/sqlc-dev/doubleclick/parser" + + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func NewParser() *Parser { + return &Parser{} +} + +type Parser struct{} + +func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { + blob, err := io.ReadAll(r) + if err != nil { + return nil, err + } + + ctx := context.Background() + stmtNodes, err := parser.Parse(ctx, bytes.NewReader(blob)) + if err != nil { + return nil, err + } + + var stmts []ast.Statement + loc := 0 + for _, stmt := range stmtNodes { + start := stmt.Pos().Offset - 1 + if start < loc { + start = loc + } + end := statementEnd(blob, start) + + converter := &cc{} + out := converter.convert(stmt) + if _, ok := out.(*ast.TODO); ok { + loc = end + continue + } + + stmts = append(stmts, ast.Statement{ + Raw: &ast.RawStmt{ + Stmt: out, + StmtLocation: loc, + StmtLen: end - loc, + }, + }) + loc = end + } + + return stmts, nil +} + +func statementEnd(blob []byte, start int) int { + for i := start; i < len(blob); i++ { + switch blob[i] { + case '\'', '"', '`': + i = skipQuoted(blob, i) + case '-': + if i+1 < len(blob) && blob[i+1] == '-' { + i = skipLineComment(blob, i) + } + case '#': + i = skipLineComment(blob, i) + case '/': + if i+1 < len(blob) && blob[i+1] == '*' { + i = skipBlockComment(blob, i) + } + case ';': + return i + 1 + } + } + return len(blob) +} + +func skipQuoted(blob []byte, i int) int { + q := blob[i] + for j := i + 1; j < len(blob); j++ { + switch blob[j] { + case '\\': + j++ + case q: + if j+1 < len(blob) && blob[j+1] == q { + j++ + continue + } + return j + } + } + return len(blob) - 1 +} + +func skipLineComment(blob []byte, i int) int { + for j := i; j < len(blob); j++ { + if blob[j] == '\n' { + return j + } + } + return len(blob) - 1 +} + +func skipBlockComment(blob []byte, i int) int { + for j := i + 2; j < len(blob); j++ { + if blob[j] == '*' && j+1 < len(blob) && blob[j+1] == '/' { + return j + 1 + } + } + return len(blob) - 1 +} + +// https://clickhouse.com/docs/en/sql-reference/syntax#comments +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ + Dash: true, // -- comment + SlashStar: true, // /* comment */ + Hash: true, // # comment (ClickHouse supports this) + } +} diff --git a/internal/engine/clickhouse/reserved.go b/internal/engine/clickhouse/reserved.go new file mode 100644 index 0000000000..1a9ac45f3a --- /dev/null +++ b/internal/engine/clickhouse/reserved.go @@ -0,0 +1,150 @@ +package clickhouse + +import "strings" + +// https://clickhouse.com/docs/en/sql-reference/syntax#keywords +func (p *Parser) IsReservedKeyword(s string) bool { + switch strings.ToLower(s) { + case "add": + case "after": + case "alias": + case "all": + case "alter": + case "and": + case "anti": + case "any": + case "array": + case "as": + case "asc": + case "asof": + case "between": + case "both": + case "by": + case "case": + case "cast": + case "check": + case "cluster": + case "collate": + case "column": + case "comment": + case "constraint": + case "create": + case "cross": + case "cube": + case "database": + case "databases": + case "default": + case "delete": + case "desc": + case "describe": + case "detach": + case "distinct": + case "distributed": + case "drop": + case "else": + case "end": + case "engine": + case "exists": + case "explain": + case "expression": + case "extract": + case "false": + case "fetch": + case "final": + case "first": + case "for": + case "format": + case "from": + case "full": + case "function": + case "global": + case "grant": + case "group": + case "having": + case "if": + case "ilike": + case "in": + case "index": + case "inner": + case "insert": + case "interpolate": + case "interval": + case "into": + case "is": + case "join": + case "key": + case "kill": + case "last": + case "leading": + case "left": + case "like": + case "limit": + case "live": + case "local": + case "logs": + case "materialized": + case "modify": + case "natural": + case "not": + case "null": + case "nulls": + case "offset": + case "on": + case "optimize": + case "or": + case "order": + case "outer": + case "outfile": + case "over": + case "partition": + case "paste": + case "populate": + case "prewhere": + case "primary": + case "projection": + case "rename": + case "replace": + case "right": + case "rollup": + case "sample": + case "select": + case "semi": + case "set": + case "settings": + case "show": + case "storage": + case "substring": + case "sync": + case "system": + case "table": + case "tables": + case "temporary": + case "test": + case "then": + case "ties": + case "to": + case "top": + case "totals": + case "trailing": + case "trim": + case "true": + case "truncate": + case "ttl": + case "type": + case "union": + case "update": + case "use": + case "using": + case "uuid": + case "values": + case "view": + case "watch": + case "when": + case "where": + case "window": + case "with": + default: + return false + } + return true +} diff --git a/internal/engine/clickhouse/seed.go b/internal/engine/clickhouse/seed.go new file mode 100644 index 0000000000..b87a704e41 --- /dev/null +++ b/internal/engine/clickhouse/seed.go @@ -0,0 +1,25 @@ +package clickhouse + +import ( + "embed" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/seed" +) + +// The dialect directory describes ClickHouse's type system. types.jsonl is +// generated from system.data_type_families of the pinned ClickHouse release +// by goldeneye (internal/goldeneye), which also checks it against one; +// dialect.json and functions.jsonl are authored by hand, since ClickHouse +// publishes no function signatures. Regenerate from internal/goldeneye with: +// +// go run ./cmd/goldeneye install clickhouse +// go run ./cmd/goldeneye generate clickhouse +// +//go:embed dialect +var dialectFS embed.FS + +// Dialect returns the catalog option that seeds ClickHouse's type system. +func Dialect() core.Option { + return seed.Dialect(dialectFS, "dialect") +} diff --git a/internal/engine/clickhouse/stdlib.go b/internal/engine/clickhouse/stdlib.go new file mode 100644 index 0000000000..da7b53ab21 --- /dev/null +++ b/internal/engine/clickhouse/stdlib.go @@ -0,0 +1,9 @@ +package clickhouse + +import ( + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +func defaultSchema(name string) *catalog.Schema { + return &catalog.Schema{Name: name} +} diff --git a/internal/engine/clickhouse/utils.go b/internal/engine/clickhouse/utils.go new file mode 100644 index 0000000000..9e52f4d5a7 --- /dev/null +++ b/internal/engine/clickhouse/utils.go @@ -0,0 +1,59 @@ +package clickhouse + +import ( + "log" + "strings" + + chast "github.com/sqlc-dev/doubleclick/ast" + + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func todo(n chast.Node) *ast.TODO { + if debug.Active { + log.Printf("clickhouse.convert: Unknown node type %T\n", n) + } + return &ast.TODO{} +} + +func identifier(id string) string { + return strings.ToLower(id) +} + +func NewIdentifier(t string) *ast.String { + return &ast.String{Str: identifier(t)} +} + +func parseTableName(n *chast.TableIdentifier) *ast.TableName { + return &ast.TableName{ + Schema: identifier(n.Database), + Name: identifier(n.Table), + } +} + +func parseTableIdentifierToRangeVar(n *chast.TableIdentifier) *ast.RangeVar { + schemaname := identifier(n.Database) + relname := identifier(n.Table) + return &ast.RangeVar{ + Schemaname: &schemaname, + Relname: &relname, + } +} + +func isNotNull(n *chast.ColumnDeclaration) bool { + if n.Type == nil { + return false + } + // Check if type is wrapped in Nullable() + // If it's Nullable, it can be null, so return false + // If it's not Nullable, it's NOT NULL by default in ClickHouse + if n.Type.Name != "" && strings.ToLower(n.Type.Name) == "nullable" { + return false + } + // Also check if Nullable field is explicitly set + if n.Nullable != nil && *n.Nullable { + return false + } + return true +} diff --git a/internal/engine/dolphin/CLAUDE.md b/internal/engine/dolphin/CLAUDE.md new file mode 100644 index 0000000000..0a11012dab --- /dev/null +++ b/internal/engine/dolphin/CLAUDE.md @@ -0,0 +1,225 @@ +# Dolphin Engine (MySQL) - Claude Code Guide + +The dolphin engine handles MySQL parsing and AST conversion using the Marino parser +(a sqlc-maintained fork of the TiDB / pingcap parser). + +## Architecture + +### Parser Flow +``` +SQL String → Marino Parser → Marino AST → sqlc AST → Analysis/Codegen +``` + +### Key Files +- `convert.go` - Converts Marino AST nodes to sqlc AST nodes +- `format.go` - MySQL-specific formatting (identifiers, types, parameters) +- `parse.go` - Entry point for parsing MySQL SQL + +## Marino Parser + +The Marino parser (`github.com/sqlc-dev/marino`) is used for MySQL parsing. It is a +hard fork of `github.com/pingcap/tidb/pkg/parser` with a flatter package layout +(no `pkg/parser/...` prefix) and the former `test_driver` types merged into the +`ast` package as `ValueExprBase` / `ParamMarkerExprBase`. + +```go +import ( + pcast "github.com/sqlc-dev/marino/ast" + "github.com/sqlc-dev/marino/mysql" + "github.com/sqlc-dev/marino/types" +) +``` + +### Common Marino Types +- `pcast.SelectStmt`, `pcast.InsertStmt`, etc. - Statement types +- `pcast.ColumnNameExpr` - Column reference +- `pcast.FuncCallExpr` - Function call +- `pcast.BinaryOperationExpr` - Binary expression +- `pcast.VariableExpr` - MySQL user variable (@var) +- `pcast.Join` - JOIN clause with Left, Right, On, Using + +## Conversion Pattern + +Each TiDB node type has a corresponding converter method: + +```go +func (c *cc) convertSelectStmt(n *pcast.SelectStmt) *ast.SelectStmt { + return &ast.SelectStmt{ + FromClause: c.convertTableRefsClause(n.From), + WhereClause: c.convert(n.Where), + // ... + } +} +``` + +The main `convert()` method dispatches to specific converters: +```go +func (c *cc) convert(node pcast.Node) ast.Node { + switch n := node.(type) { + case *pcast.SelectStmt: + return c.convertSelectStmt(n) + case *pcast.InsertStmt: + return c.convertInsertStmt(n) + // ... + } +} +``` + +## Key Conversions + +### Column References +```go +func (c *cc) convertColumnNameExpr(n *pcast.ColumnNameExpr) *ast.ColumnRef { + var items []ast.Node + if schema := n.Name.Schema.String(); schema != "" { + items = append(items, NewIdentifier(schema)) + } + if table := n.Name.Table.String(); table != "" { + items = append(items, NewIdentifier(table)) + } + items = append(items, NewIdentifier(n.Name.Name.String())) + return &ast.ColumnRef{Fields: &ast.List{Items: items}} +} +``` + +### JOINs +```go +func (c *cc) convertJoin(n *pcast.Join) *ast.List { + if n.Right != nil && n.Left != nil { + return &ast.List{ + Items: []ast.Node{&ast.JoinExpr{ + Jointype: ast.JoinType(n.Tp), + Larg: c.convert(n.Left), + Rarg: c.convert(n.Right), + Quals: c.convert(n.On), + UsingClause: convertUsing(n.Using), + }}, + } + } + // No join - just return tables + // ... +} +``` + +### MySQL User Variables +MySQL user variables (`@var`) are different from sqlc's `@param` syntax: +```go +func (c *cc) convertVariableExpr(n *pcast.VariableExpr) ast.Node { + // Use VariableExpr to preserve as-is (NOT A_Expr which would be treated as sqlc param) + return &ast.VariableExpr{ + Name: n.Name, + Location: n.OriginTextPosition(), + } +} +``` + +### Type Casts (CAST AS) +```go +func (c *cc) convertFuncCastExpr(n *pcast.FuncCastExpr) ast.Node { + typeName := types.TypeStr(n.Tp.GetType()) + // Handle UNSIGNED/SIGNED specially + if typeName == "bigint" { + if mysql.HasUnsignedFlag(n.Tp.GetFlag()) { + typeName = "bigint unsigned" + } else { + typeName = "bigint signed" + } + } + return &ast.TypeCast{ + Arg: c.convert(n.Expr), + TypeName: &ast.TypeName{Name: typeName}, + } +} +``` + +### Column Definitions +```go +func convertColumnDef(def *pcast.ColumnDef) *ast.ColumnDef { + typeName := &ast.TypeName{Name: types.TypeToStr(def.Tp.GetType(), def.Tp.GetCharset())} + + // Only add Typmods for types where length is meaningful + tp := def.Tp.GetType() + flen := def.Tp.GetFlen() + switch tp { + case mysql.TypeVarchar, mysql.TypeString, mysql.TypeVarString: + if flen >= 0 { + typeName.Typmods = &ast.List{ + Items: []ast.Node{&ast.Integer{Ival: int64(flen)}}, + } + } + // Don't add for DATETIME, TIMESTAMP - internal flen is not user-specified + } + // ... +} +``` + +### Multi-Table DELETE +MySQL supports `DELETE t1, t2 FROM t1 JOIN t2 ...`: +```go +func (c *cc) convertDeleteStmt(n *pcast.DeleteStmt) *ast.DeleteStmt { + if n.IsMultiTable && n.Tables != nil { + // Convert targets (t1.*, t2.*) + targets := &ast.List{} + for _, table := range n.Tables.Tables { + // Build ColumnRef for each target + } + stmt.Targets = targets + + // Preserve JOINs in FromClause + stmt.FromClause = c.convertTableRefsClause(n.TableRefs).Items[0] + } else { + // Single-table DELETE + stmt.Relations = c.convertTableRefsClause(n.TableRefs) + } +} +``` + +## MySQL-Specific Formatting + +### format.go +```go +func (p *Parser) TypeName(ns, name string) string { + switch name { + case "bigint unsigned": + return "UNSIGNED" + case "bigint signed": + return "SIGNED" + } + return name +} + +func (p *Parser) Param(n int) string { + return "?" // MySQL uses ? for all parameters +} +``` + +## Common Issues and Solutions + +### Issue: Panic in Walk/Apply +**Cause**: New AST node type not handled in `astutils/walk.go` or `astutils/rewrite.go` +**Solution**: Add case for the node type in both files + +### Issue: MySQL @variable being treated as parameter +**Cause**: The preprocessor's dialect said `@name` is sqlc syntax +**Solution**: MySQL sets `AtSign: false` in `internal/sql/preprocess/dialect.go`, so +`@user_id` is left alone before the parser ever sees it + +### Issue: Type length appearing incorrectly (e.g., datetime(39)) +**Cause**: Using internal `flen` for all types +**Solution**: Only populate `Typmods` for types where length is user-specified (varchar, char, etc.) + +## Testing + +### TestFormat +Tests that SQL can be: +1. Parsed +2. Formatted back to SQL +3. Re-parsed +4. Re-formatted to match + +### TestReplay +Tests the full sqlc pipeline: +1. Parse schema and queries +2. Analyze +3. Generate code +4. Compare with expected output diff --git a/internal/engine/dolphin/convert.go b/internal/engine/dolphin/convert.go index 6d1f12fd0d..4a01a68de6 100644 --- a/internal/engine/dolphin/convert.go +++ b/internal/engine/dolphin/convert.go @@ -2,13 +2,14 @@ package dolphin import ( "log" + "strconv" "strings" - pcast "github.com/pingcap/tidb/parser/ast" - "github.com/pingcap/tidb/parser/mysql" - "github.com/pingcap/tidb/parser/opcode" - driver "github.com/pingcap/tidb/parser/test_driver" - "github.com/pingcap/tidb/parser/types" + pcast "github.com/sqlc-dev/marino/ast" + "github.com/sqlc-dev/marino/format" + "github.com/sqlc-dev/marino/mysql" + "github.com/sqlc-dev/marino/opcode" + "github.com/sqlc-dev/marino/types" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/sql/ast" @@ -16,6 +17,10 @@ import ( type cc struct { paramCount int + // preserveCase keeps identifiers exactly as written instead of + // lowercasing them for case-insensitive catalog matching; the format + // parser sets it (see NewFormatParser). + preserveCase bool } func todo(n pcast.Node) *ast.TODO { @@ -25,17 +30,24 @@ func todo(n pcast.Node) *ast.TODO { return &ast.TODO{} } -func identifier(id string) string { +// identifier normalizes an identifier for the compiler, which matches +// case-insensitively by lowercasing everything. The format parser preserves +// the author's case instead: reprinting `Event` as `event` renames the +// table wherever table names are case-sensitive. +func (c *cc) identifier(id string) string { + if c.preserveCase { + return id + } return strings.ToLower(id) } -func NewIdentifier(t string) *ast.String { - return &ast.String{Str: identifier(t)} +func (c *cc) NewIdentifier(t string) *ast.String { + return &ast.String{Str: c.identifier(t)} } func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { alt := &ast.AlterTableStmt{ - Table: parseTableName(n.Table), + Table: c.parseTableName(n.Table), Cmds: &ast.List{}, } for _, spec := range n.Specs { @@ -99,7 +111,7 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { oldName := spec.OldColumnName.String() newName := spec.NewColumnName.String() return &ast.RenameColumnStmt{ - Table: parseTableName(n.Table), + Table: c.parseTableName(n.Table), Col: &ast.ColumnRef{Name: oldName}, NewName: &newName, } @@ -107,8 +119,8 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { case pcast.AlterTableRenameTable: // TODO: Returning here may be incorrect if there are multiple specs return &ast.RenameTableStmt{ - Table: parseTableName(n.Table), - NewName: &parseTableName(spec.NewTable).Name, + Table: c.parseTableName(n.Table), + NewName: &c.parseTableName(spec.NewTable).Name, } default: @@ -122,11 +134,19 @@ func (c *cc) convertAlterTableStmt(n *pcast.AlterTableStmt) ast.Node { } func (c *cc) convertAssignment(n *pcast.Assignment) *ast.ResTarget { - name := identifier(n.Column.Name.String()) - return &ast.ResTarget{ + name := c.identifier(n.Column.Name.String()) + target := &ast.ResTarget{ Name: &name, Val: c.convert(n.Expr), } + // A multi-table UPDATE qualifies its SET columns (SET a.x = ..., b.x = + // ...); analysis matches on Name alone, but printing must keep the + // qualifier or both assignments collapse onto whichever table resolves. + if table := n.Column.Table.String(); table != "" { + table = c.identifier(table) + target.Relation = &table + } + return target } // TODO: These codes should be defined in the sql/lang package @@ -187,14 +207,21 @@ func opToName(o opcode.Op) string { func (c *cc) convertBinaryOperationExpr(n *pcast.BinaryOperationExpr) ast.Node { if n.Op == opcode.LogicAnd || n.Op == opcode.LogicOr { + var boolop ast.BoolExprType + if n.Op == opcode.LogicAnd { + boolop = ast.BoolExprTypeAnd + } else { + boolop = ast.BoolExprTypeOr + } return &ast.BoolExpr{ - // TODO: Set op + Boolop: boolop, Args: &ast.List{ Items: []ast.Node{ c.convert(n.L), c.convert(n.R), }, }, + Location: n.OriginTextPosition(), } } else { return &ast.A_Expr{ @@ -204,19 +231,20 @@ func (c *cc) convertBinaryOperationExpr(n *pcast.BinaryOperationExpr) ast.Node { &ast.String{Str: opToName(n.Op)}, }, }, - Lexpr: c.convert(n.L), - Rexpr: c.convert(n.R), + Lexpr: c.convert(n.L), + Rexpr: c.convert(n.R), + Location: n.OriginTextPosition(), } } } func (c *cc) convertCreateTableStmt(n *pcast.CreateTableStmt) ast.Node { create := &ast.CreateTableStmt{ - Name: parseTableName(n.Table), + Name: c.parseTableName(n.Table), IfNotExists: n.IfNotExists, } if n.ReferTable != nil { - create.ReferTable = parseTableName(n.ReferTable) + create.ReferTable = c.parseTableName(n.ReferTable) } for _, def := range n.Cols { create.Cols = append(create.Cols, convertColumnDef(def)) @@ -244,14 +272,74 @@ func convertColumnDef(def *pcast.ColumnDef) *ast.ColumnDef { for _, opt := range def.Options { switch opt.Tp { case pcast.ColumnOptionComment: - if value, ok := opt.Expr.(*driver.ValueExpr); ok { + if value, ok := opt.Expr.(*pcast.ValueExprBase); ok { comment = value.GetString() } } } + + // Build TypeName with modifiers for proper formatting + typeName := &ast.TypeName{Name: types.TypeToStr(def.Tp.GetType(), def.Tp.GetCharset())} + + // Add type modifiers (e.g., length for varchar(255), char(32)) + // Only for types where length is meaningful and user-specified + tp := def.Tp.GetType() + flen := def.Tp.GetFlen() + needsLength := false + switch tp { + case mysql.TypeVarchar, mysql.TypeString, mysql.TypeVarString: + // VARCHAR(n), CHAR(n) - always need length + needsLength = flen >= 0 + case mysql.TypeBlob, mysql.TypeTinyBlob, mysql.TypeMediumBlob, mysql.TypeLongBlob: + // BLOB types - only if user specified length (VARBINARY(n), BINARY(n)) + // Default blob types don't need length + needsLength = false + } + + if needsLength { + typeName.Typmods = &ast.List{ + Items: []ast.Node{ + &ast.Integer{Ival: int64(flen)}, + }, + } + } + + // DECIMAL(p,s) / NUMERIC(p,s) and FLOAT/DOUBLE with explicit precision: + // the parser leaves flen and decimal at -1 when the author wrote none, + // so their presence is the author's, and dropping them would change the + // column's type. + switch tp { + case mysql.TypeNewDecimal, mysql.TypeFloat, mysql.TypeDouble: + if flen >= 0 { + mods := []ast.Node{&ast.Integer{Ival: int64(flen)}} + if dec := def.Tp.GetDecimal(); dec > 0 { + mods = append(mods, &ast.Integer{Ival: int64(dec)}) + } + typeName.Typmods = &ast.List{Items: mods} + } + // MySQL drops an integer's display width except the one that means + // something: tinyint(1) is what drivers and codegen read as a boolean, + // and BOOLEAN itself is spelled that way. + case mysql.TypeTiny: + if flen == 1 { + typeName.Typmods = &ast.List{Items: []ast.Node{&ast.Integer{Ival: 1}}} + } + // A bit column's width is part of its type, and is 1 when left out. + case mysql.TypeBit: + if flen >= 0 { + typeName.Typmods = &ast.List{Items: []ast.Node{&ast.Integer{Ival: int64(flen)}}} + } + // A fractional-seconds precision is part of the type; zero is the + // default and is not written. + case mysql.TypeDatetime, mysql.TypeTimestamp, mysql.TypeDuration: + if fsp := def.Tp.GetDecimal(); fsp > 0 { + typeName.Typmods = &ast.List{Items: []ast.Node{&ast.Integer{Ival: int64(fsp)}}} + } + } + columnDef := ast.ColumnDef{ Colname: def.Name.String(), - TypeName: &ast.TypeName{Name: types.TypeToStr(def.Tp.GetType(), def.Tp.GetCharset())}, + TypeName: typeName, IsNotNull: isNotNull(def), IsUnsigned: isUnsigned(def), Comment: comment, @@ -268,12 +356,12 @@ func convertColumnDef(def *pcast.ColumnDef) *ast.ColumnDef { func (c *cc) convertColumnNameExpr(n *pcast.ColumnNameExpr) *ast.ColumnRef { var items []ast.Node if schema := n.Name.Schema.String(); schema != "" { - items = append(items, NewIdentifier(schema)) + items = append(items, c.NewIdentifier(schema)) } if table := n.Name.Table.String(); table != "" { - items = append(items, NewIdentifier(table)) + items = append(items, c.NewIdentifier(table)) } - items = append(items, NewIdentifier(n.Name.Name.String())) + items = append(items, c.NewIdentifier(n.Name.Name.String())) return &ast.ColumnRef{ Fields: &ast.List{ Items: items, @@ -285,38 +373,71 @@ func (c *cc) convertColumnNameExpr(n *pcast.ColumnNameExpr) *ast.ColumnRef { func (c *cc) convertColumnNames(cols []*pcast.ColumnName) *ast.List { list := &ast.List{Items: []ast.Node{}} for i := range cols { - name := identifier(cols[i].Name.String()) + name := c.identifier(cols[i].Name.String()) list.Items = append(list.Items, &ast.ResTarget{ - Name: &name, + Name: &name, + Location: cols[i].OriginTextPosition(), }) } return list } func (c *cc) convertDeleteStmt(n *pcast.DeleteStmt) *ast.DeleteStmt { - rels := c.convertTableRefsClause(n.TableRefs) - if len(rels.Items) != 1 { - panic("expected one range var") - } - relations := &ast.List{} - convertToRangeVarList(rels, relations) - stmt := &ast.DeleteStmt{ - Relations: relations, WhereClause: c.convert(n.Where), ReturningList: &ast.List{}, WithClause: c.convertWithClause(n.With), } + if n.Limit != nil { stmt.LimitCount = c.convert(n.Limit.Count) } + + // Handle multi-table DELETE (DELETE t1, t2 FROM t1 JOIN t2 ...) + if n.IsMultiTable && n.Tables != nil && len(n.Tables.Tables) > 0 { + // Convert delete targets (e.g., jt.*, pt.*) + targets := &ast.List{} + for _, table := range n.Tables.Tables { + // Each table in the delete list is a ColumnRef like "jt.*" or "pt.*" + items := []ast.Node{} + if table.Schema.String() != "" { + items = append(items, c.NewIdentifier(table.Schema.String())) + } + items = append(items, c.NewIdentifier(table.Name.String())) + items = append(items, &ast.A_Star{}) + targets.Items = append(targets.Items, &ast.ColumnRef{ + Fields: &ast.List{Items: items}, + }) + } + stmt.Targets = targets + + // Convert FROM clause preserving JOINs + if n.TableRefs != nil { + fromList := c.convertTableRefsClause(n.TableRefs) + if len(fromList.Items) == 1 { + stmt.FromClause = fromList.Items[0] + } else { + stmt.FromClause = fromList + } + } + } else { + // Single-table DELETE + rels := c.convertTableRefsClause(n.TableRefs) + if len(rels.Items) != 1 { + panic("expected one range var") + } + relations := &ast.List{} + convertToRangeVarList(rels, relations) + stmt.Relations = relations + } + return stmt } func (c *cc) convertDropTableStmt(n *pcast.DropTableStmt) ast.Node { drop := &ast.DropTableStmt{IfExists: n.IfExists} for _, name := range n.Tables { - drop.Tables = append(drop.Tables, parseTableName(name)) + drop.Tables = append(drop.Tables, c.parseTableName(name)) } return drop } @@ -325,17 +446,19 @@ func (c *cc) convertRenameTableStmt(n *pcast.RenameTableStmt) ast.Node { list := &ast.List{Items: []ast.Node{}} for _, table := range n.TableToTables { list.Items = append(list.Items, &ast.RenameTableStmt{ - Table: parseTableName(table.OldTable), - NewName: &parseTableName(table.NewTable).Name, + Table: c.parseTableName(table.OldTable), + NewName: &c.parseTableName(table.NewTable).Name, }) } return list } func (c *cc) convertExistsSubqueryExpr(n *pcast.ExistsSubqueryExpr) *ast.SubLink { - sublink := &ast.SubLink{} - if ss, ok := c.convert(n.Sel).(*ast.SelectStmt); ok { - sublink.Subselect = ss + sublink := &ast.SubLink{ + SubLinkType: ast.EXISTS_SUBLINK, + } + if n.Sel != nil { + sublink.Subselect = c.convert(n.Sel) } return sublink } @@ -350,14 +473,44 @@ func (c *cc) convertFieldList(n *pcast.FieldList) *ast.List { func (c *cc) convertFuncCallExpr(n *pcast.FuncCallExpr) ast.Node { schema := n.Schema.String() + // Dispatch below compares against lowercase names; the emitted name + // goes through identifier so the format parser keeps the author's case. name := strings.ToLower(n.FnName.String()) + emitted := c.identifier(n.FnName.String()) // TODO: Deprecate the usage of Funcname items := []ast.Node{} if schema != "" { - items = append(items, NewIdentifier(schema)) + items = append(items, c.NewIdentifier(schema)) + } + items = append(items, c.NewIdentifier(emitted)) + + // Handle DATE_ADD/DATE_SUB specially to construct INTERVAL expressions + // These functions have args: [date, interval_value, TimeUnitExpr] + if (name == "date_add" || name == "date_sub") && len(n.Args) == 3 { + if timeUnit, ok := n.Args[2].(*pcast.TimeUnitExpr); ok { + args := &ast.List{ + Items: []ast.Node{ + c.convert(n.Args[0]), + &ast.IntervalExpr{ + Value: c.convert(n.Args[1]), + Unit: timeUnit.Unit.String(), + }, + }, + } + return &ast.FuncCall{ + Args: args, + Func: &ast.FuncName{ + Schema: schema, + Name: emitted, + }, + Funcname: &ast.List{ + Items: items, + }, + Location: n.OriginTextPosition(), + } + } } - items = append(items, NewIdentifier(name)) args := &ast.List{} for _, arg := range n.Args { @@ -373,7 +526,7 @@ func (c *cc) convertFuncCallExpr(n *pcast.FuncCallExpr) ast.Node { Args: args, Func: &ast.FuncName{ Schema: schema, - Name: name, + Name: emitted, }, Funcname: &ast.List{ Items: items, @@ -415,7 +568,7 @@ func (c *cc) convertInsertStmt(n *pcast.InsertStmt) *ast.InsertStmt { for _, a := range n.OnDuplicate { targetList.Items = append(targetList.Items, c.convertAssignment(a)) } - insert.OnConflictClause = &ast.OnConflictClause{ + insert.OnDuplicateKeyUpdate = &ast.OnDuplicateKeyUpdate{ TargetList: targetList, Location: n.OriginTextPosition(), } @@ -436,7 +589,7 @@ func (c *cc) convertLists(lists [][]pcast.ExprNode) *ast.List { return list } -func (c *cc) convertParamMarkerExpr(n *driver.ParamMarkerExpr) *ast.ParamRef { +func (c *cc) convertParamMarkerExpr(n *pcast.ParamMarkerExprBase) *ast.ParamRef { // Parameter numbers start at one c.paramCount += 1 return &ast.ParamRef{ @@ -454,7 +607,7 @@ func (c *cc) convertSelectField(n *pcast.SelectField) *ast.ResTarget { } var name *string if n.AsName.O != "" { - asname := identifier(n.AsName.O) + asname := c.identifier(n.AsName.O) name = &asname } return &ast.ResTarget{ @@ -466,9 +619,28 @@ func (c *cc) convertSelectField(n *pcast.SelectField) *ast.ResTarget { } func (c *cc) convertSelectStmt(n *pcast.SelectStmt) *ast.SelectStmt { + // The ORDER BY expressions are recorded twice: bare in WindowClause, + // where the compiler's strict_order_by validation expects them, and + // wrapped in SortBy nodes in SortClause, which carries the sort + // direction and is what formatting prints. Both share the same + // converted nodes so parameter numbering stays intact. windowClause := &ast.List{Items: make([]ast.Node, 0)} - orderByClause := c.convertOrderByClause(n.OrderBy) - if orderByClause != nil { + var sortClause *ast.List + if n.OrderBy != nil { + sortClause = &ast.List{Items: make([]ast.Node, 0)} + orderByClause := &ast.List{Items: []ast.Node{}} + for _, item := range n.OrderBy.Items { + expr := c.convert(item.Expr) + orderByClause.Items = append(orderByClause.Items, expr) + dir := ast.SortByDirDefault + if item.Desc { + dir = ast.SortByDirDesc + } + sortClause.Items = append(sortClause.Items, &ast.SortBy{ + Node: expr, + SortbyDir: dir, + }) + } windowClause.Items = append(windowClause.Items, orderByClause) } @@ -481,9 +653,16 @@ func (c *cc) convertSelectStmt(n *pcast.SelectStmt) *ast.SelectStmt { WhereClause: c.convert(n.Where), WithClause: c.convertWithClause(n.With), WindowClause: windowClause, + SortClause: sortClause, Op: op, All: all, } + if n.Distinct { + // A plain DISTINCT, pg-style: a non-empty clause whose single TODO + // item means "no ON (...) expressions". + stmt.DistinctClause = &ast.List{Items: []ast.Node{&ast.TODO{}}} + } + stmt.TableHints = restoreTableHints(n.TableHints) if n.Limit != nil { stmt.LimitCount = c.convert(n.Limit.Count) stmt.LimitOffset = c.convert(n.Limit.Offset) @@ -491,8 +670,33 @@ func (c *cc) convertSelectStmt(n *pcast.SelectStmt) *ast.SelectStmt { return stmt } +// restoreTableHints renders a statement's optimizer hints back to the text +// inside their /*+ ... */ comment. The compiler has no use for hints, but +// dropping them from a query would change how the server runs it, so the +// statement carries them through to printing as text. +func restoreTableHints(hints []*pcast.TableOptimizerHint) string { + if len(hints) == 0 { + return "" + } + var sb strings.Builder + ctx := format.NewRestoreCtx(format.DefaultRestoreFlags, &sb) + for i, h := range hints { + if i != 0 { + sb.WriteString(" ") + } + if err := h.Restore(ctx); err != nil { + return "" + } + } + return sb.String() +} + func (c *cc) convertSubqueryExpr(n *pcast.SubqueryExpr) ast.Node { - return c.convert(n.Query) + // Wrap subquery in SubLink to ensure parentheses are added + return &ast.SubLink{ + SubLinkType: ast.EXPR_SUBLINK, + Subselect: c.convert(n.Query), + } } func (c *cc) convertTableRefsClause(n *pcast.TableRefsClause) *ast.List { @@ -511,12 +715,20 @@ func (c *cc) convertCommonTableExpression(n *pcast.CommonTableExpression) *ast.C columns := &ast.List{} for _, col := range n.ColNameList { - columns.Items = append(columns.Items, NewIdentifier(col.String())) + columns.Items = append(columns.Items, c.NewIdentifier(col.String())) + } + + // CTE Query is wrapped in SubqueryExpr by TiDB parser. + // We need to unwrap it to get the SelectStmt directly, + // otherwise it would be double-wrapped with parentheses. + var cteQuery ast.Node + if n.Query != nil { + cteQuery = c.convert(n.Query.Query) } return &ast.CommonTableExpr{ Ctename: &name, - Ctequery: c.convert(n.Query), + Ctequery: cteQuery, Ctecolnames: columns, } } @@ -558,6 +770,11 @@ func (c *cc) convertUpdateStmt(n *pcast.UpdateStmt) *ast.UpdateStmt { FromClause: &ast.List{}, ReturningList: &ast.List{}, WithClause: c.convertWithClause(n.With), + // The table-reference tree as written. Relations above flattens a + // multi-table UPDATE's join to bare tables for analysis, which + // would print `UPDATE a JOIN b ON ...` without its ON condition — + // an update of the whole cross product. + TableRefs: rels, } if n.Limit != nil { stmt.LimitCount = c.convert(n.Limit.Count) @@ -565,25 +782,25 @@ func (c *cc) convertUpdateStmt(n *pcast.UpdateStmt) *ast.UpdateStmt { return stmt } -func (c *cc) convertValueExpr(n *driver.ValueExpr) *ast.A_Const { - switch n.TexprNode.Type.GetType() { - case mysql.TypeBit: - case mysql.TypeDate: - case mysql.TypeDatetime: - case mysql.TypeGeometry: - case mysql.TypeJSON: - case mysql.TypeNull: - case mysql.TypeSet: - case mysql.TypeShort: - case mysql.TypeDuration: - case mysql.TypeTimestamp: - // TODO: Create an AST type for these? - - case mysql.TypeTiny, - mysql.TypeInt24, - mysql.TypeYear, - mysql.TypeLong, - mysql.TypeLonglong: +func (c *cc) convertValueExpr(n *pcast.ValueExprBase) *ast.A_Const { + // The datum's kind, not the field type, says what the literal is: a + // NULL arrives with a string field type, a decimal's value lives in + // its decimal — not float — slot, and TRUE is an int64 whose field + // type carries the boolean flag. + switch n.Datum.Kind() { + case pcast.KindNull: + return &ast.A_Const{ + Val: &ast.Null{}, + Location: n.OriginTextPosition(), + } + + case pcast.KindInt64: + if mysql.HasIsBooleanFlag(n.Type.GetFlag()) { + return &ast.A_Const{ + Val: &ast.Boolean{Boolval: n.Datum.GetInt64() > 0}, + Location: n.OriginTextPosition(), + } + } return &ast.A_Const{ Val: &ast.Integer{ Ival: n.Datum.GetInt64(), @@ -591,17 +808,31 @@ func (c *cc) convertValueExpr(n *driver.ValueExpr) *ast.A_Const { Location: n.OriginTextPosition(), } - case mysql.TypeDouble, - mysql.TypeFloat, - mysql.TypeNewDecimal: + case pcast.KindUint64: + return &ast.A_Const{ + Val: &ast.Integer{ + Ival: int64(n.Datum.GetUint64()), + }, + Location: n.OriginTextPosition(), + } + + case pcast.KindFloat32, pcast.KindFloat64: return &ast.A_Const{ Val: &ast.Float{ - // TODO: Extract the value from n.TexprNode + Str: strconv.FormatFloat(n.Datum.GetFloat64(), 'f', -1, 64), }, Location: n.OriginTextPosition(), } - case mysql.TypeBlob, mysql.TypeString, mysql.TypeVarchar, mysql.TypeVarString, mysql.TypeLongBlob, mysql.TypeMediumBlob, mysql.TypeTinyBlob, mysql.TypeEnum: + case pcast.KindMysqlDecimal: + // The decimal's own rendering keeps the written scale: 1.0 stays + // 1.0. + return &ast.A_Const{ + Val: &ast.Float{ + Str: n.Datum.GetMysqlDecimal().String(), + }, + Location: n.OriginTextPosition(), + } } return &ast.A_Const{ Val: &ast.String{ @@ -614,7 +845,7 @@ func (c *cc) convertValueExpr(n *driver.ValueExpr) *ast.A_Const { func (c *cc) convertWildCardField(n *pcast.WildCardField) *ast.ColumnRef { items := []ast.Node{} if t := n.Table.String(); t != "" { - items = append(items, NewIdentifier(t)) + items = append(items, c.NewIdentifier(t)) } items = append(items, &ast.A_Star{}) @@ -630,21 +861,38 @@ func (c *cc) convertAdminStmt(n *pcast.AdminStmt) ast.Node { } func (c *cc) convertAggregateFuncExpr(n *pcast.AggregateFuncExpr) *ast.FuncCall { + // Comparisons below use the lowercase name; the emitted name keeps the + // author's case under the format parser. name := strings.ToLower(n.F) + emitted := c.identifier(n.F) fn := &ast.FuncCall{ Func: &ast.FuncName{ - Name: name, + Name: emitted, }, Funcname: &ast.List{ Items: []ast.Node{ - NewIdentifier(name), + c.NewIdentifier(emitted), }, }, Args: &ast.List{}, AggOrder: &ast.List{}, } - for _, a := range n.Args { - if value, ok := a.(*driver.ValueExpr); ok { + + // GROUP_CONCAT has special handling: + // TiDB always adds the separator as the last argument + // We need to extract it and use SEPARATOR syntax + args := n.Args + var separator string + if name == "group_concat" && len(args) >= 2 { + // The last arg is always the separator + if value, ok := args[len(args)-1].(*pcast.ValueExprBase); ok { + separator = value.GetString() + args = args[:len(args)-1] + } + } + + for _, a := range args { + if value, ok := a.(*pcast.ValueExprBase); ok { if value.GetInt64() == int64(1) { fn.AggStar = true continue @@ -655,6 +903,17 @@ func (c *cc) convertAggregateFuncExpr(n *pcast.AggregateFuncExpr) *ast.FuncCall if n.Distinct { fn.AggDistinct = true } + // GROUP_CONCAT(x ORDER BY y): the ordering decides the string that + // comes back, so it must survive into the printed call. + if n.Order != nil { + fn.AggOrder = c.convertOrderByItems(n.Order.Items) + } + + // Store separator for GROUP_CONCAT (only if non-default) + if name == "group_concat" && separator != "" && separator != "," { + fn.Separator = &separator + } + return fn } @@ -727,10 +986,6 @@ func (c *cc) convertCaseExpr(n *pcast.CaseExpr) ast.Node { } } -func (c *cc) convertChangeStmt(n *pcast.ChangeStmt) ast.Node { - return todo(n) -} - func (c *cc) convertCleanupTableLockStmt(n *pcast.CleanupTableLockStmt) ast.Node { return todo(n) } @@ -821,7 +1076,7 @@ func (c *cc) convertDropDatabaseStmt(n *pcast.DropDatabaseStmt) ast.Node { return &ast.DropSchemaStmt{ MissingOk: !n.IfExists, Schemas: []*ast.String{ - NewIdentifier(n.Name.O), + c.NewIdentifier(n.Name.O), }, } } @@ -875,9 +1130,62 @@ func (c *cc) convertFrameClause(n *pcast.FrameClause) ast.Node { } func (c *cc) convertFuncCastExpr(n *pcast.FuncCastExpr) ast.Node { + tp := n.Tp.GetType() + typeName := types.TypeToStr(tp, n.Tp.GetCharset()) + + // MySQL CAST AS UNSIGNED/SIGNED uses bigint internally. + // We need to preserve the signed/unsigned info for formatting. + if typeName == "bigint" { + if mysql.HasUnsignedFlag(n.Tp.GetFlag()) { + typeName = "bigint unsigned" + } else { + typeName = "bigint signed" + } + } + // CAST(x AS CHAR) and CAST(x AS BINARY) are typed by the parser as the + // wire's var_string, which is no SQL type, or as a char or binary. + // MySQL types the result as a varchar or a varbinary — its metadata + // and a view over it both say so. + switch typeName { + case "var_string", "char": + typeName = "varchar" + if n.Tp.GetCharset() == "binary" { + typeName = "varbinary" + } + case "binary": + typeName = "varbinary" + } + + out := &ast.TypeName{Name: typeName} + flen, dec := n.Tp.GetFlen(), n.Tp.GetDecimal() + switch tp { + case mysql.TypeNewDecimal: + // A decimal's precision and scale are part of its type, and a + // scale left out is 0: CAST(x AS DECIMAL(5)) is a decimal(5,0). + if flen >= 0 && flen != types.UnspecifiedLength { + mods := []ast.Node{&ast.Integer{Ival: int64(flen)}} + if dec >= 0 && dec != types.UnspecifiedLength { + mods = append(mods, &ast.Integer{Ival: int64(dec)}) + } + out.Typmods = &ast.List{Items: mods} + } + case mysql.TypeFloat, mysql.TypeDouble: + // The parser fills in a display width for a float or double, and + // a precision written as FLOAT(p) only picks between the two; the + // result is a plain float or double. + case mysql.TypeVarchar, mysql.TypeVarString, mysql.TypeString: + if flen > 0 && flen != types.UnspecifiedLength { + out.Typmods = &ast.List{Items: []ast.Node{&ast.Integer{Ival: int64(flen)}}} + } + case mysql.TypeDatetime, mysql.TypeTimestamp, mysql.TypeDuration: + if dec > 0 && dec != types.UnspecifiedLength { + out.Typmods = &ast.List{Items: []ast.Node{&ast.Integer{Ival: int64(dec)}}} + } + } + return &ast.TypeCast{ Arg: c.convert(n.Expr), - TypeName: &ast.TypeName{Name: types.TypeStr(n.Tp.GetType())}, + TypeName: out, } } @@ -915,10 +1223,6 @@ func (c *cc) convertHavingClause(n *pcast.HavingClause) ast.Node { return c.convert(n.Expr) } -func (c *cc) convertIndexAdviseStmt(n *pcast.IndexAdviseStmt) ast.Node { - return todo(n) -} - func (c *cc) convertIndexLockAndAlgorithm(n *pcast.IndexLockAndAlgorithm) ast.Node { return todo(n) } @@ -939,6 +1243,7 @@ func (c *cc) convertIsNullExpr(n *pcast.IsNullExpr) ast.Node { c.convert(n.Expr), }, }, + Location: n.OriginTextPosition(), } } @@ -957,12 +1262,24 @@ func (c *cc) convertJoin(n *pcast.Join) *ast.List { joinType++ } + // Convert USING clause + var usingClause *ast.List + if len(n.Using) > 0 { + items := make([]ast.Node, len(n.Using)) + for i, col := range n.Using { + items[i] = &ast.String{Str: col.Name.O} + } + usingClause = &ast.List{Items: items} + } + return &ast.List{ Items: []ast.Node{&ast.JoinExpr{ - Jointype: joinType, - Larg: c.convert(n.Left), - Rarg: c.convert(n.Right), - Quals: c.convert(n.On), + Jointype: joinType, + IsNatural: n.NaturalJoin, + Larg: c.convert(n.Left), + Rarg: c.convert(n.Right), + UsingClause: usingClause, + Quals: c.convert(n.On), }}, } } @@ -997,7 +1314,30 @@ func (c *cc) convertLockTablesStmt(n *pcast.LockTablesStmt) ast.Node { } func (c *cc) convertMatchAgainst(n *pcast.MatchAgainst) ast.Node { - return todo(n) + searchTerm := c.convert(n.Against) + + stringSearchTerm := &ast.TypeCast{ + Arg: searchTerm, + TypeName: &ast.TypeName{ + Name: "text", // Use 'text' type which maps to string in Go + }, + Location: n.OriginTextPosition(), + } + + matchOperation := &ast.A_Const{ + Val: &ast.String{Str: "MATCH_AGAINST"}, + } + + return &ast.A_Expr{ + Name: &ast.List{ + Items: []ast.Node{ + &ast.String{Str: "AGAINST"}, + }, + }, + Lexpr: matchOperation, + Rexpr: stringSearchTerm, + Location: n.OriginTextPosition(), + } } func (c *cc) convertMaxValueExpr(n *pcast.MaxValueExpr) ast.Node { @@ -1025,18 +1365,7 @@ func (c *cc) convertOrderByClause(n *pcast.OrderByClause) ast.Node { } list := &ast.List{Items: []ast.Node{}} for _, item := range n.Items { - switch item.Expr.(type) { - case *pcast.CaseExpr: - list.Items = append(list.Items, &ast.CaseWhen{ - Expr: c.convert(item.Expr), - Location: item.Expr.OriginTextPosition(), - }) - case *pcast.ColumnNameExpr: - list.Items = append(list.Items, &ast.CaseExpr{ - Xpr: c.convert(item.Expr), - Location: item.Expr.OriginTextPosition(), - }) - } + list.Items = append(list.Items, c.convert(item.Expr)) } return list } @@ -1045,7 +1374,16 @@ func (c *cc) convertParenthesesExpr(n *pcast.ParenthesesExpr) ast.Node { if n == nil { return nil } - return c.convert(n.Expr) + inner := c.convert(n.Expr) + // Only wrap in ParenExpr for SELECT statements (needed for UNION with parenthesized subqueries) + // For other expressions, the BoolExpr already adds parentheses + if _, ok := inner.(*ast.SelectStmt); ok { + return &ast.ParenExpr{ + Expr: inner, + Location: n.OriginTextPosition(), + } + } + return inner } func (c *cc) convertPartitionByClause(n *pcast.PartitionByClause) ast.Node { @@ -1079,11 +1417,20 @@ func (c *cc) convertPatternInExpr(n *pcast.PatternInExpr) ast.Node { } func (c *cc) convertPatternLikeExpr(n *pcast.PatternLikeOrIlikeExpr) ast.Node { + kind := ast.A_Expr_Kind_ILIKE + op := "~~*" + if n.IsLike { + kind = ast.A_Expr_Kind_LIKE + op = "~~" + } + if n.Not { + op = "!" + op + } return &ast.A_Expr{ - Kind: ast.A_Expr_Kind(9), + Kind: kind, Name: &ast.List{ Items: []ast.Node{ - &ast.String{Str: "~~"}, + &ast.String{Str: op}, }, }, Lexpr: c.convert(n.Expr), @@ -1096,7 +1443,7 @@ func (c *cc) convertPatternRegexpExpr(n *pcast.PatternRegexpExpr) ast.Node { } func (c *cc) convertPositionExpr(n *pcast.PositionExpr) ast.Node { - return todo(n) + return &ast.Integer{Ival: int64(n.N)} } func (c *cc) convertPrepareStmt(n *pcast.PrepareStmt) ast.Node { @@ -1197,7 +1544,33 @@ func (c *cc) convertSetOprType(n *pcast.SetOprType) (op ast.SetOperation, all bo func (c *cc) convertSetOprSelectList(n *pcast.SetOprSelectList) ast.Node { selectStmts := make([]*ast.SelectStmt, len(n.Selects)) for i, node := range n.Selects { - selectStmts[i] = c.convertSelectStmt(node.(*pcast.SelectStmt)) + switch node := node.(type) { + case *pcast.SelectStmt: + selectStmts[i] = c.convertSelectStmt(node) + case *pcast.SetOprSelectList: + // If this is a single-select SetOprSelectList (e.g., from parenthesized SELECT), + // extract the inner select instead of building a UNION tree + if len(node.Selects) == 1 { + if innerSelect, ok := node.Selects[0].(*pcast.SelectStmt); ok { + selectStmts[i] = c.convertSelectStmt(innerSelect) + } else { + selectStmts[i] = c.convertSetOprSelectList(node).(*ast.SelectStmt) + } + } else { + selectStmts[i] = c.convertSetOprSelectList(node).(*ast.SelectStmt) + } + default: + // Handle other node types like ParenthesesExpr wrapping a SELECT + converted := c.convert(node) + if ss, ok := converted.(*ast.SelectStmt); ok { + selectStmts[i] = ss + } else if pe, ok := converted.(*ast.ParenExpr); ok { + // Unwrap ParenExpr to get the inner SelectStmt + if inner, ok := pe.Expr.(*ast.SelectStmt); ok { + selectStmts[i] = inner + } + } + } } op, all := c.convertSetOprType(n.AfterSetOperator) @@ -1241,15 +1614,40 @@ func (c *cc) convertSetOprSelectList(n *pcast.SetOprSelectList) ast.Node { func (c *cc) convertSetOprStmt(n *pcast.SetOprStmt) ast.Node { if n.SelectList != nil { sn := c.convertSetOprSelectList(n.SelectList) - if ss, ok := sn.(*ast.SelectStmt); ok && n.Limit != nil { - ss.LimitOffset = c.convert(n.Limit.Offset) - ss.LimitCount = c.convert(n.Limit.Count) + if ss, ok := sn.(*ast.SelectStmt); ok { + if n.Limit != nil { + ss.LimitOffset = c.convert(n.Limit.Offset) + ss.LimitCount = c.convert(n.Limit.Count) + } + // The ORDER BY that applies to the whole compound statement + // (SELECT ... UNION SELECT ... ORDER BY x) lives on the set + // operation, not on either branch. + if n.OrderBy != nil { + ss.SortClause = c.convertOrderByItems(n.OrderBy.Items) + } } return sn } return todo(n) } +// convertOrderByItems converts ORDER BY items into the SortBy list a +// SelectStmt's SortClause carries. +func (c *cc) convertOrderByItems(items []*pcast.ByItem) *ast.List { + list := &ast.List{Items: make([]ast.Node, 0, len(items))} + for _, item := range items { + dir := ast.SortByDirDefault + if item.Desc { + dir = ast.SortByDirDesc + } + list.Items = append(list.Items, &ast.SortBy{ + Node: c.convert(item.Expr), + SortbyDir: dir, + }) + } + return list +} + func (c *cc) convertSetPwdStmt(n *pcast.SetPwdStmt) ast.Node { return todo(n) } @@ -1300,11 +1698,12 @@ func (c *cc) convertSplitRegionStmt(n *pcast.SplitRegionStmt) ast.Node { } func (c *cc) convertTableName(n *pcast.TableName) *ast.RangeVar { - schema := identifier(n.Schema.String()) - rel := identifier(n.Name.String()) + schema := c.identifier(n.Schema.String()) + rel := c.identifier(n.Name.String()) return &ast.RangeVar{ Schemaname: &schema, Relname: &rel, + Location: n.OriginTextPosition(), } } @@ -1362,7 +1761,7 @@ func (c *cc) convertTrimDirectionExpr(n *pcast.TrimDirectionExpr) ast.Node { func (c *cc) convertTruncateTableStmt(n *pcast.TruncateTableStmt) *ast.TruncateStmt { return &ast.TruncateStmt{ - Relations: toList(n.Table), + Relations: c.toList(n.Table), } } @@ -1387,7 +1786,12 @@ func (c *cc) convertVariableAssignment(n *pcast.VariableAssignment) ast.Node { } func (c *cc) convertVariableExpr(n *pcast.VariableExpr) ast.Node { - return todo(n) + // MySQL @variable references are user-defined variables, NOT sqlc named parameters. + // Use VariableExpr to preserve them as-is in the output. + return &ast.VariableExpr{ + Name: n.Name, + Location: n.OriginTextPosition(), + } } func (c *cc) convertWhenClause(n *pcast.WhenClause) ast.Node { @@ -1413,7 +1817,7 @@ func (c *cc) convertCallStmt(n *pcast.CallStmt) ast.Node { var funcname ast.List for _, s := range []string{n.Procedure.Schema.L, n.Procedure.FnName.L} { if s != "" { - funcname.Items = append(funcname.Items, NewIdentifier(s)) + funcname.Items = append(funcname.Items, c.NewIdentifier(s)) } } var args ast.List @@ -1454,10 +1858,10 @@ func (c *cc) convertProcedureInfo(n *pcast.ProcedureInfo) ast.Node { func (c *cc) convert(node pcast.Node) ast.Node { switch n := node.(type) { - case *driver.ParamMarkerExpr: + case *pcast.ParamMarkerExprBase: return c.convertParamMarkerExpr(n) - case *driver.ValueExpr: + case *pcast.ValueExprBase: return c.convertValueExpr(n) case *pcast.AdminStmt: @@ -1511,9 +1915,6 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.CaseExpr: return c.convertCaseExpr(n) - case *pcast.ChangeStmt: - return c.convertChangeStmt(n) - case *pcast.CleanupTableLockStmt: return c.convertCleanupTableLockStmt(n) @@ -1649,9 +2050,6 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.HavingClause: return c.convertHavingClause(n) - case *pcast.IndexAdviseStmt: - return c.convertIndexAdviseStmt(n) - case *pcast.IndexLockAndAlgorithm: return c.convertIndexLockAndAlgorithm(n) diff --git a/internal/engine/dolphin/dialect/dialect.json b/internal/engine/dolphin/dialect/dialect.json new file mode 100644 index 0000000000..ce503b4960 --- /dev/null +++ b/internal/engine/dolphin/dialect/dialect.json @@ -0,0 +1,50 @@ +{ + "dialect": "mysql", + "const": { + "integer": "int", + "float": "decimal", + "string": "text", + "bool": "bool" + }, + "bool": "bool", + "comparison": ["=", "<>", "!=", "<", "<=", ">", ">=", "<=>"], + "comparison_categories": "BNSDU", + "arithmetic": ["+", "-", "*", "/", "%", "DIV"], + "arithmetic_categories": "N", + "cast_categories": "NSD", + "rewrites": [ + { + "from": "boolean", + "to": "tinyint(1)" + }, + { + "from": "bool", + "to": "tinyint(1)" + }, + { + "from": "decimal", + "to": "decimal(10, 0)" + }, + { + "from": "decimal($1)", + "to": "decimal($1, 0)" + }, + { + "from": "decimal unsigned", + "to": "decimal unsigned(10, 0)" + }, + { + "from": "decimal unsigned($1)", + "to": "decimal unsigned($1, 0)" + }, + { + "from": "float($1)", + "to": "float", + "where": "$1 <= 24" + }, + { + "from": "float($1)", + "to": "double" + } + ] +} diff --git a/internal/engine/dolphin/dialect/functions.jsonl b/internal/engine/dolphin/dialect/functions.jsonl new file mode 100644 index 0000000000..91fe412f13 --- /dev/null +++ b/internal/engine/dolphin/dialect/functions.jsonl @@ -0,0 +1,520 @@ +{"name":"ABS","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"ABS","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"ABS","args":[{"type":"mediumint"}],"returns":"mediumint"} +{"name":"ABS","args":[{"type":"int"}],"returns":"int"} +{"name":"ABS","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"ABS","args":[{"type":"double"}],"returns":"double"} +{"name":"ABS","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ACOS","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ADDDATE","args":[{"type":"date"},{"type":"int"}],"returns":"date"} +{"name":"ADDTIME","args":[{"type":"time"},{"type":"time"}],"returns":"time"} +{"name":"AES_DECRYPT","args":[{"type":"binary"},{"type":"text"}],"returns":"text"} +{"name":"AES_DECRYPT","args":[{"type":"binary"},{"type":"text"},{"type":"binary"}],"returns":"text"} +{"name":"AES_ENCRYPT","args":[{"type":"text"},{"type":"text"}],"returns":"binary"} +{"name":"AES_ENCRYPT","args":[{"type":"text"},{"type":"text"},{"type":"binary"}],"returns":"binary"} +{"name":"ANY_VALUE","args":[{"type":"any"}],"returns":"any"} +{"name":"ASCII","args":[{"type":"text"}],"returns":"int"} +{"name":"ASIN","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ATAN","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ATAN2","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"AVG","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"BENCHMARK","args":[{"type":"int"},{"type":"any"}],"returns":"int"} +{"name":"BIN","args":[{"type":"int"}],"returns":"text"} +{"name":"BIN_TO_UUID","args":[{"type":"binary"}],"returns":"text"} +{"name":"BIN_TO_UUID","args":[{"type":"binary"},{"type":"tinyint"}],"returns":"text"} +{"name":"BIT_AND","args":[{"type":"any"}],"returns":"any"} +{"name":"BIT_COUNT","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"BIT_LENGTH","args":[{"type":"text"}],"returns":"int"} +{"name":"BIT_OR","args":[{"type":"any"}],"returns":"any"} +{"name":"BIT_XOR","args":[{"type":"any"}],"returns":"any"} +{"name":"CAST","args":[{"type":"any"}],"returns":"any"} +{"name":"CEIL","args":[{"type":"int"}],"returns":"int"} +{"name":"CEIL","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"CEILING","args":[{"type":"int"}],"returns":"int"} +{"name":"CEILING","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"CHAR","args":[{"type":"int"},{"type":"int","mode":"v"}],"returns":"text"} +{"name":"CHARACTER_LENGTH","args":[{"type":"text"}],"returns":"int"} +{"name":"CHARSET","args":[{"type":"text"}],"returns":"text"} +{"name":"CHAR_LENGTH","args":[{"type":"text"}],"returns":"int"} +{"name":"COERCIBILITY","args":[{"type":"text"}],"returns":"int"} +{"name":"COLLATION","args":[{"type":"text"}],"returns":"text"} +{"name":"COMPRESS","args":[{"type":"text"}],"returns":"binary"} +{"name":"CONCAT","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"CONCAT_WS","args":[{"type":"text"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"CONNECTION_ID","returns":"int"} +{"name":"CONV","args":[{"type":"int"},{"type":"int"},{"type":"int"}],"returns":"text"} +{"name":"CONVERT","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"CONVERT_TZ","args":[{"type":"datetime"},{"type":"text"},{"type":"text"}],"returns":"datetime"} +{"name":"COS","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"COT","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"COUNT","returns":"bigint"} +{"name":"COUNT","args":[{"type":"any"}],"returns":"bigint"} +{"name":"CRC32","args":[{"type":"text"}],"returns":"int"} +{"name":"CUME_DIST","returns":"double precision"} +{"name":"CURDATE","returns":"date"} +{"name":"CURRENT_DATE","returns":"date"} +{"name":"CURRENT_ROLE","returns":"text"} +{"name":"CURRENT_TIME","returns":"time"} +{"name":"CURRENT_TIME","args":[{"type":"int"}],"returns":"time"} +{"name":"CURRENT_TIMESTAMP","returns":"datetime"} +{"name":"CURRENT_TIMESTAMP","args":[{"type":"int"}],"returns":"datetime"} +{"name":"CURRENT_USER","returns":"text"} +{"name":"CURTIME","returns":"time"} +{"name":"CURTIME","args":[{"type":"int"}],"returns":"time"} +{"name":"DATABASE","returns":"text"} +{"name":"DATE","args":[{"type":"datetime"}],"returns":"date"} +{"name":"DATEDIFF","args":[{"type":"datetime"},{"type":"datetime"}],"returns":"int"} +{"name":"DATE_ADD","args":[{"type":"date"},{"type":"any"},{"type":"any"}],"returns":"date"} +{"name":"DATE_ADD","args":[{"type":"date"},{"type":"interval"}],"returns":"date"} +{"name":"DATE_ADD_INTERVAL","args":[{"type":"date"},{"type":"any"}],"returns":"date"} +{"name":"DATE_FORMAT","args":[{"type":"date"},{"type":"text"}],"returns":"text"} +{"name":"DATE_SUB","args":[{"type":"date"},{"type":"any"},{"type":"any"}],"returns":"date"} +{"name":"DATE_SUB","args":[{"type":"date"},{"type":"interval"}],"returns":"date"} +{"name":"DATE_SUB_INTERVAL","args":[{"type":"date"},{"type":"any"}],"returns":"date"} +{"name":"DAY","args":[{"type":"date"}],"returns":"int"} +{"name":"DAYNAME","args":[{"type":"date"}],"returns":"text"} +{"name":"DAYOFMONTH","args":[{"type":"date"}],"returns":"int"} +{"name":"DAYOFWEEK","args":[{"type":"date"}],"returns":"int"} +{"name":"DAYOFYEAR","args":[{"type":"date"}],"returns":"int"} +{"name":"DEFAULT","args":[{"type":"any"}],"returns":"any"} +{"name":"DEGREES","args":[{"type":"double precision"}],"returns":"int"} +{"name":"DENSE_RANK","returns":"int"} +{"name":"DISTINCT","args":[{"type":"any"}],"returns":"any"} +{"name":"ELT","args":[{"type":"int"},{"type":"text","mode":"v"}],"returns":"text"} +{"name":"EXP","args":[{"type":"int"}],"returns":"double precision"} +{"name":"EXPORT_SET","args":[{"type":"int"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"EXPORT_SET","args":[{"type":"int"},{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"EXPORT_SET","args":[{"type":"int"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"int"}],"returns":"text"} +{"name":"EXTRACT","args":[{"type":"date"},{"type":"any"}],"returns":"int"} +{"name":"EXTRACTVALUE","args":[{"type":"text"},{"type":"text"}],"returns":"any"} +{"name":"FIELD","args":[{"type":"text"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"text"} +{"name":"FIND_IN_SET","args":[{"type":"text"},{"type":"text"}],"returns":"int"} +{"name":"FIRST_VALUE","args":[{"type":"any"}],"returns":"any"} +{"name":"FLOOR","args":[{"type":"double precision"}],"returns":"int"} +{"name":"FORMAT","args":[{"type":"int"},{"type":"int"}],"returns":"text"} +{"name":"FORMAT_BYTES","args":[{"type":"int"}],"returns":"text"} +{"name":"FORMAT_PICO_TIME","args":[{"type":"time"}],"returns":"text"} +{"name":"FOUND_ROWS","returns":"int"} +{"name":"FROM_BASE64","args":[{"type":"text"}],"returns":"text"} +{"name":"FROM_DAYS","args":[{"type":"int"}],"returns":"date"} +{"name":"FROM_UNIXTIME","args":[{"type":"bigint"}],"returns":"text"} +{"name":"FROM_UNIXTIME","args":[{"type":"bigint"},{"type":"text"}],"returns":"text"} +{"name":"GEOMCOLLECTION","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"GEOMETRYCOLLECTION","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"GET_FORMAT","args":[{"type":"any"},{"type":"text"}],"returns":"text"} +{"name":"GET_LOCK","args":[{"type":"text"},{"type":"int"}],"returns":"bool"} +{"name":"GREATEST","args":[{"type":"any"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"GROUPING","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"GROUP_CONCAT","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"text","nullable":true} +{"name":"GTID_SUBSET","args":[{"type":"text"},{"type":"text"}],"returns":"bool"} +{"name":"GTID_SUBTRACT","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"HEX","args":[{"type":"int"}],"returns":"text"} +{"name":"HEX","args":[{"type":"text"}],"returns":"int"} +{"name":"HOUR","args":[{"type":"time"}],"returns":"int"} +{"name":"ICU_VERSION","returns":"text"} +{"name":"IF","args":[{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"IFNULL","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"INET6_ATON","args":[{"type":"text"}],"returns":"binary"} +{"name":"INET6_NTOA","args":[{"type":"binary"}],"returns":"text"} +{"name":"INET_ATON","args":[{"type":"text"}],"returns":"int"} +{"name":"INET_NTOA","args":[{"type":"int"}],"returns":"text"} +{"name":"INSERT","args":[{"type":"text"},{"type":"int"},{"type":"int"},{"type":"text"}],"returns":"text"} +{"name":"INSTR","args":[{"type":"text"},{"type":"text"}],"returns":"int"} +{"name":"INTERVAL","args":[{"type":"any"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"ISNULL","args":[{"type":"any"}],"returns":"bool"} +{"name":"IS_FREE_LOCK","args":[{"type":"text"}],"returns":"bool"} +{"name":"IS_IPV4","args":[{"type":"text"}],"returns":"bool"} +{"name":"IS_IPV4_COMPAT","args":[{"type":"binary"}],"returns":"bool"} +{"name":"IS_IPV4_MAPPED","args":[{"type":"binary"}],"returns":"bool"} +{"name":"IS_IPV6","args":[{"type":"text"}],"returns":"bool"} +{"name":"IS_USED_LOCK","args":[{"type":"text"}],"returns":"bool"} +{"name":"IS_UUID","args":[{"type":"text"}],"returns":"bool"} +{"name":"JSON_ARRAY","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"JSON_ARRAYAGG","args":[{"type":"any"}],"returns":"json","nullable":true} +{"name":"JSON_ARRAY_APPEND","args":[{"type":"text"},{"type":"text"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"json"} +{"name":"JSON_ARRAY_INSERT","args":[{"type":"text"},{"type":"text"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"json"} +{"name":"JSON_CONTAINS","args":[{"type":"text"},{"type":"text"}],"returns":"bool"} +{"name":"JSON_CONTAINS","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"bool"} +{"name":"JSON_CONTAINS_PATH","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"bool"} +{"name":"JSON_DEPTH","args":[{"type":"text"}],"returns":"int"} +{"name":"JSON_EXTRACT","args":[{"type":"text"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"any"} +{"name":"JSON_INSERT","args":[{"type":"text"},{"type":"text"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"json"} +{"name":"JSON_KEYS","args":[{"type":"text"}],"returns":"json"} +{"name":"JSON_KEYS","args":[{"type":"text"},{"type":"text"}],"returns":"json"} +{"name":"JSON_LENGTH","args":[{"type":"text"}],"returns":"int"} +{"name":"JSON_LENGTH","args":[{"type":"text"},{"type":"text"}],"returns":"int"} +{"name":"JSON_MERGE","args":[{"type":"text"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"json"} +{"name":"JSON_MERGE_PATCH","args":[{"type":"text"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"json"} +{"name":"JSON_MERGE_PRESERVE","args":[{"type":"text"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"json"} +{"name":"JSON_OBJECT","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"JSON_OBJECTAGG","args":[{"type":"any"},{"type":"any"}],"returns":"json","nullable":true} +{"name":"JSON_OVERLAPS","args":[{"type":"text"},{"type":"text"}],"returns":"bool"} +{"name":"JSON_PRETTY","args":[{"type":"text"}],"returns":"any"} +{"name":"JSON_QUOTE","args":[{"type":"text"}],"returns":"text"} +{"name":"JSON_REMOVE","args":[{"type":"text"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"json"} +{"name":"JSON_REPLACE","args":[{"type":"text"},{"type":"text"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"json"} +{"name":"JSON_SCHEMA_VALID","args":[{"type":"text"},{"type":"text"}],"returns":"bool"} +{"name":"JSON_SCHEMA_VALIDATION_REPORT","args":[{"type":"text"},{"type":"text"}],"returns":"json"} +{"name":"JSON_SEARCH","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"any"} +{"name":"JSON_SEARCH","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"any"} +{"name":"JSON_SET","args":[{"type":"text"},{"type":"text"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"json"} +{"name":"JSON_STORAGE_FREE","args":[{"type":"text"}],"returns":"int"} +{"name":"JSON_STORAGE_SIZE","args":[{"type":"text"}],"returns":"int"} +{"name":"JSON_TYPE","args":[{"type":"text"}],"returns":"any"} +{"name":"JSON_UNQUOTE","args":[{"type":"text"}],"returns":"json"} +{"name":"JSON_VALID","args":[{"type":"text"}],"returns":"bool"} +{"name":"JSON_VALUE","args":[{"type":"text"},{"type":"text"}],"returns":"any"} +{"name":"LAG","args":[{"type":"any"},{"type":"int","has_default":true},{"type":"any","has_default":true}],"returns":"any"} +{"name":"LAST_DAY","args":[{"type":"date"}],"returns":"date"} +{"name":"LAST_INSERT_ID","returns":"bigint"} +{"name":"LAST_INSERT_ID","args":[{"type":"any"}],"returns":"bigint"} +{"name":"LAST_VALUE","args":[{"type":"any"}],"returns":"any"} +{"name":"LCASE","args":[{"type":"text"}],"returns":"text"} +{"name":"LEAD","args":[{"type":"any"},{"type":"int","has_default":true},{"type":"any","has_default":true}],"returns":"any"} +{"name":"LEAST","args":[{"type":"any"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"LEFT","args":[{"type":"text"},{"type":"int"}],"returns":"text"} +{"name":"LENGTH","args":[{"type":"text"}],"returns":"int"} +{"name":"LINESTRING","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"LN","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"LOAD_FILE","args":[{"type":"text"}],"returns":"text"} +{"name":"LOCALTIME","returns":"datetime"} +{"name":"LOCALTIME","args":[{"type":"int"}],"returns":"datetime"} +{"name":"LOCALTIMESTAMP","returns":"datetime"} +{"name":"LOCALTIMESTAMP","args":[{"type":"int"}],"returns":"datetime"} +{"name":"LOCATE","args":[{"type":"text"},{"type":"text"}],"returns":"int"} +{"name":"LOCATE","args":[{"type":"text"},{"type":"text"},{"type":"int"}],"returns":"int"} +{"name":"LOG","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"LOG","args":[{"type":"double precision"},{"type":"int"}],"returns":"int"} +{"name":"LOG10","args":[{"type":"double precision"}],"returns":"int"} +{"name":"LOG2","args":[{"type":"double precision"}],"returns":"int"} +{"name":"LOWER","args":[{"type":"text"}],"returns":"text"} +{"name":"LPAD","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"text"} +{"name":"LTRIM","args":[{"type":"text"}],"returns":"text"} +{"name":"MAKEDATE","args":[{"type":"int"},{"type":"int"}],"returns":"date"} +{"name":"MAKETIME","args":[{"type":"int"},{"type":"int"},{"type":"int"}],"returns":"time"} +{"name":"MAKE_SET","args":[{"type":"int"},{"type":"text"},{"type":"text","mode":"v"}],"returns":"text"} +{"name":"MASTER_POS_WAIT","args":[{"type":"text"},{"type":"int"}],"returns":"int"} +{"name":"MASTER_POS_WAIT","args":[{"type":"text"},{"type":"int"},{"type":"int"}],"returns":"int"} +{"name":"MASTER_POS_WAIT","args":[{"type":"text"},{"type":"int"},{"type":"int"},{"type":"text"}],"returns":"int"} +{"name":"MAX","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"MBRCONTAINS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MBRCOVEREDBY","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MBRCOVERS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MBRDISJOINT","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MBREQUALS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MBRINTERSECTS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MBROVERLAPS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MBRTOUCHES","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MBRWITHIN","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"MD5","args":[{"type":"text"}],"returns":"text"} +{"name":"MICROSECOND","args":[{"type":"time"}],"returns":"int"} +{"name":"MID","args":[{"type":"text"},{"type":"int"},{"type":"int"}],"returns":"text"} +{"name":"MIN","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"MINUTE","args":[{"type":"time"}],"returns":"int"} +{"name":"MOD","args":[{"type":"int"},{"type":"int"}],"returns":"int"} +{"name":"MONTH","args":[{"type":"date"}],"returns":"int"} +{"name":"MONTHNAME","args":[{"type":"date"}],"returns":"text"} +{"name":"MULTILINESTRING","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"MULTIPOINT","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"MULTIPOLYGON","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"NAME_CONST","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"NOW","returns":"datetime"} +{"name":"NEXTVAL","args":[{"type":"any"}],"returns":"int"} +{"name":"NOW","args":[{"type":"int"}],"returns":"datetime"} +{"name":"NTH_VALUE","args":[{"type":"any"},{"type":"int"}],"returns":"any"} +{"name":"NTILE","args":[{"type":"int"}],"returns":"int"} +{"name":"NULLIF","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"OCT","args":[{"type":"bigint"}],"returns":"text"} +{"name":"OCTET_LENGTH","args":[{"type":"text"}],"returns":"int"} +{"name":"ORD","args":[{"type":"text"}],"returns":"int"} +{"name":"PERCENT_RANK","returns":"double precision"} +{"name":"PERIOD_ADD","args":[{"type":"int"},{"type":"int"}],"returns":"int"} +{"name":"PERIOD_DIFF","args":[{"type":"int"},{"type":"int"}],"returns":"int"} +{"name":"PI","returns":"double precision"} +{"name":"POINT","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"any"} +{"name":"POLYGON","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"POSITION","args":[{"type":"text"},{"type":"text"}],"returns":"int"} +{"name":"POW","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"POWER","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"PS_CURRENT_THREAD_ID","returns":"int"} +{"name":"PS_THREAD_ID","args":[{"type":"int"}],"returns":"int"} +{"name":"QUARTER","args":[{"type":"date"}],"returns":"int"} +{"name":"QUOTE","args":[{"type":"text"}],"returns":"text"} +{"name":"RADIANS","args":[{"type":"int"}],"returns":"double precision"} +{"name":"RAND","returns":"double precision"} +{"name":"RAND","args":[{"type":"int"}],"returns":"double precision"} +{"name":"RANDOM_BYTES","args":[{"type":"int"}],"returns":"binary"} +{"name":"RANK","returns":"int"} +{"name":"REGEXP_INSTR","args":[{"type":"text"},{"type":"text"},{"type":"int","has_default":true},{"type":"int","has_default":true},{"type":"int","has_default":true},{"type":"text","has_default":true}],"returns":"int"} +{"name":"REGEXP_LIKE","args":[{"type":"text"},{"type":"text"},{"type":"text","has_default":true}],"returns":"bool"} +{"name":"REGEXP_REPLACE","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"int","has_default":true},{"type":"int","has_default":true},{"type":"text","has_default":true}],"returns":"text"} +{"name":"REGEXP_SUBSTR","args":[{"type":"text"},{"type":"text"},{"type":"int","has_default":true},{"type":"int","has_default":true},{"type":"text","has_default":true}],"returns":"text"} +{"name":"RELEASE_ALL_LOCKS","returns":"int"} +{"name":"RELEASE_LOCK","args":[{"type":"text"}],"returns":"bool"} +{"name":"REPEAT","args":[{"type":"text"},{"type":"int"}],"returns":"text"} +{"name":"REPLACE","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"REVERSE","args":[{"type":"text"}],"returns":"text"} +{"name":"RIGHT","args":[{"type":"text"},{"type":"int"}],"returns":"text"} +{"name":"ROLES_GRAPHML","returns":"text"} +{"name":"ROUND","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ROUND","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"ROW_COUNT","returns":"bigint"} +{"name":"ROW_NUMBER","returns":"int"} +{"name":"RPAD","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"text"} +{"name":"RTRIM","args":[{"type":"text"}],"returns":"text"} +{"name":"SCHEMA","returns":"text"} +{"name":"SECOND","args":[{"type":"time"}],"returns":"int"} +{"name":"SEC_TO_TIME","args":[{"type":"int"}],"returns":"time"} +{"name":"SESSION_USER","returns":"text"} +{"name":"SHA","args":[{"type":"text"}],"returns":"text"} +{"name":"SHA1","args":[{"type":"text"}],"returns":"text"} +{"name":"SHA2","args":[{"type":"text"},{"type":"int"}],"returns":"text"} +{"name":"SIGN","args":[{"type":"double precision"}],"returns":"int"} +{"name":"SIN","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"SLEEP","args":[{"type":"int"}],"returns":"int"} +{"name":"SOUNDEX","args":[{"type":"text"}],"returns":"text"} +{"name":"SPACE","args":[{"type":"int"}],"returns":"text"} +{"name":"SQRT","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"STATEMENT_DIGEST","args":[{"type":"text"}],"returns":"text"} +{"name":"STATEMENT_DIGEST_TEXT","args":[{"type":"text"}],"returns":"text"} +{"name":"STD","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"STDDEV","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"STDDEV_POP","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"STDDEV_SAMP","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"STRCMP","args":[{"type":"text"},{"type":"text"}],"returns":"tinyint"} +{"name":"STR_TO_DATE","args":[{"type":"text"},{"type":"text"}],"returns":"datetime"} +{"name":"ST_AREA","args":[{"type":"any"}],"returns":"double precision"} +{"name":"ST_ASBINARY","args":[{"type":"any"}],"returns":"binary"} +{"name":"ST_ASBINARY","args":[{"type":"any"},{"type":"text"}],"returns":"binary"} +{"name":"ST_ASGEOJSON","args":[{"type":"any"}],"returns":"json"} +{"name":"ST_ASGEOJSON","args":[{"type":"any"},{"type":"int"}],"returns":"json"} +{"name":"ST_ASGEOJSON","args":[{"type":"any"},{"type":"int"},{"type":"tinyint"}],"returns":"json"} +{"name":"ST_ASTEXT","args":[{"type":"any"}],"returns":"text"} +{"name":"ST_ASTEXT","args":[{"type":"any"},{"type":"text"}],"returns":"text"} +{"name":"ST_ASWKB","args":[{"type":"any"}],"returns":"binary"} +{"name":"ST_ASWKB","args":[{"type":"any"},{"type":"text"}],"returns":"binary"} +{"name":"ST_ASWKT","args":[{"type":"any"}],"returns":"text"} +{"name":"ST_ASWKT","args":[{"type":"any"},{"type":"text"}],"returns":"text"} +{"name":"ST_BUFFER","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"ST_BUFFER","args":[{"type":"any"},{"type":"double precision"},{"type":"binary"}],"returns":"any"} +{"name":"ST_BUFFER","args":[{"type":"any"},{"type":"double precision"},{"type":"binary"},{"type":"binary"}],"returns":"any"} +{"name":"ST_BUFFER","args":[{"type":"any"},{"type":"double precision"},{"type":"binary"},{"type":"binary"},{"type":"binary"}],"returns":"any"} +{"name":"ST_BUFFER_STRATEGY","args":[{"type":"text"}],"returns":"binary"} +{"name":"ST_BUFFER_STRATEGY","args":[{"type":"text"},{"type":"int"}],"returns":"binary"} +{"name":"ST_CENTROID","args":[{"type":"any"}],"returns":"any"} +{"name":"ST_CONTAINS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"ST_CONVEXHULL","args":[{"type":"any"}],"returns":"any"} +{"name":"ST_CROSSES","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"ST_DIFFERENCE","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"ST_DIMENSION","args":[{"type":"any"}],"returns":"tinyint"} +{"name":"ST_DISJOINT","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"ST_DISTANCE","args":[{"type":"any"},{"type":"any"}],"returns":"double precision"} +{"name":"ST_DISTANCE","args":[{"type":"any"},{"type":"any"},{"type":"text"}],"returns":"double precision"} +{"name":"ST_DISTANCE_SPHERE","args":[{"type":"any"},{"type":"any"}],"returns":"double precision"} +{"name":"ST_DISTANCE_SPHERE","args":[{"type":"any"},{"type":"any"},{"type":"int"}],"returns":"double precision"} +{"name":"ST_ENDPOINT","args":[{"type":"any"}],"returns":"any"} +{"name":"ST_ENVELOPE","args":[{"type":"any"}],"returns":"any"} +{"name":"ST_EQUALS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"ST_EXTERIORRING","args":[{"type":"any"}],"returns":"any"} +{"name":"ST_FRECHET_DISTANCE","args":[{"type":"any"},{"type":"any"}],"returns":"double precision"} +{"name":"ST_FRECHET_DISTANCE","args":[{"type":"any"},{"type":"any"},{"type":"text"}],"returns":"double precision"} +{"name":"ST_GEOHASH","args":[{"type":"double precision"},{"type":"double precision"},{"type":"int"}],"returns":"text"} +{"name":"ST_GEOHASH","args":[{"type":"any"},{"type":"int"}],"returns":"text"} +{"name":"ST_GEOMCOLLFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMCOLLFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMCOLLFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMCOLLFROMTXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMCOLLFROMTXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMCOLLFROMTXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMCOLLFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_GEOMCOLLFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMCOLLFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMETRYCOLLECTIONFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMETRYCOLLECTIONFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMETRYCOLLECTIONFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMETRYCOLLECTIONFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_GEOMETRYCOLLECTIONFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMETRYCOLLECTIONFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMETRYFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMETRYFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMETRYFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMETRYFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_GEOMETRYFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMETRYFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMETRYN","args":[{"type":"any"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMETRYTYPE","args":[{"type":"any"}],"returns":"text"} +{"name":"ST_GEOMFROMGEOJSON","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMFROMGEOJSON","args":[{"type":"text"},{"type":"tinyint"}],"returns":"any"} +{"name":"ST_GEOMFROMGEOJSON","args":[{"type":"text"},{"type":"tinyint"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_GEOMFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_GEOMFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_GEOMFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_HAUSDORFF_DISTANCE","args":[{"type":"any"},{"type":"any"}],"returns":"double precision"} +{"name":"ST_HAUSDORFF_DISTANCE","args":[{"type":"any"},{"type":"any"},{"type":"text"}],"returns":"double precision"} +{"name":"ST_INTERIORRINGN","args":[{"type":"any"},{"type":"int"}],"returns":"any"} +{"name":"ST_INTERSECTION","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"ST_INTERSECTS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"ST_ISCLOSED","args":[{"type":"any"}],"returns":"bool"} +{"name":"ST_ISEMPTY","args":[{"type":"any"}],"returns":"bool"} +{"name":"ST_ISSIMPLE","args":[{"type":"any"}],"returns":"bool"} +{"name":"ST_ISVALID","args":[{"type":"any"}],"returns":"bool"} +{"name":"ST_LATFROMGEOHASH","args":[{"type":"text"}],"returns":"double precision"} +{"name":"ST_LATITUDE","args":[{"type":"any"}],"returns":"double precision"} +{"name":"ST_LATITUDE","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"ST_LENGTH","args":[{"type":"any"}],"returns":"double precision"} +{"name":"ST_LENGTH","args":[{"type":"any"},{"type":"text"}],"returns":"double precision"} +{"name":"ST_LINEFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_LINEFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_LINEFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_LINEFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_LINEFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_LINEFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_LINEINTERPOLATEPOINT","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"ST_LINEINTERPOLATEPOINTS","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"ST_LINESTRINGFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_LINESTRINGFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_LINESTRINGFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_LINESTRINGFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_LINESTRINGFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_LINESTRINGFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_LONGFROMGEOHASH","args":[{"type":"text"}],"returns":"double precision"} +{"name":"ST_LONGITUDE","args":[{"type":"any"}],"returns":"double precision"} +{"name":"ST_LONGITUDE","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"ST_MAKEENVELOPE","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"ST_MLINEFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_MLINEFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_MLINEFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MLINEFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_MLINEFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_MLINEFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MPOINTFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_MPOINTFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_MPOINTFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MPOINTFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_MPOINTFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_MPOINTFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MPOLYFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_MPOLYFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_MPOLYFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MPOLYFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_MPOLYFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_MPOLYFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MULTILINESTRINGFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_MULTILINESTRINGFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_MULTILINESTRINGFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MULTILINESTRINGFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_MULTILINESTRINGFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_MULTILINESTRINGFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MULTIPOINTFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_MULTIPOINTFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_MULTIPOINTFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MULTIPOINTFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_MULTIPOINTFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_MULTIPOINTFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MULTIPOLYGONFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_MULTIPOLYGONFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_MULTIPOLYGONFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_MULTIPOLYGONFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_MULTIPOLYGONFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_MULTIPOLYGONFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_NUMGEOMETRIES","args":[{"type":"any"}],"returns":"bigint"} +{"name":"ST_NUMINTERIORRING","args":[{"type":"any"}],"returns":"int"} +{"name":"ST_NUMINTERIORRINGS","args":[{"type":"any"}],"returns":"int"} +{"name":"ST_NUMPOINTS","args":[{"type":"any"}],"returns":"bigint"} +{"name":"ST_OVERLAPS","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"ST_POINTATDISTANCE","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"ST_POINTFROMGEOHASH","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_POINTFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_POINTFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_POINTFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_POINTFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_POINTFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_POINTFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_POINTN","args":[{"type":"any"},{"type":"int"}],"returns":"any"} +{"name":"ST_POLYFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_POLYFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_POLYFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_POLYFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_POLYFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_POLYFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_POLYGONFROMTEXT","args":[{"type":"text"}],"returns":"any"} +{"name":"ST_POLYGONFROMTEXT","args":[{"type":"text"},{"type":"int"}],"returns":"any"} +{"name":"ST_POLYGONFROMTEXT","args":[{"type":"text"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_POLYGONFROMWKB","args":[{"type":"binary"}],"returns":"any"} +{"name":"ST_POLYGONFROMWKB","args":[{"type":"binary"},{"type":"int"}],"returns":"any"} +{"name":"ST_POLYGONFROMWKB","args":[{"type":"binary"},{"type":"int"},{"type":"text"}],"returns":"any"} +{"name":"ST_SIMPLIFY","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"ST_SRID","args":[{"type":"any"}],"returns":"int"} +{"name":"ST_SRID","args":[{"type":"any"},{"type":"int"}],"returns":"int"} +{"name":"ST_STARTPOINT","args":[{"type":"any"}],"returns":"any"} +{"name":"ST_SWAPXY","args":[{"type":"any"}],"returns":"any"} +{"name":"ST_SYMDIFFERENCE","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"ST_TOUCHES","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"ST_TRANSFORM","args":[{"type":"any"},{"type":"int"}],"returns":"any"} +{"name":"ST_UNION","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"ST_VALIDATE","args":[{"type":"any"}],"returns":"any"} +{"name":"ST_WITHIN","args":[{"type":"any"},{"type":"any"}],"returns":"bool"} +{"name":"ST_X","args":[{"type":"any"}],"returns":"double precision"} +{"name":"ST_X","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"ST_Y","args":[{"type":"any"}],"returns":"double precision"} +{"name":"ST_Y","args":[{"type":"any"},{"type":"double precision"}],"returns":"any"} +{"name":"SUBDATE","args":[{"type":"date"},{"type":"any"}],"returns":"date"} +{"name":"SUBSTR","args":[{"type":"text"},{"type":"int"}],"returns":"text"} +{"name":"SUBSTR","args":[{"type":"text"},{"type":"int"},{"type":"int"}],"returns":"text"} +{"name":"SUBSTRING","args":[{"type":"text"},{"type":"int"}],"returns":"text"} +{"name":"SUBSTRING","args":[{"type":"text"},{"type":"int"},{"type":"int"}],"returns":"text"} +{"name":"SUBSTRING_INDEX","args":[{"type":"text"},{"type":"int"},{"type":"int"}],"returns":"text"} +{"name":"SUBTIME","args":[{"type":"time"},{"type":"time"}],"returns":"time"} +{"name":"SUM","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"SYSDATE","returns":"datetime"} +{"name":"SYSDATE","args":[{"type":"int"}],"returns":"datetime"} +{"name":"SYSTEM_USER","returns":"text"} +{"name":"TAN","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"TIME","args":[{"type":"datetime"}],"returns":"time"} +{"name":"TIMEDIFF","args":[{"type":"time"},{"type":"time"}],"returns":"time"} +{"name":"TIMESTAMP","args":[{"type":"datetime"}],"returns":"datetime"} +{"name":"TIMESTAMP","args":[{"type":"datetime"},{"type":"datetime"}],"returns":"datetime"} +{"name":"TIMESTAMPADD","args":[{"type":"any"},{"type":"int"},{"type":"datetime"}],"returns":"datetime"} +{"name":"TIMESTAMPDIFF","args":[{"type":"any"},{"type":"datetime"},{"type":"datetime"}],"returns":"int"} +{"name":"TIME_FORMAT","args":[{"type":"time"},{"type":"text"}],"returns":"text"} +{"name":"TIME_TO_SEC","args":[{"type":"time"}],"returns":"int"} +{"name":"TO_BASE64","args":[{"type":"text"}],"returns":"text"} +{"name":"TO_DAYS","args":[{"type":"date"}],"returns":"int"} +{"name":"TO_SECONDS","args":[{"type":"datetime"}],"returns":"bigint"} +{"name":"TRIM","args":[{"type":"text"}],"returns":"text"} +{"name":"TRIM","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"TRUNCATE","args":[{"type":"double precision"},{"type":"int"}],"returns":"int"} +{"name":"UCASE","args":[{"type":"text"}],"returns":"text"} +{"name":"UNCOMPRESS","args":[{"type":"binary"}],"returns":"text"} +{"name":"UNCOMPRESSED_LENGTH","args":[{"type":"binary"}],"returns":"int"} +{"name":"UNHEX","args":[{"type":"text"}],"returns":""} +{"name":"UNIX_TIMESTAMP","returns":"bigint"} +{"name":"UNIX_TIMESTAMP","args":[{"type":"datetime"}],"returns":"bigint"} +{"name":"UPDATEXML","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"UPPER","args":[{"type":"text"}],"returns":"text"} +{"name":"USER","returns":"text"} +{"name":"UTC_DATE","returns":"date"} +{"name":"UTC_TIME","returns":"time"} +{"name":"UTC_TIMESTAMP","returns":"datetime"} +{"name":"UUID","returns":"text"} +{"name":"UUID_SHORT","returns":"bigint"} +{"name":"UUID_TO_BIN","args":[{"type":"text"}],"returns":"binary"} +{"name":"UUID_TO_BIN","args":[{"type":"text"},{"type":"tinyint"}],"returns":"binary"} +{"name":"VALIDATE_PASSWORD_STRENGTH","args":[{"type":"text"}],"returns":"int"} +{"name":"VALUES","args":[{"type":"any"}],"returns":"any"} +{"name":"VARIANCE","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"VAR_POP","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"VAR_SAMP","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"VERSION","returns":"text"} +{"name":"WAIT_FOR_EXECUTED_GTID_SET","args":[{"type":"text"},{"type":"int","has_default":true}],"returns":"bool"} +{"name":"WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS","args":[{"type":"text"},{"type":"int","has_default":true},{"type":"text","has_default":true}],"returns":"bool"} +{"name":"WEEK","args":[{"type":"date"}],"returns":"int"} +{"name":"WEEK","args":[{"type":"date"},{"type":"int"}],"returns":"int"} +{"name":"WEEKDAY","args":[{"type":"date"}],"returns":"int"} +{"name":"WEEKOFYEAR","args":[{"type":"date"}],"returns":"int"} +{"name":"WEIGHT_STRING","args":[{"type":"text"}],"returns":"any"} +{"name":"YEAR","args":[{"type":"date"}],"returns":"int"} +{"name":"YEARWEEK","args":[{"type":"date"}],"returns":"int"} diff --git a/internal/engine/dolphin/dialect/operators.jsonl b/internal/engine/dolphin/dialect/operators.jsonl new file mode 100644 index 0000000000..9e7049746e --- /dev/null +++ b/internal/engine/dolphin/dialect/operators.jsonl @@ -0,0 +1,3 @@ +{"name": "~~", "left": "text", "right": "text", "result": "bool"} +{"name": "!~~", "left": "text", "right": "text", "result": "bool"} +{"name": "REGEXP", "left": "text", "right": "text", "result": "bool"} diff --git a/internal/engine/dolphin/dialect/relations.jsonl b/internal/engine/dolphin/dialect/relations.jsonl new file mode 100644 index 0000000000..0660804f9c --- /dev/null +++ b/internal/engine/dolphin/dialect/relations.jsonl @@ -0,0 +1,84 @@ +{"catalog":"def","schema":"information_schema","name":"administrable_role_authorizations","kind":"v","columns":[{"name":"user","type":"varchar(97)"},{"name":"host","type":"varchar(256)"},{"name":"grantee","type":"varchar(97)"},{"name":"grantee_host","type":"varchar(256)"},{"name":"role_name","type":"varchar(255)"},{"name":"role_host","type":"varchar(256)"},{"name":"is_grantable","type":"varchar(3)","not_null":true},{"name":"is_default","type":"varchar(3)"},{"name":"is_mandatory","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"applicable_roles","kind":"v","columns":[{"name":"user","type":"varchar(97)"},{"name":"host","type":"varchar(256)"},{"name":"grantee","type":"varchar(97)"},{"name":"grantee_host","type":"varchar(256)"},{"name":"role_name","type":"varchar(255)"},{"name":"role_host","type":"varchar(256)"},{"name":"is_grantable","type":"varchar(3)","not_null":true},{"name":"is_default","type":"varchar(3)"},{"name":"is_mandatory","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"character_sets","kind":"v","columns":[{"name":"character_set_name","type":"varchar(64)","not_null":true},{"name":"default_collate_name","type":"varchar(64)","not_null":true},{"name":"description","type":"varchar(2048)","not_null":true},{"name":"maxlen","type":"int unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"check_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"varchar(64)","not_null":true},{"name":"constraint_schema","type":"varchar(64)","not_null":true},{"name":"constraint_name","type":"varchar(64)","not_null":true},{"name":"check_clause","type":"longtext","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"collations","kind":"v","columns":[{"name":"collation_name","type":"varchar(64)","not_null":true},{"name":"character_set_name","type":"varchar(64)","not_null":true},{"name":"id","type":"bigint unsigned","not_null":true},{"name":"is_default","type":"varchar(3)","not_null":true},{"name":"is_compiled","type":"varchar(3)","not_null":true},{"name":"sortlen","type":"int unsigned","not_null":true},{"name":"pad_attribute","type":"enum('PAD SPACE','NO PAD')","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"collation_character_set_applicability","kind":"v","columns":[{"name":"collation_name","type":"varchar(64)","not_null":true},{"name":"character_set_name","type":"varchar(64)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"columns","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"column_name","type":"varchar(64)"},{"name":"ordinal_position","type":"int unsigned","not_null":true},{"name":"column_default","type":"text"},{"name":"is_nullable","type":"varchar(3)","not_null":true},{"name":"data_type","type":"longtext"},{"name":"character_maximum_length","type":"bigint"},{"name":"character_octet_length","type":"bigint"},{"name":"numeric_precision","type":"bigint unsigned"},{"name":"numeric_scale","type":"bigint unsigned"},{"name":"datetime_precision","type":"int unsigned"},{"name":"character_set_name","type":"varchar(64)"},{"name":"collation_name","type":"varchar(64)"},{"name":"column_type","type":"mediumtext","not_null":true},{"name":"column_key","type":"enum('','PRI','UNI','MUL')","not_null":true},{"name":"extra","type":"varchar(256)"},{"name":"privileges","type":"varchar(154)"},{"name":"column_comment","type":"text","not_null":true},{"name":"generation_expression","type":"longtext","not_null":true},{"name":"srs_id","type":"int unsigned"}]} +{"catalog":"def","schema":"information_schema","name":"columns_extensions","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"column_name","type":"varchar(64)"},{"name":"engine_attribute","type":"json"},{"name":"secondary_engine_attribute","type":"json"}]} +{"catalog":"def","schema":"information_schema","name":"column_privileges","kind":"v","columns":[{"name":"grantee","type":"varchar(292)","not_null":true},{"name":"table_catalog","type":"varchar(512)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"column_name","type":"varchar(64)","not_null":true},{"name":"privilege_type","type":"varchar(64)","not_null":true},{"name":"is_grantable","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"column_statistics","kind":"v","columns":[{"name":"schema_name","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"column_name","type":"varchar(64)","not_null":true},{"name":"histogram","type":"json","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"enabled_roles","kind":"v","columns":[{"name":"role_name","type":"varchar(255)"},{"name":"role_host","type":"varchar(255)"},{"name":"is_default","type":"varchar(3)"},{"name":"is_mandatory","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"engines","kind":"v","columns":[{"name":"engine","type":"varchar(64)","not_null":true},{"name":"support","type":"varchar(8)","not_null":true},{"name":"comment","type":"varchar(80)","not_null":true},{"name":"transactions","type":"varchar(3)"},{"name":"xa","type":"varchar(3)"},{"name":"savepoints","type":"varchar(3)"}]} +{"catalog":"def","schema":"information_schema","name":"events","kind":"v","columns":[{"name":"event_catalog","type":"varchar(64)","not_null":true},{"name":"event_schema","type":"varchar(64)","not_null":true},{"name":"event_name","type":"varchar(64)","not_null":true},{"name":"definer","type":"varchar(288)","not_null":true},{"name":"time_zone","type":"varchar(64)","not_null":true},{"name":"event_body","type":"varchar(3)","not_null":true},{"name":"event_definition","type":"longtext","not_null":true},{"name":"event_type","type":"varchar(9)","not_null":true},{"name":"execute_at","type":"datetime"},{"name":"interval_value","type":"varchar(256)"},{"name":"interval_field","type":"enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND')"},{"name":"sql_mode","type":"set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','NOT_USED_9','NOT_USED_10','NOT_USED_11','NOT_USED_12','NOT_USED_13','NOT_USED_14','NOT_USED_15','NOT_USED_16','NOT_USED_17','NOT_USED_18','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','ALLOW_INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NOT_USED_29','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','TIME_TRUNCATE_FRACTIONAL','INTERPRET_UTF8_AS_UTF8MB4')","not_null":true},{"name":"starts","type":"datetime"},{"name":"ends","type":"datetime"},{"name":"status","type":"varchar(21)","not_null":true},{"name":"on_completion","type":"varchar(12)","not_null":true},{"name":"created","type":"timestamp","not_null":true},{"name":"last_altered","type":"timestamp","not_null":true},{"name":"last_executed","type":"datetime"},{"name":"event_comment","type":"varchar(2048)","not_null":true},{"name":"originator","type":"int unsigned","not_null":true},{"name":"character_set_client","type":"varchar(64)","not_null":true},{"name":"collation_connection","type":"varchar(64)","not_null":true},{"name":"database_collation","type":"varchar(64)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"files","kind":"v","columns":[{"name":"file_id","type":"bigint"},{"name":"file_name","type":"text"},{"name":"file_type","type":"varchar(256)"},{"name":"tablespace_name","type":"varchar(268)","not_null":true},{"name":"table_catalog","type":"varchar(0)","not_null":true},{"name":"table_schema","type":"varbinary(0)"},{"name":"table_name","type":"varbinary(0)"},{"name":"logfile_group_name","type":"varchar(256)"},{"name":"logfile_group_number","type":"bigint"},{"name":"engine","type":"varchar(64)","not_null":true},{"name":"fulltext_keys","type":"varbinary(0)"},{"name":"deleted_rows","type":"varbinary(0)"},{"name":"update_count","type":"varbinary(0)"},{"name":"free_extents","type":"bigint"},{"name":"total_extents","type":"bigint"},{"name":"extent_size","type":"bigint"},{"name":"initial_size","type":"bigint"},{"name":"maximum_size","type":"bigint"},{"name":"autoextend_size","type":"bigint"},{"name":"creation_time","type":"varbinary(0)"},{"name":"last_update_time","type":"varbinary(0)"},{"name":"last_access_time","type":"varbinary(0)"},{"name":"recover_time","type":"varbinary(0)"},{"name":"transaction_counter","type":"varbinary(0)"},{"name":"version","type":"bigint"},{"name":"row_format","type":"varchar(256)"},{"name":"table_rows","type":"varbinary(0)"},{"name":"avg_row_length","type":"varbinary(0)"},{"name":"data_length","type":"varbinary(0)"},{"name":"max_data_length","type":"varbinary(0)"},{"name":"index_length","type":"varbinary(0)"},{"name":"data_free","type":"bigint"},{"name":"create_time","type":"varbinary(0)"},{"name":"update_time","type":"varbinary(0)"},{"name":"check_time","type":"varbinary(0)"},{"name":"checksum","type":"varbinary(0)"},{"name":"status","type":"varchar(256)"},{"name":"extra","type":"varchar(256)"}]} +{"catalog":"def","schema":"information_schema","name":"innodb_buffer_page","kind":"v","columns":[{"name":"pool_id","type":"bigint unsigned","not_null":true},{"name":"block_id","type":"bigint unsigned","not_null":true},{"name":"space","type":"bigint unsigned","not_null":true},{"name":"page_number","type":"bigint unsigned","not_null":true},{"name":"page_type","type":"varchar(64)"},{"name":"flush_type","type":"bigint unsigned","not_null":true},{"name":"fix_count","type":"bigint unsigned","not_null":true},{"name":"is_hashed","type":"varchar(3)"},{"name":"newest_modification","type":"bigint unsigned","not_null":true},{"name":"oldest_modification","type":"bigint unsigned","not_null":true},{"name":"access_time","type":"bigint unsigned","not_null":true},{"name":"table_name","type":"varchar(1024)"},{"name":"index_name","type":"varchar(1024)"},{"name":"number_records","type":"bigint unsigned","not_null":true},{"name":"data_size","type":"bigint unsigned","not_null":true},{"name":"compressed_size","type":"bigint unsigned","not_null":true},{"name":"page_state","type":"varchar(64)"},{"name":"io_fix","type":"varchar(64)"},{"name":"is_old","type":"varchar(3)"},{"name":"free_page_clock","type":"bigint unsigned","not_null":true},{"name":"is_stale","type":"varchar(3)"}]} +{"catalog":"def","schema":"information_schema","name":"innodb_buffer_page_lru","kind":"v","columns":[{"name":"pool_id","type":"bigint unsigned","not_null":true},{"name":"lru_position","type":"bigint unsigned","not_null":true},{"name":"space","type":"bigint unsigned","not_null":true},{"name":"page_number","type":"bigint unsigned","not_null":true},{"name":"page_type","type":"varchar(64)"},{"name":"flush_type","type":"bigint unsigned","not_null":true},{"name":"fix_count","type":"bigint unsigned","not_null":true},{"name":"is_hashed","type":"varchar(3)"},{"name":"newest_modification","type":"bigint unsigned","not_null":true},{"name":"oldest_modification","type":"bigint unsigned","not_null":true},{"name":"access_time","type":"bigint unsigned","not_null":true},{"name":"table_name","type":"varchar(1024)"},{"name":"index_name","type":"varchar(1024)"},{"name":"number_records","type":"bigint unsigned","not_null":true},{"name":"data_size","type":"bigint unsigned","not_null":true},{"name":"compressed_size","type":"bigint unsigned","not_null":true},{"name":"compressed","type":"varchar(3)"},{"name":"io_fix","type":"varchar(64)"},{"name":"is_old","type":"varchar(3)"},{"name":"free_page_clock","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_buffer_pool_stats","kind":"v","columns":[{"name":"pool_id","type":"bigint unsigned","not_null":true},{"name":"pool_size","type":"bigint unsigned","not_null":true},{"name":"free_buffers","type":"bigint unsigned","not_null":true},{"name":"database_pages","type":"bigint unsigned","not_null":true},{"name":"old_database_pages","type":"bigint unsigned","not_null":true},{"name":"modified_database_pages","type":"bigint unsigned","not_null":true},{"name":"pending_decompress","type":"bigint unsigned","not_null":true},{"name":"pending_reads","type":"bigint unsigned","not_null":true},{"name":"pending_flush_lru","type":"bigint unsigned","not_null":true},{"name":"pending_flush_list","type":"bigint unsigned","not_null":true},{"name":"pages_made_young","type":"bigint unsigned","not_null":true},{"name":"pages_not_made_young","type":"bigint unsigned","not_null":true},{"name":"pages_made_young_rate","type":"float(12,0)","not_null":true},{"name":"pages_made_not_young_rate","type":"float(12,0)","not_null":true},{"name":"number_pages_read","type":"bigint unsigned","not_null":true},{"name":"number_pages_created","type":"bigint unsigned","not_null":true},{"name":"number_pages_written","type":"bigint unsigned","not_null":true},{"name":"pages_read_rate","type":"float(12,0)","not_null":true},{"name":"pages_create_rate","type":"float(12,0)","not_null":true},{"name":"pages_written_rate","type":"float(12,0)","not_null":true},{"name":"number_pages_get","type":"bigint unsigned","not_null":true},{"name":"hit_rate","type":"bigint unsigned","not_null":true},{"name":"young_make_per_thousand_gets","type":"bigint unsigned","not_null":true},{"name":"not_young_make_per_thousand_gets","type":"bigint unsigned","not_null":true},{"name":"number_pages_read_ahead","type":"bigint unsigned","not_null":true},{"name":"number_read_ahead_evicted","type":"bigint unsigned","not_null":true},{"name":"read_ahead_rate","type":"float(12,0)","not_null":true},{"name":"read_ahead_evicted_rate","type":"float(12,0)","not_null":true},{"name":"lru_io_total","type":"bigint unsigned","not_null":true},{"name":"lru_io_current","type":"bigint unsigned","not_null":true},{"name":"uncompress_total","type":"bigint unsigned","not_null":true},{"name":"uncompress_current","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_cached_indexes","kind":"v","columns":[{"name":"space_id","type":"int unsigned","not_null":true},{"name":"index_id","type":"bigint unsigned","not_null":true},{"name":"n_cached_pages","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_cmp","kind":"v","columns":[{"name":"page_size","type":"int","not_null":true},{"name":"compress_ops","type":"int","not_null":true},{"name":"compress_ops_ok","type":"int","not_null":true},{"name":"compress_time","type":"int","not_null":true},{"name":"uncompress_ops","type":"int","not_null":true},{"name":"uncompress_time","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_cmpmem","kind":"v","columns":[{"name":"page_size","type":"int","not_null":true},{"name":"buffer_pool_instance","type":"int","not_null":true},{"name":"pages_used","type":"int","not_null":true},{"name":"pages_free","type":"int","not_null":true},{"name":"relocation_ops","type":"bigint","not_null":true},{"name":"relocation_time","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_cmpmem_reset","kind":"v","columns":[{"name":"page_size","type":"int","not_null":true},{"name":"buffer_pool_instance","type":"int","not_null":true},{"name":"pages_used","type":"int","not_null":true},{"name":"pages_free","type":"int","not_null":true},{"name":"relocation_ops","type":"bigint","not_null":true},{"name":"relocation_time","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_cmp_per_index","kind":"v","columns":[{"name":"database_name","type":"varchar(192)","not_null":true},{"name":"table_name","type":"varchar(192)","not_null":true},{"name":"index_name","type":"varchar(192)","not_null":true},{"name":"compress_ops","type":"int","not_null":true},{"name":"compress_ops_ok","type":"int","not_null":true},{"name":"compress_time","type":"int","not_null":true},{"name":"uncompress_ops","type":"int","not_null":true},{"name":"uncompress_time","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_cmp_per_index_reset","kind":"v","columns":[{"name":"database_name","type":"varchar(192)","not_null":true},{"name":"table_name","type":"varchar(192)","not_null":true},{"name":"index_name","type":"varchar(192)","not_null":true},{"name":"compress_ops","type":"int","not_null":true},{"name":"compress_ops_ok","type":"int","not_null":true},{"name":"compress_time","type":"int","not_null":true},{"name":"uncompress_ops","type":"int","not_null":true},{"name":"uncompress_time","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_cmp_reset","kind":"v","columns":[{"name":"page_size","type":"int","not_null":true},{"name":"compress_ops","type":"int","not_null":true},{"name":"compress_ops_ok","type":"int","not_null":true},{"name":"compress_time","type":"int","not_null":true},{"name":"uncompress_ops","type":"int","not_null":true},{"name":"uncompress_time","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_columns","kind":"v","columns":[{"name":"table_id","type":"bigint unsigned","not_null":true},{"name":"name","type":"varchar(193)","not_null":true},{"name":"pos","type":"bigint unsigned","not_null":true},{"name":"mtype","type":"int","not_null":true},{"name":"prtype","type":"int","not_null":true},{"name":"len","type":"int","not_null":true},{"name":"has_default","type":"int","not_null":true},{"name":"default_value","type":"text"}]} +{"catalog":"def","schema":"information_schema","name":"innodb_datafiles","kind":"v","columns":[{"name":"space","type":"varbinary(256)"},{"name":"path","type":"varchar(512)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_fields","kind":"v","columns":[{"name":"index_id","type":"varbinary(256)"},{"name":"name","type":"varchar(64)","not_null":true},{"name":"pos","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_foreign","kind":"v","columns":[{"name":"id","type":"varchar(129)"},{"name":"for_name","type":"varchar(129)"},{"name":"ref_name","type":"varchar(129)"},{"name":"n_cols","type":"bigint","not_null":true},{"name":"type","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_foreign_cols","kind":"v","columns":[{"name":"id","type":"varchar(129)"},{"name":"for_col_name","type":"varchar(64)","not_null":true},{"name":"ref_col_name","type":"varchar(64)","not_null":true},{"name":"pos","type":"int unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_ft_being_deleted","kind":"v","columns":[{"name":"doc_id","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_ft_config","kind":"v","columns":[{"name":"key","type":"varchar(193)","not_null":true},{"name":"value","type":"varchar(193)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_ft_default_stopword","kind":"v","columns":[{"name":"value","type":"varchar(18)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_ft_deleted","kind":"v","columns":[{"name":"doc_id","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_ft_index_cache","kind":"v","columns":[{"name":"word","type":"varchar(337)","not_null":true},{"name":"first_doc_id","type":"bigint unsigned","not_null":true},{"name":"last_doc_id","type":"bigint unsigned","not_null":true},{"name":"doc_count","type":"bigint unsigned","not_null":true},{"name":"doc_id","type":"bigint unsigned","not_null":true},{"name":"position","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_ft_index_table","kind":"v","columns":[{"name":"word","type":"varchar(337)","not_null":true},{"name":"first_doc_id","type":"bigint unsigned","not_null":true},{"name":"last_doc_id","type":"bigint unsigned","not_null":true},{"name":"doc_count","type":"bigint unsigned","not_null":true},{"name":"doc_id","type":"bigint unsigned","not_null":true},{"name":"position","type":"bigint unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_indexes","kind":"v","columns":[{"name":"index_id","type":"bigint unsigned","not_null":true},{"name":"name","type":"varchar(193)","not_null":true},{"name":"table_id","type":"bigint unsigned","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"n_fields","type":"int","not_null":true},{"name":"page_no","type":"int","not_null":true},{"name":"space","type":"int","not_null":true},{"name":"merge_threshold","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_metrics","kind":"v","columns":[{"name":"name","type":"varchar(193)","not_null":true},{"name":"subsystem","type":"varchar(193)","not_null":true},{"name":"count","type":"bigint","not_null":true},{"name":"max_count","type":"bigint"},{"name":"min_count","type":"bigint"},{"name":"avg_count","type":"float(12,0)"},{"name":"count_reset","type":"bigint","not_null":true},{"name":"max_count_reset","type":"bigint"},{"name":"min_count_reset","type":"bigint"},{"name":"avg_count_reset","type":"float(12,0)"},{"name":"time_enabled","type":"datetime"},{"name":"time_disabled","type":"datetime"},{"name":"time_elapsed","type":"bigint"},{"name":"time_reset","type":"datetime"},{"name":"status","type":"varchar(193)","not_null":true},{"name":"type","type":"varchar(193)","not_null":true},{"name":"comment","type":"varchar(193)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_session_temp_tablespaces","kind":"v","columns":[{"name":"id","type":"int unsigned","not_null":true},{"name":"space","type":"int unsigned","not_null":true},{"name":"path","type":"varchar(4001)","not_null":true},{"name":"size","type":"bigint unsigned","not_null":true},{"name":"state","type":"varchar(192)","not_null":true},{"name":"purpose","type":"varchar(192)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_tables","kind":"v","columns":[{"name":"table_id","type":"bigint unsigned","not_null":true},{"name":"name","type":"varchar(655)","not_null":true},{"name":"flag","type":"int","not_null":true},{"name":"n_cols","type":"int","not_null":true},{"name":"space","type":"bigint","not_null":true},{"name":"row_format","type":"varchar(12)"},{"name":"zip_page_size","type":"int unsigned","not_null":true},{"name":"space_type","type":"varchar(10)"},{"name":"instant_cols","type":"int","not_null":true},{"name":"total_row_versions","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_tablespaces","kind":"v","columns":[{"name":"space","type":"int unsigned","not_null":true},{"name":"name","type":"varchar(655)","not_null":true},{"name":"flag","type":"int unsigned","not_null":true},{"name":"row_format","type":"varchar(22)"},{"name":"page_size","type":"int unsigned","not_null":true},{"name":"zip_page_size","type":"int unsigned","not_null":true},{"name":"space_type","type":"varchar(10)"},{"name":"fs_block_size","type":"int unsigned","not_null":true},{"name":"file_size","type":"bigint unsigned","not_null":true},{"name":"allocated_size","type":"bigint unsigned","not_null":true},{"name":"autoextend_size","type":"bigint unsigned","not_null":true},{"name":"server_version","type":"varchar(10)"},{"name":"space_version","type":"int unsigned","not_null":true},{"name":"encryption","type":"varchar(1)"},{"name":"state","type":"varchar(10)"}]} +{"catalog":"def","schema":"information_schema","name":"innodb_tablespaces_brief","kind":"v","columns":[{"name":"space","type":"varbinary(256)"},{"name":"name","type":"varchar(268)","not_null":true},{"name":"path","type":"varchar(512)","not_null":true},{"name":"flag","type":"varbinary(256)"},{"name":"space_type","type":"varchar(7)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_tablestats","kind":"v","columns":[{"name":"table_id","type":"bigint unsigned","not_null":true},{"name":"name","type":"varchar(193)","not_null":true},{"name":"stats_initialized","type":"varchar(193)","not_null":true},{"name":"num_rows","type":"bigint unsigned","not_null":true},{"name":"clust_index_size","type":"bigint unsigned","not_null":true},{"name":"other_index_size","type":"bigint unsigned","not_null":true},{"name":"modified_counter","type":"bigint unsigned","not_null":true},{"name":"autoinc","type":"bigint unsigned","not_null":true},{"name":"ref_count","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_temp_table_info","kind":"v","columns":[{"name":"table_id","type":"bigint unsigned","not_null":true},{"name":"name","type":"varchar(64)"},{"name":"n_cols","type":"int unsigned","not_null":true},{"name":"space","type":"int unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"innodb_trx","kind":"v","columns":[{"name":"trx_id","type":"bigint unsigned","not_null":true},{"name":"trx_state","type":"varchar(13)","not_null":true},{"name":"trx_started","type":"datetime","not_null":true},{"name":"trx_requested_lock_id","type":"varchar(126)"},{"name":"trx_wait_started","type":"datetime"},{"name":"trx_weight","type":"bigint unsigned","not_null":true},{"name":"trx_mysql_thread_id","type":"bigint unsigned","not_null":true},{"name":"trx_query","type":"varchar(1024)"},{"name":"trx_operation_state","type":"varchar(64)"},{"name":"trx_tables_in_use","type":"bigint unsigned","not_null":true},{"name":"trx_tables_locked","type":"bigint unsigned","not_null":true},{"name":"trx_lock_structs","type":"bigint unsigned","not_null":true},{"name":"trx_lock_memory_bytes","type":"bigint unsigned","not_null":true},{"name":"trx_rows_locked","type":"bigint unsigned","not_null":true},{"name":"trx_rows_modified","type":"bigint unsigned","not_null":true},{"name":"trx_concurrency_tickets","type":"bigint unsigned","not_null":true},{"name":"trx_isolation_level","type":"varchar(16)","not_null":true},{"name":"trx_unique_checks","type":"int","not_null":true},{"name":"trx_foreign_key_checks","type":"int","not_null":true},{"name":"trx_last_foreign_key_error","type":"varchar(256)"},{"name":"trx_adaptive_hash_latched","type":"int","not_null":true},{"name":"trx_adaptive_hash_timeout","type":"bigint unsigned","not_null":true},{"name":"trx_is_read_only","type":"int","not_null":true},{"name":"trx_autocommit_non_locking","type":"int","not_null":true},{"name":"trx_schedule_weight","type":"bigint unsigned"}]} +{"catalog":"def","schema":"information_schema","name":"innodb_virtual","kind":"v","columns":[{"name":"table_id","type":"bigint unsigned","not_null":true},{"name":"pos","type":"int unsigned","not_null":true},{"name":"base_pos","type":"int unsigned","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"json_duality_views","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"definer","type":"varchar(288)"},{"name":"security_type","type":"varchar(7)"},{"name":"json_column_name","type":"varchar(64)","not_null":true},{"name":"root_table_catalog","type":"varchar(64)"},{"name":"root_table_schema","type":"varchar(64)"},{"name":"root_table_name","type":"varchar(64)"},{"name":"allow_insert","type":"varchar(4)"},{"name":"allow_update","type":"varchar(4)"},{"name":"allow_delete","type":"varchar(4)"},{"name":"read_only","type":"varchar(4)"},{"name":"status","type":"varchar(7)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"json_duality_view_columns","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"referenced_table_catalog","type":"varchar(64)"},{"name":"referenced_table_schema","type":"varchar(64)"},{"name":"referenced_table_name","type":"varchar(64)"},{"name":"is_root_table","type":"tinyint"},{"name":"referenced_table_id","type":"int"},{"name":"referenced_column_name","type":"varchar(64)"},{"name":"json_key_name","type":"varchar(64)"},{"name":"allow_insert","type":"tinyint"},{"name":"allow_update","type":"tinyint"},{"name":"allow_delete","type":"tinyint"},{"name":"read_only","type":"tinyint"}]} +{"catalog":"def","schema":"information_schema","name":"json_duality_view_links","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"parent_table_catalog","type":"varchar(64)"},{"name":"parent_table_schema","type":"varchar(64)"},{"name":"parent_table_name","type":"varchar(64)"},{"name":"child_table_catalog","type":"varchar(64)"},{"name":"child_table_schema","type":"varchar(64)"},{"name":"child_table_name","type":"varchar(64)"},{"name":"parent_column_name","type":"varchar(64)"},{"name":"child_column_name","type":"varchar(64)"},{"name":"join_type","type":"varchar(64)"},{"name":"json_key_name","type":"varchar(64)"}]} +{"catalog":"def","schema":"information_schema","name":"json_duality_view_tables","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"referenced_table_catalog","type":"varchar(64)"},{"name":"referenced_table_schema","type":"varchar(64)"},{"name":"referenced_table_name","type":"varchar(64)"},{"name":"where_clause","type":"varchar(64)"},{"name":"allow_insert","type":"tinyint"},{"name":"allow_update","type":"tinyint"},{"name":"allow_delete","type":"tinyint"},{"name":"read_only","type":"tinyint"},{"name":"is_root_table","type":"tinyint"},{"name":"referenced_table_id","type":"int"},{"name":"referenced_table_parent_id","type":"int"},{"name":"referenced_table_parent_relationship","type":"varchar(64)"}]} +{"catalog":"def","schema":"information_schema","name":"keywords","kind":"v","columns":[{"name":"word","type":"varchar(128)"},{"name":"reserved","type":"int"}]} +{"catalog":"def","schema":"information_schema","name":"key_column_usage","kind":"v","columns":[{"name":"constraint_catalog","type":"varchar(64)","not_null":true},{"name":"constraint_schema","type":"varchar(64)","not_null":true},{"name":"constraint_name","type":"varchar(64)"},{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"column_name","type":"varchar(64)"},{"name":"ordinal_position","type":"int unsigned","not_null":true},{"name":"position_in_unique_constraint","type":"int unsigned"},{"name":"referenced_table_schema","type":"varchar(64)"},{"name":"referenced_table_name","type":"varchar(64)"},{"name":"referenced_column_name","type":"varchar(64)"}]} +{"catalog":"def","schema":"information_schema","name":"libraries","kind":"v","columns":[{"name":"library_catalog","type":"varchar(64)","not_null":true},{"name":"library_schema","type":"varchar(64)","not_null":true},{"name":"library_name","type":"varchar(64)","not_null":true},{"name":"library_definition","type":"longtext"},{"name":"language","type":"varchar(64)","not_null":true},{"name":"created","type":"timestamp","not_null":true},{"name":"last_altered","type":"timestamp","not_null":true},{"name":"sql_mode","type":"set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','NOT_USED_9','NOT_USED_10','NOT_USED_11','NOT_USED_12','NOT_USED_13','NOT_USED_14','NOT_USED_15','NOT_USED_16','NOT_USED_17','NOT_USED_18','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','ALLOW_INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NOT_USED_29','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','TIME_TRUNCATE_FRACTIONAL','INTERPRET_UTF8_AS_UTF8MB4')","not_null":true},{"name":"library_comment","type":"text","not_null":true},{"name":"creator","type":"varchar(288)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"optimizer_trace","kind":"v","columns":[{"name":"query","type":"varchar(65535)","not_null":true},{"name":"trace","type":"varchar(65535)","not_null":true},{"name":"missing_bytes_beyond_max_mem_size","type":"int","not_null":true},{"name":"insufficient_privileges","type":"tinyint(1)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"parameters","kind":"v","columns":[{"name":"specific_catalog","type":"varchar(64)","not_null":true},{"name":"specific_schema","type":"varchar(64)","not_null":true},{"name":"specific_name","type":"varchar(64)","not_null":true},{"name":"ordinal_position","type":"bigint unsigned","not_null":true},{"name":"parameter_mode","type":"varchar(5)"},{"name":"parameter_name","type":"varchar(64)"},{"name":"data_type","type":"longtext"},{"name":"character_maximum_length","type":"bigint"},{"name":"character_octet_length","type":"bigint"},{"name":"numeric_precision","type":"int unsigned"},{"name":"numeric_scale","type":"bigint"},{"name":"datetime_precision","type":"int unsigned"},{"name":"character_set_name","type":"varchar(64)"},{"name":"collation_name","type":"varchar(64)"},{"name":"dtd_identifier","type":"mediumtext","not_null":true},{"name":"routine_type","type":"enum('FUNCTION','PROCEDURE','LIBRARY')","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"partitions","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"partition_name","type":"varchar(64)"},{"name":"subpartition_name","type":"varchar(64)"},{"name":"partition_ordinal_position","type":"int unsigned"},{"name":"subpartition_ordinal_position","type":"int unsigned"},{"name":"secondary_load","type":"varchar(1)"},{"name":"partition_method","type":"varchar(13)"},{"name":"subpartition_method","type":"varchar(13)"},{"name":"partition_expression","type":"varchar(2048)"},{"name":"subpartition_expression","type":"varchar(2048)"},{"name":"partition_description","type":"text"},{"name":"table_rows","type":"bigint unsigned"},{"name":"avg_row_length","type":"bigint unsigned"},{"name":"data_length","type":"bigint unsigned"},{"name":"max_data_length","type":"bigint unsigned"},{"name":"index_length","type":"bigint unsigned"},{"name":"data_free","type":"bigint unsigned"},{"name":"create_time","type":"timestamp","not_null":true},{"name":"update_time","type":"datetime"},{"name":"check_time","type":"datetime"},{"name":"checksum","type":"bigint"},{"name":"partition_comment","type":"text","not_null":true},{"name":"nodegroup","type":"varchar(256)"},{"name":"tablespace_name","type":"varchar(268)"}]} +{"catalog":"def","schema":"information_schema","name":"plugins","kind":"v","columns":[{"name":"plugin_name","type":"varchar(64)","not_null":true},{"name":"plugin_version","type":"varchar(20)","not_null":true},{"name":"plugin_status","type":"varchar(10)","not_null":true},{"name":"plugin_type","type":"varchar(80)","not_null":true},{"name":"plugin_type_version","type":"varchar(20)","not_null":true},{"name":"plugin_library","type":"varchar(64)"},{"name":"plugin_library_version","type":"varchar(20)"},{"name":"plugin_author","type":"varchar(64)"},{"name":"plugin_description","type":"varchar(65535)"},{"name":"plugin_license","type":"varchar(80)"},{"name":"load_option","type":"varchar(64)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"processlist","kind":"v","columns":[{"name":"id","type":"bigint unsigned","not_null":true},{"name":"user","type":"varchar(32)","not_null":true},{"name":"host","type":"varchar(261)","not_null":true},{"name":"db","type":"varchar(64)"},{"name":"command","type":"varchar(16)","not_null":true},{"name":"time","type":"int","not_null":true},{"name":"state","type":"varchar(64)"},{"name":"info","type":"varchar(65535)"}]} +{"catalog":"def","schema":"information_schema","name":"profiling","kind":"v","columns":[{"name":"query_id","type":"int","not_null":true},{"name":"seq","type":"int","not_null":true},{"name":"state","type":"varchar(30)","not_null":true},{"name":"duration","type":"decimal(905,0)","not_null":true},{"name":"cpu_user","type":"decimal(905,0)"},{"name":"cpu_system","type":"decimal(905,0)"},{"name":"context_voluntary","type":"int"},{"name":"context_involuntary","type":"int"},{"name":"block_ops_in","type":"int"},{"name":"block_ops_out","type":"int"},{"name":"messages_sent","type":"int"},{"name":"messages_received","type":"int"},{"name":"page_faults_major","type":"int"},{"name":"page_faults_minor","type":"int"},{"name":"swaps","type":"int"},{"name":"source_function","type":"varchar(30)"},{"name":"source_file","type":"varchar(20)"},{"name":"source_line","type":"int"}]} +{"catalog":"def","schema":"information_schema","name":"referential_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"varchar(64)","not_null":true},{"name":"constraint_schema","type":"varchar(64)","not_null":true},{"name":"constraint_name","type":"varchar(64)"},{"name":"unique_constraint_catalog","type":"varchar(64)","not_null":true},{"name":"unique_constraint_schema","type":"varchar(64)","not_null":true},{"name":"unique_constraint_name","type":"varchar(64)"},{"name":"match_option","type":"enum('NONE','PARTIAL','FULL')","not_null":true},{"name":"update_rule","type":"enum('NO ACTION','RESTRICT','CASCADE','SET NULL','SET DEFAULT')","not_null":true},{"name":"delete_rule","type":"enum('NO ACTION','RESTRICT','CASCADE','SET NULL','SET DEFAULT')","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"referenced_table_name","type":"varchar(64)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"resource_groups","kind":"v","columns":[{"name":"resource_group_name","type":"varchar(64)","not_null":true},{"name":"resource_group_type","type":"enum('SYSTEM','USER')","not_null":true},{"name":"resource_group_enabled","type":"tinyint(1)","not_null":true},{"name":"vcpu_ids","type":"blob"},{"name":"thread_priority","type":"int","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"role_column_grants","kind":"v","columns":[{"name":"grantor","type":"varchar(97)"},{"name":"grantor_host","type":"varchar(256)"},{"name":"grantee","type":"char(32)","not_null":true},{"name":"grantee_host","type":"char(255)","not_null":true},{"name":"table_catalog","type":"varchar(3)","not_null":true},{"name":"table_schema","type":"char(64)","not_null":true},{"name":"table_name","type":"char(64)","not_null":true},{"name":"column_name","type":"char(64)","not_null":true},{"name":"privilege_type","type":"set('Select','Insert','Update','References')","not_null":true},{"name":"is_grantable","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"role_routine_grants","kind":"v","columns":[{"name":"grantor","type":"varchar(97)"},{"name":"grantor_host","type":"varchar(256)"},{"name":"grantee","type":"char(32)","not_null":true},{"name":"grantee_host","type":"char(255)","not_null":true},{"name":"specific_catalog","type":"varchar(3)","not_null":true},{"name":"specific_schema","type":"char(64)","not_null":true},{"name":"specific_name","type":"char(64)","not_null":true},{"name":"routine_catalog","type":"varchar(3)","not_null":true},{"name":"routine_schema","type":"char(64)","not_null":true},{"name":"routine_name","type":"char(64)","not_null":true},{"name":"privilege_type","type":"set('Execute','Alter Routine','Grant')","not_null":true},{"name":"is_grantable","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"role_table_grants","kind":"v","columns":[{"name":"grantor","type":"varchar(97)"},{"name":"grantor_host","type":"varchar(256)"},{"name":"grantee","type":"char(32)","not_null":true},{"name":"grantee_host","type":"char(255)","not_null":true},{"name":"table_catalog","type":"varchar(3)","not_null":true},{"name":"table_schema","type":"char(64)","not_null":true},{"name":"table_name","type":"char(64)","not_null":true},{"name":"privilege_type","type":"set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger')","not_null":true},{"name":"is_grantable","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"routines","kind":"v","columns":[{"name":"specific_name","type":"varchar(64)","not_null":true},{"name":"routine_catalog","type":"varchar(64)","not_null":true},{"name":"routine_schema","type":"varchar(64)","not_null":true},{"name":"routine_name","type":"varchar(64)","not_null":true},{"name":"routine_type","type":"enum('FUNCTION','PROCEDURE','LIBRARY')","not_null":true},{"name":"data_type","type":"longtext"},{"name":"character_maximum_length","type":"bigint"},{"name":"character_octet_length","type":"bigint"},{"name":"numeric_precision","type":"int unsigned"},{"name":"numeric_scale","type":"int unsigned"},{"name":"datetime_precision","type":"int unsigned"},{"name":"character_set_name","type":"varchar(64)"},{"name":"collation_name","type":"varchar(64)"},{"name":"dtd_identifier","type":"longtext"},{"name":"routine_body","type":"varchar(8)","not_null":true},{"name":"routine_definition","type":"longtext"},{"name":"external_name","type":"varbinary(0)"},{"name":"external_language","type":"varchar(64)","not_null":true},{"name":"parameter_style","type":"varchar(3)","not_null":true},{"name":"is_deterministic","type":"varchar(3)","not_null":true},{"name":"sql_data_access","type":"enum('CONTAINS SQL','NO SQL','READS SQL DATA','MODIFIES SQL DATA')","not_null":true},{"name":"sql_path","type":"varbinary(0)"},{"name":"security_type","type":"enum('DEFAULT','INVOKER','DEFINER')","not_null":true},{"name":"created","type":"timestamp","not_null":true},{"name":"last_altered","type":"timestamp","not_null":true},{"name":"sql_mode","type":"set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','NOT_USED_9','NOT_USED_10','NOT_USED_11','NOT_USED_12','NOT_USED_13','NOT_USED_14','NOT_USED_15','NOT_USED_16','NOT_USED_17','NOT_USED_18','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','ALLOW_INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NOT_USED_29','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','TIME_TRUNCATE_FRACTIONAL','INTERPRET_UTF8_AS_UTF8MB4')","not_null":true},{"name":"routine_comment","type":"text","not_null":true},{"name":"definer","type":"varchar(288)","not_null":true},{"name":"character_set_client","type":"varchar(64)","not_null":true},{"name":"collation_connection","type":"varchar(64)","not_null":true},{"name":"database_collation","type":"varchar(64)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"routine_libraries","kind":"v","columns":[{"name":"routine_catalog","type":"varchar(64)","not_null":true},{"name":"routine_schema","type":"varchar(64)","not_null":true},{"name":"routine_name","type":"varchar(64)","not_null":true},{"name":"routine_type","type":"enum('FUNCTION','PROCEDURE','LIBRARY')","not_null":true},{"name":"library_catalog","type":"varchar(64)"},{"name":"library_schema","type":"varchar(100)"},{"name":"library_name","type":"varchar(100)"},{"name":"library_version","type":"varchar(100)"}]} +{"catalog":"def","schema":"information_schema","name":"schemata","kind":"v","columns":[{"name":"catalog_name","type":"varchar(64)","not_null":true},{"name":"schema_name","type":"varchar(64)","not_null":true},{"name":"default_character_set_name","type":"varchar(64)","not_null":true},{"name":"default_collation_name","type":"varchar(64)","not_null":true},{"name":"sql_path","type":"varbinary(0)"},{"name":"default_encryption","type":"enum('NO','YES')","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"schemata_extensions","kind":"v","columns":[{"name":"catalog_name","type":"varchar(64)","not_null":true},{"name":"schema_name","type":"varchar(64)","not_null":true},{"name":"options","type":"varchar(256)"}]} +{"catalog":"def","schema":"information_schema","name":"schema_privileges","kind":"v","columns":[{"name":"grantee","type":"varchar(292)","not_null":true},{"name":"table_catalog","type":"varchar(512)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"privilege_type","type":"varchar(64)","not_null":true},{"name":"is_grantable","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"statistics","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"non_unique","type":"int","not_null":true},{"name":"index_schema","type":"varchar(64)","not_null":true},{"name":"index_name","type":"varchar(64)"},{"name":"seq_in_index","type":"int unsigned","not_null":true},{"name":"column_name","type":"varchar(64)"},{"name":"collation","type":"varchar(1)"},{"name":"cardinality","type":"bigint"},{"name":"sub_part","type":"bigint"},{"name":"packed","type":"varbinary(0)"},{"name":"nullable","type":"varchar(3)","not_null":true},{"name":"index_type","type":"varchar(11)","not_null":true},{"name":"comment","type":"varchar(8)","not_null":true},{"name":"index_comment","type":"varchar(2048)","not_null":true},{"name":"is_visible","type":"varchar(3)","not_null":true},{"name":"expression","type":"longtext"}]} +{"catalog":"def","schema":"information_schema","name":"st_geometry_columns","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"column_name","type":"varchar(64)"},{"name":"srs_name","type":"varchar(80)"},{"name":"srs_id","type":"int unsigned"},{"name":"geometry_type_name","type":"longtext"}]} +{"catalog":"def","schema":"information_schema","name":"st_spatial_reference_systems","kind":"v","columns":[{"name":"srs_name","type":"varchar(80)","not_null":true},{"name":"srs_id","type":"int unsigned","not_null":true},{"name":"organization","type":"varchar(256)"},{"name":"organization_coordsys_id","type":"int unsigned"},{"name":"definition","type":"varchar(4096)","not_null":true},{"name":"description","type":"varchar(2048)"}]} +{"catalog":"def","schema":"information_schema","name":"st_units_of_measure","kind":"v","columns":[{"name":"unit_name","type":"varchar(255)"},{"name":"unit_type","type":"varchar(7)"},{"name":"conversion_factor","type":"double"},{"name":"description","type":"varchar(255)"}]} +{"catalog":"def","schema":"information_schema","name":"tables","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"table_type","type":"enum('BASE TABLE','VIEW','SYSTEM VIEW')","not_null":true},{"name":"engine","type":"varchar(64)"},{"name":"version","type":"int"},{"name":"row_format","type":"enum('Fixed','Dynamic','Compressed','Redundant','Compact','Paged')"},{"name":"table_rows","type":"bigint unsigned"},{"name":"avg_row_length","type":"bigint unsigned"},{"name":"data_length","type":"bigint unsigned"},{"name":"max_data_length","type":"bigint unsigned"},{"name":"index_length","type":"bigint unsigned"},{"name":"data_free","type":"bigint unsigned"},{"name":"auto_increment","type":"bigint unsigned"},{"name":"create_time","type":"timestamp","not_null":true},{"name":"update_time","type":"datetime"},{"name":"check_time","type":"datetime"},{"name":"table_collation","type":"varchar(64)"},{"name":"checksum","type":"bigint"},{"name":"create_options","type":"varchar(256)"},{"name":"table_comment","type":"text"}]} +{"catalog":"def","schema":"information_schema","name":"tablespaces_extensions","kind":"v","columns":[{"name":"tablespace_name","type":"varchar(268)","not_null":true},{"name":"engine_attribute","type":"json"}]} +{"catalog":"def","schema":"information_schema","name":"tables_extensions","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"engine_attribute","type":"json"},{"name":"secondary_engine_attribute","type":"json"}]} +{"catalog":"def","schema":"information_schema","name":"table_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"varchar(64)","not_null":true},{"name":"constraint_schema","type":"varchar(64)","not_null":true},{"name":"constraint_name","type":"varchar(64)"},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"constraint_type","type":"varchar(11)","not_null":true},{"name":"enforced","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"table_constraints_extensions","kind":"v","columns":[{"name":"constraint_catalog","type":"varchar(64)","not_null":true},{"name":"constraint_schema","type":"varchar(64)","not_null":true},{"name":"constraint_name","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"engine_attribute","type":"json"},{"name":"secondary_engine_attribute","type":"json"}]} +{"catalog":"def","schema":"information_schema","name":"table_privileges","kind":"v","columns":[{"name":"grantee","type":"varchar(292)","not_null":true},{"name":"table_catalog","type":"varchar(512)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"privilege_type","type":"varchar(64)","not_null":true},{"name":"is_grantable","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"triggers","kind":"v","columns":[{"name":"trigger_catalog","type":"varchar(64)","not_null":true},{"name":"trigger_schema","type":"varchar(64)","not_null":true},{"name":"trigger_name","type":"varchar(64)","not_null":true},{"name":"event_manipulation","type":"enum('INSERT','UPDATE','DELETE')","not_null":true},{"name":"event_object_catalog","type":"varchar(64)","not_null":true},{"name":"event_object_schema","type":"varchar(64)","not_null":true},{"name":"event_object_table","type":"varchar(64)","not_null":true},{"name":"action_order","type":"int unsigned","not_null":true},{"name":"action_condition","type":"varbinary(0)"},{"name":"action_statement","type":"longtext","not_null":true},{"name":"action_orientation","type":"varchar(3)","not_null":true},{"name":"action_timing","type":"enum('BEFORE','AFTER')","not_null":true},{"name":"action_reference_old_table","type":"varbinary(0)"},{"name":"action_reference_new_table","type":"varbinary(0)"},{"name":"action_reference_old_row","type":"varchar(3)","not_null":true},{"name":"action_reference_new_row","type":"varchar(3)","not_null":true},{"name":"created","type":"timestamp(2)","not_null":true},{"name":"sql_mode","type":"set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','NOT_USED_9','NOT_USED_10','NOT_USED_11','NOT_USED_12','NOT_USED_13','NOT_USED_14','NOT_USED_15','NOT_USED_16','NOT_USED_17','NOT_USED_18','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','ALLOW_INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NOT_USED_29','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','TIME_TRUNCATE_FRACTIONAL','INTERPRET_UTF8_AS_UTF8MB4')","not_null":true},{"name":"definer","type":"varchar(288)","not_null":true},{"name":"character_set_client","type":"varchar(64)","not_null":true},{"name":"collation_connection","type":"varchar(64)","not_null":true},{"name":"database_collation","type":"varchar(64)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"user_attributes","kind":"v","columns":[{"name":"user","type":"char(32)","not_null":true},{"name":"host","type":"char(255)","not_null":true},{"name":"attribute","type":"longtext"}]} +{"catalog":"def","schema":"information_schema","name":"user_privileges","kind":"v","columns":[{"name":"grantee","type":"varchar(292)","not_null":true},{"name":"table_catalog","type":"varchar(512)","not_null":true},{"name":"privilege_type","type":"varchar(64)","not_null":true},{"name":"is_grantable","type":"varchar(3)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"views","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"view_definition","type":"longtext"},{"name":"check_option","type":"enum('NONE','LOCAL','CASCADED')"},{"name":"is_updatable","type":"enum('NO','YES')"},{"name":"definer","type":"varchar(288)"},{"name":"security_type","type":"varchar(7)"},{"name":"character_set_client","type":"varchar(64)","not_null":true},{"name":"collation_connection","type":"varchar(64)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"view_routine_usage","kind":"v","columns":[{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true},{"name":"specific_catalog","type":"varchar(64)","not_null":true},{"name":"specific_schema","type":"varchar(64)","not_null":true},{"name":"specific_name","type":"varchar(64)","not_null":true}]} +{"catalog":"def","schema":"information_schema","name":"view_table_usage","kind":"v","columns":[{"name":"view_catalog","type":"varchar(64)","not_null":true},{"name":"view_schema","type":"varchar(64)","not_null":true},{"name":"view_name","type":"varchar(64)","not_null":true},{"name":"table_catalog","type":"varchar(64)","not_null":true},{"name":"table_schema","type":"varchar(64)","not_null":true},{"name":"table_name","type":"varchar(64)","not_null":true}]} diff --git a/internal/engine/dolphin/dialect/types.jsonl b/internal/engine/dolphin/dialect/types.jsonl new file mode 100644 index 0000000000..c76d29d28a --- /dev/null +++ b/internal/engine/dolphin/dialect/types.jsonl @@ -0,0 +1,39 @@ +{"name": "bool", "category": "B", "aliases": ["boolean"]} +{"name": "tinyint", "category": "N"} +{"name": "tinyint unsigned", "category": "N", "base": "tinyint"} +{"name": "smallint", "category": "N"} +{"name": "smallint unsigned", "category": "N", "base": "smallint"} +{"name": "mediumint", "category": "N"} +{"name": "mediumint unsigned", "category": "N", "base": "mediumint"} +{"name": "int", "category": "N", "aliases": ["integer"]} +{"name": "int unsigned", "category": "N", "base": "int", "aliases": ["integer unsigned"]} +{"name": "bigint", "category": "N", "aliases": ["signed", "bigint signed"]} +{"name": "bigint unsigned", "category": "N", "base": "bigint", "aliases": ["unsigned"]} +{"name": "float", "category": "N"} +{"name": "float unsigned", "category": "N", "base": "float"} +{"name": "double", "category": "N", "aliases": ["double precision", "real"]} +{"name": "double unsigned", "category": "N", "base": "double", "aliases": ["double precision unsigned", "real unsigned"]} +{"name": "decimal", "category": "N", "aliases": ["numeric", "dec", "fixed"]} +{"name": "decimal unsigned", "category": "N", "base": "decimal", "aliases": ["numeric unsigned", "dec unsigned", "fixed unsigned"]} +{"name": "bit", "category": "N"} +{"name": "char", "category": "S"} +{"name": "varchar", "category": "S"} +{"name": "tinytext", "category": "S"} +{"name": "text", "category": "S"} +{"name": "mediumtext", "category": "S"} +{"name": "longtext", "category": "S"} +{"name": "enum", "category": "S"} +{"name": "set", "category": "S"} +{"name": "binary", "category": "U"} +{"name": "varbinary", "category": "U"} +{"name": "tinyblob", "category": "U"} +{"name": "blob", "category": "U"} +{"name": "mediumblob", "category": "U"} +{"name": "longblob", "category": "U"} +{"name": "json", "category": "U"} +{"name": "geometry", "category": "U"} +{"name": "date", "category": "D"} +{"name": "datetime", "category": "D"} +{"name": "timestamp", "category": "D"} +{"name": "time", "category": "D"} +{"name": "year", "category": "D"} diff --git a/internal/engine/dolphin/fingerprint.go b/internal/engine/dolphin/fingerprint.go new file mode 100644 index 0000000000..1554a94f8d --- /dev/null +++ b/internal/engine/dolphin/fingerprint.go @@ -0,0 +1,55 @@ +package dolphin + +import ( + "fmt" + "strings" + + pcast "github.com/sqlc-dev/marino/ast" + "github.com/sqlc-dev/marino/format" + "github.com/sqlc-dev/marino/parser" +) + +// deparen unwraps parenthesized expressions so a redundant pair of +// parentheses added or dropped by formatting does not change the +// fingerprint. Everything else about the tree survives untouched. +type deparen struct{} + +func (v deparen) Enter(n pcast.Node) (pcast.Node, bool) { return n, false } +func (v deparen) Leave(n pcast.Node) (pcast.Node, bool) { + if p, ok := n.(*pcast.ParenthesesExpr); ok { + return p.Expr, true + } + return n, true +} + +// Fingerprint reduces a statement to a canonical form that survives changes +// in whitespace, keyword case, quoting style and redundant parentheses — +// and nothing else. Identifier case is preserved: MySQL table names are +// case-sensitive on most servers, so a formatting pass that changes one is +// a semantic change and must not fingerprint equal. fmt uses this as its +// proof that a formatted statement still means what the author wrote; a +// statement whose fingerprint it cannot match is left exactly as written. +func (p *Parser) Fingerprint(sql string) (string, error) { + // A fresh parser: p.pingcap carries per-parse comment state that + // ParseFile is still using. + stmts, _, err := parser.New().Parse(sql, "", "") + if err != nil { + return "", normalizeErr(err) + } + flags := format.RestoreStringSingleQuotes | + format.RestoreKeyWordUppercase | + format.RestoreNameBackQuotes + parts := make([]string, 0, len(stmts)) + for _, s := range stmts { + n, ok := s.Accept(deparen{}) + if !ok { + return "", fmt.Errorf("fingerprint: rewrite failed") + } + var sb strings.Builder + if err := n.Restore(format.NewRestoreCtx(flags, &sb)); err != nil { + return "", fmt.Errorf("fingerprint: %w", err) + } + parts = append(parts, sb.String()) + } + return strings.Join(parts, "; "), nil +} diff --git a/internal/engine/dolphin/format.go b/internal/engine/dolphin/format.go new file mode 100644 index 0000000000..b9b6c40a09 --- /dev/null +++ b/internal/engine/dolphin/format.go @@ -0,0 +1,36 @@ +package dolphin + +// QuoteIdent returns a quoted identifier if it needs quoting. +// MySQL uses backticks for quoting identifiers. +func (p *Parser) QuoteIdent(s string) string { + // For now, don't quote - MySQL is less strict about quoting + return s +} + +// TypeName returns the SQL type name for the given namespace and name. +// Handles MySQL-specific type name mappings for formatting. +func (p *Parser) TypeName(ns, name string) string { + if ns != "" { + return ns + "." + name + } + // Map internal type names to MySQL CAST-compatible names for formatting + switch name { + case "bigint unsigned": + return "UNSIGNED" + case "bigint signed": + return "SIGNED" + } + return name +} + +// Param returns the parameter placeholder for the given number. +// MySQL uses ? for all parameters (positional). +func (p *Parser) Param(n int, numbered bool) string { + return "?" +} + +// Cast returns a type cast expression. +// MySQL uses CAST(expr AS type) syntax. +func (p *Parser) Cast(arg, typeName string) string { + return "CAST(" + arg + " AS " + typeName + ")" +} diff --git a/internal/engine/dolphin/parse.go b/internal/engine/dolphin/parse.go index 676362c448..9f1f409593 100644 --- a/internal/engine/dolphin/parse.go +++ b/internal/engine/dolphin/parse.go @@ -2,25 +2,35 @@ package dolphin import ( "errors" + "fmt" "io" "regexp" "strconv" "strings" - "github.com/pingcap/tidb/parser" - _ "github.com/pingcap/tidb/parser/test_driver" + "github.com/sqlc-dev/marino/parser" - "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) func NewParser() *Parser { - return &Parser{parser.New()} + return &Parser{pingcap: parser.New()} +} + +// NewFormatParser returns the parser sqlc fmt uses. It differs from the +// compiler's parser in one way: identifiers keep the case the author wrote. +// The compiler lowercases them so catalog lookups are case-insensitive, but +// a formatter that prints `Event` as `event` renames a table on the many +// servers where table names are case-sensitive. +func NewFormatParser() *Parser { + return &Parser{pingcap: parser.New(), preserveCase: true} } type Parser struct { - pingcap *parser.Parser + pingcap *parser.Parser + preserveCase bool } var lineColumn = regexp.MustCompile(`^line (\d+) column (\d+) (.*)`) @@ -49,28 +59,59 @@ func normalizeErr(err error) error { } func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { + f, err := p.ParseFile(r) + if err != nil { + return nil, err + } + // The compiler skips statements sqlc has no node for; the formatter + // must see them, so the filter lives here, not in ParseFile. + var stmts []ast.Statement + for _, stmt := range f.Stmts { + if _, ok := stmt.Raw.Stmt.(*ast.TODO); ok { + continue + } + stmts = append(stmts, stmt) + } + return stmts, nil +} + +// ParseFile parses like Parse and also carries the file's comments, which +// marino's lexer records as it scans. +func (p *Parser) ParseFile(r io.Reader) (*ast.File, error) { blob, err := io.ReadAll(r) if err != nil { return nil, err } - stmtNodes, _, err := p.pingcap.Parse(string(blob), "", "") + src := string(blob) + stmtNodes, _, err := p.pingcap.Parse(src, "", "") if err != nil { return nil, normalizeErr(err) } var stmts []ast.Statement + // A statement's text spans from the end of the previous statement + // through its terminator, so it carries the comments written above it + // (that's where the "-- name:" annotation lives). Each text is a + // contiguous slice of src laid down after the one before it, so + // searching from the previous statement's end pins every text to its + // own occurrence even when two statements read the same. + searchFrom := 0 for i := range stmtNodes { - converter := &cc{} + converter := &cc{preserveCase: p.preserveCase} + // A statement sqlc has no node for converts to a TODO and stays in + // the list: the formatter needs its extent to keep it as written, + // and Parse filters it out for the compiler. out := converter.convert(stmtNodes[i]) - if _, ok := out.(*ast.TODO); ok { - continue - } - // TODO: Attach the text directly to the ast.Statement node text := stmtNodes[i].Text() - loc := strings.Index(string(blob), text) + idx := strings.Index(src[searchFrom:], text) + if idx < 0 { + return nil, fmt.Errorf("could not locate statement %d in source", i) + } + loc := searchFrom + idx + searchFrom = loc + len(text) stmtLen := len(text) - if text[stmtLen-1] == ';' { + if stmtLen > 0 && text[stmtLen-1] == ';' { stmtLen -= 1 // Subtract one to remove semicolon } @@ -82,12 +123,38 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { }, }) } - return stmts, nil + + var comments []ast.Comment + for _, c := range p.pingcap.Comments() { + comments = append(comments, ast.Comment{ + Text: strings.TrimRight(src[c.Begin:c.End], " \t\r\n"), + Start: c.Begin, + End: c.End, + OwnLine: ownLine(src, c.Begin), + }) + } + return &ast.File{Stmts: stmts, Comments: comments}, nil +} + +// ownLine reports that only blank space sits between the preceding line +// break and pos. +func ownLine(src string, pos int) bool { + for j := pos - 1; j >= 0; j-- { + switch src[j] { + case '\n': + return true + case ' ', '\t', '\r': + continue + default: + return false + } + } + return true } // https://dev.mysql.com/doc/refman/8.0/en/comments.html -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ Dash: true, SlashStar: true, Hash: true, diff --git a/internal/engine/dolphin/seed.go b/internal/engine/dolphin/seed.go new file mode 100644 index 0000000000..ddaeffb9c0 --- /dev/null +++ b/internal/engine/dolphin/seed.go @@ -0,0 +1,34 @@ +package dolphin + +import ( + "embed" + "sync" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/seed" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +// The dialect directory describes MySQL's type system, and functions.jsonl is +// its standard library. Both the analysis core and the catalog the legacy +// compiler builds read them. +// +//go:embed dialect +var dialectFS embed.FS + +// Dialect returns the catalog option that seeds MySQL's type system. +func Dialect() core.Option { + return seed.Dialect(dialectFS, "dialect") +} + +// stdlib is MySQL's functions in the form the catalog uses. They are embedded +// in the binary and never change within a run, so they are read once. +var stdlib = sync.OnceValue(func() []*catalog.Function { + funcs, err := seed.Functions(dialectFS, "dialect") + if err != nil { + // A failure here means sqlc was built from a broken tree, which no + // caller can do anything about. + panic(err) + } + return funcs +}) diff --git a/internal/engine/dolphin/stdlib.go b/internal/engine/dolphin/stdlib.go index 37de5d7cb6..df79c4676a 100644 --- a/internal/engine/dolphin/stdlib.go +++ b/internal/engine/dolphin/stdlib.go @@ -1,5660 +1,11 @@ package dolphin import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) +// defaultSchema is MySQL's standard library, read from the dialect directory's +// functions.jsonl. func defaultSchema(name string) *catalog.Schema { - s := &catalog.Schema{Name: name} - s.Funcs = []*catalog.Function{ - { - Name: "ABS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tinyint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tinyint"}, - }, - { - Name: "ABS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "ABS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "mediumint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "mediumint"}, - }, - { - Name: "ABS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "ABS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "ABS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double"}, - }, - { - Name: "ABS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ACOS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ADDDATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "ADDTIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "AES_DECRYPT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "AES_DECRYPT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "AES_ENCRYPT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "AES_ENCRYPT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "ANY_VALUE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ASCII", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "ASIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ATAN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ATAN2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "AVG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "BENCHMARK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "BIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "BIN_TO_UUID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "BIN_TO_UUID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "tinyint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "BIT_AND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "BIT_COUNT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "BIT_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "BIT_OR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "BIT_XOR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "CAST", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "CEIL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "CEIL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "CEILING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "CEILING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "CHAR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "CHARACTER_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "CHARSET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "CHAR_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "COERCIBILITY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "COLLATION", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "COMPRESS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "CONCAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "CONCAT_WS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "CONNECTION_ID", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "CONV", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "CONVERT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "CONVERT_TZ", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "datetime"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "COS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "COT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "COUNT", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "COUNT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "CRC32", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "CUME_DIST", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "CURDATE", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "CURRENT_DATE", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "CURRENT_ROLE", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "CURRENT_TIME", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "CURRENT_TIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "CURRENT_TIMESTAMP", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "CURRENT_TIMESTAMP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "CURRENT_USER", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "CURTIME", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "CURTIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "DATABASE", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "DATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "DATEDIFF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "datetime"}, - }, - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "DATE_ADD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "DATE_ADD_INTERVAL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "DATE_FORMAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "DATE_SUB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "DATE_SUB_INTERVAL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "DAY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "DAYNAME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "DAYOFMONTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "DAYOFWEEK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "DAYOFYEAR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "DEFAULT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "DEGREES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "DENSE_RANK", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "DISTINCT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ELT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "EXP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "EXPORT_SET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "EXPORT_SET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "EXPORT_SET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "EXTRACT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "EXTRACTVALUE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "FIELD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "FIND_IN_SET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "FIRST_VALUE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "FLOOR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "FORMAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "FORMAT_BYTES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "FORMAT_PICO_TIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "FOUND_ROWS", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "FROM_BASE64", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "FROM_DAYS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "FROM_UNIXTIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "FROM_UNIXTIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "GEOMCOLLECTION", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "GEOMETRYCOLLECTION", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "GET_FORMAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "GET_LOCK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "GREATEST", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "GROUPING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "GROUP_CONCAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - ReturnTypeNullable: true, - }, - { - Name: "GTID_SUBSET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "GTID_SUBTRACT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "HEX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "HEX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "HOUR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "ICU_VERSION", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "IF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "IFNULL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "INET6_ATON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "INET6_NTOA", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "INET_ATON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "INET_NTOA", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "INSERT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "INSTR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "INTERVAL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ISNULL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "IS_FREE_LOCK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "IS_IPV4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "IS_IPV4_COMPAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "IS_IPV4_MAPPED", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "IS_IPV6", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "IS_USED_LOCK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "IS_UUID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "JSON_ARRAY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_ARRAYAGG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_ARRAY_APPEND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_ARRAY_INSERT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_CONTAINS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "JSON_CONTAINS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "JSON_CONTAINS_PATH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "JSON_DEPTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "JSON_EXTRACT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "JSON_INSERT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_KEYS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_KEYS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "JSON_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "JSON_MERGE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_MERGE_PATCH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_MERGE_PRESERVE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_OBJECT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_OBJECTAGG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_OVERLAPS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "JSON_PRETTY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "JSON_QUOTE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "JSON_REMOVE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_REPLACE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_SCHEMA_VALID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "JSON_SCHEMA_VALIDATION_REPORT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_SEARCH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "JSON_SEARCH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "JSON_SET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_STORAGE_FREE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "JSON_STORAGE_SIZE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "JSON_TYPE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "JSON_UNQUOTE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "JSON_VALID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "JSON_VALUE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "LAG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "any"}, - HasDefault: true, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "LAST_DAY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "LAST_INSERT_ID", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "LAST_INSERT_ID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "LAST_VALUE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "LCASE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "LEAD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "any"}, - HasDefault: true, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "LEAST", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "LEFT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "LINESTRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "LN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "LOAD_FILE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "LOCALTIME", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "LOCALTIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - - { - Name: "LOCALTIMESTAMP", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "LOCALTIMESTAMP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "LOCATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "LOCATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "LOG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "LOG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "LOG10", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "LOG2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "LOWER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "LPAD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "LTRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "MAKEDATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "MAKETIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "MAKE_SET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "MASTER_POS_WAIT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "MASTER_POS_WAIT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "MASTER_POS_WAIT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "MAX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "MBRCONTAINS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MBRCOVEREDBY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MBRCOVERS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MBRDISJOINT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MBREQUALS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MBRINTERSECTS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MBROVERLAPS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MBRTOUCHES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MBRWITHIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "MD5", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "MICROSECOND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "MID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "MIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "MINUTE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "MOD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "MONTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "MONTHNAME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "MULTILINESTRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "MULTIPOINT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "MULTIPOLYGON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "NAME_CONST", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "NOW", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "NOW", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "NTH_VALUE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "NTILE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "NULLIF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "OCT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "OCTET_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "ORD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "PERCENT_RANK", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "PERIOD_ADD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "PERIOD_DIFF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "PI", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "POINT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "POLYGON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "POSITION", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "POW", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "POWER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "PS_CURRENT_THREAD_ID", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "PS_THREAD_ID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "QUARTER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "QUOTE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "RADIANS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "RAND", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "RAND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "RANDOM_BYTES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "RANK", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "REGEXP_INSTR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "text"}, - HasDefault: true, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "REGEXP_LIKE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - HasDefault: true, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "REGEXP_REPLACE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "text"}, - HasDefault: true, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "REGEXP_SUBSTR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "text"}, - HasDefault: true, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "RELEASE_ALL_LOCKS", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "RELEASE_LOCK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "REPEAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "REPLACE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "REVERSE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "RIGHT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ROLES_GRAPHML", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ROUND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ROUND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ROW_COUNT", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "ROW_NUMBER", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "RPAD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "RTRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SCHEMA", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SECOND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "SEC_TO_TIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "SESSION_USER", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SHA", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SHA1", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SHA2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SIGN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "SIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "SLEEP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "SOUNDEX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SPACE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SQRT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "STATEMENT_DIGEST", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "STATEMENT_DIGEST_TEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "STD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "STDDEV", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "STDDEV_POP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "STDDEV_SAMP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "STRCMP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tinyint"}, - }, - { - Name: "STR_TO_DATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "ST_AREA", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_ASBINARY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "ST_ASBINARY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "ST_ASGEOJSON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ST_ASGEOJSON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ST_ASGEOJSON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "tinyint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ST_ASTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ST_ASTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ST_ASWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "ST_ASWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "ST_ASWKT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ST_ASWKT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ST_BUFFER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_BUFFER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_BUFFER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_BUFFER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_BUFFER_STRATEGY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "ST_BUFFER_STRATEGY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "ST_CENTROID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_CONTAINS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_CONVEXHULL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_CROSSES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_DIFFERENCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_DIMENSION", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tinyint"}, - }, - { - Name: "ST_DISJOINT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_DISTANCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_DISTANCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_DISTANCE_SPHERE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_DISTANCE_SPHERE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_ENDPOINT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_ENVELOPE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_EQUALS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_EXTERIORRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_FRECHET_DISTANCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_FRECHET_DISTANCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_GEOHASH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ST_GEOHASH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ST_GEOMCOLLFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMCOLLFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMCOLLFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMCOLLFROMTXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMCOLLFROMTXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMCOLLFROMTXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMCOLLFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMCOLLFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMCOLLFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYCOLLECTIONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYCOLLECTIONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYCOLLECTIONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYCOLLECTIONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYCOLLECTIONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYCOLLECTIONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMETRYTYPE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ST_GEOMFROMGEOJSON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMFROMGEOJSON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tinyint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMFROMGEOJSON", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tinyint"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_GEOMFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_HAUSDORFF_DISTANCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_HAUSDORFF_DISTANCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - - { - Name: "ST_INTERIORRINGN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_INTERSECTION", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_INTERSECTS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_ISCLOSED", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_ISEMPTY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_ISSIMPLE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_ISVALID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_LATFROMGEOHASH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_LATITUDE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_LATITUDE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_LINEFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINEFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINEFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINEFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINEFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINEFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINEINTERPOLATEPOINT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINEINTERPOLATEPOINTS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINESTRINGFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINESTRINGFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINESTRINGFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINESTRINGFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINESTRINGFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LINESTRINGFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_LONGFROMGEOHASH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_LONGITUDE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_LONGITUDE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MAKEENVELOPE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MLINEFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MLINEFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MLINEFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MLINEFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MLINEFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MLINEFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOLYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOLYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOLYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOLYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOLYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MPOLYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTILINESTRINGFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTILINESTRINGFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTILINESTRINGFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTILINESTRINGFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTILINESTRINGFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTILINESTRINGFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOLYGONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOLYGONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOLYGONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOLYGONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOLYGONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_MULTIPOLYGONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_NUMGEOMETRIES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "ST_NUMINTERIORRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "ST_NUMINTERIORRINGS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "ST_NUMPOINTS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "ST_OVERLAPS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_POINTATDISTANCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POINTFROMGEOHASH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POINTFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POINTFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POINTN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYGONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYGONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYGONFROMTEXT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYGONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYGONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_POLYGONFROMWKB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_SIMPLIFY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_SRID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "ST_SRID", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "ST_STARTPOINT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_SWAPXY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_SYMDIFFERENCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_TOUCHES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_TRANSFORM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_UNION", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_VALIDATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_WITHIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "ST_X", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_X", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "ST_Y", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ST_Y", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "SUBDATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "SUBSTR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBSTR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBSTRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBSTRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBSTRING_INDEX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBTIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "SUM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "SYSDATE", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "SYSDATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "SYSTEM_USER", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "TAN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "TIME", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "TIMEDIFF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "TIMESTAMP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "TIMESTAMP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "datetime"}, - }, - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "TIMESTAMPADD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "TIMESTAMPDIFF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "datetime"}, - }, - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "TIME_FORMAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "TIME_TO_SEC", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "TO_BASE64", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "TO_DAYS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "TO_SECONDS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "TRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "TRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "TRUNCATE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "UCASE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "UNCOMPRESS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "UNCOMPRESSED_LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "binary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "UNHEX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - }, - { - Name: "UNIX_TIMESTAMP", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "UNIX_TIMESTAMP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "datetime"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "UPDATEXML", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "UPPER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "USER", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "UTC_DATE", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "UTC_TIME", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "time"}, - }, - { - Name: "UTC_TIMESTAMP", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "datetime"}, - }, - { - Name: "UUID", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "UUID_SHORT", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "UUID_TO_BIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "UUID_TO_BIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tinyint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "binary"}, - }, - { - Name: "VALIDATE_PASSWORD_STRENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "VALUES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "VARIANCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "VAR_POP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "VAR_SAMP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "VERSION", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "WAIT_FOR_EXECUTED_GTID_SET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - HasDefault: true, - }, - { - Type: &ast.TypeName{Name: "text"}, - HasDefault: true, - }, - }, - ReturnType: &ast.TypeName{Name: "bool"}, - }, - { - Name: "WEEK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "WEEK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "WEEKDAY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "WEEKOFYEAR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "WEIGHT_STRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "YEAR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - { - Name: "YEARWEEK", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int"}, - }, - } - return s + return &catalog.Schema{Name: name, Funcs: stdlib()} } diff --git a/internal/engine/dolphin/utils.go b/internal/engine/dolphin/utils.go index dd3b8f58d8..fd443aa8f5 100644 --- a/internal/engine/dolphin/utils.go +++ b/internal/engine/dolphin/utils.go @@ -1,27 +1,27 @@ package dolphin import ( - pcast "github.com/pingcap/tidb/parser/ast" - "github.com/pingcap/tidb/parser/mysql" + pcast "github.com/sqlc-dev/marino/ast" + "github.com/sqlc-dev/marino/mysql" "github.com/sqlc-dev/sqlc/internal/sql/ast" ) -func parseTableName(n *pcast.TableName) *ast.TableName { +func (c *cc) parseTableName(n *pcast.TableName) *ast.TableName { return &ast.TableName{ - Schema: identifier(n.Schema.String()), - Name: identifier(n.Name.String()), + Schema: c.identifier(n.Schema.String()), + Name: c.identifier(n.Name.String()), } } -func toList(node pcast.Node) *ast.List { +func (c *cc) toList(node pcast.Node) *ast.List { var items []ast.Node switch n := node.(type) { case *pcast.TableName: if schema := n.Schema.String(); schema != "" { - items = append(items, NewIdentifier(schema)) + items = append(items, c.NewIdentifier(schema)) } - items = append(items, NewIdentifier(n.Name.String())) + items = append(items, c.NewIdentifier(n.Name.String())) default: return nil } @@ -52,6 +52,9 @@ func convertToRangeVarList(list *ast.List, result *ast.List) { if !ok { if list, check := rel.Larg.(*ast.List); check { convertToRangeVarList(list, result) + } else if subselect, check := rel.Larg.(*ast.RangeSubselect); check { + // Handle subqueries in JOIN clauses + result.Items = append(result.Items, subselect) } else { panic("expected range var") } @@ -64,6 +67,9 @@ func convertToRangeVarList(list *ast.List, result *ast.List) { if !ok { if list, check := rel.Rarg.(*ast.List); check { convertToRangeVarList(list, result) + } else if subselect, check := rel.Rarg.(*ast.RangeSubselect); check { + // Handle subqueries in JOIN clauses + result.Items = append(result.Items, subselect) } else { panic("expected range var") } @@ -75,6 +81,9 @@ func convertToRangeVarList(list *ast.List, result *ast.List) { case *ast.RangeVar: result.Items = append(result.Items, rel) + case *ast.RangeSubselect: + result.Items = append(result.Items, rel) + default: panic("expected range var") } diff --git a/internal/engine/duckdb/convert.go b/internal/engine/duckdb/convert.go new file mode 100644 index 0000000000..152d8e59bf --- /dev/null +++ b/internal/engine/duckdb/convert.go @@ -0,0 +1,1256 @@ +package duckdb + +import ( + "math/big" + "strconv" + "strings" + + dw "github.com/sqlc-dev/darkwing/ast" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +type cc struct{} + +// loc returns a node's start offset for the Location fields of the sqlc AST. +// darkwing marks synthesized nodes with a negative span. +func (c *cc) loc(n dw.Node) int { + if n == nil { + return 0 + } + if pos := n.Pos(); pos >= 0 { + return pos + } + return 0 +} + +func (c *cc) convert(node dw.Stmt) ast.Node { + switch n := node.(type) { + case *dw.SelectStatement: + return c.convertSelectStatement(n) + case *dw.InsertStatement: + return c.convertInsertStatement(n) + case *dw.UpdateStatement: + return c.convertUpdateStatement(n) + case *dw.DeleteStatement: + return c.convertDeleteStatement(n) + case *dw.TruncateStatement: + return c.convertTruncateStatement(n) + case *dw.CreateStatement: + return c.convertCreateStatement(n) + case *dw.DropStatement: + return c.convertDropStatement(n) + case *dw.AlterStatement: + return c.convertAlterStatement(n) + default: + return todo(n) + } +} + +func (c *cc) convertSelectStatement(n *dw.SelectStatement) ast.Node { + if n == nil { + return &ast.TODO{} + } + return c.convertQueryNode(n.Node) +} + +func (c *cc) convertQueryNode(q dw.QueryNode) ast.Node { + switch n := q.(type) { + case *dw.SelectNode: + return c.convertSelectNode(n) + case *dw.SetOperationNode: + return c.convertSetOperationNode(n) + case *dw.RecursiveCTENode: + return c.convertRecursiveCTENode(n) + default: + return todo(q) + } +} + +// applyModifiers folds a query node's result modifiers — ORDER BY, LIMIT, +// DISTINCT — into the converted statement. +func (c *cc) applyModifiers(stmt *ast.SelectStmt, mods []dw.ResultModifier) { + for _, mod := range mods { + switch m := mod.(type) { + case *dw.OrderModifier: + stmt.SortClause = c.convertOrderBys(m.Orders) + case *dw.LimitModifier: + // LIMIT n% has no row-count equivalent, but its OFFSET counts rows. + if m.Limit != nil && m.LimitType != dw.LimitPercentage { + stmt.LimitCount = c.convertExpr(m.Limit) + } + if m.Offset != nil { + stmt.LimitOffset = c.convertExpr(m.Offset) + } + case *dw.DistinctModifier: + stmt.DistinctClause = &ast.List{} + for _, target := range m.DistinctOnTargets { + stmt.DistinctClause.Items = append(stmt.DistinctClause.Items, c.convertExpr(target)) + } + } + } +} + +func (c *cc) convertWithClause(ctes dw.CTEMap) *ast.WithClause { + if len(ctes.Entries) == 0 { + return nil + } + with := &ast.WithClause{Ctes: &ast.List{}} + for _, entry := range ctes.Entries { + cte := entry.CTE + name := identifier(entry.Name) + item := &ast.CommonTableExpr{ + Ctename: &name, + Ctequery: c.convertQueryNode(cte.Query), + Location: c.loc(cte), + } + // A recursive CTE parses into its own query node. + if _, ok := cte.Query.(*dw.RecursiveCTENode); ok { + with.Recursive = true + item.Cterecursive = true + } + if len(cte.Aliases) > 0 { + item.Aliascolnames = &ast.List{} + for _, alias := range cte.Aliases { + item.Aliascolnames.Items = append(item.Aliascolnames.Items, NewIdentifier(alias)) + } + } + with.Ctes.Items = append(with.Ctes.Items, item) + } + return with +} + +// isBareStar reports a plain "*" projection with no modifiers, the select +// list darkwing synthesizes when desugaring VALUES into a select. +func isBareStar(exprs []dw.Expr) bool { + if len(exprs) != 1 { + return false + } + star, ok := exprs[0].(*dw.StarExpression) + return ok && star.RelationName == "" && !star.Columns && star.Expr == nil && + len(star.ExcludeList) == 0 && len(star.QualifiedExcludeList) == 0 && + len(star.ReplaceList) == 0 && len(star.RenameList) == 0 +} + +func (c *cc) convertValuesLists(values [][]dw.Expr) *ast.List { + lists := &ast.List{} + for _, row := range values { + rowList := &ast.List{} + for _, val := range row { + rowList.Items = append(rowList.Items, c.convertExpr(val)) + } + lists.Items = append(lists.Items, rowList) + } + return lists +} + +func (c *cc) convertSelectNode(n *dw.SelectNode) ast.Node { + stmt := &ast.SelectStmt{} + + stmt.WithClause = c.convertWithClause(n.CTEs) + + // VALUES (...), (...) parses as SELECT * FROM an expression list. + if list, ok := n.FromTable.(*dw.ExpressionListRef); ok && isBareStar(n.SelectList) { + stmt.ValuesLists = c.convertValuesLists(list.Values) + c.applyModifiers(stmt, n.Modifiers) + return stmt + } + + if len(n.SelectList) > 0 { + stmt.TargetList = &ast.List{} + for _, expr := range n.SelectList { + stmt.TargetList.Items = append(stmt.TargetList.Items, c.convertResTarget(expr)) + } + } + + if from := c.convertTableRef(n.FromTable); from != nil { + stmt.FromClause = &ast.List{Items: []ast.Node{from}} + } + + if n.Where != nil { + stmt.WhereClause = c.convertExpr(n.Where) + } + + if len(n.GroupExpressions) > 0 { + stmt.GroupClause = &ast.List{} + for _, expr := range n.GroupExpressions { + stmt.GroupClause.Items = append(stmt.GroupClause.Items, c.convertExpr(expr)) + } + } + + if n.Having != nil { + stmt.HavingClause = c.convertExpr(n.Having) + } + + c.applyModifiers(stmt, n.Modifiers) + return stmt +} + +func (c *cc) convertSetOperationNode(n *dw.SetOperationNode) ast.Node { + var op ast.SetOperation + switch n.SetOpType { + case dw.SetOpUnion, dw.SetOpUnionByName: + op = ast.Union + case dw.SetOpExcept: + op = ast.Except + case dw.SetOpIntersect: + op = ast.Intersect + default: + return todo(n) + } + + // DuckDB v2 set operations are n-ary; sqlc's are binary, so a chain + // folds left-associatively. + var stmt *ast.SelectStmt + for _, input := range n.Inputs { + arg, ok := c.convertQueryNode(input).(*ast.SelectStmt) + if !ok { + return todo(n) + } + if stmt == nil { + stmt = arg + continue + } + stmt = &ast.SelectStmt{ + Op: op, + All: n.SetOpAll, + Larg: stmt, + Rarg: arg, + } + } + if stmt == nil { + return todo(n) + } + stmt.WithClause = c.convertWithClause(n.CTEs) + c.applyModifiers(stmt, n.Modifiers) + return stmt +} + +func (c *cc) convertRecursiveCTENode(n *dw.RecursiveCTENode) ast.Node { + larg, ok := c.convertQueryNode(n.Left).(*ast.SelectStmt) + if !ok { + return todo(n) + } + rarg, ok := c.convertQueryNode(n.Right).(*ast.SelectStmt) + if !ok { + return todo(n) + } + stmt := &ast.SelectStmt{ + Op: ast.Union, + All: n.UnionAll, + Larg: larg, + Rarg: rarg, + } + c.applyModifiers(stmt, n.Modifiers) + return stmt +} + +func (c *cc) convertResTarget(expr dw.Expr) *ast.ResTarget { + res := &ast.ResTarget{ + Val: c.convertExpr(expr), + Location: c.loc(expr), + } + if alias := expr.GetAlias(); alias != "" { + name := identifier(alias) + res.Name = &name + } + return res +} + +func (c *cc) convertOrderBys(orders []dw.OrderByNode) *ast.List { + list := &ast.List{} + for _, order := range orders { + sortBy := &ast.SortBy{ + Node: c.convertExpr(order.Expression), + Location: c.loc(order.Expression), + } + switch order.Type { + case dw.OrderAscending: + sortBy.SortbyDir = ast.SortByDirAsc + case dw.OrderDescending: + sortBy.SortbyDir = ast.SortByDirDesc + default: + sortBy.SortbyDir = ast.SortByDirDefault + } + switch order.NullOrder { + case dw.NullsFirst: + sortBy.SortbyNulls = ast.SortByNullsFirst + case dw.NullsLast: + sortBy.SortbyNulls = ast.SortByNullsLast + default: + sortBy.SortbyNulls = ast.SortByNullsDefault + } + list.Items = append(list.Items, sortBy) + } + return list +} + +func (c *cc) convertAlias(name string, columns []string) *ast.Alias { + if name == "" && len(columns) == 0 { + return nil + } + aliasName := identifier(name) + alias := &ast.Alias{Aliasname: &aliasName} + if len(columns) > 0 { + alias.Colnames = &ast.List{} + for _, col := range columns { + alias.Colnames.Items = append(alias.Colnames.Items, NewIdentifier(col)) + } + } + return alias +} + +func (c *cc) convertRangeVar(catalog, schema, table, alias string, loc int) *ast.RangeVar { + name := parseTableName(catalog, schema, table) + rv := &ast.RangeVar{ + Relname: &name.Name, + Location: loc, + } + if name.Schema != "" { + rv.Schemaname = &name.Schema + } + if name.Catalog != "" { + rv.Catalogname = &name.Catalog + } + if alias != "" { + rv.Alias = c.convertAlias(alias, nil) + } + return rv +} + +func (c *cc) convertTableRef(ref dw.TableRef) ast.Node { + switch t := ref.(type) { + case nil, *dw.EmptyTableRef: + return nil + case *dw.BaseTableRef: + rv := c.convertRangeVar(t.CatalogName, t.SchemaName, t.TableName, "", c.loc(t)) + if alias := c.convertAlias(t.Alias, t.ColumnNameAlias); alias != nil { + rv.Alias = alias + } + return rv + case *dw.JoinRef: + return c.convertJoinRef(t) + case *dw.SubqueryRef: + return &ast.RangeSubselect{ + Subquery: c.convertSelectStatement(t.Subquery), + Alias: c.convertAlias(t.Alias, t.ColumnNameAlias), + } + case *dw.TableFunctionRef: + return c.convertTableFunctionRef(t) + case *dw.ExpressionListRef: + // A VALUES list used as a relation becomes a values subquery. + sub := &ast.RangeSubselect{ + Subquery: &ast.SelectStmt{ValuesLists: c.convertValuesLists(t.Values)}, + Alias: c.convertAlias(t.Alias, t.ExpectedNames), + } + return sub + default: + return todo(ref) + } +} + +func (c *cc) convertJoinRef(t *dw.JoinRef) ast.Node { + join := &ast.JoinExpr{ + Larg: c.convertTableRef(t.Left), + Rarg: c.convertTableRef(t.Right), + } + switch t.JoinType { + case dw.JoinLeft: + join.Jointype = ast.JoinTypeLeft + case dw.JoinRight: + join.Jointype = ast.JoinTypeRight + case dw.JoinFull: + join.Jointype = ast.JoinTypeFull + default: + join.Jointype = ast.JoinTypeInner + } + if t.RefType == dw.JoinRefNatural { + join.IsNatural = true + } + if t.Condition != nil { + join.Quals = c.convertExpr(t.Condition) + } + if len(t.UsingColumns) > 0 { + join.UsingClause = &ast.List{} + for _, col := range t.UsingColumns { + join.UsingClause.Items = append(join.UsingClause.Items, NewIdentifier(col)) + } + } + return join +} + +func (c *cc) convertTableFunctionRef(t *dw.TableFunctionRef) ast.Node { + call, ok := c.convertExpr(t.Function).(*ast.FuncCall) + if !ok { + return todo(t) + } + return &ast.RangeFunction{ + Functions: &ast.List{Items: []ast.Node{call}}, + Alias: c.convertAlias(t.Alias, t.ColumnNameAlias), + Ordinality: t.WithOrdinality, + } +} + +func (c *cc) convertExpr(expr dw.Expr) ast.Node { + if expr == nil { + return nil + } + switch e := expr.(type) { + case *dw.ColumnRefExpression: + return c.convertColumnRef(e) + case *dw.ConstantExpression: + return c.convertConstant(e) + case *dw.ParameterExpression: + return c.convertParameter(e) + case *dw.FunctionExpression: + return c.convertFunction(e) + case *dw.OperatorExpression: + return c.convertOperator(e) + case *dw.ComparisonExpression: + return c.convertComparison(e) + case *dw.ConjunctionExpression: + return c.convertConjunction(e) + case *dw.CastExpression: + return c.convertCast(e) + case *dw.CaseExpression: + return c.convertCase(e) + case *dw.BetweenExpression: + return &ast.BetweenExpr{ + Expr: c.convertExpr(e.Input), + Left: c.convertExpr(e.Lower), + Right: c.convertExpr(e.Upper), + Location: c.loc(e), + } + case *dw.SubqueryExpression: + return c.convertSubquery(e) + case *dw.StarExpression: + return c.convertStar(e) + case *dw.CollateExpression: + return &ast.CollateExpr{ + Arg: c.convertExpr(e.Child), + Location: c.loc(e), + } + case *dw.WindowExpression: + return c.convertWindow(e) + default: + return todo(expr) + } +} + +func (c *cc) convertColumnRef(e *dw.ColumnRefExpression) *ast.ColumnRef { + fields := &ast.List{} + for _, name := range e.ColumnNames { + fields.Items = append(fields.Items, NewIdentifier(name)) + } + return &ast.ColumnRef{ + Fields: fields, + Location: c.loc(e), + } +} + +// decimalString renders a decimal's unscaled digits with the point +// re-inserted, e.g. ("15", 1) => "1.5". +func decimalString(digits string, scale int) string { + neg := strings.HasPrefix(digits, "-") + if neg { + digits = digits[1:] + } + if scale > 0 { + for len(digits) <= scale { + digits = "0" + digits + } + digits = digits[:len(digits)-scale] + "." + digits[len(digits)-scale:] + } + if neg { + digits = "-" + digits + } + return digits +} + +func hugeintString(h dw.Hugeint) string { + v := new(big.Int).SetInt64(h.Upper) + v.Lsh(v, 64) + return v.Or(v, new(big.Int).SetUint64(h.Lower)).String() +} + +func (c *cc) convertConstant(e *dw.ConstantExpression) ast.Node { + v := e.Value + konst := &ast.A_Const{Location: c.loc(e)} + switch { + case v.IsNull || v.Kind == dw.ValueNull: + konst.Val = &ast.Null{} + case v.Kind == dw.ValueBool: + konst.Val = &ast.Boolean{Boolval: v.Bool} + case v.Kind == dw.ValueInt64 && v.Type.ID == "DECIMAL": + // A decimal literal carries its unscaled value. + konst.Val = &ast.Float{Str: decimalString(strconv.FormatInt(v.Int64, 10), v.Type.Scale)} + case v.Kind == dw.ValueInt64: + konst.Val = &ast.Integer{Ival: v.Int64} + case v.Kind == dw.ValueHugeint && v.Type.ID == "DECIMAL": + konst.Val = &ast.Float{Str: decimalString(hugeintString(v.Hugeint), v.Type.Scale)} + case v.Kind == dw.ValueHugeint: + konst.Val = &ast.Float{Str: hugeintString(v.Hugeint)} + case v.Kind == dw.ValueDouble: + konst.Val = &ast.Float{Str: strconv.FormatFloat(v.Float64, 'g', -1, 64)} + case v.Kind == dw.ValueString: + konst.Val = &ast.String{Str: v.Str} + default: + return todo(e) + } + return konst +} + +// convertParameter converts a prepared-statement parameter. darkwing has +// already numbered every spelling: explicit for $3 and ?3, in order of +// appearance for ?, and in order of first use for $name. +func (c *cc) convertParameter(e *dw.ParameterExpression) ast.Node { + return &ast.ParamRef{ + Number: e.Number, + Dollar: e.Kind == dw.ParameterNumbered || e.Kind == dw.ParameterNamed, + Location: c.loc(e), + } +} + +func (c *cc) convertFunction(e *dw.FunctionExpression) ast.Node { + name := identifier(e.FunctionName) + + // Binary and prefix operators parse as operator-named functions. + if e.IsOperator { + switch len(e.Arguments) { + case 1: + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: e.FunctionName}}}, + Rexpr: c.convertExpr(e.Arguments[0].Expr), + Location: c.loc(e), + } + case 2: + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: e.FunctionName}}}, + Lexpr: c.convertExpr(e.Arguments[0].Expr), + Rexpr: c.convertExpr(e.Arguments[1].Expr), + Location: c.loc(e), + } + default: + return todo(e) + } + } + + fc := &ast.FuncCall{ + Funcname: &ast.List{}, + Location: c.loc(e), + AggDistinct: e.Distinct, + } + if schema := schemaName(e.Schema); schema != "" { + fc.Funcname.Items = append(fc.Funcname.Items, &ast.String{Str: schema}) + } + + // COUNT(*) parses as the argument-less count_star. + if name == "count_star" { + fc.Funcname.Items = append(fc.Funcname.Items, &ast.String{Str: "count"}) + fc.AggStar = true + return fc + } + fc.Funcname.Items = append(fc.Funcname.Items, &ast.String{Str: name}) + + for _, arg := range e.Arguments { + if fc.Args == nil { + fc.Args = &ast.List{} + } + fc.Args.Items = append(fc.Args.Items, c.convertExpr(arg.Expr)) + } + if e.Filter != nil { + fc.AggFilter = c.convertExpr(e.Filter) + } + if len(e.OrderBys) > 0 { + fc.AggOrder = c.convertOrderBys(e.OrderBys) + } + return fc +} + +func (c *cc) convertOperator(e *dw.OperatorExpression) ast.Node { + switch e.Type { + case dw.OperatorNot: + // NOT IN parses as NOT wrapping an IN. + if len(e.Operands) == 1 { + if in, ok := e.Operands[0].(*dw.OperatorExpression); ok && in.Type == dw.CompareIn { + node := c.convertIn(in) + node.Not = true + return node + } + } + return c.convertBoolExpr(ast.BoolExprTypeNot, e) + case dw.OperatorIsNull, dw.OperatorIsNotNull: + if len(e.Operands) != 1 { + return todo(e) + } + test := ast.NullTestTypeIsNull + if e.Type == dw.OperatorIsNotNull { + test = ast.NullTestTypeIsNotNull + } + return &ast.NullTest{ + Arg: c.convertExpr(e.Operands[0]), + Nulltesttype: test, + Location: c.loc(e), + } + case dw.CompareIn, dw.CompareNotIn: + node := c.convertIn(e) + node.Not = e.Type == dw.CompareNotIn + return node + case dw.OperatorCoalesce: + coalesce := &ast.CoalesceExpr{ + Args: &ast.List{}, + Location: c.loc(e), + } + for _, operand := range e.Operands { + coalesce.Args.Items = append(coalesce.Args.Items, c.convertExpr(operand)) + } + return coalesce + case dw.ArrayConstructor: + arr := &ast.A_ArrayExpr{ + Elements: &ast.List{}, + Location: c.loc(e), + } + for _, operand := range e.Operands { + arr.Elements.Items = append(arr.Elements.Items, c.convertExpr(operand)) + } + return arr + default: + return todo(e) + } +} + +func (c *cc) convertIn(e *dw.OperatorExpression) *ast.In { + in := &ast.In{Location: c.loc(e)} + if len(e.Operands) > 0 { + in.Expr = c.convertExpr(e.Operands[0]) + for _, item := range e.Operands[1:] { + in.List = append(in.List, c.convertExpr(item)) + } + } + return in +} + +func (c *cc) convertBoolExpr(op ast.BoolExprType, e *dw.OperatorExpression) ast.Node { + expr := &ast.BoolExpr{ + Boolop: op, + Args: &ast.List{}, + Location: c.loc(e), + } + for _, operand := range e.Operands { + expr.Args.Items = append(expr.Args.Items, c.convertExpr(operand)) + } + return expr +} + +func comparisonOperator(t dw.ExpressionType) (string, bool) { + switch t { + case dw.CompareEqual: + return "=", true + case dw.CompareNotEqual: + return "<>", true + case dw.CompareLessThan: + return "<", true + case dw.CompareGreaterThan: + return ">", true + case dw.CompareLessThanOrEqual: + return "<=", true + case dw.CompareGreaterThanOrEqual: + return ">=", true + } + return "", false +} + +func (c *cc) convertComparison(e *dw.ComparisonExpression) ast.Node { + kind := ast.A_Expr_Kind_OP + op, ok := comparisonOperator(e.Type) + if !ok { + switch e.Type { + case dw.CompareDistinctFrom: + kind, op = ast.A_Expr_Kind_DISTINCT, "=" + case dw.CompareNotDistinctFrom: + kind, op = ast.A_Expr_Kind_NOT_DISTINCT, "=" + default: + return todo(e) + } + } + return &ast.A_Expr{ + Kind: kind, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: op}}}, + Lexpr: c.convertExpr(e.Left), + Rexpr: c.convertExpr(e.Right), + Location: c.loc(e), + } +} + +func (c *cc) convertConjunction(e *dw.ConjunctionExpression) ast.Node { + boolop := ast.BoolExprTypeAnd + if e.Type == dw.ConjunctionOr { + boolop = ast.BoolExprTypeOr + } + expr := &ast.BoolExpr{ + Boolop: boolop, + Args: &ast.List{}, + Location: c.loc(e), + } + for _, operand := range e.Operands { + expr.Args.Items = append(expr.Args.Items, c.convertExpr(operand)) + } + return expr +} + +func (c *cc) convertCast(e *dw.CastExpression) ast.Node { + cast := &ast.TypeCast{ + Arg: c.convertExpr(e.Child), + Location: c.loc(e), + } + switch { + case e.CastType != nil: + typeName, arrayDims := c.convertTypeExpression(e.CastType) + if arrayDims > 0 { + typeName.ArrayBounds = &ast.List{} + for i := 0; i < arrayDims; i++ { + typeName.ArrayBounds.Items = append(typeName.ArrayBounds.Items, &ast.Integer{Ival: -1}) + } + } + cast.TypeName = typeName + case e.ResolvedType != "": + cast.TypeName = &ast.TypeName{Name: identifier(e.ResolvedType)} + default: + return todo(e) + } + return cast +} + +func (c *cc) convertCase(e *dw.CaseExpression) ast.Node { + caseExpr := &ast.CaseExpr{ + Args: &ast.List{}, + Location: c.loc(e), + } + for _, check := range e.CaseChecks { + caseExpr.Args.Items = append(caseExpr.Args.Items, &ast.CaseWhen{ + Expr: c.convertExpr(check.When), + Result: c.convertExpr(check.Then), + }) + } + if e.ElseExpr != nil { + caseExpr.Defresult = c.convertExpr(e.ElseExpr) + } + return caseExpr +} + +func (c *cc) convertSubquery(e *dw.SubqueryExpression) ast.Node { + link := &ast.SubLink{ + Subselect: c.convertSelectStatement(e.Subquery), + Location: c.loc(e), + } + switch e.SubqueryType { + case dw.SubqueryExists: + link.SubLinkType = ast.EXISTS_SUBLINK + case dw.SubqueryScalar: + link.SubLinkType = ast.EXPR_SUBLINK + case dw.SubqueryAny: + // x IN (SELECT ...) and quantified comparisons desugar to ANY. + link.SubLinkType = ast.ANY_SUBLINK + link.Testexpr = c.convertExpr(e.Child) + if op, ok := comparisonOperator(e.ComparisonType); ok { + link.OperName = &ast.List{Items: []ast.Node{&ast.String{Str: op}}} + } + default: + return todo(e) + } + return link +} + +func (c *cc) convertStar(e *dw.StarExpression) ast.Node { + // COLUMNS(...) and EXCLUDE/REPLACE/RENAME modifiers have no equivalent. + if e.Columns || e.Expr != nil || len(e.ExcludeList) > 0 || + len(e.QualifiedExcludeList) > 0 || len(e.ReplaceList) > 0 || len(e.RenameList) > 0 { + return todo(e) + } + fields := &ast.List{} + if e.RelationName != "" { + fields.Items = append(fields.Items, NewIdentifier(e.RelationName)) + } + fields.Items = append(fields.Items, &ast.A_Star{}) + return &ast.ColumnRef{ + Fields: fields, + Location: c.loc(e), + } +} + +func (c *cc) convertWindow(e *dw.WindowExpression) ast.Node { + fc := &ast.FuncCall{ + Funcname: &ast.List{Items: []ast.Node{&ast.String{Str: identifier(e.FunctionName)}}}, + Location: c.loc(e), + AggDistinct: e.Distinct, + Over: &ast.WindowDef{Location: c.loc(e)}, + } + for _, arg := range e.Arguments { + if fc.Args == nil { + fc.Args = &ast.List{} + } + fc.Args.Items = append(fc.Args.Items, c.convertExpr(arg.Expr)) + } + if e.FilterExpr != nil { + fc.AggFilter = c.convertExpr(e.FilterExpr) + } + if len(e.Partitions) > 0 { + fc.Over.PartitionClause = &ast.List{} + for _, p := range e.Partitions { + fc.Over.PartitionClause.Items = append(fc.Over.PartitionClause.Items, c.convertExpr(p)) + } + } + if len(e.Orders) > 0 { + fc.Over.OrderClause = c.convertOrderBys(e.Orders) + } + return fc +} + +// convertTypeExpression maps an unbound DuckDB type to a sqlc type name and +// the number of list/array dimensions wrapped around it, which is what the +// legacy catalog reads. The whole type — its arguments, a struct's fields, +// a map's key and value, the nesting of a list of lists — goes along as +// its spelling, which is what the analysis core reads. +func (c *cc) convertTypeExpression(t *dw.TypeExpression) (*ast.TypeName, int) { + typeName, dims := c.elementTypeName(t) + typeName.Canonical = renderTypeExpression(t) + return typeName, dims +} + +func (c *cc) elementTypeName(t *dw.TypeExpression) (*ast.TypeName, int) { + name := identifier(t.TypeName) + switch name { + case "list", "array": + // int[] is LIST(INTEGER); int[3] is ARRAY(INTEGER, 3). + if len(t.Args) > 0 { + if elem, ok := t.Args[0].(*dw.TypeExpression); ok { + typeName, dims := c.elementTypeName(elem) + return typeName, dims + 1 + } + } + } + return &ast.TypeName{ + Schema: schemaName(t.Schema), + Name: name, + }, 0 +} + +// renderTypeExpression spells a type as a call expression the core reads: +// a list is array applied to its element, a fixed-size array carries its +// size, a struct's or union's fields are labelled, and a constant argument +// is written as it was. +func renderTypeExpression(t *dw.TypeExpression) string { + name := identifier(t.TypeName) + if schema := schemaName(t.Schema); schema != "" { + name = schema + "." + name + } + if name == "list" { + name = "array" + } + if len(t.Args) == 0 { + return name + } + parts := make([]string, 0, len(t.Args)) + for _, arg := range t.Args { + var part string + switch a := arg.(type) { + case *dw.TypeExpression: + part = renderTypeExpression(a) + if a.Alias != "" { + part = identifier(a.Alias) + ": " + part + } + case *dw.ConstantExpression: + switch { + case a.Value.Str != "": + part = "'" + strings.ReplaceAll(a.Value.Str, "'", "''") + "'" + default: + part = strconv.FormatInt(a.Value.Int64, 10) + } + default: + continue + } + parts = append(parts, part) + } + return name + "(" + strings.Join(parts, ", ") + ")" +} + +func (c *cc) convertReturning(returning []dw.Expr) *ast.List { + if len(returning) == 0 { + return nil + } + list := &ast.List{} + for _, expr := range returning { + list.Items = append(list.Items, c.convertResTarget(expr)) + } + return list +} + +func (c *cc) convertInsertStatement(n *dw.InsertStatement) ast.Node { + stmt := &ast.InsertStmt{ + Relation: c.convertRangeVar(n.Catalog, n.Schema, n.Table, n.TableAlias, c.loc(n)), + WithClause: c.convertWithClause(n.CTEs), + DefaultValues: n.DefaultValues, + } + + if len(n.Columns) > 0 { + stmt.Cols = &ast.List{} + for _, col := range n.Columns { + name := identifier(col) + stmt.Cols.Items = append(stmt.Cols.Items, &ast.ResTarget{Name: &name}) + } + } + + if n.Query != nil { + stmt.SelectStmt = c.convertSelectStatement(n.Query) + } + + if n.OnConflict != nil { + stmt.OnConflictClause = c.convertOnConflict(n.OnConflict) + } + + stmt.ReturningList = c.convertReturning(n.Returning) + return stmt +} + +func (c *cc) convertOnConflict(n *dw.OnConflictInfo) *ast.OnConflictClause { + clause := &ast.OnConflictClause{Location: c.loc(n)} + switch n.Action { + case dw.OnConflictUpdate: + clause.Action = ast.OnConflictActionUpdate + default: + clause.Action = ast.OnConflictActionNothing + } + if n.SetInfo != nil { + clause.TargetList = c.convertSetClause(n.SetInfo) + if n.SetInfo.Condition != nil { + clause.WhereClause = c.convertExpr(n.SetInfo.Condition) + } + } + return clause +} + +func (c *cc) convertSetClause(set *dw.UpdateSetInfo) *ast.List { + list := &ast.List{} + for i, col := range set.Columns { + if len(col) == 0 || i >= len(set.Expressions) { + continue + } + name := identifier(col[len(col)-1]) + list.Items = append(list.Items, &ast.ResTarget{ + Name: &name, + Val: c.convertExpr(set.Expressions[i]), + }) + } + return list +} + +func (c *cc) convertUpdateStatement(n *dw.UpdateStatement) ast.Node { + target := c.convertTableRef(n.Table) + if target == nil { + return todo(n) + } + stmt := &ast.UpdateStmt{ + Relations: &ast.List{Items: []ast.Node{target}}, + TargetList: &ast.List{}, + WithClause: c.convertWithClause(n.CTEs), + } + if n.SetInfo != nil { + stmt.TargetList = c.convertSetClause(n.SetInfo) + } + if from := c.convertTableRef(n.From); from != nil { + stmt.FromClause = &ast.List{Items: []ast.Node{from}} + } + if n.Where != nil { + stmt.WhereClause = c.convertExpr(n.Where) + } + stmt.ReturningList = c.convertReturning(n.Returning) + return stmt +} + +func (c *cc) convertDeleteStatement(n *dw.DeleteStatement) ast.Node { + target := c.convertTableRef(n.Table) + if target == nil { + return todo(n) + } + stmt := &ast.DeleteStmt{ + Relations: &ast.List{Items: []ast.Node{target}}, + WithClause: c.convertWithClause(n.CTEs), + } + if len(n.Using) > 0 { + stmt.UsingClause = &ast.List{} + for _, using := range n.Using { + if item := c.convertTableRef(using); item != nil { + stmt.UsingClause.Items = append(stmt.UsingClause.Items, item) + } + } + } + if n.Where != nil { + stmt.WhereClause = c.convertExpr(n.Where) + } + stmt.ReturningList = c.convertReturning(n.Returning) + return stmt +} + +func (c *cc) convertTruncateStatement(n *dw.TruncateStatement) ast.Node { + target := c.convertTableRef(n.Table) + if target == nil { + return todo(n) + } + return &ast.TruncateStmt{ + Relations: &ast.List{Items: []ast.Node{target}}, + } +} + +func (c *cc) convertCreateStatement(n *dw.CreateStatement) ast.Node { + switch info := n.Info.(type) { + case *dw.CreateTableInfo: + return c.convertCreateTableInfo(info) + case *dw.CreateViewInfo: + return c.convertCreateViewInfo(info) + case *dw.CreateTypeInfo: + return c.convertCreateTypeInfo(info) + default: + return todo(n) + } +} + +func (c *cc) convertCreateTableInfo(info *dw.CreateTableInfo) ast.Node { + name := parseTableName(info.Catalog, info.Schema, info.Name) + + // CREATE TABLE ... AS records the table as a relation defined by its + // query, like a view. + if info.Query != nil { + into := &ast.IntoClause{ + Rel: c.convertRangeVar(info.Catalog, info.Schema, info.Name, "", c.loc(info)), + } + if len(info.QueryAliases) > 0 { + into.ColNames = &ast.List{} + for _, alias := range info.QueryAliases { + into.ColNames.Items = append(into.ColNames.Items, NewIdentifier(alias)) + } + } + return &ast.CreateTableAsStmt{ + Query: c.convertSelectStatement(info.Query), + Into: into, + IfNotExists: info.OnConflict == dw.CreateIgnore, + } + } + + stmt := &ast.CreateTableStmt{ + Name: name, + IfNotExists: info.OnConflict == dw.CreateIgnore, + } + + // Column names in table-level PRIMARY KEY constraints are NOT NULL. + primaryKey := map[string]bool{} + for _, constraint := range info.Constraints { + unique, ok := constraint.(*dw.UniqueConstraint) + if !ok || !unique.IsPrimaryKey { + continue + } + for _, col := range unique.Columns { + primaryKey[identifier(col)] = true + } + } + + declaresRowid := false + for i := range info.Columns { + def := c.convertColumnDef(&info.Columns[i], primaryKey) + declaresRowid = declaresRowid || def.Colname == "rowid" + stmt.Cols = append(stmt.Cols, def) + } + + // Every base table also offers a rowid pseudo-column, a nullable BIGINT + // that a query can select, filter on and order by. A column the table + // declares under that name takes its place. Hidden keeps it out of star + // expansions and the table's model. + if !declaresRowid { + stmt.Cols = append(stmt.Cols, &ast.ColumnDef{ + Colname: "rowid", + IsHidden: true, + TypeName: &ast.TypeName{Name: "bigint"}, + }) + } + return stmt +} + +func (c *cc) convertColumnDef(col *dw.ColumnDef, tablePrimaryKey map[string]bool) *ast.ColumnDef { + name := "" + if len(col.Names) > 0 { + name = identifier(col.Names[len(col.Names)-1]) + } + def := &ast.ColumnDef{ + Colname: name, + Location: c.loc(col), + } + if col.Type != nil { + typeName, arrayDims := c.convertTypeExpression(col.Type) + def.TypeName = typeName + def.ArrayDims = arrayDims + def.IsArray = arrayDims > 0 + } else { + // A generated column may omit its type; DuckDB infers it at bind + // time. + def.TypeName = &ast.TypeName{Name: "any"} + } + for _, constraint := range col.Constraints { + switch con := constraint.(type) { + case *dw.NotNullConstraint: + def.IsNotNull = !con.Null + case *dw.UniqueConstraint: + if con.IsPrimaryKey { + def.PrimaryKey = true + def.IsNotNull = true + } + } + } + if tablePrimaryKey[name] { + def.PrimaryKey = true + def.IsNotNull = true + } + return def +} + +func (c *cc) convertCreateViewInfo(info *dw.CreateViewInfo) ast.Node { + stmt := &ast.ViewStmt{ + View: c.convertRangeVar(info.Catalog, info.Schema, info.Name, "", c.loc(info)), + Query: c.convertSelectStatement(info.Query), + Replace: info.OnConflict == dw.CreateReplace, + } + if len(info.Aliases) > 0 { + stmt.Aliases = &ast.List{} + for _, alias := range info.Aliases { + stmt.Aliases.Items = append(stmt.Aliases.Items, NewIdentifier(alias)) + } + } + return stmt +} + +func (c *cc) convertCreateTypeInfo(info *dw.CreateTypeInfo) ast.Node { + if !info.IsEnum { + return todo(info) + } + stmt := &ast.CreateEnumStmt{ + TypeName: &ast.TypeName{ + Schema: schemaName(info.Schema), + Name: identifier(info.Name), + }, + Vals: &ast.List{}, + } + for _, val := range info.EnumValues { + stmt.Vals.Items = append(stmt.Vals.Items, &ast.String{Str: val}) + } + return stmt +} + +func (c *cc) convertDropStatement(n *dw.DropStatement) ast.Node { + switch n.DropType { + case dw.DropTable, dw.DropView: + stmt := &ast.DropTableStmt{IfExists: n.IfExists} + for _, name := range n.Names { + stmt.Tables = append(stmt.Tables, parseTableName(name.Catalog, name.Schema, name.Name)) + } + return stmt + default: + return todo(n) + } +} + +func (c *cc) convertAlterStatement(n *dw.AlterStatement) ast.Node { + if n.Entity != dw.AlterEntityTable { + return todo(n) + } + table := parseTableName(n.Name.Catalog, n.Name.Schema, n.Name.Name) + + var stmts []ast.Node + alter := &ast.AlterTableStmt{ + Table: table, + Cmds: &ast.List{}, + MissingOk: n.IfExists, + } + for _, action := range n.Actions { + switch a := action.(type) { + case *dw.AddColumnInfo: + def := c.convertColumnDef(&a.Column, nil) + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &def.Colname, + Subtype: ast.AT_AddColumn, + Def: def, + MissingOk: a.IfNotExists, + }) + case *dw.DropColumnInfo: + if len(a.Column) == 0 { + continue + } + name := identifier(a.Column[len(a.Column)-1]) + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_DropColumn, + MissingOk: a.IfExists, + }) + case *dw.AlterColumnTypeInfo: + if len(a.Column) == 0 || a.Type == nil { + continue + } + name := identifier(a.Column[len(a.Column)-1]) + typeName, arrayDims := c.convertTypeExpression(a.Type) + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_AlterColumnType, + Def: &ast.ColumnDef{ + Colname: name, + TypeName: typeName, + ArrayDims: arrayDims, + IsArray: arrayDims > 0, + }, + }) + case *dw.SetNotNullInfo: + if len(a.Column) == 0 { + continue + } + name := identifier(a.Column[len(a.Column)-1]) + subtype := ast.AT_SetNotNull + if a.Drop { + subtype = ast.AT_DropNotNull + } + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: subtype, + }) + case *dw.RenameColumnInfo: + if len(a.Column) == 0 { + continue + } + newName := identifier(a.NewName) + stmts = append(stmts, &ast.RenameColumnStmt{ + Table: table, + Col: &ast.ColumnRef{ + Name: identifier(a.Column[len(a.Column)-1]), + }, + NewName: &newName, + MissingOk: n.IfExists, + }) + case *dw.RenameInfo: + newName := identifier(a.NewName) + stmts = append(stmts, &ast.RenameTableStmt{ + Table: table, + NewName: &newName, + MissingOk: n.IfExists, + }) + } + } + + if len(alter.Cmds.Items) > 0 { + stmts = append(stmts, alter) + } + switch len(stmts) { + case 0: + return todo(n) + case 1: + return stmts[0] + default: + return &ast.List{Items: stmts} + } +} diff --git a/internal/engine/duckdb/dialect/dialect.json b/internal/engine/duckdb/dialect/dialect.json new file mode 100644 index 0000000000..061007b611 --- /dev/null +++ b/internal/engine/duckdb/dialect/dialect.json @@ -0,0 +1,26 @@ +{ + "dialect": "duckdb", + "default_schema": "main", + "const": { + "integer": "integer", + "float": "double", + "string": "varchar", + "bool": "boolean" + }, + "bool": "boolean", + "comparison": ["=", "==", "<>", "!=", "<", "<=", ">", ">=", "IS DISTINCT FROM", "IS NOT DISTINCT FROM"], + "comparison_categories": "BNSDU", + "arithmetic": ["+", "-", "*", "/", "//", "%", "**", "^"], + "arithmetic_categories": "N", + "cast_categories": "NSD", + "rewrites": [ + { + "from": "varchar($1)", + "to": "varchar" + }, + { + "from": "decimal", + "to": "decimal(18, 3)" + } + ] +} diff --git a/internal/engine/duckdb/dialect/functions.jsonl b/internal/engine/duckdb/dialect/functions.jsonl new file mode 100644 index 0000000000..84ac52aa49 --- /dev/null +++ b/internal/engine/duckdb/dialect/functions.jsonl @@ -0,0 +1,2647 @@ +{"name":"__between","args":[{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"boolean"} +{"name":"__cast","args":[{"type":"any"}],"returns":"any"} +{"name":"__internal_barrier","args":[{"type":"any"}],"returns":"any"} +{"name":"__internal_compress_geometry_point","args":[{"type":"geometry"}],"returns":"uhugeint"} +{"name":"__internal_compress_integral_ubigint","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"ubigint"} +{"name":"__internal_compress_integral_ubigint","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"ubigint"} +{"name":"__internal_compress_integral_uinteger","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"uinteger"} +{"name":"__internal_compress_integral_uinteger","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"uinteger"} +{"name":"__internal_compress_integral_uinteger","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"uinteger"} +{"name":"__internal_compress_integral_uinteger","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"uinteger"} +{"name":"__internal_compress_integral_usmallint","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"usmallint"} +{"name":"__internal_compress_integral_usmallint","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"usmallint"} +{"name":"__internal_compress_integral_usmallint","args":[{"type":"integer"},{"type":"integer"}],"returns":"usmallint"} +{"name":"__internal_compress_integral_usmallint","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"usmallint"} +{"name":"__internal_compress_integral_usmallint","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"usmallint"} +{"name":"__internal_compress_integral_usmallint","args":[{"type":"uinteger"},{"type":"uinteger"}],"returns":"usmallint"} +{"name":"__internal_compress_integral_utinyint","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"utinyint"} +{"name":"__internal_compress_integral_utinyint","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"utinyint"} +{"name":"__internal_compress_integral_utinyint","args":[{"type":"integer"},{"type":"integer"}],"returns":"utinyint"} +{"name":"__internal_compress_integral_utinyint","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"utinyint"} +{"name":"__internal_compress_integral_utinyint","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"utinyint"} +{"name":"__internal_compress_integral_utinyint","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"utinyint"} +{"name":"__internal_compress_integral_utinyint","args":[{"type":"uinteger"},{"type":"uinteger"}],"returns":"utinyint"} +{"name":"__internal_compress_integral_utinyint","args":[{"type":"usmallint"},{"type":"usmallint"}],"returns":"utinyint"} +{"name":"__internal_compress_string_hugeint","args":[{"type":"varchar"}],"returns":"hugeint"} +{"name":"__internal_compress_string_ubigint","args":[{"type":"varchar"}],"returns":"ubigint"} +{"name":"__internal_compress_string_uhugeint","args":[{"type":"varchar"}],"returns":"uhugeint"} +{"name":"__internal_compress_string_uinteger","args":[{"type":"varchar"}],"returns":"uinteger"} +{"name":"__internal_compress_string_usmallint","args":[{"type":"varchar"}],"returns":"usmallint"} +{"name":"__internal_compress_string_utinyint","args":[{"type":"varchar"}],"returns":"utinyint"} +{"name":"__internal_decompress_geometry_point","args":[{"type":"uhugeint"}],"returns":"geometry"} +{"name":"__internal_decompress_integral_bigint","args":[{"type":"uinteger"},{"type":"bigint"}],"returns":"bigint"} +{"name":"__internal_decompress_integral_bigint","args":[{"type":"usmallint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"__internal_decompress_integral_bigint","args":[{"type":"utinyint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"__internal_decompress_integral_hugeint","args":[{"type":"ubigint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"__internal_decompress_integral_hugeint","args":[{"type":"uinteger"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"__internal_decompress_integral_hugeint","args":[{"type":"usmallint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"__internal_decompress_integral_hugeint","args":[{"type":"utinyint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"__internal_decompress_integral_integer","args":[{"type":"usmallint"},{"type":"integer"}],"returns":"integer"} +{"name":"__internal_decompress_integral_integer","args":[{"type":"utinyint"},{"type":"integer"}],"returns":"integer"} +{"name":"__internal_decompress_integral_smallint","args":[{"type":"utinyint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"__internal_decompress_integral_ubigint","args":[{"type":"uinteger"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"__internal_decompress_integral_ubigint","args":[{"type":"usmallint"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"__internal_decompress_integral_ubigint","args":[{"type":"utinyint"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"__internal_decompress_integral_uhugeint","args":[{"type":"ubigint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"__internal_decompress_integral_uhugeint","args":[{"type":"uinteger"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"__internal_decompress_integral_uhugeint","args":[{"type":"usmallint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"__internal_decompress_integral_uhugeint","args":[{"type":"utinyint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"__internal_decompress_integral_uinteger","args":[{"type":"usmallint"},{"type":"uinteger"}],"returns":"uinteger"} +{"name":"__internal_decompress_integral_uinteger","args":[{"type":"utinyint"},{"type":"uinteger"}],"returns":"uinteger"} +{"name":"__internal_decompress_integral_usmallint","args":[{"type":"utinyint"},{"type":"usmallint"}],"returns":"usmallint"} +{"name":"__internal_decompress_string","args":[{"type":"hugeint"}],"returns":"varchar"} +{"name":"__internal_decompress_string","args":[{"type":"ubigint"}],"returns":"varchar"} +{"name":"__internal_decompress_string","args":[{"type":"uhugeint"}],"returns":"varchar"} +{"name":"__internal_decompress_string","args":[{"type":"uinteger"}],"returns":"varchar"} +{"name":"__internal_decompress_string","args":[{"type":"usmallint"}],"returns":"varchar"} +{"name":"__internal_decompress_string","args":[{"type":"utinyint"}],"returns":"varchar"} +{"name":"__internal_json_copy_to_geojson","args":[{"type":"any"},{"type":"varchar"},{"type":"varchar"},{"type":"varchar"},{"type":"varchar"},{"type":"boolean"}],"returns":"json"} +{"name":"__internal_json_copy_to_json","args":[{"type":"any"},{"type":"varchar"},{"type":"varchar"}],"returns":"json"} +{"name":"__internal_tablefilter_bloom_filter","args":[{"type":"any"}],"returns":"boolean"} +{"name":"__internal_tablefilter_dynamic","args":[{"type":"any"}],"returns":"boolean"} +{"name":"__internal_tablefilter_optional","args":[{"type":"any"}],"returns":"boolean"} +{"name":"__internal_tablefilter_prefix_range","args":[{"type":"any"}],"returns":"boolean"} +{"name":"__internal_tablefilter_selectivity_optional","args":[{"type":"any"}],"returns":"boolean"} +{"name":"abs","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"abs","args":[{"type":"decimal"}],"returns":"decimal"} +{"name":"abs","args":[{"type":"double"}],"returns":"double"} +{"name":"abs","args":[{"type":"float"}],"returns":"float"} +{"name":"abs","args":[{"type":"hugeint"}],"returns":"hugeint"} +{"name":"abs","args":[{"type":"integer"}],"returns":"integer"} +{"name":"abs","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"abs","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"abs","args":[{"type":"ubigint"}],"returns":"ubigint"} +{"name":"abs","args":[{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"abs","args":[{"type":"uinteger"}],"returns":"uinteger"} +{"name":"abs","args":[{"type":"usmallint"}],"returns":"usmallint"} +{"name":"abs","args":[{"type":"utinyint"}],"returns":"utinyint"} +{"name":"acos","args":[{"type":"double"}],"returns":"double"} +{"name":"acosh","args":[{"type":"double"}],"returns":"double"} +{"name":"add","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"add","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"add","args":[{"type":"bignum"},{"type":"bignum"}],"returns":"bignum"} +{"name":"add","args":[{"type":"date"},{"type":"integer"}],"returns":"date"} +{"name":"add","args":[{"type":"date"},{"type":"interval"}],"returns":"timestamp"} +{"name":"add","args":[{"type":"date"},{"type":"time with time zone"}],"returns":"timestamp with time zone"} +{"name":"add","args":[{"type":"date"},{"type":"time"}],"returns":"timestamp"} +{"name":"add","args":[{"type":"decimal"},{"type":"decimal"}],"returns":"decimal"} +{"name":"add","args":[{"type":"decimal"}],"returns":"decimal"} +{"name":"add","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"add","args":[{"type":"double"}],"returns":"double"} +{"name":"add","args":[{"type":"float"},{"type":"float"}],"returns":"float"} +{"name":"add","args":[{"type":"float"}],"returns":"float"} +{"name":"add","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"add","args":[{"type":"hugeint"}],"returns":"hugeint"} +{"name":"add","args":[{"type":"integer"},{"type":"date"}],"returns":"date"} +{"name":"add","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"add","args":[{"type":"integer"}],"returns":"integer"} +{"name":"add","args":[{"type":"interval"},{"type":"date"}],"returns":"timestamp"} +{"name":"add","args":[{"type":"interval"},{"type":"interval"}],"returns":"interval"} +{"name":"add","args":[{"type":"interval"},{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"add","args":[{"type":"interval"},{"type":"timestamp"}],"returns":"timestamp"} +{"name":"add","args":[{"type":"interval"},{"type":"time"}],"returns":"time"} +{"name":"add","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"add","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"add","args":[{"type":"time with time zone"},{"type":"date"}],"returns":"timestamp with time zone"} +{"name":"add","args":[{"type":"time with time zone"},{"type":"interval"}],"returns":"time with time zone"} +{"name":"add","args":[{"type":"time"},{"type":"date"}],"returns":"timestamp"} +{"name":"add","args":[{"type":"time"},{"type":"interval"}],"returns":"time"} +{"name":"add","args":[{"type":"timestamp"},{"type":"interval"}],"returns":"timestamp"} +{"name":"add","args":[{"type":"tinyint"},{"type":"tinyint"}],"returns":"tinyint"} +{"name":"add","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"add","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"add","args":[{"type":"ubigint"}],"returns":"ubigint"} +{"name":"add","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"add","args":[{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"add","args":[{"type":"uinteger"},{"type":"uinteger"}],"returns":"uinteger"} +{"name":"add","args":[{"type":"uinteger"}],"returns":"uinteger"} +{"name":"add","args":[{"type":"usmallint"},{"type":"usmallint"}],"returns":"usmallint"} +{"name":"add","args":[{"type":"usmallint"}],"returns":"usmallint"} +{"name":"add","args":[{"type":"utinyint"},{"type":"utinyint"}],"returns":"utinyint"} +{"name":"add","args":[{"type":"utinyint"}],"returns":"utinyint"} +{"name":"add","args":[{"type":"any[]","mode":"v"}],"returns":"any[]"} +{"name":"age","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"interval"} +{"name":"age","args":[{"type":"timestamp with time zone"}],"returns":"interval"} +{"name":"age","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"interval"} +{"name":"age","args":[{"type":"timestamp"}],"returns":"interval"} +{"name":"aggregate","args":[{"type":"any[]"},{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"alias","args":[{"type":"any"}],"returns":"varchar"} +{"name":"any_value","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"any_value","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"approx_count_distinct","kind":"a","args":[{"type":"any"}],"returns":"bigint","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"bigint"},{"type":"float[]"}],"returns":"bigint[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"bigint"},{"type":"float"}],"returns":"bigint","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"date"},{"type":"float[]"}],"returns":"date[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"date"},{"type":"float"}],"returns":"date","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"decimal"},{"type":"float[]"}],"returns":"decimal[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"decimal"},{"type":"float"}],"returns":"decimal","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"double"},{"type":"float[]"}],"returns":"double[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"double"},{"type":"float"}],"returns":"double","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"float"},{"type":"float[]"}],"returns":"float[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"hugeint"},{"type":"float[]"}],"returns":"hugeint[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"hugeint"},{"type":"float"}],"returns":"hugeint","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"integer"},{"type":"float[]"}],"returns":"integer[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"integer"},{"type":"float"}],"returns":"integer","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"smallint"},{"type":"float[]"}],"returns":"smallint[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"smallint"},{"type":"float"}],"returns":"smallint","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"time with time zone"},{"type":"float[]"}],"returns":"time with time zone[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"time with time zone"},{"type":"float"}],"returns":"time with time zone","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"time"},{"type":"float[]"}],"returns":"time[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"time"},{"type":"float"}],"returns":"time","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"float[]"}],"returns":"timestamp with time zone[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"float"}],"returns":"timestamp with time zone","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"timestamp"},{"type":"float[]"}],"returns":"timestamp[]","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"timestamp"},{"type":"float"}],"returns":"timestamp","nullable":true} +{"name":"approx_quantile","kind":"a","args":[{"type":"tinyint"},{"type":"float[]"}],"returns":"tinyint[]","nullable":true} +{"name":"approx_top_k","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"arbitrary","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"arbitrary","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"arg_max","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"arg_max_null","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"arg_max_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"arg_min","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"arg_min_null","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"arg_min_nulls_last","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"argmax","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"argmin","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"array_agg","kind":"a","args":[{"type":"any"}],"returns":"any[]","nullable":true} +{"name":"array_aggr","args":[{"type":"any[]"},{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"array_aggregate","args":[{"type":"any[]"},{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"array_cat","args":[{"type":"any[]","mode":"v"}],"returns":"any[]"} +{"name":"array_concat","args":[{"type":"any[]","mode":"v"}],"returns":"any[]"} +{"name":"array_contains","args":[{"type":"any[]"},{"type":"any"}],"returns":"boolean"} +{"name":"array_cosine_distance","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"array_cosine_distance","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"array_cosine_similarity","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"array_cosine_similarity","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"array_cross_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double[]"} +{"name":"array_cross_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float[]"} +{"name":"array_distance","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"array_distance","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"array_distinct","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"array_dot_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"array_dot_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"array_extract","args":[{"type":"any[]"},{"type":"bigint"}],"returns":"any"} +{"name":"array_extract","args":[{"type":"struct"},{"type":"varchar"}],"returns":"any"} +{"name":"array_extract","args":[{"type":"tuple"},{"type":"bigint"}],"returns":"any"} +{"name":"array_extract","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"array_grade_up","args":[{"type":"any[]"},{"type":"varchar"},{"type":"varchar"}],"returns":"any[]"} +{"name":"array_grade_up","args":[{"type":"any[]"},{"type":"varchar"}],"returns":"any[]"} +{"name":"array_grade_up","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"array_has","args":[{"type":"any[]"},{"type":"any"}],"returns":"boolean"} +{"name":"array_has_all","args":[{"type":"any[]"},{"type":"any[]"}],"returns":"boolean"} +{"name":"array_has_any","args":[{"type":"any[]"},{"type":"any[]"}],"returns":"boolean"} +{"name":"array_indexof","args":[{"type":"any[]"},{"type":"any"}],"returns":"integer"} +{"name":"array_inner_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"array_inner_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"array_intersect","args":[{"type":"any[]"},{"type":"any[]"}],"returns":"any[]"} +{"name":"array_length","args":[{"type":"any[]"},{"type":"bigint"}],"returns":"bigint"} +{"name":"array_length","args":[{"type":"any[]"}],"returns":"bigint"} +{"name":"array_negative_dot_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"array_negative_dot_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"array_negative_inner_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"array_negative_inner_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"array_position","args":[{"type":"any[]"},{"type":"any"}],"returns":"integer"} +{"name":"array_resize","args":[{"type":"any[]"},{"type":"any"},{"type":"any"}],"returns":"any[]"} +{"name":"array_resize","args":[{"type":"any[]"},{"type":"any"}],"returns":"any[]"} +{"name":"array_reverse_sort","args":[{"type":"any[]"},{"type":"varchar"}],"returns":"any[]"} +{"name":"array_reverse_sort","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"array_select","args":[{"type":"any[]"},{"type":"bigint[]"}],"returns":"any[]"} +{"name":"array_slice","args":[{"type":"any"},{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any"} +{"name":"array_slice","args":[{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"array_sort","args":[{"type":"any[]"},{"type":"varchar"},{"type":"varchar"}],"returns":"any[]"} +{"name":"array_sort","args":[{"type":"any[]"},{"type":"varchar"}],"returns":"any[]"} +{"name":"array_sort","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"array_to_json","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"array_unique","args":[{"type":"any[]"}],"returns":"ubigint"} +{"name":"array_value","args":[{"type":"any","mode":"v"}],"returns":"array"} +{"name":"array_where","args":[{"type":"any[]"},{"type":"boolean[]"}],"returns":"any[]"} +{"name":"array_zip","args":[{"type":"any","mode":"v"}],"returns":"struct[]"} +{"name":"ascii","args":[{"type":"varchar"}],"returns":"integer"} +{"name":"asin","args":[{"type":"double"}],"returns":"double"} +{"name":"asinh","args":[{"type":"double"}],"returns":"double"} +{"name":"atan","args":[{"type":"double"}],"returns":"double"} +{"name":"atan2","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"atanh","args":[{"type":"double"}],"returns":"double"} +{"name":"avg","kind":"a","args":[{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"integer"}],"returns":"double","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"interval"}],"returns":"interval","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"smallint"}],"returns":"double","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"time with time zone"}],"returns":"time with time zone","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"time"}],"returns":"time","nullable":true} +{"name":"bar","args":[{"type":"double"},{"type":"double"},{"type":"double"},{"type":"double"}],"returns":"varchar"} +{"name":"bar","args":[{"type":"double"},{"type":"double"},{"type":"double"}],"returns":"varchar"} +{"name":"base64","args":[{"type":"blob"}],"returns":"varchar"} +{"name":"bin","args":[{"type":"bigint"}],"returns":"varchar"} +{"name":"bin","args":[{"type":"bignum"}],"returns":"varchar"} +{"name":"bin","args":[{"type":"hugeint"}],"returns":"varchar"} +{"name":"bin","args":[{"type":"ubigint"}],"returns":"varchar"} +{"name":"bin","args":[{"type":"uhugeint"}],"returns":"varchar"} +{"name":"bin","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"binom","args":[{"type":"integer"},{"type":"integer"}],"returns":"hugeint"} +{"name":"bit_and","kind":"a","args":[{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"bit"}],"returns":"bit","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"hugeint"}],"returns":"hugeint","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"smallint"}],"returns":"smallint","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"tinyint"}],"returns":"tinyint","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"ubigint"}],"returns":"ubigint","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"uhugeint"}],"returns":"uhugeint","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"uinteger"}],"returns":"uinteger","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"usmallint"}],"returns":"usmallint","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"utinyint"}],"returns":"utinyint","nullable":true} +{"name":"bit_count","args":[{"type":"bigint"}],"returns":"tinyint"} +{"name":"bit_count","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"bit_count","args":[{"type":"hugeint"}],"returns":"tinyint"} +{"name":"bit_count","args":[{"type":"integer"}],"returns":"tinyint"} +{"name":"bit_count","args":[{"type":"smallint"}],"returns":"tinyint"} +{"name":"bit_count","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"bit_length","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"bit_length","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"bit_or","kind":"a","args":[{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"bit"}],"returns":"bit","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"hugeint"}],"returns":"hugeint","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"smallint"}],"returns":"smallint","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"tinyint"}],"returns":"tinyint","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"ubigint"}],"returns":"ubigint","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"uhugeint"}],"returns":"uhugeint","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"uinteger"}],"returns":"uinteger","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"usmallint"}],"returns":"usmallint","nullable":true} +{"name":"bit_or","kind":"a","args":[{"type":"utinyint"}],"returns":"utinyint","nullable":true} +{"name":"bit_position","args":[{"type":"bit"},{"type":"bit"}],"returns":"integer"} +{"name":"bit_xor","kind":"a","args":[{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"bit"}],"returns":"bit","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"hugeint"}],"returns":"hugeint","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"smallint"}],"returns":"smallint","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"tinyint"}],"returns":"tinyint","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"ubigint"}],"returns":"ubigint","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"uhugeint"}],"returns":"uhugeint","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"uinteger"}],"returns":"uinteger","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"usmallint"}],"returns":"usmallint","nullable":true} +{"name":"bit_xor","kind":"a","args":[{"type":"utinyint"}],"returns":"utinyint","nullable":true} +{"name":"bitstring","args":[{"type":"bit"},{"type":"integer"}],"returns":"bit"} +{"name":"bitstring","args":[{"type":"varchar"},{"type":"integer"}],"returns":"bit"} +{"name":"bitstring_agg","kind":"a","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"bigint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"hugeint"},{"type":"hugeint"},{"type":"hugeint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"hugeint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"integer"},{"type":"integer"},{"type":"integer"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"integer"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"smallint"},{"type":"smallint"},{"type":"smallint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"smallint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"tinyint"},{"type":"tinyint"},{"type":"tinyint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"tinyint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"ubigint"},{"type":"ubigint"},{"type":"ubigint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"ubigint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"uhugeint"},{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"uhugeint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"uinteger"},{"type":"uinteger"},{"type":"uinteger"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"uinteger"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"usmallint"},{"type":"usmallint"},{"type":"usmallint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"usmallint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"utinyint"},{"type":"utinyint"},{"type":"utinyint"}],"returns":"bit","nullable":true} +{"name":"bitstring_agg","kind":"a","args":[{"type":"utinyint"}],"returns":"bit","nullable":true} +{"name":"bitstring_byte_comparable","args":[{"type":"bit"}],"returns":"blob"} +{"name":"bool_and","kind":"a","args":[{"type":"boolean"}],"returns":"boolean","nullable":true} +{"name":"bool_or","kind":"a","args":[{"type":"boolean"}],"returns":"boolean","nullable":true} +{"name":"can_cast_implicitly","args":[{"type":"any"},{"type":"any"}],"returns":"boolean"} +{"name":"cardinality","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"ubigint"} +{"name":"cast_to_type","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"cbrt","args":[{"type":"double"}],"returns":"double"} +{"name":"ceil","args":[{"type":"decimal"}],"returns":"decimal"} +{"name":"ceil","args":[{"type":"double"}],"returns":"double"} +{"name":"ceil","args":[{"type":"float"}],"returns":"float"} +{"name":"ceiling","args":[{"type":"decimal"}],"returns":"decimal"} +{"name":"ceiling","args":[{"type":"double"}],"returns":"double"} +{"name":"ceiling","args":[{"type":"float"}],"returns":"float"} +{"name":"century","args":[{"type":"date"}],"returns":"bigint"} +{"name":"century","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"century","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"century","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"char_length","args":[{"type":"any[]"}],"returns":"bigint"} +{"name":"char_length","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"char_length","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"character_length","args":[{"type":"any[]"}],"returns":"bigint"} +{"name":"character_length","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"character_length","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"chr","args":[{"type":"integer"}],"returns":"varchar"} +{"name":"collate_aa","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_af","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_am","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ar","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ar_sa","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_as","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_az","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_bal","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_be","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_bg","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_blo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_bn","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_bo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_br","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_bs","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ca","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ceb","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_chr","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_cs","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_cu","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_cy","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_da","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_de","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_de_at","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_dsb","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_dz","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ee","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_el","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_en","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_en_us","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_eo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_es","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_et","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_fa","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_fa_af","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ff","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_fi","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_fil","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_fo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_fr","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_fr_ca","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_fy","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ga","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_gl","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_gu","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ha","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_haw","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_he","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_he_il","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_hi","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_hr","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_hsb","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_hu","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_hy","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_id","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_id_id","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ig","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_is","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_it","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ja","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ka","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_kk","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_kl","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_km","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_kn","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ko","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_kok","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ku","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ky","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_lb","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_lij","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_lkt","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ln","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_lo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_lt","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_lv","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_mk","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ml","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_mn","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_mr","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ms","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_mt","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_my","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_nb","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_nb_no","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ne","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_nl","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_nn","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_no","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_noaccent","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_nso","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_om","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_or","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_pa","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_pa_in","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_pl","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ps","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_pt","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ro","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ru","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sa","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_se","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sgs","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_si","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sk","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sl","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_smn","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sq","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sr","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sr_ba","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sr_me","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sr_rs","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ssy","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_st","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sv","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_sw","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ta","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_te","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_th","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_tk","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_tn","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_to","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_tr","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ug","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_uk","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_ur","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_uz","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_vi","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_vo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_wae","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_wo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_xh","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_yi","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_yo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_zh","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_zh_cn","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_zh_hk","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_zh_mo","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_zh_sg","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_zh_tw","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"collate_zu","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"combine","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"combine_aggr","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"combine_aggr","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"concat","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"concat_ws","args":[{"type":"varchar"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"varchar"} +{"name":"constant_or_null","args":[{"type":"any"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"contains","args":[{"type":"map"},{"type":"any"}],"returns":"boolean"} +{"name":"contains","args":[{"type":"any[]"},{"type":"any"}],"returns":"boolean"} +{"name":"contains","args":[{"type":"tuple"},{"type":"any"}],"returns":"boolean"} +{"name":"contains","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"corr","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"cos","args":[{"type":"double"}],"returns":"double"} +{"name":"cosh","args":[{"type":"double"}],"returns":"double"} +{"name":"cot","args":[{"type":"double"}],"returns":"double"} +{"name":"count","kind":"a","args":[{"type":"any"}],"returns":"bigint"} +{"name":"count","kind":"a","returns":"bigint"} +{"name":"count_if","kind":"a","args":[{"type":"boolean"}],"returns":"hugeint"} +{"name":"count_star","kind":"a","returns":"bigint"} +{"name":"countif","kind":"a","args":[{"type":"boolean"}],"returns":"hugeint"} +{"name":"covar_pop","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"covar_samp","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"create_sort_key","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"blob"} +{"name":"cume_dist","kind":"w","returns":"double"} +{"name":"current_connection_id","returns":"ubigint"} +{"name":"current_database","returns":"varchar"} +{"name":"current_date","returns":"date"} +{"name":"current_localtime","returns":"time"} +{"name":"current_localtimestamp","returns":"timestamp"} +{"name":"current_query","returns":"varchar"} +{"name":"current_query_id","returns":"ubigint"} +{"name":"current_schema","returns":"varchar"} +{"name":"current_schemas","args":[{"type":"boolean"}],"returns":"varchar[]"} +{"name":"current_setting","args":[{"type":"varchar"}],"returns":"any"} +{"name":"current_transaction_id","returns":"ubigint"} +{"name":"currval","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"damerau_levenshtein","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"bigint"} +{"name":"date_diff","args":[{"type":"varchar"},{"type":"date"},{"type":"date"}],"returns":"bigint"} +{"name":"date_diff","args":[{"type":"varchar"},{"type":"time"},{"type":"time"}],"returns":"bigint"} +{"name":"date_diff","args":[{"type":"varchar"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"date_diff","args":[{"type":"varchar"},{"type":"timestamp"},{"type":"timestamp"}],"returns":"bigint"} +{"name":"date_diff","args":[{"type":"varchar"},{"type":"timestamptz_ns"},{"type":"timestamptz_ns"}],"returns":"bigint"} +{"name":"date_part","args":[{"type":"varchar[]"},{"type":"date"}],"returns":"struct"} +{"name":"date_part","args":[{"type":"varchar[]"},{"type":"interval"}],"returns":"struct"} +{"name":"date_part","args":[{"type":"varchar[]"},{"type":"time with time zone"}],"returns":"struct"} +{"name":"date_part","args":[{"type":"varchar[]"},{"type":"timestamp with time zone"}],"returns":"struct"} +{"name":"date_part","args":[{"type":"varchar[]"},{"type":"timestamp"}],"returns":"struct"} +{"name":"date_part","args":[{"type":"varchar[]"},{"type":"time"}],"returns":"struct"} +{"name":"date_part","args":[{"type":"varchar[]"},{"type":"time_ns"}],"returns":"struct"} +{"name":"date_part","args":[{"type":"varchar"},{"type":"date"}],"returns":"double"} +{"name":"date_part","args":[{"type":"varchar"},{"type":"interval"}],"returns":"double"} +{"name":"date_part","args":[{"type":"varchar"},{"type":"time with time zone"}],"returns":"double"} +{"name":"date_part","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"double"} +{"name":"date_part","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"double"} +{"name":"date_part","args":[{"type":"varchar"},{"type":"time"}],"returns":"double"} +{"name":"date_part","args":[{"type":"varchar"},{"type":"time_ns"}],"returns":"double"} +{"name":"date_sub","args":[{"type":"varchar"},{"type":"date"},{"type":"date"}],"returns":"bigint"} +{"name":"date_sub","args":[{"type":"varchar"},{"type":"time"},{"type":"time"}],"returns":"bigint"} +{"name":"date_sub","args":[{"type":"varchar"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"date_sub","args":[{"type":"varchar"},{"type":"timestamp"},{"type":"timestamp"}],"returns":"bigint"} +{"name":"date_trunc","args":[{"type":"varchar"},{"type":"date"}],"returns":"timestamp"} +{"name":"date_trunc","args":[{"type":"varchar"},{"type":"interval"}],"returns":"interval"} +{"name":"date_trunc","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"date_trunc","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"timestamp"} +{"name":"datediff","args":[{"type":"varchar"},{"type":"date"},{"type":"date"}],"returns":"bigint"} +{"name":"datediff","args":[{"type":"varchar"},{"type":"time"},{"type":"time"}],"returns":"bigint"} +{"name":"datediff","args":[{"type":"varchar"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"datediff","args":[{"type":"varchar"},{"type":"timestamp"},{"type":"timestamp"}],"returns":"bigint"} +{"name":"datediff","args":[{"type":"varchar"},{"type":"timestamptz_ns"},{"type":"timestamptz_ns"}],"returns":"bigint"} +{"name":"datepart","args":[{"type":"varchar[]"},{"type":"date"}],"returns":"struct"} +{"name":"datepart","args":[{"type":"varchar[]"},{"type":"interval"}],"returns":"struct"} +{"name":"datepart","args":[{"type":"varchar[]"},{"type":"time with time zone"}],"returns":"struct"} +{"name":"datepart","args":[{"type":"varchar[]"},{"type":"timestamp with time zone"}],"returns":"struct"} +{"name":"datepart","args":[{"type":"varchar[]"},{"type":"timestamp"}],"returns":"struct"} +{"name":"datepart","args":[{"type":"varchar[]"},{"type":"time"}],"returns":"struct"} +{"name":"datepart","args":[{"type":"varchar[]"},{"type":"time_ns"}],"returns":"struct"} +{"name":"datepart","args":[{"type":"varchar"},{"type":"date"}],"returns":"double"} +{"name":"datepart","args":[{"type":"varchar"},{"type":"interval"}],"returns":"double"} +{"name":"datepart","args":[{"type":"varchar"},{"type":"time with time zone"}],"returns":"double"} +{"name":"datepart","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"double"} +{"name":"datepart","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"double"} +{"name":"datepart","args":[{"type":"varchar"},{"type":"time"}],"returns":"double"} +{"name":"datepart","args":[{"type":"varchar"},{"type":"time_ns"}],"returns":"double"} +{"name":"datesub","args":[{"type":"varchar"},{"type":"date"},{"type":"date"}],"returns":"bigint"} +{"name":"datesub","args":[{"type":"varchar"},{"type":"time"},{"type":"time"}],"returns":"bigint"} +{"name":"datesub","args":[{"type":"varchar"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"datesub","args":[{"type":"varchar"},{"type":"timestamp"},{"type":"timestamp"}],"returns":"bigint"} +{"name":"datetrunc","args":[{"type":"varchar"},{"type":"date"}],"returns":"timestamp"} +{"name":"datetrunc","args":[{"type":"varchar"},{"type":"interval"}],"returns":"interval"} +{"name":"datetrunc","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"datetrunc","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"timestamp"} +{"name":"day","args":[{"type":"date"}],"returns":"bigint"} +{"name":"day","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"day","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"day","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"dayname","args":[{"type":"date"}],"returns":"varchar"} +{"name":"dayname","args":[{"type":"timestamp with time zone"}],"returns":"varchar"} +{"name":"dayname","args":[{"type":"timestamp"}],"returns":"varchar"} +{"name":"dayofmonth","args":[{"type":"date"}],"returns":"bigint"} +{"name":"dayofmonth","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"dayofmonth","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"dayofmonth","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"dayofweek","args":[{"type":"date"}],"returns":"bigint"} +{"name":"dayofweek","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"dayofweek","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"dayofweek","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"dayofyear","args":[{"type":"date"}],"returns":"bigint"} +{"name":"dayofyear","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"dayofyear","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"dayofyear","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"decade","args":[{"type":"date"}],"returns":"bigint"} +{"name":"decade","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"decade","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"decade","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"decimal_average","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"decimal_division","args":[{"type":"decimal"},{"type":"decimal"},{"type":"integer"}],"returns":"decimal"} +{"name":"decimal_division","args":[{"type":"decimal"},{"type":"decimal"}],"returns":"decimal"} +{"name":"decode","args":[{"type":"blob"},{"type":"varchar"}],"returns":"varchar"} +{"name":"decode","args":[{"type":"blob"}],"returns":"varchar"} +{"name":"degrees","args":[{"type":"double"}],"returns":"double"} +{"name":"dense_rank","kind":"w","returns":"bigint"} +{"name":"divide","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"divide","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"divide","args":[{"type":"float"},{"type":"float"}],"returns":"float"} +{"name":"divide","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"divide","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"divide","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"divide","args":[{"type":"tinyint"},{"type":"tinyint"}],"returns":"tinyint"} +{"name":"divide","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"divide","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"divide","args":[{"type":"uinteger"},{"type":"uinteger"}],"returns":"uinteger"} +{"name":"divide","args":[{"type":"usmallint"},{"type":"usmallint"}],"returns":"usmallint"} +{"name":"divide","args":[{"type":"utinyint"},{"type":"utinyint"}],"returns":"utinyint"} +{"name":"duckdb_format_sql","args":[{"type":"varchar"},{"type":"map"}],"returns":"varchar"} +{"name":"duckdb_format_sql","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"editdist3","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"bigint"} +{"name":"element_at","args":[{"type":"map"},{"type":"any"}],"returns":"any[]"} +{"name":"encode","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"ends_with","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"entropy","kind":"a","args":[{"type":"any"}],"returns":"double","nullable":true} +{"name":"enum_code","args":[{"type":"any"}],"returns":"any"} +{"name":"enum_first","args":[{"type":"any"}],"returns":"varchar"} +{"name":"enum_last","args":[{"type":"any"}],"returns":"varchar"} +{"name":"enum_range","args":[{"type":"any"}],"returns":"varchar[]"} +{"name":"enum_range_boundary","args":[{"type":"any"},{"type":"any"}],"returns":"varchar[]"} +{"name":"epoch","args":[{"type":"date"}],"returns":"double"} +{"name":"epoch","args":[{"type":"interval"}],"returns":"double"} +{"name":"epoch","args":[{"type":"time with time zone"}],"returns":"double"} +{"name":"epoch","args":[{"type":"timestamp with time zone"}],"returns":"double"} +{"name":"epoch","args":[{"type":"timestamp"}],"returns":"double"} +{"name":"epoch","args":[{"type":"time"}],"returns":"double"} +{"name":"epoch","args":[{"type":"time_ns"}],"returns":"double"} +{"name":"epoch_ms","args":[{"type":"bigint"}],"returns":"timestamp"} +{"name":"epoch_ms","args":[{"type":"date"}],"returns":"bigint"} +{"name":"epoch_ms","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"epoch_ms","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"epoch_ms","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"epoch_ms","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"epoch_ms","args":[{"type":"time"}],"returns":"bigint"} +{"name":"epoch_ms","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"date"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"timestamptz_ns"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"timestamp_ns"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"time"}],"returns":"bigint"} +{"name":"epoch_ns","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"epoch_us","args":[{"type":"date"}],"returns":"bigint"} +{"name":"epoch_us","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"epoch_us","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"epoch_us","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"epoch_us","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"epoch_us","args":[{"type":"time"}],"returns":"bigint"} +{"name":"epoch_us","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"equi_width_bins","args":[{"type":"any"},{"type":"any"},{"type":"bigint"},{"type":"boolean"}],"returns":"any[]"} +{"name":"equi_width_bins","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"boolean"}],"returns":"any[]"} +{"name":"equi_width_bins","args":[{"type":"double"},{"type":"double"},{"type":"bigint"},{"type":"boolean"}],"returns":"any[]"} +{"name":"equi_width_bins","args":[{"type":"timestamp"},{"type":"timestamp"},{"type":"bigint"},{"type":"boolean"}],"returns":"any[]"} +{"name":"era","args":[{"type":"date"}],"returns":"bigint"} +{"name":"era","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"era","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"era","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"even","args":[{"type":"double"}],"returns":"double"} +{"name":"exp","args":[{"type":"double"}],"returns":"double"} +{"name":"factorial","args":[{"type":"integer"}],"returns":"hugeint"} +{"name":"favg","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"fill","kind":"w","args":[{"type":"any"}],"returns":"any"} +{"name":"first","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"first","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"first_value","kind":"w","args":[{"type":"any"}],"returns":"any"} +{"name":"flatten","args":[{"type":"any[][]"}],"returns":"any[]"} +{"name":"floor","args":[{"type":"decimal"}],"returns":"decimal"} +{"name":"floor","args":[{"type":"double"}],"returns":"double"} +{"name":"floor","args":[{"type":"float"}],"returns":"float"} +{"name":"format","args":[{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"varchar"} +{"name":"format_bytes","args":[{"type":"bigint"}],"returns":"varchar"} +{"name":"from_base64","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"from_binary","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"from_hex","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"from_json","args":[{"type":"json"},{"type":"varchar"}],"returns":"any"} +{"name":"from_json","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"any"} +{"name":"from_json_strict","args":[{"type":"json"},{"type":"varchar"}],"returns":"any"} +{"name":"from_json_strict","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"any"} +{"name":"fsum","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"gamma","args":[{"type":"double"}],"returns":"double"} +{"name":"gcd","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"gcd","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"gen_random_uuid","returns":"uuid"} +{"name":"generate_series","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"}],"returns":"bigint[]"} +{"name":"generate_series","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint[]"} +{"name":"generate_series","args":[{"type":"bigint"}],"returns":"bigint[]"} +{"name":"generate_series","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"timestamp with time zone[]"} +{"name":"generate_series","args":[{"type":"timestamp"},{"type":"timestamp"},{"type":"interval"}],"returns":"timestamp[]"} +{"name":"get_bit","args":[{"type":"bit"},{"type":"integer"}],"returns":"integer"} +{"name":"get_current_time","returns":"time with time zone"} +{"name":"get_current_timestamp","returns":"timestamp with time zone"} +{"name":"getenv","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"getvariable","args":[{"type":"varchar"}],"returns":"any"} +{"name":"grade_up","args":[{"type":"any[]"},{"type":"varchar"},{"type":"varchar"}],"returns":"any[]"} +{"name":"grade_up","args":[{"type":"any[]"},{"type":"varchar"}],"returns":"any[]"} +{"name":"grade_up","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"greatest","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"greatest_common_divisor","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"greatest_common_divisor","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"group_concat","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"group_concat","kind":"a","args":[{"type":"any"}],"returns":"varchar","nullable":true} +{"name":"hamming","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"bigint"} +{"name":"hash","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"ubigint"} +{"name":"hex","args":[{"type":"bigint"}],"returns":"varchar"} +{"name":"hex","args":[{"type":"bignum"}],"returns":"varchar"} +{"name":"hex","args":[{"type":"blob"}],"returns":"varchar"} +{"name":"hex","args":[{"type":"hugeint"}],"returns":"varchar"} +{"name":"hex","args":[{"type":"ubigint"}],"returns":"varchar"} +{"name":"hex","args":[{"type":"uhugeint"}],"returns":"varchar"} +{"name":"hex","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"histogram","kind":"a","args":[{"type":"any"},{"type":"any[]"}],"returns":"map","nullable":true} +{"name":"histogram","kind":"a","args":[{"type":"any"}],"returns":"map","nullable":true} +{"name":"histogram_exact","kind":"a","args":[{"type":"any"},{"type":"any[]"}],"returns":"map","nullable":true} +{"name":"hour","args":[{"type":"date"}],"returns":"bigint"} +{"name":"hour","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"hour","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"hour","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"hour","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"hour","args":[{"type":"time"}],"returns":"bigint"} +{"name":"hour","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"icu_collate_aa","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_af","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_am","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ar","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ar_sa","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_as","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_az","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_bal","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_be","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_bg","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_blo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_bn","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_bo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_br","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_bs","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ca","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ceb","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_chr","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_cs","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_cu","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_cy","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_da","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_de","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_de_at","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_dsb","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_dz","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ee","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_el","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_en","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_en_us","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_eo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_es","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_et","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_fa","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_fa_af","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ff","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_fi","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_fil","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_fo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_fr","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_fr_ca","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_fy","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ga","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_gl","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_gu","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ha","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_haw","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_he","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_he_il","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_hi","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_hr","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_hsb","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_hu","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_hy","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_id","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_id_id","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ig","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_is","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_it","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ja","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ka","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_kk","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_kl","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_km","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_kn","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ko","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_kok","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ku","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ky","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_lb","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_lij","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_lkt","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ln","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_lo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_lt","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_lv","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_mk","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ml","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_mn","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_mr","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ms","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_mt","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_my","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_nb","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_nb_no","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ne","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_nl","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_nn","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_no","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_noaccent","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_nso","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_om","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_or","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_pa","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_pa_in","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_pl","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ps","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_pt","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ro","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ru","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sa","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_se","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sgs","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_si","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sk","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sl","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_smn","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sq","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sr","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sr_ba","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sr_me","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sr_rs","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ssy","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_st","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sv","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_sw","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ta","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_te","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_th","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_tk","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_tn","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_to","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_tr","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ug","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_uk","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_ur","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_uz","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_vi","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_vo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_wae","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_wo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_xh","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_yi","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_yo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_zh","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_zh_cn","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_zh_hk","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_zh_mo","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_zh_sg","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_zh_tw","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_collate_zu","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"icu_sort_key","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"ilike_escape","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"in_search_path","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"index_key","args":[{"type":"struct"},{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"blob"} +{"name":"instr","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"bigint"} +{"name":"is_histogram_other_bin","args":[{"type":"any"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"date"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"double"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"float"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"timestamp"}],"returns":"boolean"} +{"name":"isinf","args":[{"type":"date"}],"returns":"boolean"} +{"name":"isinf","args":[{"type":"double"}],"returns":"boolean"} +{"name":"isinf","args":[{"type":"float"}],"returns":"boolean"} +{"name":"isinf","args":[{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"isinf","args":[{"type":"timestamp"}],"returns":"boolean"} +{"name":"isnan","args":[{"type":"double"}],"returns":"boolean"} +{"name":"isnan","args":[{"type":"float"}],"returns":"boolean"} +{"name":"isodow","args":[{"type":"date"}],"returns":"bigint"} +{"name":"isodow","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"isodow","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"isodow","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"isoyear","args":[{"type":"date"}],"returns":"bigint"} +{"name":"isoyear","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"isoyear","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"isoyear","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"jaccard","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"double"} +{"name":"jaro_similarity","args":[{"type":"varchar"},{"type":"varchar"},{"type":"double"}],"returns":"double"} +{"name":"jaro_similarity","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"double"} +{"name":"jaro_winkler_similarity","args":[{"type":"varchar"},{"type":"varchar"},{"type":"double"}],"returns":"double"} +{"name":"jaro_winkler_similarity","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"double"} +{"name":"json_array","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"json_array_length","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"ubigint[]"} +{"name":"json_array_length","args":[{"type":"json"},{"type":"varchar"}],"returns":"ubigint"} +{"name":"json_array_length","args":[{"type":"json"}],"returns":"ubigint"} +{"name":"json_array_length","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"ubigint[]"} +{"name":"json_array_length","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"ubigint"} +{"name":"json_array_length","args":[{"type":"varchar"}],"returns":"ubigint"} +{"name":"json_contains","args":[{"type":"json"},{"type":"json"}],"returns":"boolean"} +{"name":"json_contains","args":[{"type":"json"},{"type":"varchar"}],"returns":"boolean"} +{"name":"json_contains","args":[{"type":"varchar"},{"type":"json"}],"returns":"boolean"} +{"name":"json_contains","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"json_deep_merge","args":[{"type":"json"},{"type":"json"},{"type":"json","mode":"v"}],"returns":"json"} +{"name":"json_deserialize_sql","args":[{"type":"json"}],"returns":"varchar"} +{"name":"json_exists","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"boolean[]"} +{"name":"json_exists","args":[{"type":"json"},{"type":"varchar"}],"returns":"boolean"} +{"name":"json_exists","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"boolean[]"} +{"name":"json_exists","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"json_extract","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"json[]"} +{"name":"json_extract","args":[{"type":"json"},{"type":"bigint"}],"returns":"json"} +{"name":"json_extract","args":[{"type":"json"},{"type":"varchar"}],"returns":"json"} +{"name":"json_extract","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"json[]"} +{"name":"json_extract","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"json"} +{"name":"json_extract","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"json"} +{"name":"json_extract_path","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"json[]"} +{"name":"json_extract_path","args":[{"type":"json"},{"type":"bigint"}],"returns":"json"} +{"name":"json_extract_path","args":[{"type":"json"},{"type":"varchar"}],"returns":"json"} +{"name":"json_extract_path","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"json[]"} +{"name":"json_extract_path","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"json"} +{"name":"json_extract_path","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"json"} +{"name":"json_extract_path_text","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"json_extract_path_text","args":[{"type":"json"},{"type":"bigint"}],"returns":"varchar"} +{"name":"json_extract_path_text","args":[{"type":"json"},{"type":"varchar"}],"returns":"varchar"} +{"name":"json_extract_path_text","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"json_extract_path_text","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"json_extract_path_text","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"json_extract_string","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"json_extract_string","args":[{"type":"json"},{"type":"bigint"}],"returns":"varchar"} +{"name":"json_extract_string","args":[{"type":"json"},{"type":"varchar"}],"returns":"varchar"} +{"name":"json_extract_string","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"json_extract_string","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"json_extract_string","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"json_insert","args":[{"type":"json"},{"type":"varchar"},{"type":"json"}],"returns":"json"} +{"name":"json_keys","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"varchar[][]"} +{"name":"json_keys","args":[{"type":"json"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"json_keys","args":[{"type":"json"}],"returns":"varchar[]"} +{"name":"json_keys","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar[][]"} +{"name":"json_keys","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"json_keys","args":[{"type":"varchar"}],"returns":"varchar[]"} +{"name":"json_merge_patch","args":[{"type":"json"},{"type":"json"},{"type":"json","mode":"v"}],"returns":"json"} +{"name":"json_merge_patch_diff","args":[{"type":"json"},{"type":"json"}],"returns":"json"} +{"name":"json_normalize","args":[{"type":"json"}],"returns":"varchar"} +{"name":"json_object","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"json_pretty","args":[{"type":"json"}],"returns":"varchar"} +{"name":"json_quote","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"json_remove","args":[{"type":"json"},{"type":"varchar"}],"returns":"json"} +{"name":"json_replace","args":[{"type":"json"},{"type":"varchar"},{"type":"json"}],"returns":"json"} +{"name":"json_serialize_plan","args":[{"type":"varchar"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"}],"returns":"json"} +{"name":"json_serialize_sql","args":[{"type":"varchar"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"},{"type":"boolean"}],"returns":"json"} +{"name":"json_set","args":[{"type":"json"},{"type":"varchar"},{"type":"json"}],"returns":"json"} +{"name":"json_strip_nulls","args":[{"type":"json"}],"returns":"json"} +{"name":"json_structure","args":[{"type":"json"}],"returns":"json"} +{"name":"json_structure","args":[{"type":"varchar"}],"returns":"json"} +{"name":"json_transform","args":[{"type":"json"},{"type":"varchar"}],"returns":"any"} +{"name":"json_transform","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"any"} +{"name":"json_transform_strict","args":[{"type":"json"},{"type":"varchar"}],"returns":"any"} +{"name":"json_transform_strict","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"any"} +{"name":"json_type","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"json_type","args":[{"type":"json"},{"type":"varchar"}],"returns":"varchar"} +{"name":"json_type","args":[{"type":"json"}],"returns":"varchar"} +{"name":"json_type","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"json_type","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"json_type","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"json_valid","args":[{"type":"json"}],"returns":"boolean"} +{"name":"json_valid","args":[{"type":"varchar"}],"returns":"boolean"} +{"name":"json_value","args":[{"type":"json"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"json_value","args":[{"type":"json"},{"type":"bigint"}],"returns":"varchar"} +{"name":"json_value","args":[{"type":"json"},{"type":"varchar"}],"returns":"varchar"} +{"name":"json_value","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"json_value","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"json_value","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"julian","args":[{"type":"date"}],"returns":"double"} +{"name":"julian","args":[{"type":"timestamp with time zone"}],"returns":"double"} +{"name":"julian","args":[{"type":"timestamp"}],"returns":"double"} +{"name":"kahan_sum","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"kurtosis","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"kurtosis_pop","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"lag","kind":"w","args":[{"type":"any"},{"type":"bigint"},{"type":"any"}],"returns":"any"} +{"name":"last","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"last","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"last_day","args":[{"type":"date"}],"returns":"date"} +{"name":"last_day","args":[{"type":"timestamp with time zone"}],"returns":"date"} +{"name":"last_day","args":[{"type":"timestamp"}],"returns":"date"} +{"name":"last_value","kind":"w","args":[{"type":"any"}],"returns":"any"} +{"name":"lcase","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"lcm","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"lcm","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"lead","kind":"w","args":[{"type":"any"},{"type":"bigint"},{"type":"any"}],"returns":"any"} +{"name":"least","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"least_common_multiple","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"least_common_multiple","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"left","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"left_grapheme","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"len","args":[{"type":"any[]"}],"returns":"bigint"} +{"name":"len","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"len","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"length","args":[{"type":"any[]"}],"returns":"bigint"} +{"name":"length","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"length","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"length_grapheme","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"levenshtein","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"bigint"} +{"name":"lgamma","args":[{"type":"double"}],"returns":"double"} +{"name":"like_escape","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"list","kind":"a","args":[{"type":"any"}],"returns":"any[]","nullable":true} +{"name":"list_aggr","args":[{"type":"any[]"},{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"list_aggregate","args":[{"type":"any[]"},{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"list_cat","args":[{"type":"any[]","mode":"v"}],"returns":"any[]"} +{"name":"list_concat","args":[{"type":"any[]","mode":"v"}],"returns":"any[]"} +{"name":"list_contains","args":[{"type":"any[]"},{"type":"any"}],"returns":"boolean"} +{"name":"list_cosine_distance","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"list_cosine_distance","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"list_cosine_similarity","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"list_cosine_similarity","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"list_distance","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"list_distance","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"list_distinct","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"list_dot_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"list_dot_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"list_element","args":[{"type":"any[]"},{"type":"bigint"}],"returns":"any"} +{"name":"list_element","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"list_extract","args":[{"type":"any[]"},{"type":"bigint"}],"returns":"any"} +{"name":"list_extract","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"list_grade_up","args":[{"type":"any[]"},{"type":"varchar"},{"type":"varchar"}],"returns":"any[]"} +{"name":"list_grade_up","args":[{"type":"any[]"},{"type":"varchar"}],"returns":"any[]"} +{"name":"list_grade_up","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"list_has","args":[{"type":"any[]"},{"type":"any"}],"returns":"boolean"} +{"name":"list_has_all","args":[{"type":"any[]"},{"type":"any[]"}],"returns":"boolean"} +{"name":"list_has_any","args":[{"type":"any[]"},{"type":"any[]"}],"returns":"boolean"} +{"name":"list_indexof","args":[{"type":"any[]"},{"type":"any"}],"returns":"integer"} +{"name":"list_inner_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"list_inner_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"list_intersect","args":[{"type":"any[]"},{"type":"any[]"}],"returns":"any[]"} +{"name":"list_negative_dot_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"list_negative_dot_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"list_negative_inner_product","args":[{"type":"double[]"},{"type":"double[]"}],"returns":"double"} +{"name":"list_negative_inner_product","args":[{"type":"float[]"},{"type":"float[]"}],"returns":"float"} +{"name":"list_pack","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any[]"} +{"name":"list_position","args":[{"type":"any[]"},{"type":"any"}],"returns":"integer"} +{"name":"list_resize","args":[{"type":"any[]"},{"type":"any"},{"type":"any"}],"returns":"any[]"} +{"name":"list_resize","args":[{"type":"any[]"},{"type":"any"}],"returns":"any[]"} +{"name":"list_reverse_sort","args":[{"type":"any[]"},{"type":"varchar"}],"returns":"any[]"} +{"name":"list_reverse_sort","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"list_select","args":[{"type":"any[]"},{"type":"bigint[]"}],"returns":"any[]"} +{"name":"list_slice","args":[{"type":"any"},{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any"} +{"name":"list_slice","args":[{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"list_sort","args":[{"type":"any[]"},{"type":"varchar"},{"type":"varchar"}],"returns":"any[]"} +{"name":"list_sort","args":[{"type":"any[]"},{"type":"varchar"}],"returns":"any[]"} +{"name":"list_sort","args":[{"type":"any[]"}],"returns":"any[]"} +{"name":"list_unique","args":[{"type":"any[]"}],"returns":"ubigint"} +{"name":"list_value","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any[]"} +{"name":"list_where","args":[{"type":"any[]"},{"type":"boolean[]"}],"returns":"any[]"} +{"name":"list_zip","args":[{"type":"any","mode":"v"}],"returns":"struct[]"} +{"name":"listagg","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"listagg","kind":"a","args":[{"type":"any"}],"returns":"varchar","nullable":true} +{"name":"ln","args":[{"type":"double"}],"returns":"double"} +{"name":"log","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"log","args":[{"type":"double"}],"returns":"double"} +{"name":"log10","args":[{"type":"double"}],"returns":"double"} +{"name":"log2","args":[{"type":"double"}],"returns":"double"} +{"name":"lower","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"lpad","args":[{"type":"varchar"},{"type":"integer"},{"type":"varchar"}],"returns":"varchar"} +{"name":"ltrim","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"ltrim","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"lttb","kind":"a","args":[{"type":"double"},{"type":"double"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"double"},{"type":"float"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"float"},{"type":"double"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"float"},{"type":"float"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"float"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp"},{"type":"double"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp"},{"type":"float"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamptz_ns"},{"type":"double"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamptz_ns"},{"type":"float"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp_ms"},{"type":"double"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp_ms"},{"type":"float"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp_ns"},{"type":"double"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp_ns"},{"type":"float"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp_s"},{"type":"double"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"lttb","kind":"a","args":[{"type":"timestamp_s"},{"type":"float"},{"type":"bigint"}],"returns":"struct[]","nullable":true} +{"name":"mad","kind":"a","args":[{"type":"date"}],"returns":"interval","nullable":true} +{"name":"mad","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"mad","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"mad","kind":"a","args":[{"type":"float"}],"returns":"float","nullable":true} +{"name":"mad","kind":"a","args":[{"type":"time with time zone"}],"returns":"interval","nullable":true} +{"name":"mad","kind":"a","args":[{"type":"timestamp with time zone"}],"returns":"interval","nullable":true} +{"name":"mad","kind":"a","args":[{"type":"timestamp"}],"returns":"interval","nullable":true} +{"name":"mad","kind":"a","args":[{"type":"time"}],"returns":"interval","nullable":true} +{"name":"make_date","args":[{"type":"struct"}],"returns":"date"} +{"name":"make_date","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"}],"returns":"date"} +{"name":"make_date","args":[{"type":"integer"}],"returns":"date"} +{"name":"make_time","args":[{"type":"bigint"},{"type":"bigint"},{"type":"double"}],"returns":"time"} +{"name":"make_timestamp","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"double"}],"returns":"timestamp"} +{"name":"make_timestamp","args":[{"type":"bigint"}],"returns":"timestamp"} +{"name":"make_timestamp_ms","args":[{"type":"bigint"}],"returns":"timestamp"} +{"name":"make_timestamp_ns","args":[{"type":"bigint"}],"returns":"timestamp_ns"} +{"name":"make_timestamptz","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"double"},{"type":"varchar"}],"returns":"timestamp with time zone"} +{"name":"make_timestamptz","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"double"}],"returns":"timestamp with time zone"} +{"name":"make_timestamptz","args":[{"type":"bigint"}],"returns":"timestamp with time zone"} +{"name":"map","args":[{"type":"any[]"},{"type":"any[]"}],"returns":"map"} +{"name":"map","returns":"map"} +{"name":"map_concat","args":[{"type":"any","mode":"v"}],"returns":"list"} +{"name":"map_contains","args":[{"type":"map"},{"type":"any"}],"returns":"boolean"} +{"name":"map_entries","args":[{"type":"map"}],"returns":"struct[]"} +{"name":"map_extract","args":[{"type":"map"},{"type":"any"}],"returns":"any[]"} +{"name":"map_extract_value","args":[{"type":"map"},{"type":"any"}],"returns":"any"} +{"name":"map_from_entries","args":[{"type":"tuple[]"}],"returns":"map"} +{"name":"map_keys","args":[{"type":"map"}],"returns":"any[]"} +{"name":"map_values","args":[{"type":"map"}],"returns":"any[]"} +{"name":"max","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"max","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"max_by","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"md5","args":[{"type":"blob"}],"returns":"varchar"} +{"name":"md5","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"md5_number","args":[{"type":"blob"}],"returns":"uhugeint"} +{"name":"md5_number","args":[{"type":"varchar"}],"returns":"uhugeint"} +{"name":"mean","kind":"a","args":[{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"integer"}],"returns":"double","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"interval"}],"returns":"interval","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"smallint"}],"returns":"double","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"time with time zone"}],"returns":"time with time zone","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"mean","kind":"a","args":[{"type":"time"}],"returns":"time","nullable":true} +{"name":"median","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"microsecond","args":[{"type":"date"}],"returns":"bigint"} +{"name":"microsecond","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"microsecond","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"microsecond","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"microsecond","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"microsecond","args":[{"type":"time"}],"returns":"bigint"} +{"name":"microsecond","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"millennium","args":[{"type":"date"}],"returns":"bigint"} +{"name":"millennium","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"millennium","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"millennium","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"millisecond","args":[{"type":"date"}],"returns":"bigint"} +{"name":"millisecond","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"millisecond","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"millisecond","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"millisecond","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"millisecond","args":[{"type":"time"}],"returns":"bigint"} +{"name":"millisecond","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"min","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"min","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"any"},{"type":"bigint"}],"returns":"any[]","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"bigint"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"blob"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"date"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"hugeint"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"integer"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"timestamp with time zone"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"timestamp"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"any","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"blob"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"date"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"hugeint"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"timestamp with time zone"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"timestamp"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"bigint"},{"type":"varchar"}],"returns":"bigint","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"blob"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"date"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"double"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"hugeint"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"integer"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"timestamp with time zone"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"timestamp"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"blob"},{"type":"varchar"}],"returns":"blob","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"bigint"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"blob"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"date"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"hugeint"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"integer"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"timestamp"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"date"},{"type":"varchar"}],"returns":"date","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"bigint"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"blob"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"date"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"hugeint"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"timestamp with time zone"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"timestamp"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"decimal"},{"type":"varchar"}],"returns":"decimal","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"bigint"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"blob"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"date"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"hugeint"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"timestamp with time zone"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"timestamp"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"double"},{"type":"varchar"}],"returns":"double","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"blob"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"date"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"hugeint"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"timestamp with time zone"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"timestamp"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"integer"},{"type":"varchar"}],"returns":"integer","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"bigint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"blob"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"hugeint"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"timestamp"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"bigint"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"blob"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"date"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"hugeint"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"integer"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp with time zone"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"timestamp","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"blob"}],"returns":"varchar","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"double"}],"returns":"varchar","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"hugeint"}],"returns":"varchar","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"integer"}],"returns":"varchar","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar","nullable":true} +{"name":"min_by","kind":"a","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"minute","args":[{"type":"date"}],"returns":"bigint"} +{"name":"minute","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"minute","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"minute","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"minute","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"minute","args":[{"type":"time"}],"returns":"bigint"} +{"name":"minute","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"mismatches","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"bigint"} +{"name":"mod","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"mod","args":[{"type":"decimal"},{"type":"decimal"}],"returns":"decimal"} +{"name":"mod","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"mod","args":[{"type":"float"},{"type":"float"}],"returns":"float"} +{"name":"mod","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"mod","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"mod","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"mod","args":[{"type":"tinyint"},{"type":"tinyint"}],"returns":"tinyint"} +{"name":"mod","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"mod","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"mod","args":[{"type":"uinteger"},{"type":"uinteger"}],"returns":"uinteger"} +{"name":"mod","args":[{"type":"usmallint"},{"type":"usmallint"}],"returns":"usmallint"} +{"name":"mod","args":[{"type":"utinyint"},{"type":"utinyint"}],"returns":"utinyint"} +{"name":"mode","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"month","args":[{"type":"date"}],"returns":"bigint"} +{"name":"month","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"month","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"month","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"monthname","args":[{"type":"date"}],"returns":"varchar"} +{"name":"monthname","args":[{"type":"timestamp with time zone"}],"returns":"varchar"} +{"name":"monthname","args":[{"type":"timestamp"}],"returns":"varchar"} +{"name":"multiply","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"multiply","args":[{"type":"bigint"},{"type":"interval"}],"returns":"interval"} +{"name":"multiply","args":[{"type":"decimal"},{"type":"decimal"}],"returns":"decimal"} +{"name":"multiply","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"multiply","args":[{"type":"double"},{"type":"interval"}],"returns":"interval"} +{"name":"multiply","args":[{"type":"float"},{"type":"float"}],"returns":"float"} +{"name":"multiply","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"multiply","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"multiply","args":[{"type":"interval"},{"type":"bigint"}],"returns":"interval"} +{"name":"multiply","args":[{"type":"interval"},{"type":"double"}],"returns":"interval"} +{"name":"multiply","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"multiply","args":[{"type":"tinyint"},{"type":"tinyint"}],"returns":"tinyint"} +{"name":"multiply","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"multiply","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"multiply","args":[{"type":"uinteger"},{"type":"uinteger"}],"returns":"uinteger"} +{"name":"multiply","args":[{"type":"usmallint"},{"type":"usmallint"}],"returns":"usmallint"} +{"name":"multiply","args":[{"type":"utinyint"},{"type":"utinyint"}],"returns":"utinyint"} +{"name":"nanosecond","args":[{"type":"date"}],"returns":"bigint"} +{"name":"nanosecond","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"nanosecond","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"nanosecond","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"nanosecond","args":[{"type":"timestamptz_ns"}],"returns":"bigint"} +{"name":"nanosecond","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"nanosecond","args":[{"type":"timestamp_ns"}],"returns":"bigint"} +{"name":"nanosecond","args":[{"type":"time"}],"returns":"bigint"} +{"name":"nanosecond","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"nextafter","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"nextafter","args":[{"type":"float"},{"type":"float"}],"returns":"float"} +{"name":"nextval","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"nfc_normalize","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"normalized_interval","args":[{"type":"interval"}],"returns":"interval"} +{"name":"not_ilike_escape","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"not_like_escape","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"now","returns":"timestamp with time zone"} +{"name":"nth_value","kind":"w","args":[{"type":"any"},{"type":"bigint"}],"returns":"any"} +{"name":"ntile","kind":"w","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"octet_length","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"octet_length","args":[{"type":"blob"}],"returns":"bigint"} +{"name":"ord","args":[{"type":"varchar"}],"returns":"integer"} +{"name":"overlay","args":[{"type":"varchar"},{"type":"varchar"},{"type":"bigint"},{"type":"bigint"}],"returns":"varchar"} +{"name":"overlay","args":[{"type":"varchar"},{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"parse_dirname","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"parse_dirname","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"parse_dirpath","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"parse_dirpath","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"parse_duckdb_log_message","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"any"} +{"name":"parse_filename","args":[{"type":"varchar"},{"type":"boolean"},{"type":"varchar"}],"returns":"varchar"} +{"name":"parse_filename","args":[{"type":"varchar"},{"type":"boolean"}],"returns":"varchar"} +{"name":"parse_filename","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"parse_filename","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"parse_formatted_bytes","args":[{"type":"varchar"}],"returns":"ubigint"} +{"name":"parse_path","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"parse_path","args":[{"type":"varchar"}],"returns":"varchar[]"} +{"name":"path_join","args":[{"type":"varchar"},{"type":"varchar","mode":"v"}],"returns":"varchar"} +{"name":"percent_rank","kind":"w","returns":"double"} +{"name":"pi","returns":"double"} +{"name":"position","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"bigint"} +{"name":"pow","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"power","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"prefix","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"printf","args":[{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"varchar"} +{"name":"product","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"quantile","kind":"a","args":[{"type":"any"},{"type":"double[]"}],"returns":"any","nullable":true} +{"name":"quantile","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"quantile","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"bigint"},{"type":"double[]"}],"returns":"bigint","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"date"},{"type":"double[]"}],"returns":"date","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"date"},{"type":"double"}],"returns":"date","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"decimal"},{"type":"double[]"}],"returns":"decimal","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"double"},{"type":"double[]"}],"returns":"double","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"float"},{"type":"double[]"}],"returns":"float","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"float"},{"type":"double"}],"returns":"float","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"hugeint"},{"type":"double[]"}],"returns":"hugeint","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"hugeint"},{"type":"double"}],"returns":"hugeint","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"integer"},{"type":"double[]"}],"returns":"integer","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"smallint"},{"type":"double[]"}],"returns":"smallint","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"smallint"},{"type":"double"}],"returns":"smallint","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"time with time zone"},{"type":"double[]"}],"returns":"time with time zone","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"time with time zone"},{"type":"double"}],"returns":"time with time zone","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"time"},{"type":"double[]"}],"returns":"time","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"time"},{"type":"double"}],"returns":"time","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double[]"}],"returns":"timestamp with time zone","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"timestamp with time zone"},{"type":"double"}],"returns":"timestamp with time zone","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"timestamp"},{"type":"double[]"}],"returns":"timestamp","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"timestamp"},{"type":"double"}],"returns":"timestamp","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"timestamptz_ns"},{"type":"double[]"}],"returns":"timestamptz_ns","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"timestamptz_ns"},{"type":"double"}],"returns":"timestamptz_ns","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"tinyint"},{"type":"double[]"}],"returns":"tinyint","nullable":true} +{"name":"quantile_cont","kind":"a","args":[{"type":"tinyint"},{"type":"double"}],"returns":"tinyint","nullable":true} +{"name":"quantile_disc","kind":"a","args":[{"type":"any"},{"type":"double[]"}],"returns":"any","nullable":true} +{"name":"quantile_disc","kind":"a","args":[{"type":"any"},{"type":"double"}],"returns":"any","nullable":true} +{"name":"quantile_disc","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"quarter","args":[{"type":"date"}],"returns":"bigint"} +{"name":"quarter","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"quarter","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"quarter","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"radians","args":[{"type":"double"}],"returns":"double"} +{"name":"random","returns":"double"} +{"name":"range","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"}],"returns":"bigint[]"} +{"name":"range","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint[]"} +{"name":"range","args":[{"type":"bigint"}],"returns":"bigint[]"} +{"name":"range","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"timestamp with time zone[]"} +{"name":"range","args":[{"type":"timestamp"},{"type":"timestamp"},{"type":"interval"}],"returns":"timestamp[]"} +{"name":"rank","kind":"w","returns":"bigint"} +{"name":"rank_dense","kind":"w","returns":"bigint"} +{"name":"regexp_escape","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar[]"},{"type":"varchar"}],"returns":"varchar"} +{"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar"} +{"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"integer"},{"type":"varchar"}],"returns":"varchar"} +{"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"integer"}],"returns":"varchar"} +{"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"regexp_extract_all","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar[]"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"regexp_extract_all","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"regexp_extract_all","args":[{"type":"varchar"},{"type":"varchar"},{"type":"integer"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"regexp_extract_all","args":[{"type":"varchar"},{"type":"varchar"},{"type":"integer"}],"returns":"varchar[]"} +{"name":"regexp_extract_all","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"regexp_full_match","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"regexp_full_match","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"regexp_matches","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"regexp_matches","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"regexp_replace","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"regexp_replace","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"regexp_split_to_array","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"regexp_split_to_array","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"regr_avgx","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"regr_avgy","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"regr_count","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"uinteger","nullable":true} +{"name":"regr_intercept","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"regr_r2","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"regr_slope","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"regr_sxx","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"regr_sxy","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"regr_syy","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"remap_struct","args":[{"type":"any"},{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"repeat","args":[{"type":"any[]"},{"type":"bigint"}],"returns":"any[]"} +{"name":"repeat","args":[{"type":"blob"},{"type":"bigint"}],"returns":"blob"} +{"name":"repeat","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"replace","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"replace_type","args":[{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"bigint"},{"type":"double[]"},{"type":"integer"}],"returns":"bigint[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"bigint"},{"type":"double[]"}],"returns":"bigint[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"bigint"},{"type":"double"},{"type":"integer"}],"returns":"bigint","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"bigint"},{"type":"double"}],"returns":"bigint","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"decimal"},{"type":"double[]"},{"type":"integer"}],"returns":"decimal[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"decimal"},{"type":"double[]"}],"returns":"decimal[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"decimal"},{"type":"double"},{"type":"integer"}],"returns":"decimal","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"decimal"},{"type":"double"}],"returns":"decimal","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"double"},{"type":"double[]"},{"type":"integer"}],"returns":"double[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"double"},{"type":"double[]"}],"returns":"double[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"double"},{"type":"double"},{"type":"integer"}],"returns":"double","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"double"},{"type":"double"}],"returns":"double","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"float"},{"type":"double[]"},{"type":"integer"}],"returns":"float[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"float"},{"type":"double[]"}],"returns":"float[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"float"},{"type":"double"},{"type":"integer"}],"returns":"float","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"float"},{"type":"double"}],"returns":"float","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"hugeint"},{"type":"double[]"},{"type":"integer"}],"returns":"hugeint[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"hugeint"},{"type":"double[]"}],"returns":"hugeint[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"hugeint"},{"type":"double"},{"type":"integer"}],"returns":"hugeint","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"hugeint"},{"type":"double"}],"returns":"hugeint","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"integer"},{"type":"double[]"},{"type":"integer"}],"returns":"integer[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"integer"},{"type":"double[]"}],"returns":"integer[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"integer"},{"type":"double"},{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"integer"},{"type":"double"}],"returns":"integer","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"smallint"},{"type":"double[]"},{"type":"integer"}],"returns":"smallint[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"smallint"},{"type":"double[]"}],"returns":"smallint[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"smallint"},{"type":"double"},{"type":"integer"}],"returns":"smallint","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"smallint"},{"type":"double"}],"returns":"smallint","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"tinyint"},{"type":"double[]"},{"type":"integer"}],"returns":"tinyint[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"tinyint"},{"type":"double[]"}],"returns":"tinyint[]","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"tinyint"},{"type":"double"},{"type":"integer"}],"returns":"tinyint","nullable":true} +{"name":"reservoir_quantile","kind":"a","args":[{"type":"tinyint"},{"type":"double"}],"returns":"tinyint","nullable":true} +{"name":"reverse","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"right","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"right_grapheme","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"round","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"round","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"round","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal"} +{"name":"round","args":[{"type":"decimal"}],"returns":"decimal"} +{"name":"round","args":[{"type":"double"},{"type":"integer"}],"returns":"double"} +{"name":"round","args":[{"type":"double"}],"returns":"double"} +{"name":"round","args":[{"type":"float"},{"type":"integer"}],"returns":"float"} +{"name":"round","args":[{"type":"float"}],"returns":"float"} +{"name":"round","args":[{"type":"hugeint"},{"type":"integer"}],"returns":"hugeint"} +{"name":"round","args":[{"type":"hugeint"}],"returns":"hugeint"} +{"name":"round","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"round","args":[{"type":"integer"}],"returns":"integer"} +{"name":"round","args":[{"type":"smallint"},{"type":"integer"}],"returns":"smallint"} +{"name":"round","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"round","args":[{"type":"tinyint"},{"type":"integer"}],"returns":"tinyint"} +{"name":"round","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"round_even","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"round_even","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal"} +{"name":"round_even","args":[{"type":"double"},{"type":"integer"}],"returns":"double"} +{"name":"round_even","args":[{"type":"float"},{"type":"integer"}],"returns":"float"} +{"name":"round_even","args":[{"type":"hugeint"},{"type":"integer"}],"returns":"hugeint"} +{"name":"round_even","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"round_even","args":[{"type":"smallint"},{"type":"integer"}],"returns":"smallint"} +{"name":"round_even","args":[{"type":"tinyint"},{"type":"integer"}],"returns":"tinyint"} +{"name":"roundbankers","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"roundbankers","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal"} +{"name":"roundbankers","args":[{"type":"double"},{"type":"integer"}],"returns":"double"} +{"name":"roundbankers","args":[{"type":"float"},{"type":"integer"}],"returns":"float"} +{"name":"roundbankers","args":[{"type":"hugeint"},{"type":"integer"}],"returns":"hugeint"} +{"name":"roundbankers","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"roundbankers","args":[{"type":"smallint"},{"type":"integer"}],"returns":"smallint"} +{"name":"roundbankers","args":[{"type":"tinyint"},{"type":"integer"}],"returns":"tinyint"} +{"name":"row","args":[{"type":"any","mode":"v"}],"returns":"tuple"} +{"name":"row_number","kind":"w","returns":"bigint"} +{"name":"row_to_json","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"rpad","args":[{"type":"varchar"},{"type":"integer"},{"type":"varchar"}],"returns":"varchar"} +{"name":"rtrim","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"rtrim","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"second","args":[{"type":"date"}],"returns":"bigint"} +{"name":"second","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"second","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"second","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"second","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"second","args":[{"type":"time"}],"returns":"bigint"} +{"name":"second","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"sem","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"set_bit","args":[{"type":"bit"},{"type":"integer"},{"type":"integer"}],"returns":"bit"} +{"name":"setval","args":[{"type":"varchar"},{"type":"bigint"},{"type":"boolean"}],"returns":"bigint"} +{"name":"setval","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"bigint"} +{"name":"sha1","args":[{"type":"blob"}],"returns":"varchar"} +{"name":"sha1","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"sha256","args":[{"type":"blob"}],"returns":"varchar"} +{"name":"sha256","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"sign","args":[{"type":"bigint"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"double"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"float"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"hugeint"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"integer"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"smallint"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"ubigint"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"uhugeint"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"uinteger"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"usmallint"}],"returns":"tinyint"} +{"name":"sign","args":[{"type":"utinyint"}],"returns":"tinyint"} +{"name":"signbit","args":[{"type":"double"}],"returns":"boolean"} +{"name":"signbit","args":[{"type":"float"}],"returns":"boolean"} +{"name":"sin","args":[{"type":"double"}],"returns":"double"} +{"name":"sinh","args":[{"type":"double"}],"returns":"double"} +{"name":"skewness","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"split","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"sqrt","args":[{"type":"double"}],"returns":"double"} +{"name":"st_asbinary","args":[{"type":"geometry"}],"returns":"blob"} +{"name":"st_asgeojson","args":[{"type":"geometry"}],"returns":"json"} +{"name":"st_astext","args":[{"type":"geometry"}],"returns":"varchar"} +{"name":"st_aswkb","args":[{"type":"geometry"}],"returns":"blob"} +{"name":"st_aswkt","args":[{"type":"geometry"}],"returns":"varchar"} +{"name":"st_crs","args":[{"type":"geometry"}],"returns":"varchar"} +{"name":"st_geomfromgeojson","args":[{"type":"json"}],"returns":"geometry"} +{"name":"st_geomfromgeojson","args":[{"type":"varchar"}],"returns":"geometry"} +{"name":"st_geomfromwkb","args":[{"type":"blob"}],"returns":"geometry"} +{"name":"st_intersects_extent","args":[{"type":"geometry"},{"type":"geometry"}],"returns":"boolean"} +{"name":"st_setcrs","args":[{"type":"geometry"},{"type":"varchar"}],"returns":"geometry"} +{"name":"starts_with","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"stats","args":[{"type":"any"}],"returns":"variant"} +{"name":"stddev","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"stddev_pop","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"stddev_samp","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"str_split","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"str_split_regex","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"str_split_regex","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"strftime","args":[{"type":"date"},{"type":"varchar"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"timestamp"},{"type":"varchar"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"timestamptz_ns"},{"type":"varchar"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"timestamp_ns"},{"type":"varchar"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"varchar"},{"type":"date"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"varchar"},{"type":"timestamptz_ns"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"varchar"} +{"name":"strftime","args":[{"type":"varchar"},{"type":"timestamp_ns"}],"returns":"varchar"} +{"name":"string_agg","kind":"a","args":[{"type":"any"},{"type":"varchar"}],"returns":"varchar","nullable":true} +{"name":"string_agg","kind":"a","args":[{"type":"any"}],"returns":"varchar","nullable":true} +{"name":"string_split","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"string_split_regex","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"string_split_regex","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"string_to_array","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"strip_accents","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"strlen","args":[{"type":"varchar"}],"returns":"bigint"} +{"name":"strpos","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"bigint"} +{"name":"strptime","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"timestamp"} +{"name":"strptime","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"timestamp"} +{"name":"struct_concat","args":[{"type":"any","mode":"v"}],"returns":"struct"} +{"name":"struct_contains","args":[{"type":"tuple"},{"type":"any"}],"returns":"boolean"} +{"name":"struct_extract","args":[{"type":"struct"},{"type":"varchar"}],"returns":"any"} +{"name":"struct_extract","args":[{"type":"tuple"},{"type":"bigint"}],"returns":"any"} +{"name":"struct_extract_at","args":[{"type":"struct"},{"type":"bigint"}],"returns":"any"} +{"name":"struct_has","args":[{"type":"tuple"},{"type":"any"}],"returns":"boolean"} +{"name":"struct_indexof","args":[{"type":"tuple"},{"type":"any"}],"returns":"integer"} +{"name":"struct_insert","args":[{"type":"any","mode":"v"}],"returns":"struct"} +{"name":"struct_keys","args":[{"type":"any"}],"returns":"varchar[]"} +{"name":"struct_pack","args":[{"type":"any","mode":"v"}],"returns":"struct"} +{"name":"struct_position","args":[{"type":"tuple"},{"type":"any"}],"returns":"integer"} +{"name":"struct_update","args":[{"type":"any","mode":"v"}],"returns":"struct"} +{"name":"struct_values","args":[{"type":"struct"}],"returns":"tuple"} +{"name":"substr","args":[{"type":"varchar"},{"type":"bigint"},{"type":"bigint"}],"returns":"varchar"} +{"name":"substr","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"substring","args":[{"type":"varchar"},{"type":"bigint"},{"type":"bigint"}],"returns":"varchar"} +{"name":"substring","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"substring_grapheme","args":[{"type":"varchar"},{"type":"bigint"},{"type":"bigint"}],"returns":"varchar"} +{"name":"substring_grapheme","args":[{"type":"varchar"},{"type":"bigint"}],"returns":"varchar"} +{"name":"subtract","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"subtract","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"subtract","args":[{"type":"bignum"},{"type":"bignum"}],"returns":"bignum"} +{"name":"subtract","args":[{"type":"bignum"}],"returns":"bignum"} +{"name":"subtract","args":[{"type":"date"},{"type":"date"}],"returns":"bigint"} +{"name":"subtract","args":[{"type":"date"},{"type":"integer"}],"returns":"date"} +{"name":"subtract","args":[{"type":"date"},{"type":"interval"}],"returns":"timestamp"} +{"name":"subtract","args":[{"type":"decimal"},{"type":"decimal"}],"returns":"decimal"} +{"name":"subtract","args":[{"type":"decimal"}],"returns":"decimal"} +{"name":"subtract","args":[{"type":"double"},{"type":"double"}],"returns":"double"} +{"name":"subtract","args":[{"type":"double"}],"returns":"double"} +{"name":"subtract","args":[{"type":"float"},{"type":"float"}],"returns":"float"} +{"name":"subtract","args":[{"type":"float"}],"returns":"float"} +{"name":"subtract","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"subtract","args":[{"type":"hugeint"}],"returns":"hugeint"} +{"name":"subtract","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"subtract","args":[{"type":"integer"}],"returns":"integer"} +{"name":"subtract","args":[{"type":"interval"},{"type":"interval"}],"returns":"interval"} +{"name":"subtract","args":[{"type":"interval"}],"returns":"interval"} +{"name":"subtract","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"subtract","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"subtract","args":[{"type":"time with time zone"},{"type":"interval"}],"returns":"time with time zone"} +{"name":"subtract","args":[{"type":"time"},{"type":"interval"}],"returns":"time"} +{"name":"subtract","args":[{"type":"timestamp"},{"type":"interval"}],"returns":"timestamp"} +{"name":"subtract","args":[{"type":"timestamp"},{"type":"timestamp"}],"returns":"interval"} +{"name":"subtract","args":[{"type":"tinyint"},{"type":"tinyint"}],"returns":"tinyint"} +{"name":"subtract","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"subtract","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"subtract","args":[{"type":"ubigint"}],"returns":"ubigint"} +{"name":"subtract","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"subtract","args":[{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"subtract","args":[{"type":"uinteger"},{"type":"uinteger"}],"returns":"uinteger"} +{"name":"subtract","args":[{"type":"uinteger"}],"returns":"uinteger"} +{"name":"subtract","args":[{"type":"usmallint"},{"type":"usmallint"}],"returns":"usmallint"} +{"name":"subtract","args":[{"type":"usmallint"}],"returns":"usmallint"} +{"name":"subtract","args":[{"type":"utinyint"},{"type":"utinyint"}],"returns":"utinyint"} +{"name":"subtract","args":[{"type":"utinyint"}],"returns":"utinyint"} +{"name":"suffix","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"boolean"} +{"name":"sum","kind":"a","args":[{"type":"bigint"}],"returns":"hugeint","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"bignum"}],"returns":"bignum","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"boolean"}],"returns":"hugeint","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"hugeint"}],"returns":"hugeint","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"integer"}],"returns":"hugeint","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"smallint"}],"returns":"hugeint","nullable":true} +{"name":"sum_no_overflow","kind":"a","args":[{"type":"bigint"}],"returns":"hugeint","nullable":true} +{"name":"sum_no_overflow","kind":"a","args":[{"type":"decimal"}],"returns":"decimal","nullable":true} +{"name":"sum_no_overflow","kind":"a","args":[{"type":"integer"}],"returns":"hugeint","nullable":true} +{"name":"sumkahan","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"switch","args":[{"type":"map"},{"type":"any"}],"returns":"any"} +{"name":"switch","args":[{"type":"map"}],"returns":"any"} +{"name":"switch","args":[{"type":"any"},{"type":"map"},{"type":"any"}],"returns":"any"} +{"name":"switch","args":[{"type":"any"},{"type":"map"}],"returns":"any"} +{"name":"tan","args":[{"type":"double"}],"returns":"double"} +{"name":"tanh","args":[{"type":"double"}],"returns":"double"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"date"},{"type":"date"}],"returns":"date"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"date"},{"type":"interval"}],"returns":"date"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"date"}],"returns":"date"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"time"},{"type":"interval"}],"returns":"time"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"time"},{"type":"time"}],"returns":"time"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"timestamp with time zone"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"timestamp with time zone"},{"type":"varchar"}],"returns":"timestamp with time zone"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"timestamp"},{"type":"interval"}],"returns":"timestamp"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"timestamp"},{"type":"timestamp"}],"returns":"timestamp"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"timestamp"}],"returns":"timestamp"} +{"name":"time_bucket","args":[{"type":"interval"},{"type":"time"}],"returns":"time"} +{"name":"timetz_byte_comparable","args":[{"type":"time with time zone"}],"returns":"ubigint"} +{"name":"timezone","args":[{"type":"date"}],"returns":"bigint"} +{"name":"timezone","args":[{"type":"interval"},{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"timezone","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"timezone","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"timezone","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"timezone","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"timezone","args":[{"type":"time"}],"returns":"bigint"} +{"name":"timezone","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"timezone","args":[{"type":"varchar"},{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"timezone","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"timestamp"} +{"name":"timezone","args":[{"type":"varchar"},{"type":"timestamptz_ns"}],"returns":"timestamp_ns"} +{"name":"timezone","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"timestamp with time zone"} +{"name":"timezone","args":[{"type":"varchar"},{"type":"timestamp_ns"}],"returns":"timestamptz_ns"} +{"name":"timezone_hour","args":[{"type":"date"}],"returns":"bigint"} +{"name":"timezone_hour","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"timezone_hour","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"timezone_hour","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"timezone_hour","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"timezone_hour","args":[{"type":"time"}],"returns":"bigint"} +{"name":"timezone_hour","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"timezone_minute","args":[{"type":"date"}],"returns":"bigint"} +{"name":"timezone_minute","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"timezone_minute","args":[{"type":"time with time zone"}],"returns":"bigint"} +{"name":"timezone_minute","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"timezone_minute","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"timezone_minute","args":[{"type":"time"}],"returns":"bigint"} +{"name":"timezone_minute","args":[{"type":"time_ns"}],"returns":"bigint"} +{"name":"to_aggregate_state","args":[{"type":"any"},{"type":"varchar"},{"type":"any[]"},{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"to_aggregate_state","args":[{"type":"any"},{"type":"varchar"},{"type":"any[]"},{"type":"any"}],"returns":"any"} +{"name":"to_aggregate_state","args":[{"type":"any"},{"type":"varchar"},{"type":"any[]"}],"returns":"any"} +{"name":"to_base","args":[{"type":"bigint"},{"type":"integer"},{"type":"integer"}],"returns":"varchar"} +{"name":"to_base","args":[{"type":"bigint"},{"type":"integer"}],"returns":"varchar"} +{"name":"to_base64","args":[{"type":"blob"}],"returns":"varchar"} +{"name":"to_binary","args":[{"type":"bigint"}],"returns":"varchar"} +{"name":"to_binary","args":[{"type":"bignum"}],"returns":"varchar"} +{"name":"to_binary","args":[{"type":"hugeint"}],"returns":"varchar"} +{"name":"to_binary","args":[{"type":"ubigint"}],"returns":"varchar"} +{"name":"to_binary","args":[{"type":"uhugeint"}],"returns":"varchar"} +{"name":"to_binary","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"to_centuries","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_centuries","args":[{"type":"integer"}],"returns":"interval"} +{"name":"to_days","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_days","args":[{"type":"integer"}],"returns":"interval"} +{"name":"to_decades","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_decades","args":[{"type":"integer"}],"returns":"interval"} +{"name":"to_hex","args":[{"type":"bigint"}],"returns":"varchar"} +{"name":"to_hex","args":[{"type":"bignum"}],"returns":"varchar"} +{"name":"to_hex","args":[{"type":"blob"}],"returns":"varchar"} +{"name":"to_hex","args":[{"type":"hugeint"}],"returns":"varchar"} +{"name":"to_hex","args":[{"type":"ubigint"}],"returns":"varchar"} +{"name":"to_hex","args":[{"type":"uhugeint"}],"returns":"varchar"} +{"name":"to_hex","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"to_hours","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_json","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"to_microseconds","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_millennia","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_millennia","args":[{"type":"integer"}],"returns":"interval"} +{"name":"to_milliseconds","args":[{"type":"double"}],"returns":"interval"} +{"name":"to_minutes","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_months","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_months","args":[{"type":"integer"}],"returns":"interval"} +{"name":"to_quarters","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_quarters","args":[{"type":"integer"}],"returns":"interval"} +{"name":"to_seconds","args":[{"type":"double"}],"returns":"interval"} +{"name":"to_timestamp","args":[{"type":"double"}],"returns":"timestamp with time zone"} +{"name":"to_weeks","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_weeks","args":[{"type":"integer"}],"returns":"interval"} +{"name":"to_years","args":[{"type":"bigint"}],"returns":"interval"} +{"name":"to_years","args":[{"type":"integer"}],"returns":"interval"} +{"name":"today","returns":"date"} +{"name":"transaction_timestamp","returns":"timestamp with time zone"} +{"name":"translate","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"trim","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} +{"name":"trim","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"trunc","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"trunc","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"trunc","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal"} +{"name":"trunc","args":[{"type":"decimal"}],"returns":"decimal"} +{"name":"trunc","args":[{"type":"double"},{"type":"integer"}],"returns":"double"} +{"name":"trunc","args":[{"type":"double"}],"returns":"double"} +{"name":"trunc","args":[{"type":"float"},{"type":"integer"}],"returns":"float"} +{"name":"trunc","args":[{"type":"float"}],"returns":"float"} +{"name":"trunc","args":[{"type":"hugeint"},{"type":"integer"}],"returns":"hugeint"} +{"name":"trunc","args":[{"type":"hugeint"}],"returns":"hugeint"} +{"name":"trunc","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"integer"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"smallint"},{"type":"integer"}],"returns":"smallint"} +{"name":"trunc","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"trunc","args":[{"type":"tinyint"},{"type":"integer"}],"returns":"tinyint"} +{"name":"trunc","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"trunc","args":[{"type":"ubigint"},{"type":"integer"}],"returns":"ubigint"} +{"name":"trunc","args":[{"type":"ubigint"}],"returns":"ubigint"} +{"name":"trunc","args":[{"type":"uhugeint"},{"type":"integer"}],"returns":"uhugeint"} +{"name":"trunc","args":[{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"trunc","args":[{"type":"uinteger"},{"type":"integer"}],"returns":"uinteger"} +{"name":"trunc","args":[{"type":"uinteger"}],"returns":"uinteger"} +{"name":"trunc","args":[{"type":"usmallint"},{"type":"integer"}],"returns":"usmallint"} +{"name":"trunc","args":[{"type":"usmallint"}],"returns":"usmallint"} +{"name":"trunc","args":[{"type":"utinyint"},{"type":"integer"}],"returns":"utinyint"} +{"name":"trunc","args":[{"type":"utinyint"}],"returns":"utinyint"} +{"name":"try_strptime","args":[{"type":"varchar"},{"type":"varchar[]"}],"returns":"timestamp"} +{"name":"try_strptime","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"timestamp"} +{"name":"txid_current","returns":"ubigint"} +{"name":"typeof","args":[{"type":"any"}],"returns":"varchar"} +{"name":"ucase","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"unbin","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"unhex","args":[{"type":"varchar"}],"returns":"blob"} +{"name":"unicode","args":[{"type":"varchar"}],"returns":"integer"} +{"name":"union_extract","args":[{"type":"union"},{"type":"varchar"}],"returns":"any"} +{"name":"union_tag","args":[{"type":"union"}],"returns":"any"} +{"name":"union_value","args":[{"type":"any","mode":"v"}],"returns":"union"} +{"name":"unpivot_list","args":[{"type":"any","mode":"v"}],"returns":"list"} +{"name":"upper","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"url_decode","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"url_encode","args":[{"type":"varchar"}],"returns":"varchar"} +{"name":"uuid","returns":"uuid"} +{"name":"uuid_extract_timestamp","args":[{"type":"uuid"}],"returns":"timestamp with time zone"} +{"name":"uuid_extract_version","args":[{"type":"uuid"}],"returns":"uinteger"} +{"name":"uuidv4","returns":"uuid"} +{"name":"uuidv7","returns":"uuid"} +{"name":"var_pop","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"var_samp","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"variance","kind":"a","args":[{"type":"double"}],"returns":"double","nullable":true} +{"name":"variant_array_length","args":[{"type":"variant"},{"type":"varchar[]"}],"returns":"ubigint[]"} +{"name":"variant_array_length","args":[{"type":"variant"},{"type":"varchar"}],"returns":"ubigint"} +{"name":"variant_array_length","args":[{"type":"variant"}],"returns":"ubigint"} +{"name":"variant_bytes_to_variant","args":[{"type":"blob"}],"returns":"variant"} +{"name":"variant_comparator","args":[{"type":"variant"}],"returns":"blob"} +{"name":"variant_contains","args":[{"type":"variant"},{"type":"variant"}],"returns":"boolean"} +{"name":"variant_exists","args":[{"type":"variant"},{"type":"varchar[]"}],"returns":"boolean[]"} +{"name":"variant_exists","args":[{"type":"variant"},{"type":"varchar"}],"returns":"boolean"} +{"name":"variant_extract","args":[{"type":"variant"},{"type":"uinteger"}],"returns":"variant"} +{"name":"variant_extract","args":[{"type":"variant"},{"type":"varchar"}],"returns":"variant"} +{"name":"variant_extract_string","args":[{"type":"variant"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"variant_extract_string","args":[{"type":"variant"},{"type":"varchar"}],"returns":"varchar"} +{"name":"variant_group_object","kind":"a","args":[{"type":"varchar"},{"type":"variant"}],"returns":"variant","nullable":true} +{"name":"variant_keys","args":[{"type":"variant"},{"type":"varchar[]"}],"returns":"varchar[][]"} +{"name":"variant_keys","args":[{"type":"variant"},{"type":"varchar"}],"returns":"varchar[]"} +{"name":"variant_keys","args":[{"type":"variant"}],"returns":"varchar[]"} +{"name":"variant_normalize","args":[{"type":"variant"}],"returns":"variant"} +{"name":"variant_to_parquet_variant","args":[{"type":"variant"}],"returns":"any"} +{"name":"variant_type","args":[{"type":"variant"},{"type":"varchar[]"}],"returns":"varchar[]"} +{"name":"variant_type","args":[{"type":"variant"},{"type":"varchar"}],"returns":"varchar"} +{"name":"variant_type","args":[{"type":"variant"}],"returns":"varchar"} +{"name":"variant_typeof","args":[{"type":"variant"}],"returns":"varchar"} +{"name":"vector_type","args":[{"type":"any"}],"returns":"varchar"} +{"name":"version","returns":"varchar"} +{"name":"vertex_extract","args":[{"type":"geometry"},{"type":"varchar"}],"returns":"double"} +{"name":"week","args":[{"type":"date"}],"returns":"bigint"} +{"name":"week","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"week","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"week","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"weekday","args":[{"type":"date"}],"returns":"bigint"} +{"name":"weekday","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"weekday","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"weekday","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"weekofyear","args":[{"type":"date"}],"returns":"bigint"} +{"name":"weekofyear","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"weekofyear","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"weekofyear","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"write_log","args":[{"type":"varchar"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"xor","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"xor","args":[{"type":"bit"},{"type":"bit"}],"returns":"bit"} +{"name":"xor","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"hugeint"} +{"name":"xor","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"xor","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"xor","args":[{"type":"tinyint"},{"type":"tinyint"}],"returns":"tinyint"} +{"name":"xor","args":[{"type":"ubigint"},{"type":"ubigint"}],"returns":"ubigint"} +{"name":"xor","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"uhugeint"} +{"name":"xor","args":[{"type":"uinteger"},{"type":"uinteger"}],"returns":"uinteger"} +{"name":"xor","args":[{"type":"usmallint"},{"type":"usmallint"}],"returns":"usmallint"} +{"name":"xor","args":[{"type":"utinyint"},{"type":"utinyint"}],"returns":"utinyint"} +{"name":"year","args":[{"type":"date"}],"returns":"bigint"} +{"name":"year","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"year","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"year","args":[{"type":"timestamp"}],"returns":"bigint"} +{"name":"yearweek","args":[{"type":"date"}],"returns":"bigint"} +{"name":"yearweek","args":[{"type":"interval"}],"returns":"bigint"} +{"name":"yearweek","args":[{"type":"timestamp with time zone"}],"returns":"bigint"} +{"name":"yearweek","args":[{"type":"timestamp"}],"returns":"bigint"} diff --git a/internal/engine/duckdb/dialect/operators.jsonl b/internal/engine/duckdb/dialect/operators.jsonl new file mode 100644 index 0000000000..cb8789149c --- /dev/null +++ b/internal/engine/duckdb/dialect/operators.jsonl @@ -0,0 +1,157 @@ +{"name":"!~~","left":"varchar","right":"varchar","result":"boolean"} +{"name":"!~~*","left":"varchar","right":"varchar","result":"boolean"} +{"name":"%","left":"bigint","right":"bigint","result":"bigint"} +{"name":"%","left":"decimal","right":"decimal","result":"decimal"} +{"name":"%","left":"double","right":"double","result":"double"} +{"name":"%","left":"float","right":"float","result":"float"} +{"name":"%","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"%","left":"integer","right":"integer","result":"integer"} +{"name":"%","left":"smallint","right":"smallint","result":"smallint"} +{"name":"%","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"%","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"%","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"%","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"%","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"%","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"\u0026","left":"bigint","right":"bigint","result":"bigint"} +{"name":"\u0026","left":"bit","right":"bit","result":"bit"} +{"name":"\u0026","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"\u0026","left":"integer","right":"integer","result":"integer"} +{"name":"\u0026","left":"smallint","right":"smallint","result":"smallint"} +{"name":"\u0026","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"\u0026","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"\u0026","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"\u0026","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"\u0026","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"\u0026","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"\u0026\u0026","left":"geometry","right":"geometry","result":"boolean"} +{"name":"*","left":"bigint","right":"bigint","result":"bigint"} +{"name":"*","left":"bigint","right":"interval","result":"interval"} +{"name":"*","left":"decimal","right":"decimal","result":"decimal"} +{"name":"*","left":"double","right":"double","result":"double"} +{"name":"*","left":"double","right":"interval","result":"interval"} +{"name":"*","left":"float","right":"float","result":"float"} +{"name":"*","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"*","left":"integer","right":"integer","result":"integer"} +{"name":"*","left":"interval","right":"bigint","result":"interval"} +{"name":"*","left":"interval","right":"double","result":"interval"} +{"name":"*","left":"smallint","right":"smallint","result":"smallint"} +{"name":"*","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"*","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"*","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"*","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"*","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"*","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"**","left":"double","right":"double","result":"double"} +{"name":"+","left":"bigint","right":"bigint","result":"bigint"} +{"name":"+","left":"bignum","right":"bignum","result":"bignum"} +{"name":"+","left":"date","right":"integer","result":"date"} +{"name":"+","left":"date","right":"interval","result":"timestamp"} +{"name":"+","left":"date","right":"time with time zone","result":"timestamp with time zone"} +{"name":"+","left":"date","right":"time","result":"timestamp"} +{"name":"+","left":"decimal","right":"decimal","result":"decimal"} +{"name":"+","left":"double","right":"double","result":"double"} +{"name":"+","left":"float","right":"float","result":"float"} +{"name":"+","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"+","left":"integer","right":"date","result":"date"} +{"name":"+","left":"integer","right":"integer","result":"integer"} +{"name":"+","left":"interval","right":"date","result":"timestamp"} +{"name":"+","left":"interval","right":"interval","result":"interval"} +{"name":"+","left":"interval","right":"time with time zone","result":"time with time zone"} +{"name":"+","left":"interval","right":"timestamp with time zone","result":"timestamp with time zone"} +{"name":"+","left":"interval","right":"timestamp","result":"timestamp"} +{"name":"+","left":"interval","right":"time","result":"time"} +{"name":"+","left":"smallint","right":"smallint","result":"smallint"} +{"name":"+","left":"time with time zone","right":"date","result":"timestamp with time zone"} +{"name":"+","left":"time with time zone","right":"interval","result":"time with time zone"} +{"name":"+","left":"time","right":"date","result":"timestamp"} +{"name":"+","left":"time","right":"interval","result":"time"} +{"name":"+","left":"timestamp with time zone","right":"interval","result":"timestamp with time zone"} +{"name":"+","left":"timestamp","right":"interval","result":"timestamp"} +{"name":"+","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"+","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"+","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"+","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"+","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"+","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"-","left":"bigint","right":"bigint","result":"bigint"} +{"name":"-","left":"bignum","right":"bignum","result":"bignum"} +{"name":"-","left":"date","right":"date","result":"bigint"} +{"name":"-","left":"date","right":"integer","result":"date"} +{"name":"-","left":"date","right":"interval","result":"timestamp"} +{"name":"-","left":"decimal","right":"decimal","result":"decimal"} +{"name":"-","left":"double","right":"double","result":"double"} +{"name":"-","left":"float","right":"float","result":"float"} +{"name":"-","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"-","left":"integer","right":"integer","result":"integer"} +{"name":"-","left":"interval","right":"interval","result":"interval"} +{"name":"-","left":"smallint","right":"smallint","result":"smallint"} +{"name":"-","left":"time with time zone","right":"interval","result":"time with time zone"} +{"name":"-","left":"time","right":"interval","result":"time"} +{"name":"-","left":"timestamp with time zone","right":"interval","result":"timestamp with time zone"} +{"name":"-","left":"timestamp with time zone","right":"timestamp with time zone","result":"interval"} +{"name":"-","left":"timestamp","right":"interval","result":"timestamp"} +{"name":"-","left":"timestamp","right":"timestamp","result":"interval"} +{"name":"-","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"-","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"-","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"-","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"-","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"-","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"-\u003e\u003e","left":"json","right":"bigint","result":"varchar"} +{"name":"-\u003e\u003e","left":"json","right":"varchar","result":"varchar"} +{"name":"-\u003e\u003e","left":"varchar","right":"bigint","result":"varchar"} +{"name":"-\u003e\u003e","left":"varchar","right":"varchar","result":"varchar"} +{"name":"/","left":"double","right":"double","result":"double"} +{"name":"/","left":"float","right":"float","result":"float"} +{"name":"/","left":"interval","right":"double","result":"interval"} +{"name":"//","left":"bigint","right":"bigint","result":"bigint"} +{"name":"//","left":"double","right":"double","result":"double"} +{"name":"//","left":"float","right":"float","result":"float"} +{"name":"//","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"//","left":"integer","right":"integer","result":"integer"} +{"name":"//","left":"smallint","right":"smallint","result":"smallint"} +{"name":"//","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"//","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"//","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"//","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"//","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"//","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"\u003c\u003c","left":"bigint","right":"bigint","result":"bigint"} +{"name":"\u003c\u003c","left":"bit","right":"integer","result":"bit"} +{"name":"\u003c\u003c","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"\u003c\u003c","left":"integer","right":"integer","result":"integer"} +{"name":"\u003c\u003c","left":"smallint","right":"smallint","result":"smallint"} +{"name":"\u003c\u003c","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"\u003c\u003c","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"\u003c\u003c","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"\u003c\u003c","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"\u003c\u003c","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"\u003c\u003c","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"\u003e\u003e","left":"bigint","right":"bigint","result":"bigint"} +{"name":"\u003e\u003e","left":"bit","right":"integer","result":"bit"} +{"name":"\u003e\u003e","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"\u003e\u003e","left":"integer","right":"integer","result":"integer"} +{"name":"\u003e\u003e","left":"smallint","right":"smallint","result":"smallint"} +{"name":"\u003e\u003e","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"\u003e\u003e","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"\u003e\u003e","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"\u003e\u003e","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"\u003e\u003e","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"\u003e\u003e","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"^","left":"double","right":"double","result":"double"} +{"name":"^@","left":"varchar","right":"varchar","result":"boolean"} +{"name":"|","left":"bigint","right":"bigint","result":"bigint"} +{"name":"|","left":"bit","right":"bit","result":"bit"} +{"name":"|","left":"hugeint","right":"hugeint","result":"hugeint"} +{"name":"|","left":"integer","right":"integer","result":"integer"} +{"name":"|","left":"smallint","right":"smallint","result":"smallint"} +{"name":"|","left":"tinyint","right":"tinyint","result":"tinyint"} +{"name":"|","left":"ubigint","right":"ubigint","result":"ubigint"} +{"name":"|","left":"uhugeint","right":"uhugeint","result":"uhugeint"} +{"name":"|","left":"uinteger","right":"uinteger","result":"uinteger"} +{"name":"|","left":"usmallint","right":"usmallint","result":"usmallint"} +{"name":"|","left":"utinyint","right":"utinyint","result":"utinyint"} +{"name":"~~","left":"varchar","right":"varchar","result":"boolean"} +{"name":"~~*","left":"varchar","right":"varchar","result":"boolean"} +{"name":"~~~","left":"varchar","right":"varchar","result":"boolean"} diff --git a/internal/engine/duckdb/dialect/types.jsonl b/internal/engine/duckdb/dialect/types.jsonl new file mode 100644 index 0000000000..c88fc243ef --- /dev/null +++ b/internal/engine/duckdb/dialect/types.jsonl @@ -0,0 +1,41 @@ +{"name":"any","category":"U"} +{"name":"array","category":"C"} +{"name":"bigint","category":"N","aliases":["int64","int8","long","oid"]} +{"name":"bignum","category":"U","aliases":["varint"]} +{"name":"bit","category":"U","aliases":["bitstring"]} +{"name":"blob","category":"U","aliases":["binary","bytea","varbinary"]} +{"name":"boolean","category":"B","aliases":["bool","logical"]} +{"name":"date","category":"D"} +{"name":"decimal","category":"N","aliases":["dec","numeric"]} +{"name":"double","category":"N","aliases":["float8"]} +{"name":"enum","category":"U"} +{"name":"float","category":"N","aliases":["float4","real"]} +{"name":"geometry","category":"U"} +{"name":"hugeint","category":"N","aliases":["int128"]} +{"name":"integer","category":"N","aliases":["int","int32","int4","integral","signed"]} +{"name":"interval","category":"D"} +{"name":"list","category":"C"} +{"name":"map","category":"C"} +{"name":"smallint","category":"N","aliases":["int16","int2","short"]} +{"name":"struct","category":"C","aliases":["row"]} +{"name":"time","category":"D"} +{"name":"time with time zone","category":"D","aliases":["timetz"]} +{"name":"time_ns","category":"D"} +{"name":"timestamp","category":"D","aliases":["datetime","timestamp_us"]} +{"name":"timestamp with time zone","category":"D","aliases":["timestamptz"]} +{"name":"timestamp_ms","category":"D"} +{"name":"timestamp_ns","category":"D"} +{"name":"timestamp_s","category":"D"} +{"name":"timestamptz_ns","category":"D"} +{"name":"tinyint","category":"N","aliases":["int1"]} +{"name":"tuple","category":"U"} +{"name":"ubigint","category":"N","aliases":["uint64"]} +{"name":"uhugeint","category":"N","aliases":["uint128"]} +{"name":"uinteger","category":"N","aliases":["uint32"]} +{"name":"union","category":"C"} +{"name":"usmallint","category":"N","aliases":["uint16"]} +{"name":"utinyint","category":"N","aliases":["uint8"]} +{"name":"uuid","category":"U","aliases":["guid"]} +{"name":"varchar","category":"S","aliases":["bpchar","char","nvarchar","string","text"]} +{"name":"variant","category":"U"} +{"name":"json","category":"S","base":"varchar"} diff --git a/internal/engine/duckdb/parse.go b/internal/engine/duckdb/parse.go new file mode 100644 index 0000000000..76a996e562 --- /dev/null +++ b/internal/engine/duckdb/parse.go @@ -0,0 +1,67 @@ +package duckdb + +import ( + "context" + "errors" + "io" + + "github.com/sqlc-dev/darkwing/parser" + + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +func NewParser() *Parser { + return &Parser{} +} + +type Parser struct{} + +// Parse converts DuckDB SQL into sqlc's AST. darkwing assigns every +// statement a byte span and the spans tile the input — each statement +// starts where the previous one ended — so a statement's span covers the +// comments before it, which is where the sqlc query annotation lives. +func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { + stmts, err := parser.Parse(context.Background(), r) + if err != nil { + var perr *parser.Error + if errors.As(err, &perr) { + serr := &sqlerr.Error{ + Message: err.Error(), + Line: perr.Line, + Column: perr.Column, + } + if perr.Offset >= 0 { + serr.Location = perr.Offset + } + return nil, serr + } + return nil, err + } + + var out []ast.Statement + for _, stmt := range stmts { + converter := &cc{} + node := converter.convert(stmt) + if _, ok := node.(*ast.TODO); ok { + continue + } + out = append(out, ast.Statement{ + Raw: &ast.RawStmt{ + Stmt: node, + StmtLocation: stmt.Pos(), + StmtLen: stmt.End() - stmt.Pos(), + }, + }) + } + return out, nil +} + +// https://duckdb.org/docs/stable/sql/introduction#comments +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ + Dash: true, // -- comment + SlashStar: true, // /* comment */ + } +} diff --git a/internal/engine/duckdb/reserved.go b/internal/engine/duckdb/reserved.go new file mode 100644 index 0000000000..e80c397053 --- /dev/null +++ b/internal/engine/duckdb/reserved.go @@ -0,0 +1,9 @@ +package duckdb + +import "github.com/sqlc-dev/darkwing/token" + +// IsReservedKeyword reports whether s is a reserved keyword in DuckDB's +// grammar, per the keyword lists darkwing vendors from DuckDB. +func (p *Parser) IsReservedKeyword(s string) bool { + return token.Categories(s).Has(token.KeywordReserved) +} diff --git a/internal/engine/duckdb/seed.go b/internal/engine/duckdb/seed.go new file mode 100644 index 0000000000..852b5d217b --- /dev/null +++ b/internal/engine/duckdb/seed.go @@ -0,0 +1,23 @@ +package duckdb + +import ( + "embed" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/seed" +) + +// The dialect directory describes DuckDB's type system. types.jsonl, +// functions.jsonl and operators.jsonl are generated from a live DuckDB 2.0 +// CLI by goldeneye (internal/goldeneye), which also checks them against one; +// dialect.json is authored by hand. Regenerate from internal/goldeneye with: +// +// DUCKDB=/path/to/duckdb go run ./cmd/goldeneye generate duckdb +// +//go:embed dialect +var dialectFS embed.FS + +// Dialect returns the catalog option that seeds DuckDB's type system. +func Dialect() core.Option { + return seed.Dialect(dialectFS, "dialect") +} diff --git a/internal/engine/duckdb/utils.go b/internal/engine/duckdb/utils.go new file mode 100644 index 0000000000..490ad43b7d --- /dev/null +++ b/internal/engine/duckdb/utils.go @@ -0,0 +1,47 @@ +package duckdb + +import ( + "log" + "strings" + + dw "github.com/sqlc-dev/darkwing/ast" + + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func todo(n dw.Node) *ast.TODO { + if debug.Active { + log.Printf("duckdb.convert: Unknown node type %T\n", n) + } + return &ast.TODO{} +} + +// identifier normalizes an identifier. DuckDB identifiers are +// case-insensitive (though case-preserving); the catalog matches them +// lowercased. +func identifier(id string) string { + return strings.ToLower(id) +} + +func NewIdentifier(t string) *ast.String { + return &ast.String{Str: identifier(t)} +} + +// schemaName normalizes a schema qualifier. DuckDB's default "main" schema +// maps to the catalog's default namespace, so it is treated as unqualified. +func schemaName(s string) string { + s = identifier(s) + if s == "main" { + return "" + } + return s +} + +func parseTableName(catalog, schema, name string) *ast.TableName { + return &ast.TableName{ + Catalog: identifier(catalog), + Schema: schemaName(schema), + Name: identifier(name), + } +} diff --git a/internal/engine/googlesql/catalog.go b/internal/engine/googlesql/catalog.go new file mode 100644 index 0000000000..33dd9398a2 --- /dev/null +++ b/internal/engine/googlesql/catalog.go @@ -0,0 +1,16 @@ +package googlesql + +import ( + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +func NewCatalog() *catalog.Catalog { + def := "main" // GoogleSQL has no implicit schema; use "main" as the default + return &catalog.Catalog{ + DefaultSchema: def, + Schemas: []*catalog.Schema{ + defaultSchema(def), + }, + Extensions: map[string]struct{}{}, + } +} diff --git a/internal/engine/googlesql/convert.go b/internal/engine/googlesql/convert.go new file mode 100644 index 0000000000..aa694299b6 --- /dev/null +++ b/internal/engine/googlesql/convert.go @@ -0,0 +1,1365 @@ +package googlesql + +import ( + "strconv" + "strings" + + zjast "github.com/sqlc-dev/zetajones/ast" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +type cc struct { + paramCount int + // namedParams tracks the number assigned to each "@name" so repeated uses + // share a single parameter. + namedParams map[string]int +} + +func (c *cc) convert(node zjast.Node) ast.Node { + switch n := node.(type) { + case *zjast.QueryStatement: + return c.convertQuery(n.Query) + case *zjast.InsertStatement: + return c.convertInsertStatement(n) + case *zjast.UpdateStatement: + return c.convertUpdateStatement(n) + case *zjast.DeleteStatement: + return c.convertDeleteStatement(n) + case *zjast.CreateTableStatement: + return c.convertCreateTableStatement(n) + case *zjast.CreateViewStatement: + return c.convertCreateViewStatement(n) + case *zjast.AlterStatement: + return c.convertAlterStatement(n) + case *zjast.RenameStatement: + return c.convertRenameStatement(n) + case *zjast.DropStatement: + return c.convertDropStatement(n) + case *zjast.TruncateStatement: + return c.convertTruncateStatement(n) + case *zjast.HintedStatement: + if n.Statement == nil { + return todo(n) + } + return c.convert(n.Statement) + default: + return todo(n) + } +} + +func (c *cc) convertQuery(n *zjast.Query) ast.Node { + if n == nil { + return todo(n) + } + // Pipe operators (|>) have no sqlc AST equivalent. + if len(n.PipeOperators) > 0 { + return todo(n) + } + node := c.convertQueryExpr(n.QueryExpr) + stmt, ok := node.(*ast.SelectStmt) + if !ok { + return node + } + if n.WithClause != nil { + stmt.WithClause = c.convertWithClause(n.WithClause) + } + if n.OrderBy != nil { + stmt.SortClause = c.convertOrderBy(n.OrderBy) + } + if n.Limit != nil { + if n.Limit.Limit != nil { + if _, all := n.Limit.Limit.Expr.(*zjast.LimitAll); !all { + stmt.LimitCount = c.convertExpr(n.Limit.Limit.Expr) + } + } + if n.Limit.Offset != nil { + stmt.LimitOffset = c.convertExpr(n.Limit.Offset) + } + } + return stmt +} + +func (c *cc) convertQueryExpr(node zjast.Node) ast.Node { + switch n := node.(type) { + case *zjast.Select: + return c.convertSelect(n) + case *zjast.SetOperation: + return c.convertSetOperation(n) + case *zjast.Query: + // Parenthesized query. + return c.convertQuery(n) + case *zjast.AliasedQueryExpression: + return c.convertQuery(n.Query) + default: + return todo(n) + } +} + +func (c *cc) convertSetOperation(n *zjast.SetOperation) ast.Node { + if len(n.Inputs) == 0 { + return todo(n) + } + var entries []*zjast.SetOperationMetadata + if n.Metadata != nil { + entries = n.Metadata.Entries + } + result, ok := c.convertQueryExpr(n.Inputs[0]).(*ast.SelectStmt) + if !ok { + return todo(n) + } + for i, input := range n.Inputs[1:] { + rarg, ok := c.convertQueryExpr(input).(*ast.SelectStmt) + if !ok { + return todo(n) + } + op := ast.Union + all := false + if i < len(entries) && entries[i] != nil { + meta := entries[i] + if meta.OpType != nil { + switch strings.ToUpper(meta.OpType.Op) { + case "UNION": + op = ast.Union + case "INTERSECT": + op = ast.Intersect + case "EXCEPT": + op = ast.Except + } + } + if meta.AllOrDistinct != nil { + all = strings.ToUpper(meta.AllOrDistinct.Value) == "ALL" + } + } + result = &ast.SelectStmt{ + Op: op, + All: all, + Larg: result, + Rarg: rarg, + } + } + return result +} + +func (c *cc) convertSelect(n *zjast.Select) *ast.SelectStmt { + stmt := &ast.SelectStmt{} + + if n.SelectList != nil { + stmt.TargetList = &ast.List{} + for _, col := range n.SelectList.Columns { + if col == nil { + continue + } + stmt.TargetList.Items = append(stmt.TargetList.Items, c.convertSelectColumn(col)) + } + } + + if n.From != nil { + stmt.FromClause = &ast.List{ + Items: []ast.Node{c.convertTableExpr(n.From.TableExpression)}, + } + } + + if n.Where != nil { + stmt.WhereClause = c.convertExpr(n.Where.Expr) + } + + if n.GroupBy != nil { + stmt.GroupClause = &ast.List{} + for _, item := range n.GroupBy.Items { + if item == nil { + continue + } + if item.Expr != nil { + stmt.GroupClause.Items = append(stmt.GroupClause.Items, c.convertExpr(item.Expr)) + } else { + // ROLLUP, CUBE, GROUPING SETS, or the empty grouping item. + stmt.GroupClause.Items = append(stmt.GroupClause.Items, todo(item)) + } + } + } + + if n.Having != nil { + stmt.HavingClause = c.convertExpr(n.Having.Expr) + } + + if n.Distinct { + stmt.DistinctClause = &ast.List{} + } + + return stmt +} + +func (c *cc) convertSelectColumn(n *zjast.SelectColumn) *ast.ResTarget { + res := &ast.ResTarget{ + Location: n.Pos(), + } + if n.Alias != nil && n.Alias.Identifier != nil { + name := identifier(n.Alias.Identifier.Name) + res.Name = &name + } + res.Val = c.convertExpr(n.Expr) + return res +} + +func (c *cc) convertTableExpr(node zjast.Node) ast.Node { + switch n := node.(type) { + case *zjast.TablePathExpression: + return c.convertTablePathExpression(n) + case *zjast.TableSubquery: + if len(n.PostfixOperators) > 0 { + return todo(n) + } + return &ast.RangeSubselect{ + Lateral: n.IsLateral, + Subquery: c.convertQuery(n.Query), + Alias: convertAlias(n.Alias), + } + case *zjast.Join: + return c.convertJoin(n) + case *zjast.ParenthesizedJoin: + if len(n.PostfixOperators) > 0 { + return todo(n) + } + return c.convertTableExpr(n.Join) + case *zjast.TVF: + return c.convertTVF(n) + default: + return todo(n) + } +} + +func (c *cc) convertTablePathExpression(n *zjast.TablePathExpression) ast.Node { + if len(n.PostfixOperators) > 0 { + return todo(n) + } + if n.UnnestExpr != nil { + return &ast.RangeFunction{ + Functions: &ast.List{ + Items: []ast.Node{c.convertUnnestExpression(n.UnnestExpr)}, + }, + Alias: convertAlias(n.Alias), + } + } + rv := parseRangeVar(n.Path) + rv.Alias = convertAlias(n.Alias) + return rv +} + +func (c *cc) convertUnnestExpression(n *zjast.UnnestExpression) *ast.FuncCall { + fc := &ast.FuncCall{ + Func: &ast.FuncName{Name: "unnest"}, + Funcname: &ast.List{Items: []ast.Node{&ast.String{Str: "unnest"}}}, + Args: &ast.List{}, + Location: n.Pos(), + } + for _, e := range n.Expressions { + if e == nil { + continue + } + fc.Args.Items = append(fc.Args.Items, c.convertExpr(e.Expr)) + } + return fc +} + +func (c *cc) convertTVF(n *zjast.TVF) ast.Node { + if len(n.PostfixOperators) > 0 { + return todo(n) + } + parts := pathParts(n.Name) + if len(parts) == 0 { + return todo(n) + } + fc := c.newFuncCall(parts, n.Pos()) + for _, arg := range n.Args { + if arg == nil || arg.Expr == nil { + continue + } + fc.Args.Items = append(fc.Args.Items, c.convertExpr(arg.Expr)) + } + return &ast.RangeFunction{ + Functions: &ast.List{Items: []ast.Node{fc}}, + Alias: convertAlias(n.Alias), + } +} + +func (c *cc) convertJoin(n *zjast.Join) ast.Node { + join := &ast.JoinExpr{ + Larg: c.convertTableExpr(n.Lhs), + Rarg: c.convertTableExpr(n.Rhs), + IsNatural: n.Natural, + } + + switch strings.ToUpper(n.JoinType) { + case "", "INNER", "CROSS", "COMMA": + join.Jointype = ast.JoinTypeInner + case "LEFT": + join.Jointype = ast.JoinTypeLeft + case "RIGHT": + join.Jointype = ast.JoinTypeRight + case "FULL": + join.Jointype = ast.JoinTypeFull + default: + join.Jointype = ast.JoinTypeInner + } + + switch clause := n.OnOrUsingClause.(type) { + case *zjast.OnClause: + join.Quals = c.convertExpr(clause.Expr) + case *zjast.UsingClause: + join.UsingClause = &ast.List{} + for _, key := range clause.Keys { + if key == nil { + continue + } + join.UsingClause.Items = append(join.UsingClause.Items, NewIdentifier(key.Name)) + } + } + + return join +} + +func (c *cc) convertWithClause(n *zjast.WithClause) *ast.WithClause { + wc := &ast.WithClause{ + Recursive: n.Recursive, + Ctes: &ast.List{}, + Location: n.Pos(), + } + for _, entry := range n.Entries { + if entry == nil || entry.AliasedQuery == nil { + // "name() AS GROUP ROWS" entries are not supported. + continue + } + aq := entry.AliasedQuery + cte := &ast.CommonTableExpr{ + Location: aq.Pos(), + Ctequery: c.convertQuery(aq.Query), + } + if aq.Identifier != nil { + name := identifier(aq.Identifier.Name) + cte.Ctename = &name + } + wc.Ctes.Items = append(wc.Ctes.Items, cte) + } + return wc +} + +func (c *cc) convertOrderBy(n *zjast.OrderBy) *ast.List { + list := &ast.List{} + for _, item := range n.Items { + if item == nil { + continue + } + sortBy := &ast.SortBy{ + Node: c.convertExpr(item.Expr), + Location: item.Pos(), + } + switch { + case item.Descending: + sortBy.SortbyDir = ast.SortByDirDesc + case item.HasAsc: + sortBy.SortbyDir = ast.SortByDirAsc + default: + sortBy.SortbyDir = ast.SortByDirDefault + } + if item.NullOrder != nil { + if item.NullOrder.NullsFirst { + sortBy.SortbyNulls = ast.SortByNullsFirst + } else { + sortBy.SortbyNulls = ast.SortByNullsLast + } + } + list.Items = append(list.Items, sortBy) + } + return list +} + +func (c *cc) convertExpr(node zjast.Node) ast.Node { + if node == nil { + return nil + } + switch n := node.(type) { + case *zjast.Identifier: + return &ast.ColumnRef{ + Fields: &ast.List{Items: []ast.Node{NewIdentifier(n.Name)}}, + Location: n.Pos(), + } + case *zjast.PathExpression: + return c.convertPathExpression(n) + case *zjast.DotIdentifier: + if fields, ok := columnRefFields(n); ok { + return &ast.ColumnRef{ + Fields: &ast.List{Items: fields}, + Location: n.Pos(), + } + } + return todo(n) + case *zjast.IntLiteral: + return c.convertIntLiteral(n) + case *zjast.FloatLiteral: + return &ast.A_Const{ + Val: &ast.Float{Str: n.Image}, + Location: n.Pos(), + } + case *zjast.StringLiteral: + return &ast.A_Const{ + Val: &ast.String{Str: stringLiteralValue(n)}, + Location: n.Pos(), + } + case *zjast.BooleanLiteral: + return &ast.A_Const{ + Val: &ast.Boolean{Boolval: n.Value}, + Location: n.Pos(), + } + case *zjast.NullLiteral: + return &ast.A_Const{ + Val: &ast.Null{}, + Location: n.Pos(), + } + case *zjast.ParameterExpr: + return c.convertParameterExpr(n) + case *zjast.UnaryExpression: + return c.convertUnaryExpression(n) + case *zjast.BinaryExpression: + return c.convertBinaryExpression(n) + case *zjast.BitwiseShiftExpression: + op := ">>" + if n.IsLeftShift { + op = "<<" + } + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: op}}}, + Lexpr: c.convertExpr(n.Lhs), + Rexpr: c.convertExpr(n.Rhs), + Location: n.Pos(), + } + case *zjast.AndExpr: + return c.convertBoolExpr(ast.BoolExprTypeAnd, n.Conjuncts, n.Pos()) + case *zjast.OrExpr: + return c.convertBoolExpr(ast.BoolExprTypeOr, n.Disjuncts, n.Pos()) + case *zjast.BetweenExpression: + return &ast.BetweenExpr{ + Expr: c.convertExpr(n.Lhs), + Left: c.convertExpr(n.Low), + Right: c.convertExpr(n.High), + Not: n.IsNot, + Location: n.Pos(), + } + case *zjast.InExpression: + return c.convertInExpression(n) + case *zjast.CaseValueExpression: + if len(n.Arguments) == 0 { + return todo(n) + } + return c.buildCaseExpr(c.convertExpr(n.Arguments[0]), n.Arguments[1:], n.Pos()) + case *zjast.CaseNoValueExpression: + return c.buildCaseExpr(nil, n.Arguments, n.Pos()) + case *zjast.CastExpression: + return &ast.TypeCast{ + Arg: c.convertExpr(n.Expr), + TypeName: spelledTypeName(typeName(n.Type)), + Location: n.Pos(), + } + case *zjast.ExpressionSubquery: + return c.convertExpressionSubquery(n) + case *zjast.FunctionCall: + return c.convertFunctionCall(n) + case *zjast.AnalyticFunctionCall: + return c.convertAnalyticFunctionCall(n) + case *zjast.Star: + return &ast.ColumnRef{ + Fields: &ast.List{Items: []ast.Node{&ast.A_Star{}}}, + Location: n.Pos(), + } + case *zjast.DotStar: + return c.convertDotStar(n) + case *zjast.ArrayElement: + return &ast.A_Indirection{ + Arg: c.convertExpr(n.Array), + Indirection: &ast.List{ + Items: []ast.Node{ + &ast.A_Indices{Uidx: c.convertExpr(arrayPosition(n.Position))}, + }, + }, + } + case *zjast.ArrayConstructor: + return c.convertArrayConstructor(n) + case *zjast.ExtractExpression: + return c.convertExtractExpression(n) + case *zjast.DateOrTimeLiteral: + kind := strings.ToLower(strings.TrimPrefix(n.TypeKind, "TYPE_")) + return c.typedLiteral(n.Value, kind, n.Pos()) + case *zjast.NumericLiteral: + return c.typedLiteral(n.Value, "numeric", n.Pos()) + case *zjast.BigNumericLiteral: + return c.typedLiteral(n.Value, "bignumeric", n.Pos()) + case *zjast.JSONLiteral: + return c.typedLiteral(n.Value, "json", n.Pos()) + case *zjast.BytesLiteral: + var sb strings.Builder + for _, comp := range n.Components { + if comp != nil { + sb.WriteString(unquote(comp.Image)) + } + } + return &ast.TypeCast{ + Arg: &ast.A_Const{Val: &ast.String{Str: sb.String()}, Location: n.Pos()}, + TypeName: spelledTypeName("bytes"), + Location: n.Pos(), + } + case *zjast.IntervalExpr: + unit := "" + if n.DatePart != nil { + unit = strings.ToLower(n.DatePart.Name) + } + return &ast.IntervalExpr{ + Value: c.convertExpr(n.Value), + Unit: unit, + Location: n.Pos(), + } + case *zjast.NamedArgument: + return c.convertExpr(n.Value) + case *zjast.ExpressionWithAlias: + return c.convertExpr(n.Expression) + default: + return todo(n) + } +} + +func (c *cc) convertPathExpression(n *zjast.PathExpression) ast.Node { + fields, ok := columnRefFields(n) + if !ok { + return todo(n) + } + return &ast.ColumnRef{ + Fields: &ast.List{Items: fields}, + Location: n.Pos(), + } +} + +func (c *cc) convertIntLiteral(n *zjast.IntLiteral) ast.Node { + // Base 0 also accepts hexadecimal literals (0x1a). + ival, err := strconv.ParseInt(n.Image, 0, 64) + if err != nil { + return &ast.A_Const{ + Val: &ast.Float{Str: n.Image}, + Location: n.Pos(), + } + } + return &ast.A_Const{ + Val: &ast.Integer{Ival: ival}, + Location: n.Pos(), + } +} + +// convertParameterExpr converts "@name" and "?" query parameters. +// +// Both become ParamRef nodes. "@name" is native GoogleSQL syntax rather than +// sqlc syntax, so nothing rewrites it before the parser runs and the numbering +// here is what the rest of the pipeline sees: repeated uses of a name share a +// number, and positional parameters are numbered by their 1-based position in +// the statement. +func (c *cc) convertParameterExpr(n *zjast.ParameterExpr) ast.Node { + if n.Name != nil { + number, ok := c.namedParams[n.Name.Name] + if !ok { + c.paramCount++ + number = c.paramCount + if c.namedParams == nil { + c.namedParams = map[string]int{} + } + c.namedParams[n.Name.Name] = number + } + return &ast.ParamRef{ + Number: number, + Name: n.Name.Name, + Location: n.Pos(), + } + } + c.paramCount++ + number := n.Position + if number == 0 { + number = c.paramCount + } + return &ast.ParamRef{ + Number: number, + Location: n.Pos(), + } +} + +func (c *cc) convertUnaryExpression(n *zjast.UnaryExpression) ast.Node { + if strings.ToUpper(n.Op) == "NOT" { + return &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{ + Items: []ast.Node{c.convertExpr(n.Operand)}, + }, + Location: n.Pos(), + } + } + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: n.Op}}}, + Rexpr: c.convertExpr(n.Operand), + Location: n.Pos(), + } +} + +func (c *cc) convertBinaryExpression(n *zjast.BinaryExpression) ast.Node { + // "x IS NULL" and "x IS NOT NULL" become NullTest nodes. + if strings.ToUpper(n.Op) == "IS" { + if _, isNull := n.Right.(*zjast.NullLiteral); isNull { + nullTest := &ast.NullTest{ + Arg: c.convertExpr(n.Left), + Location: n.Pos(), + } + if n.IsNot { + nullTest.Nulltesttype = ast.NullTestTypeIsNotNull + } else { + nullTest.Nulltesttype = ast.NullTestTypeIsNull + } + return nullTest + } + } + + var expr ast.Node = &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: n.Op}}}, + Lexpr: c.convertExpr(n.Left), + Rexpr: c.convertExpr(n.Right), + Location: n.Pos(), + } + if n.IsNot { + // "a NOT LIKE b", "a IS NOT b", etc: wrap the comparison in a NOT. + expr = &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{Items: []ast.Node{expr}}, + Location: n.Pos(), + } + } + return expr +} + +func (c *cc) convertBoolExpr(op ast.BoolExprType, operands []zjast.Node, loc int) *ast.BoolExpr { + expr := &ast.BoolExpr{ + Boolop: op, + Args: &ast.List{}, + Location: loc, + } + for _, operand := range operands { + expr.Args.Items = append(expr.Args.Items, c.convertExpr(operand)) + } + return expr +} + +func (c *cc) convertInExpression(n *zjast.InExpression) ast.Node { + // "x IN UNNEST(array)" tests membership of an array, which is what + // "x = ANY(array)" says. + if n.UnnestExpr != nil && len(n.UnnestExpr.Expressions) == 1 && n.UnnestExpr.Expressions[0] != nil { + var expr ast.Node = &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP_ANY, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: "="}}}, + Lexpr: c.convertExpr(n.Lhs), + Rexpr: c.convertExpr(n.UnnestExpr.Expressions[0].Expr), + Location: n.Pos(), + } + if n.IsNot { + expr = &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{Items: []ast.Node{expr}}, + Location: n.Pos(), + } + } + return expr + } + in := &ast.In{ + Expr: c.convertExpr(n.Lhs), + Not: n.IsNot, + Location: n.Pos(), + } + if n.List != nil { + for _, expr := range n.List.Exprs { + in.List = append(in.List, c.convertExpr(expr)) + } + } + if n.UnnestExpr != nil { + in.List = append(in.List, c.convertUnnestExpression(n.UnnestExpr)) + } + if n.Query != nil { + in.Sel = c.convertQuery(n.Query) + } + return in +} + +// buildCaseExpr builds a CaseExpr from the alternating WHEN/THEN expression +// pairs (and optional trailing ELSE expression) of a zetajones CASE node. +func (c *cc) buildCaseExpr(arg ast.Node, rest []zjast.Node, loc int) *ast.CaseExpr { + caseExpr := &ast.CaseExpr{ + Arg: arg, + Args: &ast.List{}, + Location: loc, + } + i := 0 + for ; i+1 < len(rest); i += 2 { + caseExpr.Args.Items = append(caseExpr.Args.Items, &ast.CaseWhen{ + Expr: c.convertExpr(rest[i]), + Result: c.convertExpr(rest[i+1]), + }) + } + if i < len(rest) { + caseExpr.Defresult = c.convertExpr(rest[i]) + } + return caseExpr +} + +func (c *cc) convertExpressionSubquery(n *zjast.ExpressionSubquery) *ast.SubLink { + subLink := &ast.SubLink{ + Subselect: c.convertQuery(n.Query), + Location: n.Pos(), + } + switch strings.ToUpper(n.Modifier) { + case "EXISTS": + subLink.SubLinkType = ast.EXISTS_SUBLINK + case "ARRAY": + subLink.SubLinkType = ast.ARRAY_SUBLINK + default: + subLink.SubLinkType = ast.EXPR_SUBLINK + } + return subLink +} + +// newFuncCall builds a FuncCall from a dotted function path. GoogleSQL +// function names are case-insensitive, so they are lowercased. +func (c *cc) newFuncCall(parts []string, loc int) *ast.FuncCall { + name := strings.ToLower(parts[len(parts)-1]) + var schema string + if len(parts) > 1 { + schema = strings.ToLower(strings.Join(parts[:len(parts)-1], ".")) + } + items := []ast.Node{} + if schema != "" { + items = append(items, &ast.String{Str: schema}) + } + items = append(items, &ast.String{Str: name}) + return &ast.FuncCall{ + Func: &ast.FuncName{Schema: schema, Name: name}, + Funcname: &ast.List{Items: items}, + Args: &ast.List{}, + Location: loc, + } +} + +// convertConditional converts the conditional functions whose result is one +// of their arguments to the nodes that say so, which is what types the +// result after the arguments and makes it nullable only when it can be: +// COALESCE and IFNULL, NULLIF, IF, GREATEST and LEAST. It returns nil for +// anything else. +func (c *cc) convertConditional(name string, args []zjast.Node, loc int) ast.Node { + convert := func() *ast.List { + list := &ast.List{} + for _, arg := range args { + list.Items = append(list.Items, c.convertExpr(arg)) + } + return list + } + switch { + case (name == "coalesce" && len(args) > 0) || (name == "ifnull" && len(args) == 2): + return &ast.CoalesceExpr{Args: convert(), Location: loc} + case name == "nullif" && len(args) == 2: + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_NULLIF, + Name: &ast.List{Items: []ast.Node{&ast.String{Str: "="}}}, + Lexpr: c.convertExpr(args[0]), + Rexpr: c.convertExpr(args[1]), + Location: loc, + } + case name == "if" && len(args) == 3: + return c.buildCaseExpr(nil, args, loc) + case (name == "greatest" || name == "least") && len(args) > 0: + // The ops number as PostgreSQL's do: IS_GREATEST, then IS_LEAST. + op := ast.MinMaxOp(0) + if name == "least" { + op = 1 + } + return &ast.MinMaxExpr{Op: op, Args: convert(), Location: loc} + } + return nil +} + +// typedLiteral converts a literal spelled with its type, DATE '2024-01-01' +// or JSON '{}', to its string cast to that type. +func (c *cc) typedLiteral(value *zjast.StringLiteral, typ string, loc int) ast.Node { + if value == nil || typ == "" { + return todo(value) + } + return &ast.TypeCast{ + Arg: &ast.A_Const{Val: &ast.String{Str: stringLiteralValue(value)}, Location: value.Pos()}, + TypeName: spelledTypeName(typ), + Location: loc, + } +} + +// convertArrayConstructor converts [a, b] and ARRAY[a, b]. An explicit +// element type is a cast of the array to it, which is what gives an empty +// array its type. +func (c *cc) convertArrayConstructor(n *zjast.ArrayConstructor) ast.Node { + arr := &ast.A_ArrayExpr{Elements: &ast.List{}, Location: n.Pos()} + for _, elem := range n.Elements { + arr.Elements.Items = append(arr.Elements.Items, c.convertExpr(elem)) + } + if n.Type == nil { + return arr + } + return &ast.TypeCast{ + Arg: arr, + TypeName: spelledTypeName(typeName(n.Type)), + Location: n.Pos(), + } +} + +// arrayPosition unwraps the OFFSET, ORDINAL, SAFE_OFFSET or SAFE_ORDINAL +// that says how an array subscript counts to the position it wraps. They all +// address one element, so they type alike. +func arrayPosition(node zjast.Node) zjast.Node { + call, ok := node.(*zjast.FunctionCall) + if !ok || call.IsChained || len(call.Args) != 1 { + return node + } + switch strings.ToUpper(strings.Join(pathParts(call.Function), ".")) { + case "OFFSET", "ORDINAL", "SAFE_OFFSET", "SAFE_ORDINAL": + return call.Args[0] + } + return node +} + +func (c *cc) convertFunctionCall(n *zjast.FunctionCall) ast.Node { + // Chained calls ("expr.method(...)") have no sqlc AST equivalent. + if n.IsChained { + return todo(n) + } + parts := pathParts(n.Function) + if len(parts) == 0 { + return todo(n) + } + // SAFE.f(...) is f(...), except that it returns NULL where f raises an + // error, so its result is f's made nullable: a CASE with no ELSE. + if len(parts) == 2 && strings.EqualFold(parts[0], "SAFE") { + call := *n + call.Function = &zjast.PathExpression{Names: n.Function.Names[1:]} + return &ast.CaseExpr{ + Args: &ast.List{Items: []ast.Node{&ast.CaseWhen{ + Expr: &ast.A_Const{Val: &ast.Boolean{Boolval: true}, Location: n.Pos()}, + Result: c.convertFunctionCall(&call), + }}}, + Location: n.Pos(), + } + } + if len(parts) == 1 && !n.Distinct && n.OrderBy == nil { + if expr := c.convertConditional(strings.ToLower(parts[0]), n.Args, n.Pos()); expr != nil { + return expr + } + } + fc := c.newFuncCall(parts, n.Pos()) + fc.AggDistinct = n.Distinct + partArg, hasPart := datePartArg[fc.Func.Name] + for i, arg := range n.Args { + if _, ok := arg.(*zjast.Star); ok { + fc.AggStar = true + continue + } + if hasPart && i == partArg { + if part, ok := datePart(arg); ok { + fc.Args.Items = append(fc.Args.Items, &ast.A_Const{Val: &ast.String{Str: part}, Location: arg.Pos()}) + continue + } + } + fc.Args.Items = append(fc.Args.Items, c.convertExpr(arg)) + } + if n.OrderBy != nil { + fc.AggOrder = c.convertOrderBy(n.OrderBy) + } + return fc +} + +// datePartArg is the position of the argument naming a date part, DAY or +// WEEK(MONDAY), in the functions that take one. The part is a keyword, not +// a column, so it is converted to a string. +var datePartArg = map[string]int{ + "date_diff": 2, + "date_trunc": 1, + "timestamp_diff": 2, + "timestamp_trunc": 1, + "last_day": 1, +} + +// datePart spells a date part argument: DAY, or WEEK(MONDAY). +func datePart(node zjast.Node) (string, bool) { + switch n := node.(type) { + case *zjast.PathExpression: + if parts := pathParts(n); len(parts) == 1 { + return strings.ToUpper(parts[0]), true + } + case *zjast.FunctionCall: + parts := pathParts(n.Function) + if len(parts) == 1 && len(n.Args) == 1 { + if arg, ok := datePart(n.Args[0]); ok { + return strings.ToUpper(parts[0]) + "(" + arg + ")", true + } + } + } + return "", false +} + +// convertExtractExpression converts EXTRACT(part FROM expr). Every part is +// an INT64 but DATE, which is the date of a timestamp, so EXTRACT is the +// extract function the dialect seeds as INT64, and EXTRACT(DATE FROM ts) +// is date(ts). +func (c *cc) convertExtractExpression(n *zjast.ExtractExpression) ast.Node { + part, ok := datePart(n.LhsExpr) + if !ok || n.RhsExpr == nil { + return todo(n) + } + name := "extract" + if part == "DATE" { + name = "date" + } + fc := c.newFuncCall([]string{name}, n.Pos()) + fc.Args.Items = append(fc.Args.Items, c.convertExpr(n.RhsExpr)) + if n.TimeZone != nil { + fc.Args.Items = append(fc.Args.Items, c.convertExpr(n.TimeZone)) + } + return fc +} + +func (c *cc) convertAnalyticFunctionCall(n *zjast.AnalyticFunctionCall) ast.Node { + base := c.convertExpr(n.Expr) + fc, ok := base.(*ast.FuncCall) + if !ok { + return base + } + over := &ast.WindowDef{Location: n.Pos()} + if spec := n.WindowSpec; spec != nil { + if spec.Name != nil { + name := identifier(spec.Name.Name) + over.Name = &name + } + if spec.PartitionBy != nil { + over.PartitionClause = &ast.List{} + for _, expr := range spec.PartitionBy.Expressions { + over.PartitionClause.Items = append(over.PartitionClause.Items, c.convertExpr(expr)) + } + } + if spec.OrderBy != nil { + over.OrderClause = c.convertOrderBy(spec.OrderBy) + } + } + fc.Over = over + return fc +} + +func (c *cc) convertDotStar(n *zjast.DotStar) ast.Node { + fields, ok := columnRefFields(n.Expr) + if !ok { + return todo(n) + } + fields = append(fields, &ast.A_Star{}) + return &ast.ColumnRef{ + Fields: &ast.List{Items: fields}, + Location: n.Pos(), + } +} + +// targetPath extracts the table path of an INSERT/UPDATE/DELETE target. +func targetPath(node zjast.Node) (*zjast.PathExpression, bool) { + path, ok := node.(*zjast.PathExpression) + return path, ok && path != nil +} + +func (c *cc) convertInsertStatement(n *zjast.InsertStatement) ast.Node { + path, ok := targetPath(n.Target) + if !ok { + return todo(n) + } + stmt := &ast.InsertStmt{ + Relation: parseRangeVar(path), + } + + if n.Columns != nil { + stmt.Cols = &ast.List{} + for _, col := range n.Columns.Identifiers { + if col == nil { + continue + } + name := identifier(col.Name) + stmt.Cols.Items = append(stmt.Cols.Items, &ast.ResTarget{ + Name: &name, + Location: col.Pos(), + }) + } + } + + switch { + case n.Rows != nil: + selectStmt := &ast.SelectStmt{ + ValuesLists: &ast.List{}, + } + for _, row := range n.Rows.Rows { + if row == nil { + continue + } + rowList := &ast.List{} + for _, val := range row.Values { + rowList.Items = append(rowList.Items, c.convertExpr(val)) + } + selectStmt.ValuesLists.Items = append(selectStmt.ValuesLists.Items, rowList) + } + stmt.SelectStmt = selectStmt + case n.Query != nil: + stmt.SelectStmt = c.convertQuery(n.Query) + } + + if n.Returning != nil { + stmt.ReturningList = c.convertReturningClause(n.Returning) + } + + return stmt +} + +// convertReturningClause converts a "THEN RETURN" clause to a returning list. +func (c *cc) convertReturningClause(n *zjast.ReturningClause) *ast.List { + list := &ast.List{} + if n.SelectList != nil { + for _, col := range n.SelectList.Columns { + if col == nil { + continue + } + list.Items = append(list.Items, c.convertSelectColumn(col)) + } + } + return list +} + +func (c *cc) convertUpdateStatement(n *zjast.UpdateStatement) ast.Node { + path, ok := targetPath(n.Target) + if !ok { + return todo(n) + } + rv := parseRangeVar(path) + rv.Alias = convertAlias(n.Alias) + stmt := &ast.UpdateStmt{ + Relations: &ast.List{Items: []ast.Node{rv}}, + TargetList: &ast.List{}, + } + + if n.UpdateItemList != nil { + for _, item := range n.UpdateItemList.Items { + if item == nil || item.SetValue == nil { + // Nested INSERT/UPDATE/DELETE update items are unsupported. + continue + } + stmt.TargetList.Items = append(stmt.TargetList.Items, c.convertUpdateSetValue(item.SetValue)) + } + } + + if n.From != nil { + stmt.FromClause = &ast.List{ + Items: []ast.Node{c.convertTableExpr(n.From.TableExpression)}, + } + } + + if n.Where != nil { + stmt.WhereClause = c.convertExpr(whereExpr(n.Where)) + } + + if n.Returning != nil { + stmt.ReturningList = c.convertReturningClause(n.Returning) + } + + return stmt +} + +func (c *cc) convertUpdateSetValue(n *zjast.UpdateSetValue) *ast.ResTarget { + res := &ast.ResTarget{ + Val: c.convertExpr(n.Value), + Location: n.Pos(), + } + if path, ok := n.Path.(*zjast.PathExpression); ok { + if parts := pathParts(path); len(parts) > 0 { + name := identifier(parts[len(parts)-1]) + res.Name = &name + } + } + return res +} + +func (c *cc) convertDeleteStatement(n *zjast.DeleteStatement) ast.Node { + path, ok := targetPath(n.Target) + if !ok { + return todo(n) + } + rv := parseRangeVar(path) + rv.Alias = convertAlias(n.Alias) + stmt := &ast.DeleteStmt{ + Relations: &ast.List{Items: []ast.Node{rv}}, + } + + if n.Where != nil { + stmt.WhereClause = c.convertExpr(whereExpr(n.Where)) + } + + if n.Returning != nil { + stmt.ReturningList = c.convertReturningClause(n.Returning) + } + + return stmt +} + +func (c *cc) convertCreateTableStatement(n *zjast.CreateTableStatement) ast.Node { + stmt := &ast.CreateTableStmt{ + Name: parseTableName(n.Name), + IfNotExists: n.IsIfNotExists, + } + if n.TableElementList != nil { + for _, elem := range n.TableElementList.Elements { + col, ok := elem.(*zjast.ColumnDefinition) + if !ok { + // Table-level PRIMARY KEY, FOREIGN KEY, and CHECK + // constraints are skipped. + continue + } + stmt.Cols = append(stmt.Cols, c.convertColumnDefinition(col)) + } + } + return stmt +} + +func (c *cc) convertColumnDefinition(n *zjast.ColumnDefinition) *ast.ColumnDef { + col := &ast.ColumnDef{ + Location: n.Pos(), + TypeName: spelledTypeName(columnSchemaTypeName(n.Schema)), + } + if n.Name != nil { + col.Colname = identifier(n.Name.Name) + } + + if attrs := columnAttributes(n.Schema); attrs != nil { + for _, attr := range attrs.Attributes { + switch attr.(type) { + case *zjast.NotNullColumnAttribute: + col.IsNotNull = true + case *zjast.PrimaryKeyColumnAttribute: + col.PrimaryKey = true + case *zjast.HiddenColumnAttribute: + // Spanner leaves a HIDDEN column out of SELECT *. + col.IsHidden = true + } + } + } + + if simple, ok := n.Schema.(*zjast.SimpleColumnSchema); ok { + // A generated column's "AS (expression) STORED" and an identity + // column's IDENTITY(...) arrive here too; neither is a default. + if _, generated := simple.DefaultExpression.(*zjast.GeneratedColumnInfo); !generated && simple.DefaultExpression != nil { + col.RawDefault = c.convertExpr(simple.DefaultExpression) + } + } + + return col +} + +// convertCreateViewStatement converts CREATE [OR REPLACE] VIEW. Spanner's +// SQL SECURITY clause says nothing about the view's columns. +func (c *cc) convertCreateViewStatement(n *zjast.CreateViewStatement) ast.Node { + if n.ViewKind != "" || n.Query == nil || n.Name == nil { + return todo(n) + } + stmt := &ast.ViewStmt{ + View: parseRangeVar(n.Name), + Query: c.convertQuery(n.Query), + Replace: n.IsOrReplace, + } + if n.Columns != nil { + stmt.Aliases = &ast.List{} + for _, col := range n.Columns.Columns { + if col == nil || col.Name == nil { + continue + } + stmt.Aliases.Items = append(stmt.Aliases.Items, NewIdentifier(col.Name.Name)) + } + } + return stmt +} + +// convertAlterStatement converts ALTER TABLE. Its column actions become one +// AlterTableStmt; RENAME COLUMN and RENAME TO, which the sqlc AST spells as +// statements of their own, follow it in a list. Actions that change nothing +// about a column's name, type or nullability, such as constraints, options, +// defaults and row deletion policies, are dropped. +func (c *cc) convertAlterStatement(n *zjast.AlterStatement) ast.Node { + if n.NodeName != "AlterTableStatement" || n.Path == nil || n.Actions == nil { + return todo(n) + } + table := parseTableName(n.Path) + alter := &ast.AlterTableStmt{ + Table: table, + Cmds: &ast.List{}, + MissingOk: n.IsIfExists, + } + stmts := []ast.Node{alter} + for _, action := range n.Actions.Actions { + switch a := action.(type) { + case *zjast.AddColumnAction: + if a.Column == nil { + continue + } + def := c.convertColumnDefinition(a.Column) + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &def.Colname, + Subtype: ast.AT_AddColumn, + Def: def, + MissingOk: a.IsIfNotExists, + }) + case *zjast.DropColumnAction: + if a.Name == nil { + continue + } + name := identifier(a.Name.Name) + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_DropColumn, + MissingOk: a.IsIfExists, + }) + case *zjast.SpannerAlterColumnAction: + // Spanner's "ALTER COLUMN c [NOT NULL] ..." restates the + // column's whole definition, nullability included. + if a.Column == nil { + continue + } + def := c.convertColumnDefinition(a.Column) + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &def.Colname, + Subtype: ast.AT_AlterColumnType, + Def: def, + }) + if !def.IsNotNull { + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &def.Colname, + Subtype: ast.AT_DropNotNull, + }) + } + case *zjast.AlterColumnTypeAction: + if a.Column == nil { + continue + } + name := identifier(a.Column.Name) + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_AlterColumnType, + MissingOk: a.IsIfExists, + Def: &ast.ColumnDef{ + Colname: name, + TypeName: spelledTypeName(columnSchemaTypeName(a.Schema)), + }, + }) + case *zjast.AlterColumnDropNotNullAction: + if a.Column == nil { + continue + } + name := identifier(a.Column.Name) + alter.Cmds.Items = append(alter.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_DropNotNull, + MissingOk: a.IsIfExists, + }) + case *zjast.RenameColumnAction: + if a.Name == nil || a.NewName == nil { + continue + } + newName := identifier(a.NewName.Name) + stmts = append(stmts, &ast.RenameColumnStmt{ + Table: table, + Col: &ast.ColumnRef{Name: identifier(a.Name.Name)}, + NewName: &newName, + MissingOk: n.IsIfExists, + }) + case *zjast.RenameToClause: + parts := pathParts(a.NewName) + if len(parts) == 0 { + continue + } + newName := identifier(parts[len(parts)-1]) + stmts = append(stmts, &ast.RenameTableStmt{ + Table: table, + NewName: &newName, + MissingOk: n.IsIfExists, + }) + } + } + if len(stmts) == 1 { + return alter + } + return &ast.List{Items: stmts} +} + +// convertRenameStatement converts Spanner's "RENAME TABLE a TO b [, c TO +// d ...]", which renames each table in turn. +func (c *cc) convertRenameStatement(n *zjast.RenameStatement) ast.Node { + if n.Identifier == nil || !strings.EqualFold(n.Identifier.Name, "TABLE") { + return todo(n) + } + list := &ast.List{} + add := func(oldName, newName *zjast.PathExpression) { + parts := pathParts(newName) + if oldName == nil || len(parts) == 0 { + return + } + name := identifier(parts[len(parts)-1]) + list.Items = append(list.Items, &ast.RenameTableStmt{ + Table: parseTableName(oldName), + NewName: &name, + }) + } + add(n.OldName, n.NewName) + for _, more := range n.MoreRenames { + add(more.OldName, more.NewName) + } + if len(list.Items) == 0 { + return todo(n) + } + return list +} + +func (c *cc) convertDropStatement(n *zjast.DropStatement) ast.Node { + // DROP TABLE and DROP VIEW map onto the sqlc AST, which drops both + // kinds of relation alike; other object kinds (indexes, sequences, + // schemas, ...) fall through to TODO. + kind := strings.ToUpper(n.ObjectKind) + if (kind == "TABLE" || kind == "VIEW") && n.Path != nil { + return &ast.DropTableStmt{ + IfExists: n.IsIfExists, + Tables: []*ast.TableName{parseTableName(n.Path)}, + } + } + return todo(n) +} + +func (c *cc) convertTruncateStatement(n *zjast.TruncateStatement) ast.Node { + if n.Target == nil { + return todo(n) + } + return &ast.TruncateStmt{ + Relations: &ast.List{Items: []ast.Node{parseRangeVar(n.Target)}}, + } +} + +// spelledTypeName is a type name the core reads from its spelling, whose +// name is the family the spelling applies: string for string(10), array +// for array(int64). +func spelledTypeName(spelling string) *ast.TypeName { + name := spelling + if i := strings.IndexByte(name, '('); i >= 0 { + name = name[:i] + } + return &ast.TypeName{Name: name, Canonical: spelling} +} diff --git a/internal/engine/googlesql/dialect/dialect.json b/internal/engine/googlesql/dialect/dialect.json new file mode 100644 index 0000000000..ef0e61426a --- /dev/null +++ b/internal/engine/googlesql/dialect/dialect.json @@ -0,0 +1,16 @@ +{ + "dialect": "googlesql", + "const": { + "integer": "int64", + "float": "float64", + "string": "string", + "bool": "bool" + }, + "bool": "bool", + "comparison": ["=", "<>", "!=", "<", "<=", ">", ">="], + "comparison_categories": "BNSDTU", + "arithmetic": ["+", "-", "*", "/"], + "arithmetic_categories": "N", + "idents": ["max"], + "propagate_nullable": true +} diff --git a/internal/engine/googlesql/dialect/functions.jsonl b/internal/engine/googlesql/dialect/functions.jsonl new file mode 100644 index 0000000000..e01d9a0fba --- /dev/null +++ b/internal/engine/googlesql/dialect/functions.jsonl @@ -0,0 +1,291 @@ +{"name":"abs","args":[{"type":"int64"}],"returns":"int64"} +{"name":"abs","args":[{"type":"float64"}],"returns":"float64"} +{"name":"abs","args":[{"type":"float32"}],"returns":"float32"} +{"name":"abs","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"acos","args":[{"type":"float64"}],"returns":"float64"} +{"name":"any_value","kind":"a","args":[{"type":"anyelement"}],"returns":"$1","nullable":true} +{"name":"array_agg","kind":"a","args":[{"type":"anyelement"}],"returns":"array($1)","nullable":true} +{"name":"array_concat","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"$1"} +{"name":"array_concat_agg","kind":"a","args":[{"type":"anyarray"}],"returns":"$1","nullable":true} +{"name":"array_first","args":[{"type":"anyarray"}],"returns":"anyelement","nullable":true} +{"name":"array_includes","args":[{"type":"anyarray"},{"type":"anyelement"}],"returns":"bool"} +{"name":"array_includes_all","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"bool"} +{"name":"array_includes_any","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"bool"} +{"name":"array_is_distinct","args":[{"type":"anyarray"}],"returns":"bool"} +{"name":"array_last","args":[{"type":"anyarray"}],"returns":"anyelement","nullable":true} +{"name":"array_length","args":[{"type":"anyarray"}],"returns":"int64"} +{"name":"array_max","args":[{"type":"anyarray"}],"returns":"anyelement","nullable":true} +{"name":"array_min","args":[{"type":"anyarray"}],"returns":"anyelement","nullable":true} +{"name":"array_reverse","args":[{"type":"anyarray"}],"returns":"$1"} +{"name":"array_slice","args":[{"type":"anyarray"},{"type":"int64"},{"type":"int64"}],"returns":"$1"} +{"name":"array_to_string","args":[{"type":"array(string)"},{"type":"string"}],"returns":"string"} +{"name":"array_to_string","args":[{"type":"array(bytes)"},{"type":"bytes"}],"returns":"bytes"} +{"name":"array_to_string","args":[{"type":"array(string)"},{"type":"string"},{"type":"string"}],"returns":"string"} +{"name":"asin","args":[{"type":"float64"}],"returns":"float64"} +{"name":"atan","args":[{"type":"float64"}],"returns":"float64"} +{"name":"atan2","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64"} +{"name":"avg","kind":"a","args":[{"type":"int64"}],"returns":"float64","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"float32"}],"returns":"float64","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"numeric"}],"returns":"numeric","nullable":true} +{"name":"avg","kind":"a","args":[{"type":"interval"}],"returns":"interval","nullable":true} +{"name":"bit_and","kind":"a","args":[{"type":"int64"}],"returns":"int64","nullable":true} +{"name":"bit_count","args":[{"type":"int64"}],"returns":"int64"} +{"name":"bit_count","args":[{"type":"bytes"}],"returns":"int64"} +{"name":"bit_or","kind":"a","args":[{"type":"int64"}],"returns":"int64","nullable":true} +{"name":"bit_reverse","args":[{"type":"int64"},{"type":"bool"}],"returns":"int64"} +{"name":"bit_xor","kind":"a","args":[{"type":"int64"}],"returns":"int64","nullable":true} +{"name":"bool","args":[{"type":"json"}],"returns":"bool"} +{"name":"byte_length","args":[{"type":"string"}],"returns":"int64"} +{"name":"byte_length","args":[{"type":"bytes"}],"returns":"int64"} +{"name":"ceil","args":[{"type":"float64"}],"returns":"float64"} +{"name":"ceil","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"ceiling","args":[{"type":"float64"}],"returns":"float64"} +{"name":"ceiling","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"char_length","args":[{"type":"string"}],"returns":"int64"} +{"name":"character_length","args":[{"type":"string"}],"returns":"int64"} +{"name":"code_points_to_bytes","args":[{"type":"array(int64)"}],"returns":"bytes"} +{"name":"code_points_to_string","args":[{"type":"array(int64)"}],"returns":"string"} +{"name":"concat","args":[{"type":"string"},{"type":"string"}],"returns":"string"} +{"name":"concat","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bytes"} +{"name":"cos","args":[{"type":"float64"}],"returns":"float64"} +{"name":"cosine_distance","args":[{"type":"array(float64)"},{"type":"array(float64)"}],"returns":"float64"} +{"name":"cosine_distance","args":[{"type":"array(float32)"},{"type":"array(float32)"}],"returns":"float64"} +{"name":"count","kind":"a","args":[{"type":"anyelement"}],"returns":"int64","never_null":true} +{"name":"countif","kind":"a","args":[{"type":"bool"}],"returns":"int64","never_null":true} +{"name":"current_date","returns":"date"} +{"name":"current_timestamp","returns":"timestamp"} +{"name":"date","args":[{"type":"timestamp"}],"returns":"date"} +{"name":"date","args":[{"type":"timestamp"},{"type":"string"}],"returns":"date"} +{"name":"date","args":[{"type":"int64"},{"type":"int64"},{"type":"int64"}],"returns":"date"} +{"name":"date_add","args":[{"type":"date"},{"type":"interval"}],"returns":"date"} +{"name":"date_diff","args":[{"type":"date"},{"type":"date"},{"type":"string"}],"returns":"int64"} +{"name":"date_from_unix_date","args":[{"type":"int64"}],"returns":"date"} +{"name":"date_sub","args":[{"type":"date"},{"type":"interval"}],"returns":"date"} +{"name":"date_trunc","args":[{"type":"date"},{"type":"string"}],"returns":"date"} +{"name":"div","args":[{"type":"int64"},{"type":"int64"}],"returns":"int64"} +{"name":"div","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"dot_product","args":[{"type":"array(float64)"},{"type":"array(float64)"}],"returns":"float64"} +{"name":"dot_product","args":[{"type":"array(float32)"},{"type":"array(float32)"}],"returns":"float64"} +{"name":"dot_product","args":[{"type":"array(int64)"},{"type":"array(int64)"}],"returns":"float64"} +{"name":"ends_with","args":[{"type":"string"},{"type":"string"}],"returns":"bool"} +{"name":"ends_with","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bool"} +{"name":"euclidean_distance","args":[{"type":"array(float64)"},{"type":"array(float64)"}],"returns":"float64"} +{"name":"euclidean_distance","args":[{"type":"array(float32)"},{"type":"array(float32)"}],"returns":"float64"} +{"name":"exp","args":[{"type":"float64"}],"returns":"float64"} +{"name":"exp","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"extract","args":[{"type":"timestamp"}],"returns":"int64"} +{"name":"extract","args":[{"type":"date"}],"returns":"int64"} +{"name":"extract","args":[{"type":"timestamp"},{"type":"string"}],"returns":"int64"} +{"name":"farm_fingerprint","args":[{"type":"string"}],"returns":"int64"} +{"name":"farm_fingerprint","args":[{"type":"bytes"}],"returns":"int64"} +{"name":"float32","args":[{"type":"json"}],"returns":"float32"} +{"name":"float64","args":[{"type":"json"}],"returns":"float64"} +{"name":"floor","args":[{"type":"float64"}],"returns":"float64"} +{"name":"floor","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"format","args":[{"type":"string"}],"returns":"string"} +{"name":"format_date","args":[{"type":"string"},{"type":"date"}],"returns":"string"} +{"name":"format_timestamp","args":[{"type":"string"},{"type":"timestamp"}],"returns":"string"} +{"name":"format_timestamp","args":[{"type":"string"},{"type":"timestamp"},{"type":"string"}],"returns":"string"} +{"name":"from_base32","args":[{"type":"string"}],"returns":"bytes"} +{"name":"from_base64","args":[{"type":"string"}],"returns":"bytes"} +{"name":"from_hex","args":[{"type":"string"}],"returns":"bytes"} +{"name":"generate_array","args":[{"type":"int64"},{"type":"int64"}],"returns":"array(int64)"} +{"name":"generate_array","args":[{"type":"int64"},{"type":"int64"},{"type":"int64"}],"returns":"array(int64)"} +{"name":"generate_array","args":[{"type":"float64"},{"type":"float64"},{"type":"float64"}],"returns":"array(float64)"} +{"name":"generate_date_array","args":[{"type":"date"},{"type":"date"}],"returns":"array(date)"} +{"name":"generate_date_array","args":[{"type":"date"},{"type":"date"},{"type":"interval"}],"returns":"array(date)"} +{"name":"generate_uuid","returns":"string","never_null":true} +{"name":"get_next_sequence_value","args":[{"type":"anyelement"}],"returns":"int64","never_null":true} +{"name":"ieee_divide","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64"} +{"name":"int64","args":[{"type":"json"}],"returns":"int64"} +{"name":"is_inf","args":[{"type":"float64"}],"returns":"bool"} +{"name":"is_nan","args":[{"type":"float64"}],"returns":"bool"} +{"name":"json_array","args":[{"type":"anyelement"}],"returns":"json"} +{"name":"json_array_append","args":[{"type":"json"},{"type":"string"},{"type":"anyelement"}],"returns":"json"} +{"name":"json_array_insert","args":[{"type":"json"},{"type":"string"},{"type":"anyelement"}],"returns":"json"} +{"name":"json_contains","args":[{"type":"json"},{"type":"json"}],"returns":"bool"} +{"name":"json_keys","args":[{"type":"json"}],"returns":"array(string)"} +{"name":"json_object","args":[{"type":"string"},{"type":"anyelement"}],"returns":"json"} +{"name":"json_query","args":[{"type":"json"},{"type":"string"}],"returns":"json","nullable":true} +{"name":"json_query","args":[{"type":"string"},{"type":"string"}],"returns":"string","nullable":true} +{"name":"json_query_array","args":[{"type":"json"}],"returns":"array(json)","nullable":true} +{"name":"json_query_array","args":[{"type":"json"},{"type":"string"}],"returns":"array(json)","nullable":true} +{"name":"json_remove","args":[{"type":"json"},{"type":"string"}],"returns":"json"} +{"name":"json_set","args":[{"type":"json"},{"type":"string"},{"type":"anyelement"}],"returns":"json"} +{"name":"json_strip_nulls","args":[{"type":"json"}],"returns":"json"} +{"name":"json_type","args":[{"type":"json"}],"returns":"string"} +{"name":"json_value","args":[{"type":"json"},{"type":"string"}],"returns":"string","nullable":true} +{"name":"json_value","args":[{"type":"string"},{"type":"string"}],"returns":"string","nullable":true} +{"name":"json_value_array","args":[{"type":"json"}],"returns":"array(string)","nullable":true} +{"name":"json_value_array","args":[{"type":"json"},{"type":"string"}],"returns":"array(string)","nullable":true} +{"name":"justify_days","args":[{"type":"interval"}],"returns":"interval"} +{"name":"justify_hours","args":[{"type":"interval"}],"returns":"interval"} +{"name":"justify_interval","args":[{"type":"interval"}],"returns":"interval"} +{"name":"lax_bool","args":[{"type":"json"}],"returns":"bool","nullable":true} +{"name":"lax_float64","args":[{"type":"json"}],"returns":"float64","nullable":true} +{"name":"lax_int64","args":[{"type":"json"}],"returns":"int64","nullable":true} +{"name":"lax_string","args":[{"type":"json"}],"returns":"string","nullable":true} +{"name":"length","args":[{"type":"string"}],"returns":"int64"} +{"name":"length","args":[{"type":"bytes"}],"returns":"int64"} +{"name":"ln","args":[{"type":"float64"}],"returns":"float64"} +{"name":"ln","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"log","args":[{"type":"float64"}],"returns":"float64"} +{"name":"log","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"log","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64"} +{"name":"log10","args":[{"type":"float64"}],"returns":"float64"} +{"name":"log10","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"logical_and","kind":"a","args":[{"type":"bool"}],"returns":"bool","nullable":true} +{"name":"logical_or","kind":"a","args":[{"type":"bool"}],"returns":"bool","nullable":true} +{"name":"lower","args":[{"type":"string"}],"returns":"string"} +{"name":"lower","args":[{"type":"bytes"}],"returns":"bytes"} +{"name":"lpad","args":[{"type":"string"},{"type":"int64"}],"returns":"string"} +{"name":"lpad","args":[{"type":"string"},{"type":"int64"},{"type":"string"}],"returns":"string"} +{"name":"lpad","args":[{"type":"bytes"},{"type":"int64"},{"type":"bytes"}],"returns":"bytes"} +{"name":"ltrim","args":[{"type":"string"}],"returns":"string"} +{"name":"ltrim","args":[{"type":"string"},{"type":"string"}],"returns":"string"} +{"name":"ltrim","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bytes"} +{"name":"make_interval","args":[{"type":"int64"},{"type":"int64"},{"type":"int64"}],"returns":"interval"} +{"name":"max","kind":"a","args":[{"type":"anyelement"}],"returns":"$1","nullable":true} +{"name":"md5","args":[{"type":"string"}],"returns":"bytes"} +{"name":"md5","args":[{"type":"bytes"}],"returns":"bytes"} +{"name":"min","kind":"a","args":[{"type":"anyelement"}],"returns":"$1","nullable":true} +{"name":"mod","args":[{"type":"int64"},{"type":"int64"}],"returns":"int64"} +{"name":"mod","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"new_uuid","returns":"uuid","never_null":true} +{"name":"normalize","args":[{"type":"string"}],"returns":"string"} +{"name":"normalize_and_casefold","args":[{"type":"string"}],"returns":"string"} +{"name":"parse_date","args":[{"type":"string"},{"type":"string"}],"returns":"date"} +{"name":"parse_json","args":[{"type":"string"}],"returns":"json"} +{"name":"parse_timestamp","args":[{"type":"string"},{"type":"string"}],"returns":"timestamp"} +{"name":"parse_timestamp","args":[{"type":"string"},{"type":"string"},{"type":"string"}],"returns":"timestamp"} +{"name":"pending_commit_timestamp","returns":"timestamp","never_null":true} +{"name":"pow","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64"} +{"name":"pow","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"power","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64"} +{"name":"power","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"regexp_contains","args":[{"type":"string"},{"type":"string"}],"returns":"bool"} +{"name":"regexp_contains","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bool"} +{"name":"regexp_extract","args":[{"type":"string"},{"type":"string"}],"returns":"string","nullable":true} +{"name":"regexp_extract","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bytes","nullable":true} +{"name":"regexp_extract_all","args":[{"type":"string"},{"type":"string"}],"returns":"array(string)"} +{"name":"regexp_extract_all","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"array(bytes)"} +{"name":"regexp_replace","args":[{"type":"string"},{"type":"string"},{"type":"string"}],"returns":"string"} +{"name":"regexp_replace","args":[{"type":"bytes"},{"type":"bytes"},{"type":"bytes"}],"returns":"bytes"} +{"name":"repeat","args":[{"type":"string"},{"type":"int64"}],"returns":"string"} +{"name":"repeat","args":[{"type":"bytes"},{"type":"int64"}],"returns":"bytes"} +{"name":"replace","args":[{"type":"string"},{"type":"string"},{"type":"string"}],"returns":"string"} +{"name":"replace","args":[{"type":"bytes"},{"type":"bytes"},{"type":"bytes"}],"returns":"bytes"} +{"name":"reverse","args":[{"type":"string"}],"returns":"string"} +{"name":"reverse","args":[{"type":"bytes"}],"returns":"bytes"} +{"name":"round","args":[{"type":"float64"}],"returns":"float64"} +{"name":"round","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"round","args":[{"type":"float64"},{"type":"int64"}],"returns":"float64"} +{"name":"round","args":[{"type":"numeric"},{"type":"int64"}],"returns":"numeric"} +{"name":"rpad","args":[{"type":"string"},{"type":"int64"}],"returns":"string"} +{"name":"rpad","args":[{"type":"string"},{"type":"int64"},{"type":"string"}],"returns":"string"} +{"name":"rpad","args":[{"type":"bytes"},{"type":"int64"},{"type":"bytes"}],"returns":"bytes"} +{"name":"rtrim","args":[{"type":"string"}],"returns":"string"} +{"name":"rtrim","args":[{"type":"string"},{"type":"string"}],"returns":"string"} +{"name":"rtrim","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bytes"} +{"name":"safe_add","args":[{"type":"int64"},{"type":"int64"}],"returns":"int64","nullable":true} +{"name":"safe_add","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"safe_add","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric","nullable":true} +{"name":"safe_convert_bytes_to_string","args":[{"type":"bytes"}],"returns":"string"} +{"name":"safe_divide","args":[{"type":"int64"},{"type":"int64"}],"returns":"float64","nullable":true} +{"name":"safe_divide","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"safe_divide","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric","nullable":true} +{"name":"safe_multiply","args":[{"type":"int64"},{"type":"int64"}],"returns":"int64","nullable":true} +{"name":"safe_multiply","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"safe_multiply","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric","nullable":true} +{"name":"safe_negate","args":[{"type":"int64"}],"returns":"int64","nullable":true} +{"name":"safe_negate","args":[{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"safe_negate","args":[{"type":"numeric"}],"returns":"numeric","nullable":true} +{"name":"safe_subtract","args":[{"type":"int64"},{"type":"int64"}],"returns":"int64","nullable":true} +{"name":"safe_subtract","args":[{"type":"float64"},{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"safe_subtract","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric","nullable":true} +{"name":"safe_to_json","args":[{"type":"anyelement"}],"returns":"json","never_null":true} +{"name":"score","args":[{"type":"tokenlist"},{"type":"string"}],"returns":"float64"} +{"name":"score_ngrams","args":[{"type":"tokenlist"},{"type":"string"}],"returns":"float64"} +{"name":"search","args":[{"type":"tokenlist"},{"type":"string"}],"returns":"bool"} +{"name":"search_ngrams","args":[{"type":"tokenlist"},{"type":"string"}],"returns":"bool"} +{"name":"search_substring","args":[{"type":"tokenlist"},{"type":"string"}],"returns":"bool"} +{"name":"sha1","args":[{"type":"string"}],"returns":"bytes"} +{"name":"sha1","args":[{"type":"bytes"}],"returns":"bytes"} +{"name":"sha256","args":[{"type":"string"}],"returns":"bytes"} +{"name":"sha256","args":[{"type":"bytes"}],"returns":"bytes"} +{"name":"sha512","args":[{"type":"string"}],"returns":"bytes"} +{"name":"sha512","args":[{"type":"bytes"}],"returns":"bytes"} +{"name":"sign","args":[{"type":"int64"}],"returns":"int64"} +{"name":"sign","args":[{"type":"float64"}],"returns":"float64"} +{"name":"sign","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"sin","args":[{"type":"float64"}],"returns":"float64"} +{"name":"snippet","args":[{"type":"string"},{"type":"string"}],"returns":"json"} +{"name":"soundex","args":[{"type":"string"}],"returns":"string"} +{"name":"split","args":[{"type":"string"}],"returns":"array(string)"} +{"name":"split","args":[{"type":"string"},{"type":"string"}],"returns":"array(string)"} +{"name":"split","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"array(bytes)"} +{"name":"split_substr","args":[{"type":"string"},{"type":"string"},{"type":"int64"}],"returns":"string"} +{"name":"split_substr","args":[{"type":"string"},{"type":"string"},{"type":"int64"},{"type":"int64"}],"returns":"string"} +{"name":"sqrt","args":[{"type":"float64"}],"returns":"float64"} +{"name":"sqrt","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"starts_with","args":[{"type":"string"},{"type":"string"}],"returns":"bool"} +{"name":"starts_with","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bool"} +{"name":"stddev","kind":"a","args":[{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"stddev_samp","kind":"a","args":[{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"string","args":[{"type":"timestamp"}],"returns":"string"} +{"name":"string","args":[{"type":"json"}],"returns":"string"} +{"name":"string","args":[{"type":"timestamp"},{"type":"string"}],"returns":"string"} +{"name":"string_agg","kind":"a","args":[{"type":"string"}],"returns":"string","nullable":true} +{"name":"string_agg","kind":"a","args":[{"type":"bytes"}],"returns":"bytes","nullable":true} +{"name":"string_agg","kind":"a","args":[{"type":"string"},{"type":"string"}],"returns":"string","nullable":true} +{"name":"string_agg","kind":"a","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bytes","nullable":true} +{"name":"strpos","args":[{"type":"string"},{"type":"string"}],"returns":"int64"} +{"name":"strpos","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"int64"} +{"name":"substr","args":[{"type":"string"},{"type":"int64"}],"returns":"string"} +{"name":"substr","args":[{"type":"bytes"},{"type":"int64"}],"returns":"bytes"} +{"name":"substr","args":[{"type":"string"},{"type":"int64"},{"type":"int64"}],"returns":"string"} +{"name":"substr","args":[{"type":"bytes"},{"type":"int64"},{"type":"int64"}],"returns":"bytes"} +{"name":"substring","args":[{"type":"string"},{"type":"int64"}],"returns":"string"} +{"name":"substring","args":[{"type":"string"},{"type":"int64"},{"type":"int64"}],"returns":"string"} +{"name":"sum","kind":"a","args":[{"type":"int64"}],"returns":"int64","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"float32"}],"returns":"float64","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"numeric"}],"returns":"numeric","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"interval"}],"returns":"interval","nullable":true} +{"name":"tan","args":[{"type":"float64"}],"returns":"float64"} +{"name":"timestamp","args":[{"type":"string"}],"returns":"timestamp"} +{"name":"timestamp","args":[{"type":"date"}],"returns":"timestamp"} +{"name":"timestamp","args":[{"type":"string"},{"type":"string"}],"returns":"timestamp"} +{"name":"timestamp","args":[{"type":"date"},{"type":"string"}],"returns":"timestamp"} +{"name":"timestamp_add","args":[{"type":"timestamp"},{"type":"interval"}],"returns":"timestamp"} +{"name":"timestamp_diff","args":[{"type":"timestamp"},{"type":"timestamp"},{"type":"string"}],"returns":"int64"} +{"name":"timestamp_micros","args":[{"type":"int64"}],"returns":"timestamp"} +{"name":"timestamp_millis","args":[{"type":"int64"}],"returns":"timestamp"} +{"name":"timestamp_seconds","args":[{"type":"int64"}],"returns":"timestamp"} +{"name":"timestamp_sub","args":[{"type":"timestamp"},{"type":"interval"}],"returns":"timestamp"} +{"name":"timestamp_trunc","args":[{"type":"timestamp"},{"type":"string"}],"returns":"timestamp"} +{"name":"timestamp_trunc","args":[{"type":"timestamp"},{"type":"string"},{"type":"string"}],"returns":"timestamp"} +{"name":"to_base32","args":[{"type":"bytes"}],"returns":"string"} +{"name":"to_base64","args":[{"type":"bytes"}],"returns":"string"} +{"name":"to_code_points","args":[{"type":"string"}],"returns":"array(int64)"} +{"name":"to_code_points","args":[{"type":"bytes"}],"returns":"array(int64)"} +{"name":"to_hex","args":[{"type":"bytes"}],"returns":"string"} +{"name":"to_json","args":[{"type":"anyelement"}],"returns":"json","never_null":true} +{"name":"to_json_string","args":[{"type":"json"}],"returns":"string","never_null":true} +{"name":"trim","args":[{"type":"string"}],"returns":"string"} +{"name":"trim","args":[{"type":"string"},{"type":"string"}],"returns":"string"} +{"name":"trim","args":[{"type":"bytes"},{"type":"bytes"}],"returns":"bytes"} +{"name":"trunc","args":[{"type":"float64"}],"returns":"float64"} +{"name":"trunc","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"trunc","args":[{"type":"float64"},{"type":"int64"}],"returns":"float64"} +{"name":"trunc","args":[{"type":"numeric"},{"type":"int64"}],"returns":"numeric"} +{"name":"unix_date","args":[{"type":"date"}],"returns":"int64"} +{"name":"unix_micros","args":[{"type":"timestamp"}],"returns":"int64"} +{"name":"unix_millis","args":[{"type":"timestamp"}],"returns":"int64"} +{"name":"unix_seconds","args":[{"type":"timestamp"}],"returns":"int64"} +{"name":"unnest","args":[{"type":"anyarray"}],"returns":"anyelement","nullable":true} +{"name":"upper","args":[{"type":"string"}],"returns":"string"} +{"name":"upper","args":[{"type":"bytes"}],"returns":"bytes"} +{"name":"var_samp","kind":"a","args":[{"type":"float64"}],"returns":"float64","nullable":true} +{"name":"variance","kind":"a","args":[{"type":"float64"}],"returns":"float64","nullable":true} diff --git a/internal/engine/googlesql/dialect/operators.jsonl b/internal/engine/googlesql/dialect/operators.jsonl new file mode 100644 index 0000000000..7a414883bc --- /dev/null +++ b/internal/engine/googlesql/dialect/operators.jsonl @@ -0,0 +1,83 @@ +{"name":"+","left":"int64","right":"int64","result":"int64"} +{"name":"+","left":"int64","right":"float64","result":"float64"} +{"name":"+","left":"int64","right":"float32","result":"float64"} +{"name":"+","left":"int64","right":"numeric","result":"numeric"} +{"name":"+","left":"float64","right":"int64","result":"float64"} +{"name":"+","left":"float64","right":"float64","result":"float64"} +{"name":"+","left":"float64","right":"float32","result":"float64"} +{"name":"+","left":"float64","right":"numeric","result":"float64"} +{"name":"+","left":"float32","right":"int64","result":"float64"} +{"name":"+","left":"float32","right":"float64","result":"float64"} +{"name":"+","left":"float32","right":"float32","result":"float64"} +{"name":"+","left":"float32","right":"numeric","result":"float64"} +{"name":"+","left":"numeric","right":"int64","result":"numeric"} +{"name":"+","left":"numeric","right":"float64","result":"float64"} +{"name":"+","left":"numeric","right":"float32","result":"float64"} +{"name":"+","left":"numeric","right":"numeric","result":"numeric"} +{"name":"-","left":"int64","right":"int64","result":"int64"} +{"name":"-","left":"int64","right":"float64","result":"float64"} +{"name":"-","left":"int64","right":"float32","result":"float64"} +{"name":"-","left":"int64","right":"numeric","result":"numeric"} +{"name":"-","left":"float64","right":"int64","result":"float64"} +{"name":"-","left":"float64","right":"float64","result":"float64"} +{"name":"-","left":"float64","right":"float32","result":"float64"} +{"name":"-","left":"float64","right":"numeric","result":"float64"} +{"name":"-","left":"float32","right":"int64","result":"float64"} +{"name":"-","left":"float32","right":"float64","result":"float64"} +{"name":"-","left":"float32","right":"float32","result":"float64"} +{"name":"-","left":"float32","right":"numeric","result":"float64"} +{"name":"-","left":"numeric","right":"int64","result":"numeric"} +{"name":"-","left":"numeric","right":"float64","result":"float64"} +{"name":"-","left":"numeric","right":"float32","result":"float64"} +{"name":"-","left":"numeric","right":"numeric","result":"numeric"} +{"name":"*","left":"int64","right":"int64","result":"int64"} +{"name":"*","left":"int64","right":"float64","result":"float64"} +{"name":"*","left":"int64","right":"float32","result":"float64"} +{"name":"*","left":"int64","right":"numeric","result":"numeric"} +{"name":"*","left":"float64","right":"int64","result":"float64"} +{"name":"*","left":"float64","right":"float64","result":"float64"} +{"name":"*","left":"float64","right":"float32","result":"float64"} +{"name":"*","left":"float64","right":"numeric","result":"float64"} +{"name":"*","left":"float32","right":"int64","result":"float64"} +{"name":"*","left":"float32","right":"float64","result":"float64"} +{"name":"*","left":"float32","right":"float32","result":"float64"} +{"name":"*","left":"float32","right":"numeric","result":"float64"} +{"name":"*","left":"numeric","right":"int64","result":"numeric"} +{"name":"*","left":"numeric","right":"float64","result":"float64"} +{"name":"*","left":"numeric","right":"float32","result":"float64"} +{"name":"*","left":"numeric","right":"numeric","result":"numeric"} +{"name":"/","left":"int64","right":"int64","result":"float64"} +{"name":"/","left":"int64","right":"float64","result":"float64"} +{"name":"/","left":"int64","right":"float32","result":"float64"} +{"name":"/","left":"int64","right":"numeric","result":"numeric"} +{"name":"/","left":"float64","right":"int64","result":"float64"} +{"name":"/","left":"float64","right":"float64","result":"float64"} +{"name":"/","left":"float64","right":"float32","result":"float64"} +{"name":"/","left":"float64","right":"numeric","result":"float64"} +{"name":"/","left":"float32","right":"int64","result":"float64"} +{"name":"/","left":"float32","right":"float64","result":"float64"} +{"name":"/","left":"float32","right":"float32","result":"float64"} +{"name":"/","left":"float32","right":"numeric","result":"float64"} +{"name":"/","left":"numeric","right":"int64","result":"numeric"} +{"name":"/","left":"numeric","right":"float64","result":"float64"} +{"name":"/","left":"numeric","right":"float32","result":"float64"} +{"name":"/","left":"numeric","right":"numeric","result":"numeric"} +{"name":"||","left":"string","right":"string","result":"string"} +{"name":"||","left":"bytes","right":"bytes","result":"bytes"} +{"name":"+","left":"timestamp","right":"interval","result":"timestamp"} +{"name":"+","left":"interval","right":"interval","result":"interval"} +{"name":"-","left":"timestamp","right":"interval","result":"timestamp"} +{"name":"-","left":"interval","right":"interval","result":"interval"} +{"name":"+","left":"interval","right":"timestamp","result":"timestamp"} +{"name":"-","left":"date","right":"date","result":"interval"} +{"name":"-","left":"timestamp","right":"timestamp","result":"interval"} +{"name":"*","left":"interval","right":"int64","result":"interval"} +{"name":"/","left":"interval","right":"int64","result":"interval"} +{"name":"\u0026","left":"int64","right":"int64","result":"int64"} +{"name":"|","left":"int64","right":"int64","result":"int64"} +{"name":"^","left":"int64","right":"int64","result":"int64"} +{"name":"\u003c\u003c","left":"int64","right":"int64","result":"int64"} +{"name":"\u003e\u003e","left":"int64","right":"int64","result":"int64"} +{"name":"\u0026","left":"bytes","right":"bytes","result":"bytes"} +{"name":"|","left":"bytes","right":"bytes","result":"bytes"} +{"name":"^","left":"bytes","right":"bytes","result":"bytes"} diff --git a/internal/engine/googlesql/dialect/relations.jsonl b/internal/engine/googlesql/dialect/relations.jsonl new file mode 100644 index 0000000000..03e4e78e1e --- /dev/null +++ b/internal/engine/googlesql/dialect/relations.jsonl @@ -0,0 +1,98 @@ +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAMS","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"ALL","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAM_COLUMNS","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAM_OPTIONS","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAM_PRIVILEGES","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAM_TABLES","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"ALL_COLUMNS","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHECK_CONSTRAINTS","kind":"v","columns":[{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true},{"name":"CHECK_CLAUSE","type":"string(max)","not_null":true},{"name":"SPANNER_STATE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"COLUMNS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64","not_null":true},{"name":"COLUMN_DEFAULT","type":"string(max)"},{"name":"DATA_TYPE","type":"string(max)"},{"name":"IS_NULLABLE","type":"string(max)"},{"name":"SPANNER_TYPE","type":"string(max)"},{"name":"IS_GENERATED","type":"string(max)","not_null":true},{"name":"GENERATION_EXPRESSION","type":"string(max)"},{"name":"IS_STORED","type":"string(max)"},{"name":"IS_HIDDEN","type":"bool","not_null":true},{"name":"SPANNER_STATE","type":"string(max)"},{"name":"IS_IDENTITY","type":"string(max)"},{"name":"IDENTITY_GENERATION","type":"string(max)"},{"name":"IDENTITY_KIND","type":"string(max)"},{"name":"IDENTITY_START_WITH_COUNTER","type":"string(max)"},{"name":"IDENTITY_SKIP_RANGE_MIN","type":"string(max)"},{"name":"IDENTITY_SKIP_RANGE_MAX","type":"string(max)"},{"name":"ON_UPDATE_EXPRESSION","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"COLUMN_COLUMN_USAGE","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"DEPENDENT_COLUMN","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"COLUMN_OPTIONS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"COLUMN_PRIVILEGES","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CONSTRAINT_COLUMN_USAGE","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CONSTRAINT_TABLE_USAGE","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"DATABASE_OPTIONS","kind":"v","columns":[{"name":"CATALOG_NAME","type":"string(max)","not_null":true},{"name":"SCHEMA_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"INDEXES","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"INDEX_NAME","type":"string(max)","not_null":true},{"name":"INDEX_TYPE","type":"string(max)","not_null":true},{"name":"PARENT_TABLE_NAME","type":"string(max)","not_null":true},{"name":"IS_UNIQUE","type":"bool","not_null":true},{"name":"IS_NULL_FILTERED","type":"bool","not_null":true},{"name":"INDEX_STATE","type":"string(100)","not_null":true},{"name":"FILTER","type":"string(max)"},{"name":"SPANNER_IS_MANAGED","type":"bool","not_null":true},{"name":"SEARCH_PARTITION_BY","type":"string(max)","array":true},{"name":"SEARCH_ORDER_BY","type":"string(max)","array":true},{"name":"SEARCH_UNNEST","type":"string(max)","array":true}]} +{"schema":"INFORMATION_SCHEMA","name":"INDEX_COLUMNS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"INDEX_NAME","type":"string(max)","not_null":true},{"name":"INDEX_TYPE","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64"},{"name":"COLUMN_ORDERING","type":"string(max)"},{"name":"IS_NULLABLE","type":"string(max)"},{"name":"SPANNER_TYPE","type":"string(max)"},{"name":"EXPRESSION","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"INDEX_OPTIONS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"INDEX_NAME","type":"string(max)","not_null":true},{"name":"INDEX_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"KEY_COLUMN_USAGE","kind":"v","columns":[{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64","not_null":true},{"name":"POSITION_IN_UNIQUE_CONSTRAINT","type":"int64"}]} +{"schema":"INFORMATION_SCHEMA","name":"LOCALITY_GROUP_OPTIONS","kind":"v","columns":[{"name":"LOCALITY_GROUP_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"MODELS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"IS_REMOTE","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"MODEL_COLUMNS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_KIND","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64","not_null":true},{"name":"DATA_TYPE","type":"string(max)","not_null":true},{"name":"IS_EXPLICIT","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"MODEL_COLUMN_OPTIONS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_KIND","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"MODEL_OPTIONS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"MODEL_PRIVILEGES","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"PARAMETERS","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64","not_null":true},{"name":"PARAMETER_NAME","type":"string(max)","not_null":true},{"name":"DATA_TYPE","type":"string(max)","not_null":true},{"name":"PARAMETER_DEFAULT","type":"string(max)"},{"name":"SPANNER_TYPE","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"PLACEMENTS","kind":"v","columns":[{"name":"PLACEMENT_NAME","type":"string(max)","not_null":true},{"name":"IS_DEFAULT","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"PLACEMENT_OPTIONS","kind":"v","columns":[{"name":"PLACEMENT_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"PROPERTY_GRAPHS","kind":"v","columns":[{"name":"PROPERTY_GRAPH_CATALOG","type":"string(max)","not_null":true},{"name":"PROPERTY_GRAPH_SCHEMA","type":"string(max)","not_null":true},{"name":"PROPERTY_GRAPH_NAME","type":"string(max)","not_null":true},{"name":"PROPERTY_GRAPH_METADATA_JSON","type":"json"}]} +{"schema":"INFORMATION_SCHEMA","name":"REFERENTIAL_CONSTRAINTS","kind":"v","columns":[{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true},{"name":"UNIQUE_CONSTRAINT_CATALOG","type":"string(max)"},{"name":"UNIQUE_CONSTRAINT_SCHEMA","type":"string(max)"},{"name":"UNIQUE_CONSTRAINT_NAME","type":"string(max)"},{"name":"MATCH_OPTION","type":"string(max)","not_null":true},{"name":"UPDATE_RULE","type":"string(max)","not_null":true},{"name":"DELETE_RULE","type":"string(max)","not_null":true},{"name":"SPANNER_STATE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLES","kind":"v","columns":[{"name":"ROLE_NAME","type":"string(max)","not_null":true},{"name":"IS_SYSTEM","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_CHANGE_STREAM_GRANTS","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_COLUMN_GRANTS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_GRANTEES","kind":"v","columns":[{"name":"ROLE_NAME","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_MODEL_GRANTS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_ROUTINE_GRANTS","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_TABLE_GRANTS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROUTINES","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"ROUTINE_CATALOG","type":"string(max)","not_null":true},{"name":"ROUTINE_SCHEMA","type":"string(max)","not_null":true},{"name":"ROUTINE_NAME","type":"string(max)","not_null":true},{"name":"ROUTINE_TYPE","type":"string(max)","not_null":true},{"name":"DATA_TYPE","type":"string(max)","not_null":true},{"name":"ROUTINE_BODY","type":"string(max)","not_null":true},{"name":"ROUTINE_DEFINITION","type":"string(max)","not_null":true},{"name":"SECURITY_TYPE","type":"string(max)","not_null":true},{"name":"SPANNER_TYPE","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"ROUTINE_OPTIONS","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROUTINE_PRIVILEGES","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"SCHEMATA","kind":"v","columns":[{"name":"CATALOG_NAME","type":"string(max)","not_null":true},{"name":"SCHEMA_NAME","type":"string(max)","not_null":true},{"name":"EFFECTIVE_TIMESTAMP","type":"int64"},{"name":"PROTO_BUNDLE","type":"proto('proto2.FileDescriptorSet')"},{"name":"SCHEMA_OWNER","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"SEQUENCES","kind":"v","columns":[{"name":"CATALOG","type":"string(max)","not_null":true},{"name":"SCHEMA","type":"string(max)","not_null":true},{"name":"NAME","type":"string(max)","not_null":true},{"name":"DATA_TYPE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"SEQUENCE_OPTIONS","kind":"v","columns":[{"name":"CATALOG","type":"string(max)","not_null":true},{"name":"SCHEMA","type":"string(max)","not_null":true},{"name":"NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"SPANNER_STATISTICS","kind":"v","columns":[{"name":"CATALOG_NAME","type":"string(max)","not_null":true},{"name":"SCHEMA_NAME","type":"string(max)","not_null":true},{"name":"PACKAGE_NAME","type":"string(max)","not_null":true},{"name":"ALLOW_GC","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLES","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"PARENT_TABLE_NAME","type":"string(max)"},{"name":"ON_DELETE_ACTION","type":"string(max)"},{"name":"TABLE_TYPE","type":"string(32)","not_null":true},{"name":"SPANNER_STATE","type":"string(max)"},{"name":"INTERLEAVE_TYPE","type":"string(max)"},{"name":"ROW_DELETION_POLICY_EXPRESSION","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLE_CONSTRAINTS","kind":"v","columns":[{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"CONSTRAINT_TYPE","type":"string(max)","not_null":true},{"name":"IS_DEFERRABLE","type":"string(max)","not_null":true},{"name":"INITIALLY_DEFERRED","type":"string(max)","not_null":true},{"name":"ENFORCED","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLE_OPTIONS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLE_PRIVILEGES","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLE_SYNONYMS","kind":"v","columns":[{"name":"SYNONYM_CATALOG","type":"string(max)","not_null":true},{"name":"SYNONYM_SCHEMA","type":"string(max)","not_null":true},{"name":"SYNONYM_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"VIEWS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"VIEW_DEFINITION","type":"string(max)"},{"name":"SECURITY_TYPE","type":"string(max)","not_null":true}]} +{"schema":"SPANNER_SYS","name":"ACTIVE_PARTITIONED_DMLS","kind":"v","columns":[{"name":"TEXT","type":"string(max)"},{"name":"TEXT_FINGERPRINT","type":"string(max)"},{"name":"SESSION_ID","type":"string(max)"},{"name":"NUM_PARTITIONS_TOTAL","type":"int64"},{"name":"NUM_PARTITIONS_COMPLETE","type":"int64"},{"name":"NUM_TRIVIAL_PARTITIONS_COMPLETE","type":"int64"},{"name":"PROGRESS","type":"string(max)"},{"name":"ROWS_PROCESSED","type":"int64"},{"name":"START_TIMESTAMP","type":"timestamp"},{"name":"LAST_UPDATE_TIMESTAMP","type":"timestamp"}]} +{"schema":"SPANNER_SYS","name":"ACTIVE_QUERIES_SUMMARY","kind":"v","columns":[{"name":"ACTIVE_COUNT","type":"int64"},{"name":"OLDEST_START_TIME","type":"timestamp"},{"name":"COUNT_OLDER_THAN_1S","type":"int64"},{"name":"COUNT_OLDER_THAN_10S","type":"int64"},{"name":"COUNT_OLDER_THAN_100S","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"COLUMN_OPERATIONS_STATS_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"COLUMN_NAME","type":"string(max)"},{"name":"QUERY_COUNT","type":"int64"},{"name":"READ_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"IS_QUERY_CACHE_MEMORY_CAPPED","type":"bool"}]} +{"schema":"SPANNER_SYS","name":"COLUMN_OPERATIONS_STATS_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"COLUMN_NAME","type":"string(max)"},{"name":"QUERY_COUNT","type":"int64"},{"name":"READ_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"IS_QUERY_CACHE_MEMORY_CAPPED","type":"bool"}]} +{"schema":"SPANNER_SYS","name":"COLUMN_OPERATIONS_STATS_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"COLUMN_NAME","type":"string(max)"},{"name":"QUERY_COUNT","type":"int64"},{"name":"READ_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"IS_QUERY_CACHE_MEMORY_CAPPED","type":"bool"}]} +{"schema":"SPANNER_SYS","name":"GRAPH_OPERATION_EXECUTION_STATUS","kind":"v","columns":[{"name":"QUERY_ID","type":"string(max)"},{"name":"QUERY_TEXT","type":"string(max)"},{"name":"START_TIMESTAMP","type":"timestamp"},{"name":"LAST_UPDATE_TIMESTAMP","type":"timestamp"},{"name":"PROGRESS","type":"float64"},{"name":"STATUS","type":"string(max)"},{"name":"ERROR_MESSAGE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"ROW_RANGE_START_KEY","type":"bytes(max)"},{"name":"LOCK_WAIT_SECONDS","type":"float64"},{"name":"SAMPLE_LOCK_REQUESTS","type":"struct(COLUMN: string(max), LOCK_MODE: string(max), TRANSACTION_TAG: string(max))","array":true},{"name":"SAMPLE_LOCK_REQUESTS_JSON_STRING","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"ROW_RANGE_START_KEY","type":"bytes(max)"},{"name":"LOCK_WAIT_SECONDS","type":"float64"},{"name":"SAMPLE_LOCK_REQUESTS","type":"struct(COLUMN: string(max), LOCK_MODE: string(max), TRANSACTION_TAG: string(max))","array":true},{"name":"SAMPLE_LOCK_REQUESTS_JSON_STRING","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"ROW_RANGE_START_KEY","type":"bytes(max)"},{"name":"LOCK_WAIT_SECONDS","type":"float64"},{"name":"SAMPLE_LOCK_REQUESTS","type":"struct(COLUMN: string(max), LOCK_MODE: string(max), TRANSACTION_TAG: string(max))","array":true},{"name":"SAMPLE_LOCK_REQUESTS_JSON_STRING","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOTAL_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TOTAL_LOCK_WAIT_SECONDS","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOTAL_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TOTAL_LOCK_WAIT_SECONDS","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOTAL_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TOTAL_LOCK_WAIT_SECONDS","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"OLDEST_ACTIVE_QUERIES","kind":"v","columns":[{"name":"START_TIME","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"TEXT","type":"string(max)"},{"name":"TEXT_TRUNCATED","type":"bool"},{"name":"SESSION_ID","type":"string(max)"},{"name":"QUERY_ID","type":"string(max)"},{"name":"CLIENT_IP_ADDRESS","type":"string(max)"},{"name":"API_CLIENT_HEADER","type":"string(max)"},{"name":"USER_AGENT_HEADER","type":"string(max)"},{"name":"SERVER_REGION","type":"string(max)"},{"name":"PRIORITY","type":"string(max)"},{"name":"TRANSACTION_TYPE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_PROFILES_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"LATENCY_SECONDS","type":"float64"},{"name":"QUERY_PROFILE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_PROFILES_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"LATENCY_SECONDS","type":"float64"},{"name":"QUERY_PROFILE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_PROFILES_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"LATENCY_SECONDS","type":"float64"},{"name":"QUERY_PROFILE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_RECOMMENDATIONS","kind":"v","columns":[{"name":"GENERATION_TIME","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"QUERY_RECOMMENDATIONS","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT","type":"string(max)"},{"name":"TEXT_TRUNCATED","type":"bool"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"STATEMENT_COUNT","type":"int64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"QUERY_TYPE","type":"string(max)"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"},{"name":"QUERY_OPTIMIZER_VERSIONS","type":"int64","array":true},{"name":"STATISTICS_PACKAGE_NAMES","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT","type":"string(max)"},{"name":"TEXT_TRUNCATED","type":"bool"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"STATEMENT_COUNT","type":"int64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"QUERY_TYPE","type":"string(max)"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"},{"name":"QUERY_OPTIMIZER_VERSIONS","type":"int64","array":true},{"name":"STATISTICS_PACKAGE_NAMES","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT","type":"string(max)"},{"name":"TEXT_TRUNCATED","type":"bool"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"STATEMENT_COUNT","type":"int64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"QUERY_TYPE","type":"string(max)"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"},{"name":"QUERY_OPTIMIZER_VERSIONS","type":"int64","array":true},{"name":"STATISTICS_PACKAGE_NAMES","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOTAL_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOTAL_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOTAL_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"FPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"READ_TYPE","type":"string(max)"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"FPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"READ_TYPE","type":"string(max)"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"FPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"READ_TYPE","type":"string(max)"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOTAL_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOTAL_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOTAL_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"ROW_DELETION_POLICIES","kind":"v","columns":[{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"PROCESSED_WATERMARK","type":"timestamp"},{"name":"UNDELETABLE_ROWS","type":"int64","not_null":true},{"name":"MIN_UNDELETABLE_TIMESTAMP","type":"timestamp"}]} +{"schema":"SPANNER_SYS","name":"SCHEMA_RECOMMENDATIONS","kind":"v","columns":[{"name":"GENERATION_TIME","type":"timestamp"},{"name":"FINGERPRINT","type":"string(max)"},{"name":"SCHEMA_RECOMMENDATIONS","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"SPLIT_HOTNESS_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"SPLIT_START","type":"string(max)"},{"name":"SPLIT_LIMIT","type":"string(max)"},{"name":"AFFECTED_TABLES","type":"string(max)","array":true},{"name":"HOTNESS","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"SPLIT_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"SPLIT_START","type":"string(max)"},{"name":"SPLIT_LIMIT","type":"string(max)"},{"name":"AFFECTED_TABLES","type":"string(max)","array":true},{"name":"CPU_USAGE_SCORE","type":"int64"},{"name":"UNSPLITTABLE_REASONS","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"SPLIT_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"SPLIT_START","type":"string(max)"},{"name":"SPLIT_LIMIT","type":"string(max)"},{"name":"AFFECTED_TABLES","type":"string(max)","array":true},{"name":"CPU_USAGE_SCORE","type":"int64"},{"name":"UNSPLITTABLE_REASONS","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"SPLIT_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"SPLIT_START","type":"string(max)"},{"name":"SPLIT_LIMIT","type":"string(max)"},{"name":"AFFECTED_TABLES","type":"string(max)","array":true},{"name":"CPU_USAGE_SCORE","type":"int64"},{"name":"UNSPLITTABLE_REASONS","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"SUPPORTED_OPTIMIZER_VERSIONS","kind":"v","columns":[{"name":"VERSION","type":"int64","not_null":true},{"name":"RELEASE_DATE","type":"date","not_null":true},{"name":"IS_DEFAULT","type":"bool","not_null":true}]} +{"schema":"SPANNER_SYS","name":"TABLE_OPERATIONS_STATS_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"READ_QUERY_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"DELETE_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TABLE_OPERATIONS_STATS_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"READ_QUERY_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"DELETE_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TABLE_OPERATIONS_STATS_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"READ_QUERY_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"DELETE_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TABLE_SIZES_STATS_1HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"USED_BYTES","type":"float64"},{"name":"USED_SSD_BYTES","type":"float64"},{"name":"USED_HDD_BYTES","type":"float64"},{"name":"COLUMNAR_USED_BYTES","type":"float64"},{"name":"COLUMNAR_USED_SSD_BYTES","type":"float64"},{"name":"COLUMNAR_USED_HDD_BYTES","type":"float64"},{"name":"COLUMNAR_COVERAGE_RATIO","type":"float64"},{"name":"COLUMNAR_SSD_COVERAGE_RATIO","type":"float64"},{"name":"COLUMNAR_HDD_COVERAGE_RATIO","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"TABLE_SIZES_STATS_PER_LOCALITY_GROUP_1HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"LOCALITY_GROUP","type":"string(max)"},{"name":"USED_SSD_BYTES","type":"float64"},{"name":"USED_HDD_BYTES","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"TASKS","kind":"v","columns":[{"name":"TASK_NAME","type":"string(max)","not_null":true},{"name":"PROCESSED_WATERMARK","type":"timestamp"},{"name":"LAST_RUN_STATUS","type":"string(max)"},{"name":"UNDELETABLE_ROWS","type":"int64","not_null":true}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"FPRINT","type":"int64"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_CONSTRUCTIVE_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_DELETE_TABLES","type":"string(max)","array":true},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"TRANSACTION_TAG","type":"string(max)"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"FPRINT","type":"int64"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_CONSTRUCTIVE_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_DELETE_TABLES","type":"string(max)","array":true},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"TRANSACTION_TAG","type":"string(max)"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"FPRINT","type":"int64"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_CONSTRUCTIVE_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_DELETE_TABLES","type":"string(max)","array":true},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"TRANSACTION_TAG","type":"string(max)"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOTAL_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOTAL_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOTAL_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"USER_SPLIT_POINTS","kind":"v","columns":[{"name":"TABLE_NAME","type":"string(max)"},{"name":"INDEX_NAME","type":"string(max)"},{"name":"INITIATOR","type":"string(max)"},{"name":"SPLIT_KEY","type":"string(max)"},{"name":"EXPIRE_TIME","type":"timestamp"}]} +{"schema":"SPANNER_SYS","name":"VECTOR_INDEX_METRICS_HISTORY","kind":"v","columns":[{"name":"VECTOR_INDEX_NAME","type":"string(max)"},{"name":"START_TIME","type":"timestamp"},{"name":"COMPLETION_TIME","type":"timestamp"},{"name":"ROWS_SCANNED","type":"int64"},{"name":"CLUSTERS_SAMPLED","type":"int64"},{"name":"ZERO_SIZE_CLUSTERS_SAMPLED","type":"int64"},{"name":"MIN_CLUSTER_SIZE","type":"int64"},{"name":"MAX_CLUSTER_SIZE","type":"int64"},{"name":"CLUSTER_SIZE_PERCENTILES","type":"struct(percentile: int64, value_at_percentile: int64)","array":true},{"name":"CLUSTER_AVERAGE_DISTANCE_TO_CENTROID_PERCENTILES","type":"struct(percentile: int64, value_at_percentile: float64)","array":true},{"name":"NUM_LEAVES","type":"int64"},{"name":"NUM_BRANCHES","type":"int64"}]} diff --git a/internal/engine/googlesql/dialect/types.jsonl b/internal/engine/googlesql/dialect/types.jsonl new file mode 100644 index 0000000000..10f671d9a7 --- /dev/null +++ b/internal/engine/googlesql/dialect/types.jsonl @@ -0,0 +1,23 @@ +{"name":"bool","category":"B"} +{"name":"int64","category":"N"} +{"name":"float32","category":"N"} +{"name":"float64","category":"N"} +{"name":"numeric","category":"N"} +{"name":"bignumeric","category":"N"} +{"name":"string","category":"S"} +{"name":"bytes","category":"S"} +{"name":"uuid","category":"S"} +{"name":"date","category":"D"} +{"name":"datetime","category":"D"} +{"name":"time","category":"D"} +{"name":"timestamp","category":"D"} +{"name":"interval","category":"T"} +{"name":"json","category":"U"} +{"name":"geography","category":"U"} +{"name":"struct","category":"U"} +{"name":"enum","category":"U"} +{"name":"proto","category":"U"} +{"name":"tokenlist","category":"U"} +{"name":"array","category":"A"} +{"name":"range","category":"U"} +{"name":"map","category":"U"} diff --git a/internal/engine/googlesql/parse.go b/internal/engine/googlesql/parse.go new file mode 100644 index 0000000000..87967c00ce --- /dev/null +++ b/internal/engine/googlesql/parse.go @@ -0,0 +1,70 @@ +package googlesql + +import ( + "bytes" + "context" + "io" + + "github.com/sqlc-dev/zetajones/parser" + + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func NewParser() *Parser { + return &Parser{} +} + +type Parser struct{} + +func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { + blob, err := io.ReadAll(r) + if err != nil { + return nil, err + } + + ctx := context.Background() + stmtNodes, err := parser.Parse(ctx, bytes.NewReader(blob)) + if err != nil { + return nil, err + } + + // zetajones node locations are byte offsets into the input. Following the + // convention used by the other engines, a statement's location starts at the + // end of the previous statement (or the start of the input) so that any + // leading comment — in particular the "-- name:" annotation sqlc relies on — + // is captured as part of the statement. + var stmts []ast.Statement + loc := 0 + for _, stmt := range stmtNodes { + converter := &cc{} + out := converter.convert(stmt) + if _, ok := out.(*ast.TODO); ok { + // Skip over the unsupported statement (and its trailing semicolon) + // so the next statement's leading comment is measured from here. + loc = stmt.End() + 1 + continue + } + + end := stmt.End() + stmts = append(stmts, ast.Statement{ + Raw: &ast.RawStmt{ + Stmt: out, + StmtLocation: loc, + StmtLen: end - loc, + }, + }) + loc = end + 1 + } + + return stmts, nil +} + +// https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#comments +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ + Dash: true, // -- comment + SlashStar: true, // /* comment */ + Hash: true, // # comment + } +} diff --git a/internal/engine/googlesql/reserved.go b/internal/engine/googlesql/reserved.go new file mode 100644 index 0000000000..14db13087c --- /dev/null +++ b/internal/engine/googlesql/reserved.go @@ -0,0 +1,11 @@ +package googlesql + +import ( + "github.com/sqlc-dev/zetajones/token" +) + +// IsReservedKeyword reports whether s is a reserved keyword in GoogleSQL; see +// https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#reserved_keywords +func (p *Parser) IsReservedKeyword(s string) bool { + return token.IsReservedKeyword(s) +} diff --git a/internal/engine/googlesql/seed.go b/internal/engine/googlesql/seed.go new file mode 100644 index 0000000000..11c85dd076 --- /dev/null +++ b/internal/engine/googlesql/seed.go @@ -0,0 +1,16 @@ +package googlesql + +import ( + "embed" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/seed" +) + +//go:embed dialect +var dialectFS embed.FS + +// Dialect returns the catalog option that seeds GoogleSQL's type system. +func Dialect() core.Option { + return seed.Dialect(dialectFS, "dialect") +} diff --git a/internal/engine/googlesql/stdlib.go b/internal/engine/googlesql/stdlib.go new file mode 100644 index 0000000000..e43d9c02c6 --- /dev/null +++ b/internal/engine/googlesql/stdlib.go @@ -0,0 +1,9 @@ +package googlesql + +import ( + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +func defaultSchema(name string) *catalog.Schema { + return &catalog.Schema{Name: name} +} diff --git a/internal/engine/googlesql/utils.go b/internal/engine/googlesql/utils.go new file mode 100644 index 0000000000..0ee4c585d2 --- /dev/null +++ b/internal/engine/googlesql/utils.go @@ -0,0 +1,298 @@ +package googlesql + +import ( + "log" + "strings" + + zjast "github.com/sqlc-dev/zetajones/ast" + + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func todo(n zjast.Node) *ast.TODO { + if debug.Active { + log.Printf("googlesql.convert: Unknown node type %T\n", n) + } + return &ast.TODO{} +} + +// identifier passes table and column identifiers through unchanged. GoogleSQL +// keywords are case-insensitive, but table names (on BigQuery) are +// case-sensitive, so unlike the MySQL and ClickHouse engines we do not +// lowercase identifiers here. Function and type names, which are +// case-insensitive, are lowercased at their call sites instead. +func identifier(id string) string { + return id +} + +func NewIdentifier(t string) *ast.String { + return &ast.String{Str: identifier(t)} +} + +// pathParts returns the identifier names of a dotted path expression. +func pathParts(n *zjast.PathExpression) []string { + if n == nil { + return nil + } + parts := make([]string, 0, len(n.Names)) + for _, id := range n.Names { + if id == nil { + continue + } + parts = append(parts, id.Name) + } + return parts +} + +func parseTableName(n *zjast.PathExpression) *ast.TableName { + name := &ast.TableName{} + parts := pathParts(n) + switch len(parts) { + case 0: + case 1: + name.Name = identifier(parts[0]) + case 2: + name.Schema = identifier(parts[0]) + name.Name = identifier(parts[1]) + default: + name.Catalog = identifier(parts[0]) + name.Schema = identifier(parts[len(parts)-2]) + name.Name = identifier(parts[len(parts)-1]) + } + return name +} + +func parseRangeVar(n *zjast.PathExpression) *ast.RangeVar { + tn := parseTableName(n) + rv := &ast.RangeVar{} + if n != nil { + rv.Location = n.Pos() + } + if tn.Catalog != "" { + catalog := tn.Catalog + rv.Catalogname = &catalog + } + if tn.Schema != "" { + schema := tn.Schema + rv.Schemaname = &schema + } + if tn.Name != "" { + relname := tn.Name + rv.Relname = &relname + } + return rv +} + +func convertAlias(a *zjast.Alias) *ast.Alias { + if a == nil || a.Identifier == nil { + return nil + } + name := identifier(a.Identifier.Name) + return &ast.Alias{Aliasname: &name} +} + +// whereExpr unwraps a WHERE clause node to its expression. The DELETE and +// UPDATE statement nodes hold either a *WhereClause or a bare expression. +func whereExpr(node zjast.Node) zjast.Node { + if wc, ok := node.(*zjast.WhereClause); ok { + return wc.Expr + } + return node +} + +// stringLiteralValue concatenates and unquotes the components of a string +// literal. +func stringLiteralValue(n *zjast.StringLiteral) string { + var sb strings.Builder + for _, comp := range n.Components { + if comp == nil { + continue + } + sb.WriteString(unquote(comp.Image)) + } + return sb.String() +} + +// unquote strips the optional r/b prefix and the surrounding quotes from a +// string literal component and decodes escape sequences for non-raw strings. +// It is best-effort: malformed input is returned unchanged. +func unquote(image string) string { + raw := false + i := 0 +prefix: + for i < len(image) { + switch image[i] { + case 'r', 'R': + raw = true + i++ + case 'b', 'B': + i++ + default: + break prefix + } + } + s := image[i:] + for _, q := range []string{`'''`, `"""`, `'`, `"`} { + if len(s) >= 2*len(q) && strings.HasPrefix(s, q) && strings.HasSuffix(s, q) { + s = s[len(q) : len(s)-len(q)] + if raw || !strings.ContainsRune(s, '\\') { + return s + } + return decodeEscapes(s) + } + } + return image +} + +func decodeEscapes(s string) string { + var sb strings.Builder + for i := 0; i < len(s); i++ { + ch := s[i] + if ch != '\\' || i+1 >= len(s) { + sb.WriteByte(ch) + continue + } + i++ + switch s[i] { + case 'n': + sb.WriteByte('\n') + case 't': + sb.WriteByte('\t') + case 'r': + sb.WriteByte('\r') + case 'a': + sb.WriteByte('\a') + case 'b': + sb.WriteByte('\b') + case 'f': + sb.WriteByte('\f') + case 'v': + sb.WriteByte('\v') + case '\\', '\'', '"', '?', '`': + sb.WriteByte(s[i]) + default: + // Unknown escape (\x, \u, ...): keep it verbatim. + sb.WriteByte('\\') + sb.WriteByte(s[i]) + } + } + return sb.String() +} + +// typeName renders a zetajones type node (used by CAST) as a lowercased type +// name. Nested types degrade to a readable representation. +// typeName spells a type the way the analysis core reads one: a family +// applied to its arguments, with an array's element, a struct's labelled +// fields, a range's subtype and a map's key and value nested, and a +// parameter list's integers and MAX written as they were. +func typeName(node zjast.Node) string { + switch t := node.(type) { + case *zjast.SimpleType: + return strings.ToLower(strings.Join(pathParts(t.Name), ".")) + typeParameters(t.TypeParameters) + case *zjast.ArrayType: + return "array(" + typeName(t.ElementType) + ")" + case *zjast.StructType: + fields := make([]string, 0, len(t.Fields)) + for _, f := range t.Fields { + field := typeName(f.Type) + if f.Name != nil { + field = identifier(f.Name.Name) + ": " + field + } + fields = append(fields, field) + } + return "struct(" + strings.Join(fields, ", ") + ")" + case *zjast.RangeType: + return "range(" + typeName(t.ElementType) + ")" + case *zjast.MapType: + return "map(" + typeName(t.KeyType) + ", " + typeName(t.ValueType) + ")" + default: + return "" + } +} + +// typeParameters spells a parameter list, STRING(10) or BYTES(MAX), as the +// arguments of a call. +func typeParameters(params *zjast.TypeParameterList) string { + if params == nil || len(params.Parameters) == 0 { + return "" + } + parts := make([]string, 0, len(params.Parameters)) + for _, p := range params.Parameters { + switch v := p.(type) { + case *zjast.IntLiteral: + parts = append(parts, v.Image) + case *zjast.MaxLiteral: + parts = append(parts, "max") + default: + continue + } + } + if len(parts) == 0 { + return "" + } + return "(" + strings.Join(parts, ", ") + ")" +} + +// columnSchemaTypeName renders a CREATE TABLE column schema as a lowercased +// type name. Nested types degrade to a readable representation. +// columnSchemaTypeName spells a column's type the way typeName spells a +// type. +func columnSchemaTypeName(node zjast.Node) string { + switch t := node.(type) { + case *zjast.SimpleColumnSchema: + return strings.ToLower(strings.Join(pathParts(t.Type), ".")) + typeParameters(t.TypeParameters) + case *zjast.ArrayColumnSchema: + return "array(" + columnSchemaTypeName(t.ElementSchema) + ")" + case *zjast.StructColumnSchema: + fields := make([]string, 0, len(t.Fields)) + for _, f := range t.Fields { + field := columnSchemaTypeName(f.Schema) + if f.Name != nil { + field = identifier(f.Name.Name) + ": " + field + } + fields = append(fields, field) + } + return "struct(" + strings.Join(fields, ", ") + ")" + default: + return "" + } +} + +// columnAttributes returns the attribute list (NOT NULL, PRIMARY KEY, ...) of +// a column schema, if any. +func columnAttributes(node zjast.Node) *zjast.ColumnAttributeList { + switch t := node.(type) { + case *zjast.SimpleColumnSchema: + return t.Attributes + case *zjast.ArrayColumnSchema: + return t.Attributes + case *zjast.StructColumnSchema: + return t.Attributes + default: + return nil + } +} + +// columnRefFields flattens an identifier, path expression, or dotted +// identifier chain into ColumnRef fields. +func columnRefFields(node zjast.Node) ([]ast.Node, bool) { + switch n := node.(type) { + case *zjast.Identifier: + return []ast.Node{NewIdentifier(n.Name)}, true + case *zjast.PathExpression: + var fields []ast.Node + for _, part := range pathParts(n) { + fields = append(fields, NewIdentifier(part)) + } + return fields, len(fields) > 0 + case *zjast.DotIdentifier: + base, ok := columnRefFields(n.Expr) + if !ok || n.Name == nil { + return nil, false + } + return append(base, NewIdentifier(n.Name.Name)), true + default: + return nil, false + } +} diff --git a/internal/engine/mssql/convert.go b/internal/engine/mssql/convert.go new file mode 100644 index 0000000000..bdef335bc6 --- /dev/null +++ b/internal/engine/mssql/convert.go @@ -0,0 +1,1210 @@ +package mssql + +import ( + "strconv" + "strings" + + tsql "github.com/sqlc-dev/teesql/ast" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +type cc struct { + paramCount int + // namedParams tracks the parameter each "@name" was given, by its + // lowercased name, so repeated uses share a single parameter. + namedParams map[string]namedParam + // toByte maps a teesql UTF-16 code-unit offset to a byte offset in the + // source, so Location fields agree with StmtLocation/StmtLen. + toByte func(int) int +} + +// loc returns a node's start offset in bytes, for the Location fields of the +// sqlc AST. +func (c *cc) loc(n any) int { + f, ok := n.(fragmented) + if !ok { + return 0 + } + off := f.Frag().StartOffset + if c.toByte != nil { + return c.toByte(off) + } + return off +} + +func (c *cc) parseRangeVar(n *tsql.SchemaObjectName) *ast.RangeVar { + name := parseTableName(n) + rv := &ast.RangeVar{ + Relname: &name.Name, + Location: c.loc(n), + } + if name.Schema != "" { + rv.Schemaname = &name.Schema + } + return rv +} + +func (c *cc) convert(node tsql.Node) ast.Node { + switch n := node.(type) { + case *tsql.SelectStatement: + return c.convertSelectStatement(n) + case *tsql.InsertStatement: + return c.convertInsertStatement(n) + case *tsql.UpdateStatement: + return c.convertUpdateStatement(n) + case *tsql.DeleteStatement: + return c.convertDeleteStatement(n) + case *tsql.CreateTableStatement: + return c.convertCreateTableStatement(n) + case *tsql.DropTableStatement: + return c.convertDropTableStatement(n) + case *tsql.AlterTableAddTableElementStatement: + return c.convertAlterTableAddTableElementStatement(n) + case *tsql.AlterTableDropTableElementStatement: + return c.convertAlterTableDropTableElementStatement(n) + case *tsql.CreateTypeUddtStatement: + return c.convertCreateTypeUddtStatement(n) + default: + return todo(n) + } +} + +// convertCreateTypeUddtStatement reports CREATE TYPE name FROM base [NOT +// NULL] as the domain it is: a type standing on its base that may forbid +// NULL. +func (c *cc) convertCreateTypeUddtStatement(n *tsql.CreateTypeUddtStatement) ast.Node { + if n.Name == nil || n.Name.BaseIdentifier == nil || n.DataType == nil { + return todo(n) + } + stmt := &ast.CreateDomainStmt{ + Domainname: &ast.List{}, + TypeName: dataTypeName(n.DataType), + } + if n.Name.SchemaIdentifier != nil { + stmt.Domainname.Items = append(stmt.Domainname.Items, NewIdentifier(identifierValue(n.Name.SchemaIdentifier))) + } + stmt.Domainname.Items = append(stmt.Domainname.Items, NewIdentifier(identifierValue(n.Name.BaseIdentifier))) + if n.NullableConstraint != nil && !n.NullableConstraint.Nullable { + stmt.Constraints = &ast.List{Items: []ast.Node{&ast.Constraint{Contype: ast.ConstrTypeNotNull}}} + } + return stmt +} + +func (c *cc) convertSelectStatement(n *tsql.SelectStatement) ast.Node { + stmt := c.convertQueryExpression(n.QueryExpression) + sel, ok := stmt.(*ast.SelectStmt) + if !ok { + return stmt + } + if with := c.convertWithClause(n.WithCtesAndXmlNamespaces); with != nil { + sel.WithClause = with + } + return sel +} + +func (c *cc) convertWithClause(n *tsql.WithCtesAndXmlNamespaces) *ast.WithClause { + if n == nil || len(n.CommonTableExpressions) == 0 { + return nil + } + with := &ast.WithClause{ + Ctes: &ast.List{}, + Location: c.loc(n), + } + for _, cte := range n.CommonTableExpressions { + name := identifierValue(cte.ExpressionName) + item := &ast.CommonTableExpr{ + Ctename: &name, + Ctequery: c.convertQueryExpression(cte.QueryExpression), + Location: c.loc(cte), + } + if len(cte.Columns) > 0 { + item.Aliascolnames = &ast.List{} + for _, col := range cte.Columns { + item.Aliascolnames.Items = append(item.Aliascolnames.Items, NewIdentifier(col.Value)) + } + } + with.Ctes.Items = append(with.Ctes.Items, item) + } + return with +} + +func (c *cc) convertQueryExpression(q tsql.QueryExpression) ast.Node { + switch n := q.(type) { + case *tsql.QuerySpecification: + return c.convertQuerySpecification(n) + case *tsql.BinaryQueryExpression: + return c.convertBinaryQueryExpression(n) + case *tsql.QueryParenthesisExpression: + return c.convertQueryExpression(n.QueryExpression) + default: + return todo(q) + } +} + +func (c *cc) convertBinaryQueryExpression(n *tsql.BinaryQueryExpression) ast.Node { + var op ast.SetOperation + switch n.BinaryQueryExpressionType { + case "Union": + op = ast.Union + case "Except": + op = ast.Except + case "Intersect": + op = ast.Intersect + default: + return todo(n) + } + larg, ok := c.convertQueryExpression(n.FirstQueryExpression).(*ast.SelectStmt) + if !ok { + return todo(n) + } + rarg, ok := c.convertQueryExpression(n.SecondQueryExpression).(*ast.SelectStmt) + if !ok { + return todo(n) + } + stmt := &ast.SelectStmt{ + Op: op, + All: n.All, + Larg: larg, + Rarg: rarg, + } + if n.OrderByClause != nil { + stmt.SortClause = c.convertOrderByClause(n.OrderByClause) + } + return stmt +} + +func (c *cc) convertQuerySpecification(n *tsql.QuerySpecification) *ast.SelectStmt { + stmt := &ast.SelectStmt{} + + if len(n.SelectElements) > 0 { + stmt.TargetList = &ast.List{} + for _, elem := range n.SelectElements { + if target := c.convertSelectElement(elem); target != nil { + stmt.TargetList.Items = append(stmt.TargetList.Items, target) + } + } + } + + if n.FromClause != nil { + stmt.FromClause = &ast.List{} + for _, ref := range n.FromClause.TableReferences { + stmt.FromClause.Items = append(stmt.FromClause.Items, c.convertTableReference(ref)) + } + } + + if n.WhereClause != nil { + stmt.WhereClause = c.convertBooleanExpression(n.WhereClause.SearchCondition) + } + + if n.GroupByClause != nil { + stmt.GroupClause = &ast.List{} + for _, spec := range n.GroupByClause.GroupingSpecifications { + if g, ok := spec.(*tsql.ExpressionGroupingSpecification); ok { + stmt.GroupClause.Items = append(stmt.GroupClause.Items, c.convertScalarExpression(g.Expression)) + } + } + } + + if n.HavingClause != nil { + stmt.HavingClause = c.convertBooleanExpression(n.HavingClause.SearchCondition) + } + + if n.OrderByClause != nil { + stmt.SortClause = c.convertOrderByClause(n.OrderByClause) + } + + // OFFSET n ROWS FETCH NEXT m ROWS ONLY + if n.OffsetClause != nil { + if n.OffsetClause.OffsetExpression != nil { + stmt.LimitOffset = c.convertScalarExpression(n.OffsetClause.OffsetExpression) + } + if n.OffsetClause.FetchExpression != nil { + stmt.LimitCount = c.convertScalarExpression(n.OffsetClause.FetchExpression) + } + } + + // TOP n; TOP n PERCENT does not translate to a row count. + if n.TopRowFilter != nil && !n.TopRowFilter.Percent { + stmt.LimitCount = c.convertScalarExpression(n.TopRowFilter.Expression) + } + + if n.UniqueRowFilter == "Distinct" { + stmt.DistinctClause = &ast.List{} + } + + return stmt +} + +func (c *cc) convertSelectElement(elem tsql.SelectElement) ast.Node { + switch e := elem.(type) { + case *tsql.SelectScalarExpression: + res := &ast.ResTarget{ + Val: c.convertScalarExpression(e.Expression), + Location: c.loc(e), + } + if name := columnAlias(e.ColumnName); name != "" { + res.Name = &name + } + return res + case *tsql.SelectStarExpression: + fields := &ast.List{} + if e.Qualifier != nil { + for _, id := range e.Qualifier.Identifiers { + fields.Items = append(fields.Items, NewIdentifier(id.Value)) + } + } + fields.Items = append(fields.Items, &ast.A_Star{}) + return &ast.ResTarget{ + Val: &ast.ColumnRef{ + Fields: fields, + Location: c.loc(e), + }, + Location: c.loc(e), + } + default: + return &ast.ResTarget{ + Val: todo(elem), + Location: c.loc(elem), + } + } +} + +func columnAlias(n *tsql.IdentifierOrValueExpression) string { + if n == nil { + return "" + } + if n.Identifier != nil { + return identifierValue(n.Identifier) + } + if n.Value != "" { + return identifier(n.Value) + } + return "" +} + +func (c *cc) convertOrderByClause(n *tsql.OrderByClause) *ast.List { + list := &ast.List{} + for _, elem := range n.OrderByElements { + sortBy := &ast.SortBy{ + Node: c.convertScalarExpression(elem.Expression), + Location: c.loc(elem), + } + switch elem.SortOrder { + case "Descending": + sortBy.SortbyDir = ast.SortByDirDesc + case "Ascending": + sortBy.SortbyDir = ast.SortByDirAsc + default: + sortBy.SortbyDir = ast.SortByDirDefault + } + list.Items = append(list.Items, sortBy) + } + return list +} + +func (c *cc) convertTableReference(ref tsql.TableReference) ast.Node { + switch t := ref.(type) { + case *tsql.NamedTableReference: + rv := c.parseRangeVar(t.SchemaObject) + if t.Alias != nil { + alias := identifierValue(t.Alias) + rv.Alias = &ast.Alias{Aliasname: &alias} + } + return rv + case *tsql.QueryDerivedTable: + sub := &ast.RangeSubselect{ + Subquery: c.convertQueryExpression(t.QueryExpression), + } + if t.Alias != nil { + alias := identifierValue(t.Alias) + sub.Alias = &ast.Alias{Aliasname: &alias} + } + return sub + case *tsql.QualifiedJoin: + join := &ast.JoinExpr{ + Larg: c.convertTableReference(t.FirstTableReference), + Rarg: c.convertTableReference(t.SecondTableReference), + } + switch t.QualifiedJoinType { + case "LeftOuter": + join.Jointype = ast.JoinTypeLeft + case "RightOuter": + join.Jointype = ast.JoinTypeRight + case "FullOuter": + join.Jointype = ast.JoinTypeFull + default: + join.Jointype = ast.JoinTypeInner + } + if t.SearchCondition != nil { + join.Quals = c.convertBooleanExpression(t.SearchCondition) + } + return join + case *tsql.UnqualifiedJoin: + if t.UnqualifiedJoinType != "CrossJoin" { + return todo(ref) + } + return &ast.JoinExpr{ + Jointype: ast.JoinTypeInner, + Larg: c.convertTableReference(t.FirstTableReference), + Rarg: c.convertTableReference(t.SecondTableReference), + } + default: + return todo(ref) + } +} + +func (c *cc) convertBooleanExpression(expr tsql.BooleanExpression) ast.Node { + if expr == nil { + return nil + } + switch e := expr.(type) { + case *tsql.BooleanComparisonExpression: + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: comparisonOperator(e.ComparisonType)}}, + }, + Lexpr: c.convertScalarExpression(e.FirstExpression), + Rexpr: c.convertScalarExpression(e.SecondExpression), + Location: c.loc(e), + } + case *tsql.BooleanBinaryExpression: + boolop := ast.BoolExprTypeAnd + if e.BinaryExpressionType == "Or" { + boolop = ast.BoolExprTypeOr + } + return &ast.BoolExpr{ + Boolop: boolop, + Args: &ast.List{ + Items: []ast.Node{ + c.convertBooleanExpression(e.FirstExpression), + c.convertBooleanExpression(e.SecondExpression), + }, + }, + Location: c.loc(e), + } + case *tsql.BooleanNotExpression: + return &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{ + Items: []ast.Node{c.convertBooleanExpression(e.Expression)}, + }, + Location: c.loc(e), + } + case *tsql.BooleanParenthesisExpression: + return c.convertBooleanExpression(e.Expression) + case *tsql.BooleanIsNullExpression: + test := ast.NullTestTypeIsNull + if e.IsNot { + test = ast.NullTestTypeIsNotNull + } + return &ast.NullTest{ + Arg: c.convertScalarExpression(e.Expression), + Nulltesttype: test, + Location: c.loc(e), + } + case *tsql.BooleanTernaryExpression: + return &ast.BetweenExpr{ + Expr: c.convertScalarExpression(e.FirstExpression), + Left: c.convertScalarExpression(e.SecondExpression), + Right: c.convertScalarExpression(e.ThirdExpression), + Not: e.TernaryExpressionType == "NotBetween", + Location: c.loc(e), + } + case *tsql.BooleanInExpression: + in := &ast.In{ + Expr: c.convertScalarExpression(e.Expression), + Not: e.NotDefined, + Location: c.loc(e), + } + for _, item := range e.Values { + in.List = append(in.List, c.convertScalarExpression(item)) + } + if e.Subquery != nil { + in.Sel = c.convertQueryExpression(e.Subquery) + } + return in + case *tsql.BooleanLikeExpression: + op := "~~" + if e.NotDefined { + op = "!~~" + } + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: op}}, + }, + Lexpr: c.convertScalarExpression(e.FirstExpression), + Rexpr: c.convertScalarExpression(e.SecondExpression), + Location: c.loc(e), + } + case *tsql.ExistsPredicate: + return &ast.SubLink{ + SubLinkType: ast.EXISTS_SUBLINK, + Subselect: c.convertQueryExpression(e.Subquery), + Location: c.loc(e), + } + case *tsql.BooleanScalarPlaceholder: + return c.convertScalarExpression(e.Scalar) + default: + return todo(expr) + } +} + +func comparisonOperator(comparisonType string) string { + switch comparisonType { + case "Equals": + return "=" + case "NotEqualToBrackets", "NotEqualToExclamation": + return "<>" + case "GreaterThan": + return ">" + case "LessThan": + return "<" + case "GreaterThanOrEqualTo", "NotLessThan": + return ">=" + case "LessThanOrEqualTo", "NotGreaterThan": + return "<=" + default: + return "=" + } +} + +func (c *cc) convertScalarExpression(expr tsql.ScalarExpression) ast.Node { + if expr == nil { + return nil + } + switch e := expr.(type) { + case *tsql.ColumnReferenceExpression: + return c.convertColumnReference(e) + case *tsql.VariableReference: + return c.convertVariableReference(e) + case *tsql.IntegerLiteral: + ival, _ := strconv.ParseInt(e.Value, 10, 64) + return &ast.A_Const{ + Val: &ast.Integer{Ival: ival}, + Location: c.loc(e), + } + case *tsql.NumericLiteral: + return &ast.A_Const{ + Val: &ast.Float{Str: e.Value}, + Location: c.loc(e), + } + case *tsql.RealLiteral: + return &ast.A_Const{ + Val: &ast.Float{Str: e.Value}, + Location: c.loc(e), + } + case *tsql.MoneyLiteral: + return &ast.A_Const{ + Val: &ast.Float{Str: e.Value}, + Location: c.loc(e), + } + case *tsql.StringLiteral: + return &ast.A_Const{ + Val: &ast.String{Str: e.Value}, + Location: c.loc(e), + } + case *tsql.NullLiteral: + return &ast.A_Const{ + Val: &ast.Null{}, + Location: c.loc(e), + } + case *tsql.BinaryExpression: + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: binaryOperator(e.BinaryExpressionType)}}, + }, + Lexpr: c.convertScalarExpression(e.FirstExpression), + Rexpr: c.convertScalarExpression(e.SecondExpression), + Location: c.loc(e), + } + case *tsql.UnaryExpression: + switch e.UnaryExpressionType { + case "Positive": + return c.convertScalarExpression(e.Expression) + case "BitwiseNot": + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: "~"}}, + }, + Rexpr: c.convertScalarExpression(e.Expression), + Location: c.loc(e), + } + default: // Negative + return &ast.A_Expr{ + Kind: ast.A_Expr_Kind_OP, + Name: &ast.List{ + Items: []ast.Node{&ast.String{Str: "-"}}, + }, + Rexpr: c.convertScalarExpression(e.Expression), + Location: c.loc(e), + } + } + case *tsql.ParenthesisExpression: + return c.convertScalarExpression(e.Expression) + case *tsql.FunctionCall: + return c.convertFunctionCall(e) + case *tsql.CastCall: + return &ast.TypeCast{ + Arg: c.convertScalarExpression(e.Parameter), + TypeName: dataTypeName(e.DataType), + Location: c.loc(e), + } + case *tsql.TryCastCall: + return &ast.TypeCast{ + Arg: c.convertScalarExpression(e.Parameter), + TypeName: dataTypeName(e.DataType), + Location: c.loc(e), + } + case *tsql.ConvertCall: + return &ast.TypeCast{ + Arg: c.convertScalarExpression(e.Parameter), + TypeName: dataTypeName(e.DataType), + Location: c.loc(e), + } + case *tsql.TryConvertCall: + return &ast.TypeCast{ + Arg: c.convertScalarExpression(e.Parameter), + TypeName: dataTypeName(e.DataType), + Location: c.loc(e), + } + case *tsql.CoalesceExpression: + coalesce := &ast.CoalesceExpr{ + Args: &ast.List{}, + Location: c.loc(e), + } + for _, arg := range e.Expressions { + coalesce.Args.Items = append(coalesce.Args.Items, c.convertScalarExpression(arg)) + } + return coalesce + case *tsql.NullIfExpression: + return &ast.FuncCall{ + Funcname: &ast.List{ + Items: []ast.Node{&ast.String{Str: "nullif"}}, + }, + Args: &ast.List{ + Items: []ast.Node{ + c.convertScalarExpression(e.FirstExpression), + c.convertScalarExpression(e.SecondExpression), + }, + }, + Location: c.loc(e), + } + case *tsql.IIfCall: + return &ast.CaseExpr{ + Args: &ast.List{ + Items: []ast.Node{ + &ast.CaseWhen{ + Expr: c.convertBooleanExpression(e.Predicate), + Result: c.convertScalarExpression(e.ThenExpression), + }, + }, + }, + Defresult: c.convertScalarExpression(e.ElseExpression), + Location: c.loc(e), + } + case *tsql.SearchedCaseExpression: + caseExpr := &ast.CaseExpr{ + Args: &ast.List{}, + Location: c.loc(e), + } + for _, when := range e.WhenClauses { + caseExpr.Args.Items = append(caseExpr.Args.Items, &ast.CaseWhen{ + Expr: c.convertBooleanExpression(when.WhenExpression), + Result: c.convertScalarExpression(when.ThenExpression), + }) + } + if e.ElseExpression != nil { + caseExpr.Defresult = c.convertScalarExpression(e.ElseExpression) + } + return caseExpr + case *tsql.SimpleCaseExpression: + caseExpr := &ast.CaseExpr{ + Arg: c.convertScalarExpression(e.InputExpression), + Args: &ast.List{}, + Location: c.loc(e), + } + for _, when := range e.WhenClauses { + caseExpr.Args.Items = append(caseExpr.Args.Items, &ast.CaseWhen{ + Expr: c.convertScalarExpression(when.WhenExpression), + Result: c.convertScalarExpression(when.ThenExpression), + }) + } + if e.ElseExpression != nil { + caseExpr.Defresult = c.convertScalarExpression(e.ElseExpression) + } + return caseExpr + case *tsql.ScalarSubquery: + return &ast.SubLink{ + SubLinkType: ast.EXPR_SUBLINK, + Subselect: c.convertQueryExpression(e.QueryExpression), + Location: c.loc(e), + } + case *tsql.ParameterlessCall: + return &ast.FuncCall{ + Funcname: &ast.List{ + Items: []ast.Node{&ast.String{Str: identifier(e.ParameterlessCallType)}}, + }, + Location: c.loc(e), + } + default: + return todo(expr) + } +} + +func binaryOperator(binaryExpressionType string) string { + switch binaryExpressionType { + case "Add": + return "+" + case "Subtract": + return "-" + case "Multiply": + return "*" + case "Divide": + return "/" + case "Modulo": + return "%" + case "BitwiseAnd": + return "&" + case "BitwiseOr": + return "|" + case "BitwiseXor": + return "^" + default: + return "+" + } +} + +func (c *cc) convertColumnReference(n *tsql.ColumnReferenceExpression) *ast.ColumnRef { + fields := &ast.List{} + if n.MultiPartIdentifier != nil { + for _, id := range n.MultiPartIdentifier.Identifiers { + fields.Items = append(fields.Items, NewIdentifier(id.Value)) + } + } + if n.ColumnType == "Wildcard" { + fields.Items = append(fields.Items, &ast.A_Star{}) + } + return &ast.ColumnRef{ + Fields: fields, + Location: c.loc(n), + } +} + +// convertVariableReference converts an "@name" query parameter. Repeated uses +// of a name share a single parameter number. SQL Server compares variable +// names without regard to case, so @Name and @name are one parameter, bound +// by the spelling of its first use. +func (c *cc) convertVariableReference(n *tsql.VariableReference) ast.Node { + name := strings.TrimPrefix(n.Name, "@") + key := strings.ToLower(name) + param, ok := c.namedParams[key] + if !ok { + c.paramCount++ + param = namedParam{number: c.paramCount, name: name} + if c.namedParams == nil { + c.namedParams = map[string]namedParam{} + } + c.namedParams[key] = param + } + return &ast.ParamRef{ + Number: param.number, + Name: param.name, + Location: c.loc(n), + } +} + +// namedParam is the number an @name parameter was given and the spelling +// of the name at its first use. +type namedParam struct { + number int + name string +} + +func (c *cc) convertFunctionCall(n *tsql.FunctionCall) *ast.FuncCall { + fc := &ast.FuncCall{ + Funcname: &ast.List{ + Items: []ast.Node{&ast.String{Str: identifierValue(n.FunctionName)}}, + }, + Location: c.loc(n), + AggDistinct: n.UniqueRowFilter == "Distinct", + } + + for _, param := range n.Parameters { + // COUNT(*) and friends carry the star as a wildcard column reference. + if col, ok := param.(*tsql.ColumnReferenceExpression); ok && col.ColumnType == "Wildcard" && col.MultiPartIdentifier == nil { + fc.AggStar = true + continue + } + if fc.Args == nil { + fc.Args = &ast.List{} + } + fc.Args.Items = append(fc.Args.Items, c.convertScalarExpression(param)) + } + + if n.OverClause != nil { + fc.Over = &ast.WindowDef{Location: c.loc(n.OverClause)} + if len(n.OverClause.Partitions) > 0 { + fc.Over.PartitionClause = &ast.List{} + for _, p := range n.OverClause.Partitions { + fc.Over.PartitionClause.Items = append(fc.Over.PartitionClause.Items, c.convertScalarExpression(p)) + } + } + if n.OverClause.OrderByClause != nil { + fc.Over.OrderClause = c.convertOrderByClause(n.OverClause.OrderByClause) + } + } + + return fc +} + +// convertOutputClause converts an OUTPUT clause to a returning list. The +// INSERTED and DELETED pseudo-table qualifiers are stripped so the columns +// resolve against the statement's target table. +func (c *cc) convertOutputClause(n *tsql.OutputClause) *ast.List { + if n == nil || len(n.SelectColumns) == 0 { + return nil + } + list := &ast.List{} + for _, elem := range n.SelectColumns { + target := c.convertSelectElement(elem) + if res, ok := target.(*ast.ResTarget); ok { + stripOutputQualifier(res.Val) + } + list.Items = append(list.Items, target) + } + return list +} + +func stripOutputQualifier(node ast.Node) { + ref, ok := node.(*ast.ColumnRef) + if !ok || ref.Fields == nil || len(ref.Fields.Items) < 2 { + return + } + if first, ok := ref.Fields.Items[0].(*ast.String); ok { + switch first.Str { + case "inserted", "deleted": + ref.Fields.Items = ref.Fields.Items[1:] + } + } +} + +func (c *cc) convertInsertStatement(n *tsql.InsertStatement) ast.Node { + if n.InsertSpecification == nil { + return todo(n) + } + spec := n.InsertSpecification + + target, ok := spec.Target.(*tsql.NamedTableReference) + if !ok { + return todo(n) + } + + stmt := &ast.InsertStmt{ + Relation: c.parseRangeVar(target.SchemaObject), + } + + if len(spec.Columns) > 0 { + stmt.Cols = &ast.List{} + for _, col := range spec.Columns { + if col.MultiPartIdentifier == nil || len(col.MultiPartIdentifier.Identifiers) == 0 { + continue + } + ids := col.MultiPartIdentifier.Identifiers + name := identifierValue(ids[len(ids)-1]) + stmt.Cols.Items = append(stmt.Cols.Items, &ast.ResTarget{ + Name: &name, + Location: c.loc(col), + }) + } + } + + switch src := spec.InsertSource.(type) { + case *tsql.ValuesInsertSource: + if !src.IsDefaultValues { + sel := &ast.SelectStmt{ + ValuesLists: &ast.List{}, + } + for _, row := range src.RowValues { + rowList := &ast.List{} + for _, val := range row.ColumnValues { + rowList.Items = append(rowList.Items, c.convertScalarExpression(val)) + } + sel.ValuesLists.Items = append(sel.ValuesLists.Items, rowList) + } + stmt.SelectStmt = sel + } + case *tsql.SelectInsertSource: + stmt.SelectStmt = c.convertQueryExpression(src.Select) + } + + if returning := c.convertOutputClause(spec.OutputClause); returning != nil { + stmt.ReturningList = returning + } + + return stmt +} + +func (c *cc) convertUpdateStatement(n *tsql.UpdateStatement) ast.Node { + if n.UpdateSpecification == nil { + return todo(n) + } + spec := n.UpdateSpecification + + target, ok := spec.Target.(*tsql.NamedTableReference) + if !ok { + return todo(n) + } + + rv, fromItems, quals := c.dmlTargetAndFrom(target, spec.FromClause) + stmt := &ast.UpdateStmt{ + Relations: &ast.List{ + Items: []ast.Node{rv}, + }, + TargetList: &ast.List{}, + FromClause: &ast.List{Items: fromItems}, + ReturningList: &ast.List{}, + WithClause: c.convertWithClause(n.WithCtesAndXmlNamespaces), + } + + for _, sc := range spec.SetClauses { + assign, ok := sc.(*tsql.AssignmentSetClause) + if !ok || assign.Column == nil { + continue + } + ids := assign.Column.MultiPartIdentifier + if ids == nil || len(ids.Identifiers) == 0 { + continue + } + name := identifierValue(ids.Identifiers[len(ids.Identifiers)-1]) + stmt.TargetList.Items = append(stmt.TargetList.Items, &ast.ResTarget{ + Name: &name, + Val: c.convertScalarExpression(assign.NewValue), + Location: c.loc(assign), + }) + } + + if spec.WhereClause != nil { + stmt.WhereClause = c.convertBooleanExpression(spec.WhereClause.SearchCondition) + } + stmt.WhereClause = andQuals(stmt.WhereClause, quals) + + if returning := c.convertOutputClause(spec.OutputClause); returning != nil { + stmt.ReturningList = returning + } + + return stmt +} + +func (c *cc) convertDeleteStatement(n *tsql.DeleteStatement) ast.Node { + if n.DeleteSpecification == nil { + return todo(n) + } + spec := n.DeleteSpecification + + target, ok := spec.Target.(*tsql.NamedTableReference) + if !ok { + return todo(n) + } + + rv, fromItems, quals := c.dmlTargetAndFrom(target, spec.FromClause) + stmt := &ast.DeleteStmt{ + Relations: &ast.List{ + Items: []ast.Node{rv}, + }, + ReturningList: &ast.List{}, + WithClause: c.convertWithClause(n.WithCtesAndXmlNamespaces), + } + if len(fromItems) > 0 { + stmt.FromClause = &ast.List{Items: fromItems} + } + + if spec.WhereClause != nil { + stmt.WhereClause = c.convertBooleanExpression(spec.WhereClause.SearchCondition) + } + stmt.WhereClause = andQuals(stmt.WhereClause, quals) + + if returning := c.convertOutputClause(spec.OutputClause); returning != nil { + stmt.ReturningList = returning + } + + return stmt +} + +// dmlTargetAndFrom resolves an UPDATE or DELETE statement's target against +// its FROM clause. T-SQL names the target by the alias the FROM clause gives +// it — "UPDATE a SET ... FROM authors a" — so a target matching a FROM +// relation becomes that relation, removed from the returned FROM items. The +// ON conditions of inner joins dissolved by the removal are returned as +// extra WHERE conditions. +func (c *cc) dmlTargetAndFrom(target *tsql.NamedTableReference, from *tsql.FromClause) (*ast.RangeVar, []ast.Node, []ast.Node) { + rv := c.parseRangeVar(target.SchemaObject) + if target.Alias != nil { + alias := identifierValue(target.Alias) + rv.Alias = &ast.Alias{Aliasname: &alias} + } + var items []ast.Node + if from != nil { + for _, ref := range from.TableReferences { + items = append(items, c.convertTableReference(ref)) + } + } + if rv.Schemaname == nil && rv.Alias == nil && rv.Relname != nil { + for i, item := range items { + found, remaining, quals := extractTarget(item, *rv.Relname) + if found == nil { + continue + } + if remaining == nil { + items = append(items[:i], items[i+1:]...) + } else { + items[i] = remaining + } + return found, items, quals + } + } + return rv, items, nil +} + +// extractTarget removes the relation named name — by alias, or by table name +// when unaliased — from a FROM item. It returns the extracted relation, what +// remains of the item (nil when the relation was the whole item), and the ON +// conditions of any inner join dissolved by the removal. Relations under an +// outer join are left alone: pulling one out would change the join's meaning. +func extractTarget(item ast.Node, name string) (*ast.RangeVar, ast.Node, []ast.Node) { + switch v := item.(type) { + case *ast.RangeVar: + if rangeVarNamed(v, name) { + return v, nil, nil + } + case *ast.JoinExpr: + if v.Jointype != ast.JoinTypeInner { + return nil, item, nil + } + if found, remaining, quals := extractTarget(v.Larg, name); found != nil { + if remaining == nil { + if v.Quals != nil { + quals = append(quals, v.Quals) + } + return found, v.Rarg, quals + } + v.Larg = remaining + return found, v, quals + } + if found, remaining, quals := extractTarget(v.Rarg, name); found != nil { + if remaining == nil { + if v.Quals != nil { + quals = append(quals, v.Quals) + } + return found, v.Larg, quals + } + v.Rarg = remaining + return found, v, quals + } + } + return nil, item, nil +} + +func rangeVarNamed(rv *ast.RangeVar, name string) bool { + if rv.Alias != nil && rv.Alias.Aliasname != nil { + return *rv.Alias.Aliasname == name + } + return rv.Schemaname == nil && rv.Relname != nil && *rv.Relname == name +} + +// andQuals conjoins the ON conditions of dissolved inner joins onto a WHERE +// clause; for inner joins the two forms are equivalent. +func andQuals(where ast.Node, quals []ast.Node) ast.Node { + for _, q := range quals { + if where == nil { + where = q + continue + } + where = &ast.BoolExpr{ + Boolop: ast.BoolExprTypeAnd, + Args: &ast.List{Items: []ast.Node{where, q}}, + } + } + return where +} + +func (c *cc) convertCreateTableStatement(n *tsql.CreateTableStatement) ast.Node { + if n.SchemaObjectName == nil || n.Definition == nil { + return todo(n) + } + + stmt := &ast.CreateTableStmt{ + Name: parseTableName(n.SchemaObjectName), + } + + // Column names in table-level PRIMARY KEY constraints are NOT NULL. + primaryKey := map[string]bool{} + for _, constraint := range n.Definition.TableConstraints { + unique, ok := constraint.(*tsql.UniqueConstraintDefinition) + if !ok || !unique.IsPrimaryKey { + continue + } + for _, col := range unique.Columns { + if col.Column == nil || col.Column.MultiPartIdentifier == nil { + continue + } + ids := col.Column.MultiPartIdentifier.Identifiers + if len(ids) == 0 { + continue + } + primaryKey[identifierValue(ids[len(ids)-1])] = true + } + } + + for _, col := range n.Definition.ColumnDefinitions { + stmt.Cols = append(stmt.Cols, c.convertColumnDefinition(col, primaryKey)) + } + + return stmt +} + +func (c *cc) convertColumnDefinition(n *tsql.ColumnDefinition, tablePrimaryKey map[string]bool) *ast.ColumnDef { + name := identifierValue(n.ColumnIdentifier) + colDef := &ast.ColumnDef{ + Colname: name, + TypeName: dataTypeName(n.DataType), + Location: c.loc(n), + } + + // T-SQL columns are nullable unless declared otherwise, except that a + // rowversion column is NOT NULL unless declared nullable, and sysname + // is defined as nvarchar(128) NOT NULL. + if n.Nullable != nil && !n.Nullable.Nullable { + colDef.IsNotNull = true + } + if n.Nullable == nil { + switch strings.TrimPrefix(colDef.TypeName.Name, "sys.") { + case "rowversion", "timestamp", "sysname": + colDef.IsNotNull = true + } + } + // IDENTITY columns are always NOT NULL. + if n.IdentityOptions != nil { + colDef.IsNotNull = true + } + for _, constraint := range n.Constraints { + switch cons := constraint.(type) { + case *tsql.NullableConstraintDefinition: + colDef.IsNotNull = !cons.Nullable + case *tsql.UniqueConstraintDefinition: + if cons.IsPrimaryKey { + colDef.PrimaryKey = true + colDef.IsNotNull = true + } + } + } + if tablePrimaryKey[name] { + colDef.PrimaryKey = true + colDef.IsNotNull = true + } + + return colDef +} + +// dataTypeName returns the lowercased base name of a column's declared type, +// e.g. "nvarchar" for NVARCHAR(100). Length and precision arguments do not +// name distinct types. +// dataTypeName is a type as the core reads it: its name, qualified by its +// schema for a user-defined type, with its parameters as type modifiers, +// MAX among them as the word it is. +func dataTypeName(ref tsql.DataTypeReference) *ast.TypeName { + switch t := ref.(type) { + case *tsql.SqlDataTypeReference: + out := &ast.TypeName{Name: identifier(t.SqlDataTypeOption)} + if t.Name != nil && t.Name.BaseIdentifier != nil { + out.Name = identifierValue(t.Name.BaseIdentifier) + } + for _, p := range t.Parameters { + switch v := p.(type) { + case *tsql.IntegerLiteral: + n, _ := strconv.ParseInt(v.Value, 10, 64) + out.Typmods = appendTypmod(out.Typmods, &ast.A_Const{Val: &ast.Integer{Ival: n}}) + case *tsql.MaxLiteral: + out.Typmods = appendTypmod(out.Typmods, &ast.String{Str: "max"}) + } + } + return out + case *tsql.XmlDataTypeReference: + return &ast.TypeName{Name: "xml"} + case *tsql.UserDataTypeReference: + if t.Name != nil && t.Name.BaseIdentifier != nil { + name := identifierValue(t.Name.BaseIdentifier) + if t.Name.SchemaIdentifier != nil { + name = identifierValue(t.Name.SchemaIdentifier) + "." + name + } + return &ast.TypeName{Name: name} + } + } + return &ast.TypeName{} +} + +func appendTypmod(l *ast.List, n ast.Node) *ast.List { + if l == nil { + l = &ast.List{} + } + l.Items = append(l.Items, n) + return l +} + +func (c *cc) convertDropTableStatement(n *tsql.DropTableStatement) ast.Node { + stmt := &ast.DropTableStmt{ + IfExists: n.IsIfExists, + } + for _, obj := range n.Objects { + stmt.Tables = append(stmt.Tables, parseTableName(obj)) + } + return stmt +} + +func (c *cc) convertAlterTableAddTableElementStatement(n *tsql.AlterTableAddTableElementStatement) ast.Node { + if n.SchemaObjectName == nil || n.Definition == nil { + return todo(n) + } + stmt := &ast.AlterTableStmt{ + Table: parseTableName(n.SchemaObjectName), + Cmds: &ast.List{}, + } + for _, col := range n.Definition.ColumnDefinitions { + def := c.convertColumnDefinition(col, nil) + stmt.Cmds.Items = append(stmt.Cmds.Items, &ast.AlterTableCmd{ + Name: &def.Colname, + Subtype: ast.AT_AddColumn, + Def: def, + }) + } + return stmt +} + +func (c *cc) convertAlterTableDropTableElementStatement(n *tsql.AlterTableDropTableElementStatement) ast.Node { + if n.SchemaObjectName == nil { + return todo(n) + } + stmt := &ast.AlterTableStmt{ + Table: parseTableName(n.SchemaObjectName), + Cmds: &ast.List{}, + } + for _, elem := range n.AlterTableDropTableElements { + if elem.TableElementType != "Column" || elem.Name == nil { + continue + } + name := identifierValue(elem.Name) + stmt.Cmds.Items = append(stmt.Cmds.Items, &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_DropColumn, + MissingOk: elem.IsIfExists, + }) + } + if len(stmt.Cmds.Items) == 0 { + return todo(n) + } + return stmt +} diff --git a/internal/engine/mssql/dialect/dialect.json b/internal/engine/mssql/dialect/dialect.json new file mode 100644 index 0000000000..30ea408744 --- /dev/null +++ b/internal/engine/mssql/dialect/dialect.json @@ -0,0 +1,84 @@ +{ + "dialect": "mssql", + "default_schema": "dbo", + "const": { + "integer": "int", + "float": "float", + "string": "varchar", + "bool": "bit" + }, + "bool": "bit", + "comparison": ["=", "<>", "!=", "<", "<=", ">", ">="], + "comparison_categories": "NBSD", + "arithmetic": ["+", "-", "*", "/", "%"], + "arithmetic_categories": "N", + "cast_categories": "NSD", + "idents": ["max"], + "rewrites": [ + { + "from": "sysname", + "to": "nvarchar(128)" + }, + { + "from": "float($1)", + "to": "real", + "where": "$1 <= 24" + }, + { + "from": "float($1)", + "to": "float" + }, + { + "from": "char", + "to": "char(1)" + }, + { + "from": "varchar", + "to": "varchar(1)" + }, + { + "from": "nchar", + "to": "nchar(1)" + }, + { + "from": "nvarchar", + "to": "nvarchar(1)" + }, + { + "from": "binary", + "to": "binary(1)" + }, + { + "from": "varbinary", + "to": "varbinary(1)" + }, + { + "from": "decimal", + "to": "decimal(18, 0)" + }, + { + "from": "decimal($1)", + "to": "decimal($1, 0)" + }, + { + "from": "numeric", + "to": "numeric(18, 0)" + }, + { + "from": "numeric($1)", + "to": "numeric($1, 0)" + }, + { + "from": "datetime2", + "to": "datetime2(7)" + }, + { + "from": "time", + "to": "time(7)" + }, + { + "from": "datetimeoffset", + "to": "datetimeoffset(7)" + } + ] +} diff --git a/internal/engine/mssql/dialect/functions.jsonl b/internal/engine/mssql/dialect/functions.jsonl new file mode 100644 index 0000000000..e0cd45408c --- /dev/null +++ b/internal/engine/mssql/dialect/functions.jsonl @@ -0,0 +1,76 @@ +{"name": "count", "kind": "a", "returns": "int"} +{"name": "count_big", "kind": "a", "returns": "bigint"} +{"name": "sum", "kind": "a", "args": [{"type": "bigint"}], "returns": "bigint", "nullable": true} +{"name": "sum", "kind": "a", "args": [{"type": "int"}], "returns": "int", "nullable": true} +{"name": "sum", "kind": "a", "args": [{"type": "smallint"}], "returns": "int", "nullable": true} +{"name": "sum", "kind": "a", "args": [{"type": "tinyint"}], "returns": "int", "nullable": true} +{"name": "sum", "kind": "a", "args": [{"type": "decimal"}], "returns": "decimal", "nullable": true} +{"name": "sum", "kind": "a", "args": [{"type": "money"}], "returns": "money", "nullable": true} +{"name": "sum", "kind": "a", "args": [{"type": "float"}], "returns": "float", "nullable": true} +{"name": "sum", "kind": "a", "args": [{"type": "real"}], "returns": "float", "nullable": true} +{"name": "avg", "kind": "a", "args": [{"type": "bigint"}], "returns": "bigint", "nullable": true} +{"name": "avg", "kind": "a", "args": [{"type": "int"}], "returns": "int", "nullable": true} +{"name": "avg", "kind": "a", "args": [{"type": "smallint"}], "returns": "int", "nullable": true} +{"name": "avg", "kind": "a", "args": [{"type": "tinyint"}], "returns": "int", "nullable": true} +{"name": "avg", "kind": "a", "args": [{"type": "decimal"}], "returns": "decimal", "nullable": true} +{"name": "avg", "kind": "a", "args": [{"type": "money"}], "returns": "money", "nullable": true} +{"name": "avg", "kind": "a", "args": [{"type": "float"}], "returns": "float", "nullable": true} +{"name": "avg", "kind": "a", "args": [{"type": "real"}], "returns": "float", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "bigint"}], "returns": "bigint", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "int"}], "returns": "int", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "smallint"}], "returns": "smallint", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "tinyint"}], "returns": "tinyint", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "decimal"}], "returns": "decimal", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "money"}], "returns": "money", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "float"}], "returns": "float", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "real"}], "returns": "real", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "date"}], "returns": "date", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "datetime"}], "returns": "datetime", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "datetime2"}], "returns": "datetime2", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "datetimeoffset"}], "returns": "datetimeoffset", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "time"}], "returns": "time", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "varchar"}], "returns": "varchar", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "nvarchar"}], "returns": "nvarchar", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "char"}], "returns": "char", "nullable": true} +{"name": "min", "kind": "a", "args": [{"type": "nchar"}], "returns": "nchar", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "bigint"}], "returns": "bigint", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "int"}], "returns": "int", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "smallint"}], "returns": "smallint", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "tinyint"}], "returns": "tinyint", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "decimal"}], "returns": "decimal", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "money"}], "returns": "money", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "float"}], "returns": "float", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "real"}], "returns": "real", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "date"}], "returns": "date", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "datetime"}], "returns": "datetime", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "datetime2"}], "returns": "datetime2", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "datetimeoffset"}], "returns": "datetimeoffset", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "time"}], "returns": "time", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "varchar"}], "returns": "varchar", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "nvarchar"}], "returns": "nvarchar", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "char"}], "returns": "char", "nullable": true} +{"name": "max", "kind": "a", "args": [{"type": "nchar"}], "returns": "nchar", "nullable": true} +{"name": "getdate", "returns": "datetime"} +{"name": "getutcdate", "returns": "datetime"} +{"name": "sysdatetime", "returns": "datetime2"} +{"name": "sysutcdatetime", "returns": "datetime2"} +{"name": "sysdatetimeoffset", "returns": "datetimeoffset"} +{"name": "current_timestamp", "returns": "datetime"} +{"name": "newid", "returns": "uniqueidentifier"} +{"name": "newsequentialid", "returns": "uniqueidentifier"} +{"name": "scope_identity", "returns": "decimal"} +{"name": "len", "args": [{"type": "varchar"}], "returns": "int"} +{"name": "len", "args": [{"type": "nvarchar"}], "returns": "int"} +{"name": "datalength", "args": [{"type": "varchar"}], "returns": "int"} +{"name": "datalength", "args": [{"type": "nvarchar"}], "returns": "int"} +{"name": "datalength", "args": [{"type": "varbinary"}], "returns": "int"} +{"name": "lower", "args": [{"type": "varchar"}], "returns": "varchar"} +{"name": "lower", "args": [{"type": "nvarchar"}], "returns": "nvarchar"} +{"name": "upper", "args": [{"type": "varchar"}], "returns": "varchar"} +{"name": "upper", "args": [{"type": "nvarchar"}], "returns": "nvarchar"} +{"name": "ltrim", "args": [{"type": "varchar"}], "returns": "varchar"} +{"name": "ltrim", "args": [{"type": "nvarchar"}], "returns": "nvarchar"} +{"name": "rtrim", "args": [{"type": "varchar"}], "returns": "varchar"} +{"name": "rtrim", "args": [{"type": "nvarchar"}], "returns": "nvarchar"} +{"name": "trim", "args": [{"type": "varchar"}], "returns": "varchar"} +{"name": "trim", "args": [{"type": "nvarchar"}], "returns": "nvarchar"} diff --git a/internal/engine/mssql/dialect/relations.jsonl b/internal/engine/mssql/dialect/relations.jsonl new file mode 100644 index 0000000000..d3b250f005 --- /dev/null +++ b/internal/engine/mssql/dialect/relations.jsonl @@ -0,0 +1,630 @@ +{"schema":"sys","name":"all_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_computed","type":"bit"},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_sparse","type":"bit"},{"name":"is_column_set","type":"bit"},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit"},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"all_objects","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"}]} +{"schema":"sys","name":"all_parameters","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"is_output","type":"bit","not_null":true},{"name":"is_cursor_ref","type":"bit","not_null":true},{"name":"has_default_value","type":"bit","not_null":true},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"default_value","type":"sql_variant"},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"is_readonly","type":"bit","not_null":true},{"name":"is_nullable","type":"bit"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"all_sql_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"uses_quoted_identifier","type":"bit"},{"name":"is_schema_bound","type":"bit"},{"name":"uses_database_collation","type":"bit"},{"name":"is_recompiled","type":"bit"},{"name":"null_on_null_input","type":"bit"},{"name":"execute_as_principal_id","type":"int"},{"name":"uses_native_compilation","type":"bit"},{"name":"inline_type","type":"bit"},{"name":"is_inlineable","type":"bit"}]} +{"schema":"sys","name":"all_views","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"},{"name":"is_replicated","type":"bit"},{"name":"has_replication_filter","type":"bit"},{"name":"has_opaque_metadata","type":"bit"},{"name":"has_unchecked_assembly_data","type":"bit"},{"name":"with_check_option","type":"bit"},{"name":"is_date_correlation_view","type":"bit"},{"name":"is_tracked_by_cdc","type":"bit"},{"name":"has_snapshot","type":"bit"},{"name":"ledger_view_type","type":"tinyint"},{"name":"ledger_view_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_view","type":"bit"}]} +{"schema":"sys","name":"allocation_units","kind":"v","columns":[{"name":"allocation_unit_id","type":"bigint","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"container_id","type":"bigint","not_null":true},{"name":"data_space_id","type":"int"},{"name":"total_pages","type":"bigint","not_null":true},{"name":"used_pages","type":"bigint","not_null":true},{"name":"data_pages","type":"bigint","not_null":true}]} +{"schema":"sys","name":"assemblies","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int"},{"name":"assembly_id","type":"int","not_null":true},{"name":"clr_name","type":"nvarchar(4000)"},{"name":"permission_set","type":"tinyint"},{"name":"permission_set_desc","type":"nvarchar(60)"},{"name":"is_visible","type":"bit","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_user_defined","type":"bit"}]} +{"schema":"sys","name":"assembly_files","kind":"v","columns":[{"name":"assembly_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(260)"},{"name":"file_id","type":"int","not_null":true},{"name":"content","type":"varbinary(max)"},{"name":"sha2_256","type":"varbinary(8000)"},{"name":"sha2_512","type":"varbinary(8000)"}]} +{"schema":"sys","name":"assembly_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true},{"name":"assembly_class","type":"nvarchar(128)"},{"name":"assembly_method","type":"nvarchar(128)"},{"name":"null_on_null_input","type":"bit"},{"name":"execute_as_principal_id","type":"int"}]} +{"schema":"sys","name":"assembly_references","kind":"v","columns":[{"name":"assembly_id","type":"int","not_null":true},{"name":"referenced_assembly_id","type":"int","not_null":true}]} +{"schema":"sys","name":"assembly_types","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_user_defined","type":"bit","not_null":true},{"name":"is_assembly_type","type":"bit","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true},{"name":"assembly_class","type":"nvarchar(128)"},{"name":"is_binary_ordered","type":"bit"},{"name":"is_fixed_length","type":"bit"},{"name":"prog_id","type":"nvarchar(40)"},{"name":"assembly_qualified_name","type":"nvarchar(4000)"},{"name":"is_table_type","type":"bit","not_null":true}]} +{"schema":"sys","name":"asymmetric_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int"},{"name":"asymmetric_key_id","type":"int","not_null":true},{"name":"pvt_key_encryption_type","type":"char(2)","not_null":true},{"name":"pvt_key_encryption_type_desc","type":"nvarchar(60)"},{"name":"thumbprint","type":"varbinary(64)","not_null":true},{"name":"algorithm","type":"char(2)","not_null":true},{"name":"algorithm_desc","type":"nvarchar(60)"},{"name":"key_length","type":"int","not_null":true},{"name":"sid","type":"varbinary(85)"},{"name":"string_sid","type":"nvarchar(128)"},{"name":"public_key","type":"varbinary(max)","not_null":true},{"name":"attested_by","type":"nvarchar(260)"},{"name":"provider_type","type":"nvarchar(60)"},{"name":"cryptographic_provider_guid","type":"uniqueidentifier"},{"name":"cryptographic_provider_algid","type":"sql_variant"}]} +{"schema":"sys","name":"availability_databases_cluster","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"group_database_id","type":"uniqueidentifier","not_null":true},{"name":"database_name","type":"nvarchar(128)"},{"name":"truncation_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"availability_group_listener_ip_addresses","kind":"v","columns":[{"name":"listener_id","type":"nvarchar(36)"},{"name":"ip_address","type":"nvarchar(48)"},{"name":"ip_subnet_mask","type":"nvarchar(15)"},{"name":"is_dhcp","type":"bit","not_null":true},{"name":"network_subnet_ip","type":"nvarchar(48)"},{"name":"network_subnet_prefix_length","type":"int"},{"name":"network_subnet_ipv4_mask","type":"nvarchar(48)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"availability_group_listeners","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"listener_id","type":"nvarchar(36)"},{"name":"dns_name","type":"nvarchar(63)"},{"name":"port","type":"int"},{"name":"is_conformant","type":"bit","not_null":true},{"name":"ip_configuration_string_from_cluster","type":"nvarchar(4000)"},{"name":"is_distributed_network_name","type":"bit","not_null":true}]} +{"schema":"sys","name":"availability_groups","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"resource_id","type":"nvarchar(40)"},{"name":"resource_group_id","type":"nvarchar(40)"},{"name":"failure_condition_level","type":"int"},{"name":"health_check_timeout","type":"int"},{"name":"automated_backup_preference","type":"tinyint"},{"name":"automated_backup_preference_desc","type":"nvarchar(60)"},{"name":"version","type":"smallint"},{"name":"basic_features","type":"bit"},{"name":"dtc_support","type":"bit"},{"name":"db_failover","type":"bit"},{"name":"is_distributed","type":"bit"},{"name":"cluster_type","type":"tinyint"},{"name":"cluster_type_desc","type":"nvarchar(60)"},{"name":"required_synchronized_secondaries_to_commit","type":"int"},{"name":"sequence_number","type":"bigint"},{"name":"is_contained","type":"bit"},{"name":"cluster_connection_options","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"availability_groups_cluster","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"resource_id","type":"nvarchar(40)"},{"name":"resource_group_id","type":"nvarchar(40)"},{"name":"failure_condition_level","type":"int"},{"name":"health_check_timeout","type":"int"},{"name":"automated_backup_preference","type":"tinyint"},{"name":"automated_backup_preference_desc","type":"nvarchar(60)"},{"name":"cluster_connection_options","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"availability_read_only_routing_lists","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"routing_priority","type":"int","not_null":true},{"name":"read_only_replica_id","type":"uniqueidentifier","not_null":true}]} +{"schema":"sys","name":"availability_replicas","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier"},{"name":"group_id","type":"uniqueidentifier"},{"name":"replica_metadata_id","type":"int"},{"name":"replica_server_name","type":"nvarchar(256)"},{"name":"owner_sid","type":"varbinary(85)"},{"name":"endpoint_url","type":"nvarchar(256)"},{"name":"availability_mode","type":"tinyint"},{"name":"availability_mode_desc","type":"nvarchar(60)"},{"name":"failover_mode","type":"tinyint"},{"name":"failover_mode_desc","type":"nvarchar(60)"},{"name":"session_timeout","type":"int"},{"name":"primary_role_allow_connections","type":"tinyint"},{"name":"primary_role_allow_connections_desc","type":"nvarchar(60)"},{"name":"secondary_role_allow_connections","type":"tinyint"},{"name":"secondary_role_allow_connections_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime"},{"name":"modify_date","type":"datetime"},{"name":"backup_priority","type":"int"},{"name":"read_only_routing_url","type":"nvarchar(256)"},{"name":"seeding_mode","type":"tinyint"},{"name":"seeding_mode_desc","type":"nvarchar(60)"},{"name":"read_write_routing_url","type":"nvarchar(256)"}]} +{"schema":"sys","name":"backup_devices","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"type","type":"tinyint"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"physical_name","type":"nvarchar(260)"}]} +{"schema":"sys","name":"certificates","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"certificate_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"pvt_key_encryption_type","type":"char(2)","not_null":true},{"name":"pvt_key_encryption_type_desc","type":"nvarchar(60)"},{"name":"is_active_for_begin_dialog","type":"bit"},{"name":"issuer_name","type":"nvarchar(442)"},{"name":"cert_serial_number","type":"nvarchar(64)"},{"name":"sid","type":"varbinary(85)"},{"name":"string_sid","type":"nvarchar(128)"},{"name":"subject","type":"nvarchar(4000)"},{"name":"expiry_date","type":"datetime"},{"name":"start_date","type":"datetime"},{"name":"thumbprint","type":"varbinary(64)","not_null":true},{"name":"attested_by","type":"nvarchar(260)"},{"name":"pvt_key_last_backup_date","type":"datetime"},{"name":"key_length","type":"int"}]} +{"schema":"sys","name":"change_tracking_databases","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"is_auto_cleanup_on","type":"tinyint"},{"name":"retention_period","type":"int"},{"name":"retention_period_units","type":"tinyint"},{"name":"retention_period_units_desc","type":"nvarchar(60)"},{"name":"max_cleanup_version","type":"bigint"}]} +{"schema":"sys","name":"change_tracking_tables","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"is_track_columns_updated_on","type":"bit","not_null":true},{"name":"min_valid_version","type":"bigint"},{"name":"begin_version","type":"bigint"},{"name":"cleanup_version","type":"bigint"}]} +{"schema":"sys","name":"check_constraints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"is_disabled","type":"bit","not_null":true},{"name":"is_not_for_replication","type":"bit","not_null":true},{"name":"is_not_trusted","type":"bit","not_null":true},{"name":"parent_column_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_database_collation","type":"bit"},{"name":"is_system_named","type":"bit","not_null":true}]} +{"schema":"sys","name":"column_encryption_key_values","kind":"v","columns":[{"name":"column_encryption_key_id","type":"int","not_null":true},{"name":"column_master_key_id","type":"int","not_null":true},{"name":"encrypted_value","type":"varbinary(8000)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"}]} +{"schema":"sys","name":"column_encryption_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"column_encryption_key_id","type":"int","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"column_master_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"column_master_key_id","type":"int","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"key_store_provider_name","type":"nvarchar(128)"},{"name":"key_path","type":"nvarchar(4000)"},{"name":"allow_enclave_computations","type":"int","not_null":true},{"name":"signature","type":"varbinary(8000)"}]} +{"schema":"sys","name":"column_store_dictionaries","kind":"v","columns":[{"name":"partition_id","type":"bigint"},{"name":"hobt_id","type":"bigint"},{"name":"column_id","type":"int"},{"name":"dictionary_id","type":"int"},{"name":"version","type":"int"},{"name":"type","type":"int"},{"name":"last_id","type":"int"},{"name":"entry_count","type":"bigint"},{"name":"on_disk_size","type":"bigint"}]} +{"schema":"sys","name":"column_store_row_groups","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_number","type":"int"},{"name":"row_group_id","type":"int"},{"name":"delta_store_hobt_id","type":"bigint"},{"name":"state","type":"tinyint"},{"name":"state_description","type":"nvarchar(60)","not_null":true},{"name":"total_rows","type":"bigint"},{"name":"deleted_rows","type":"bigint"},{"name":"size_in_bytes","type":"bigint"}]} +{"schema":"sys","name":"column_store_segments","kind":"v","columns":[{"name":"partition_id","type":"bigint"},{"name":"hobt_id","type":"bigint"},{"name":"column_id","type":"int"},{"name":"segment_id","type":"int"},{"name":"version","type":"int"},{"name":"encoding_type","type":"int"},{"name":"row_count","type":"int"},{"name":"has_nulls","type":"int"},{"name":"base_id","type":"bigint"},{"name":"magnitude","type":"float"},{"name":"primary_dictionary_id","type":"int"},{"name":"secondary_dictionary_id","type":"int"},{"name":"min_data_id","type":"bigint"},{"name":"max_data_id","type":"bigint"},{"name":"null_value","type":"bigint"},{"name":"on_disk_size","type":"bigint"},{"name":"collation_id","type":"int"},{"name":"min_deep_data","type":"varbinary(18)"},{"name":"max_deep_data","type":"varbinary(18)"}]} +{"schema":"sys","name":"column_type_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"user_type_id","type":"int","not_null":true}]} +{"schema":"sys","name":"column_xml_schema_collection_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true}]} +{"schema":"sys","name":"columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_computed","type":"bit"},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_sparse","type":"bit"},{"name":"is_column_set","type":"bit"},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit"},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"computed_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_database_collation","type":"bit","not_null":true},{"name":"is_persisted","type":"bit","not_null":true},{"name":"is_computed","type":"bit"},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_column_set","type":"bit","not_null":true},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit"},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"},{"name":"is_index_column_expression","type":"bit"}]} +{"schema":"sys","name":"configurations","kind":"v","columns":[{"name":"configuration_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(35)","not_null":true},{"name":"value","type":"sql_variant"},{"name":"minimum","type":"sql_variant"},{"name":"maximum","type":"sql_variant"},{"name":"value_in_use","type":"sql_variant"},{"name":"description","type":"nvarchar(255)","not_null":true},{"name":"is_dynamic","type":"bit","not_null":true},{"name":"is_advanced","type":"bit","not_null":true}]} +{"schema":"sys","name":"conversation_endpoints","kind":"v","columns":[{"name":"conversation_handle","type":"uniqueidentifier","not_null":true},{"name":"conversation_id","type":"uniqueidentifier","not_null":true},{"name":"is_initiator","type":"bit","not_null":true},{"name":"service_contract_id","type":"int","not_null":true},{"name":"conversation_group_id","type":"uniqueidentifier","not_null":true},{"name":"service_id","type":"int","not_null":true},{"name":"lifetime","type":"datetime","not_null":true},{"name":"state","type":"char(2)","not_null":true},{"name":"state_desc","type":"nvarchar(60)"},{"name":"far_service","type":"nvarchar(256)","not_null":true},{"name":"far_broker_instance","type":"nvarchar(128)"},{"name":"principal_id","type":"int","not_null":true},{"name":"far_principal_id","type":"int","not_null":true},{"name":"outbound_session_key_identifier","type":"uniqueidentifier","not_null":true},{"name":"inbound_session_key_identifier","type":"uniqueidentifier","not_null":true},{"name":"security_timestamp","type":"datetime","not_null":true},{"name":"dialog_timer","type":"datetime","not_null":true},{"name":"send_sequence","type":"bigint","not_null":true},{"name":"last_send_tran_id","type":"binary(6)","not_null":true},{"name":"end_dialog_sequence","type":"bigint","not_null":true},{"name":"receive_sequence","type":"bigint","not_null":true},{"name":"receive_sequence_frag","type":"int","not_null":true},{"name":"system_sequence","type":"bigint","not_null":true},{"name":"first_out_of_order_sequence","type":"bigint","not_null":true},{"name":"last_out_of_order_sequence","type":"bigint","not_null":true},{"name":"last_out_of_order_frag","type":"int","not_null":true},{"name":"is_system","type":"bit","not_null":true},{"name":"priority","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"conversation_groups","kind":"v","columns":[{"name":"conversation_group_id","type":"uniqueidentifier","not_null":true},{"name":"service_id","type":"int","not_null":true},{"name":"is_system","type":"bit"}]} +{"schema":"sys","name":"conversation_priorities","kind":"v","columns":[{"name":"priority_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"service_contract_id","type":"int"},{"name":"local_service_id","type":"int"},{"name":"remote_service_name","type":"nvarchar(256)"},{"name":"priority","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"credentials","kind":"v","columns":[{"name":"credential_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"credential_identity","type":"nvarchar(4000)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"target_type","type":"nvarchar(60)"},{"name":"target_id","type":"int"}]} +{"schema":"sys","name":"crypt_properties","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"thumbprint","type":"varbinary(32)","not_null":true},{"name":"crypt_type","type":"char(4)","not_null":true},{"name":"crypt_type_desc","type":"nvarchar(60)"},{"name":"crypt_property","type":"varbinary(max)","not_null":true}]} +{"schema":"sys","name":"cryptographic_providers","kind":"v","columns":[{"name":"provider_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"guid","type":"uniqueidentifier"},{"name":"version","type":"nvarchar(24)"},{"name":"dll_path","type":"nvarchar(520)"},{"name":"is_enabled","type":"bit","not_null":true}]} +{"schema":"sys","name":"data_spaces","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"data_space_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_default","type":"bit","not_null":true},{"name":"is_system","type":"bit"}]} +{"schema":"sys","name":"database_audit_specification_details","kind":"v","columns":[{"name":"database_specification_id","type":"int","not_null":true},{"name":"audit_action_id","type":"char(4)","not_null":true},{"name":"audit_action_name","type":"nvarchar(60)"},{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"audited_principal_id","type":"int","not_null":true},{"name":"audited_result","type":"nvarchar(60)"},{"name":"is_group","type":"bit"}]} +{"schema":"sys","name":"database_audit_specifications","kind":"v","columns":[{"name":"database_specification_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"audit_guid","type":"uniqueidentifier"},{"name":"is_state_enabled","type":"bit"},{"name":"is_session_context_enabled","type":"bit"},{"name":"session_context_keys","type":"nvarchar(max)"}]} +{"schema":"sys","name":"database_automatic_tuning_configurations","kind":"v","columns":[{"name":"option","type":"nvarchar(60)"},{"name":"option_value","type":"nvarchar(60)"},{"name":"type","type":"nvarchar(60)"},{"name":"type_value","type":"sql_variant"},{"name":"details","type":"nvarchar(4000)"},{"name":"state","type":"int","not_null":true}]} +{"schema":"sys","name":"database_automatic_tuning_mode","kind":"v","columns":[{"name":"desired_state","type":"smallint"},{"name":"desired_state_desc","type":"nvarchar(60)"},{"name":"actual_state","type":"smallint"},{"name":"actual_state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_automatic_tuning_options","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"desired_state","type":"smallint"},{"name":"desired_state_desc","type":"nvarchar(60)"},{"name":"actual_state","type":"smallint"},{"name":"actual_state_desc","type":"nvarchar(60)"},{"name":"reason","type":"smallint"},{"name":"reason_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_credentials","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"credential_id","type":"int","not_null":true},{"name":"credential_identity","type":"nvarchar(4000)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"target_type","type":"nvarchar(60)"},{"name":"target_id","type":"int"}]} +{"schema":"sys","name":"database_files","kind":"v","columns":[{"name":"file_id","type":"int","not_null":true},{"name":"file_guid","type":"uniqueidentifier"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"data_space_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"physical_name","type":"nvarchar(260)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"size","type":"int","not_null":true},{"name":"max_size","type":"int","not_null":true},{"name":"growth","type":"int","not_null":true},{"name":"is_media_read_only","type":"bit","not_null":true},{"name":"is_read_only","type":"bit","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_percent_growth","type":"bit","not_null":true},{"name":"is_name_reserved","type":"bit","not_null":true},{"name":"is_persistent_log_buffer","type":"bit","not_null":true},{"name":"create_lsn","type":"numeric(25,0)"},{"name":"drop_lsn","type":"numeric(25,0)"},{"name":"read_only_lsn","type":"numeric(25,0)"},{"name":"read_write_lsn","type":"numeric(25,0)"},{"name":"differential_base_lsn","type":"numeric(25,0)"},{"name":"differential_base_guid","type":"uniqueidentifier"},{"name":"differential_base_time","type":"datetime"},{"name":"redo_start_lsn","type":"numeric(25,0)"},{"name":"redo_start_fork_guid","type":"uniqueidentifier"},{"name":"redo_target_lsn","type":"numeric(25,0)"},{"name":"redo_target_fork_guid","type":"uniqueidentifier"},{"name":"backup_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"database_filestream_options","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"non_transacted_access","type":"tinyint","not_null":true},{"name":"non_transacted_access_desc","type":"nvarchar(60)","not_null":true},{"name":"directory_name","type":"nvarchar(256)"}]} +{"schema":"sys","name":"database_ledger_blocks","kind":"v","columns":[{"name":"block_id","type":"bigint","not_null":true},{"name":"transactions_root_hash","type":"varbinary(32)"},{"name":"block_size","type":"int","not_null":true},{"name":"previous_block_hash","type":"varbinary(32)"}]} +{"schema":"sys","name":"database_ledger_digest_locations","kind":"v","columns":[{"name":"path","type":"nvarchar(4000)"},{"name":"last_digest_block_id","type":"bigint"},{"name":"is_current","type":"bit","not_null":true}]} +{"schema":"sys","name":"database_ledger_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint","not_null":true},{"name":"block_id","type":"bigint","not_null":true},{"name":"transaction_ordinal","type":"int","not_null":true},{"name":"commit_time","type":"datetime2(7)","not_null":true},{"name":"principal_name","type":"nvarchar(128)","not_null":true},{"name":"table_hashes","type":"varbinary(max)"}]} +{"schema":"sys","name":"database_mirroring","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"mirroring_guid","type":"uniqueidentifier"},{"name":"mirroring_state","type":"tinyint"},{"name":"mirroring_state_desc","type":"nvarchar(60)"},{"name":"mirroring_role","type":"tinyint"},{"name":"mirroring_role_desc","type":"nvarchar(60)"},{"name":"mirroring_role_sequence","type":"int"},{"name":"mirroring_safety_level","type":"tinyint"},{"name":"mirroring_safety_level_desc","type":"nvarchar(60)"},{"name":"mirroring_safety_sequence","type":"int"},{"name":"mirroring_partner_name","type":"nvarchar(128)"},{"name":"mirroring_partner_instance","type":"nvarchar(128)"},{"name":"mirroring_witness_name","type":"nvarchar(128)"},{"name":"mirroring_witness_state","type":"tinyint"},{"name":"mirroring_witness_state_desc","type":"nvarchar(60)"},{"name":"mirroring_failover_lsn","type":"numeric(25,0)"},{"name":"mirroring_connection_timeout","type":"int"},{"name":"mirroring_redo_queue","type":"int"},{"name":"mirroring_redo_queue_type","type":"nvarchar(60)"},{"name":"mirroring_end_of_log_lsn","type":"numeric(25,0)"},{"name":"mirroring_replication_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"database_mirroring_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"role","type":"tinyint"},{"name":"role_desc","type":"nvarchar(60)"},{"name":"is_encryption_enabled","type":"bit","not_null":true},{"name":"connection_auth","type":"tinyint","not_null":true},{"name":"connection_auth_desc","type":"nvarchar(60)"},{"name":"certificate_id","type":"int","not_null":true},{"name":"encryption_algorithm","type":"tinyint","not_null":true},{"name":"encryption_algorithm_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_mirroring_witnesses","kind":"v","columns":[{"name":"database_name","type":"nvarchar(128)","not_null":true},{"name":"principal_server_name","type":"nvarchar(128)"},{"name":"mirror_server_name","type":"nvarchar(128)"},{"name":"safety_level","type":"tinyint","not_null":true},{"name":"safety_level_desc","type":"nvarchar(60)"},{"name":"safety_sequence_number","type":"int","not_null":true},{"name":"role_sequence_number","type":"int","not_null":true},{"name":"mirroring_guid","type":"uniqueidentifier","not_null":true},{"name":"family_guid","type":"uniqueidentifier","not_null":true},{"name":"is_suspended","type":"bit"},{"name":"is_suspended_sequence_number","type":"int","not_null":true},{"name":"partner_sync_state","type":"tinyint"},{"name":"partner_sync_state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_permissions","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"grantee_principal_id","type":"int","not_null":true},{"name":"grantor_principal_id","type":"int","not_null":true},{"name":"type","type":"char(4)","not_null":true},{"name":"permission_name","type":"nvarchar(128)"},{"name":"state","type":"char(1)","not_null":true},{"name":"state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_principals","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"type","type":"char(1)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"default_schema_name","type":"nvarchar(128)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"owning_principal_id","type":"int"},{"name":"sid","type":"varbinary(85)"},{"name":"is_fixed_role","type":"bit","not_null":true},{"name":"authentication_type","type":"int","not_null":true},{"name":"authentication_type_desc","type":"nvarchar(60)"},{"name":"default_language_name","type":"nvarchar(128)"},{"name":"default_language_lcid","type":"int"},{"name":"allow_encrypted_value_modifications","type":"bit","not_null":true},{"name":"tenant_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"database_query_store_internal_state","kind":"v","columns":[{"name":"pending_message_count","type":"bigint","not_null":true},{"name":"messaging_memory_used_mb","type":"bigint","not_null":true}]} +{"schema":"sys","name":"database_query_store_options","kind":"v","columns":[{"name":"desired_state","type":"smallint","not_null":true},{"name":"desired_state_desc","type":"nvarchar(60)"},{"name":"actual_state","type":"smallint","not_null":true},{"name":"actual_state_desc","type":"nvarchar(60)"},{"name":"readonly_reason","type":"int"},{"name":"current_storage_size_mb","type":"bigint"},{"name":"flush_interval_seconds","type":"bigint"},{"name":"interval_length_minutes","type":"bigint"},{"name":"max_storage_size_mb","type":"bigint"},{"name":"stale_query_threshold_days","type":"bigint"},{"name":"max_plans_per_query","type":"bigint"},{"name":"query_capture_mode","type":"smallint","not_null":true},{"name":"query_capture_mode_desc","type":"nvarchar(60)"},{"name":"capture_policy_execution_count","type":"int"},{"name":"capture_policy_total_compile_cpu_time_ms","type":"bigint"},{"name":"capture_policy_total_execution_cpu_time_ms","type":"bigint"},{"name":"capture_policy_stale_threshold_hours","type":"int"},{"name":"size_based_cleanup_mode","type":"smallint","not_null":true},{"name":"size_based_cleanup_mode_desc","type":"nvarchar(60)"},{"name":"wait_stats_capture_mode","type":"smallint","not_null":true},{"name":"wait_stats_capture_mode_desc","type":"nvarchar(60)"},{"name":"actual_state_additional_info","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"database_recovery_status","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"database_guid","type":"uniqueidentifier"},{"name":"family_guid","type":"uniqueidentifier"},{"name":"last_log_backup_lsn","type":"numeric(25,0)"},{"name":"recovery_fork_guid","type":"uniqueidentifier"},{"name":"first_recovery_fork_guid","type":"uniqueidentifier"},{"name":"fork_point_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"database_role_members","kind":"v","columns":[{"name":"role_principal_id","type":"int","not_null":true},{"name":"member_principal_id","type":"int","not_null":true}]} +{"schema":"sys","name":"database_scoped_configurations","kind":"v","columns":[{"name":"configuration_id","type":"int"},{"name":"name","type":"nvarchar(60)"},{"name":"value","type":"sql_variant"},{"name":"value_for_secondary","type":"sql_variant"},{"name":"is_value_default","type":"bit"}]} +{"schema":"sys","name":"database_scoped_credentials","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"credential_id","type":"int","not_null":true},{"name":"credential_identity","type":"nvarchar(4000)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"target_type","type":"nvarchar(60)"},{"name":"target_id","type":"int"}]} +{"schema":"sys","name":"databases","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"source_database_id","type":"int"},{"name":"owner_sid","type":"varbinary(85)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"compatibility_level","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"user_access","type":"tinyint"},{"name":"user_access_desc","type":"nvarchar(60)"},{"name":"is_read_only","type":"bit"},{"name":"is_auto_close_on","type":"bit","not_null":true},{"name":"is_auto_shrink_on","type":"bit"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_in_standby","type":"bit"},{"name":"is_cleanly_shutdown","type":"bit"},{"name":"is_supplemental_logging_enabled","type":"bit"},{"name":"snapshot_isolation_state","type":"tinyint"},{"name":"snapshot_isolation_state_desc","type":"nvarchar(60)"},{"name":"is_read_committed_snapshot_on","type":"bit"},{"name":"recovery_model","type":"tinyint"},{"name":"recovery_model_desc","type":"nvarchar(60)"},{"name":"page_verify_option","type":"tinyint"},{"name":"page_verify_option_desc","type":"nvarchar(60)"},{"name":"is_auto_create_stats_on","type":"bit"},{"name":"is_auto_create_stats_incremental_on","type":"bit"},{"name":"is_auto_update_stats_on","type":"bit"},{"name":"is_auto_update_stats_async_on","type":"bit"},{"name":"is_ansi_null_default_on","type":"bit"},{"name":"is_ansi_nulls_on","type":"bit"},{"name":"is_ansi_padding_on","type":"bit"},{"name":"is_ansi_warnings_on","type":"bit"},{"name":"is_arithabort_on","type":"bit"},{"name":"is_concat_null_yields_null_on","type":"bit"},{"name":"is_numeric_roundabort_on","type":"bit"},{"name":"is_quoted_identifier_on","type":"bit"},{"name":"is_recursive_triggers_on","type":"bit"},{"name":"is_cursor_close_on_commit_on","type":"bit"},{"name":"is_local_cursor_default","type":"bit"},{"name":"is_fulltext_enabled","type":"bit"},{"name":"is_trustworthy_on","type":"bit"},{"name":"is_db_chaining_on","type":"bit"},{"name":"is_parameterization_forced","type":"bit"},{"name":"is_master_key_encrypted_by_server","type":"bit","not_null":true},{"name":"is_query_store_on","type":"bit"},{"name":"is_published","type":"bit","not_null":true},{"name":"is_subscribed","type":"bit","not_null":true},{"name":"is_merge_published","type":"bit","not_null":true},{"name":"is_distributor","type":"bit","not_null":true},{"name":"is_sync_with_backup","type":"bit","not_null":true},{"name":"service_broker_guid","type":"uniqueidentifier","not_null":true},{"name":"is_broker_enabled","type":"bit","not_null":true},{"name":"log_reuse_wait","type":"tinyint"},{"name":"log_reuse_wait_desc","type":"nvarchar(60)"},{"name":"is_date_correlation_on","type":"bit","not_null":true},{"name":"is_cdc_enabled","type":"bit","not_null":true},{"name":"is_encrypted","type":"bit"},{"name":"is_honor_broker_priority_on","type":"bit"},{"name":"replica_id","type":"uniqueidentifier"},{"name":"group_database_id","type":"uniqueidentifier"},{"name":"resource_pool_id","type":"int"},{"name":"default_language_lcid","type":"smallint"},{"name":"default_language_name","type":"nvarchar(128)"},{"name":"default_fulltext_language_lcid","type":"int"},{"name":"default_fulltext_language_name","type":"nvarchar(128)"},{"name":"is_nested_triggers_on","type":"bit"},{"name":"is_transform_noise_words_on","type":"bit"},{"name":"two_digit_year_cutoff","type":"smallint"},{"name":"containment","type":"tinyint"},{"name":"containment_desc","type":"nvarchar(60)"},{"name":"target_recovery_time_in_seconds","type":"int"},{"name":"delayed_durability","type":"int"},{"name":"delayed_durability_desc","type":"nvarchar(60)"},{"name":"is_memory_optimized_elevate_to_snapshot_on","type":"bit"},{"name":"is_federation_member","type":"bit"},{"name":"is_remote_data_archive_enabled","type":"bit"},{"name":"is_mixed_page_allocation_on","type":"bit"},{"name":"is_temporal_history_retention_enabled","type":"bit"},{"name":"catalog_collation_type","type":"int","not_null":true},{"name":"catalog_collation_type_desc","type":"nvarchar(60)"},{"name":"physical_database_name","type":"nvarchar(128)"},{"name":"is_result_set_caching_on","type":"bit"},{"name":"is_accelerated_database_recovery_on","type":"bit"},{"name":"is_tempdb_spill_to_remote_store","type":"bit"},{"name":"is_stale_page_detection_on","type":"bit"},{"name":"is_memory_optimized_enabled","type":"bit"},{"name":"is_data_retention_enabled","type":"bit"},{"name":"is_ledger_on","type":"bit"},{"name":"is_change_feed_enabled","type":"bit"},{"name":"is_data_lake_replication_enabled","type":"bit"},{"name":"is_event_stream_enabled","type":"bit"},{"name":"data_compaction","type":"tinyint"},{"name":"data_compaction_desc","type":"nvarchar(60)"},{"name":"data_lake_log_publishing","type":"tinyint"},{"name":"data_lake_log_publishing_desc","type":"nvarchar(60)"},{"name":"is_vorder_enabled","type":"bit"},{"name":"is_proactive_statistics_refresh_on","type":"bit"},{"name":"is_optimized_locking_on","type":"bit"}]} +{"schema":"sys","name":"default_constraints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"parent_column_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"is_system_named","type":"bit","not_null":true}]} +{"schema":"sys","name":"destination_data_spaces","kind":"v","columns":[{"name":"partition_scheme_id","type":"int","not_null":true},{"name":"destination_id","type":"int","not_null":true},{"name":"data_space_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_audit_actions","kind":"v","columns":[{"name":"action_id","type":"varchar(4)"},{"name":"name","type":"nvarchar(128)"},{"name":"class_desc","type":"nvarchar(35)"},{"name":"covering_action_name","type":"nvarchar(128)"},{"name":"parent_class_desc","type":"nvarchar(35)"},{"name":"covering_parent_action_name","type":"nvarchar(128)"},{"name":"configuration_level","type":"nvarchar(128)"},{"name":"containing_group_name","type":"nvarchar(128)"},{"name":"action_in_log","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_audit_class_type_map","kind":"v","columns":[{"name":"class_type","type":"varchar(2)"},{"name":"class_type_desc","type":"nvarchar(35)"},{"name":"securable_class_desc","type":"nvarchar(35)"}]} +{"schema":"sys","name":"dm_broker_activated_tasks","kind":"v","columns":[{"name":"spid","type":"int"},{"name":"database_id","type":"smallint"},{"name":"queue_id","type":"int"},{"name":"procedure_name","type":"nvarchar(325)"},{"name":"execute_as","type":"int"}]} +{"schema":"sys","name":"dm_broker_connections","kind":"v","columns":[{"name":"connection_id","type":"uniqueidentifier"},{"name":"transport_stream_id","type":"uniqueidentifier"},{"name":"state","type":"smallint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"connect_time","type":"datetime"},{"name":"login_time","type":"datetime"},{"name":"authentication_method","type":"nvarchar(128)"},{"name":"principal_name","type":"nvarchar(128)"},{"name":"remote_user_name","type":"nvarchar(128)"},{"name":"last_activity_time","type":"datetime"},{"name":"is_accept","type":"bit"},{"name":"login_state","type":"smallint"},{"name":"login_state_desc","type":"nvarchar(60)"},{"name":"peer_certificate_id","type":"int"},{"name":"encryption_algorithm","type":"smallint"},{"name":"encryption_algorithm_desc","type":"nvarchar(60)"},{"name":"receives_posted","type":"smallint"},{"name":"is_receive_flow_controlled","type":"bit"},{"name":"sends_posted","type":"smallint"},{"name":"is_send_flow_controlled","type":"bit"},{"name":"total_bytes_sent","type":"bigint"},{"name":"total_bytes_received","type":"bigint"},{"name":"total_fragments_sent","type":"bigint"},{"name":"total_fragments_received","type":"bigint"},{"name":"total_sends","type":"bigint"},{"name":"total_receives","type":"bigint"},{"name":"peer_arbitration_id","type":"uniqueidentifier"},{"name":"address","type":"nvarchar(256)"},{"name":"encryption_key_bit_length","type":"int"},{"name":"encryption_protocol_version","type":"nvarchar(16)"}]} +{"schema":"sys","name":"dm_broker_forwarded_messages","kind":"v","columns":[{"name":"conversation_id","type":"uniqueidentifier"},{"name":"is_initiator","type":"bit"},{"name":"to_service_name","type":"nvarchar(256)"},{"name":"to_broker_instance","type":"nvarchar(256)"},{"name":"from_service_name","type":"nvarchar(256)"},{"name":"from_broker_instance","type":"nvarchar(256)"},{"name":"adjacent_broker_address","type":"nvarchar(256)"},{"name":"message_sequence_number","type":"bigint"},{"name":"message_fragment_number","type":"int"},{"name":"hops_remaining","type":"tinyint"},{"name":"time_to_live","type":"int"},{"name":"time_consumed","type":"int"},{"name":"message_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_broker_queue_monitors","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"queue_id","type":"int"},{"name":"state","type":"nvarchar(32)"},{"name":"last_empty_rowset_time","type":"datetime"},{"name":"last_activated_time","type":"datetime"},{"name":"tasks_waiting","type":"int"}]} +{"schema":"sys","name":"dm_cache_hit_stats","kind":"v","columns":[{"name":"distribution_id","type":"smallint"},{"name":"cache_hit","type":"bigint"},{"name":"remote_hit","type":"bigint"},{"name":"collection_start_time","type":"datetime"}]} +{"schema":"sys","name":"dm_cache_size","kind":"v","columns":[{"name":"distribution_id","type":"smallint"},{"name":"cache_used","type":"bigint"},{"name":"cache_available","type":"bigint"},{"name":"cache_capacity","type":"bigint"}]} +{"schema":"sys","name":"dm_cache_stats","kind":"v","columns":[{"name":"distribution_id","type":"smallint"},{"name":"cache_hit","type":"bigint"},{"name":"remote_hit","type":"bigint"},{"name":"collection_start_time","type":"datetime"},{"name":"cache_used","type":"bigint"},{"name":"cache_available","type":"bigint"},{"name":"cache_capacity","type":"bigint"}]} +{"schema":"sys","name":"dm_cdc_errors","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"phase_number","type":"int"},{"name":"entry_time","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"},{"name":"error_message","type":"nvarchar(1025)"},{"name":"start_lsn","type":"nvarchar(24)"},{"name":"begin_lsn","type":"nvarchar(24)"},{"name":"sequence_value","type":"nvarchar(24)"}]} +{"schema":"sys","name":"dm_cdc_log_scan_sessions","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"duration","type":"int"},{"name":"scan_phase","type":"nvarchar(200)"},{"name":"error_count","type":"int"},{"name":"start_lsn","type":"nvarchar(24)"},{"name":"current_lsn","type":"nvarchar(24)"},{"name":"end_lsn","type":"nvarchar(24)"},{"name":"tran_count","type":"bigint"},{"name":"last_commit_lsn","type":"nvarchar(24)"},{"name":"last_commit_time","type":"datetime"},{"name":"log_record_count","type":"bigint"},{"name":"schema_change_count","type":"int"},{"name":"command_count","type":"bigint"},{"name":"first_begin_cdc_lsn","type":"nvarchar(24)"},{"name":"last_commit_cdc_lsn","type":"nvarchar(24)"},{"name":"last_commit_cdc_time","type":"datetime"},{"name":"latency","type":"int"},{"name":"empty_scan_count","type":"int"},{"name":"failed_sessions_count","type":"int"}]} +{"schema":"sys","name":"dm_change_event_stream_errors","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"source_task","type":"tinyint"},{"name":"stream_group_id","type":"uniqueidentifier"},{"name":"table_id","type":"int"},{"name":"capture_phase_number","type":"int"},{"name":"entry_time","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"},{"name":"error_message","type":"nvarchar(1025)"},{"name":"batch_start_lsn","type":"nvarchar(24)"},{"name":"batch_end_lsn","type":"nvarchar(24)"},{"name":"tran_begin_lsn","type":"nvarchar(24)"},{"name":"tran_commit_lsn","type":"nvarchar(24)"},{"name":"sequence_value","type":"nvarchar(24)"},{"name":"command_id","type":"int"}]} +{"schema":"sys","name":"dm_change_event_stream_log_scan_sessions","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"duration","type":"int"},{"name":"batch_processing_phase","type":"nvarchar(200)"},{"name":"error_count","type":"int"},{"name":"batch_start_lsn","type":"nvarchar(24)"},{"name":"currently_processed_lsn","type":"nvarchar(24)"},{"name":"batch_end_lsn","type":"nvarchar(24)"},{"name":"tran_count","type":"bigint"},{"name":"currently_processed_commit_lsn","type":"nvarchar(24)"},{"name":"currently_processed_commit_time","type":"datetime"},{"name":"log_record_count","type":"bigint"},{"name":"schema_change_count","type":"int"},{"name":"command_count","type":"bigint"},{"name":"latency","type":"int"},{"name":"rows_left_to_publish","type":"bigint"},{"name":"empty_scan_count","type":"int"},{"name":"failed_sessions_count","type":"int"}]} +{"schema":"sys","name":"dm_change_feed_errors","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"source_task","type":"tinyint"},{"name":"table_group_id","type":"uniqueidentifier"},{"name":"table_id","type":"int"},{"name":"capture_phase_number","type":"int"},{"name":"entry_time","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"},{"name":"error_message","type":"nvarchar(1025)"},{"name":"batch_start_lsn","type":"nvarchar(24)"},{"name":"batch_end_lsn","type":"nvarchar(24)"},{"name":"tran_begin_lsn","type":"nvarchar(24)"},{"name":"tran_commit_lsn","type":"nvarchar(24)"},{"name":"sequence_value","type":"nvarchar(24)"},{"name":"command_id","type":"int"}]} +{"schema":"sys","name":"dm_change_feed_log_scan_sessions","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"duration","type":"int"},{"name":"batch_processing_phase","type":"nvarchar(200)"},{"name":"error_count","type":"int"},{"name":"batch_start_lsn","type":"nvarchar(24)"},{"name":"currently_processed_lsn","type":"nvarchar(24)"},{"name":"batch_end_lsn","type":"nvarchar(24)"},{"name":"tran_count","type":"bigint"},{"name":"currently_processed_commit_lsn","type":"nvarchar(24)"},{"name":"currently_processed_commit_time","type":"datetime"},{"name":"log_record_count","type":"bigint"},{"name":"schema_change_count","type":"int"},{"name":"command_count","type":"bigint"},{"name":"latency","type":"int"},{"name":"rows_left_to_publish","type":"bigint"},{"name":"table_groups_to_commit","type":"int"},{"name":"empty_scan_count","type":"int"},{"name":"failed_sessions_count","type":"int"}]} +{"schema":"sys","name":"dm_clr_appdomains","kind":"v","columns":[{"name":"appdomain_address","type":"varbinary(8)"},{"name":"appdomain_id","type":"int"},{"name":"appdomain_name","type":"nvarchar(386)"},{"name":"creation_time","type":"datetime"},{"name":"db_id","type":"int"},{"name":"user_id","type":"int"},{"name":"state","type":"nvarchar(128)"},{"name":"strong_refcount","type":"int"},{"name":"weak_refcount","type":"int"},{"name":"cost","type":"int"},{"name":"value","type":"int"},{"name":"compatibility_level","type":"int"},{"name":"total_processor_time_ms","type":"bigint"},{"name":"total_allocated_memory_kb","type":"bigint"},{"name":"survived_memory_kb","type":"bigint"}]} +{"schema":"sys","name":"dm_clr_loaded_assemblies","kind":"v","columns":[{"name":"assembly_id","type":"int"},{"name":"appdomain_address","type":"varbinary(8)"},{"name":"load_time","type":"datetime"}]} +{"schema":"sys","name":"dm_clr_properties","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"value","type":"nvarchar(128)"}]} +{"schema":"sys","name":"dm_clr_tasks","kind":"v","columns":[{"name":"task_address","type":"varbinary(8)"},{"name":"sos_task_address","type":"varbinary(8)"},{"name":"appdomain_address","type":"varbinary(8)"},{"name":"state","type":"nvarchar(128)"},{"name":"abort_state","type":"nvarchar(128)"},{"name":"type","type":"nvarchar(128)"},{"name":"affinity_count","type":"int"},{"name":"forced_yield_count","type":"int"}]} +{"schema":"sys","name":"dm_cluster_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"description","type":"nvarchar(4000)","not_null":true},{"name":"endpoint","type":"nvarchar(256)","not_null":true},{"name":"protocol_desc","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_column_encryption_enclave","kind":"v","columns":[{"name":"current_enclave_session_count","type":"int"},{"name":"current_column_encryption_key_count","type":"int"},{"name":"current_memory_size_kb","type":"bigint"},{"name":"total_evicted_session_count","type":"bigint"}]} +{"schema":"sys","name":"dm_column_encryption_enclave_operation_stats","kind":"v","columns":[{"name":"operation_type","type":"nvarchar(128)"},{"name":"total_operation_count","type":"bigint"}]} +{"schema":"sys","name":"dm_column_encryption_enclave_properties","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"value","type":"sql_variant"}]} +{"schema":"sys","name":"dm_column_store_object_pool","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"column_id","type":"int"},{"name":"row_group_id","type":"int","not_null":true},{"name":"object_type","type":"int","not_null":true},{"name":"object_type_desc","type":"nvarchar(60)","not_null":true},{"name":"access_count","type":"bigint","not_null":true},{"name":"memory_used_in_bytes","type":"bigint","not_null":true},{"name":"object_load_time","type":"datetime2(7)","not_null":true}]} +{"schema":"sys","name":"dm_cryptographic_provider_properties","kind":"v","columns":[{"name":"provider_id","type":"int"},{"name":"guid","type":"uniqueidentifier"},{"name":"provider_version","type":"nvarchar(128)"},{"name":"sqlcrypt_version","type":"nvarchar(128)"},{"name":"friendly_name","type":"nvarchar(1024)"},{"name":"authentication_type","type":"nvarchar(128)"},{"name":"symmetric_key_support","type":"tinyint"},{"name":"symmetric_key_persistance","type":"tinyint"},{"name":"symmetric_key_export","type":"tinyint"},{"name":"symmetric_key_import","type":"tinyint"},{"name":"asymmetric_key_support","type":"tinyint"},{"name":"asymmetric_key_persistance","type":"tinyint"},{"name":"asymmetric_key_export","type":"tinyint"},{"name":"asymmetric_key_import","type":"tinyint"}]} +{"schema":"sys","name":"dm_database_backup_lineage","kind":"v","columns":[{"name":"backup_file_id","type":"uniqueidentifier","not_null":true},{"name":"logical_database_id","type":"uniqueidentifier"},{"name":"logical_server_name","type":"nvarchar(128)"},{"name":"logical_database_name","type":"nvarchar(128)"},{"name":"backup_start_date","type":"datetime2(7)","not_null":true},{"name":"backup_finish_date","type":"datetime2(7)","not_null":true},{"name":"backup_type","type":"char(1)","not_null":true},{"name":"database_allocated_storage_mb","type":"numeric(31,11)"}]} +{"schema":"sys","name":"dm_database_backups","kind":"v","columns":[{"name":"backup_file_id","type":"uniqueidentifier","not_null":true},{"name":"logical_database_id","type":"uniqueidentifier"},{"name":"physical_database_name","type":"nvarchar(128)","not_null":true},{"name":"logical_server_name","type":"nvarchar(128)"},{"name":"logical_database_name","type":"nvarchar(128)"},{"name":"backup_start_date","type":"datetime2(7)","not_null":true},{"name":"backup_finish_date","type":"datetime2(7)","not_null":true},{"name":"backup_type","type":"char(1)","not_null":true},{"name":"in_retention","type":"bit"}]} +{"schema":"sys","name":"dm_database_encryption_keys","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"encryption_state","type":"int"},{"name":"create_date","type":"datetime"},{"name":"regenerate_date","type":"datetime"},{"name":"modify_date","type":"datetime"},{"name":"set_date","type":"datetime"},{"name":"opened_date","type":"datetime"},{"name":"key_algorithm","type":"nvarchar(128)"},{"name":"key_length","type":"int"},{"name":"encryptor_thumbprint","type":"varbinary(20)"},{"name":"encryptor_type","type":"nvarchar(128)"},{"name":"percent_complete","type":"real"},{"name":"encryption_state_desc","type":"nvarchar(128)"},{"name":"encryption_scan_state","type":"int"},{"name":"encryption_scan_state_desc","type":"nvarchar(128)"},{"name":"encryption_scan_modify_date","type":"datetime"}]} +{"schema":"sys","name":"dm_database_external_governance_sync_state","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"sync_scope","type":"smallint"},{"name":"sync_scope_desc","type":"nvarchar(60)"},{"name":"sync_state","type":"smallint"},{"name":"sync_state_desc","type":"nvarchar(60)"},{"name":"user_initiated_sync","type":"smallint"},{"name":"sync_percent_complete","type":"smallint"},{"name":"current_sync_token","type":"nvarchar(128)"},{"name":"next_sync_token","type":"nvarchar(128)"},{"name":"last_reference_fetch_success_time_utc","type":"datetime"},{"name":"last_reference_fetch_attempt_time_utc","type":"datetime"},{"name":"last_reference_fetch_error","type":"int"},{"name":"last_blob_fetch_success_time_utc","type":"datetime"},{"name":"last_blob_fetch_attempt_time_utc","type":"datetime"},{"name":"last_blob_fetch_error","type":"int"},{"name":"last_sync_success_time_utc","type":"datetime"},{"name":"last_synchronizing_success_time_utc","type":"datetime"},{"name":"last_synchronizing_attempt_time_utc","type":"datetime"},{"name":"last_synchronizing_error","type":"int"}]} +{"schema":"sys","name":"dm_database_external_policy_actions","kind":"v","columns":[{"name":"sql_action_id","type":"int"},{"name":"action_namespace","type":"nvarchar(256)"},{"name":"action_type","type":"nvarchar(32)"},{"name":"action_provider_string","type":"nvarchar(20)"}]} +{"schema":"sys","name":"dm_database_external_policy_principal_assigned_actions","kind":"v","columns":[{"name":"principal_sid","type":"varbinary(85)"},{"name":"principal_aad_object_id","type":"nvarchar(36)"},{"name":"action_namespace","type":"nvarchar(256)"},{"name":"action_type","type":"nvarchar(32)"},{"name":"role_name","type":"nvarchar(128)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"role_assignment_scope","type":"nvarchar(4000)"},{"name":"role_assignment_type","type":"int"},{"name":"role_assignment_type_desc","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_database_external_policy_principals","kind":"v","columns":[{"name":"sid","type":"varbinary(85)"},{"name":"aad_object_id","type":"nvarchar(36)"},{"name":"type","type":"nvarchar(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"authentication_type","type":"int"},{"name":"authentication_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_database_external_policy_role_actions","kind":"v","columns":[{"name":"role_guid","type":"nvarchar(128)"},{"name":"sql_action_id","type":"int"}]} +{"schema":"sys","name":"dm_database_external_policy_role_members","kind":"v","columns":[{"name":"principal_aad_object_id","type":"nvarchar(36)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"assignment_scope","type":"nvarchar(4000)"},{"name":"assignment_type","type":"int"},{"name":"assignment_type_desc","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_database_external_policy_roles","kind":"v","columns":[{"name":"role_name","type":"nvarchar(128)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"modify_date","type":"datetime2(7)"}]} +{"schema":"sys","name":"dm_db_column_store_row_group_operational_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"row_group_id","type":"int","not_null":true},{"name":"index_scan_count","type":"bigint","not_null":true},{"name":"scan_count","type":"bigint","not_null":true},{"name":"delete_buffer_scan_count","type":"bigint","not_null":true},{"name":"row_group_lock_count","type":"bigint","not_null":true},{"name":"row_group_lock_wait_count","type":"bigint","not_null":true},{"name":"row_group_lock_wait_in_ms","type":"bigint","not_null":true},{"name":"returned_row_count","type":"bigint","not_null":true},{"name":"returned_aggregate_count","type":"bigint","not_null":true},{"name":"returned_group_count","type":"bigint","not_null":true},{"name":"input_groupby_row_count","type":"bigint","not_null":true},{"name":"row_group_elimination_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_db_column_store_row_group_physical_stats","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_number","type":"int"},{"name":"row_group_id","type":"int"},{"name":"delta_store_hobt_id","type":"bigint"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)","not_null":true},{"name":"total_rows","type":"bigint"},{"name":"deleted_rows","type":"bigint"},{"name":"size_in_bytes","type":"bigint"},{"name":"trim_reason","type":"tinyint"},{"name":"trim_reason_desc","type":"nvarchar(60)"},{"name":"transition_to_compressed_state","type":"tinyint"},{"name":"transition_to_compressed_state_desc","type":"nvarchar(60)"},{"name":"has_vertipaq_optimization","type":"bit"},{"name":"generation","type":"bigint"},{"name":"created_time","type":"datetime"},{"name":"closed_time","type":"datetime"}]} +{"schema":"sys","name":"dm_db_data_pool_nodes","kind":"v","columns":[{"name":"data_pool_id","type":"int","not_null":true},{"name":"data_pool_node_name","type":"nvarchar(256)","not_null":true},{"name":"address","type":"nvarchar(256)","not_null":true},{"name":"state","type":"nvarchar(256)","not_null":true},{"name":"health_status","type":"nvarchar(256)","not_null":true},{"name":"health_error_message","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_db_data_pools","kind":"v","columns":[{"name":"data_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)"},{"name":"location","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_db_external_language_stats","kind":"v","columns":[{"name":"external_language_id","type":"int","not_null":true},{"name":"is_installed","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_db_external_script_execution_stats","kind":"v","columns":[{"name":"external_language_id","type":"int","not_null":true},{"name":"counter_name","type":"nvarchar(256)","not_null":true},{"name":"counter_value","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_db_file_space_usage","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"file_id","type":"smallint"},{"name":"filegroup_id","type":"smallint"},{"name":"total_page_count","type":"bigint"},{"name":"allocated_extent_page_count","type":"bigint"},{"name":"unallocated_extent_page_count","type":"bigint"},{"name":"version_store_reserved_page_count","type":"bigint"},{"name":"user_object_reserved_page_count","type":"bigint"},{"name":"internal_object_reserved_page_count","type":"bigint"},{"name":"mixed_extent_page_count","type":"bigint"},{"name":"modified_extent_page_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_fts_index_physical_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"fulltext_index_page_count","type":"bigint"},{"name":"keyphrase_index_page_count","type":"bigint"},{"name":"similarity_index_page_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_index_usage_stats","kind":"v","columns":[{"name":"database_id","type":"smallint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"user_seeks","type":"bigint","not_null":true},{"name":"user_scans","type":"bigint","not_null":true},{"name":"user_lookups","type":"bigint","not_null":true},{"name":"user_updates","type":"bigint","not_null":true},{"name":"last_user_seek","type":"datetime"},{"name":"last_user_scan","type":"datetime"},{"name":"last_user_lookup","type":"datetime"},{"name":"last_user_update","type":"datetime"},{"name":"system_seeks","type":"bigint","not_null":true},{"name":"system_scans","type":"bigint","not_null":true},{"name":"system_lookups","type":"bigint","not_null":true},{"name":"system_updates","type":"bigint","not_null":true},{"name":"last_system_seek","type":"datetime"},{"name":"last_system_scan","type":"datetime"},{"name":"last_system_lookup","type":"datetime"},{"name":"last_system_update","type":"datetime"}]} +{"schema":"sys","name":"dm_db_information_protection_label_properties","kind":"v","columns":[{"name":"label_id","type":"nvarchar(36)"},{"name":"name","type":"nvarchar(128)"}]} +{"schema":"sys","name":"dm_db_internal_auto_tuning_create_index_recommendations","kind":"v","columns":[{"name":"id","type":"bigint","not_null":true},{"name":"state","type":"int","not_null":true},{"name":"state_name","type":"nvarchar(128)","not_null":true},{"name":"type_id","type":"int","not_null":true},{"name":"recommendation_timestamp_utc","type":"datetime","not_null":true},{"name":"last_refresh_timestamp_utc","type":"datetime","not_null":true},{"name":"archived","type":"bit","not_null":true},{"name":"extended_properties","type":"nvarchar(max)"},{"name":"index_type","type":"tinyint","not_null":true},{"name":"schema","type":"nvarchar(128)","not_null":true},{"name":"table","type":"nvarchar(128)","not_null":true},{"name":"index_columns","type":"nvarchar(4000)","not_null":true},{"name":"included_columns","type":"nvarchar(max)"},{"name":"index_name","type":"nvarchar(128)","not_null":true},{"name":"estimated_space_change_cached","type":"float"},{"name":"estimated_action_duration_cached","type":"float"},{"name":"reported_number_of_queries_with_improved_performance_cached","type":"int"},{"name":"reported_number_of_queries_with_regressed_performance_cached","type":"int"},{"name":"reported_cpu_utilization_change_absolute_cached","type":"float"},{"name":"reported_cpu_utilization_change_relative_cached","type":"float"},{"name":"reported_logical_reads_change_absolute_cached","type":"float"},{"name":"reported_logical_reads_change_relative_cached","type":"float"},{"name":"reported_logical_writes_change_absolute_cached","type":"float"},{"name":"reported_logical_writes_change_relative_cached","type":"float"},{"name":"index_size_kb_before_action","type":"bigint"},{"name":"index_size_kb_after_action","type":"bigint"},{"name":"recommendation_source","type":"smallint"},{"name":"baseline_data_collecting_start_time_utc","type":"datetime"},{"name":"score","type":"int"},{"name":"group_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_db_internal_auto_tuning_recommendation_impact_query_metrics","kind":"v","columns":[{"name":"recommendation_id","type":"bigint","not_null":true},{"name":"query_hash","type":"binary(8)","not_null":true},{"name":"metric","type":"smallint","not_null":true},{"name":"metric_name","type":"nvarchar(29)","not_null":true},{"name":"avg_metric_before_action","type":"float"},{"name":"avg_metric_after_action","type":"float"}]} +{"schema":"sys","name":"dm_db_internal_auto_tuning_recommendation_metrics","kind":"v","columns":[{"name":"recommendation_id","type":"bigint","not_null":true},{"name":"dimension_id","type":"smallint","not_null":true},{"name":"dimension_name","type":"nvarchar(31)","not_null":true},{"name":"impact_type_id","type":"tinyint","not_null":true},{"name":"impact_type_name","type":"nvarchar(9)","not_null":true},{"name":"unit_type_id","type":"smallint"},{"name":"unit_type_name","type":"nvarchar(15)","not_null":true},{"name":"absolute_value","type":"float"},{"name":"change_value_absolute","type":"float"},{"name":"change_value_relative","type":"float"}]} +{"schema":"sys","name":"dm_db_internal_auto_tuning_workflows","kind":"v","columns":[{"name":"execution_id","type":"uniqueidentifier","not_null":true},{"name":"current_state","type":"int","not_null":true},{"name":"create_date_utc","type":"datetime","not_null":true},{"name":"last_update_date_utc","type":"datetime","not_null":true},{"name":"workflow_type_id","type":"int","not_null":true},{"name":"retry_count","type":"int","not_null":true},{"name":"derived_from_id","type":"uniqueidentifier"},{"name":"properties","type":"nvarchar(max)"},{"name":"recommendation_id","type":"bigint"}]} +{"schema":"sys","name":"dm_db_internal_automatic_tuning_version","kind":"v","columns":[{"name":"version_code","type":"bigint"}]} +{"schema":"sys","name":"dm_db_log_space_usage","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"total_log_size_in_bytes","type":"bigint"},{"name":"used_log_space_in_bytes","type":"bigint"},{"name":"used_log_space_in_percent","type":"real"},{"name":"log_space_in_bytes_since_last_backup","type":"bigint"}]} +{"schema":"sys","name":"dm_db_logical_index_corruptions","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"entry_time","type":"datetime"},{"name":"row_handle","type":"varbinary(8000)"},{"name":"operation_type","type":"tinyint","not_null":true},{"name":"operation_type_desc","type":"nvarchar(60)","not_null":true}]} +{"schema":"sys","name":"dm_db_mirroring_auto_page_repair","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"file_id","type":"int","not_null":true},{"name":"page_id","type":"bigint","not_null":true},{"name":"error_type","type":"smallint","not_null":true},{"name":"page_status","type":"tinyint","not_null":true},{"name":"modification_time","type":"datetime","not_null":true}]} +{"schema":"sys","name":"dm_db_mirroring_connections","kind":"v","columns":[{"name":"connection_id","type":"uniqueidentifier"},{"name":"transport_stream_id","type":"uniqueidentifier"},{"name":"state","type":"smallint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"connect_time","type":"datetime"},{"name":"login_time","type":"datetime"},{"name":"authentication_method","type":"nvarchar(128)"},{"name":"principal_name","type":"nvarchar(128)"},{"name":"remote_user_name","type":"nvarchar(128)"},{"name":"last_activity_time","type":"datetime"},{"name":"is_accept","type":"bit"},{"name":"login_state","type":"smallint"},{"name":"login_state_desc","type":"nvarchar(60)"},{"name":"peer_certificate_id","type":"int"},{"name":"encryption_algorithm","type":"smallint"},{"name":"encryption_algorithm_desc","type":"nvarchar(60)"},{"name":"receives_posted","type":"smallint"},{"name":"is_receive_flow_controlled","type":"bit"},{"name":"sends_posted","type":"smallint"},{"name":"is_send_flow_controlled","type":"bit"},{"name":"total_bytes_sent","type":"bigint"},{"name":"total_bytes_received","type":"bigint"},{"name":"total_fragments_sent","type":"bigint"},{"name":"total_fragments_received","type":"bigint"},{"name":"total_sends","type":"bigint"},{"name":"total_receives","type":"bigint"},{"name":"peer_arbitration_id","type":"uniqueidentifier"},{"name":"address","type":"nvarchar(256)"},{"name":"encryption_key_bit_length","type":"int"},{"name":"encryption_protocol_version","type":"nvarchar(16)"}]} +{"schema":"sys","name":"dm_db_mirroring_past_actions","kind":"v","columns":[{"name":"mirroring_guid","type":"uniqueidentifier"},{"name":"state_machine_name","type":"nvarchar(60)"},{"name":"action_type","type":"nvarchar(60)"},{"name":"name","type":"nvarchar(60)"},{"name":"current_state","type":"nvarchar(60)"},{"name":"action_sequence","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_db_missing_index_details","kind":"v","columns":[{"name":"index_handle","type":"int","not_null":true},{"name":"database_id","type":"smallint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"equality_columns","type":"nvarchar(4000)"},{"name":"inequality_columns","type":"nvarchar(4000)"},{"name":"included_columns","type":"nvarchar(4000)"},{"name":"statement","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_db_missing_index_group_stats","kind":"v","columns":[{"name":"group_handle","type":"int","not_null":true},{"name":"unique_compiles","type":"bigint"},{"name":"user_seeks","type":"bigint"},{"name":"user_scans","type":"bigint"},{"name":"last_user_seek","type":"datetime"},{"name":"last_user_scan","type":"datetime"},{"name":"avg_total_user_cost","type":"float"},{"name":"avg_user_impact","type":"float"},{"name":"system_seeks","type":"bigint"},{"name":"system_scans","type":"bigint"},{"name":"last_system_seek","type":"datetime"},{"name":"last_system_scan","type":"datetime"},{"name":"avg_total_system_cost","type":"float"},{"name":"avg_system_impact","type":"float"}]} +{"schema":"sys","name":"dm_db_missing_index_group_stats_query","kind":"v","columns":[{"name":"group_handle","type":"int","not_null":true},{"name":"query_hash","type":"binary(8)","not_null":true},{"name":"query_plan_hash","type":"binary(8)","not_null":true},{"name":"last_sql_handle","type":"varbinary(64)","not_null":true},{"name":"last_statement_start_offset","type":"int","not_null":true},{"name":"last_statement_end_offset","type":"int","not_null":true},{"name":"last_statement_sql_handle","type":"varbinary(64)"},{"name":"user_seeks","type":"bigint","not_null":true},{"name":"user_scans","type":"bigint","not_null":true},{"name":"last_user_seek","type":"datetime"},{"name":"last_user_scan","type":"datetime"},{"name":"avg_total_user_cost","type":"float"},{"name":"avg_user_impact","type":"float","not_null":true},{"name":"system_seeks","type":"bigint","not_null":true},{"name":"system_scans","type":"bigint","not_null":true},{"name":"last_system_seek","type":"datetime"},{"name":"last_system_scan","type":"datetime"},{"name":"avg_total_system_cost","type":"float"},{"name":"avg_system_impact","type":"float","not_null":true}]} +{"schema":"sys","name":"dm_db_missing_index_groups","kind":"v","columns":[{"name":"index_group_handle","type":"int","not_null":true},{"name":"index_handle","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_db_partition_stats","kind":"v","columns":[{"name":"partition_id","type":"bigint"},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"in_row_data_page_count","type":"bigint"},{"name":"in_row_used_page_count","type":"bigint"},{"name":"in_row_reserved_page_count","type":"bigint"},{"name":"lob_used_page_count","type":"bigint"},{"name":"lob_reserved_page_count","type":"bigint"},{"name":"row_overflow_used_page_count","type":"bigint"},{"name":"row_overflow_reserved_page_count","type":"bigint"},{"name":"used_page_count","type":"bigint"},{"name":"reserved_page_count","type":"bigint"},{"name":"row_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_persisted_sku_features","kind":"v","columns":[{"name":"feature_name","type":"nvarchar(4000)"},{"name":"feature_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_db_rda_migration_status","kind":"v","columns":[{"name":"table_id","type":"int"},{"name":"database_id","type":"int"},{"name":"migrated_rows","type":"bigint"},{"name":"start_time_utc","type":"datetime"},{"name":"end_time_utc","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"}]} +{"schema":"sys","name":"dm_db_rda_schema_update_status","kind":"v","columns":[{"name":"table_id","type":"int"},{"name":"database_id","type":"int"},{"name":"task_id","type":"bigint"},{"name":"task_type","type":"int"},{"name":"task_type_desc","type":"nvarchar(60)"},{"name":"task_state","type":"int"},{"name":"task_state_desc","type":"nvarchar(60)"},{"name":"start_time_utc","type":"datetime"},{"name":"end_time_utc","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"}]} +{"schema":"sys","name":"dm_db_script_level","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"script_id","type":"int","not_null":true},{"name":"script_name","type":"nvarchar(128)"},{"name":"version","type":"int","not_null":true},{"name":"script_level","type":"int","not_null":true},{"name":"downgrade_start_level","type":"int","not_null":true},{"name":"downgrade_target_level","type":"int","not_null":true},{"name":"upgrade_start_level","type":"int"},{"name":"upgrade_target_level","type":"int"}]} +{"schema":"sys","name":"dm_db_session_space_usage","kind":"v","columns":[{"name":"session_id","type":"smallint"},{"name":"database_id","type":"int"},{"name":"user_objects_alloc_page_count","type":"bigint"},{"name":"user_objects_dealloc_page_count","type":"bigint"},{"name":"internal_objects_alloc_page_count","type":"bigint"},{"name":"internal_objects_dealloc_page_count","type":"bigint"},{"name":"user_objects_deferred_dealloc_page_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_storage_pool_nodes","kind":"v","columns":[{"name":"storage_pool_id","type":"int","not_null":true},{"name":"storage_pool_node_name","type":"nvarchar(256)","not_null":true},{"name":"address","type":"nvarchar(256)","not_null":true},{"name":"state","type":"nvarchar(256)","not_null":true},{"name":"health_status","type":"nvarchar(256)","not_null":true},{"name":"health_error_message","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_db_storage_pools","kind":"v","columns":[{"name":"storage_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)"},{"name":"location","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_db_task_space_usage","kind":"v","columns":[{"name":"task_address","type":"varbinary(8)"},{"name":"is_remote_task","type":"bit","not_null":true},{"name":"session_id","type":"smallint"},{"name":"request_id","type":"int"},{"name":"exec_context_id","type":"int"},{"name":"database_id","type":"int"},{"name":"user_objects_alloc_page_count","type":"bigint"},{"name":"user_objects_dealloc_page_count","type":"bigint"},{"name":"internal_objects_alloc_page_count","type":"bigint"},{"name":"internal_objects_dealloc_page_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_tuning_recommendations","kind":"v","columns":[{"name":"name","type":"nvarchar(4000)"},{"name":"type","type":"nvarchar(4000)"},{"name":"reason","type":"nvarchar(4000)"},{"name":"valid_since","type":"datetime2(7)"},{"name":"last_refresh","type":"datetime2(7)"},{"name":"state","type":"nvarchar(4000)"},{"name":"is_executable_action","type":"bit"},{"name":"is_revertable_action","type":"bit"},{"name":"execute_action_start_time","type":"datetime2(7)"},{"name":"execute_action_duration","type":"time(7)"},{"name":"execute_action_initiated_by","type":"nvarchar(4000)"},{"name":"execute_action_initiated_time","type":"datetime2(7)"},{"name":"revert_action_start_time","type":"datetime2(7)"},{"name":"revert_action_duration","type":"time(7)"},{"name":"revert_action_initiated_by","type":"nvarchar(4000)"},{"name":"revert_action_initiated_time","type":"datetime2(7)"},{"name":"score","type":"int"},{"name":"details","type":"nvarchar(max)"}]} +{"schema":"sys","name":"dm_db_uncontained_entities","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"nvarchar(60)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"statement_line_number","type":"int"},{"name":"statement_offset_begin","type":"int"},{"name":"statement_offset_end","type":"int"},{"name":"statement_type","type":"nvarchar(256)"},{"name":"feature_name","type":"nvarchar(128)","not_null":true},{"name":"feature_type_name","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_checkpoint_files","kind":"v","columns":[{"name":"container_id","type":"int","not_null":true},{"name":"container_guid","type":"uniqueidentifier","not_null":true},{"name":"checkpoint_file_id","type":"uniqueidentifier","not_null":true},{"name":"relative_file_path","type":"nvarchar(260)","not_null":true},{"name":"file_type","type":"smallint","not_null":true},{"name":"file_type_desc","type":"nvarchar(60)","not_null":true},{"name":"internal_storage_slot","type":"int"},{"name":"checkpoint_pair_file_id","type":"uniqueidentifier"},{"name":"file_size_in_bytes","type":"bigint","not_null":true},{"name":"file_size_used_in_bytes","type":"bigint"},{"name":"logical_row_count","type":"bigint"},{"name":"state","type":"smallint","not_null":true},{"name":"state_desc","type":"nvarchar(60)","not_null":true},{"name":"lower_bound_tsn","type":"bigint"},{"name":"upper_bound_tsn","type":"bigint"},{"name":"begin_checkpoint_id","type":"bigint"},{"name":"end_checkpoint_id","type":"bigint"},{"name":"last_updated_checkpoint_id","type":"bigint"},{"name":"encryption_status","type":"smallint"},{"name":"encryption_status_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_db_xtp_checkpoint_internals","kind":"v","columns":[{"name":"checkpoint_id","type":"bigint","not_null":true},{"name":"checkpoint_timestamp","type":"bigint"},{"name":"last_segment_lsn","type":"numeric(25,0)"},{"name":"recovery_lsn","type":"numeric(25,0)"},{"name":"is_synchronized","type":"bit"}]} +{"schema":"sys","name":"dm_db_xtp_checkpoint_stats","kind":"v","columns":[{"name":"last_lsn_processed","type":"numeric(25,0)"},{"name":"end_of_log_lsn","type":"numeric(25,0)"},{"name":"bytes_to_end_of_log","type":"bigint"},{"name":"log_consumption_rate","type":"bigint"},{"name":"active_scan_time_in_ms","type":"bigint"},{"name":"total_wait_time_in_ms","type":"bigint"},{"name":"waits_for_io_count","type":"bigint"},{"name":"io_wait_time_in_ms","type":"bigint"},{"name":"waits_for_new_log_count","type":"bigint"},{"name":"new_log_wait_time_in_ms","type":"bigint"},{"name":"idle_attempts_count","type":"bigint"},{"name":"tx_segments_dispatched_count","type":"bigint"},{"name":"segment_bytes_dispatched","type":"bigint"},{"name":"bytes_serialized","type":"bigint"},{"name":"serializer_user_time_in_ms","type":"bigint"},{"name":"serializer_kernel_time_in_ms","type":"bigint"},{"name":"xtp_log_bytes_consumed","type":"bigint"},{"name":"checkpoints_closed","type":"bigint"},{"name":"last_closed_checkpoint_ts","type":"bigint"},{"name":"hardened_recovery_lsn","type":"numeric(25,0)"},{"name":"hardened_root_file_guid","type":"uniqueidentifier"},{"name":"hardened_root_file_watermark","type":"bigint"},{"name":"hardened_truncation_lsn","type":"numeric(25,0)"},{"name":"log_bytes_since_last_close","type":"bigint"},{"name":"time_since_last_close_in_ms","type":"bigint"},{"name":"current_checkpoint_id","type":"bigint"},{"name":"current_checkpoint_segment_count","type":"bigint"},{"name":"recovery_lsn_candidate","type":"numeric(25,0)"},{"name":"outstanding_checkpoint_count","type":"bigint"},{"name":"closing_checkpoint_id","type":"bigint"},{"name":"recovery_checkpoint_id","type":"bigint"},{"name":"recovery_checkpoint_ts","type":"bigint"},{"name":"bootstrap_recovery_lsn","type":"numeric(25,0)"},{"name":"bootstrap_root_file_guid","type":"uniqueidentifier"},{"name":"internal_error_code","type":"bigint"},{"name":"tail_cache_page_count","type":"bigint"},{"name":"tail_cache_max_page_count","type":"bigint"},{"name":"tail_cache_min_needed_lsn","type":"numeric(25,0)"},{"name":"merge_outstanding_merges","type":"bigint"},{"name":"merge_stats_number_of_merges","type":"bigint"},{"name":"merge_stats_log_blocks_merged","type":"bigint"},{"name":"merge_stats_bytes_merged","type":"bigint"},{"name":"merge_stats_user_time","type":"bigint"},{"name":"merge_stats_kernel_time","type":"bigint"},{"name":"bytes_of_large_data_serialized","type":"bigint"},{"name":"closed_checkpoint_epoch_value","type":"bigint"},{"name":"db_in_checkpoint_only_mode","type":"bit"}]} +{"schema":"sys","name":"dm_db_xtp_gc_cycle_stats","kind":"v","columns":[{"name":"cycle_id","type":"bigint","not_null":true},{"name":"ticks_at_cycle_start","type":"bigint","not_null":true},{"name":"ticks_at_cycle_end","type":"bigint","not_null":true},{"name":"node_id","type":"int","not_null":true},{"name":"base_generation","type":"bigint","not_null":true},{"name":"xacts_copied_to_local","type":"bigint","not_null":true},{"name":"xacts_in_gen_0","type":"bigint","not_null":true},{"name":"xacts_in_gen_1","type":"bigint","not_null":true},{"name":"xacts_in_gen_2","type":"bigint","not_null":true},{"name":"xacts_in_gen_3","type":"bigint","not_null":true},{"name":"xacts_in_gen_4","type":"bigint","not_null":true},{"name":"xacts_in_gen_5","type":"bigint","not_null":true},{"name":"xacts_in_gen_6","type":"bigint","not_null":true},{"name":"xacts_in_gen_7","type":"bigint","not_null":true},{"name":"xacts_in_gen_8","type":"bigint","not_null":true},{"name":"xacts_in_gen_9","type":"bigint","not_null":true},{"name":"xacts_in_gen_10","type":"bigint","not_null":true},{"name":"xacts_in_gen_11","type":"bigint","not_null":true},{"name":"xacts_in_gen_12","type":"bigint","not_null":true},{"name":"xacts_in_gen_13","type":"bigint","not_null":true},{"name":"xacts_in_gen_14","type":"bigint","not_null":true},{"name":"xacts_in_gen_15","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_hash_index_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"total_bucket_count","type":"bigint","not_null":true},{"name":"empty_bucket_count","type":"bigint"},{"name":"avg_chain_length","type":"bigint","not_null":true},{"name":"max_chain_length","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_index_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"scans_started","type":"bigint","not_null":true},{"name":"scans_retries","type":"bigint","not_null":true},{"name":"rows_returned","type":"bigint","not_null":true},{"name":"rows_touched","type":"bigint","not_null":true},{"name":"rows_expiring","type":"bigint","not_null":true},{"name":"rows_expired","type":"bigint","not_null":true},{"name":"rows_expired_removed","type":"bigint","not_null":true},{"name":"phantom_scans_started","type":"bigint","not_null":true},{"name":"phantom_scans_retries","type":"bigint","not_null":true},{"name":"phantom_rows_touched","type":"bigint","not_null":true},{"name":"phantom_expiring_rows_encountered","type":"bigint","not_null":true},{"name":"phantom_expired_removed_rows_encountered","type":"bigint","not_null":true},{"name":"phantom_expired_rows_removed","type":"bigint","not_null":true},{"name":"object_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_memory_consumers","kind":"v","columns":[{"name":"memory_consumer_id","type":"bigint","not_null":true},{"name":"memory_consumer_type","type":"int","not_null":true},{"name":"memory_consumer_type_desc","type":"nvarchar(16)","not_null":true},{"name":"memory_consumer_desc","type":"nvarchar(64)"},{"name":"object_id","type":"int"},{"name":"xtp_object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"allocated_bytes","type":"bigint","not_null":true},{"name":"used_bytes","type":"bigint","not_null":true},{"name":"allocation_count","type":"bigint","not_null":true},{"name":"partition_count","type":"int","not_null":true},{"name":"sizeclass_count","type":"int","not_null":true},{"name":"min_sizeclass","type":"int","not_null":true},{"name":"max_sizeclass","type":"int","not_null":true},{"name":"memory_consumer_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_nonclustered_index_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"delta_pages","type":"bigint","not_null":true},{"name":"internal_pages","type":"bigint","not_null":true},{"name":"leaf_pages","type":"bigint","not_null":true},{"name":"outstanding_retired_nodes","type":"bigint","not_null":true},{"name":"page_update_count","type":"bigint","not_null":true},{"name":"page_update_retry_count","type":"bigint","not_null":true},{"name":"page_consolidation_count","type":"bigint","not_null":true},{"name":"page_consolidation_retry_count","type":"bigint","not_null":true},{"name":"page_split_count","type":"bigint","not_null":true},{"name":"page_split_retry_count","type":"bigint","not_null":true},{"name":"key_split_count","type":"bigint","not_null":true},{"name":"key_split_retry_count","type":"bigint","not_null":true},{"name":"page_merge_count","type":"bigint","not_null":true},{"name":"page_merge_retry_count","type":"bigint","not_null":true},{"name":"key_merge_count","type":"bigint","not_null":true},{"name":"key_merge_retry_count","type":"bigint","not_null":true},{"name":"uses_key_normalization","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_object_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"row_insert_attempts","type":"bigint","not_null":true},{"name":"row_update_attempts","type":"bigint","not_null":true},{"name":"row_delete_attempts","type":"bigint","not_null":true},{"name":"write_conflicts","type":"bigint","not_null":true},{"name":"unique_constraint_violations","type":"bigint","not_null":true},{"name":"object_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_table_memory_stats","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"memory_allocated_for_table_kb","type":"bigint"},{"name":"memory_used_by_table_kb","type":"bigint"},{"name":"memory_allocated_for_indexes_kb","type":"bigint"},{"name":"memory_used_by_indexes_kb","type":"bigint"}]} +{"schema":"sys","name":"dm_db_xtp_transactions","kind":"v","columns":[{"name":"node_id","type":"smallint","not_null":true},{"name":"xtp_transaction_id","type":"bigint","not_null":true},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"session_id","type":"smallint","not_null":true},{"name":"begin_tsn","type":"bigint","not_null":true},{"name":"end_tsn","type":"bigint","not_null":true},{"name":"state","type":"int","not_null":true},{"name":"state_desc","type":"nvarchar(16)","not_null":true},{"name":"result","type":"int","not_null":true},{"name":"result_desc","type":"nvarchar(24)","not_null":true},{"name":"xtp_parent_transaction_node_id","type":"smallint","not_null":true},{"name":"xtp_parent_transaction_id","type":"bigint","not_null":true},{"name":"last_error","type":"int","not_null":true},{"name":"is_speculative","type":"bit","not_null":true},{"name":"is_prepared","type":"bit","not_null":true},{"name":"is_delayed_durability","type":"bit","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"database_address","type":"varbinary(8)","not_null":true},{"name":"thread_id","type":"int","not_null":true},{"name":"read_set_row_count","type":"int","not_null":true},{"name":"write_set_row_count","type":"int","not_null":true},{"name":"scan_set_count","type":"int","not_null":true},{"name":"savepoint_garbage_count","type":"int","not_null":true},{"name":"log_bytes_required","type":"bigint","not_null":true},{"name":"count_of_allocations","type":"int","not_null":true},{"name":"allocated_bytes","type":"int","not_null":true},{"name":"reserved_bytes","type":"int","not_null":true},{"name":"commit_dependency_count","type":"int","not_null":true},{"name":"commit_dependency_total_attempt_count","type":"int","not_null":true},{"name":"scan_area","type":"int","not_null":true},{"name":"scan_area_desc","type":"nvarchar(16)","not_null":true},{"name":"scan_location","type":"int","not_null":true},{"name":"dependent_1_address","type":"varbinary(8)","not_null":true},{"name":"dependent_2_address","type":"varbinary(8)","not_null":true},{"name":"dependent_3_address","type":"varbinary(8)","not_null":true},{"name":"dependent_4_address","type":"varbinary(8)","not_null":true},{"name":"dependent_5_address","type":"varbinary(8)","not_null":true},{"name":"dependent_6_address","type":"varbinary(8)","not_null":true},{"name":"dependent_7_address","type":"varbinary(8)","not_null":true},{"name":"dependent_8_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_undeploy_status","kind":"v","columns":[{"name":"deployment_state","type":"int","not_null":true},{"name":"deployment_state_desc","type":"nvarchar(60)","not_null":true},{"name":"undeploy_lsn","type":"numeric(25,0)"},{"name":"start_of_log_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"dm_dist_requests","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"dist_statement_hash","type":"binary(8)"},{"name":"dist_statement_id","type":"uniqueidentifier"},{"name":"dist_client_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_distributed_exchange_stats","kind":"v","columns":[{"name":"request_id","type":"nvarchar(32)"},{"name":"step_index","type":"int","not_null":true},{"name":"dms_step_index","type":"int"},{"name":"source_distribution_id","type":"int","not_null":true},{"name":"destination_distribution_id","type":"int"},{"name":"type","type":"nvarchar(32)"},{"name":"status","type":"nvarchar(32)"},{"name":"bytes_per_sec","type":"bigint","not_null":true},{"name":"bytes_processed","type":"bigint","not_null":true},{"name":"rows_processed","type":"bigint","not_null":true},{"name":"start_time","type":"datetime","not_null":true},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int","not_null":true},{"name":"cpu_time","type":"bigint"},{"name":"query_time","type":"int","not_null":true},{"name":"buffers_available","type":"int"},{"name":"sql_spid","type":"int","not_null":true},{"name":"dms_cpid","type":"int"},{"name":"error_id","type":"nvarchar(36)"},{"name":"source_info","type":"nvarchar(4000)"},{"name":"destination_info","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_dw_databases","kind":"v","columns":[{"name":"logical_database_id","type":"uniqueidentifier","not_null":true},{"name":"logical_db_name","type":"nvarchar(129)"},{"name":"database_type","type":"nvarchar(100)"},{"name":"sync_point","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_dw_pit_databases","kind":"v","columns":[{"name":"logical_database_id","type":"uniqueidentifier"},{"name":"sql_db_id","type":"smallint","not_null":true},{"name":"pit_key","type":"nvarchar(4000)"},{"name":"pit_db_name","type":"nvarchar(129)"},{"name":"database_type","type":"nvarchar(100)"}]} +{"schema":"sys","name":"dm_dw_quality_clustering","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_id","type":"bigint"},{"name":"total_row_groups_analyzed","type":"bigint"},{"name":"max_overlap","type":"bigint"},{"name":"total_overlap","type":"bigint"},{"name":"total_cell_count","type":"smallint"},{"name":"quality","type":"float"},{"name":"unit_of_work","type":"bigint"}]} +{"schema":"sys","name":"dm_dw_quality_delta","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_id","type":"bigint"},{"name":"total_rows_analyzed","type":"bigint"},{"name":"quality","type":"float"},{"name":"unit_of_work","type":"bigint"}]} +{"schema":"sys","name":"dm_dw_quality_index","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_id","type":"bigint"},{"name":"overall_quality","type":"float"},{"name":"clustering_quality","type":"float"},{"name":"delta_quality","type":"float"},{"name":"row_group_quality","type":"float"},{"name":"unit_of_work","type":"bigint"}]} +{"schema":"sys","name":"dm_dw_quality_row_group","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_id","type":"bigint"},{"name":"total_row_groups_analyzed","type":"bigint"},{"name":"total_poor_row_groups_analyzed","type":"bigint"},{"name":"average_rows","type":"float"},{"name":"quality","type":"float"},{"name":"unit_of_work","type":"bigint"}]} +{"schema":"sys","name":"dm_dw_resource_manager_abort_cache","kind":"v","columns":[{"name":"asn","type":"bigint","not_null":true},{"name":"bsn","type":"bigint","not_null":true},{"name":"nested_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_dw_resource_manager_active_tran","kind":"v","columns":[{"name":"read_version","type":"bigint","not_null":true},{"name":"write_version","type":"bigint","not_null":true},{"name":"nested_id","type":"bigint","not_null":true},{"name":"current_read_version","type":"bigint","not_null":true},{"name":"is_pit","type":"tinyint","not_null":true},{"name":"txn_type","type":"tinyint","not_null":true},{"name":"txn_tag","type":"tinyint","not_null":true},{"name":"is_txn_owner","type":"tinyint","not_null":true},{"name":"ddl_step","type":"smallint","not_null":true}]} +{"schema":"sys","name":"dm_dw_tran_manager_abort_cache","kind":"v","columns":[{"name":"asn","type":"bigint","not_null":true},{"name":"bsn","type":"bigint","not_null":true},{"name":"nested_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_dw_tran_manager_active_cache","kind":"v","columns":[{"name":"bsn","type":"bigint","not_null":true},{"name":"tag","type":"tinyint","not_null":true},{"name":"resource_manager_id","type":"uniqueidentifier","not_null":true}]} +{"schema":"sys","name":"dm_dw_tran_manager_commit_cache","kind":"v","columns":[{"name":"bsn","type":"bigint","not_null":true},{"name":"csn","type":"bigint","not_null":true},{"name":"min_active_bsn","type":"bigint","not_null":true},{"name":"tag","type":"tinyint","not_null":true},{"name":"state","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"dm_exec_background_job_queue","kind":"v","columns":[{"name":"time_queued","type":"datetime","not_null":true},{"name":"job_id","type":"int","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"object_id1","type":"int","not_null":true},{"name":"object_id2","type":"int","not_null":true},{"name":"object_id3","type":"int","not_null":true},{"name":"object_id4","type":"int","not_null":true},{"name":"error_code","type":"int"},{"name":"request_type","type":"smallint","not_null":true},{"name":"retry_count","type":"smallint","not_null":true},{"name":"in_progress","type":"smallint","not_null":true},{"name":"session_id","type":"smallint"}]} +{"schema":"sys","name":"dm_exec_background_job_queue_stats","kind":"v","columns":[{"name":"queue_max_len","type":"int","not_null":true},{"name":"enqueued_count","type":"int","not_null":true},{"name":"started_count","type":"int","not_null":true},{"name":"ended_count","type":"int","not_null":true},{"name":"failed_lock_count","type":"int","not_null":true},{"name":"failed_other_count","type":"int","not_null":true},{"name":"failed_giveup_count","type":"int","not_null":true},{"name":"enqueue_failed_full_count","type":"int","not_null":true},{"name":"enqueue_failed_duplicate_count","type":"int","not_null":true},{"name":"elapsed_avg_ms","type":"int","not_null":true},{"name":"elapsed_max_ms","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_cached_plans","kind":"v","columns":[{"name":"bucketid","type":"int","not_null":true},{"name":"refcounts","type":"int","not_null":true},{"name":"usecounts","type":"int","not_null":true},{"name":"size_in_bytes","type":"int","not_null":true},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"cacheobjtype","type":"nvarchar(50)","not_null":true},{"name":"objtype","type":"nvarchar(20)","not_null":true},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"pool_id","type":"int","not_null":true},{"name":"parent_plan_handle","type":"varbinary(64)"}]} +{"schema":"sys","name":"dm_exec_ce_feedback_cache","kind":"v","columns":[{"name":"database_id","type":"bigint","not_null":true},{"name":"fingerprint","type":"varbinary(8)","not_null":true},{"name":"feedback","type":"varbinary(8)","not_null":true},{"name":"observed_count","type":"bigint","not_null":true},{"name":"state","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_compute_node_errors","kind":"v","columns":[{"name":"error_id","type":"nvarchar(36)"},{"name":"source","type":"nvarchar(255)"},{"name":"type","type":"nvarchar(255)"},{"name":"create_time","type":"datetime"},{"name":"compute_node_id","type":"int"},{"name":"execution_id","type":"nvarchar(36)"},{"name":"spid","type":"int"},{"name":"thread_id","type":"int"},{"name":"details","type":"nvarchar(4000)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_compute_node_status","kind":"v","columns":[{"name":"compute_node_id","type":"int"},{"name":"process_id","type":"int"},{"name":"process_name","type":"nvarchar(255)"},{"name":"allocated_memory","type":"bigint"},{"name":"available_memory","type":"bigint"},{"name":"process_cpu_usage","type":"bigint"},{"name":"total_cpu_usage","type":"bigint"},{"name":"thread_count","type":"bigint"},{"name":"handle_count","type":"bigint"},{"name":"total_elapsed_time","type":"bigint"},{"name":"is_available","type":"bit"},{"name":"sent_time","type":"datetime"},{"name":"received_time","type":"datetime"},{"name":"error_id","type":"nvarchar(36)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_compute_nodes","kind":"v","columns":[{"name":"compute_node_id","type":"int"},{"name":"type","type":"nvarchar(32)"},{"name":"name","type":"nvarchar(32)"},{"name":"address","type":"nvarchar(32)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_compute_pools","kind":"v","columns":[{"name":"compute_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)"},{"name":"location","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_exec_connections","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"most_recent_session_id","type":"int"},{"name":"connect_time","type":"datetime","not_null":true},{"name":"net_transport","type":"nvarchar(40)","not_null":true},{"name":"protocol_type","type":"nvarchar(40)"},{"name":"protocol_version","type":"int"},{"name":"endpoint_id","type":"int"},{"name":"encrypt_option","type":"nvarchar(40)","not_null":true},{"name":"auth_scheme","type":"nvarchar(40)","not_null":true},{"name":"node_affinity","type":"smallint","not_null":true},{"name":"num_reads","type":"int"},{"name":"num_writes","type":"int"},{"name":"last_read","type":"datetime"},{"name":"last_write","type":"datetime"},{"name":"net_packet_size","type":"int"},{"name":"client_net_address","type":"nvarchar(48)"},{"name":"client_tcp_port","type":"int"},{"name":"local_net_address","type":"nvarchar(48)"},{"name":"local_tcp_port","type":"int"},{"name":"connection_id","type":"uniqueidentifier","not_null":true},{"name":"parent_connection_id","type":"uniqueidentifier"},{"name":"most_recent_sql_handle","type":"varbinary(64)"}]} +{"schema":"sys","name":"dm_exec_distributed_request_steps","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"operation_type","type":"nvarchar(128)"},{"name":"distribution_type","type":"nvarchar(32)"},{"name":"location_type","type":"nvarchar(32)"},{"name":"status","type":"nvarchar(32)"},{"name":"error_id","type":"nvarchar(36)"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"row_count","type":"bigint"},{"name":"command","type":"nvarchar(4000)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_distributed_requests","kind":"v","columns":[{"name":"sql_handle","type":"varbinary(64)"},{"name":"execution_id","type":"nvarchar(32)"},{"name":"status","type":"nvarchar(32)"},{"name":"error_id","type":"nvarchar(36)"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_distributed_sql_requests","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"compute_node_id","type":"int"},{"name":"distribution_id","type":"int"},{"name":"status","type":"nvarchar(32)"},{"name":"error_id","type":"nvarchar(36)"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"row_count","type":"bigint"},{"name":"spid","type":"int"},{"name":"command","type":"nvarchar(4000)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_distributed_tasks","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"start_time","type":"datetime","not_null":true},{"name":"cpu_time","type":"int","not_null":true},{"name":"total_elapsed_time","type":"int","not_null":true},{"name":"distributed_statement_id","type":"nvarchar(38)"},{"name":"distributed_query_hash","type":"nvarchar(38)"},{"name":"distributed_request_id","type":"nvarchar(38)"},{"name":"distributed_scheduler_id","type":"nvarchar(38)"},{"name":"distributed_query_operator_id","type":"nvarchar(38)"},{"name":"distributed_task_group_id","type":"nvarchar(38)"},{"name":"distributed_execution_id","type":"nvarchar(38)"},{"name":"distributed_submission_id","type":"nvarchar(38)"}]} +{"schema":"sys","name":"dm_exec_dms_services","kind":"v","columns":[{"name":"dms_core_id","type":"int"},{"name":"compute_node_id","type":"int"},{"name":"status","type":"nvarchar(32)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_dms_workers","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"dms_step_index","type":"int"},{"name":"compute_node_id","type":"int"},{"name":"distribution_id","type":"int"},{"name":"type","type":"nvarchar(32)"},{"name":"status","type":"nvarchar(32)"},{"name":"bytes_per_sec","type":"bigint"},{"name":"bytes_processed","type":"bigint"},{"name":"rows_processed","type":"bigint"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"cpu_time","type":"bigint"},{"name":"query_time","type":"int"},{"name":"buffers_available","type":"int"},{"name":"dms_cpid","type":"int"},{"name":"sql_spid","type":"int"},{"name":"error_id","type":"nvarchar(36)"},{"name":"source_info","type":"nvarchar(4000)"},{"name":"destination_info","type":"nvarchar(4000)"},{"name":"command","type":"nvarchar(4000)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_external_operations","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"operation_type","type":"nvarchar(128)"},{"name":"operation_name","type":"nvarchar(4000)"},{"name":"map_progress","type":"float"},{"name":"reduce_progress","type":"float"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_external_work","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"dms_step_index","type":"int"},{"name":"work_id","type":"int"},{"name":"compute_node_id","type":"int"},{"name":"type","type":"nvarchar(60)"},{"name":"input_name","type":"nvarchar(4000)"},{"name":"read_location","type":"bigint"},{"name":"read_command","type":"nvarchar(4000)"},{"name":"bytes_processed","type":"bigint"},{"name":"length","type":"bigint"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"status","type":"nvarchar(32)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_function_stats","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"sql_handle","type":"varbinary(64)","not_null":true},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"cached_time","type":"datetime"},{"name":"last_execution_time","type":"datetime"},{"name":"execution_count","type":"bigint","not_null":true},{"name":"total_worker_time","type":"bigint","not_null":true},{"name":"last_worker_time","type":"bigint","not_null":true},{"name":"min_worker_time","type":"bigint","not_null":true},{"name":"max_worker_time","type":"bigint","not_null":true},{"name":"total_physical_reads","type":"bigint","not_null":true},{"name":"last_physical_reads","type":"bigint","not_null":true},{"name":"min_physical_reads","type":"bigint","not_null":true},{"name":"max_physical_reads","type":"bigint","not_null":true},{"name":"total_logical_writes","type":"bigint","not_null":true},{"name":"last_logical_writes","type":"bigint","not_null":true},{"name":"min_logical_writes","type":"bigint","not_null":true},{"name":"max_logical_writes","type":"bigint","not_null":true},{"name":"total_logical_reads","type":"bigint","not_null":true},{"name":"last_logical_reads","type":"bigint","not_null":true},{"name":"min_logical_reads","type":"bigint","not_null":true},{"name":"max_logical_reads","type":"bigint","not_null":true},{"name":"total_elapsed_time","type":"bigint","not_null":true},{"name":"last_elapsed_time","type":"bigint","not_null":true},{"name":"min_elapsed_time","type":"bigint","not_null":true},{"name":"max_elapsed_time","type":"bigint","not_null":true},{"name":"total_num_physical_reads","type":"bigint","not_null":true},{"name":"last_num_physical_reads","type":"bigint","not_null":true},{"name":"min_num_physical_reads","type":"bigint","not_null":true},{"name":"max_num_physical_reads","type":"bigint","not_null":true},{"name":"total_page_server_reads","type":"bigint","not_null":true},{"name":"last_page_server_reads","type":"bigint","not_null":true},{"name":"min_page_server_reads","type":"bigint","not_null":true},{"name":"max_page_server_reads","type":"bigint","not_null":true},{"name":"total_num_page_server_reads","type":"bigint","not_null":true},{"name":"last_num_page_server_reads","type":"bigint","not_null":true},{"name":"min_num_page_server_reads","type":"bigint","not_null":true},{"name":"max_num_page_server_reads","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_procedure_stats","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"sql_handle","type":"varbinary(64)","not_null":true},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"cached_time","type":"datetime"},{"name":"last_execution_time","type":"datetime"},{"name":"execution_count","type":"bigint","not_null":true},{"name":"total_worker_time","type":"bigint","not_null":true},{"name":"last_worker_time","type":"bigint","not_null":true},{"name":"min_worker_time","type":"bigint","not_null":true},{"name":"max_worker_time","type":"bigint","not_null":true},{"name":"total_physical_reads","type":"bigint","not_null":true},{"name":"last_physical_reads","type":"bigint","not_null":true},{"name":"min_physical_reads","type":"bigint","not_null":true},{"name":"max_physical_reads","type":"bigint","not_null":true},{"name":"total_logical_writes","type":"bigint","not_null":true},{"name":"last_logical_writes","type":"bigint","not_null":true},{"name":"min_logical_writes","type":"bigint","not_null":true},{"name":"max_logical_writes","type":"bigint","not_null":true},{"name":"total_logical_reads","type":"bigint","not_null":true},{"name":"last_logical_reads","type":"bigint","not_null":true},{"name":"min_logical_reads","type":"bigint","not_null":true},{"name":"max_logical_reads","type":"bigint","not_null":true},{"name":"total_elapsed_time","type":"bigint","not_null":true},{"name":"last_elapsed_time","type":"bigint","not_null":true},{"name":"min_elapsed_time","type":"bigint","not_null":true},{"name":"max_elapsed_time","type":"bigint","not_null":true},{"name":"total_spills","type":"bigint"},{"name":"last_spills","type":"bigint"},{"name":"min_spills","type":"bigint"},{"name":"max_spills","type":"bigint"},{"name":"total_num_physical_reads","type":"bigint","not_null":true},{"name":"last_num_physical_reads","type":"bigint","not_null":true},{"name":"min_num_physical_reads","type":"bigint","not_null":true},{"name":"max_num_physical_reads","type":"bigint","not_null":true},{"name":"total_page_server_reads","type":"bigint","not_null":true},{"name":"last_page_server_reads","type":"bigint","not_null":true},{"name":"min_page_server_reads","type":"bigint","not_null":true},{"name":"max_page_server_reads","type":"bigint","not_null":true},{"name":"total_num_page_server_reads","type":"bigint","not_null":true},{"name":"last_num_page_server_reads","type":"bigint","not_null":true},{"name":"min_num_page_server_reads","type":"bigint","not_null":true},{"name":"max_num_page_server_reads","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_query_memory_grants","kind":"v","columns":[{"name":"session_id","type":"smallint"},{"name":"request_id","type":"int"},{"name":"scheduler_id","type":"int"},{"name":"dop","type":"smallint"},{"name":"request_time","type":"datetime"},{"name":"grant_time","type":"datetime"},{"name":"requested_memory_kb","type":"bigint"},{"name":"granted_memory_kb","type":"bigint"},{"name":"required_memory_kb","type":"bigint"},{"name":"used_memory_kb","type":"bigint"},{"name":"max_used_memory_kb","type":"bigint"},{"name":"query_cost","type":"float"},{"name":"timeout_sec","type":"int"},{"name":"resource_semaphore_id","type":"smallint"},{"name":"queue_id","type":"smallint"},{"name":"wait_order","type":"int"},{"name":"is_next_candidate","type":"bit"},{"name":"wait_time_ms","type":"bigint"},{"name":"plan_handle","type":"varbinary(64)"},{"name":"sql_handle","type":"varbinary(64)"},{"name":"group_id","type":"int"},{"name":"pool_id","type":"int"},{"name":"is_small","type":"bit"},{"name":"ideal_memory_kb","type":"bigint"},{"name":"reserved_worker_count","type":"int"},{"name":"used_worker_count","type":"int"},{"name":"max_used_worker_count","type":"int"},{"name":"reserved_node_bitmap","type":"bigint"},{"name":"query_hash","type":"binary(8)"},{"name":"query_plan_hash","type":"binary(8)"}]} +{"schema":"sys","name":"dm_exec_query_optimizer_info","kind":"v","columns":[{"name":"counter","type":"nvarchar(4000)","not_null":true},{"name":"occurrence","type":"bigint","not_null":true},{"name":"value","type":"float"}]} +{"schema":"sys","name":"dm_exec_query_optimizer_memory_gateways","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"max_count","type":"int","not_null":true},{"name":"active_count","type":"int","not_null":true},{"name":"waiter_count","type":"int","not_null":true},{"name":"threshold_factor","type":"bigint","not_null":true},{"name":"threshold","type":"bigint","not_null":true},{"name":"is_active","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_exec_query_parallel_workers","kind":"v","columns":[{"name":"node_id","type":"int","not_null":true},{"name":"scheduler_count","type":"int","not_null":true},{"name":"max_worker_count","type":"int","not_null":true},{"name":"reserved_worker_count","type":"int","not_null":true},{"name":"free_worker_count","type":"int","not_null":true},{"name":"used_worker_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_query_profiles","kind":"v","columns":[{"name":"session_id","type":"smallint"},{"name":"request_id","type":"int"},{"name":"sql_handle","type":"varbinary(64)"},{"name":"plan_handle","type":"varbinary(64)"},{"name":"physical_operator_name","type":"nvarchar(256)"},{"name":"node_id","type":"int"},{"name":"thread_id","type":"int"},{"name":"task_address","type":"varbinary(8)","not_null":true},{"name":"row_count","type":"bigint"},{"name":"rewind_count","type":"bigint"},{"name":"rebind_count","type":"bigint"},{"name":"end_of_scan_count","type":"bigint"},{"name":"estimate_row_count","type":"bigint"},{"name":"first_active_time","type":"bigint"},{"name":"last_active_time","type":"bigint"},{"name":"open_time","type":"bigint"},{"name":"first_row_time","type":"bigint"},{"name":"last_row_time","type":"bigint"},{"name":"close_time","type":"bigint"},{"name":"elapsed_time_ms","type":"bigint"},{"name":"cpu_time_ms","type":"bigint"},{"name":"database_id","type":"smallint"},{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"scan_count","type":"bigint"},{"name":"logical_read_count","type":"bigint"},{"name":"physical_read_count","type":"bigint"},{"name":"read_ahead_count","type":"bigint"},{"name":"write_page_count","type":"bigint"},{"name":"lob_logical_read_count","type":"bigint"},{"name":"lob_physical_read_count","type":"bigint"},{"name":"lob_read_ahead_count","type":"bigint"},{"name":"segment_read_count","type":"int"},{"name":"segment_skip_count","type":"int"},{"name":"actual_read_row_count","type":"bigint"},{"name":"estimated_read_row_count","type":"bigint"},{"name":"page_server_read_count","type":"bigint"},{"name":"page_server_read_ahead_count","type":"bigint"},{"name":"lob_page_server_read_count","type":"bigint"},{"name":"lob_page_server_read_ahead_count","type":"bigint"},{"name":"row_requalification_count","type":"bigint"}]} +{"schema":"sys","name":"dm_exec_query_resource_semaphores","kind":"v","columns":[{"name":"resource_semaphore_id","type":"smallint"},{"name":"target_memory_kb","type":"bigint"},{"name":"max_target_memory_kb","type":"bigint"},{"name":"total_memory_kb","type":"bigint"},{"name":"available_memory_kb","type":"bigint"},{"name":"granted_memory_kb","type":"bigint"},{"name":"used_memory_kb","type":"bigint"},{"name":"grantee_count","type":"int"},{"name":"waiter_count","type":"int"},{"name":"timeout_error_count","type":"bigint"},{"name":"forced_grant_count","type":"bigint"},{"name":"pool_id","type":"int"}]} +{"schema":"sys","name":"dm_exec_query_stats","kind":"v","columns":[{"name":"sql_handle","type":"varbinary(64)","not_null":true},{"name":"statement_start_offset","type":"int","not_null":true},{"name":"statement_end_offset","type":"int","not_null":true},{"name":"plan_generation_num","type":"bigint"},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"creation_time","type":"datetime"},{"name":"last_execution_time","type":"datetime"},{"name":"execution_count","type":"bigint","not_null":true},{"name":"total_worker_time","type":"bigint","not_null":true},{"name":"last_worker_time","type":"bigint","not_null":true},{"name":"min_worker_time","type":"bigint","not_null":true},{"name":"max_worker_time","type":"bigint","not_null":true},{"name":"total_physical_reads","type":"bigint","not_null":true},{"name":"last_physical_reads","type":"bigint","not_null":true},{"name":"min_physical_reads","type":"bigint","not_null":true},{"name":"max_physical_reads","type":"bigint","not_null":true},{"name":"total_logical_writes","type":"bigint","not_null":true},{"name":"last_logical_writes","type":"bigint","not_null":true},{"name":"min_logical_writes","type":"bigint","not_null":true},{"name":"max_logical_writes","type":"bigint","not_null":true},{"name":"total_logical_reads","type":"bigint","not_null":true},{"name":"last_logical_reads","type":"bigint","not_null":true},{"name":"min_logical_reads","type":"bigint","not_null":true},{"name":"max_logical_reads","type":"bigint","not_null":true},{"name":"total_clr_time","type":"bigint","not_null":true},{"name":"last_clr_time","type":"bigint","not_null":true},{"name":"min_clr_time","type":"bigint","not_null":true},{"name":"max_clr_time","type":"bigint","not_null":true},{"name":"total_elapsed_time","type":"bigint","not_null":true},{"name":"last_elapsed_time","type":"bigint","not_null":true},{"name":"min_elapsed_time","type":"bigint","not_null":true},{"name":"max_elapsed_time","type":"bigint","not_null":true},{"name":"query_hash","type":"binary(8)"},{"name":"query_plan_hash","type":"binary(8)"},{"name":"total_rows","type":"bigint"},{"name":"last_rows","type":"bigint"},{"name":"min_rows","type":"bigint"},{"name":"max_rows","type":"bigint"},{"name":"statement_sql_handle","type":"varbinary(64)"},{"name":"statement_context_id","type":"bigint"},{"name":"total_dop","type":"bigint"},{"name":"last_dop","type":"bigint"},{"name":"min_dop","type":"bigint"},{"name":"max_dop","type":"bigint"},{"name":"total_grant_kb","type":"bigint"},{"name":"last_grant_kb","type":"bigint"},{"name":"min_grant_kb","type":"bigint"},{"name":"max_grant_kb","type":"bigint"},{"name":"total_used_grant_kb","type":"bigint"},{"name":"last_used_grant_kb","type":"bigint"},{"name":"min_used_grant_kb","type":"bigint"},{"name":"max_used_grant_kb","type":"bigint"},{"name":"total_ideal_grant_kb","type":"bigint"},{"name":"last_ideal_grant_kb","type":"bigint"},{"name":"min_ideal_grant_kb","type":"bigint"},{"name":"max_ideal_grant_kb","type":"bigint"},{"name":"total_reserved_threads","type":"bigint"},{"name":"last_reserved_threads","type":"bigint"},{"name":"min_reserved_threads","type":"bigint"},{"name":"max_reserved_threads","type":"bigint"},{"name":"total_used_threads","type":"bigint"},{"name":"last_used_threads","type":"bigint"},{"name":"min_used_threads","type":"bigint"},{"name":"max_used_threads","type":"bigint"},{"name":"total_columnstore_segment_reads","type":"bigint"},{"name":"last_columnstore_segment_reads","type":"bigint"},{"name":"min_columnstore_segment_reads","type":"bigint"},{"name":"max_columnstore_segment_reads","type":"bigint"},{"name":"total_columnstore_segment_skips","type":"bigint"},{"name":"last_columnstore_segment_skips","type":"bigint"},{"name":"min_columnstore_segment_skips","type":"bigint"},{"name":"max_columnstore_segment_skips","type":"bigint"},{"name":"total_spills","type":"bigint"},{"name":"last_spills","type":"bigint"},{"name":"min_spills","type":"bigint"},{"name":"max_spills","type":"bigint"},{"name":"total_num_physical_reads","type":"bigint","not_null":true},{"name":"last_num_physical_reads","type":"bigint","not_null":true},{"name":"min_num_physical_reads","type":"bigint","not_null":true},{"name":"max_num_physical_reads","type":"bigint","not_null":true},{"name":"total_page_server_reads","type":"bigint","not_null":true},{"name":"last_page_server_reads","type":"bigint","not_null":true},{"name":"min_page_server_reads","type":"bigint","not_null":true},{"name":"max_page_server_reads","type":"bigint","not_null":true},{"name":"total_num_page_server_reads","type":"bigint","not_null":true},{"name":"last_num_page_server_reads","type":"bigint","not_null":true},{"name":"min_num_page_server_reads","type":"bigint","not_null":true},{"name":"max_num_page_server_reads","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_query_transformation_stats","kind":"v","columns":[{"name":"name","type":"varchar(8000)","not_null":true},{"name":"promise_total","type":"bigint","not_null":true},{"name":"promise_avg","type":"float","not_null":true},{"name":"promised","type":"bigint","not_null":true},{"name":"built_substitute","type":"bigint","not_null":true},{"name":"succeeded","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_requests","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"start_time","type":"datetime","not_null":true},{"name":"status","type":"nvarchar(30)","not_null":true},{"name":"command","type":"nvarchar(32)","not_null":true},{"name":"sql_handle","type":"varbinary(64)"},{"name":"statement_start_offset","type":"int"},{"name":"statement_end_offset","type":"int"},{"name":"plan_handle","type":"varbinary(64)"},{"name":"database_id","type":"smallint","not_null":true},{"name":"user_id","type":"int","not_null":true},{"name":"connection_id","type":"uniqueidentifier"},{"name":"blocking_session_id","type":"smallint"},{"name":"wait_type","type":"nvarchar(60)"},{"name":"wait_time","type":"int","not_null":true},{"name":"last_wait_type","type":"nvarchar(60)","not_null":true},{"name":"wait_resource","type":"nvarchar(256)","not_null":true},{"name":"open_transaction_count","type":"int","not_null":true},{"name":"open_resultset_count","type":"int","not_null":true},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"context_info","type":"varbinary(128)"},{"name":"percent_complete","type":"real","not_null":true},{"name":"estimated_completion_time","type":"bigint","not_null":true},{"name":"cpu_time","type":"int","not_null":true},{"name":"total_elapsed_time","type":"int","not_null":true},{"name":"scheduler_id","type":"int"},{"name":"task_address","type":"varbinary(8)"},{"name":"reads","type":"bigint","not_null":true},{"name":"writes","type":"bigint","not_null":true},{"name":"logical_reads","type":"bigint","not_null":true},{"name":"text_size","type":"int","not_null":true},{"name":"language","type":"nvarchar(128)"},{"name":"date_format","type":"nvarchar(3)"},{"name":"date_first","type":"smallint","not_null":true},{"name":"quoted_identifier","type":"bit","not_null":true},{"name":"arithabort","type":"bit","not_null":true},{"name":"ansi_null_dflt_on","type":"bit","not_null":true},{"name":"ansi_defaults","type":"bit","not_null":true},{"name":"ansi_warnings","type":"bit","not_null":true},{"name":"ansi_padding","type":"bit","not_null":true},{"name":"ansi_nulls","type":"bit","not_null":true},{"name":"concat_null_yields_null","type":"bit","not_null":true},{"name":"transaction_isolation_level","type":"smallint","not_null":true},{"name":"lock_timeout","type":"int","not_null":true},{"name":"deadlock_priority","type":"int","not_null":true},{"name":"row_count","type":"bigint","not_null":true},{"name":"prev_error","type":"int","not_null":true},{"name":"nest_level","type":"int","not_null":true},{"name":"granted_query_memory","type":"int","not_null":true},{"name":"executing_managed_code","type":"bit","not_null":true},{"name":"group_id","type":"int","not_null":true},{"name":"query_hash","type":"binary(8)"},{"name":"query_plan_hash","type":"binary(8)"},{"name":"statement_sql_handle","type":"varbinary(64)"},{"name":"statement_context_id","type":"bigint"},{"name":"dop","type":"int","not_null":true},{"name":"parallel_worker_count","type":"int"},{"name":"external_script_request_id","type":"uniqueidentifier"},{"name":"is_resumable","type":"bit","not_null":true},{"name":"page_resource","type":"varbinary(8)"},{"name":"page_server_reads","type":"bigint","not_null":true},{"name":"dist_statement_id","type":"uniqueidentifier"},{"name":"label","type":"nvarchar(255)"}]} +{"schema":"sys","name":"dm_exec_requests_history","kind":"v","columns":[{"name":"status","type":"varchar(9)","not_null":true},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"distributed_statement_id","type":"nvarchar(128)","not_null":true},{"name":"query_hash","type":"binary(8)","not_null":true},{"name":"login_name","type":"nvarchar(644)"},{"name":"start_time","type":"datetime2(7)","not_null":true},{"name":"end_time","type":"datetime2(7)","not_null":true},{"name":"command","type":"nvarchar(4000)"},{"name":"query_text","type":"nvarchar(max)"},{"name":"total_elapsed_time_ms","type":"bigint"},{"name":"data_processed_mb","type":"bigint","not_null":true},{"name":"error","type":"nvarchar(max)"},{"name":"error_code","type":"int"},{"name":"rejected_rows_path","type":"nvarchar(max)"}]} +{"schema":"sys","name":"dm_exec_session_wait_stats","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"wait_type","type":"nvarchar(60)","not_null":true},{"name":"waiting_tasks_count","type":"bigint","not_null":true},{"name":"wait_time_ms","type":"bigint","not_null":true},{"name":"max_wait_time_ms","type":"bigint","not_null":true},{"name":"signal_wait_time_ms","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_sessions","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"login_time","type":"datetime","not_null":true},{"name":"host_name","type":"nvarchar(128)"},{"name":"program_name","type":"nvarchar(128)"},{"name":"host_process_id","type":"int"},{"name":"client_version","type":"int"},{"name":"client_interface_name","type":"nvarchar(32)"},{"name":"security_id","type":"varbinary(85)","not_null":true},{"name":"login_name","type":"nvarchar(128)","not_null":true},{"name":"nt_domain","type":"nvarchar(128)"},{"name":"nt_user_name","type":"nvarchar(128)"},{"name":"status","type":"nvarchar(30)","not_null":true},{"name":"context_info","type":"varbinary(128)"},{"name":"cpu_time","type":"int","not_null":true},{"name":"memory_usage","type":"int","not_null":true},{"name":"total_scheduled_time","type":"int","not_null":true},{"name":"total_elapsed_time","type":"int","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"last_request_start_time","type":"datetime","not_null":true},{"name":"last_request_end_time","type":"datetime"},{"name":"reads","type":"bigint","not_null":true},{"name":"writes","type":"bigint","not_null":true},{"name":"logical_reads","type":"bigint","not_null":true},{"name":"is_user_process","type":"bit","not_null":true},{"name":"text_size","type":"int","not_null":true},{"name":"language","type":"nvarchar(128)"},{"name":"date_format","type":"nvarchar(3)"},{"name":"date_first","type":"smallint","not_null":true},{"name":"quoted_identifier","type":"bit","not_null":true},{"name":"arithabort","type":"bit","not_null":true},{"name":"ansi_null_dflt_on","type":"bit","not_null":true},{"name":"ansi_defaults","type":"bit","not_null":true},{"name":"ansi_warnings","type":"bit","not_null":true},{"name":"ansi_padding","type":"bit","not_null":true},{"name":"ansi_nulls","type":"bit","not_null":true},{"name":"concat_null_yields_null","type":"bit","not_null":true},{"name":"transaction_isolation_level","type":"smallint","not_null":true},{"name":"lock_timeout","type":"int","not_null":true},{"name":"deadlock_priority","type":"int","not_null":true},{"name":"row_count","type":"bigint","not_null":true},{"name":"prev_error","type":"int","not_null":true},{"name":"original_security_id","type":"varbinary(85)","not_null":true},{"name":"original_login_name","type":"nvarchar(128)","not_null":true},{"name":"last_successful_logon","type":"datetime"},{"name":"last_unsuccessful_logon","type":"datetime"},{"name":"unsuccessful_logons","type":"bigint"},{"name":"group_id","type":"int","not_null":true},{"name":"database_id","type":"smallint","not_null":true},{"name":"authenticating_database_id","type":"int"},{"name":"open_transaction_count","type":"int","not_null":true},{"name":"page_server_reads","type":"bigint","not_null":true},{"name":"contained_availability_group_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_exec_trigger_stats","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"sql_handle","type":"varbinary(64)","not_null":true},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"cached_time","type":"datetime"},{"name":"last_execution_time","type":"datetime"},{"name":"execution_count","type":"bigint","not_null":true},{"name":"total_worker_time","type":"bigint","not_null":true},{"name":"last_worker_time","type":"bigint","not_null":true},{"name":"min_worker_time","type":"bigint","not_null":true},{"name":"max_worker_time","type":"bigint","not_null":true},{"name":"total_physical_reads","type":"bigint","not_null":true},{"name":"last_physical_reads","type":"bigint","not_null":true},{"name":"min_physical_reads","type":"bigint","not_null":true},{"name":"max_physical_reads","type":"bigint","not_null":true},{"name":"total_logical_writes","type":"bigint","not_null":true},{"name":"last_logical_writes","type":"bigint","not_null":true},{"name":"min_logical_writes","type":"bigint","not_null":true},{"name":"max_logical_writes","type":"bigint","not_null":true},{"name":"total_logical_reads","type":"bigint","not_null":true},{"name":"last_logical_reads","type":"bigint","not_null":true},{"name":"min_logical_reads","type":"bigint","not_null":true},{"name":"max_logical_reads","type":"bigint","not_null":true},{"name":"total_elapsed_time","type":"bigint","not_null":true},{"name":"last_elapsed_time","type":"bigint","not_null":true},{"name":"min_elapsed_time","type":"bigint","not_null":true},{"name":"max_elapsed_time","type":"bigint","not_null":true},{"name":"total_spills","type":"bigint"},{"name":"last_spills","type":"bigint"},{"name":"min_spills","type":"bigint"},{"name":"max_spills","type":"bigint"},{"name":"total_num_physical_reads","type":"bigint","not_null":true},{"name":"last_num_physical_reads","type":"bigint","not_null":true},{"name":"min_num_physical_reads","type":"bigint","not_null":true},{"name":"max_num_physical_reads","type":"bigint","not_null":true},{"name":"total_page_server_reads","type":"bigint","not_null":true},{"name":"last_page_server_reads","type":"bigint","not_null":true},{"name":"min_page_server_reads","type":"bigint","not_null":true},{"name":"max_page_server_reads","type":"bigint","not_null":true},{"name":"total_num_page_server_reads","type":"bigint","not_null":true},{"name":"last_num_page_server_reads","type":"bigint","not_null":true},{"name":"min_num_page_server_reads","type":"bigint","not_null":true},{"name":"max_num_page_server_reads","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_valid_use_hints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"dm_external_authentication","kind":"v","columns":[{"name":"use_identity","type":"bit"},{"name":"credential_id","type":"int"},{"name":"certificate_id","type":"int"}]} +{"schema":"sys","name":"dm_external_data_processed","kind":"v","columns":[{"name":"type","type":"varchar(7)","not_null":true},{"name":"data_processed_mb","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_external_governance_sync_state","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"sync_scope","type":"smallint"},{"name":"sync_scope_desc","type":"nvarchar(60)"},{"name":"sync_state","type":"smallint"},{"name":"sync_state_desc","type":"nvarchar(60)"},{"name":"user_initiated_sync","type":"smallint"},{"name":"sync_percent_complete","type":"smallint"},{"name":"current_sync_token","type":"nvarchar(128)"},{"name":"next_sync_token","type":"nvarchar(128)"},{"name":"last_reference_fetch_success_time_utc","type":"datetime"},{"name":"last_reference_fetch_attempt_time_utc","type":"datetime"},{"name":"last_reference_fetch_error","type":"int"},{"name":"last_blob_fetch_success_time_utc","type":"datetime"},{"name":"last_blob_fetch_attempt_time_utc","type":"datetime"},{"name":"last_blob_fetch_error","type":"int"},{"name":"last_sync_success_time_utc","type":"datetime"},{"name":"last_synchronizing_success_time_utc","type":"datetime"},{"name":"last_synchronizing_attempt_time_utc","type":"datetime"},{"name":"last_synchronizing_error","type":"int"}]} +{"schema":"sys","name":"dm_external_governance_synchronizing_objects","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"schema_id","type":"int"},{"name":"last_fetch_time_utc","type":"datetime"},{"name":"last_synchronizing_attempt_time_utc","type":"datetime"},{"name":"last_synchronizing_error","type":"int"}]} +{"schema":"sys","name":"dm_external_policy_cache","kind":"v","columns":[{"name":"policy_cache_state","type":"int"},{"name":"policy_cache_state_desc","type":"nvarchar(16)"},{"name":"last_policy_cache_update_time","type":"datetime2(7)"},{"name":"last_pull_type","type":"int"},{"name":"last_pull_type_desc","type":"nvarchar(16)"},{"name":"number_of_cached_policies","type":"int"}]} +{"schema":"sys","name":"dm_external_policy_excluded_role_members","kind":"v","columns":[{"name":"excluded_principal_object_id","type":"nvarchar(36)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"assignment_scope","type":"nvarchar(4000)"},{"name":"condition_function","type":"nvarchar(128)"},{"name":"condition_function_parameters","type":"nvarchar(128)"}]} +{"schema":"sys","name":"dm_external_provider_certificate_info","kind":"v","columns":[{"name":"subject","type":"nvarchar(128)"},{"name":"thumbprint","type":"nvarchar(128)"},{"name":"expiry_date","type":"datetime"},{"name":"is_readable","type":"bit"},{"name":"is_missing","type":"bit"}]} +{"schema":"sys","name":"dm_external_script_execution_stats","kind":"v","columns":[{"name":"language","type":"nvarchar(128)"},{"name":"counter_name","type":"nvarchar(256)","not_null":true},{"name":"counter_value","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_external_script_requests","kind":"v","columns":[{"name":"external_script_request_id","type":"uniqueidentifier","not_null":true},{"name":"language","type":"nvarchar(128)"},{"name":"degree_of_parallelism","type":"int","not_null":true},{"name":"external_user_name","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_external_script_resource_usage_stats","kind":"v","columns":[{"name":"package_name","type":"nvarchar(256)","not_null":true},{"name":"memory_usage","type":"bigint","not_null":true},{"name":"cpu_usage","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_filestream_file_io_handles","kind":"v","columns":[{"name":"handle_context_address","type":"varbinary(8)"},{"name":"creation_request_id","type":"int","not_null":true},{"name":"creation_irp_id","type":"int","not_null":true},{"name":"handle_id","type":"int","not_null":true},{"name":"creation_client_thread_id","type":"varbinary(8)"},{"name":"creation_client_process_id","type":"varbinary(8)"},{"name":"filestream_transaction_id","type":"varbinary(128)"},{"name":"access_type","type":"nvarchar(60)","not_null":true},{"name":"logical_path","type":"nvarchar(256)"},{"name":"physical_path","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_filestream_file_io_requests","kind":"v","columns":[{"name":"request_context_address","type":"varbinary(8)","not_null":true},{"name":"current_spid","type":"smallint","not_null":true},{"name":"request_type","type":"nvarchar(60)","not_null":true},{"name":"request_state","type":"nvarchar(60)","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"irp_id","type":"int","not_null":true},{"name":"handle_id","type":"int","not_null":true},{"name":"client_thread_id","type":"varbinary(8)"},{"name":"client_process_id","type":"varbinary(8)"},{"name":"handle_context_address","type":"varbinary(8)"},{"name":"filestream_transaction_id","type":"varbinary(128)"}]} +{"schema":"sys","name":"dm_filestream_non_transacted_handles","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"object_id","type":"int"},{"name":"handle_id","type":"int"},{"name":"file_object_type","type":"int"},{"name":"file_object_type_desc","type":"nvarchar(60)"},{"name":"correlation_process_id","type":"varbinary(8)"},{"name":"correlation_thread_id","type":"varbinary(8)"},{"name":"file_context","type":"varbinary(8)"},{"name":"state","type":"int"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"current_workitem_type","type":"int"},{"name":"current_workitem_type_desc","type":"nvarchar(60)"},{"name":"fcb_id","type":"bigint"},{"name":"item_id","type":"varbinary(892)"},{"name":"is_directory","type":"bit"},{"name":"item_name","type":"nvarchar(256)"},{"name":"opened_file_name","type":"nvarchar(256)"},{"name":"database_directory_name","type":"nvarchar(256)"},{"name":"table_directory_name","type":"nvarchar(256)"},{"name":"remaining_file_name","type":"nvarchar(256)"},{"name":"open_time","type":"datetime","not_null":true},{"name":"flags","type":"int"},{"name":"login_id","type":"int"},{"name":"login_name","type":"nvarchar(256)"},{"name":"login_sid","type":"varbinary(85)"},{"name":"read_access","type":"bit"},{"name":"write_access","type":"bit"},{"name":"delete_access","type":"bit"},{"name":"share_read","type":"bit"},{"name":"share_write","type":"bit"},{"name":"share_delete","type":"bit"},{"name":"create_disposition","type":"int"}]} +{"schema":"sys","name":"dm_fts_active_catalogs","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"catalog_id","type":"int","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(4000)","not_null":true},{"name":"is_paused","type":"bit","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"status_description","type":"nvarchar(64)"},{"name":"previous_status","type":"int","not_null":true},{"name":"previous_status_description","type":"nvarchar(64)"},{"name":"worker_count","type":"int","not_null":true},{"name":"active_fts_index_count","type":"int","not_null":true},{"name":"auto_population_count","type":"int","not_null":true},{"name":"manual_population_count","type":"int","not_null":true},{"name":"full_incremental_population_count","type":"int","not_null":true},{"name":"row_count_in_thousands","type":"int","not_null":true},{"name":"is_importing","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_fts_fdhosts","kind":"v","columns":[{"name":"fdhost_id","type":"int","not_null":true},{"name":"fdhost_name","type":"nvarchar(128)"},{"name":"fdhost_process_id","type":"int","not_null":true},{"name":"fdhost_type","type":"nvarchar(64)"},{"name":"max_thread","type":"int","not_null":true},{"name":"batch_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_fts_index_population","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"catalog_id","type":"int","not_null":true},{"name":"table_id","type":"int","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"population_type","type":"int","not_null":true},{"name":"population_type_description","type":"nvarchar(64)"},{"name":"is_clustered_index_scan","type":"bit","not_null":true},{"name":"range_count","type":"int","not_null":true},{"name":"completed_range_count","type":"int","not_null":true},{"name":"outstanding_batch_count","type":"int","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"status_description","type":"nvarchar(64)"},{"name":"completion_type","type":"int","not_null":true},{"name":"completion_type_description","type":"nvarchar(64)"},{"name":"worker_count","type":"int","not_null":true},{"name":"queued_population_type","type":"int","not_null":true},{"name":"queued_population_type_description","type":"nvarchar(64)"},{"name":"start_time","type":"datetime","not_null":true},{"name":"incremental_timestamp","type":"binary(8)","not_null":true}]} +{"schema":"sys","name":"dm_fts_memory_buffers","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(4000)","not_null":true},{"name":"is_free","type":"bit","not_null":true},{"name":"row_count","type":"int","not_null":true},{"name":"bytes_used","type":"int","not_null":true},{"name":"percent_used","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_fts_memory_pools","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"buffer_size","type":"int","not_null":true},{"name":"min_buffer_limit","type":"int","not_null":true},{"name":"max_buffer_limit","type":"int","not_null":true},{"name":"buffer_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_fts_outstanding_batches","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"catalog_id","type":"int","not_null":true},{"name":"table_id","type":"int","not_null":true},{"name":"batch_id","type":"int","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"crawl_memory_address","type":"varbinary(8)","not_null":true},{"name":"memregion_memory_address","type":"varbinary(8)","not_null":true},{"name":"hr_batch","type":"int","not_null":true},{"name":"is_retry_batch","type":"bit","not_null":true},{"name":"retry_hints","type":"int","not_null":true},{"name":"retry_hints_description","type":"nvarchar(64)"},{"name":"doc_failed","type":"bigint","not_null":true},{"name":"batch_timestamp","type":"binary(8)","not_null":true}]} +{"schema":"sys","name":"dm_fts_population_ranges","kind":"v","columns":[{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"parent_memory_address","type":"varbinary(8)","not_null":true},{"name":"is_retry","type":"bit","not_null":true},{"name":"session_id","type":"smallint","not_null":true},{"name":"processed_row_count","type":"int","not_null":true},{"name":"error_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_fts_semantic_similarity_population","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"catalog_id","type":"int","not_null":true},{"name":"table_id","type":"int","not_null":true},{"name":"document_count","type":"bigint","not_null":true},{"name":"document_processed_count","type":"bigint","not_null":true},{"name":"completion_type","type":"int","not_null":true},{"name":"completion_type_description","type":"nvarchar(64)"},{"name":"worker_count","type":"int","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"status_description","type":"nvarchar(64)"},{"name":"start_time","type":"datetime","not_null":true},{"name":"incremental_timestamp","type":"binary(8)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_ag_threads","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"num_databases","type":"int"},{"name":"num_capture_threads","type":"int"},{"name":"num_redo_threads","type":"int"},{"name":"num_parallel_redo_threads","type":"int"},{"name":"num_hadr_threads","type":"int"}]} +{"schema":"sys","name":"dm_hadr_auto_page_repair","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"file_id","type":"int","not_null":true},{"name":"page_id","type":"bigint","not_null":true},{"name":"error_type","type":"smallint","not_null":true},{"name":"page_status","type":"tinyint","not_null":true},{"name":"modification_time","type":"datetime","not_null":true}]} +{"schema":"sys","name":"dm_hadr_automatic_seeding","kind":"v","columns":[{"name":"start_time","type":"datetime","not_null":true},{"name":"completion_time","type":"datetime"},{"name":"ag_id","type":"uniqueidentifier","not_null":true},{"name":"ag_db_id","type":"uniqueidentifier","not_null":true},{"name":"ag_remote_replica_id","type":"uniqueidentifier","not_null":true},{"name":"operation_id","type":"uniqueidentifier","not_null":true},{"name":"is_source","type":"bit","not_null":true},{"name":"current_state","type":"nvarchar(4000)","not_null":true},{"name":"performed_seeding","type":"bit","not_null":true},{"name":"failure_state","type":"int"},{"name":"failure_state_desc","type":"nvarchar(4000)"},{"name":"error_code","type":"int"},{"name":"number_of_attempts","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_hadr_availability_group_states","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"primary_replica","type":"nvarchar(128)"},{"name":"primary_recovery_health","type":"tinyint"},{"name":"primary_recovery_health_desc","type":"nvarchar(60)"},{"name":"secondary_recovery_health","type":"tinyint"},{"name":"secondary_recovery_health_desc","type":"nvarchar(60)"},{"name":"synchronization_health","type":"tinyint"},{"name":"synchronization_health_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_hadr_availability_replica_cluster_nodes","kind":"v","columns":[{"name":"group_name","type":"nvarchar(256)","not_null":true},{"name":"replica_server_name","type":"nvarchar(256)","not_null":true},{"name":"node_name","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_availability_replica_cluster_states","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"replica_server_name","type":"nvarchar(256)","not_null":true},{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"join_state","type":"tinyint","not_null":true},{"name":"join_state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_hadr_availability_replica_states","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"is_local","type":"bit","not_null":true},{"name":"role","type":"tinyint"},{"name":"role_desc","type":"nvarchar(60)"},{"name":"operational_state","type":"tinyint"},{"name":"operational_state_desc","type":"nvarchar(60)"},{"name":"connected_state","type":"tinyint"},{"name":"connected_state_desc","type":"nvarchar(60)"},{"name":"recovery_health","type":"tinyint"},{"name":"recovery_health_desc","type":"nvarchar(60)"},{"name":"synchronization_health","type":"tinyint"},{"name":"synchronization_health_desc","type":"nvarchar(60)"},{"name":"last_connect_error_number","type":"int"},{"name":"last_connect_error_description","type":"nvarchar(1024)"},{"name":"last_connect_error_timestamp","type":"datetime"},{"name":"write_lease_remaining_ticks","type":"bigint"},{"name":"current_configuration_commit_start_time_utc","type":"datetime"},{"name":"is_internal","type":"bit"}]} +{"schema":"sys","name":"dm_hadr_cached_database_replica_states","kind":"v","columns":[{"name":"ag_id","type":"uniqueidentifier","not_null":true},{"name":"ag_name","type":"nvarchar(256)","not_null":true},{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"replica_name","type":"nvarchar(256)","not_null":true},{"name":"ag_db_id","type":"uniqueidentifier","not_null":true},{"name":"ag_db_name","type":"nvarchar(256)","not_null":true},{"name":"is_local","type":"bit","not_null":true},{"name":"is_primary_replica","type":"bit","not_null":true},{"name":"synchronization_state","type":"tinyint"},{"name":"synchronization_state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_hadr_cached_replica_states","kind":"v","columns":[{"name":"ag_id","type":"uniqueidentifier","not_null":true},{"name":"ag_name","type":"nvarchar(256)","not_null":true},{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"replica_name","type":"nvarchar(256)","not_null":true},{"name":"is_local","type":"bit","not_null":true},{"name":"availability_mode","type":"tinyint","not_null":true},{"name":"sequence_number","type":"bigint"},{"name":"role","type":"tinyint"},{"name":"role_desc","type":"nvarchar(60)"},{"name":"synchronization_health","type":"tinyint"},{"name":"synchronization_health_desc","type":"nvarchar(60)"},{"name":"secondary_role_allow_connections","type":"tinyint"},{"name":"secondary_role_allow_connections_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_hadr_cluster","kind":"v","columns":[{"name":"cluster_name","type":"nvarchar(256)","not_null":true},{"name":"quorum_type","type":"tinyint","not_null":true},{"name":"quorum_type_desc","type":"nvarchar(60)","not_null":true},{"name":"quorum_state","type":"tinyint","not_null":true},{"name":"quorum_state_desc","type":"nvarchar(60)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_cluster_members","kind":"v","columns":[{"name":"member_name","type":"nvarchar(256)","not_null":true},{"name":"member_type","type":"tinyint","not_null":true},{"name":"member_type_desc","type":"nvarchar(60)","not_null":true},{"name":"member_state","type":"tinyint","not_null":true},{"name":"member_state_desc","type":"nvarchar(60)","not_null":true},{"name":"number_of_quorum_votes","type":"int"},{"name":"number_of_current_votes","type":"int"}]} +{"schema":"sys","name":"dm_hadr_cluster_networks","kind":"v","columns":[{"name":"member_name","type":"nvarchar(128)","not_null":true},{"name":"network_subnet_ip","type":"nvarchar(64)","not_null":true},{"name":"network_subnet_ipv4_mask","type":"nvarchar(45)"},{"name":"network_subnet_prefix_length","type":"int"},{"name":"is_public","type":"bit","not_null":true},{"name":"is_ipv4","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_hadr_database_replica_cluster_states","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"group_database_id","type":"uniqueidentifier","not_null":true},{"name":"database_name","type":"nvarchar(128)"},{"name":"is_failover_ready","type":"bit","not_null":true},{"name":"is_pending_secondary_suspend","type":"bit","not_null":true},{"name":"is_database_joined","type":"bit","not_null":true},{"name":"recovery_lsn","type":"numeric(25,0)"},{"name":"truncation_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"dm_hadr_database_replica_states","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"group_database_id","type":"uniqueidentifier","not_null":true},{"name":"is_local","type":"bit"},{"name":"is_primary_replica","type":"bit"},{"name":"synchronization_state","type":"tinyint"},{"name":"synchronization_state_desc","type":"nvarchar(60)"},{"name":"is_commit_participant","type":"bit"},{"name":"synchronization_health","type":"tinyint"},{"name":"synchronization_health_desc","type":"nvarchar(60)"},{"name":"database_state","type":"tinyint"},{"name":"database_state_desc","type":"nvarchar(60)"},{"name":"is_suspended","type":"bit"},{"name":"suspend_reason","type":"tinyint"},{"name":"suspend_reason_desc","type":"nvarchar(60)"},{"name":"recovery_lsn","type":"numeric(25,0)"},{"name":"truncation_lsn","type":"numeric(25,0)"},{"name":"last_sent_lsn","type":"numeric(25,0)"},{"name":"last_sent_time","type":"datetime"},{"name":"last_received_lsn","type":"numeric(25,0)"},{"name":"last_received_time","type":"datetime"},{"name":"last_hardened_lsn","type":"numeric(25,0)"},{"name":"last_hardened_time","type":"datetime"},{"name":"last_redone_lsn","type":"numeric(25,0)"},{"name":"last_redone_time","type":"datetime"},{"name":"log_send_queue_size","type":"bigint"},{"name":"log_send_rate","type":"bigint"},{"name":"redo_queue_size","type":"bigint"},{"name":"redo_rate","type":"bigint"},{"name":"filestream_send_rate","type":"bigint"},{"name":"end_of_log_lsn","type":"numeric(25,0)"},{"name":"last_commit_lsn","type":"numeric(25,0)"},{"name":"last_commit_time","type":"datetime"},{"name":"low_water_mark_for_ghosts","type":"bigint"},{"name":"secondary_lag_seconds","type":"bigint"},{"name":"quorum_commit_lsn","type":"numeric(25,0)"},{"name":"quorum_commit_time","type":"datetime"},{"name":"is_internal","type":"bit"}]} +{"schema":"sys","name":"dm_hadr_db_threads","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"ag_db_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"num_capture_threads","type":"int"},{"name":"num_redo_threads","type":"int"},{"name":"num_parallel_redo_threads","type":"int"}]} +{"schema":"sys","name":"dm_hadr_instance_node_map","kind":"v","columns":[{"name":"ag_resource_id","type":"nvarchar(256)","not_null":true},{"name":"instance_name","type":"nvarchar(256)","not_null":true},{"name":"node_name","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_internal_availability_groups","kind":"v","columns":[{"name":"distributed_availability_group_id","type":"uniqueidentifier"},{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"resource_id","type":"nvarchar(40)"},{"name":"resource_group_id","type":"nvarchar(40)"},{"name":"failure_condition_level","type":"int"},{"name":"health_check_timeout","type":"int"},{"name":"automated_backup_preference","type":"tinyint"},{"name":"automated_backup_preference_desc","type":"nvarchar(60)"},{"name":"version","type":"smallint"},{"name":"basic_features","type":"bit"},{"name":"dtc_support","type":"bit"},{"name":"db_failover","type":"bit"},{"name":"is_distributed","type":"bit"},{"name":"cluster_type","type":"tinyint"},{"name":"cluster_type_desc","type":"nvarchar(60)"},{"name":"required_synchronized_secondaries_to_commit","type":"int"},{"name":"sequence_number","type":"bigint"},{"name":"is_contained","type":"bit"},{"name":"group_database_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_hadr_internal_availability_replicas","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier"},{"name":"group_id","type":"uniqueidentifier"},{"name":"replica_metadata_id","type":"int"},{"name":"replica_server_name","type":"nvarchar(256)"},{"name":"owner_sid","type":"varbinary(85)"},{"name":"endpoint_url","type":"nvarchar(256)"},{"name":"availability_mode","type":"tinyint"},{"name":"availability_mode_desc","type":"nvarchar(60)"},{"name":"failover_mode","type":"tinyint"},{"name":"failover_mode_desc","type":"nvarchar(60)"},{"name":"session_timeout","type":"int"},{"name":"primary_role_allow_connections","type":"tinyint"},{"name":"primary_role_allow_connections_desc","type":"nvarchar(60)"},{"name":"secondary_role_allow_connections","type":"tinyint"},{"name":"secondary_role_allow_connections_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime"},{"name":"modify_date","type":"datetime"},{"name":"backup_priority","type":"int"},{"name":"read_only_routing_url","type":"nvarchar(256)"},{"name":"seeding_mode","type":"tinyint"},{"name":"seeding_mode_desc","type":"nvarchar(60)"},{"name":"read_write_routing_url","type":"nvarchar(256)"},{"name":"distributed_availability_group_replica_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_hadr_name_id_map","kind":"v","columns":[{"name":"ag_name","type":"nvarchar(256)","not_null":true},{"name":"ag_id","type":"uniqueidentifier","not_null":true},{"name":"ag_resource_id","type":"nvarchar(256)","not_null":true},{"name":"ag_group_id","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_physical_seeding_stats","kind":"v","columns":[{"name":"local_physical_seeding_id","type":"uniqueidentifier","not_null":true},{"name":"remote_physical_seeding_id","type":"uniqueidentifier"},{"name":"local_database_id","type":"int","not_null":true},{"name":"local_database_name","type":"nvarchar(128)"},{"name":"remote_machine_name","type":"nvarchar(128)"},{"name":"role_desc","type":"nvarchar(128)"},{"name":"internal_state_desc","type":"nvarchar(128)"},{"name":"transfer_rate_bytes_per_second","type":"bigint"},{"name":"transferred_size_bytes","type":"bigint"},{"name":"database_size_bytes","type":"bigint"},{"name":"start_time_utc","type":"datetime"},{"name":"end_time_utc","type":"datetime"},{"name":"estimate_time_complete_utc","type":"datetime"},{"name":"total_disk_io_wait_time_ms","type":"bigint"},{"name":"total_network_wait_time_ms","type":"bigint"},{"name":"failure_code","type":"int"},{"name":"failure_message","type":"nvarchar(128)"},{"name":"failure_time_utc","type":"datetime"},{"name":"is_compression_enabled","type":"bit"}]} +{"schema":"sys","name":"dm_hpc_device_stats","kind":"v","columns":[{"name":"device_logical_id","type":"int","not_null":true},{"name":"device_type","type":"int","not_null":true},{"name":"device_provider","type":"int","not_null":true},{"name":"device_physical_id","type":"bigint","not_null":true},{"name":"version","type":"bigint","not_null":true},{"name":"compute_units","type":"int","not_null":true},{"name":"max_thread_proxies","type":"int","not_null":true},{"name":"clock_frequency","type":"bigint","not_null":true},{"name":"device_memory_bytes","type":"bigint","not_null":true},{"name":"rows_handled","type":"bigint","not_null":true},{"name":"cycles_used","type":"bigint","not_null":true},{"name":"device_to_host_bytes","type":"bigint","not_null":true},{"name":"host_to_device_bytes","type":"bigint","not_null":true},{"name":"device_ready","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_hpc_thread_proxy_stats","kind":"v","columns":[{"name":"device_logical_id","type":"int","not_null":true},{"name":"device_type","type":"int","not_null":true},{"name":"device_provider","type":"int","not_null":true},{"name":"proxy_id","type":"int","not_null":true},{"name":"rows_handled","type":"bigint","not_null":true},{"name":"cycles_used","type":"bigint","not_null":true},{"name":"host_to_device_bytes","type":"bigint","not_null":true},{"name":"device_to_host_bytes","type":"bigint","not_null":true},{"name":"device_memory_bytes","type":"bigint","not_null":true},{"name":"session_id","type":"smallint","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"active","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_io_backup_tapes","kind":"v","columns":[{"name":"physical_device_name","type":"nvarchar(260)","not_null":true},{"name":"logical_device_name","type":"nvarchar(128)"},{"name":"status","type":"int","not_null":true},{"name":"status_desc","type":"nvarchar(260)","not_null":true},{"name":"mount_request_time","type":"datetime"},{"name":"mount_expiration_time","type":"datetime"},{"name":"database_name","type":"nvarchar(128)"},{"name":"spid","type":"int"},{"name":"command","type":"int"},{"name":"command_desc","type":"nvarchar(60)"},{"name":"media_family_id","type":"int"},{"name":"media_set_name","type":"nvarchar(128)"},{"name":"media_set_guid","type":"uniqueidentifier"},{"name":"media_sequence_number","type":"int"},{"name":"tape_operation","type":"int"},{"name":"tape_operation_desc","type":"nvarchar(60)"},{"name":"mount_request_type","type":"int"},{"name":"mount_request_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_io_cluster_shared_drives","kind":"v","columns":[{"name":"drivename","type":"nchar(1)"}]} +{"schema":"sys","name":"dm_io_cluster_valid_path_names","kind":"v","columns":[{"name":"path_name","type":"nvarchar(256)"},{"name":"cluster_owner_node","type":"nvarchar(60)"},{"name":"is_cluster_shared_volume","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_io_network_traffic_stats","kind":"v","columns":[{"name":"snapshot_time","type":"datetime2(7)","not_null":true},{"name":"network_protocol","type":"tinyint","not_null":true},{"name":"network_protocol_desc","type":"nvarchar(60)","not_null":true},{"name":"count_sends","type":"bigint","not_null":true},{"name":"count_receives","type":"bigint","not_null":true},{"name":"send_bytes","type":"bigint","not_null":true},{"name":"receive_bytes","type":"bigint","not_null":true},{"name":"max_send_bytes","type":"bigint","not_null":true},{"name":"max_receive_bytes","type":"bigint","not_null":true},{"name":"min_send_bytes","type":"bigint","not_null":true},{"name":"min_receive_bytes","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_io_pending_io_requests","kind":"v","columns":[{"name":"io_completion_request_address","type":"varbinary(8)","not_null":true},{"name":"io_type","type":"nvarchar(60)","not_null":true},{"name":"io_pending_ms_ticks","type":"bigint","not_null":true},{"name":"io_pending","type":"int","not_null":true},{"name":"io_completion_routine_address","type":"varbinary(8)"},{"name":"io_user_data_address","type":"varbinary(8)"},{"name":"scheduler_address","type":"varbinary(8)","not_null":true},{"name":"io_handle","type":"varbinary(8)"},{"name":"io_offset","type":"bigint","not_null":true},{"name":"io_handle_path","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_logpool_hashentries","kind":"v","columns":[{"name":"bucket_no","type":"int","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"recovery_unit_id","type":"int","not_null":true},{"name":"log_block_id","type":"bigint","not_null":true},{"name":"cache_buffer","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_logpool_stats","kind":"v","columns":[{"name":"hash_hit_total_search_length","type":"bigint","not_null":true},{"name":"hash_miss_total_search_length","type":"bigint","not_null":true},{"name":"hash_hits","type":"bigint","not_null":true},{"name":"hash_misses","type":"bigint","not_null":true},{"name":"hash_bucket_count","type":"int","not_null":true},{"name":"mem_status_stamp","type":"bigint","not_null":true},{"name":"mem_status","type":"int","not_null":true},{"name":"logpoolmgr_count","type":"int","not_null":true},{"name":"total_pages","type":"bigint","not_null":true},{"name":"private_pages","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_buffer_descriptors","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"file_id","type":"int"},{"name":"page_id","type":"int"},{"name":"page_level","type":"int"},{"name":"allocation_unit_id","type":"bigint"},{"name":"page_type","type":"nvarchar(60)"},{"name":"row_count","type":"int"},{"name":"free_space_in_bytes","type":"int"},{"name":"is_modified","type":"bit"},{"name":"numa_node","type":"int"},{"name":"read_microsec","type":"bigint"},{"name":"is_in_bpool_extension","type":"bit"},{"name":"error_code","type":"int"},{"name":"op_history","type":"varbinary(8)"},{"name":"buffer_address","type":"varbinary(8)"},{"name":"latch_address","type":"varbinary(8)"},{"name":"latch_desc","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_buffer_pool_extension_configuration","kind":"v","columns":[{"name":"path","type":"nvarchar(256)"},{"name":"file_id","type":"int"},{"name":"state","type":"int"},{"name":"state_description","type":"nvarchar(60)","not_null":true},{"name":"current_size_in_kb","type":"bigint"}]} +{"schema":"sys","name":"dm_os_child_instances","kind":"v","columns":[{"name":"owning_principal_name","type":"nvarchar(256)"},{"name":"owning_principal_sid","type":"nvarchar(256)"},{"name":"owning_principal_sid_binary","type":"varbinary(85)"},{"name":"instance_name","type":"nvarchar(128)"},{"name":"instance_pipe_name","type":"nvarchar(260)"},{"name":"os_process_id","type":"int"},{"name":"os_process_creation_date","type":"datetime"},{"name":"heart_beat","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_os_cluster_nodes","kind":"v","columns":[{"name":"nodename","type":"nvarchar(128)"},{"name":"status","type":"int"},{"name":"status_description","type":"varchar(7)","not_null":true},{"name":"is_current_owner","type":"bit"}]} +{"schema":"sys","name":"dm_os_cluster_properties","kind":"v","columns":[{"name":"verboselogging","type":"bigint"},{"name":"sqldumperdumpflags","type":"bigint"},{"name":"sqldumperdumppath","type":"nvarchar(260)","not_null":true},{"name":"sqldumperdumptimeout","type":"bigint"},{"name":"failureconditionlevel","type":"bigint"},{"name":"healthchecktimeout","type":"bigint"},{"name":"clusterconnectionoptions","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_os_dispatcher_pools","kind":"v","columns":[{"name":"dispatcher_pool_address","type":"varbinary(8)","not_null":true},{"name":"type","type":"nvarchar(256)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"dispatcher_count","type":"int","not_null":true},{"name":"dispatcher_ideal_count","type":"int","not_null":true},{"name":"dispatcher_timeout_ms","type":"int","not_null":true},{"name":"dispatcher_waiting_count","type":"int","not_null":true},{"name":"queue_length","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_dispatchers","kind":"v","columns":[{"name":"dispatcher_pool_address","type":"varbinary(8)","not_null":true},{"name":"task_address","type":"varbinary(8)","not_null":true},{"name":"state","type":"nvarchar(60)","not_null":true},{"name":"wait_duration","type":"bigint"},{"name":"current_item_duration","type":"bigint"},{"name":"items_processed","type":"bigint","not_null":true},{"name":"fade_end_time","type":"int"}]} +{"schema":"sys","name":"dm_os_enumerate_fixed_drives","kind":"v","columns":[{"name":"fixed_drive_path","type":"nvarchar(256)"},{"name":"drive_type","type":"int","not_null":true},{"name":"drive_type_desc","type":"nvarchar(256)"},{"name":"free_space_in_bytes","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_host_info","kind":"v","columns":[{"name":"host_platform","type":"nvarchar(256)","not_null":true},{"name":"host_distribution","type":"nvarchar(256)","not_null":true},{"name":"host_release","type":"nvarchar(256)","not_null":true},{"name":"host_service_pack_level","type":"nvarchar(256)","not_null":true},{"name":"host_sku","type":"int"},{"name":"os_language_version","type":"int","not_null":true},{"name":"host_architecture","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_os_hosts","kind":"v","columns":[{"name":"host_address","type":"varbinary(8)","not_null":true},{"name":"type","type":"nvarchar(60)"},{"name":"name","type":"nvarchar(60)","not_null":true},{"name":"enqueued_tasks_count","type":"int"},{"name":"active_tasks_count","type":"int"},{"name":"completed_ios_count","type":"int"},{"name":"completed_ios_in_bytes","type":"bigint"},{"name":"active_ios_count","type":"int"},{"name":"default_memory_clerk_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_os_job_object","kind":"v","columns":[{"name":"cpu_rate","type":"int"},{"name":"cpu_affinity_mask","type":"bigint"},{"name":"cpu_affinity_group","type":"int"},{"name":"memory_limit_mb","type":"bigint"},{"name":"process_memory_limit_mb","type":"bigint"},{"name":"workingset_limit_mb","type":"bigint"},{"name":"non_sos_mem_gap_mb","type":"bigint"},{"name":"low_mem_signal_threshold_mb","type":"bigint"},{"name":"total_user_time","type":"bigint"},{"name":"total_kernel_time","type":"bigint"},{"name":"write_operation_count","type":"bigint"},{"name":"read_operation_count","type":"bigint"},{"name":"peak_process_memory_used_mb","type":"bigint"},{"name":"peak_job_memory_used_mb","type":"bigint"},{"name":"process_physical_affinity","type":"nvarchar(3072)","not_null":true}]} +{"schema":"sys","name":"dm_os_latch_stats","kind":"v","columns":[{"name":"latch_class","type":"nvarchar(60)","not_null":true},{"name":"waiting_requests_count","type":"bigint"},{"name":"wait_time_ms","type":"bigint"},{"name":"max_wait_time_ms","type":"bigint"}]} +{"schema":"sys","name":"dm_os_linux_cpu_stats","kind":"v","columns":[{"name":"uptime_secs","type":"float","not_null":true},{"name":"loadavg_1min","type":"float","not_null":true},{"name":"user_time_cs","type":"bigint","not_null":true},{"name":"nice_time_cs","type":"bigint","not_null":true},{"name":"system_time_cs","type":"bigint","not_null":true},{"name":"idle_time_cs","type":"bigint","not_null":true},{"name":"iowait_time_cs","type":"bigint","not_null":true},{"name":"irq_time_cs","type":"bigint","not_null":true},{"name":"softirq_time_cs","type":"bigint","not_null":true},{"name":"interrupt_cnt","type":"bigint","not_null":true},{"name":"csw_cnt","type":"bigint","not_null":true},{"name":"boot_time_secs","type":"bigint","not_null":true},{"name":"total_forks_cnt","type":"bigint","not_null":true},{"name":"proc_runable_cnt","type":"bigint","not_null":true},{"name":"proc_ioblocked_cnt","type":"bigint","not_null":true},{"name":"c3_time","type":"bigint","not_null":true},{"name":"c2_time","type":"bigint","not_null":true},{"name":"c1_time","type":"bigint","not_null":true},{"name":"c3_count","type":"bigint","not_null":true},{"name":"c2_count","type":"bigint","not_null":true},{"name":"c1_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_linux_disk_stats","kind":"v","columns":[{"name":"dev_name","type":"nvarchar(256)","not_null":true},{"name":"major_num","type":"bigint","not_null":true},{"name":"minor_num","type":"bigint","not_null":true},{"name":"reads_completed","type":"bigint","not_null":true},{"name":"reads_merged","type":"bigint","not_null":true},{"name":"sectors_read","type":"bigint","not_null":true},{"name":"read_time_ms","type":"bigint","not_null":true},{"name":"writes_completed","type":"bigint","not_null":true},{"name":"writes_merged","type":"bigint","not_null":true},{"name":"sectors_written","type":"bigint","not_null":true},{"name":"write_time_ms","type":"bigint","not_null":true},{"name":"ios_in_progress","type":"bigint","not_null":true},{"name":"io_time_ms","type":"bigint","not_null":true},{"name":"weighted_io_time_ms","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_linux_net_stats","kind":"v","columns":[{"name":"interface","type":"nvarchar(256)","not_null":true},{"name":"recv_bytes","type":"bigint","not_null":true},{"name":"recv_packets","type":"bigint","not_null":true},{"name":"recv_errors","type":"bigint","not_null":true},{"name":"recv_drops","type":"bigint","not_null":true},{"name":"recv_fifo","type":"bigint","not_null":true},{"name":"recv_frame","type":"bigint","not_null":true},{"name":"recv_compressed","type":"bigint","not_null":true},{"name":"recv_multicast","type":"bigint","not_null":true},{"name":"tx_bytes","type":"bigint","not_null":true},{"name":"tx_packets","type":"bigint","not_null":true},{"name":"tx_errors","type":"bigint","not_null":true},{"name":"tx_drop","type":"bigint","not_null":true},{"name":"tx_fifo","type":"bigint","not_null":true},{"name":"tx_collisions","type":"bigint","not_null":true},{"name":"tx_carrier","type":"bigint","not_null":true},{"name":"tx_compressed","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_linux_vm_stats","kind":"v","columns":[{"name":"vm_metric_name","type":"nvarchar(256)","not_null":true},{"name":"count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_loaded_modules","kind":"v","columns":[{"name":"base_address","type":"varbinary(8)","not_null":true},{"name":"file_version","type":"varchar(256)"},{"name":"product_version","type":"varchar(256)"},{"name":"debug","type":"bit"},{"name":"patched","type":"bit"},{"name":"prerelease","type":"bit"},{"name":"private_build","type":"bit"},{"name":"special_build","type":"bit"},{"name":"language","type":"int"},{"name":"company","type":"nvarchar(256)"},{"name":"description","type":"nvarchar(256)"},{"name":"name","type":"nvarchar(512)"},{"name":"target","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_memory_allocations","kind":"v","columns":[{"name":"memory_allocation_address","type":"varbinary(8)","not_null":true},{"name":"size_in_bytes","type":"bigint","not_null":true},{"name":"creation_time","type":"datetime","not_null":true},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"allocator_stack_address","type":"varbinary(8)","not_null":true},{"name":"source_file","type":"varchar(256)"},{"name":"line_num","type":"int","not_null":true},{"name":"sequence_num","type":"int","not_null":true},{"name":"tag","type":"int","not_null":true},{"name":"allocation_rva_stack","type":"nvarchar(max)"}]} +{"schema":"sys","name":"dm_os_memory_allocations_filtered","kind":"v","columns":[{"name":"memory_object_address","type":"varbinary(8)"},{"name":"sum_bytes","type":"bigint"},{"name":"line_num","type":"int","not_null":true},{"name":"source_file","type":"varchar(256)"}]} +{"schema":"sys","name":"dm_os_memory_broker_clerks","kind":"v","columns":[{"name":"clerk_name","type":"nvarchar(256)","not_null":true},{"name":"total_kb","type":"bigint","not_null":true},{"name":"simulated_kb","type":"bigint","not_null":true},{"name":"simulation_benefit","type":"float","not_null":true},{"name":"internal_benefit","type":"float","not_null":true},{"name":"external_benefit","type":"float","not_null":true},{"name":"value_of_memory","type":"float","not_null":true},{"name":"periodic_freed_kb","type":"bigint","not_null":true},{"name":"internal_freed_kb","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_brokers","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"memory_broker_type","type":"nvarchar(60)","not_null":true},{"name":"allocations_kb","type":"bigint","not_null":true},{"name":"allocations_kb_per_sec","type":"bigint","not_null":true},{"name":"predicted_allocations_kb","type":"bigint","not_null":true},{"name":"target_allocations_kb","type":"bigint","not_null":true},{"name":"future_allocations_kb","type":"bigint","not_null":true},{"name":"overall_limit_kb","type":"bigint","not_null":true},{"name":"last_notification","type":"nvarchar(60)","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_cache_clock_hands","kind":"v","columns":[{"name":"cache_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"clock_hand","type":"nvarchar(60)","not_null":true},{"name":"clock_status","type":"nvarchar(60)","not_null":true},{"name":"rounds_count","type":"bigint","not_null":true},{"name":"removed_all_rounds_count","type":"bigint","not_null":true},{"name":"updated_last_round_count","type":"bigint","not_null":true},{"name":"removed_last_round_count","type":"bigint","not_null":true},{"name":"last_tick_time","type":"bigint","not_null":true},{"name":"round_start_time","type":"bigint","not_null":true},{"name":"last_round_start_time","type":"bigint","not_null":true},{"name":"entries_visited_all_rounds_count","type":"bigint","not_null":true},{"name":"inuse_all_rounds_count","type":"bigint","not_null":true},{"name":"pinned_all_rounds_count","type":"bigint","not_null":true},{"name":"do_not_remove_all_rounds_count","type":"bigint","not_null":true},{"name":"invisible_all_rounds_count","type":"bigint","not_null":true},{"name":"different_pool_all_rounds_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_cache_counters","kind":"v","columns":[{"name":"cache_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"pages_kb","type":"bigint","not_null":true},{"name":"pages_in_use_kb","type":"bigint"},{"name":"entries_count","type":"bigint","not_null":true},{"name":"entries_in_use_count","type":"bigint","not_null":true},{"name":"extended_properties","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_memory_cache_entries","kind":"v","columns":[{"name":"cache_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"entry_address","type":"varbinary(8)","not_null":true},{"name":"entry_data_address","type":"varbinary(8)","not_null":true},{"name":"in_use_count","type":"int","not_null":true},{"name":"is_dirty","type":"bit","not_null":true},{"name":"disk_ios_count","type":"int","not_null":true},{"name":"context_switches_count","type":"int","not_null":true},{"name":"original_cost","type":"int","not_null":true},{"name":"current_cost","type":"int","not_null":true},{"name":"memory_object_address","type":"varbinary(8)"},{"name":"pages_kb","type":"bigint","not_null":true},{"name":"entry_data","type":"nvarchar(3072)"},{"name":"pool_id","type":"int"},{"name":"time_to_generate","type":"float"},{"name":"use_count","type":"bigint"},{"name":"average_time_between_uses","type":"float"},{"name":"time_since_last_use","type":"float"},{"name":"probability_of_reuse","type":"float"},{"name":"value","type":"float"}]} +{"schema":"sys","name":"dm_os_memory_cache_hash_tables","kind":"v","columns":[{"name":"cache_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"table_level","type":"int","not_null":true},{"name":"buckets_count","type":"int","not_null":true},{"name":"buckets_in_use_count","type":"int","not_null":true},{"name":"buckets_min_length","type":"int","not_null":true},{"name":"buckets_max_length","type":"int","not_null":true},{"name":"buckets_avg_length","type":"int","not_null":true},{"name":"buckets_max_length_ever","type":"int","not_null":true},{"name":"hits_count","type":"bigint","not_null":true},{"name":"misses_count","type":"bigint","not_null":true},{"name":"buckets_avg_scan_hit_length","type":"int","not_null":true},{"name":"buckets_avg_scan_miss_length","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_clerks","kind":"v","columns":[{"name":"memory_clerk_address","type":"varbinary(8)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"pages_kb","type":"bigint","not_null":true},{"name":"virtual_memory_reserved_kb","type":"bigint","not_null":true},{"name":"virtual_memory_committed_kb","type":"bigint","not_null":true},{"name":"awe_allocated_kb","type":"bigint","not_null":true},{"name":"shared_memory_reserved_kb","type":"bigint","not_null":true},{"name":"shared_memory_committed_kb","type":"bigint","not_null":true},{"name":"page_size_in_bytes","type":"bigint","not_null":true},{"name":"page_allocator_address","type":"varbinary(8)","not_null":true},{"name":"host_address","type":"varbinary(8)","not_null":true},{"name":"parent_memory_broker_type","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_os_memory_health_history","kind":"v","columns":[{"name":"snapshot_time","type":"datetime2(7)","not_null":true},{"name":"severity_level","type":"tinyint","not_null":true},{"name":"severity_level_desc","type":"nvarchar(60)","not_null":true},{"name":"allocation_potential_memory_mb","type":"int","not_null":true},{"name":"reclaimable_cache_memory_mb","type":"int","not_null":true},{"name":"top_memory_clerks","type":"nvarchar(4000)"},{"name":"out_of_memory_event_count","type":"int","not_null":true},{"name":"memgrant_timeout_count","type":"int","not_null":true},{"name":"memgrant_waiter_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_node_access_stats","kind":"v","columns":[{"name":"local_node","type":"int"},{"name":"remote_node","type":"int"},{"name":"page_class","type":"nvarchar(60)"},{"name":"read_count","type":"bigint"},{"name":"write_count","type":"bigint"}]} +{"schema":"sys","name":"dm_os_memory_nodes","kind":"v","columns":[{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"virtual_address_space_reserved_kb","type":"bigint","not_null":true},{"name":"virtual_address_space_committed_kb","type":"bigint","not_null":true},{"name":"locked_page_allocations_kb","type":"bigint","not_null":true},{"name":"pages_kb","type":"bigint","not_null":true},{"name":"shared_memory_reserved_kb","type":"bigint","not_null":true},{"name":"shared_memory_committed_kb","type":"bigint","not_null":true},{"name":"cpu_affinity_mask","type":"bigint","not_null":true},{"name":"online_scheduler_mask","type":"bigint","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"foreign_committed_kb","type":"bigint","not_null":true},{"name":"target_kb","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_nodes_processor_groups","kind":"v","columns":[{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"processor_group","type":"smallint","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_objects","kind":"v","columns":[{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"parent_address","type":"varbinary(8)"},{"name":"pages_in_bytes","type":"bigint","not_null":true},{"name":"creation_options","type":"int"},{"name":"bytes_used","type":"bigint"},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"name","type":"varchar(256)"},{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"creation_time","type":"datetime"},{"name":"page_size_in_bytes","type":"int","not_null":true},{"name":"max_pages_in_bytes","type":"bigint","not_null":true},{"name":"page_allocator_address","type":"varbinary(8)","not_null":true},{"name":"creation_stack_address","type":"varbinary(8)"},{"name":"sequence_num","type":"int"},{"name":"partition_type","type":"int","not_null":true},{"name":"partition_type_desc","type":"nvarchar(60)","not_null":true},{"name":"contention_factor","type":"real"},{"name":"waiting_tasks_count","type":"bigint"},{"name":"exclusive_access_count","type":"bigint"}]} +{"schema":"sys","name":"dm_os_memory_pools","kind":"v","columns":[{"name":"memory_pool_address","type":"varbinary(8)","not_null":true},{"name":"pool_id","type":"int","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"max_free_entries_count","type":"bigint","not_null":true},{"name":"free_entries_count","type":"bigint","not_null":true},{"name":"removed_in_all_rounds_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_nodes","kind":"v","columns":[{"name":"node_id","type":"smallint","not_null":true},{"name":"node_state_desc","type":"nvarchar(256)","not_null":true},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"memory_clerk_address","type":"varbinary(8)","not_null":true},{"name":"io_completion_worker_address","type":"varbinary(8)"},{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"cpu_affinity_mask","type":"bigint","not_null":true},{"name":"online_scheduler_count","type":"smallint","not_null":true},{"name":"idle_scheduler_count","type":"smallint","not_null":true},{"name":"active_worker_count","type":"int","not_null":true},{"name":"avg_load_balance","type":"int","not_null":true},{"name":"timer_task_affinity_mask","type":"bigint","not_null":true},{"name":"permanent_task_affinity_mask","type":"bigint","not_null":true},{"name":"resource_monitor_state","type":"bit","not_null":true},{"name":"online_scheduler_mask","type":"bigint","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"cpu_count","type":"int","not_null":true},{"name":"cached_tasks","type":"bigint","not_null":true},{"name":"cached_tasks_reused","type":"bigint","not_null":true},{"name":"cached_tasks_removed","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_out_of_memory_events","kind":"v","columns":[{"name":"event_time","type":"datetime","not_null":true},{"name":"oom_cause","type":"smallint","not_null":true},{"name":"oom_cause_desc","type":"nvarchar(30)","not_null":true},{"name":"available_physical_memory_mb","type":"int","not_null":true},{"name":"initial_job_object_memory_limit_mb","type":"int"},{"name":"current_job_object_memory_limit_mb","type":"int"},{"name":"process_memory_usage_mb","type":"int","not_null":true},{"name":"non_sos_memory_usage_mb","type":"int","not_null":true},{"name":"committed_memory_target_mb","type":"int","not_null":true},{"name":"committed_memory_mb","type":"int","not_null":true},{"name":"allocation_potential_memory_mb","type":"int","not_null":true},{"name":"oom_factor","type":"smallint","not_null":true},{"name":"oom_factor_desc","type":"nvarchar(30)","not_null":true},{"name":"oom_resource_pools","type":"nvarchar(4000)"},{"name":"top_memory_clerks","type":"nvarchar(4000)"},{"name":"top_resource_pools","type":"nvarchar(4000)"},{"name":"possible_leaked_memory_clerks","type":"nvarchar(4000)"},{"name":"possible_non_sos_leaked_memory_mb","type":"int"}]} +{"schema":"sys","name":"dm_os_parent_block_descriptors","kind":"v","columns":[{"name":"parent_block_descriptor","type":"varbinary(8)","not_null":true},{"name":"total_blocks","type":"bigint","not_null":true},{"name":"free_blocks","type":"bigint","not_null":true},{"name":"uncommitted_blocks","type":"bigint","not_null":true},{"name":"block_allocator_address","type":"varbinary(8)"},{"name":"free_committed_blocks","type":"bigint"},{"name":"allocation_granularity","type":"bigint"},{"name":"is_leaf_allocator","type":"bit"},{"name":"is_oom","type":"bit"},{"name":"is_oom_warning","type":"bit"},{"name":"top_block_allocator_address","type":"varbinary(8)"},{"name":"top_block_allocation_granularity","type":"bigint"}]} +{"schema":"sys","name":"dm_os_performance_counters","kind":"v","columns":[{"name":"object_name","type":"nchar(128)","not_null":true},{"name":"counter_name","type":"nchar(128)","not_null":true},{"name":"instance_name","type":"nchar(128)"},{"name":"cntr_value","type":"bigint","not_null":true},{"name":"cntr_type","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_process_memory","kind":"v","columns":[{"name":"physical_memory_in_use_kb","type":"bigint","not_null":true},{"name":"large_page_allocations_kb","type":"bigint","not_null":true},{"name":"locked_page_allocations_kb","type":"bigint","not_null":true},{"name":"total_virtual_address_space_kb","type":"bigint","not_null":true},{"name":"virtual_address_space_reserved_kb","type":"bigint","not_null":true},{"name":"virtual_address_space_committed_kb","type":"bigint","not_null":true},{"name":"virtual_address_space_available_kb","type":"bigint","not_null":true},{"name":"page_fault_count","type":"bigint","not_null":true},{"name":"memory_utilization_percentage","type":"int","not_null":true},{"name":"available_commit_limit_kb","type":"bigint","not_null":true},{"name":"process_physical_memory_low","type":"bit","not_null":true},{"name":"process_virtual_memory_low","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_os_ring_buffers","kind":"v","columns":[{"name":"ring_buffer_address","type":"varbinary(8)","not_null":true},{"name":"ring_buffer_type","type":"nvarchar(60)","not_null":true},{"name":"timestamp","type":"bigint","not_null":true},{"name":"record","type":"nvarchar(max)"},{"name":"ring_buffer_group","type":"nvarchar(60)","not_null":true},{"name":"create_time","type":"datetime2(7)","not_null":true}]} +{"schema":"sys","name":"dm_os_schedulers","kind":"v","columns":[{"name":"scheduler_address","type":"varbinary(8)","not_null":true},{"name":"parent_node_id","type":"int","not_null":true},{"name":"scheduler_id","type":"int","not_null":true},{"name":"cpu_id","type":"int","not_null":true},{"name":"status","type":"nvarchar(60)","not_null":true},{"name":"is_online","type":"bit","not_null":true},{"name":"is_idle","type":"bit","not_null":true},{"name":"preemptive_switches_count","type":"int","not_null":true},{"name":"context_switches_count","type":"int","not_null":true},{"name":"idle_switches_count","type":"int","not_null":true},{"name":"current_tasks_count","type":"int","not_null":true},{"name":"runnable_tasks_count","type":"int","not_null":true},{"name":"current_workers_count","type":"int","not_null":true},{"name":"active_workers_count","type":"int","not_null":true},{"name":"work_queue_count","type":"bigint","not_null":true},{"name":"pending_disk_io_count","type":"int","not_null":true},{"name":"queued_disk_io_count","type":"int","not_null":true},{"name":"load_factor","type":"int","not_null":true},{"name":"yield_count","type":"int","not_null":true},{"name":"last_timer_activity","type":"bigint","not_null":true},{"name":"failed_to_create_worker","type":"bit","not_null":true},{"name":"active_worker_address","type":"varbinary(8)"},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"task_memory_object_address","type":"varbinary(8)","not_null":true},{"name":"quantum_length_us","type":"bigint","not_null":true},{"name":"total_cpu_usage_ms","type":"bigint","not_null":true},{"name":"total_cpu_idle_capped_ms","type":"bigint"},{"name":"total_scheduler_delay_ms","type":"bigint","not_null":true},{"name":"ideal_workers_limit","type":"int","not_null":true},{"name":"total_signal_time","type":"bigint","not_null":true},{"name":"total_waits_completed","type":"bigint","not_null":true},{"name":"total_enqueued_tasks","type":"int","not_null":true},{"name":"total_completed_tasks","type":"int","not_null":true},{"name":"spinlock_wait_time_ms","type":"bigint","not_null":true},{"name":"spinlock_max_wait_time_ms","type":"bigint","not_null":true},{"name":"spinlock_wait_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_server_diagnostics_log_configurations","kind":"v","columns":[{"name":"is_enabled","type":"int"},{"name":"path","type":"nvarchar(260)","not_null":true},{"name":"max_size","type":"int"},{"name":"max_files","type":"int"}]} +{"schema":"sys","name":"dm_os_spinlock_stats","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"collisions","type":"bigint"},{"name":"spins","type":"bigint"},{"name":"spins_per_collision","type":"real"},{"name":"sleep_time","type":"bigint"},{"name":"backoffs","type":"bigint"}]} +{"schema":"sys","name":"dm_os_stacks","kind":"v","columns":[{"name":"stack_address","type":"varbinary(8)","not_null":true},{"name":"frame_index","type":"int","not_null":true},{"name":"frame_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_os_sublatches","kind":"v","columns":[{"name":"superlatch_address","type":"varbinary(8)"},{"name":"sublatch_address","type":"varbinary(8)","not_null":true},{"name":"partition_id","type":"int","not_null":true},{"name":"class_desc","type":"nvarchar(60)","not_null":true},{"name":"latch_desc","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_sys_info","kind":"v","columns":[{"name":"cpu_ticks","type":"bigint","not_null":true},{"name":"ms_ticks","type":"bigint","not_null":true},{"name":"cpu_count","type":"int","not_null":true},{"name":"hyperthread_ratio","type":"int","not_null":true},{"name":"physical_memory_kb","type":"bigint","not_null":true},{"name":"virtual_memory_kb","type":"bigint","not_null":true},{"name":"committed_kb","type":"bigint","not_null":true},{"name":"committed_target_kb","type":"bigint","not_null":true},{"name":"visible_target_kb","type":"bigint","not_null":true},{"name":"stack_size_in_bytes","type":"int","not_null":true},{"name":"os_quantum","type":"bigint","not_null":true},{"name":"os_error_mode","type":"int","not_null":true},{"name":"os_priority_class","type":"int"},{"name":"max_workers_count","type":"int","not_null":true},{"name":"scheduler_count","type":"int","not_null":true},{"name":"scheduler_total_count","type":"int","not_null":true},{"name":"deadlock_monitor_serial_number","type":"int","not_null":true},{"name":"sqlserver_start_time_ms_ticks","type":"bigint","not_null":true},{"name":"sqlserver_start_time","type":"datetime","not_null":true},{"name":"affinity_type","type":"int","not_null":true},{"name":"affinity_type_desc","type":"nvarchar(60)","not_null":true},{"name":"process_kernel_time_ms","type":"bigint","not_null":true},{"name":"process_user_time_ms","type":"bigint","not_null":true},{"name":"time_source","type":"int","not_null":true},{"name":"time_source_desc","type":"nvarchar(60)","not_null":true},{"name":"virtual_machine_type","type":"int","not_null":true},{"name":"virtual_machine_type_desc","type":"nvarchar(60)","not_null":true},{"name":"softnuma_configuration","type":"int","not_null":true},{"name":"softnuma_configuration_desc","type":"nvarchar(60)","not_null":true},{"name":"process_physical_affinity","type":"nvarchar(3072)","not_null":true},{"name":"sql_memory_model","type":"int","not_null":true},{"name":"sql_memory_model_desc","type":"nvarchar(60)","not_null":true},{"name":"socket_count","type":"int","not_null":true},{"name":"cores_per_socket","type":"int","not_null":true},{"name":"numa_node_count","type":"int","not_null":true},{"name":"container_type","type":"int","not_null":true},{"name":"container_type_desc","type":"nvarchar(60)","not_null":true}]} +{"schema":"sys","name":"dm_os_sys_memory","kind":"v","columns":[{"name":"total_physical_memory_kb","type":"bigint","not_null":true},{"name":"available_physical_memory_kb","type":"bigint","not_null":true},{"name":"total_page_file_kb","type":"bigint","not_null":true},{"name":"available_page_file_kb","type":"bigint","not_null":true},{"name":"system_cache_kb","type":"bigint","not_null":true},{"name":"kernel_paged_pool_kb","type":"bigint","not_null":true},{"name":"kernel_nonpaged_pool_kb","type":"bigint","not_null":true},{"name":"system_high_memory_signal_state","type":"bit","not_null":true},{"name":"system_low_memory_signal_state","type":"bit","not_null":true},{"name":"system_memory_state_desc","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_os_tasks","kind":"v","columns":[{"name":"task_address","type":"varbinary(8)","not_null":true},{"name":"task_state","type":"nvarchar(60)"},{"name":"context_switches_count","type":"int"},{"name":"pending_io_count","type":"int"},{"name":"pending_io_byte_count","type":"bigint"},{"name":"pending_io_byte_average","type":"int"},{"name":"scheduler_id","type":"int","not_null":true},{"name":"session_id","type":"smallint"},{"name":"exec_context_id","type":"int"},{"name":"request_id","type":"int"},{"name":"worker_address","type":"varbinary(8)"},{"name":"host_address","type":"varbinary(8)","not_null":true},{"name":"parent_task_address","type":"varbinary(8)"},{"name":"task_local_storage","type":"nvarchar(3072)"}]} +{"schema":"sys","name":"dm_os_threads","kind":"v","columns":[{"name":"thread_address","type":"varbinary(8)","not_null":true},{"name":"started_by_sqlservr","type":"bit","not_null":true},{"name":"os_thread_id","type":"int","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"instruction_address","type":"varbinary(8)"},{"name":"creation_time","type":"datetime"},{"name":"kernel_time","type":"bigint"},{"name":"usermode_time","type":"bigint"},{"name":"stack_base_address","type":"varbinary(8)","not_null":true},{"name":"stack_end_address","type":"varbinary(8)"},{"name":"stack_bytes_committed","type":"int","not_null":true},{"name":"stack_bytes_used","type":"int"},{"name":"affinity","type":"bigint","not_null":true},{"name":"priority","type":"int"},{"name":"locale","type":"int"},{"name":"token","type":"varbinary(8)"},{"name":"is_impersonating","type":"int"},{"name":"is_waiting_on_loader_lock","type":"int"},{"name":"fiber_data","type":"varbinary(8)"},{"name":"thread_handle","type":"varbinary(8)"},{"name":"event_handle","type":"varbinary(8)"},{"name":"scheduler_address","type":"varbinary(8)"},{"name":"worker_address","type":"varbinary(8)"},{"name":"fiber_context_address","type":"varbinary(8)"},{"name":"self_address","type":"varbinary(8)"},{"name":"processor_group","type":"smallint","not_null":true},{"name":"description","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_virtual_address_dump","kind":"v","columns":[{"name":"region_base_address","type":"varbinary(8)","not_null":true},{"name":"region_allocation_base_address","type":"varbinary(8)","not_null":true},{"name":"region_allocation_protection","type":"varbinary(8)","not_null":true},{"name":"region_size_in_bytes","type":"bigint","not_null":true},{"name":"region_state","type":"varbinary(8)","not_null":true},{"name":"region_current_protection","type":"varbinary(8)","not_null":true},{"name":"region_type","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_os_wait_stats","kind":"v","columns":[{"name":"wait_type","type":"nvarchar(60)","not_null":true},{"name":"waiting_tasks_count","type":"bigint","not_null":true},{"name":"wait_time_ms","type":"bigint","not_null":true},{"name":"max_wait_time_ms","type":"bigint","not_null":true},{"name":"signal_wait_time_ms","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_waiting_tasks","kind":"v","columns":[{"name":"waiting_task_address","type":"varbinary(8)","not_null":true},{"name":"session_id","type":"smallint"},{"name":"exec_context_id","type":"int"},{"name":"wait_duration_ms","type":"bigint"},{"name":"wait_type","type":"nvarchar(60)"},{"name":"resource_address","type":"varbinary(8)"},{"name":"blocking_task_address","type":"varbinary(8)"},{"name":"blocking_session_id","type":"smallint"},{"name":"blocking_exec_context_id","type":"int"},{"name":"resource_description","type":"nvarchar(3072)"}]} +{"schema":"sys","name":"dm_os_windows_info","kind":"v","columns":[{"name":"windows_release","type":"nvarchar(256)","not_null":true},{"name":"windows_service_pack_level","type":"nvarchar(256)","not_null":true},{"name":"windows_sku","type":"int"},{"name":"os_language_version","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_worker_local_storage","kind":"v","columns":[{"name":"worker_address","type":"varbinary(8)","not_null":true},{"name":"comp_exec_ctxt_address","type":"varbinary(8)","not_null":true},{"name":"ec_address","type":"varbinary(8)","not_null":true},{"name":"broker_address","type":"varbinary(8)","not_null":true},{"name":"task_proxy_address","type":"varbinary(8)","not_null":true},{"name":"msqlxact_address","type":"varbinary(8)","not_null":true},{"name":"sql_prof_address","type":"varbinary(8)","not_null":true},{"name":"stack_checker_address","type":"varbinary(8)","not_null":true},{"name":"host_task_address","type":"varbinary(8)","not_null":true},{"name":"sni_error_address","type":"varbinary(8)","not_null":true},{"name":"queryscan_address","type":"varbinary(8)","not_null":true},{"name":"diag_address","type":"varbinary(8)","not_null":true},{"name":"query_driver_address","type":"varbinary(8)","not_null":true},{"name":"federatedxact_address","type":"varbinary(8)","not_null":true},{"name":"filestream_address","type":"varbinary(8)","not_null":true},{"name":"qe_cc_address","type":"varbinary(8)","not_null":true},{"name":"xtp_address","type":"varbinary(8)","not_null":true},{"name":"gq_address","type":"varbinary(8)","not_null":true},{"name":"extensibility_ctxt_address","type":"varbinary(8)","not_null":true},{"name":"performance_counters_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_os_workers","kind":"v","columns":[{"name":"worker_address","type":"varbinary(8)","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"is_preemptive","type":"bit"},{"name":"is_fiber","type":"bit"},{"name":"is_sick","type":"bit"},{"name":"is_in_cc_exception","type":"bit"},{"name":"is_fatal_exception","type":"bit"},{"name":"is_inside_catch","type":"bit"},{"name":"is_in_polling_io_completion_routine","type":"bit"},{"name":"context_switch_count","type":"int","not_null":true},{"name":"pending_io_count","type":"int","not_null":true},{"name":"pending_io_byte_count","type":"bigint","not_null":true},{"name":"pending_io_byte_average","type":"int","not_null":true},{"name":"wait_started_ms_ticks","type":"bigint","not_null":true},{"name":"wait_resumed_ms_ticks","type":"bigint","not_null":true},{"name":"task_bound_ms_ticks","type":"bigint","not_null":true},{"name":"worker_created_ms_ticks","type":"bigint","not_null":true},{"name":"exception_num","type":"int","not_null":true},{"name":"exception_severity","type":"int","not_null":true},{"name":"exception_address","type":"varbinary(8)"},{"name":"affinity","type":"bigint","not_null":true},{"name":"state","type":"nvarchar(60)"},{"name":"start_quantum","type":"bigint","not_null":true},{"name":"end_quantum","type":"bigint","not_null":true},{"name":"last_wait_type","type":"nvarchar(60)"},{"name":"return_code","type":"int","not_null":true},{"name":"quantum_used","type":"bigint","not_null":true},{"name":"max_quantum","type":"bigint","not_null":true},{"name":"boost_count","type":"int","not_null":true},{"name":"tasks_processed_count","type":"int","not_null":true},{"name":"fiber_address","type":"varbinary(8)"},{"name":"task_address","type":"varbinary(8)"},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"thread_address","type":"varbinary(8)"},{"name":"signal_worker_address","type":"varbinary(8)"},{"name":"scheduler_address","type":"varbinary(8)"},{"name":"processor_group","type":"smallint","not_null":true},{"name":"worker_migration_count","type":"int","not_null":true},{"name":"spinlock_wait_time_ms","type":"bigint","not_null":true},{"name":"spinlock_max_wait_time_ms","type":"bigint","not_null":true},{"name":"spinlock_wait_count","type":"bigint","not_null":true},{"name":"cpu_used","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_pal_processes","kind":"v","columns":[{"name":"process_id","type":"bigint","not_null":true},{"name":"process_name","type":"nvarchar(256)","not_null":true},{"name":"processor_time","type":"bigint","not_null":true},{"name":"user_time","type":"bigint","not_null":true},{"name":"privileged_time","type":"bigint","not_null":true},{"name":"virtual_bytes_peak","type":"bigint","not_null":true},{"name":"virtual_bytes","type":"bigint","not_null":true},{"name":"working_set_peak","type":"bigint","not_null":true},{"name":"working_set","type":"bigint","not_null":true},{"name":"page_file_bytes_peak","type":"bigint","not_null":true},{"name":"page_file_bytes","type":"bigint","not_null":true},{"name":"private_bytes","type":"bigint","not_null":true},{"name":"thread_count","type":"bigint","not_null":true},{"name":"elapsed_time","type":"bigint","not_null":true},{"name":"pool_paged_bytes","type":"bigint","not_null":true},{"name":"handle_count","type":"bigint","not_null":true},{"name":"io_read_operations","type":"bigint","not_null":true},{"name":"io_write_operations","type":"bigint","not_null":true},{"name":"io_read_bytes","type":"bigint","not_null":true},{"name":"io_write_bytes","type":"bigint","not_null":true},{"name":"working_set_private","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_pal_ring_buffers","kind":"v","columns":[{"name":"ring_buffer_address","type":"varbinary(8)","not_null":true},{"name":"ring_buffer_type","type":"nvarchar(60)","not_null":true},{"name":"timestamp","type":"bigint","not_null":true},{"name":"record","type":"nvarchar(max)"},{"name":"ring_buffer_group","type":"nvarchar(60)","not_null":true},{"name":"create_time","type":"datetime2(7)","not_null":true}]} +{"schema":"sys","name":"dm_qn_subscriptions","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"sid","type":"varbinary(85)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"created","type":"datetime","not_null":true},{"name":"timeout","type":"int","not_null":true},{"name":"status","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_repl_articles","kind":"v","columns":[{"name":"artcache_db_address","type":"varbinary(8)"},{"name":"artcache_table_address","type":"varbinary(8)"},{"name":"artcache_schema_address","type":"varbinary(8)"},{"name":"artcache_article_address","type":"varbinary(8)"},{"name":"artid","type":"int"},{"name":"artfilter","type":"int"},{"name":"artobjid","type":"int"},{"name":"artpubid","type":"int"},{"name":"artstatus","type":"tinyint"},{"name":"arttype","type":"tinyint"},{"name":"wszartdesttable","type":"nvarchar(256)"},{"name":"wszartdesttableowner","type":"nvarchar(256)"},{"name":"wszartinscmd","type":"nvarchar(258)"},{"name":"cmdtypeins","type":"int"},{"name":"wszartdelcmd","type":"nvarchar(258)"},{"name":"cmdtypedel","type":"int"},{"name":"wszartupdcmd","type":"nvarchar(258)"},{"name":"cmdtypeupd","type":"int"},{"name":"wszartpartialupdcmd","type":"nvarchar(258)"},{"name":"cmdtypepartialupd","type":"int"},{"name":"numcol","type":"int"},{"name":"artcmdtype","type":"tinyint"},{"name":"artgeninscmd","type":"nvarchar(4000)"},{"name":"artgendelcmd","type":"nvarchar(4000)"},{"name":"artgenupdcmd","type":"nvarchar(4000)"},{"name":"artpartialupdcmd","type":"nvarchar(4000)"},{"name":"artupdtxtcmd","type":"nvarchar(4000)"},{"name":"artgenins2cmd","type":"nvarchar(4000)"},{"name":"artgendel2cmd","type":"nvarchar(4000)"},{"name":"finreconcile","type":"tinyint"},{"name":"fpuballowupdate","type":"tinyint"},{"name":"intpublicationoptions","type":"int"}]} +{"schema":"sys","name":"dm_repl_schemas","kind":"v","columns":[{"name":"artcache_schema_address","type":"varbinary(8)"},{"name":"tabid","type":"int"},{"name":"indexid","type":"smallint"},{"name":"idsch","type":"int"},{"name":"tabschema","type":"nvarchar(256)"},{"name":"cctabschema","type":"smallint"},{"name":"tabname","type":"nvarchar(256)"},{"name":"cctabname","type":"smallint"},{"name":"rowsetid_delete","type":"bigint"},{"name":"rowsetid_insert","type":"bigint"},{"name":"num_pk_cols","type":"int"},{"name":"pcitee","type":"varbinary(8)"},{"name":"re_numtextcols","type":"int"},{"name":"re_schema_lsn_begin","type":"nvarchar(24)"},{"name":"re_schema_lsn_end","type":"nvarchar(24)"},{"name":"re_numcols","type":"int"},{"name":"re_colid","type":"int"},{"name":"re_awcname","type":"nvarchar(256)"},{"name":"re_ccname","type":"smallint"},{"name":"re_colattr","type":"smallint"},{"name":"re_maxlen","type":"smallint"},{"name":"re_prec","type":"tinyint"},{"name":"re_scale","type":"tinyint"},{"name":"re_collatid","type":"int"},{"name":"re_xvtype","type":"tinyint"},{"name":"re_offset","type":"int"},{"name":"re_bitpos","type":"tinyint"},{"name":"re_fnullable","type":"tinyint"},{"name":"re_fansitrim","type":"tinyint"},{"name":"re_computed","type":"int"},{"name":"se_rowsetid","type":"bigint"},{"name":"se_schema_lsn_begin","type":"nvarchar(24)"},{"name":"se_schema_lsn_end","type":"nvarchar(24)"},{"name":"se_numcols","type":"int"},{"name":"se_colid","type":"int"},{"name":"se_maxlen","type":"smallint"},{"name":"se_prec","type":"tinyint"},{"name":"se_scale","type":"tinyint"},{"name":"se_collatid","type":"int"},{"name":"se_xvtype","type":"tinyint"},{"name":"se_offset","type":"int"},{"name":"se_bitpos","type":"tinyint"},{"name":"se_fnullable","type":"tinyint"},{"name":"se_fansitrim","type":"tinyint"},{"name":"se_computed","type":"tinyint"},{"name":"se_nullbitinleafrows","type":"smallint"}]} +{"schema":"sys","name":"dm_repl_tranhash","kind":"v","columns":[{"name":"buckets","type":"int"},{"name":"hashed_trans","type":"int"},{"name":"completed_trans","type":"int"},{"name":"compensated_trans","type":"int"},{"name":"first_begin_lsn","type":"nvarchar(24)"},{"name":"last_commit_lsn","type":"nvarchar(24)"}]} +{"schema":"sys","name":"dm_repl_traninfo","kind":"v","columns":[{"name":"fp2p_pub_exists","type":"tinyint"},{"name":"db_ver","type":"int"},{"name":"comp_range_address","type":"varbinary(8)"},{"name":"textinfo_address","type":"varbinary(8)"},{"name":"fsinfo_address","type":"varbinary(8)"},{"name":"begin_lsn","type":"nvarchar(24)"},{"name":"commit_lsn","type":"nvarchar(24)"},{"name":"dbid","type":"smallint"},{"name":"rows","type":"int"},{"name":"xdesid","type":"nvarchar(24)"},{"name":"artcache_table_address","type":"varbinary(8)"},{"name":"server","type":"nvarchar(256)"},{"name":"server_len_in_bytes","type":"int"},{"name":"database","type":"nvarchar(256)"},{"name":"db_len_in_bytes","type":"int"},{"name":"originator","type":"nvarchar(256)"},{"name":"originator_len_in_bytes","type":"int"},{"name":"orig_db","type":"nvarchar(256)"},{"name":"orig_db_len_in_bytes","type":"int"},{"name":"cmds_in_tran","type":"int"},{"name":"is_boundedupdate_singleton","type":"tinyint"},{"name":"begin_update_lsn","type":"nvarchar(24)"},{"name":"delete_lsn","type":"nvarchar(24)"},{"name":"last_end_lsn","type":"nvarchar(24)"},{"name":"fcomplete","type":"tinyint"},{"name":"fcompensated","type":"tinyint"},{"name":"fprocessingtext","type":"tinyint"},{"name":"max_cmds_in_tran","type":"int"},{"name":"begin_time","type":"datetime"},{"name":"commit_time","type":"datetime"},{"name":"session_id","type":"int"},{"name":"session_phase","type":"nvarchar(200)"},{"name":"is_known_cdc_tran","type":"tinyint"},{"name":"error_count","type":"int"}]} +{"schema":"sys","name":"dm_request_phases","kind":"v","columns":[{"name":"dist_statement_id","type":"uniqueidentifier","not_null":true},{"name":"dist_request_id","type":"uniqueidentifier","not_null":true},{"name":"id","type":"nvarchar(30)","not_null":true},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time_ms","type":"bigint"},{"name":"min_time_ms","type":"bigint"},{"name":"max_time_ms","type":"bigint"},{"name":"avg_time_ms","type":"bigint"},{"name":"stdev_time_ms","type":"float"},{"name":"input_dop","type":"int","not_null":true},{"name":"output_dop","type":"int","not_null":true},{"name":"state_desc","type":"nvarchar(30)","not_null":true},{"name":"total_bytes_processed","type":"bigint"},{"name":"operation_type","type":"nvarchar(30)"},{"name":"task_retries","type":"int"},{"name":"parent_ids","type":"nvarchar(30)"},{"name":"min_rows","type":"bigint"},{"name":"max_rows","type":"bigint"},{"name":"avg_rows","type":"bigint"},{"name":"stdev_rows","type":"float"},{"name":"total_rows","type":"bigint"},{"name":"error_id","type":"nvarchar(30)"}]} +{"schema":"sys","name":"dm_request_phases_exec_task_stats","kind":"v","columns":[{"name":"dist_request_id","type":"uniqueidentifier","not_null":true},{"name":"id","type":"nvarchar(30)","not_null":true},{"name":"min_time_ms","type":"bigint"},{"name":"max_time_ms","type":"bigint"},{"name":"avg_time_ms","type":"bigint"},{"name":"stdev_time_ms","type":"float"},{"name":"total_bytes_processed","type":"bigint"},{"name":"min_rows","type":"bigint"},{"name":"max_rows","type":"bigint"},{"name":"avg_rows","type":"bigint"},{"name":"stdev_rows","type":"float"},{"name":"total_rows","type":"bigint"},{"name":"error_id","type":"nvarchar(30)"}]} +{"schema":"sys","name":"dm_request_phases_task_group_stats","kind":"v","columns":[{"name":"dist_request_id","type":"uniqueidentifier","not_null":true},{"name":"id","type":"nvarchar(30)","not_null":true},{"name":"dist_statement_id","type":"uniqueidentifier","not_null":true},{"name":"state_desc","type":"nvarchar(30)","not_null":true},{"name":"start_time","type":"bigint","not_null":true},{"name":"end_time","type":"bigint","not_null":true},{"name":"input_dop","type":"int","not_null":true},{"name":"output_dop","type":"int","not_null":true},{"name":"operation_type","type":"nvarchar(30)"},{"name":"task_retries","type":"int"},{"name":"parent_ids","type":"nvarchar(30)"}]} +{"schema":"sys","name":"dm_resource_governor_configuration","kind":"v","columns":[{"name":"classifier_function_id","type":"int","not_null":true},{"name":"is_reconfiguration_pending","type":"tinyint","not_null":true},{"name":"max_outstanding_io_per_volume","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_external_resource_pool_affinity","kind":"v","columns":[{"name":"external_pool_id","type":"int","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"cpu_mask","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_external_resource_pools","kind":"v","columns":[{"name":"external_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"pool_version","type":"bigint","not_null":true},{"name":"max_cpu_percent","type":"int","not_null":true},{"name":"max_processes","type":"int","not_null":true},{"name":"max_memory_percent","type":"int","not_null":true},{"name":"statistics_start_time","type":"datetime","not_null":true},{"name":"peak_memory_kb","type":"bigint","not_null":true},{"name":"write_io_count","type":"bigint","not_null":true},{"name":"read_io_count","type":"bigint","not_null":true},{"name":"total_cpu_kernel_ms","type":"bigint","not_null":true},{"name":"total_cpu_user_ms","type":"bigint","not_null":true},{"name":"active_processes_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_resource_pool_affinity","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"scheduler_mask","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_resource_pool_volumes","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"volume_name","type":"nvarchar(256)","not_null":true},{"name":"read_io_queued_total","type":"int","not_null":true},{"name":"read_io_issued_total","type":"int","not_null":true},{"name":"read_io_completed_total","type":"int","not_null":true},{"name":"read_io_throttled_total","type":"int","not_null":true},{"name":"read_bytes_total","type":"bigint","not_null":true},{"name":"read_io_stall_total_ms","type":"bigint","not_null":true},{"name":"read_io_stall_queued_ms","type":"bigint","not_null":true},{"name":"write_io_queued_total","type":"int","not_null":true},{"name":"write_io_issued_total","type":"int","not_null":true},{"name":"write_io_completed_total","type":"int","not_null":true},{"name":"write_io_throttled_total","type":"int","not_null":true},{"name":"write_bytes_total","type":"bigint","not_null":true},{"name":"write_io_stall_total_ms","type":"bigint","not_null":true},{"name":"write_io_stall_queued_ms","type":"bigint","not_null":true},{"name":"io_issue_violations_total","type":"int","not_null":true},{"name":"io_issue_delay_total_ms","type":"bigint","not_null":true},{"name":"io_issue_ahead_total_ms","type":"bigint","not_null":true},{"name":"reserved_io_limited_by_volume_total","type":"int","not_null":true},{"name":"io_issue_delay_non_throttled_total_ms","type":"bigint"}]} +{"schema":"sys","name":"dm_resource_governor_resource_pools","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"statistics_start_time","type":"datetime","not_null":true},{"name":"total_cpu_usage_ms","type":"bigint","not_null":true},{"name":"cache_memory_kb","type":"bigint","not_null":true},{"name":"compile_memory_kb","type":"bigint","not_null":true},{"name":"used_memgrant_kb","type":"bigint","not_null":true},{"name":"total_memgrant_count","type":"bigint","not_null":true},{"name":"total_memgrant_timeout_count","type":"bigint","not_null":true},{"name":"active_memgrant_count","type":"int","not_null":true},{"name":"active_memgrant_kb","type":"bigint","not_null":true},{"name":"memgrant_waiter_count","type":"int","not_null":true},{"name":"max_memory_kb","type":"bigint","not_null":true},{"name":"used_memory_kb","type":"bigint","not_null":true},{"name":"target_memory_kb","type":"bigint","not_null":true},{"name":"out_of_memory_count","type":"bigint","not_null":true},{"name":"min_cpu_percent","type":"int","not_null":true},{"name":"max_cpu_percent","type":"int","not_null":true},{"name":"min_memory_percent","type":"int","not_null":true},{"name":"max_memory_percent","type":"int","not_null":true},{"name":"cap_cpu_percent","type":"int","not_null":true},{"name":"min_iops_per_volume","type":"int"},{"name":"max_iops_per_volume","type":"int"},{"name":"read_io_queued_total","type":"int"},{"name":"read_io_issued_total","type":"int"},{"name":"read_io_completed_total","type":"int","not_null":true},{"name":"read_io_throttled_total","type":"int"},{"name":"read_bytes_total","type":"bigint","not_null":true},{"name":"read_io_stall_total_ms","type":"bigint","not_null":true},{"name":"read_io_stall_queued_ms","type":"bigint"},{"name":"write_io_queued_total","type":"int"},{"name":"write_io_issued_total","type":"int"},{"name":"write_io_completed_total","type":"int","not_null":true},{"name":"write_io_throttled_total","type":"int"},{"name":"write_bytes_total","type":"bigint","not_null":true},{"name":"write_io_stall_total_ms","type":"bigint","not_null":true},{"name":"write_io_stall_queued_ms","type":"bigint"},{"name":"io_issue_violations_total","type":"int"},{"name":"io_issue_delay_total_ms","type":"bigint"},{"name":"io_issue_ahead_total_ms","type":"bigint"},{"name":"reserved_io_limited_by_volume_total","type":"int"},{"name":"io_issue_delay_non_throttled_total_ms","type":"bigint"},{"name":"total_cpu_delayed_ms","type":"bigint","not_null":true},{"name":"total_cpu_active_ms","type":"bigint","not_null":true},{"name":"total_cpu_violation_delay_ms","type":"bigint","not_null":true},{"name":"total_cpu_violation_sec","type":"bigint","not_null":true},{"name":"total_cpu_usage_preemptive_ms","type":"bigint","not_null":true},{"name":"total_cpu_usage_actual_ms","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_workload_groups","kind":"v","columns":[{"name":"group_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"pool_id","type":"int","not_null":true},{"name":"external_pool_id","type":"int"},{"name":"statistics_start_time","type":"datetime","not_null":true},{"name":"total_request_count","type":"bigint","not_null":true},{"name":"total_queued_request_count","type":"bigint","not_null":true},{"name":"active_request_count","type":"int","not_null":true},{"name":"queued_request_count","type":"int","not_null":true},{"name":"total_cpu_limit_violation_count","type":"bigint","not_null":true},{"name":"total_cpu_usage_ms","type":"bigint","not_null":true},{"name":"max_request_cpu_time_ms","type":"bigint","not_null":true},{"name":"blocked_task_count","type":"int","not_null":true},{"name":"total_lock_wait_count","type":"bigint","not_null":true},{"name":"total_lock_wait_time_ms","type":"bigint","not_null":true},{"name":"total_query_optimization_count","type":"bigint","not_null":true},{"name":"total_suboptimal_plan_generation_count","type":"bigint","not_null":true},{"name":"total_reduced_memgrant_count","type":"bigint","not_null":true},{"name":"max_request_grant_memory_kb","type":"bigint","not_null":true},{"name":"active_parallel_thread_count","type":"bigint","not_null":true},{"name":"importance","type":"nvarchar(256)","not_null":true},{"name":"request_max_memory_grant_percent","type":"int","not_null":true},{"name":"request_max_cpu_time_sec","type":"int","not_null":true},{"name":"request_memory_grant_timeout_sec","type":"int","not_null":true},{"name":"group_max_requests","type":"int","not_null":true},{"name":"max_dop","type":"int","not_null":true},{"name":"effective_max_dop","type":"int","not_null":true},{"name":"total_cpu_usage_preemptive_ms","type":"bigint","not_null":true},{"name":"request_max_memory_grant_percent_numeric","type":"float","not_null":true},{"name":"total_cpu_usage_actual_ms","type":"bigint","not_null":true},{"name":"cache_memory_kb","type":"bigint"},{"name":"compile_memory_kb","type":"bigint"},{"name":"used_memory_kb","type":"bigint","not_null":true},{"name":"cap_cpu_percent","type":"decimal(5,2)"},{"name":"tempdb_data_space_kb","type":"bigint"},{"name":"peak_tempdb_data_space_kb","type":"bigint"},{"name":"total_tempdb_data_limit_violation_count","type":"bigint"}]} +{"schema":"sys","name":"dm_server_accelerator_status","kind":"v","columns":[{"name":"accelerator","type":"nvarchar(256)","not_null":true},{"name":"accelerator_desc","type":"nvarchar(256)","not_null":true},{"name":"config","type":"tinyint"},{"name":"config_in_use","type":"tinyint"},{"name":"mode","type":"tinyint"},{"name":"mode_desc","type":"nvarchar(60)"},{"name":"mode_reason","type":"tinyint"},{"name":"mode_reason_desc","type":"nvarchar(60)"},{"name":"accelerator_hardware_detected","type":"tinyint"},{"name":"accelerator_library_version","type":"nvarchar(256)"},{"name":"accelerator_driver_version","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_server_audit_status","kind":"v","columns":[{"name":"audit_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"status","type":"smallint","not_null":true},{"name":"status_desc","type":"nvarchar(256)","not_null":true},{"name":"status_time","type":"datetime2(7)","not_null":true},{"name":"event_session_address","type":"varbinary(8)"},{"name":"audit_file_path","type":"nvarchar(256)"},{"name":"audit_file_size","type":"bigint"}]} +{"schema":"sys","name":"dm_server_external_policy_actions","kind":"v","columns":[{"name":"sql_action_id","type":"int"},{"name":"action_namespace","type":"nvarchar(256)"},{"name":"action_type","type":"nvarchar(32)"},{"name":"action_provider_string","type":"nvarchar(20)"}]} +{"schema":"sys","name":"dm_server_external_policy_principal_assigned_actions","kind":"v","columns":[{"name":"principal_sid","type":"varbinary(85)"},{"name":"principal_aad_object_id","type":"nvarchar(36)"},{"name":"action_namespace","type":"nvarchar(256)"},{"name":"action_type","type":"nvarchar(32)"},{"name":"role_name","type":"nvarchar(128)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"role_assignment_scope","type":"nvarchar(4000)"},{"name":"role_assignment_type","type":"int"},{"name":"role_assignment_type_desc","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_server_external_policy_principals","kind":"v","columns":[{"name":"sid","type":"varbinary(85)"},{"name":"aad_object_id","type":"nvarchar(36)"},{"name":"type","type":"nvarchar(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"authentication_type","type":"int"},{"name":"authentication_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_server_external_policy_role_actions","kind":"v","columns":[{"name":"role_guid","type":"nvarchar(128)"},{"name":"sql_action_id","type":"int"}]} +{"schema":"sys","name":"dm_server_external_policy_role_members","kind":"v","columns":[{"name":"principal_aad_object_id","type":"nvarchar(36)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"assignment_scope","type":"nvarchar(4000)"},{"name":"assignment_type","type":"int"},{"name":"assignment_type_desc","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_server_external_policy_roles","kind":"v","columns":[{"name":"role_name","type":"nvarchar(128)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"modify_date","type":"datetime2(7)"}]} +{"schema":"sys","name":"dm_server_managed_identities","kind":"v","columns":[{"name":"client_id","type":"uniqueidentifier"},{"name":"identity_type","type":"nvarchar(60)"},{"name":"tenant_id","type":"uniqueidentifier"},{"name":"is_primary","type":"bit"}]} +{"schema":"sys","name":"dm_server_memory_dumps","kind":"v","columns":[{"name":"filename","type":"nvarchar(256)","not_null":true},{"name":"creation_time","type":"datetimeoffset(7)","not_null":true},{"name":"size_in_bytes","type":"bigint"}]} +{"schema":"sys","name":"dm_server_registry","kind":"v","columns":[{"name":"registry_key","type":"nvarchar(256)"},{"name":"value_name","type":"nvarchar(256)"},{"name":"value_data","type":"sql_variant"}]} +{"schema":"sys","name":"dm_server_services","kind":"v","columns":[{"name":"servicename","type":"nvarchar(256)","not_null":true},{"name":"startup_type","type":"int"},{"name":"startup_type_desc","type":"nvarchar(256)","not_null":true},{"name":"status","type":"int"},{"name":"status_desc","type":"nvarchar(256)","not_null":true},{"name":"process_id","type":"int"},{"name":"last_startup_time","type":"datetimeoffset(7)"},{"name":"service_account","type":"nvarchar(256)","not_null":true},{"name":"filename","type":"nvarchar(256)","not_null":true},{"name":"is_clustered","type":"nvarchar(1)","not_null":true},{"name":"cluster_nodename","type":"nvarchar(256)"},{"name":"instant_file_initialization_enabled","type":"nvarchar(1)","not_null":true}]} +{"schema":"sys","name":"dm_server_suspend_status","kind":"v","columns":[{"name":"db_id","type":"smallint","not_null":true},{"name":"db_name","type":"nvarchar(256)","not_null":true},{"name":"suspend_session_id","type":"smallint"},{"name":"suspend_time_ms","type":"bigint"},{"name":"is_diff_map_cleared","type":"bit"},{"name":"is_write_io_frozen","type":"bit"}]} +{"schema":"sys","name":"dm_tcp_listener_states","kind":"v","columns":[{"name":"listener_id","type":"int","not_null":true},{"name":"ip_address","type":"nvarchar(48)","not_null":true},{"name":"is_ipv4","type":"bit","not_null":true},{"name":"port","type":"int","not_null":true},{"name":"type","type":"smallint","not_null":true},{"name":"type_desc","type":"nvarchar(20)","not_null":true},{"name":"state","type":"smallint","not_null":true},{"name":"state_desc","type":"nvarchar(16)","not_null":true},{"name":"start_time","type":"datetime","not_null":true}]} +{"schema":"sys","name":"dm_tran_aborted_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint","not_null":true},{"name":"database_id","type":"smallint","not_null":true},{"name":"begin_xact_lsn","type":"numeric(25,0)"},{"name":"end_xact_lsn","type":"numeric(25,0)"},{"name":"begin_time","type":"datetime"},{"name":"nest_aborted","type":"bit"}]} +{"schema":"sys","name":"dm_tran_active_snapshot_database_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint"},{"name":"transaction_sequence_num","type":"bigint"},{"name":"commit_sequence_num","type":"bigint"},{"name":"session_id","type":"int"},{"name":"is_snapshot","type":"bit"},{"name":"first_snapshot_sequence_num","type":"bigint"},{"name":"max_version_chain_traversed","type":"int"},{"name":"average_version_chain_traversed","type":"float"},{"name":"elapsed_time_seconds","type":"bigint"}]} +{"schema":"sys","name":"dm_tran_active_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint","not_null":true},{"name":"name","type":"nvarchar(32)","not_null":true},{"name":"transaction_begin_time","type":"datetime","not_null":true},{"name":"transaction_type","type":"int","not_null":true},{"name":"transaction_uow","type":"uniqueidentifier"},{"name":"transaction_state","type":"int","not_null":true},{"name":"transaction_status","type":"int","not_null":true},{"name":"transaction_status2","type":"int","not_null":true},{"name":"dtc_state","type":"int","not_null":true},{"name":"dtc_status","type":"int","not_null":true},{"name":"dtc_isolation_level","type":"int","not_null":true},{"name":"filestream_transaction_id","type":"varbinary(128)"}]} +{"schema":"sys","name":"dm_tran_commit_table","kind":"v","columns":[{"name":"commit_ts","type":"bigint"},{"name":"xdes_id","type":"bigint"},{"name":"commit_lbn","type":"bigint","not_null":true},{"name":"commit_csn","type":"bigint","not_null":true},{"name":"commit_time","type":"datetime","not_null":true}]} +{"schema":"sys","name":"dm_tran_current_snapshot","kind":"v","columns":[{"name":"transaction_sequence_num","type":"bigint"}]} +{"schema":"sys","name":"dm_tran_current_transaction","kind":"v","columns":[{"name":"transaction_id","type":"bigint"},{"name":"transaction_sequence_num","type":"bigint"},{"name":"transaction_is_snapshot","type":"bit"},{"name":"first_snapshot_sequence_num","type":"bigint"},{"name":"last_transaction_sequence_num","type":"bigint"},{"name":"first_useful_sequence_num","type":"bigint"}]} +{"schema":"sys","name":"dm_tran_database_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"database_transaction_begin_time","type":"datetime"},{"name":"database_transaction_type","type":"int","not_null":true},{"name":"database_transaction_state","type":"int","not_null":true},{"name":"database_transaction_status","type":"int","not_null":true},{"name":"database_transaction_status2","type":"int","not_null":true},{"name":"database_transaction_log_record_count","type":"bigint","not_null":true},{"name":"database_transaction_replicate_record_count","type":"int","not_null":true},{"name":"database_transaction_log_bytes_used","type":"bigint","not_null":true},{"name":"database_transaction_log_bytes_reserved","type":"bigint","not_null":true},{"name":"database_transaction_log_bytes_used_system","type":"int","not_null":true},{"name":"database_transaction_log_bytes_reserved_system","type":"int","not_null":true},{"name":"database_transaction_begin_lsn","type":"numeric(25,0)"},{"name":"database_transaction_last_lsn","type":"numeric(25,0)"},{"name":"database_transaction_most_recent_savepoint_lsn","type":"numeric(25,0)"},{"name":"database_transaction_commit_lsn","type":"numeric(25,0)"},{"name":"database_transaction_last_rollback_lsn","type":"numeric(25,0)"},{"name":"database_transaction_next_undo_lsn","type":"numeric(25,0)"},{"name":"database_transaction_first_repl_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"dm_tran_distributed_transaction_stats","kind":"v","columns":[{"name":"aborted","type":"int","not_null":true},{"name":"aborted_max","type":"int","not_null":true},{"name":"forced_abort","type":"int","not_null":true},{"name":"committed","type":"int","not_null":true},{"name":"committed_max","type":"int","not_null":true},{"name":"forced_commit","type":"int","not_null":true},{"name":"heuristic","type":"int","not_null":true},{"name":"heuristic_max","type":"int","not_null":true},{"name":"in_doubt","type":"int","not_null":true},{"name":"in_doubt_max","type":"int","not_null":true},{"name":"open","type":"int","not_null":true},{"name":"open_max","type":"int","not_null":true},{"name":"single_phase_in_doubt","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_tran_global_recovery_transactions","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"transaction_uow","type":"uniqueidentifier","not_null":true},{"name":"transaction_manager_dbid","type":"int","not_null":true},{"name":"transaction_manager_rmid","type":"uniqueidentifier","not_null":true},{"name":"transaction_manager_server_name","type":"nvarchar(261)"},{"name":"transaction_manager_database_name","type":"nvarchar(129)"}]} +{"schema":"sys","name":"dm_tran_global_transactions","kind":"v","columns":[{"name":"transaction_id","type":"uniqueidentifier","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"transaction_state","type":"int","not_null":true},{"name":"resource_manager_id","type":"uniqueidentifier","not_null":true},{"name":"resource_manager_server","type":"nvarchar(261)"},{"name":"resource_manager_database","type":"nvarchar(129)"},{"name":"resource_manager_dbid","type":"int","not_null":true},{"name":"resource_manager_state","type":"int","not_null":true},{"name":"resource_prepare_lsn","type":"nvarchar(24)"},{"name":"resource_phase_1_time","type":"bigint","not_null":true},{"name":"resource_phase_2_time","type":"bigint","not_null":true},{"name":"transaction_phase_1_time","type":"bigint","not_null":true},{"name":"transaction_phase_2_time","type":"bigint","not_null":true},{"name":"transaction_total_time","type":"bigint","not_null":true},{"name":"transaction_diag_status","type":"int","not_null":true},{"name":"resource_manager_diag_status","type":"int","not_null":true},{"name":"max_csn","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_tran_global_transactions_enlistments","kind":"v","columns":[{"name":"transaction_id","type":"uniqueidentifier","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"iso_level","type":"int","not_null":true},{"name":"can_commit","type":"int","not_null":true},{"name":"enlistment_state","type":"int","not_null":true},{"name":"resource_manager_id","type":"uniqueidentifier","not_null":true},{"name":"server_name","type":"nvarchar(261)"},{"name":"database_name","type":"nvarchar(129)"},{"name":"transaction_manager_server_name","type":"nvarchar(261)"},{"name":"transaction_manager_database_name","type":"nvarchar(129)"},{"name":"transaction_manager_database_id","type":"int","not_null":true},{"name":"transaction_manager_rmid","type":"uniqueidentifier","not_null":true},{"name":"prepare_lsn","type":"nvarchar(24)"},{"name":"snapshot_timestamp","type":"bigint","not_null":true},{"name":"oldest_active_lsn","type":"nvarchar(24)"},{"name":"prepare_elapsed_time","type":"bigint","not_null":true},{"name":"object_ref_count","type":"int","not_null":true},{"name":"transaction_timeout","type":"int","not_null":true},{"name":"diag_status","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_tran_global_transactions_log","kind":"v","columns":[{"name":"transaction_id","type":"uniqueidentifier","not_null":true},{"name":"time_utc","type":"datetime","not_null":true},{"name":"dropped","type":"tinyint","not_null":true},{"name":"resource_manager_id","type":"uniqueidentifier","not_null":true},{"name":"resource_manager_prepare_lsn","type":"nvarchar(24)"},{"name":"resource_manager_ack_received","type":"tinyint","not_null":true},{"name":"commit_timestamp","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_tran_locks","kind":"v","columns":[{"name":"resource_type","type":"nvarchar(60)","not_null":true},{"name":"resource_subtype","type":"nvarchar(60)","not_null":true},{"name":"resource_database_id","type":"int","not_null":true},{"name":"resource_description","type":"nvarchar(256)","not_null":true},{"name":"resource_associated_entity_id","type":"bigint"},{"name":"resource_lock_partition","type":"int"},{"name":"request_mode","type":"nvarchar(60)","not_null":true},{"name":"request_type","type":"nvarchar(60)","not_null":true},{"name":"request_status","type":"nvarchar(60)","not_null":true},{"name":"request_reference_count","type":"smallint","not_null":true},{"name":"request_lifetime","type":"int","not_null":true},{"name":"request_session_id","type":"int","not_null":true},{"name":"request_exec_context_id","type":"int","not_null":true},{"name":"request_request_id","type":"int","not_null":true},{"name":"request_owner_type","type":"nvarchar(60)","not_null":true},{"name":"request_owner_id","type":"bigint"},{"name":"request_owner_guid","type":"uniqueidentifier"},{"name":"request_owner_lockspace_id","type":"nvarchar(32)","not_null":true},{"name":"lock_owner_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_tran_orphaned_distributed_transactions","kind":"v","columns":[{"name":"transaction_uow","type":"nvarchar(256)"},{"name":"description","type":"nvarchar(256)","not_null":true},{"name":"state","type":"nvarchar(256)","not_null":true},{"name":"isolation_level","type":"int","not_null":true},{"name":"parent","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_tran_persistent_version_store","kind":"v","columns":[{"name":"xdes_ts_push","type":"bigint","not_null":true},{"name":"xdes_ts_tran","type":"bigint","not_null":true},{"name":"subid_push","type":"int"},{"name":"subid_tran","type":"int"},{"name":"rowset_id","type":"bigint","not_null":true},{"name":"sec_version_rid","type":"binary(8)","not_null":true},{"name":"min_len","type":"smallint"},{"name":"seq_num","type":"bigint"},{"name":"prev_row_in_chain","type":"binary(8)","not_null":true},{"name":"row_version","type":"varbinary(8000)","not_null":true}]} +{"schema":"sys","name":"dm_tran_persistent_version_store_stats","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"pvs_filegroup_id","type":"smallint"},{"name":"persistent_version_store_size_kb","type":"bigint","not_null":true},{"name":"online_index_version_store_size_kb","type":"bigint","not_null":true},{"name":"current_aborted_transaction_count","type":"bigint","not_null":true},{"name":"oldest_active_transaction_id","type":"bigint","not_null":true},{"name":"oldest_active_transaction_global_id","type":"bigint","not_null":true},{"name":"oldest_aborted_transaction_id","type":"bigint","not_null":true},{"name":"min_transaction_timestamp","type":"bigint","not_null":true},{"name":"online_index_min_transaction_timestamp","type":"bigint","not_null":true},{"name":"secondary_low_water_mark","type":"bigint","not_null":true},{"name":"offrow_version_cleaner_start_time","type":"datetime2(7)"},{"name":"offrow_version_cleaner_end_time","type":"datetime2(7)"},{"name":"aborted_version_cleaner_start_time","type":"datetime2(7)"},{"name":"aborted_version_cleaner_end_time","type":"datetime2(7)"},{"name":"pvs_off_row_page_skipped_low_water_mark","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_transaction_not_cleaned","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_oldest_active_xdesid","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_min_useful_xts","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_oldest_snapshot","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_oldest_aborted_xdesid","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_tran_session_transactions","kind":"v","columns":[{"name":"session_id","type":"int","not_null":true},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"transaction_descriptor","type":"binary(8)","not_null":true},{"name":"enlist_count","type":"int","not_null":true},{"name":"is_user_transaction","type":"bit","not_null":true},{"name":"is_local","type":"bit","not_null":true},{"name":"is_enlisted","type":"bit","not_null":true},{"name":"is_bound","type":"bit","not_null":true},{"name":"open_transaction_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_tran_top_version_generators","kind":"v","columns":[{"name":"database_id","type":"smallint"},{"name":"rowset_id","type":"bigint"},{"name":"aggregated_record_length_in_bytes","type":"int"}]} +{"schema":"sys","name":"dm_tran_transactions_snapshot","kind":"v","columns":[{"name":"transaction_sequence_num","type":"bigint"},{"name":"snapshot_id","type":"int"},{"name":"snapshot_sequence_num","type":"bigint"}]} +{"schema":"sys","name":"dm_tran_version_store","kind":"v","columns":[{"name":"transaction_sequence_num","type":"bigint"},{"name":"version_sequence_num","type":"bigint"},{"name":"database_id","type":"smallint"},{"name":"rowset_id","type":"bigint"},{"name":"status","type":"tinyint"},{"name":"min_length_in_bytes","type":"smallint"},{"name":"record_length_first_part_in_bytes","type":"smallint"},{"name":"record_image_first_part","type":"varbinary(8000)"},{"name":"record_length_second_part_in_bytes","type":"smallint"},{"name":"record_image_second_part","type":"varbinary(8000)"}]} +{"schema":"sys","name":"dm_tran_version_store_space_usage","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"reserved_page_count","type":"bigint"},{"name":"reserved_space_kb","type":"bigint"}]} +{"schema":"sys","name":"dm_xe_map_values","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"object_package_guid","type":"uniqueidentifier","not_null":true},{"name":"map_key","type":"int","not_null":true},{"name":"map_value","type":"nvarchar(3072)","not_null":true}]} +{"schema":"sys","name":"dm_xe_object_columns","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"object_name","type":"nvarchar(256)","not_null":true},{"name":"object_package_guid","type":"uniqueidentifier","not_null":true},{"name":"type_name","type":"nvarchar(256)","not_null":true},{"name":"type_package_guid","type":"uniqueidentifier","not_null":true},{"name":"column_type","type":"nvarchar(60)","not_null":true},{"name":"column_value","type":"nvarchar(256)"},{"name":"capabilities","type":"int"},{"name":"capabilities_desc","type":"nvarchar(256)"},{"name":"description","type":"nvarchar(3072)"}]} +{"schema":"sys","name":"dm_xe_objects","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"object_type","type":"nvarchar(60)","not_null":true},{"name":"package_guid","type":"uniqueidentifier","not_null":true},{"name":"description","type":"nvarchar(3072)","not_null":true},{"name":"capabilities","type":"int"},{"name":"capabilities_desc","type":"nvarchar(256)"},{"name":"type_name","type":"nvarchar(256)"},{"name":"type_package_guid","type":"uniqueidentifier"},{"name":"type_size","type":"int"}]} +{"schema":"sys","name":"dm_xe_packages","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"guid","type":"uniqueidentifier","not_null":true},{"name":"description","type":"nvarchar(3072)","not_null":true},{"name":"capabilities","type":"int"},{"name":"capabilities_desc","type":"nvarchar(256)"},{"name":"module_guid","type":"nvarchar(60)","not_null":true},{"name":"module_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_xe_session_event_actions","kind":"v","columns":[{"name":"event_session_address","type":"varbinary(8)","not_null":true},{"name":"action_name","type":"nvarchar(256)","not_null":true},{"name":"action_package_guid","type":"uniqueidentifier","not_null":true},{"name":"event_name","type":"nvarchar(256)","not_null":true},{"name":"event_package_guid","type":"uniqueidentifier","not_null":true}]} +{"schema":"sys","name":"dm_xe_session_events","kind":"v","columns":[{"name":"event_session_address","type":"varbinary(8)","not_null":true},{"name":"event_name","type":"nvarchar(256)","not_null":true},{"name":"event_package_guid","type":"uniqueidentifier","not_null":true},{"name":"event_predicate","type":"nvarchar(3072)"},{"name":"event_fire_count","type":"bigint","not_null":true},{"name":"event_fire_average_time","type":"bigint","not_null":true},{"name":"event_fire_min_time","type":"bigint","not_null":true},{"name":"event_fire_max_time","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_xe_session_object_columns","kind":"v","columns":[{"name":"event_session_address","type":"varbinary(8)","not_null":true},{"name":"column_name","type":"nvarchar(256)","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"column_value","type":"nvarchar(3072)"},{"name":"object_type","type":"nvarchar(60)","not_null":true},{"name":"object_name","type":"nvarchar(256)","not_null":true},{"name":"object_package_guid","type":"uniqueidentifier","not_null":true}]} +{"schema":"sys","name":"dm_xe_session_targets","kind":"v","columns":[{"name":"event_session_address","type":"varbinary(8)","not_null":true},{"name":"target_name","type":"nvarchar(256)","not_null":true},{"name":"target_package_guid","type":"uniqueidentifier","not_null":true},{"name":"execution_count","type":"bigint","not_null":true},{"name":"execution_duration_ms","type":"bigint","not_null":true},{"name":"target_data","type":"nvarchar(max)"},{"name":"bytes_written","type":"bigint","not_null":true},{"name":"used_memory","type":"bigint","not_null":true},{"name":"max_memory","type":"bigint","not_null":true},{"name":"failed_buffer_count","type":"bigint"}]} +{"schema":"sys","name":"dm_xe_sessions","kind":"v","columns":[{"name":"address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"pending_buffers","type":"int","not_null":true},{"name":"total_regular_buffers","type":"int","not_null":true},{"name":"regular_buffer_size","type":"bigint","not_null":true},{"name":"total_large_buffers","type":"int","not_null":true},{"name":"large_buffer_size","type":"bigint","not_null":true},{"name":"total_buffer_size","type":"bigint","not_null":true},{"name":"buffer_policy_flags","type":"int","not_null":true},{"name":"buffer_policy_desc","type":"nvarchar(256)","not_null":true},{"name":"flags","type":"int","not_null":true},{"name":"flag_desc","type":"nvarchar(256)","not_null":true},{"name":"dropped_event_count","type":"int","not_null":true},{"name":"dropped_buffer_count","type":"int","not_null":true},{"name":"blocked_event_fire_time","type":"int","not_null":true},{"name":"create_time","type":"datetime","not_null":true},{"name":"largest_event_dropped_size","type":"int","not_null":true},{"name":"session_source","type":"nvarchar(256)","not_null":true},{"name":"buffer_processed_count","type":"bigint","not_null":true},{"name":"buffer_full_count","type":"bigint","not_null":true},{"name":"total_bytes_generated","type":"bigint","not_null":true},{"name":"total_target_memory","type":"bigint","not_null":true},{"name":"buffer_processing_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_xtp_gc_queue_stats","kind":"v","columns":[{"name":"queue_id","type":"int","not_null":true},{"name":"total_enqueues","type":"bigint","not_null":true},{"name":"total_dequeues","type":"bigint","not_null":true},{"name":"current_queue_depth","type":"bigint","not_null":true},{"name":"maximum_queue_depth","type":"bigint","not_null":true},{"name":"last_service_ticks","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_xtp_gc_stats","kind":"v","columns":[{"name":"rows_examined","type":"bigint","not_null":true},{"name":"rows_no_sweep_needed","type":"bigint","not_null":true},{"name":"rows_first_in_bucket","type":"bigint","not_null":true},{"name":"rows_first_in_bucket_removed","type":"bigint","not_null":true},{"name":"rows_marked_for_unlink","type":"bigint","not_null":true},{"name":"parallel_assist_count","type":"bigint","not_null":true},{"name":"idle_worker_count","type":"bigint","not_null":true},{"name":"sweep_scans_started","type":"bigint","not_null":true},{"name":"sweep_scan_retries","type":"bigint","not_null":true},{"name":"sweep_rows_touched","type":"bigint","not_null":true},{"name":"sweep_rows_expiring","type":"bigint","not_null":true},{"name":"sweep_rows_expired","type":"bigint","not_null":true},{"name":"sweep_rows_expired_removed","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_xtp_system_memory_consumers","kind":"v","columns":[{"name":"memory_consumer_id","type":"bigint","not_null":true},{"name":"memory_consumer_type","type":"int","not_null":true},{"name":"memory_consumer_type_desc","type":"nvarchar(16)","not_null":true},{"name":"memory_consumer_desc","type":"nvarchar(64)"},{"name":"lookaside_id","type":"bigint"},{"name":"allocated_bytes","type":"bigint","not_null":true},{"name":"used_bytes","type":"bigint","not_null":true},{"name":"allocation_count","type":"bigint","not_null":true},{"name":"partition_count","type":"int","not_null":true},{"name":"sizeclass_count","type":"int","not_null":true},{"name":"min_sizeclass","type":"int","not_null":true},{"name":"max_sizeclass","type":"int","not_null":true},{"name":"memory_consumer_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_xtp_threads","kind":"v","columns":[{"name":"thread_address","type":"varbinary(8)","not_null":true},{"name":"thread_type","type":"int","not_null":true},{"name":"thread_type_desc","type":"nvarchar(32)","not_null":true},{"name":"retired_row_count","type":"int","not_null":true},{"name":"retired_transaction_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_xtp_transaction_recent_rows","kind":"v","columns":[{"name":"node_id","type":"smallint","not_null":true},{"name":"xtp_transaction_id","type":"bigint","not_null":true},{"name":"row_address","type":"varbinary(8)","not_null":true},{"name":"table_address","type":"varbinary(8)","not_null":true},{"name":"before_begin","type":"bigint","not_null":true},{"name":"before_end","type":"bigint","not_null":true},{"name":"before_links","type":"int","not_null":true},{"name":"before_time","type":"bigint","not_null":true},{"name":"after_begin","type":"bigint","not_null":true},{"name":"after_end","type":"bigint","not_null":true},{"name":"after_links","type":"int","not_null":true},{"name":"after_time","type":"bigint","not_null":true},{"name":"outcome","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_xtp_transaction_stats","kind":"v","columns":[{"name":"total_count","type":"bigint","not_null":true},{"name":"read_only_count","type":"bigint","not_null":true},{"name":"total_aborts","type":"bigint","not_null":true},{"name":"system_aborts","type":"bigint","not_null":true},{"name":"validation_failures","type":"bigint","not_null":true},{"name":"dependencies_taken","type":"bigint","not_null":true},{"name":"dependencies_failed","type":"bigint","not_null":true},{"name":"savepoint_create","type":"bigint","not_null":true},{"name":"savepoint_rollbacks","type":"bigint","not_null":true},{"name":"savepoint_refreshes","type":"bigint","not_null":true},{"name":"log_bytes_written","type":"bigint","not_null":true},{"name":"log_io_count","type":"bigint","not_null":true},{"name":"phantom_scans_started","type":"bigint","not_null":true},{"name":"phantom_scans_retries","type":"bigint","not_null":true},{"name":"phantom_rows_touched","type":"bigint","not_null":true},{"name":"phantom_rows_expiring","type":"bigint","not_null":true},{"name":"phantom_rows_expired","type":"bigint","not_null":true},{"name":"phantom_rows_expired_removed","type":"bigint","not_null":true},{"name":"scans_started","type":"bigint","not_null":true},{"name":"scans_retried","type":"bigint","not_null":true},{"name":"rows_returned","type":"bigint","not_null":true},{"name":"rows_touched","type":"bigint","not_null":true},{"name":"rows_expiring","type":"bigint","not_null":true},{"name":"rows_expired","type":"bigint","not_null":true},{"name":"rows_expired_removed","type":"bigint","not_null":true},{"name":"row_insert_attempts","type":"bigint","not_null":true},{"name":"row_update_attempts","type":"bigint","not_null":true},{"name":"row_delete_attempts","type":"bigint","not_null":true},{"name":"write_conflicts","type":"bigint","not_null":true},{"name":"unique_constraint_violations","type":"bigint","not_null":true},{"name":"drop_table_memory_attempts","type":"bigint","not_null":true},{"name":"drop_table_memory_failures","type":"bigint","not_null":true}]} +{"schema":"sys","name":"edge_constraint_clauses","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"clause_number","type":"int","not_null":true},{"name":"from_object_id","type":"int","not_null":true},{"name":"to_object_id","type":"int","not_null":true}]} +{"schema":"sys","name":"edge_constraints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"is_disabled","type":"bit","not_null":true},{"name":"is_not_trusted","type":"bit","not_null":true},{"name":"is_system_named","type":"bit","not_null":true},{"name":"delete_referential_action","type":"tinyint"},{"name":"delete_referential_action_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"endpoint_webmethods","kind":"v","columns":[{"name":"endpoint_id","type":"int","not_null":true},{"name":"namespace","type":"nvarchar(384)"},{"name":"method_alias","type":"nvarchar(64)","not_null":true},{"name":"object_name","type":"nvarchar(776)"},{"name":"result_schema","type":"tinyint"},{"name":"result_schema_desc","type":"nvarchar(60)"},{"name":"result_format","type":"tinyint"},{"name":"result_format_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true}]} +{"schema":"sys","name":"event_notification_event_types","kind":"v","columns":[{"name":"type","type":"int","not_null":true},{"name":"type_name","type":"nvarchar(64)"},{"name":"parent_type","type":"int"}]} +{"schema":"sys","name":"event_notifications","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"parent_class","type":"tinyint","not_null":true},{"name":"parent_class_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"service_name","type":"nvarchar(256)"},{"name":"broker_instance","type":"nvarchar(128)"},{"name":"creator_sid","type":"varbinary(85)"},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"events","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"type_desc","type":"nvarchar(128)","not_null":true},{"name":"is_trigger_event","type":"bit"},{"name":"event_group_type","type":"int"},{"name":"event_group_type_desc","type":"nvarchar(128)"}]} +{"schema":"sys","name":"extended_procedures","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"dll_name","type":"nvarchar(260)"}]} +{"schema":"sys","name":"extended_properties","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"value","type":"sql_variant"}]} +{"schema":"sys","name":"external_data_sources","kind":"v","columns":[{"name":"data_source_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"location","type":"nvarchar(4000)","not_null":true},{"name":"type_desc","type":"nvarchar(255)"},{"name":"type","type":"tinyint","not_null":true},{"name":"resource_manager_location","type":"nvarchar(4000)"},{"name":"credential_id","type":"int","not_null":true},{"name":"database_name","type":"nvarchar(128)"},{"name":"shard_map_name","type":"nvarchar(128)"},{"name":"connection_options","type":"nvarchar(4000)"},{"name":"pushdown","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"external_file_formats","kind":"v","columns":[{"name":"file_format_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"format_type","type":"nvarchar(100)","not_null":true},{"name":"field_terminator","type":"nvarchar(10)"},{"name":"string_delimiter","type":"nvarchar(10)"},{"name":"date_format","type":"nvarchar(50)"},{"name":"use_type_default","type":"bit"},{"name":"serde_method","type":"nvarchar(255)"},{"name":"row_terminator","type":"nvarchar(10)"},{"name":"encoding","type":"nvarchar(10)"},{"name":"data_compression","type":"nvarchar(255)"},{"name":"first_row","type":"int"},{"name":"parser_version","type":"nvarchar(32)"}]} +{"schema":"sys","name":"external_governance_classification_attributes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"object_attributes","type":"nvarchar(max)"}]} +{"schema":"sys","name":"external_governance_classifications","kind":"v","columns":[{"name":"classification","type":"nvarchar(4000)"},{"name":"classification_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"external_governance_classifications_mapping","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(16)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"classification_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"external_governance_sensitivity_classifications","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(16)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"label","type":"nvarchar(128)"},{"name":"label_id","type":"nvarchar(128)"},{"name":"information_type","type":"nvarchar(128)"},{"name":"information_type_id","type":"nvarchar(128)"},{"name":"rank","type":"int"},{"name":"rank_desc","type":"varchar(8)"}]} +{"schema":"sys","name":"external_governance_sensitivity_labels","kind":"v","columns":[{"name":"label","type":"nvarchar(4000)"},{"name":"label_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"external_governance_sensitivity_labels_mapping","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(16)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"label_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"external_job_streams","kind":"v","columns":[{"name":"job_id","type":"int","not_null":true},{"name":"stream_id","type":"int","not_null":true},{"name":"is_input","type":"bit","not_null":true},{"name":"is_output","type":"bit","not_null":true}]} +{"schema":"sys","name":"external_language_files","kind":"v","columns":[{"name":"external_language_id","type":"int","not_null":true},{"name":"content","type":"varbinary(max)"},{"name":"file_name","type":"nvarchar(128)"},{"name":"platform","type":"tinyint"},{"name":"platform_desc","type":"nvarchar(60)"},{"name":"parameters","type":"nvarchar(128)"},{"name":"environment_variables","type":"nvarchar(128)"}]} +{"schema":"sys","name":"external_languages","kind":"v","columns":[{"name":"external_language_id","type":"int","not_null":true},{"name":"language","type":"nvarchar(128)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"external_libraries","kind":"v","columns":[{"name":"external_library_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"principal_id","type":"int"},{"name":"language","type":"nvarchar(128)"},{"name":"scope","type":"int","not_null":true},{"name":"scope_desc","type":"varchar(7)","not_null":true}]} +{"schema":"sys","name":"external_libraries_installed","kind":"v","columns":[{"name":"db_id","type":"int","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"language_id","type":"int","not_null":true},{"name":"external_library_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"mdversion","type":"binary(8)","not_null":true}]} +{"schema":"sys","name":"external_library_files","kind":"v","columns":[{"name":"external_library_id","type":"int","not_null":true},{"name":"content","type":"varbinary(max)"},{"name":"platform","type":"tinyint"},{"name":"platform_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"external_library_setup_errors","kind":"v","columns":[{"name":"db_id","type":"int","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"external_library_id","type":"int","not_null":true},{"name":"error_code","type":"int","not_null":true},{"name":"error_timestamp","type":"datetime2(7)","not_null":true},{"name":"error_message","type":"nvarchar(1024)"}]} +{"schema":"sys","name":"external_models","kind":"v","columns":[{"name":"external_model_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"principal_id","type":"int"},{"name":"location","type":"nvarchar(4000)"},{"name":"api_format","type":"nvarchar(100)"},{"name":"model_type_id","type":"int"},{"name":"model_type_desc","type":"nvarchar(65)"},{"name":"model","type":"nvarchar(100)"},{"name":"credential_id","type":"int"},{"name":"parameters","type":"nvarchar(max)"},{"name":"create_time","type":"datetime2(7)"},{"name":"modify_time","type":"datetime2(7)"}]} +{"schema":"sys","name":"external_stream_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true}]} +{"schema":"sys","name":"external_streaming_jobs","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"uses_ansi_nulls","type":"bit"},{"name":"statement","type":"nvarchar(max)"},{"name":"status","type":"int"}]} +{"schema":"sys","name":"external_streams","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"max_column_id_used","type":"int"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"data_source_id","type":"int"},{"name":"file_format_id","type":"int"},{"name":"location","type":"nvarchar(4000)"},{"name":"input_options","type":"nvarchar(4000)"},{"name":"output_options","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"external_table_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"partition_column_ordinal","type":"int"},{"name":"hash_column_ordinal","type":"int"}]} +{"schema":"sys","name":"external_table_partitioning_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"ordinal_id","type":"bigint"}]} +{"schema":"sys","name":"external_table_schema_changed_mdsync","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"table_id","type":"int","not_null":true},{"name":"schema_changed","type":"sql_variant"}]} +{"schema":"sys","name":"external_tables","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"max_column_id_used","type":"int"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"data_source_id","type":"int","not_null":true},{"name":"file_format_id","type":"int"},{"name":"location","type":"nvarchar(4000)"},{"name":"reject_type","type":"nvarchar(20)"},{"name":"reject_value","type":"float"},{"name":"reject_sample_value","type":"float"},{"name":"distribution_type","type":"tinyint"},{"name":"distribution_desc","type":"nvarchar(120)"},{"name":"sharding_col_id","type":"int"},{"name":"remote_schema_name","type":"nvarchar(128)"},{"name":"remote_object_name","type":"nvarchar(128)"},{"name":"rejected_row_location","type":"nvarchar(4000)"},{"name":"table_options","type":"nvarchar(1000)"},{"name":"partition_type","type":"int","not_null":true},{"name":"partition_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"filegroups","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"data_space_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_default","type":"bit"},{"name":"is_system","type":"bit"},{"name":"filegroup_guid","type":"uniqueidentifier"},{"name":"log_filegroup_id","type":"int"},{"name":"is_read_only","type":"bit"},{"name":"is_autogrow_all_files","type":"bit"}]} +{"schema":"sys","name":"filetable_system_defined_objects","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true}]} +{"schema":"sys","name":"filetables","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"is_enabled","type":"bit","not_null":true},{"name":"directory_name","type":"nvarchar(256)","not_null":true},{"name":"filename_collation_id","type":"int","not_null":true},{"name":"filename_collation_name","type":"nvarchar(129)","not_null":true}]} +{"schema":"sys","name":"foreign_key_columns","kind":"v","columns":[{"name":"constraint_object_id","type":"int","not_null":true},{"name":"constraint_column_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"parent_column_id","type":"int","not_null":true},{"name":"referenced_object_id","type":"int","not_null":true},{"name":"referenced_column_id","type":"int","not_null":true}]} +{"schema":"sys","name":"foreign_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"referenced_object_id","type":"int"},{"name":"key_index_id","type":"int"},{"name":"is_disabled","type":"bit","not_null":true},{"name":"is_not_for_replication","type":"bit","not_null":true},{"name":"is_not_trusted","type":"bit","not_null":true},{"name":"delete_referential_action","type":"tinyint"},{"name":"delete_referential_action_desc","type":"nvarchar(60)"},{"name":"update_referential_action","type":"tinyint"},{"name":"update_referential_action_desc","type":"nvarchar(60)"},{"name":"is_system_named","type":"bit","not_null":true}]} +{"schema":"sys","name":"fulltext_catalogs","kind":"v","columns":[{"name":"fulltext_catalog_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"path","type":"nvarchar(260)"},{"name":"is_default","type":"bit","not_null":true},{"name":"is_accent_sensitivity_on","type":"bit","not_null":true},{"name":"data_space_id","type":"int"},{"name":"file_id","type":"int"},{"name":"principal_id","type":"int"},{"name":"is_importing","type":"bit","not_null":true}]} +{"schema":"sys","name":"fulltext_document_types","kind":"v","columns":[{"name":"document_type","type":"nvarchar(128)","not_null":true},{"name":"class_id","type":"uniqueidentifier","not_null":true},{"name":"path","type":"nvarchar(260)"},{"name":"version","type":"nvarchar(128)","not_null":true},{"name":"manufacturer","type":"nvarchar(128)"}]} +{"schema":"sys","name":"fulltext_index_catalog_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int"},{"name":"fulltext_catalog_id","type":"int","not_null":true}]} +{"schema":"sys","name":"fulltext_index_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"type_column_id","type":"int"},{"name":"language_id","type":"int","not_null":true},{"name":"statistical_semantics","type":"int","not_null":true}]} +{"schema":"sys","name":"fulltext_index_fragments","kind":"v","columns":[{"name":"table_id","type":"int","not_null":true},{"name":"fragment_id","type":"int","not_null":true},{"name":"fragment_object_id","type":"int","not_null":true},{"name":"timestamp","type":"binary(8)","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"data_size","type":"bigint","not_null":true},{"name":"row_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"fulltext_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"unique_index_id","type":"int","not_null":true},{"name":"index_version","type":"int"},{"name":"fulltext_catalog_id","type":"int"},{"name":"is_enabled","type":"bit","not_null":true},{"name":"change_tracking_state","type":"char(1)"},{"name":"change_tracking_state_desc","type":"nvarchar(60)"},{"name":"has_crawl_completed","type":"bit","not_null":true},{"name":"crawl_type","type":"char(1)","not_null":true},{"name":"crawl_type_desc","type":"nvarchar(60)"},{"name":"crawl_start_date","type":"datetime"},{"name":"crawl_end_date","type":"datetime"},{"name":"incremental_timestamp","type":"binary(8)"},{"name":"stoplist_id","type":"int"},{"name":"property_list_id","type":"int"},{"name":"data_space_id","type":"int","not_null":true}]} +{"schema":"sys","name":"fulltext_languages","kind":"v","columns":[{"name":"lcid","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"fulltext_semantic_language_statistics_database","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"register_date","type":"datetime","not_null":true},{"name":"registered_by","type":"int","not_null":true},{"name":"version","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"fulltext_semantic_languages","kind":"v","columns":[{"name":"lcid","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"fulltext_stoplists","kind":"v","columns":[{"name":"stoplist_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"fulltext_stopwords","kind":"v","columns":[{"name":"stoplist_id","type":"int","not_null":true},{"name":"stopword","type":"nvarchar(64)","not_null":true},{"name":"language","type":"nvarchar(128)","not_null":true},{"name":"language_id","type":"int","not_null":true}]} +{"schema":"sys","name":"fulltext_system_stopwords","kind":"v","columns":[{"name":"stopword","type":"nvarchar(64)"},{"name":"language_id","type":"int","not_null":true}]} +{"schema":"sys","name":"function_order_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"order_column_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"is_descending","type":"bit"}]} +{"schema":"sys","name":"hash_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"has_filter","type":"bit"},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"bucket_count","type":"int","not_null":true},{"name":"auto_created","type":"bit"}]} +{"schema":"sys","name":"http_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"site","type":"nvarchar(128)"},{"name":"url_path","type":"nvarchar(4000)"},{"name":"is_clear_port_enabled","type":"bit","not_null":true},{"name":"clear_port","type":"int","not_null":true},{"name":"is_ssl_port_enabled","type":"bit","not_null":true},{"name":"ssl_port","type":"int","not_null":true},{"name":"is_anonymous_enabled","type":"bit","not_null":true},{"name":"is_basic_auth_enabled","type":"bit","not_null":true},{"name":"is_digest_auth_enabled","type":"bit","not_null":true},{"name":"is_kerberos_auth_enabled","type":"bit","not_null":true},{"name":"is_ntlm_auth_enabled","type":"bit","not_null":true},{"name":"is_integrated_auth_enabled","type":"bit","not_null":true},{"name":"authorization_realm","type":"nvarchar(128)"},{"name":"default_logon_domain","type":"nvarchar(128)"},{"name":"is_compression_enabled","type":"bit","not_null":true}]} +{"schema":"sys","name":"identity_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"seed_value","type":"sql_variant"},{"name":"increment_value","type":"sql_variant"},{"name":"last_value","type":"sql_variant"},{"name":"is_not_for_replication","type":"bit"},{"name":"is_computed","type":"bit","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_column_set","type":"bit","not_null":true},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit","not_null":true},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"}]} +{"schema":"sys","name":"index_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"index_column_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"key_ordinal","type":"tinyint","not_null":true},{"name":"partition_ordinal","type":"tinyint","not_null":true},{"name":"is_descending_key","type":"bit"},{"name":"is_included_column","type":"bit"},{"name":"column_store_order_ordinal","type":"tinyint"},{"name":"data_clustering_ordinal","type":"tinyint"}]} +{"schema":"sys","name":"index_resumable_operations","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"sql_text","type":"nvarchar(max)"},{"name":"last_max_dop_used","type":"smallint","not_null":true},{"name":"partition_number","type":"int"},{"name":"state","type":"tinyint","not_null":true},{"name":"state_desc","type":"nvarchar(60)"},{"name":"start_time","type":"datetime","not_null":true},{"name":"last_pause_time","type":"datetime"},{"name":"total_execution_time","type":"int","not_null":true},{"name":"percent_complete","type":"float","not_null":true},{"name":"page_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int"},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"has_filter","type":"bit"},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"compression_delay","type":"int"},{"name":"suppress_dup_key_messages","type":"bit"},{"name":"auto_created","type":"bit"},{"name":"optimize_for_sequential_key","type":"bit"}]} +{"schema":"sys","name":"information_protection_label_mapping","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(6)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"label_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"internal_partitions","kind":"v","columns":[{"name":"partition_id","type":"bigint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"hobt_id","type":"bigint","not_null":true},{"name":"internal_object_type","type":"tinyint"},{"name":"internal_object_type_desc","type":"nvarchar(60)"},{"name":"row_group_id","type":"int"},{"name":"rows","type":"bigint"},{"name":"data_compression","type":"tinyint"},{"name":"data_compression_desc","type":"nvarchar(60)"},{"name":"xml_compression","type":"bit"},{"name":"xml_compression_desc","type":"varchar(3)"}]} +{"schema":"sys","name":"internal_tables","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"},{"name":"internal_type","type":"tinyint"},{"name":"internal_type_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int"},{"name":"parent_minor_id","type":"int"},{"name":"lob_data_space_id","type":"int","not_null":true},{"name":"filestream_data_space_id","type":"int"}]} +{"schema":"sys","name":"json_index_paths","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"path","type":"varchar(8000)"}]} +{"schema":"sys","name":"json_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"has_filter","type":"bit","not_null":true},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"auto_created","type":"bit"},{"name":"optimize_for_array_search","type":"bit"}]} +{"schema":"sys","name":"key_constraints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"unique_index_id","type":"int"},{"name":"is_system_named","type":"bit","not_null":true},{"name":"is_enforced","type":"bit"}]} +{"schema":"sys","name":"key_encryptions","kind":"v","columns":[{"name":"key_id","type":"int","not_null":true},{"name":"thumbprint","type":"varbinary(32)"},{"name":"crypt_type","type":"char(4)","not_null":true},{"name":"crypt_type_desc","type":"nvarchar(60)"},{"name":"crypt_property","type":"varbinary(max)"}]} +{"schema":"sys","name":"ledger_column_history","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"column_name","type":"nvarchar(128)","not_null":true},{"name":"operation_type","type":"int","not_null":true},{"name":"operation_type_desc","type":"nvarchar(60)"},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"sequence_number","type":"bigint","not_null":true}]} +{"schema":"sys","name":"ledger_table_history","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"schema_name","type":"nvarchar(128)","not_null":true},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"ledger_view_schema_name","type":"nvarchar(128)","not_null":true},{"name":"ledger_view_name","type":"nvarchar(128)","not_null":true},{"name":"operation_type","type":"int","not_null":true},{"name":"operation_type_desc","type":"nvarchar(60)"},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"sequence_number","type":"bigint","not_null":true}]} +{"schema":"sys","name":"linked_logins","kind":"v","columns":[{"name":"server_id","type":"int","not_null":true},{"name":"local_principal_id","type":"int"},{"name":"uses_self_credential","type":"bit","not_null":true},{"name":"remote_name","type":"nvarchar(128)"},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"login_token","kind":"v","columns":[{"name":"principal_id","type":"int"},{"name":"sid","type":"varbinary(85)"},{"name":"name","type":"nvarchar(128)"},{"name":"type","type":"nvarchar(128)"},{"name":"usage","type":"nvarchar(128)"}]} +{"schema":"sys","name":"masked_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_database_collation","type":"bit","not_null":true},{"name":"is_persisted","type":"bit","not_null":true},{"name":"is_computed","type":"bit","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_column_set","type":"bit","not_null":true},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit","not_null":true},{"name":"is_masked","type":"bit"},{"name":"masking_function","type":"nvarchar(4000)"},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"}]} +{"schema":"sys","name":"master_files","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"file_id","type":"int","not_null":true},{"name":"file_guid","type":"uniqueidentifier"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"data_space_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"physical_name","type":"nvarchar(260)","not_null":true},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"size","type":"int","not_null":true},{"name":"max_size","type":"int","not_null":true},{"name":"growth","type":"int","not_null":true},{"name":"is_media_read_only","type":"bit","not_null":true},{"name":"is_read_only","type":"bit","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_percent_growth","type":"bit","not_null":true},{"name":"is_name_reserved","type":"bit","not_null":true},{"name":"is_persistent_log_buffer","type":"bit","not_null":true},{"name":"create_lsn","type":"numeric(25,0)"},{"name":"drop_lsn","type":"numeric(25,0)"},{"name":"read_only_lsn","type":"numeric(25,0)"},{"name":"read_write_lsn","type":"numeric(25,0)"},{"name":"differential_base_lsn","type":"numeric(25,0)"},{"name":"differential_base_guid","type":"uniqueidentifier"},{"name":"differential_base_time","type":"datetime"},{"name":"redo_start_lsn","type":"numeric(25,0)"},{"name":"redo_start_fork_guid","type":"uniqueidentifier"},{"name":"redo_target_lsn","type":"numeric(25,0)"},{"name":"redo_target_fork_guid","type":"uniqueidentifier"},{"name":"backup_lsn","type":"numeric(25,0)"},{"name":"credential_id","type":"int"}]} +{"schema":"sys","name":"master_key_passwords","kind":"v","columns":[{"name":"credential_id","type":"int","not_null":true},{"name":"family_guid","type":"uniqueidentifier"}]} +{"schema":"sys","name":"memory_optimized_tables_internal_attributes","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"type","type":"int"},{"name":"type_desc","type":"nvarchar(60)","not_null":true},{"name":"minor_id","type":"int","not_null":true}]} +{"schema":"sys","name":"message_type_xml_schema_collection_usages","kind":"v","columns":[{"name":"message_type_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true}]} +{"schema":"sys","name":"messages","kind":"v","columns":[{"name":"message_id","type":"int","not_null":true},{"name":"language_id","type":"smallint","not_null":true},{"name":"severity","type":"tinyint"},{"name":"is_event_logged","type":"bit","not_null":true},{"name":"text","type":"nvarchar(2048)","not_null":true}]} +{"schema":"sys","name":"module_assembly_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true}]} +{"schema":"sys","name":"numbered_procedure_parameters","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"procedure_number","type":"smallint","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"is_output","type":"bit","not_null":true},{"name":"is_cursor_ref","type":"bit","not_null":true}]} +{"schema":"sys","name":"numbered_procedures","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"procedure_number","type":"smallint"},{"name":"definition","type":"nvarchar(max)"}]} +{"schema":"sys","name":"objects","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true}]} +{"schema":"sys","name":"openkeys","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"database_name","type":"nvarchar(128)"},{"name":"key_id","type":"int"},{"name":"key_name","type":"nvarchar(128)"},{"name":"key_guid","type":"uniqueidentifier"},{"name":"opened_date","type":"datetime"},{"name":"status","type":"smallint"}]} +{"schema":"sys","name":"parameter_type_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"parameter_id","type":"int","not_null":true},{"name":"user_type_id","type":"int","not_null":true}]} +{"schema":"sys","name":"parameter_xml_schema_collection_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"parameter_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true}]} +{"schema":"sys","name":"parameters","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"is_output","type":"bit","not_null":true},{"name":"is_cursor_ref","type":"bit","not_null":true},{"name":"has_default_value","type":"bit","not_null":true},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"default_value","type":"sql_variant"},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"is_readonly","type":"bit","not_null":true},{"name":"is_nullable","type":"bit"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"partition_functions","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"function_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"fanout","type":"int","not_null":true},{"name":"boundary_value_on_right","type":"bit","not_null":true},{"name":"is_system","type":"bit","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"partition_parameters","kind":"v","columns":[{"name":"function_id","type":"int","not_null":true},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"user_type_id","type":"int","not_null":true}]} +{"schema":"sys","name":"partition_range_values","kind":"v","columns":[{"name":"function_id","type":"int","not_null":true},{"name":"boundary_id","type":"int","not_null":true},{"name":"parameter_id","type":"int","not_null":true},{"name":"value","type":"sql_variant"}]} +{"schema":"sys","name":"partition_schemes","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"data_space_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_default","type":"bit"},{"name":"is_system","type":"bit"},{"name":"function_id","type":"int","not_null":true}]} +{"schema":"sys","name":"partitions","kind":"v","columns":[{"name":"partition_id","type":"bigint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"hobt_id","type":"bigint","not_null":true},{"name":"rows","type":"bigint"},{"name":"filestream_filegroup_id","type":"smallint","not_null":true},{"name":"data_compression","type":"tinyint","not_null":true},{"name":"data_compression_desc","type":"nvarchar(60)"},{"name":"xml_compression","type":"bit"},{"name":"xml_compression_desc","type":"varchar(3)"}]} +{"schema":"sys","name":"periods","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"period_type","type":"tinyint"},{"name":"period_type_desc","type":"nvarchar(60)"},{"name":"object_id","type":"int","not_null":true},{"name":"start_column_id","type":"int","not_null":true},{"name":"end_column_id","type":"int","not_null":true}]} +{"schema":"sys","name":"plan_guides","kind":"v","columns":[{"name":"plan_guide_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_disabled","type":"bit","not_null":true},{"name":"query_text","type":"nvarchar(max)"},{"name":"scope_type","type":"tinyint","not_null":true},{"name":"scope_type_desc","type":"nvarchar(60)"},{"name":"scope_object_id","type":"int"},{"name":"scope_batch","type":"nvarchar(max)"},{"name":"parameters","type":"nvarchar(max)"},{"name":"hints","type":"nvarchar(max)"}]} +{"schema":"sys","name":"procedures","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"is_auto_executed","type":"bit","not_null":true},{"name":"is_execution_replicated","type":"bit"},{"name":"is_repl_serializable_only","type":"bit"},{"name":"skips_repl_constraints","type":"bit"}]} +{"schema":"sys","name":"query_context_settings","kind":"v","columns":[{"name":"context_settings_id","type":"bigint","not_null":true},{"name":"set_options","type":"varbinary(8)"},{"name":"language_id","type":"smallint","not_null":true},{"name":"date_format","type":"smallint","not_null":true},{"name":"date_first","type":"tinyint","not_null":true},{"name":"status","type":"varbinary(2)"},{"name":"required_cursor_options","type":"int","not_null":true},{"name":"acceptable_cursor_options","type":"int","not_null":true},{"name":"merge_action_type","type":"smallint","not_null":true},{"name":"default_schema_id","type":"int","not_null":true},{"name":"is_replication_specific","type":"bit","not_null":true},{"name":"is_contained","type":"varbinary(1)"}]} +{"schema":"sys","name":"query_store_plan","kind":"v","columns":[{"name":"plan_id","type":"bigint","not_null":true},{"name":"query_id","type":"bigint","not_null":true},{"name":"plan_group_id","type":"bigint"},{"name":"engine_version","type":"nvarchar(32)"},{"name":"compatibility_level","type":"smallint","not_null":true},{"name":"query_plan_hash","type":"binary(8)","not_null":true},{"name":"query_plan","type":"nvarchar(max)"},{"name":"is_online_index_plan","type":"bit","not_null":true},{"name":"is_trivial_plan","type":"bit","not_null":true},{"name":"is_parallel_plan","type":"bit","not_null":true},{"name":"is_forced_plan","type":"bit","not_null":true},{"name":"is_natively_compiled","type":"bit","not_null":true},{"name":"force_failure_count","type":"bigint","not_null":true},{"name":"last_force_failure_reason","type":"int","not_null":true},{"name":"last_force_failure_reason_desc","type":"nvarchar(128)"},{"name":"count_compiles","type":"bigint"},{"name":"initial_compile_start_time","type":"datetimeoffset(7)","not_null":true},{"name":"last_compile_start_time","type":"datetimeoffset(7)"},{"name":"last_execution_time","type":"datetimeoffset(7)"},{"name":"avg_compile_duration","type":"float"},{"name":"last_compile_duration","type":"bigint"},{"name":"plan_forcing_type","type":"int","not_null":true},{"name":"plan_forcing_type_desc","type":"nvarchar(60)"},{"name":"has_compile_replay_script","type":"bit","not_null":true},{"name":"is_optimized_plan_forcing_disabled","type":"bit","not_null":true},{"name":"plan_type","type":"int","not_null":true},{"name":"plan_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"query_store_plan_feedback","kind":"v","columns":[{"name":"plan_feedback_id","type":"bigint","not_null":true},{"name":"plan_id","type":"bigint","not_null":true},{"name":"feature_id","type":"tinyint","not_null":true},{"name":"feature_desc","type":"nvarchar(60)"},{"name":"feedback_data","type":"nvarchar(max)"},{"name":"state","type":"int"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"create_time","type":"datetimeoffset(7)","not_null":true},{"name":"last_updated_time","type":"datetimeoffset(7)"},{"name":"replica_group_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"query_store_plan_forcing_locations","kind":"v","columns":[{"name":"plan_forcing_location_id","type":"bigint","not_null":true},{"name":"query_id","type":"bigint","not_null":true},{"name":"plan_id","type":"bigint","not_null":true},{"name":"replica_group_id","type":"bigint","not_null":true},{"name":"timestamp","type":"datetime","not_null":true},{"name":"plan_forcing_type","type":"int","not_null":true},{"name":"plan_forcing_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"query_store_query","kind":"v","columns":[{"name":"query_id","type":"bigint","not_null":true},{"name":"query_text_id","type":"bigint","not_null":true},{"name":"context_settings_id","type":"bigint","not_null":true},{"name":"object_id","type":"bigint"},{"name":"batch_sql_handle","type":"varbinary(44)"},{"name":"query_hash","type":"binary(8)","not_null":true},{"name":"is_internal_query","type":"bit","not_null":true},{"name":"query_parameterization_type","type":"tinyint","not_null":true},{"name":"query_parameterization_type_desc","type":"nvarchar(60)"},{"name":"initial_compile_start_time","type":"datetimeoffset(7)","not_null":true},{"name":"last_compile_start_time","type":"datetimeoffset(7)"},{"name":"last_execution_time","type":"datetimeoffset(7)"},{"name":"last_compile_batch_sql_handle","type":"varbinary(44)"},{"name":"last_compile_batch_offset_start","type":"bigint"},{"name":"last_compile_batch_offset_end","type":"bigint"},{"name":"count_compiles","type":"bigint"},{"name":"avg_compile_duration","type":"float"},{"name":"last_compile_duration","type":"bigint"},{"name":"avg_bind_duration","type":"float"},{"name":"last_bind_duration","type":"bigint"},{"name":"avg_bind_cpu_time","type":"float"},{"name":"last_bind_cpu_time","type":"bigint"},{"name":"avg_optimize_duration","type":"float"},{"name":"last_optimize_duration","type":"bigint"},{"name":"avg_optimize_cpu_time","type":"float"},{"name":"last_optimize_cpu_time","type":"bigint"},{"name":"avg_compile_memory_kb","type":"float"},{"name":"last_compile_memory_kb","type":"bigint"},{"name":"max_compile_memory_kb","type":"bigint"},{"name":"is_clouddb_internal_query","type":"bit"}]} +{"schema":"sys","name":"query_store_query_hints","kind":"v","columns":[{"name":"query_hint_id","type":"bigint","not_null":true},{"name":"query_id","type":"bigint","not_null":true},{"name":"replica_group_id","type":"bigint","not_null":true},{"name":"query_hint_text","type":"nvarchar(max)"},{"name":"last_query_hint_failure_reason","type":"int","not_null":true},{"name":"last_query_hint_failure_reason_desc","type":"nvarchar(128)"},{"name":"query_hint_failure_count","type":"bigint","not_null":true},{"name":"source","type":"int"},{"name":"source_desc","type":"nvarchar(128)"},{"name":"comment","type":"nvarchar(max)"}]} +{"schema":"sys","name":"query_store_query_text","kind":"v","columns":[{"name":"query_text_id","type":"bigint","not_null":true},{"name":"query_sql_text","type":"nvarchar(max)"},{"name":"statement_sql_handle","type":"varbinary(44)"},{"name":"is_part_of_encrypted_module","type":"bit","not_null":true},{"name":"has_restricted_text","type":"bit","not_null":true}]} +{"schema":"sys","name":"query_store_query_variant","kind":"v","columns":[{"name":"query_variant_query_id","type":"bigint","not_null":true},{"name":"parent_query_id","type":"bigint","not_null":true},{"name":"dispatcher_plan_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"query_store_replicas","kind":"v","columns":[{"name":"replica_group_id","type":"bigint","not_null":true},{"name":"role_type","type":"smallint","not_null":true},{"name":"replica_name","type":"nvarchar(644)"}]} +{"schema":"sys","name":"query_store_runtime_stats","kind":"v","columns":[{"name":"runtime_stats_id","type":"bigint","not_null":true},{"name":"plan_id","type":"bigint","not_null":true},{"name":"runtime_stats_interval_id","type":"bigint","not_null":true},{"name":"execution_type","type":"tinyint","not_null":true},{"name":"execution_type_desc","type":"nvarchar(60)"},{"name":"first_execution_time","type":"datetimeoffset(7)","not_null":true},{"name":"last_execution_time","type":"datetimeoffset(7)","not_null":true},{"name":"count_executions","type":"bigint","not_null":true},{"name":"avg_duration","type":"float"},{"name":"last_duration","type":"bigint","not_null":true},{"name":"min_duration","type":"bigint","not_null":true},{"name":"max_duration","type":"bigint","not_null":true},{"name":"stdev_duration","type":"float"},{"name":"avg_cpu_time","type":"float"},{"name":"last_cpu_time","type":"bigint","not_null":true},{"name":"min_cpu_time","type":"bigint","not_null":true},{"name":"max_cpu_time","type":"bigint","not_null":true},{"name":"stdev_cpu_time","type":"float"},{"name":"avg_logical_io_reads","type":"float"},{"name":"last_logical_io_reads","type":"bigint","not_null":true},{"name":"min_logical_io_reads","type":"bigint","not_null":true},{"name":"max_logical_io_reads","type":"bigint","not_null":true},{"name":"stdev_logical_io_reads","type":"float"},{"name":"avg_logical_io_writes","type":"float"},{"name":"last_logical_io_writes","type":"bigint","not_null":true},{"name":"min_logical_io_writes","type":"bigint","not_null":true},{"name":"max_logical_io_writes","type":"bigint","not_null":true},{"name":"stdev_logical_io_writes","type":"float"},{"name":"avg_physical_io_reads","type":"float"},{"name":"last_physical_io_reads","type":"bigint","not_null":true},{"name":"min_physical_io_reads","type":"bigint","not_null":true},{"name":"max_physical_io_reads","type":"bigint","not_null":true},{"name":"stdev_physical_io_reads","type":"float"},{"name":"avg_clr_time","type":"float"},{"name":"last_clr_time","type":"bigint","not_null":true},{"name":"min_clr_time","type":"bigint","not_null":true},{"name":"max_clr_time","type":"bigint","not_null":true},{"name":"stdev_clr_time","type":"float"},{"name":"avg_dop","type":"float"},{"name":"last_dop","type":"bigint","not_null":true},{"name":"min_dop","type":"bigint","not_null":true},{"name":"max_dop","type":"bigint","not_null":true},{"name":"stdev_dop","type":"float"},{"name":"avg_query_max_used_memory","type":"float"},{"name":"last_query_max_used_memory","type":"bigint","not_null":true},{"name":"min_query_max_used_memory","type":"bigint","not_null":true},{"name":"max_query_max_used_memory","type":"bigint","not_null":true},{"name":"stdev_query_max_used_memory","type":"float"},{"name":"avg_rowcount","type":"float"},{"name":"last_rowcount","type":"bigint","not_null":true},{"name":"min_rowcount","type":"bigint","not_null":true},{"name":"max_rowcount","type":"bigint","not_null":true},{"name":"stdev_rowcount","type":"float"},{"name":"avg_num_physical_io_reads","type":"float"},{"name":"last_num_physical_io_reads","type":"bigint"},{"name":"min_num_physical_io_reads","type":"bigint"},{"name":"max_num_physical_io_reads","type":"bigint"},{"name":"stdev_num_physical_io_reads","type":"float"},{"name":"avg_log_bytes_used","type":"float"},{"name":"last_log_bytes_used","type":"bigint"},{"name":"min_log_bytes_used","type":"bigint"},{"name":"max_log_bytes_used","type":"bigint"},{"name":"stdev_log_bytes_used","type":"float"},{"name":"avg_tempdb_space_used","type":"float"},{"name":"last_tempdb_space_used","type":"bigint"},{"name":"min_tempdb_space_used","type":"bigint"},{"name":"max_tempdb_space_used","type":"bigint"},{"name":"stdev_tempdb_space_used","type":"float"},{"name":"avg_page_server_io_reads","type":"float"},{"name":"last_page_server_io_reads","type":"bigint"},{"name":"min_page_server_io_reads","type":"bigint"},{"name":"max_page_server_io_reads","type":"bigint"},{"name":"stdev_page_server_io_reads","type":"float"},{"name":"replica_group_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"query_store_runtime_stats_interval","kind":"v","columns":[{"name":"runtime_stats_interval_id","type":"bigint","not_null":true},{"name":"start_time","type":"datetimeoffset(7)","not_null":true},{"name":"end_time","type":"datetimeoffset(7)","not_null":true},{"name":"comment","type":"nvarchar(max)"}]} +{"schema":"sys","name":"query_store_wait_stats","kind":"v","columns":[{"name":"wait_stats_id","type":"bigint","not_null":true},{"name":"plan_id","type":"bigint","not_null":true},{"name":"runtime_stats_interval_id","type":"bigint","not_null":true},{"name":"wait_category","type":"smallint","not_null":true},{"name":"wait_category_desc","type":"nvarchar(60)"},{"name":"execution_type","type":"tinyint","not_null":true},{"name":"execution_type_desc","type":"nvarchar(60)"},{"name":"total_query_wait_time_ms","type":"bigint","not_null":true},{"name":"avg_query_wait_time_ms","type":"float"},{"name":"last_query_wait_time_ms","type":"bigint","not_null":true},{"name":"min_query_wait_time_ms","type":"bigint","not_null":true},{"name":"max_query_wait_time_ms","type":"bigint","not_null":true},{"name":"stdev_query_wait_time_ms","type":"float"},{"name":"replica_group_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"registered_search_properties","kind":"v","columns":[{"name":"property_list_id","type":"int","not_null":true},{"name":"property_id","type":"int","not_null":true},{"name":"property_name","type":"nvarchar(256)","not_null":true},{"name":"property_set_guid","type":"uniqueidentifier","not_null":true},{"name":"property_int_id","type":"int","not_null":true},{"name":"property_description","type":"nvarchar(512)"}]} +{"schema":"sys","name":"registered_search_property_lists","kind":"v","columns":[{"name":"property_list_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"remote_data_archive_databases","kind":"v","columns":[{"name":"remote_database_id","type":"int","not_null":true},{"name":"remote_database_name","type":"nvarchar(128)","not_null":true},{"name":"data_source_id","type":"int","not_null":true},{"name":"federated_service_account","type":"bit"}]} +{"schema":"sys","name":"remote_data_archive_tables","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"remote_database_id","type":"int","not_null":true},{"name":"remote_table_name","type":"nvarchar(128)"},{"name":"filter_predicate","type":"nvarchar(max)"},{"name":"migration_direction","type":"tinyint"},{"name":"migration_direction_desc","type":"nvarchar(60)"},{"name":"is_migration_paused","type":"bit"},{"name":"is_reconciled","type":"bit"}]} +{"schema":"sys","name":"remote_logins","kind":"v","columns":[{"name":"server_id","type":"int","not_null":true},{"name":"remote_name","type":"nvarchar(128)"},{"name":"local_principal_id","type":"int"},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"remote_service_bindings","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"remote_service_binding_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"remote_service_name","type":"nvarchar(256)"},{"name":"service_contract_id","type":"int","not_null":true},{"name":"remote_principal_id","type":"int"},{"name":"is_anonymous_on","type":"bit","not_null":true}]} +{"schema":"sys","name":"resource_governor_configuration","kind":"v","columns":[{"name":"classifier_function_id","type":"int","not_null":true},{"name":"is_enabled","type":"bit","not_null":true},{"name":"max_outstanding_io_per_volume","type":"int","not_null":true}]} +{"schema":"sys","name":"resource_governor_external_resource_pool_affinity","kind":"v","columns":[{"name":"external_pool_id","type":"int","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"cpu_mask","type":"bigint","not_null":true}]} +{"schema":"sys","name":"resource_governor_external_resource_pools","kind":"v","columns":[{"name":"external_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"max_cpu_percent","type":"int","not_null":true},{"name":"max_memory_percent","type":"int","not_null":true},{"name":"max_processes","type":"int","not_null":true},{"name":"version","type":"bigint","not_null":true}]} +{"schema":"sys","name":"resource_governor_resource_pool_affinity","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"scheduler_mask","type":"bigint","not_null":true}]} +{"schema":"sys","name":"resource_governor_resource_pools","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"min_cpu_percent","type":"int","not_null":true},{"name":"max_cpu_percent","type":"int","not_null":true},{"name":"min_memory_percent","type":"int","not_null":true},{"name":"max_memory_percent","type":"int","not_null":true},{"name":"cap_cpu_percent","type":"int","not_null":true},{"name":"min_iops_per_volume","type":"int","not_null":true},{"name":"max_iops_per_volume","type":"int","not_null":true}]} +{"schema":"sys","name":"resource_governor_workload_groups","kind":"v","columns":[{"name":"group_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"importance","type":"nvarchar(128)","not_null":true},{"name":"request_max_memory_grant_percent","type":"int","not_null":true},{"name":"request_max_cpu_time_sec","type":"int","not_null":true},{"name":"request_memory_grant_timeout_sec","type":"int","not_null":true},{"name":"max_dop","type":"int","not_null":true},{"name":"group_max_requests","type":"int","not_null":true},{"name":"pool_id","type":"int","not_null":true},{"name":"external_pool_id","type":"int","not_null":true},{"name":"request_max_memory_grant_percent_numeric","type":"float","not_null":true},{"name":"group_max_tempdb_data_percent","type":"float"},{"name":"group_max_tempdb_data_mb","type":"float"}]} +{"schema":"sys","name":"routes","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"route_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"remote_service_name","type":"nvarchar(256)"},{"name":"broker_instance","type":"nvarchar(128)"},{"name":"lifetime","type":"datetime"},{"name":"address","type":"nvarchar(256)"},{"name":"mirror_address","type":"nvarchar(256)"}]} +{"schema":"sys","name":"schemas","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"securable_classes","kind":"v","columns":[{"name":"class_desc","type":"nvarchar(60)"},{"name":"class","type":"int"}]} +{"schema":"sys","name":"security_policies","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_enabled","type":"bit","not_null":true},{"name":"is_not_for_replication","type":"bit","not_null":true},{"name":"uses_database_collation","type":"bit"},{"name":"is_schema_bound","type":"bit","not_null":true}]} +{"schema":"sys","name":"security_predicates","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"security_predicate_id","type":"int","not_null":true},{"name":"target_object_id","type":"int","not_null":true},{"name":"predicate_definition","type":"nvarchar(max)"},{"name":"predicate_type","type":"int"},{"name":"predicate_type_desc","type":"nvarchar(60)"},{"name":"operation","type":"int"},{"name":"operation_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"selective_xml_index_namespaces","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"is_default_uri","type":"bit"},{"name":"uri","type":"nvarchar(4000)"},{"name":"prefix","type":"nvarchar(128)"}]} +{"schema":"sys","name":"selective_xml_index_paths","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"path_id","type":"int"},{"name":"path","type":"nvarchar(4000)"},{"name":"name","type":"nvarchar(128)"},{"name":"path_type","type":"tinyint"},{"name":"path_type_desc","type":"nvarchar(128)"},{"name":"xml_component_id","type":"int"},{"name":"xquery_type_description","type":"nvarchar(4000)"},{"name":"is_xquery_type_inferred","type":"bit"},{"name":"xquery_max_length","type":"int"},{"name":"is_xquery_max_length_inferred","type":"bit"},{"name":"is_node","type":"bit"},{"name":"system_type_id","type":"tinyint"},{"name":"user_type_id","type":"tinyint"},{"name":"max_length","type":"smallint"},{"name":"precision","type":"tinyint"},{"name":"scale","type":"tinyint"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_singleton","type":"bit"}]} +{"schema":"sys","name":"sensitivity_classifications","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(16)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"label","type":"nvarchar(128)"},{"name":"label_id","type":"nvarchar(128)"},{"name":"information_type","type":"nvarchar(128)"},{"name":"information_type_id","type":"nvarchar(128)"},{"name":"rank","type":"int"},{"name":"rank_desc","type":"varchar(8)"}]} +{"schema":"sys","name":"sequences","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"start_value","type":"sql_variant","not_null":true},{"name":"increment","type":"sql_variant","not_null":true},{"name":"minimum_value","type":"sql_variant","not_null":true},{"name":"maximum_value","type":"sql_variant","not_null":true},{"name":"is_cycling","type":"bit"},{"name":"is_cached","type":"bit"},{"name":"cache_size","type":"int"},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint"},{"name":"current_value","type":"sql_variant","not_null":true},{"name":"is_exhausted","type":"bit","not_null":true},{"name":"last_used_value","type":"sql_variant"}]} +{"schema":"sys","name":"server_assembly_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true},{"name":"assembly_class","type":"nvarchar(128)"},{"name":"assembly_method","type":"nvarchar(128)"},{"name":"execute_as_principal_id","type":"int"}]} +{"schema":"sys","name":"server_audit_specification_details","kind":"v","columns":[{"name":"server_specification_id","type":"int","not_null":true},{"name":"audit_action_id","type":"char(4)","not_null":true},{"name":"audit_action_name","type":"nvarchar(60)"},{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"audited_principal_id","type":"int","not_null":true},{"name":"audited_result","type":"nvarchar(60)"},{"name":"is_group","type":"bit"}]} +{"schema":"sys","name":"server_audit_specifications","kind":"v","columns":[{"name":"server_specification_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"audit_guid","type":"uniqueidentifier"},{"name":"is_state_enabled","type":"bit"},{"name":"is_session_context_enabled","type":"bit"},{"name":"session_context_keys","type":"nvarchar(max)"}]} +{"schema":"sys","name":"server_audits","kind":"v","columns":[{"name":"audit_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"audit_guid","type":"uniqueidentifier"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"on_failure","type":"tinyint"},{"name":"on_failure_desc","type":"nvarchar(60)"},{"name":"is_state_enabled","type":"bit"},{"name":"queue_delay","type":"int"},{"name":"predicate","type":"nvarchar(3000)"},{"name":"is_operator_audit","type":"bit"}]} +{"schema":"sys","name":"server_event_notifications","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"parent_class","type":"tinyint","not_null":true},{"name":"parent_class_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"service_name","type":"nvarchar(256)"},{"name":"broker_instance","type":"nvarchar(128)"},{"name":"creator_sid","type":"varbinary(85)"},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"server_event_session_actions","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"event_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"package","type":"nvarchar(128)"},{"name":"module","type":"nvarchar(128)"}]} +{"schema":"sys","name":"server_event_session_events","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"event_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"package","type":"nvarchar(128)"},{"name":"module","type":"nvarchar(128)"},{"name":"predicate","type":"nvarchar(3000)"},{"name":"predicate_xml","type":"nvarchar(max)"}]} +{"schema":"sys","name":"server_event_session_fields","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"value","type":"sql_variant"}]} +{"schema":"sys","name":"server_event_session_targets","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"target_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"package","type":"nvarchar(128)"},{"name":"module","type":"nvarchar(128)"}]} +{"schema":"sys","name":"server_event_sessions","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"event_retention_mode","type":"char(1)"},{"name":"event_retention_mode_desc","type":"nvarchar(60)"},{"name":"max_dispatch_latency","type":"int"},{"name":"max_memory","type":"int"},{"name":"max_event_size","type":"int"},{"name":"memory_partition_mode","type":"char(1)"},{"name":"memory_partition_mode_desc","type":"nvarchar(60)"},{"name":"track_causality","type":"bit"},{"name":"startup_state","type":"bit"},{"name":"has_long_running_target","type":"bit"},{"name":"max_duration","type":"bigint"}]} +{"schema":"sys","name":"server_events","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"type_desc","type":"nvarchar(128)","not_null":true},{"name":"is_trigger_event","type":"bit"},{"name":"event_group_type","type":"int"},{"name":"event_group_type_desc","type":"nvarchar(128)"}]} +{"schema":"sys","name":"server_file_audits","kind":"v","columns":[{"name":"audit_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"audit_guid","type":"uniqueidentifier"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"on_failure","type":"tinyint"},{"name":"on_failure_desc","type":"nvarchar(60)"},{"name":"is_state_enabled","type":"bit"},{"name":"queue_delay","type":"int"},{"name":"predicate","type":"nvarchar(3000)"},{"name":"max_file_size","type":"bigint"},{"name":"max_rollover_files","type":"int"},{"name":"max_files","type":"int"},{"name":"reserve_disk_space","type":"bit"},{"name":"log_file_path","type":"nvarchar(260)"},{"name":"log_file_name","type":"nvarchar(260)"},{"name":"retention_days","type":"int"}]} +{"schema":"sys","name":"server_memory_optimized_hybrid_buffer_pool_configuration","kind":"v","columns":[{"name":"is_configured","type":"sql_variant"},{"name":"is_enabled","type":"sql_variant"}]} +{"schema":"sys","name":"server_permissions","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"grantee_principal_id","type":"int","not_null":true},{"name":"grantor_principal_id","type":"int","not_null":true},{"name":"type","type":"char(4)","not_null":true},{"name":"permission_name","type":"nvarchar(128)"},{"name":"state","type":"char(1)","not_null":true},{"name":"state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"server_principal_credentials","kind":"v","columns":[{"name":"principal_id","type":"int","not_null":true},{"name":"credential_id","type":"int","not_null":true}]} +{"schema":"sys","name":"server_principals","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"sid","type":"varbinary(85)"},{"name":"type","type":"char(1)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_disabled","type":"bit"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"default_database_name","type":"nvarchar(128)"},{"name":"default_language_name","type":"nvarchar(128)"},{"name":"credential_id","type":"int"},{"name":"owning_principal_id","type":"int"},{"name":"is_fixed_role","type":"bit","not_null":true},{"name":"tenant_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"server_role_members","kind":"v","columns":[{"name":"role_principal_id","type":"int","not_null":true},{"name":"member_principal_id","type":"int","not_null":true}]} +{"schema":"sys","name":"server_sql_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"uses_quoted_identifier","type":"bit"},{"name":"execute_as_principal_id","type":"int"}]} +{"schema":"sys","name":"server_trigger_events","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"type_desc","type":"nvarchar(128)","not_null":true},{"name":"is_trigger_event","type":"bit"},{"name":"is_first","type":"bit"},{"name":"is_last","type":"bit"},{"name":"event_group_type","type":"int"},{"name":"event_group_type_desc","type":"nvarchar(128)"}]} +{"schema":"sys","name":"server_triggers","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"parent_class","type":"tinyint","not_null":true},{"name":"parent_class_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_disabled","type":"bit","not_null":true}]} +{"schema":"sys","name":"servers","kind":"v","columns":[{"name":"server_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"product","type":"nvarchar(128)","not_null":true},{"name":"provider","type":"nvarchar(128)","not_null":true},{"name":"data_source","type":"nvarchar(4000)"},{"name":"location","type":"nvarchar(4000)"},{"name":"provider_string","type":"nvarchar(4000)"},{"name":"catalog","type":"nvarchar(128)"},{"name":"connect_timeout","type":"int"},{"name":"query_timeout","type":"int"},{"name":"is_linked","type":"bit","not_null":true},{"name":"is_remote_login_enabled","type":"bit","not_null":true},{"name":"is_rpc_out_enabled","type":"bit","not_null":true},{"name":"is_data_access_enabled","type":"bit","not_null":true},{"name":"is_collation_compatible","type":"bit","not_null":true},{"name":"uses_remote_collation","type":"bit","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"lazy_schema_validation","type":"bit","not_null":true},{"name":"is_system","type":"bit","not_null":true},{"name":"is_publisher","type":"bit","not_null":true},{"name":"is_subscriber","type":"bit"},{"name":"is_distributor","type":"bit"},{"name":"is_nonsql_subscriber","type":"bit"},{"name":"is_remote_proc_transaction_promotion_enabled","type":"bit"},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_rda_server","type":"bit"}]} +{"schema":"sys","name":"service_broker_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"is_message_forwarding_enabled","type":"bit","not_null":true},{"name":"message_forwarding_size","type":"int","not_null":true},{"name":"connection_auth","type":"tinyint","not_null":true},{"name":"connection_auth_desc","type":"nvarchar(60)"},{"name":"certificate_id","type":"int","not_null":true},{"name":"encryption_algorithm","type":"tinyint","not_null":true},{"name":"encryption_algorithm_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"service_contract_message_usages","kind":"v","columns":[{"name":"service_contract_id","type":"int","not_null":true},{"name":"message_type_id","type":"int","not_null":true},{"name":"is_sent_by_initiator","type":"bit","not_null":true},{"name":"is_sent_by_target","type":"bit","not_null":true}]} +{"schema":"sys","name":"service_contract_usages","kind":"v","columns":[{"name":"service_id","type":"int","not_null":true},{"name":"service_contract_id","type":"int","not_null":true}]} +{"schema":"sys","name":"service_contracts","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"service_contract_id","type":"int","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"service_message_types","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"message_type_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"validation","type":"char(2)","not_null":true},{"name":"validation_desc","type":"nvarchar(60)"},{"name":"xml_collection_id","type":"int"}]} +{"schema":"sys","name":"service_queue_usages","kind":"v","columns":[{"name":"service_id","type":"int","not_null":true},{"name":"service_queue_id","type":"int","not_null":true}]} +{"schema":"sys","name":"service_queues","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"max_readers","type":"smallint"},{"name":"activation_procedure","type":"nvarchar(776)"},{"name":"execute_as_principal_id","type":"int"},{"name":"is_activation_enabled","type":"bit","not_null":true},{"name":"is_receive_enabled","type":"bit","not_null":true},{"name":"is_enqueue_enabled","type":"bit","not_null":true},{"name":"is_retention_enabled","type":"bit","not_null":true},{"name":"is_poison_message_handling_enabled","type":"bit"}]} +{"schema":"sys","name":"services","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"service_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"service_queue_id","type":"int","not_null":true}]} +{"schema":"sys","name":"soap_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"is_sql_language_enabled","type":"bit","not_null":true},{"name":"wsdl_generator_procedure","type":"nvarchar(776)"},{"name":"default_database","type":"nvarchar(128)"},{"name":"default_namespace","type":"nvarchar(384)"},{"name":"default_result_schema","type":"tinyint"},{"name":"default_result_schema_desc","type":"nvarchar(60)"},{"name":"is_xml_charset_enforced","type":"bit","not_null":true},{"name":"is_session_enabled","type":"bit","not_null":true},{"name":"session_timeout","type":"int","not_null":true},{"name":"login_type","type":"nvarchar(60)"},{"name":"header_limit","type":"int","not_null":true}]} +{"schema":"sys","name":"spatial_index_tessellations","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"tessellation_scheme","type":"nvarchar(60)"},{"name":"bounding_box_xmin","type":"float"},{"name":"bounding_box_ymin","type":"float"},{"name":"bounding_box_xmax","type":"float"},{"name":"bounding_box_ymax","type":"float"},{"name":"level_1_grid","type":"smallint"},{"name":"level_1_grid_desc","type":"nvarchar(60)"},{"name":"level_2_grid","type":"smallint"},{"name":"level_2_grid_desc","type":"nvarchar(60)"},{"name":"level_3_grid","type":"smallint"},{"name":"level_3_grid_desc","type":"nvarchar(60)"},{"name":"level_4_grid","type":"smallint"},{"name":"level_4_grid_desc","type":"nvarchar(60)"},{"name":"cells_per_object","type":"int"}]} +{"schema":"sys","name":"spatial_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"spatial_index_type","type":"int","not_null":true},{"name":"spatial_index_type_desc","type":"nvarchar(60)"},{"name":"tessellation_scheme","type":"nvarchar(60)"},{"name":"has_filter","type":"bit","not_null":true},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"auto_created","type":"bit"}]} +{"schema":"sys","name":"spatial_reference_systems","kind":"v","columns":[{"name":"spatial_reference_id","type":"int"},{"name":"authority_name","type":"nvarchar(128)"},{"name":"authorized_spatial_reference_id","type":"int"},{"name":"well_known_text","type":"nvarchar(4000)"},{"name":"unit_of_measure","type":"nvarchar(128)"},{"name":"unit_conversion_factor","type":"float"}]} +{"schema":"sys","name":"sql_dependencies","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"referenced_major_id","type":"int","not_null":true},{"name":"referenced_minor_id","type":"int","not_null":true},{"name":"is_selected","type":"bit","not_null":true},{"name":"is_updated","type":"bit","not_null":true},{"name":"is_select_all","type":"bit","not_null":true}]} +{"schema":"sys","name":"sql_expression_dependencies","kind":"v","columns":[{"name":"referencing_id","type":"int","not_null":true},{"name":"referencing_minor_id","type":"int","not_null":true},{"name":"referencing_class","type":"tinyint"},{"name":"referencing_class_desc","type":"nvarchar(60)"},{"name":"is_schema_bound_reference","type":"bit","not_null":true},{"name":"referenced_class","type":"tinyint"},{"name":"referenced_class_desc","type":"nvarchar(60)"},{"name":"referenced_server_name","type":"nvarchar(128)"},{"name":"referenced_database_name","type":"nvarchar(128)"},{"name":"referenced_schema_name","type":"nvarchar(128)"},{"name":"referenced_entity_name","type":"nvarchar(128)"},{"name":"referenced_id","type":"int"},{"name":"referenced_minor_id","type":"int","not_null":true},{"name":"is_caller_dependent","type":"bit","not_null":true},{"name":"is_ambiguous","type":"bit","not_null":true}]} +{"schema":"sys","name":"sql_logins","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"sid","type":"varbinary(85)"},{"name":"type","type":"char(1)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_disabled","type":"bit"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"default_database_name","type":"nvarchar(128)"},{"name":"default_language_name","type":"nvarchar(128)"},{"name":"credential_id","type":"int"},{"name":"is_policy_checked","type":"bit"},{"name":"is_expiration_checked","type":"bit"},{"name":"password_hash","type":"varbinary(256)"}]} +{"schema":"sys","name":"sql_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"uses_quoted_identifier","type":"bit"},{"name":"is_schema_bound","type":"bit"},{"name":"uses_database_collation","type":"bit"},{"name":"is_recompiled","type":"bit"},{"name":"null_on_null_input","type":"bit"},{"name":"execute_as_principal_id","type":"int"},{"name":"uses_native_compilation","type":"bit"},{"name":"inline_type","type":"bit"},{"name":"is_inlineable","type":"bit"}]} +{"schema":"sys","name":"stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"stats_id","type":"int","not_null":true},{"name":"auto_created","type":"bit"},{"name":"user_created","type":"bit"},{"name":"no_recompute","type":"bit"},{"name":"has_filter","type":"bit"},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"is_temporary","type":"bit"},{"name":"is_incremental","type":"bit"},{"name":"has_persisted_sample","type":"bit"},{"name":"stats_generation_method","type":"int","not_null":true},{"name":"stats_generation_method_desc","type":"varchar(80)","not_null":true},{"name":"auto_drop","type":"bit"},{"name":"replica_role_id","type":"tinyint"},{"name":"replica_role_desc","type":"nvarchar(60)"},{"name":"replica_name","type":"nvarchar(128)"}]} +{"schema":"sys","name":"stats_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"stats_id","type":"int","not_null":true},{"name":"stats_column_id","type":"int"},{"name":"column_id","type":"int"}]} +{"schema":"sys","name":"symmetric_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int"},{"name":"symmetric_key_id","type":"int","not_null":true},{"name":"key_length","type":"int","not_null":true},{"name":"key_algorithm","type":"char(2)","not_null":true},{"name":"algorithm_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"key_guid","type":"uniqueidentifier"},{"name":"key_thumbprint","type":"sql_variant"},{"name":"provider_type","type":"nvarchar(60)"},{"name":"cryptographic_provider_guid","type":"uniqueidentifier"},{"name":"cryptographic_provider_algid","type":"sql_variant"}]} +{"schema":"sys","name":"synonyms","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"base_object_name","type":"nvarchar(1035)"}]} +{"schema":"sys","name":"sysaltfiles","kind":"v","columns":[{"name":"fileid","type":"smallint"},{"name":"groupid","type":"smallint"},{"name":"size","type":"int","not_null":true},{"name":"maxsize","type":"int","not_null":true},{"name":"growth","type":"int","not_null":true},{"name":"status","type":"int"},{"name":"perf","type":"int"},{"name":"dbid","type":"smallint"},{"name":"name","type":"nvarchar(128)"},{"name":"filename","type":"nvarchar(260)"}]} +{"schema":"sys","name":"syscacheobjects","kind":"v","columns":[{"name":"bucketid","type":"int","not_null":true},{"name":"cacheobjtype","type":"nvarchar(50)","not_null":true},{"name":"objtype","type":"nvarchar(20)","not_null":true},{"name":"objid","type":"int"},{"name":"dbid","type":"smallint"},{"name":"dbidexec","type":"smallint"},{"name":"uid","type":"smallint"},{"name":"refcounts","type":"int","not_null":true},{"name":"usecounts","type":"int","not_null":true},{"name":"pagesused","type":"int"},{"name":"setopts","type":"int"},{"name":"langid","type":"smallint"},{"name":"dateformat","type":"smallint"},{"name":"status","type":"int"},{"name":"lasttime","type":"bigint"},{"name":"maxexectime","type":"bigint"},{"name":"avgexectime","type":"bigint"},{"name":"lastreads","type":"bigint"},{"name":"lastwrites","type":"bigint"},{"name":"sqlbytes","type":"int"},{"name":"sql","type":"nvarchar(3900)"}]} +{"schema":"sys","name":"syscharsets","kind":"v","columns":[{"name":"type","type":"smallint","not_null":true},{"name":"id","type":"tinyint","not_null":true},{"name":"csid","type":"tinyint","not_null":true},{"name":"status","type":"smallint"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"description","type":"nvarchar(255)","not_null":true},{"name":"binarydefinition","type":"varbinary(6000)"},{"name":"definition","type":"image"}]} +{"schema":"sys","name":"syscolumns","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"id","type":"int","not_null":true},{"name":"xtype","type":"tinyint","not_null":true},{"name":"typestat","type":"tinyint"},{"name":"xusertype","type":"smallint"},{"name":"length","type":"smallint","not_null":true},{"name":"xprec","type":"tinyint","not_null":true},{"name":"xscale","type":"tinyint","not_null":true},{"name":"colid","type":"smallint"},{"name":"xoffset","type":"smallint"},{"name":"bitpos","type":"tinyint"},{"name":"reserved","type":"tinyint"},{"name":"colstat","type":"smallint"},{"name":"cdefault","type":"int","not_null":true},{"name":"domain","type":"int","not_null":true},{"name":"number","type":"smallint"},{"name":"colorder","type":"smallint"},{"name":"autoval","type":"varbinary(8000)"},{"name":"offset","type":"smallint"},{"name":"collationid","type":"int"},{"name":"language","type":"int"},{"name":"status","type":"tinyint"},{"name":"type","type":"tinyint","not_null":true},{"name":"usertype","type":"smallint"},{"name":"printfmt","type":"varchar(255)"},{"name":"prec","type":"smallint"},{"name":"scale","type":"int"},{"name":"iscomputed","type":"int"},{"name":"isoutparam","type":"int"},{"name":"isnullable","type":"int"},{"name":"collation","type":"nvarchar(128)"},{"name":"tdscollation","type":"binary(5)"}]} +{"schema":"sys","name":"syscomments","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"number","type":"smallint"},{"name":"colid","type":"smallint","not_null":true},{"name":"status","type":"smallint","not_null":true},{"name":"ctext","type":"varbinary(8000)"},{"name":"texttype","type":"smallint"},{"name":"language","type":"smallint"},{"name":"encrypted","type":"bit","not_null":true},{"name":"compressed","type":"bit","not_null":true},{"name":"text","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"sysconfigures","kind":"v","columns":[{"name":"value","type":"int"},{"name":"config","type":"int","not_null":true},{"name":"comment","type":"nvarchar(255)","not_null":true},{"name":"status","type":"smallint"}]} +{"schema":"sys","name":"sysconstraints","kind":"v","columns":[{"name":"constid","type":"int","not_null":true},{"name":"id","type":"int","not_null":true},{"name":"colid","type":"smallint"},{"name":"spare1","type":"tinyint"},{"name":"status","type":"int"},{"name":"actions","type":"int"},{"name":"error","type":"int"}]} +{"schema":"sys","name":"syscscontainers","kind":"v","columns":[{"name":"blob_container_id","type":"smallint","not_null":true},{"name":"blob_container_url","type":"nvarchar(261)"},{"name":"blob_container_type","type":"tinyint"}]} +{"schema":"sys","name":"syscurconfigs","kind":"v","columns":[{"name":"value","type":"int","not_null":true},{"name":"config","type":"smallint"},{"name":"comment","type":"nvarchar(255)","not_null":true},{"name":"status","type":"smallint"}]} +{"schema":"sys","name":"syscursorcolumns","kind":"v","columns":[{"name":"cursor_handle","type":"int","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"ordinal_position","type":"int","not_null":true},{"name":"column_characteristics_flags","type":"int","not_null":true},{"name":"column_size","type":"int","not_null":true},{"name":"data_type_sql","type":"int","not_null":true},{"name":"column_precision","type":"tinyint","not_null":true},{"name":"column_scale","type":"tinyint","not_null":true},{"name":"order_position","type":"int","not_null":true},{"name":"order_direction","type":"nvarchar(1)"},{"name":"hidden_column","type":"smallint","not_null":true},{"name":"columnid","type":"int","not_null":true},{"name":"objectid","type":"int","not_null":true},{"name":"dbid","type":"int","not_null":true},{"name":"dbname","type":"nvarchar(128)"}]} +{"schema":"sys","name":"syscursorrefs","kind":"v","columns":[{"name":"reference_name","type":"nvarchar(128)"},{"name":"cursor_scope","type":"tinyint","not_null":true},{"name":"cursor_handl","type":"int","not_null":true}]} +{"schema":"sys","name":"syscursors","kind":"v","columns":[{"name":"cursor_handle","type":"int","not_null":true},{"name":"cursor_name","type":"nvarchar(128)"},{"name":"status","type":"int","not_null":true},{"name":"model","type":"tinyint","not_null":true},{"name":"concurrency","type":"tinyint","not_null":true},{"name":"scrollable","type":"tinyint","not_null":true},{"name":"open_status","type":"tinyint","not_null":true},{"name":"cursor_rows","type":"numeric(10,0)"},{"name":"fetch_status","type":"smallint","not_null":true},{"name":"column_count","type":"smallint","not_null":true},{"name":"row_count","type":"numeric(10,0)"},{"name":"last_operation","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"syscursortables","kind":"v","columns":[{"name":"cursor_handle","type":"int","not_null":true},{"name":"table_owner","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)"},{"name":"optimizer_hint","type":"smallint","not_null":true},{"name":"lock_type","type":"smallint","not_null":true},{"name":"server_name","type":"nvarchar(128)"},{"name":"objectid","type":"int","not_null":true},{"name":"dbid","type":"int","not_null":true},{"name":"dbname","type":"nvarchar(128)"}]} +{"schema":"sys","name":"sysdatabases","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"dbid","type":"smallint"},{"name":"sid","type":"varbinary(85)"},{"name":"mode","type":"smallint"},{"name":"status","type":"int"},{"name":"status2","type":"int"},{"name":"crdate","type":"datetime","not_null":true},{"name":"reserved","type":"datetime"},{"name":"category","type":"int"},{"name":"cmptlevel","type":"tinyint","not_null":true},{"name":"filename","type":"nvarchar(260)"},{"name":"version","type":"smallint"}]} +{"schema":"sys","name":"sysdepends","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"depid","type":"int","not_null":true},{"name":"number","type":"smallint"},{"name":"depnumber","type":"smallint"},{"name":"status","type":"smallint"},{"name":"deptype","type":"tinyint","not_null":true},{"name":"depdbid","type":"smallint"},{"name":"depsiteid","type":"smallint"},{"name":"selall","type":"bit","not_null":true},{"name":"resultobj","type":"bit","not_null":true},{"name":"readobj","type":"bit","not_null":true}]} +{"schema":"sys","name":"sysdevices","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"size","type":"int"},{"name":"low","type":"int"},{"name":"high","type":"int"},{"name":"status","type":"smallint"},{"name":"cntrltype","type":"smallint"},{"name":"phyname","type":"nvarchar(260)"}]} +{"schema":"sys","name":"sysfilegroups","kind":"v","columns":[{"name":"groupid","type":"smallint"},{"name":"allocpolicy","type":"smallint"},{"name":"status","type":"int"},{"name":"groupname","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"sysfiles","kind":"v","columns":[{"name":"fileid","type":"smallint"},{"name":"groupid","type":"smallint"},{"name":"size","type":"int","not_null":true},{"name":"maxsize","type":"int","not_null":true},{"name":"growth","type":"int","not_null":true},{"name":"status","type":"int"},{"name":"perf","type":"int"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"filename","type":"nvarchar(260)"}]} +{"schema":"sys","name":"sysforeignkeys","kind":"v","columns":[{"name":"constid","type":"int","not_null":true},{"name":"fkeyid","type":"int","not_null":true},{"name":"rkeyid","type":"int","not_null":true},{"name":"fkey","type":"smallint"},{"name":"rkey","type":"smallint"},{"name":"keyno","type":"smallint"}]} +{"schema":"sys","name":"sysfulltextcatalogs","kind":"v","columns":[{"name":"ftcatid","type":"smallint"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"status","type":"smallint"},{"name":"path","type":"nvarchar(260)"}]} +{"schema":"sys","name":"sysindexes","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"status","type":"int"},{"name":"first","type":"binary(6)"},{"name":"indid","type":"smallint"},{"name":"root","type":"binary(6)"},{"name":"minlen","type":"smallint"},{"name":"keycnt","type":"smallint"},{"name":"groupid","type":"smallint"},{"name":"dpages","type":"int"},{"name":"reserved","type":"int"},{"name":"used","type":"int"},{"name":"rowcnt","type":"bigint"},{"name":"rowmodctr","type":"int"},{"name":"reserved3","type":"tinyint"},{"name":"reserved4","type":"tinyint"},{"name":"xmaxlen","type":"smallint"},{"name":"maxirow","type":"smallint"},{"name":"origfillfactor","type":"tinyint"},{"name":"statversion","type":"tinyint"},{"name":"reserved2","type":"int"},{"name":"firstiam","type":"binary(6)"},{"name":"impid","type":"smallint"},{"name":"lockflags","type":"smallint"},{"name":"pgmodctr","type":"int"},{"name":"keys","type":"varbinary(1088)"},{"name":"name","type":"nvarchar(128)"},{"name":"statblob","type":"image"},{"name":"maxlen","type":"int"},{"name":"rows","type":"int"}]} +{"schema":"sys","name":"sysindexkeys","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"indid","type":"smallint"},{"name":"colid","type":"smallint"},{"name":"keyno","type":"smallint"}]} +{"schema":"sys","name":"syslanguages","kind":"v","columns":[{"name":"langid","type":"smallint","not_null":true},{"name":"dateformat","type":"nchar(3)","not_null":true},{"name":"datefirst","type":"tinyint","not_null":true},{"name":"upgrade","type":"int"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"alias","type":"nvarchar(128)","not_null":true},{"name":"months","type":"nvarchar(372)"},{"name":"shortmonths","type":"nvarchar(132)"},{"name":"days","type":"nvarchar(217)"},{"name":"lcid","type":"int","not_null":true},{"name":"msglangid","type":"smallint","not_null":true}]} +{"schema":"sys","name":"syslockinfo","kind":"v","columns":[{"name":"rsc_text","type":"nchar(32)","not_null":true},{"name":"rsc_bin","type":"binary(16)","not_null":true},{"name":"rsc_valblk","type":"binary(16)","not_null":true},{"name":"rsc_dbid","type":"smallint","not_null":true},{"name":"rsc_indid","type":"smallint","not_null":true},{"name":"rsc_objid","type":"int","not_null":true},{"name":"rsc_type","type":"tinyint","not_null":true},{"name":"rsc_flag","type":"tinyint","not_null":true},{"name":"req_mode","type":"tinyint","not_null":true},{"name":"req_status","type":"tinyint","not_null":true},{"name":"req_refcnt","type":"smallint","not_null":true},{"name":"req_cryrefcnt","type":"smallint","not_null":true},{"name":"req_lifetime","type":"int","not_null":true},{"name":"req_spid","type":"int","not_null":true},{"name":"req_ecid","type":"int","not_null":true},{"name":"req_ownertype","type":"smallint","not_null":true},{"name":"req_transactionid","type":"bigint"},{"name":"req_transactionuow","type":"uniqueidentifier"}]} +{"schema":"sys","name":"syslogins","kind":"v","columns":[{"name":"sid","type":"varbinary(85)"},{"name":"status","type":"smallint"},{"name":"createdate","type":"datetime","not_null":true},{"name":"updatedate","type":"datetime","not_null":true},{"name":"accdate","type":"datetime","not_null":true},{"name":"totcpu","type":"int"},{"name":"totio","type":"int"},{"name":"spacelimit","type":"int"},{"name":"timelimit","type":"int"},{"name":"resultlimit","type":"int"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"dbname","type":"nvarchar(128)"},{"name":"password","type":"nvarchar(128)"},{"name":"language","type":"nvarchar(128)"},{"name":"denylogin","type":"int"},{"name":"hasaccess","type":"int"},{"name":"isntname","type":"int"},{"name":"isntgroup","type":"int"},{"name":"isntuser","type":"int"},{"name":"sysadmin","type":"int"},{"name":"securityadmin","type":"int"},{"name":"serveradmin","type":"int"},{"name":"setupadmin","type":"int"},{"name":"processadmin","type":"int"},{"name":"diskadmin","type":"int"},{"name":"dbcreator","type":"int"},{"name":"bulkadmin","type":"int"},{"name":"##ms_serverstatereader##","type":"int"},{"name":"##ms_serverstatemanager##","type":"int"},{"name":"##ms_definitionreader##","type":"int"},{"name":"##ms_databaseconnector##","type":"int"},{"name":"##ms_databasemanager##","type":"int"},{"name":"##ms_loginmanager##","type":"int"},{"name":"##ms_securitydefinitionreader##","type":"int"},{"name":"##ms_permissiondefinitionreader##","type":"int"},{"name":"##ms_serversecuritystatereader##","type":"int"},{"name":"##ms_serverpermissionstatereader##","type":"int"},{"name":"loginname","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"sysmembers","kind":"v","columns":[{"name":"memberuid","type":"smallint"},{"name":"groupuid","type":"smallint"}]} +{"schema":"sys","name":"sysmessages","kind":"v","columns":[{"name":"error","type":"int","not_null":true},{"name":"severity","type":"tinyint"},{"name":"dlevel","type":"smallint"},{"name":"description","type":"nvarchar(255)"},{"name":"msglangid","type":"smallint","not_null":true}]} +{"schema":"sys","name":"sysobjects","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"id","type":"int","not_null":true},{"name":"xtype","type":"char(2)","not_null":true},{"name":"uid","type":"smallint"},{"name":"info","type":"smallint"},{"name":"status","type":"int"},{"name":"base_schema_ver","type":"int"},{"name":"replinfo","type":"int"},{"name":"parent_obj","type":"int","not_null":true},{"name":"crdate","type":"datetime","not_null":true},{"name":"ftcatid","type":"smallint"},{"name":"schema_ver","type":"int"},{"name":"stats_schema_ver","type":"int"},{"name":"type","type":"char(2)"},{"name":"userstat","type":"smallint"},{"name":"sysstat","type":"smallint"},{"name":"indexdel","type":"smallint"},{"name":"refdate","type":"datetime","not_null":true},{"name":"version","type":"int"},{"name":"deltrig","type":"int"},{"name":"instrig","type":"int"},{"name":"updtrig","type":"int"},{"name":"seltrig","type":"int"},{"name":"category","type":"int"},{"name":"cache","type":"smallint"}]} +{"schema":"sys","name":"sysoledbusers","kind":"v","columns":[{"name":"rmtsrvid","type":"smallint"},{"name":"rmtloginame","type":"nvarchar(128)"},{"name":"rmtpassword","type":"nvarchar(128)"},{"name":"loginsid","type":"varbinary(85)"},{"name":"status","type":"smallint"},{"name":"changedate","type":"datetime","not_null":true}]} +{"schema":"sys","name":"sysopentapes","kind":"v","columns":[{"name":"opentape","type":"nvarchar(64)","not_null":true}]} +{"schema":"sys","name":"sysperfinfo","kind":"v","columns":[{"name":"object_name","type":"nchar(128)","not_null":true},{"name":"counter_name","type":"nchar(128)","not_null":true},{"name":"instance_name","type":"nchar(128)"},{"name":"cntr_value","type":"bigint","not_null":true},{"name":"cntr_type","type":"int","not_null":true}]} +{"schema":"sys","name":"syspermissions","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"grantee","type":"smallint"},{"name":"grantor","type":"smallint"},{"name":"actadd","type":"smallint"},{"name":"actmod","type":"smallint"},{"name":"seladd","type":"varbinary(4000)"},{"name":"selmod","type":"varbinary(4000)"},{"name":"updadd","type":"varbinary(4000)"},{"name":"updmod","type":"varbinary(4000)"},{"name":"refadd","type":"varbinary(4000)"},{"name":"refmod","type":"varbinary(4000)"}]} +{"schema":"sys","name":"sysprocesses","kind":"v","columns":[{"name":"spid","type":"smallint","not_null":true},{"name":"kpid","type":"smallint","not_null":true},{"name":"blocked","type":"smallint","not_null":true},{"name":"waittype","type":"binary(2)","not_null":true},{"name":"waittime","type":"bigint","not_null":true},{"name":"lastwaittype","type":"nchar(32)","not_null":true},{"name":"waitresource","type":"nchar(256)","not_null":true},{"name":"dbid","type":"smallint","not_null":true},{"name":"uid","type":"smallint"},{"name":"cpu","type":"int","not_null":true},{"name":"physical_io","type":"bigint","not_null":true},{"name":"memusage","type":"int","not_null":true},{"name":"login_time","type":"datetime","not_null":true},{"name":"last_batch","type":"datetime","not_null":true},{"name":"ecid","type":"smallint","not_null":true},{"name":"open_tran","type":"smallint","not_null":true},{"name":"status","type":"nchar(30)","not_null":true},{"name":"sid","type":"binary(86)","not_null":true},{"name":"hostname","type":"nchar(128)","not_null":true},{"name":"program_name","type":"nchar(128)","not_null":true},{"name":"hostprocess","type":"nchar(10)","not_null":true},{"name":"cmd","type":"nchar(26)","not_null":true},{"name":"nt_domain","type":"nchar(128)","not_null":true},{"name":"nt_username","type":"nchar(128)","not_null":true},{"name":"net_address","type":"nchar(12)","not_null":true},{"name":"net_library","type":"nchar(12)","not_null":true},{"name":"loginame","type":"nchar(128)","not_null":true},{"name":"context_info","type":"binary(128)","not_null":true},{"name":"sql_handle","type":"binary(20)","not_null":true},{"name":"stmt_start","type":"int","not_null":true},{"name":"stmt_end","type":"int","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"page_resource","type":"varbinary(8)"}]} +{"schema":"sys","name":"sysprotects","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"uid","type":"smallint"},{"name":"action","type":"tinyint"},{"name":"protecttype","type":"tinyint"},{"name":"columns","type":"varbinary(8000)"},{"name":"grantor","type":"smallint"}]} +{"schema":"sys","name":"sysreferences","kind":"v","columns":[{"name":"constid","type":"int","not_null":true},{"name":"fkeyid","type":"int","not_null":true},{"name":"rkeyid","type":"int"},{"name":"rkeyindid","type":"smallint"},{"name":"keycnt","type":"smallint"},{"name":"forkeys","type":"varbinary(32)"},{"name":"refkeys","type":"varbinary(32)"},{"name":"fkeydbid","type":"smallint"},{"name":"rkeydbid","type":"smallint"},{"name":"fkey1","type":"smallint"},{"name":"fkey2","type":"smallint"},{"name":"fkey3","type":"smallint"},{"name":"fkey4","type":"smallint"},{"name":"fkey5","type":"smallint"},{"name":"fkey6","type":"smallint"},{"name":"fkey7","type":"smallint"},{"name":"fkey8","type":"smallint"},{"name":"fkey9","type":"smallint"},{"name":"fkey10","type":"smallint"},{"name":"fkey11","type":"smallint"},{"name":"fkey12","type":"smallint"},{"name":"fkey13","type":"smallint"},{"name":"fkey14","type":"smallint"},{"name":"fkey15","type":"smallint"},{"name":"fkey16","type":"smallint"},{"name":"rkey1","type":"smallint"},{"name":"rkey2","type":"smallint"},{"name":"rkey3","type":"smallint"},{"name":"rkey4","type":"smallint"},{"name":"rkey5","type":"smallint"},{"name":"rkey6","type":"smallint"},{"name":"rkey7","type":"smallint"},{"name":"rkey8","type":"smallint"},{"name":"rkey9","type":"smallint"},{"name":"rkey10","type":"smallint"},{"name":"rkey11","type":"smallint"},{"name":"rkey12","type":"smallint"},{"name":"rkey13","type":"smallint"},{"name":"rkey14","type":"smallint"},{"name":"rkey15","type":"smallint"},{"name":"rkey16","type":"smallint"}]} +{"schema":"sys","name":"sysremotelogins","kind":"v","columns":[{"name":"remoteserverid","type":"smallint"},{"name":"remoteusername","type":"nvarchar(128)"},{"name":"status","type":"smallint"},{"name":"sid","type":"varbinary(85)"},{"name":"changedate","type":"datetime","not_null":true}]} +{"schema":"sys","name":"sysservers","kind":"v","columns":[{"name":"srvid","type":"smallint"},{"name":"srvstatus","type":"smallint"},{"name":"srvname","type":"nvarchar(128)","not_null":true},{"name":"srvproduct","type":"nvarchar(128)","not_null":true},{"name":"providername","type":"nvarchar(128)","not_null":true},{"name":"datasource","type":"nvarchar(4000)"},{"name":"location","type":"nvarchar(4000)"},{"name":"providerstring","type":"nvarchar(4000)"},{"name":"schemadate","type":"datetime","not_null":true},{"name":"topologyx","type":"int"},{"name":"topologyy","type":"int"},{"name":"catalog","type":"nvarchar(128)"},{"name":"srvcollation","type":"nvarchar(128)"},{"name":"connecttimeout","type":"int"},{"name":"querytimeout","type":"int"},{"name":"srvnetname","type":"char(30)"},{"name":"isremote","type":"bit"},{"name":"rpc","type":"bit","not_null":true},{"name":"pub","type":"bit","not_null":true},{"name":"sub","type":"bit"},{"name":"dist","type":"bit"},{"name":"dpub","type":"bit"},{"name":"rpcout","type":"bit","not_null":true},{"name":"dataaccess","type":"bit","not_null":true},{"name":"collationcompatible","type":"bit","not_null":true},{"name":"system","type":"bit","not_null":true},{"name":"useremotecollation","type":"bit","not_null":true},{"name":"lazyschemavalidation","type":"bit","not_null":true},{"name":"collation","type":"nvarchar(128)"},{"name":"nonsqlsub","type":"bit"}]} +{"schema":"sys","name":"system_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_computed","type":"bit","not_null":true},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit","not_null":true},{"name":"is_non_sql_subscribed","type":"bit","not_null":true},{"name":"is_merge_published","type":"bit","not_null":true},{"name":"is_dts_replicated","type":"bit","not_null":true},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_column_set","type":"bit","not_null":true},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit","not_null":true},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit","not_null":true},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit","not_null":true},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"system_components_surface_area_configuration","kind":"v","columns":[{"name":"component_name","type":"nvarchar(128)"},{"name":"database_name","type":"nvarchar(128)"},{"name":"schema_name","type":"nvarchar(128)"},{"name":"object_name","type":"nvarchar(128)","not_null":true},{"name":"state","type":"tinyint"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"system_internals_allocation_units","kind":"v","columns":[{"name":"allocation_unit_id","type":"bigint","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"container_id","type":"bigint","not_null":true},{"name":"filegroup_id","type":"smallint","not_null":true},{"name":"total_pages","type":"bigint","not_null":true},{"name":"used_pages","type":"bigint","not_null":true},{"name":"data_pages","type":"bigint","not_null":true},{"name":"first_page","type":"binary(6)","not_null":true},{"name":"root_page","type":"binary(6)","not_null":true},{"name":"first_iam_page","type":"binary(6)","not_null":true}]} +{"schema":"sys","name":"system_internals_partition_columns","kind":"v","columns":[{"name":"partition_id","type":"bigint","not_null":true},{"name":"partition_column_id","type":"int","not_null":true},{"name":"modified_count","type":"bigint","not_null":true},{"name":"max_inrow_length","type":"smallint"},{"name":"is_replicated","type":"bit"},{"name":"is_logged_for_replication","type":"bit"},{"name":"is_dropped","type":"bit"},{"name":"system_type_id","type":"tinyint"},{"name":"max_length","type":"smallint"},{"name":"precision","type":"tinyint"},{"name":"scale","type":"tinyint"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_filestream","type":"bit"},{"name":"key_ordinal","type":"smallint","not_null":true},{"name":"is_nullable","type":"bit"},{"name":"is_descending_key","type":"bit"},{"name":"is_uniqueifier","type":"bit"},{"name":"leaf_offset","type":"smallint"},{"name":"internal_offset","type":"smallint"},{"name":"leaf_bit_position","type":"tinyint"},{"name":"internal_bit_position","type":"tinyint"},{"name":"leaf_null_bit","type":"smallint"},{"name":"internal_null_bit","type":"smallint"},{"name":"is_anti_matter","type":"bit"},{"name":"partition_column_guid","type":"uniqueidentifier"},{"name":"is_sparse","type":"bit"},{"name":"has_default","type":"bit","not_null":true},{"name":"default_value","type":"sql_variant"},{"name":"hobt_column_id","type":"int","not_null":true},{"name":"is_csilocator","type":"bit"},{"name":"is_added_with_skip_segments","type":"bit"}]} +{"schema":"sys","name":"system_internals_partitions","kind":"v","columns":[{"name":"partition_id","type":"bigint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"rows","type":"bigint","not_null":true},{"name":"filestream_filegroup_id","type":"smallint","not_null":true},{"name":"is_orphaned","type":"bit"},{"name":"dropped_lob_column_state","type":"tinyint"},{"name":"is_unique","type":"bit"},{"name":"is_replicated","type":"bit"},{"name":"is_logged_for_replication","type":"bit"},{"name":"is_sereplicated","type":"bit","not_null":true},{"name":"max_null_bit_used","type":"smallint","not_null":true},{"name":"max_leaf_length","type":"int","not_null":true},{"name":"min_leaf_length","type":"smallint","not_null":true},{"name":"max_internal_length","type":"smallint","not_null":true},{"name":"min_internal_length","type":"smallint","not_null":true},{"name":"allows_nullable_keys","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"is_data_row_format","type":"bit"},{"name":"is_not_versioned","type":"bit"},{"name":"filestream_guid","type":"uniqueidentifier"},{"name":"ownertype","type":"tinyint","not_null":true},{"name":"is_columnstore","type":"bit"},{"name":"optimize_for_sequential_key","type":"bit"}]} +{"schema":"sys","name":"system_objects","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"}]} +{"schema":"sys","name":"system_parameters","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"is_output","type":"bit","not_null":true},{"name":"is_cursor_ref","type":"bit","not_null":true},{"name":"has_default_value","type":"bit","not_null":true},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"default_value","type":"sql_variant"},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"is_readonly","type":"bit","not_null":true},{"name":"is_nullable","type":"bit"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"system_sql_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_ansi_nulls","type":"bit","not_null":true},{"name":"uses_quoted_identifier","type":"bit","not_null":true},{"name":"is_schema_bound","type":"bit","not_null":true},{"name":"uses_database_collation","type":"bit","not_null":true},{"name":"is_recompiled","type":"bit","not_null":true},{"name":"null_on_null_input","type":"bit","not_null":true},{"name":"execute_as_principal_id","type":"int"},{"name":"uses_native_compilation","type":"bit","not_null":true},{"name":"inline_type","type":"bit","not_null":true},{"name":"is_inlineable","type":"bit","not_null":true}]} +{"schema":"sys","name":"system_views","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"},{"name":"is_replicated","type":"bit","not_null":true},{"name":"has_replication_filter","type":"bit","not_null":true},{"name":"has_opaque_metadata","type":"bit","not_null":true},{"name":"has_unchecked_assembly_data","type":"bit","not_null":true},{"name":"with_check_option","type":"bit","not_null":true},{"name":"is_date_correlation_view","type":"bit","not_null":true},{"name":"is_tracked_by_cdc","type":"bit","not_null":true},{"name":"has_snapshot","type":"bit","not_null":true},{"name":"ledger_view_type","type":"tinyint"},{"name":"ledger_view_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_view","type":"bit","not_null":true}]} +{"schema":"sys","name":"systypes","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"xtype","type":"tinyint","not_null":true},{"name":"status","type":"tinyint"},{"name":"xusertype","type":"smallint"},{"name":"length","type":"smallint","not_null":true},{"name":"xprec","type":"tinyint","not_null":true},{"name":"xscale","type":"tinyint","not_null":true},{"name":"tdefault","type":"int","not_null":true},{"name":"domain","type":"int","not_null":true},{"name":"uid","type":"smallint"},{"name":"reserved","type":"smallint"},{"name":"collationid","type":"int"},{"name":"usertype","type":"smallint"},{"name":"variable","type":"bit","not_null":true},{"name":"allownulls","type":"bit"},{"name":"type","type":"tinyint","not_null":true},{"name":"printfmt","type":"varchar(255)"},{"name":"prec","type":"smallint"},{"name":"scale","type":"tinyint"},{"name":"collation","type":"nvarchar(128)"}]} +{"schema":"sys","name":"sysusers","kind":"v","columns":[{"name":"uid","type":"smallint"},{"name":"status","type":"smallint"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"sid","type":"varbinary(85)"},{"name":"roles","type":"varbinary(2048)"},{"name":"createdate","type":"datetime","not_null":true},{"name":"updatedate","type":"datetime","not_null":true},{"name":"altuid","type":"smallint"},{"name":"password","type":"varbinary(256)"},{"name":"gid","type":"smallint"},{"name":"environ","type":"varchar(255)"},{"name":"hasdbaccess","type":"int"},{"name":"islogin","type":"int"},{"name":"isntname","type":"int"},{"name":"isntgroup","type":"int"},{"name":"isntuser","type":"int"},{"name":"issqluser","type":"int"},{"name":"isaliased","type":"int"},{"name":"issqlrole","type":"int"},{"name":"isapprole","type":"int"}]} +{"schema":"sys","name":"table_types","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_user_defined","type":"bit","not_null":true},{"name":"is_assembly_type","type":"bit","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_table_type","type":"bit","not_null":true},{"name":"type_table_object_id","type":"int","not_null":true},{"name":"is_memory_optimized","type":"bit"}]} +{"schema":"sys","name":"tables","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"lob_data_space_id","type":"int","not_null":true},{"name":"filestream_data_space_id","type":"int"},{"name":"max_column_id_used","type":"int","not_null":true},{"name":"lock_on_bulk_load","type":"bit","not_null":true},{"name":"uses_ansi_nulls","type":"bit"},{"name":"is_replicated","type":"bit"},{"name":"has_replication_filter","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_sync_tran_subscribed","type":"bit"},{"name":"has_unchecked_assembly_data","type":"bit","not_null":true},{"name":"text_in_row_limit","type":"int"},{"name":"large_value_types_out_of_row","type":"bit"},{"name":"is_tracked_by_cdc","type":"bit"},{"name":"lock_escalation","type":"tinyint"},{"name":"lock_escalation_desc","type":"nvarchar(60)"},{"name":"is_filetable","type":"bit"},{"name":"is_memory_optimized","type":"bit"},{"name":"durability","type":"tinyint"},{"name":"durability_desc","type":"nvarchar(60)"},{"name":"temporal_type","type":"tinyint"},{"name":"temporal_type_desc","type":"nvarchar(60)"},{"name":"history_table_id","type":"int"},{"name":"is_remote_data_archive_enabled","type":"bit"},{"name":"is_external","type":"bit","not_null":true},{"name":"history_retention_period","type":"int"},{"name":"history_retention_period_unit","type":"int"},{"name":"history_retention_period_unit_desc","type":"nvarchar(10)"},{"name":"is_node","type":"bit"},{"name":"is_edge","type":"bit"},{"name":"data_retention_period","type":"int"},{"name":"data_retention_period_unit","type":"int"},{"name":"data_retention_period_unit_desc","type":"nvarchar(10)"},{"name":"ledger_type","type":"tinyint"},{"name":"ledger_type_desc","type":"nvarchar(60)"},{"name":"ledger_view_id","type":"int"},{"name":"is_dropped_ledger_table","type":"bit"}]} +{"schema":"sys","name":"tcp_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"port","type":"int","not_null":true},{"name":"is_dynamic_port","type":"bit","not_null":true},{"name":"ip_address","type":"varchar(45)"}]} +{"schema":"sys","name":"time_zone_info","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"current_utc_offset","type":"nvarchar(6)","not_null":true},{"name":"is_currently_dst","type":"bit","not_null":true}]} +{"schema":"sys","name":"trace_categories","kind":"v","columns":[{"name":"category_id","type":"smallint","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"type","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"trace_columns","kind":"v","columns":[{"name":"trace_column_id","type":"smallint","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"type_name","type":"nvarchar(128)"},{"name":"max_size","type":"int"},{"name":"is_filterable","type":"bit","not_null":true},{"name":"is_repeatable","type":"bit","not_null":true},{"name":"is_repeated_base","type":"bit","not_null":true}]} +{"schema":"sys","name":"trace_event_bindings","kind":"v","columns":[{"name":"trace_event_id","type":"smallint","not_null":true},{"name":"trace_column_id","type":"smallint","not_null":true}]} +{"schema":"sys","name":"trace_events","kind":"v","columns":[{"name":"trace_event_id","type":"smallint","not_null":true},{"name":"category_id","type":"smallint","not_null":true},{"name":"name","type":"nvarchar(128)"}]} +{"schema":"sys","name":"trace_subclass_values","kind":"v","columns":[{"name":"trace_event_id","type":"smallint","not_null":true},{"name":"trace_column_id","type":"smallint","not_null":true},{"name":"subclass_name","type":"nvarchar(128)"},{"name":"subclass_value","type":"smallint"}]} +{"schema":"sys","name":"traces","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"path","type":"nvarchar(260)"},{"name":"max_size","type":"bigint"},{"name":"stop_time","type":"datetime"},{"name":"max_files","type":"int"},{"name":"is_rowset","type":"bit"},{"name":"is_rollover","type":"bit"},{"name":"is_shutdown","type":"bit"},{"name":"is_default","type":"bit"},{"name":"buffer_count","type":"int"},{"name":"buffer_size","type":"int"},{"name":"file_position","type":"bigint"},{"name":"reader_spid","type":"int"},{"name":"start_time","type":"datetime"},{"name":"last_event_time","type":"datetime"},{"name":"event_count","type":"bigint"},{"name":"dropped_event_count","type":"int"}]} +{"schema":"sys","name":"transmission_queue","kind":"v","columns":[{"name":"conversation_handle","type":"uniqueidentifier","not_null":true},{"name":"to_service_name","type":"nvarchar(256)"},{"name":"to_broker_instance","type":"nvarchar(128)"},{"name":"from_service_name","type":"nvarchar(256)"},{"name":"service_contract_name","type":"nvarchar(256)"},{"name":"enqueue_time","type":"datetime","not_null":true},{"name":"message_sequence_number","type":"bigint","not_null":true},{"name":"message_type_name","type":"nvarchar(256)"},{"name":"is_conversation_error","type":"bit","not_null":true},{"name":"is_end_of_dialog","type":"bit","not_null":true},{"name":"message_body","type":"varbinary(max)"},{"name":"transmission_status","type":"nvarchar(4000)"},{"name":"priority","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"trigger_event_types","kind":"v","columns":[{"name":"type","type":"int","not_null":true},{"name":"type_name","type":"nvarchar(64)"},{"name":"parent_type","type":"int"}]} +{"schema":"sys","name":"trigger_events","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"type_desc","type":"nvarchar(128)","not_null":true},{"name":"is_first","type":"bit"},{"name":"is_last","type":"bit"},{"name":"event_group_type","type":"int"},{"name":"event_group_type_desc","type":"nvarchar(128)"},{"name":"is_trigger_event","type":"bit"}]} +{"schema":"sys","name":"triggers","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"parent_class","type":"tinyint","not_null":true},{"name":"parent_class_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_disabled","type":"bit","not_null":true},{"name":"is_not_for_replication","type":"bit","not_null":true},{"name":"is_instead_of_trigger","type":"bit","not_null":true}]} +{"schema":"sys","name":"trusted_assemblies","kind":"v","columns":[{"name":"hash","type":"varbinary(8000)"},{"name":"description","type":"nvarchar(4000)"},{"name":"create_date","type":"datetime2(7)","not_null":true},{"name":"created_by","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"type_assembly_usages","kind":"v","columns":[{"name":"user_type_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true}]} +{"schema":"sys","name":"types","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_user_defined","type":"bit","not_null":true},{"name":"is_assembly_type","type":"bit","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_table_type","type":"bit","not_null":true}]} +{"schema":"sys","name":"user_token","kind":"v","columns":[{"name":"principal_id","type":"int"},{"name":"sid","type":"varbinary(85)"},{"name":"name","type":"nvarchar(128)"},{"name":"type","type":"nvarchar(128)"},{"name":"usage","type":"nvarchar(128)"}]} +{"schema":"sys","name":"vector_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"has_filter","type":"bit","not_null":true},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"auto_created","type":"bit"},{"name":"vector_index_type","type":"nvarchar(60)"},{"name":"distance_metric","type":"nvarchar(60)"},{"name":"build_parameters","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"via_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"discriminator","type":"nvarchar(128)"}]} +{"schema":"sys","name":"views","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"has_replication_filter","type":"bit"},{"name":"has_opaque_metadata","type":"bit","not_null":true},{"name":"has_unchecked_assembly_data","type":"bit","not_null":true},{"name":"with_check_option","type":"bit","not_null":true},{"name":"is_date_correlation_view","type":"bit","not_null":true},{"name":"is_tracked_by_cdc","type":"bit"},{"name":"has_snapshot","type":"bit"},{"name":"ledger_view_type","type":"tinyint"},{"name":"ledger_view_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_view","type":"bit"}]} +{"schema":"sys","name":"xml_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"using_xml_index_id","type":"int"},{"name":"secondary_type","type":"char(1)"},{"name":"secondary_type_desc","type":"nvarchar(60)"},{"name":"has_filter","type":"bit","not_null":true},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"xml_index_type","type":"tinyint"},{"name":"xml_index_type_description","type":"nvarchar(60)"},{"name":"path_id","type":"int"},{"name":"auto_created","type":"bit"}]} +{"schema":"sys","name":"xml_schema_attributes","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"is_default_fixed","type":"bit","not_null":true},{"name":"must_be_qualified","type":"bit","not_null":true},{"name":"default_value","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"xml_schema_collections","kind":"v","columns":[{"name":"xml_collection_id","type":"int","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"xml_schema_component_placements","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"placement_id","type":"int","not_null":true},{"name":"placed_xml_component_id","type":"int","not_null":true},{"name":"is_default_fixed","type":"bit","not_null":true},{"name":"min_occurences","type":"int","not_null":true},{"name":"max_occurences","type":"int","not_null":true},{"name":"default_value","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"xml_schema_components","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"}]} +{"schema":"sys","name":"xml_schema_elements","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"is_default_fixed","type":"bit","not_null":true},{"name":"is_abstract","type":"bit","not_null":true},{"name":"is_nillable","type":"bit","not_null":true},{"name":"must_be_qualified","type":"bit","not_null":true},{"name":"is_extension_blocked","type":"bit","not_null":true},{"name":"is_restriction_blocked","type":"bit","not_null":true},{"name":"is_substitution_blocked","type":"bit","not_null":true},{"name":"is_final_extension","type":"bit","not_null":true},{"name":"is_final_restriction","type":"bit","not_null":true},{"name":"default_value","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"xml_schema_facets","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"facet_id","type":"int","not_null":true},{"name":"kind","type":"char(2)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"is_fixed","type":"bit","not_null":true},{"name":"value","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"xml_schema_model_groups","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"compositor","type":"char(1)","not_null":true},{"name":"compositor_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"xml_schema_namespaces","kind":"v","columns":[{"name":"xml_collection_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"xml_namespace_id","type":"int","not_null":true}]} +{"schema":"sys","name":"xml_schema_types","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"is_abstract","type":"bit","not_null":true},{"name":"allows_mixed_content","type":"bit","not_null":true},{"name":"is_extension_blocked","type":"bit","not_null":true},{"name":"is_restriction_blocked","type":"bit","not_null":true},{"name":"is_final_extension","type":"bit","not_null":true},{"name":"is_final_restriction","type":"bit","not_null":true},{"name":"is_final_list_member","type":"bit","not_null":true},{"name":"is_final_union_member","type":"bit","not_null":true}]} +{"schema":"sys","name":"xml_schema_wildcard_namespaces","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"namespace","type":"nvarchar(4000)","not_null":true}]} +{"schema":"sys","name":"xml_schema_wildcards","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"process_content","type":"char(1)","not_null":true},{"name":"process_content_desc","type":"nvarchar(60)"},{"name":"disallow_namespaces","type":"bit","not_null":true}]} +{"schema":"information_schema","name":"check_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"check_clause","type":"nvarchar(4000)"}]} +{"schema":"information_schema","name":"column_domain_usage","kind":"v","columns":[{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"column_privileges","kind":"v","columns":[{"name":"grantor","type":"nvarchar(128)"},{"name":"grantee","type":"nvarchar(128)"},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"privilege_type","type":"varchar(10)"},{"name":"is_grantable","type":"varchar(3)"}]} +{"schema":"information_schema","name":"columns","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"ordinal_position","type":"int"},{"name":"column_default","type":"nvarchar(4000)"},{"name":"is_nullable","type":"varchar(3)"},{"name":"data_type","type":"nvarchar(128)"},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"constraint_column_usage","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true}]} +{"schema":"information_schema","name":"constraint_table_usage","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true}]} +{"schema":"information_schema","name":"domain_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)","not_null":true},{"name":"is_deferrable","type":"varchar(2)","not_null":true},{"name":"initially_deferred","type":"varchar(2)","not_null":true}]} +{"schema":"information_schema","name":"domains","kind":"v","columns":[{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)","not_null":true},{"name":"data_type","type":"nvarchar(128)"},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"domain_default","type":"nvarchar(4000)"}]} +{"schema":"information_schema","name":"key_column_usage","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"ordinal_position","type":"int","not_null":true}]} +{"schema":"information_schema","name":"parameters","kind":"v","columns":[{"name":"specific_catalog","type":"nvarchar(128)"},{"name":"specific_schema","type":"nvarchar(128)"},{"name":"specific_name","type":"nvarchar(128)","not_null":true},{"name":"ordinal_position","type":"int","not_null":true},{"name":"parameter_mode","type":"nvarchar(10)"},{"name":"is_result","type":"nvarchar(10)"},{"name":"as_locator","type":"nvarchar(10)"},{"name":"parameter_name","type":"nvarchar(128)"},{"name":"data_type","type":"nvarchar(128)","not_null":true},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"interval_type","type":"nvarchar(30)"},{"name":"interval_precision","type":"smallint"},{"name":"user_defined_type_catalog","type":"nvarchar(128)"},{"name":"user_defined_type_schema","type":"nvarchar(128)"},{"name":"user_defined_type_name","type":"nvarchar(128)"},{"name":"scope_catalog","type":"nvarchar(128)"},{"name":"scope_schema","type":"nvarchar(128)"},{"name":"scope_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"referential_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"unique_constraint_catalog","type":"nvarchar(128)"},{"name":"unique_constraint_schema","type":"nvarchar(128)"},{"name":"unique_constraint_name","type":"nvarchar(128)"},{"name":"match_option","type":"varchar(7)"},{"name":"update_rule","type":"varchar(11)"},{"name":"delete_rule","type":"varchar(11)"}]} +{"schema":"information_schema","name":"routine_columns","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"ordinal_position","type":"int","not_null":true},{"name":"column_default","type":"nvarchar(4000)"},{"name":"is_nullable","type":"varchar(3)"},{"name":"data_type","type":"nvarchar(128)"},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"routines","kind":"v","columns":[{"name":"specific_catalog","type":"nvarchar(128)"},{"name":"specific_schema","type":"nvarchar(128)"},{"name":"specific_name","type":"nvarchar(128)","not_null":true},{"name":"routine_catalog","type":"nvarchar(128)"},{"name":"routine_schema","type":"nvarchar(128)"},{"name":"routine_name","type":"nvarchar(128)","not_null":true},{"name":"routine_type","type":"nvarchar(20)"},{"name":"module_catalog","type":"nvarchar(128)"},{"name":"module_schema","type":"nvarchar(128)"},{"name":"module_name","type":"nvarchar(128)"},{"name":"udt_catalog","type":"nvarchar(128)"},{"name":"udt_schema","type":"nvarchar(128)"},{"name":"udt_name","type":"nvarchar(128)"},{"name":"data_type","type":"nvarchar(128)"},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"interval_type","type":"nvarchar(30)"},{"name":"interval_precision","type":"smallint"},{"name":"type_udt_catalog","type":"nvarchar(128)"},{"name":"type_udt_schema","type":"nvarchar(128)"},{"name":"type_udt_name","type":"nvarchar(128)"},{"name":"scope_catalog","type":"nvarchar(128)"},{"name":"scope_schema","type":"nvarchar(128)"},{"name":"scope_name","type":"nvarchar(128)"},{"name":"maximum_cardinality","type":"bigint"},{"name":"dtd_identifier","type":"nvarchar(128)"},{"name":"routine_body","type":"nvarchar(30)"},{"name":"routine_definition","type":"nvarchar(4000)"},{"name":"external_name","type":"nvarchar(128)"},{"name":"external_language","type":"nvarchar(30)"},{"name":"parameter_style","type":"nvarchar(30)"},{"name":"is_deterministic","type":"nvarchar(10)"},{"name":"sql_data_access","type":"nvarchar(30)"},{"name":"is_null_call","type":"nvarchar(10)"},{"name":"sql_path","type":"nvarchar(128)"},{"name":"schema_level_routine","type":"nvarchar(10)"},{"name":"max_dynamic_result_sets","type":"smallint"},{"name":"is_user_defined_cast","type":"nvarchar(10)"},{"name":"is_implicitly_invocable","type":"nvarchar(10)"},{"name":"created","type":"datetime","not_null":true},{"name":"last_altered","type":"datetime","not_null":true}]} +{"schema":"information_schema","name":"schemata","kind":"v","columns":[{"name":"catalog_name","type":"nvarchar(128)"},{"name":"schema_name","type":"nvarchar(128)","not_null":true},{"name":"schema_owner","type":"nvarchar(128)"},{"name":"default_character_set_catalog","type":"nvarchar(128)"},{"name":"default_character_set_schema","type":"nvarchar(128)"},{"name":"default_character_set_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"sequences","kind":"v","columns":[{"name":"sequence_catalog","type":"nvarchar(128)"},{"name":"sequence_schema","type":"nvarchar(128)"},{"name":"sequence_name","type":"nvarchar(128)","not_null":true},{"name":"data_type","type":"nvarchar(128)","not_null":true},{"name":"numeric_precision","type":"tinyint","not_null":true},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"start_value","type":"sql_variant","not_null":true},{"name":"minimum_value","type":"sql_variant","not_null":true},{"name":"maximum_value","type":"sql_variant","not_null":true},{"name":"increment","type":"sql_variant","not_null":true},{"name":"cycle_option","type":"bit"},{"name":"declared_data_type","type":"nvarchar(128)","not_null":true},{"name":"declared_numeric_precision","type":"tinyint","not_null":true},{"name":"declared_numeric_scale","type":"tinyint","not_null":true}]} +{"schema":"information_schema","name":"table_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)"},{"name":"constraint_type","type":"varchar(11)"},{"name":"is_deferrable","type":"varchar(2)","not_null":true},{"name":"initially_deferred","type":"varchar(2)","not_null":true}]} +{"schema":"information_schema","name":"table_privileges","kind":"v","columns":[{"name":"grantor","type":"nvarchar(128)"},{"name":"grantee","type":"nvarchar(128)"},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"privilege_type","type":"varchar(10)"},{"name":"is_grantable","type":"varchar(3)"}]} +{"schema":"information_schema","name":"tables","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"table_type","type":"varchar(10)"}]} +{"schema":"information_schema","name":"view_column_usage","kind":"v","columns":[{"name":"view_catalog","type":"nvarchar(128)"},{"name":"view_schema","type":"nvarchar(128)"},{"name":"view_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"view_table_usage","kind":"v","columns":[{"name":"view_catalog","type":"nvarchar(128)"},{"name":"view_schema","type":"nvarchar(128)"},{"name":"view_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true}]} +{"schema":"information_schema","name":"views","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"view_definition","type":"nvarchar(4000)"},{"name":"check_option","type":"varchar(7)"},{"name":"is_updatable","type":"varchar(2)","not_null":true}]} diff --git a/internal/engine/mssql/dialect/types.jsonl b/internal/engine/mssql/dialect/types.jsonl new file mode 100644 index 0000000000..e730686aa7 --- /dev/null +++ b/internal/engine/mssql/dialect/types.jsonl @@ -0,0 +1,34 @@ +{"name": "bigint", "category": "N"} +{"name": "int", "category": "N", "aliases": ["integer"]} +{"name": "smallint", "category": "N"} +{"name": "tinyint", "category": "N"} +{"name": "bit", "category": "B"} +{"name": "decimal", "category": "N", "aliases": ["dec", "numeric"]} +{"name": "money", "category": "N"} +{"name": "smallmoney", "category": "N"} +{"name": "float", "category": "N", "aliases": ["double precision"]} +{"name": "real", "category": "N"} +{"name": "date", "category": "D"} +{"name": "datetime", "category": "D"} +{"name": "datetime2", "category": "D"} +{"name": "smalldatetime", "category": "D"} +{"name": "datetimeoffset", "category": "D"} +{"name": "time", "category": "D"} +{"name": "char", "category": "S", "aliases": ["character"]} +{"name": "varchar", "category": "S"} +{"name": "text", "category": "S"} +{"name": "nchar", "category": "S"} +{"name": "nvarchar", "category": "S"} +{"name": "ntext", "category": "S"} +{"name": "binary", "category": "S"} +{"name": "varbinary", "category": "S"} +{"name": "image", "category": "S"} +{"name": "uniqueidentifier", "category": "S"} +{"name": "xml", "category": "U"} +{"name": "json", "category": "U"} +{"name": "sql_variant", "category": "U"} +{"name": "rowversion", "category": "U", "aliases": ["timestamp"]} +{"name": "hierarchyid", "category": "U"} +{"name": "geography", "category": "U"} +{"name": "geometry", "category": "U"} +{"name": "vector", "category": "U"} diff --git a/internal/engine/mssql/parse.go b/internal/engine/mssql/parse.go new file mode 100644 index 0000000000..e222708ece --- /dev/null +++ b/internal/engine/mssql/parse.go @@ -0,0 +1,187 @@ +package mssql + +import ( + "bytes" + "context" + "io" + "unicode/utf8" + + "github.com/sqlc-dev/teesql/parser" + + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +func NewParser() *Parser { + return &Parser{} +} + +type Parser struct{} + +func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { + blob, err := io.ReadAll(r) + if err != nil { + return nil, err + } + + ctx := context.Background() + script, err := parser.Parse(ctx, bytes.NewReader(blob)) + if err != nil { + return nil, err + } + + toByte := byteOffsets(blob) + + var stmts []ast.Statement + loc := 0 + for _, batch := range script.Batches { + for _, stmt := range batch.Statements { + start := loc + if frag, ok := stmt.(fragmented); ok && frag.Frag().HasSpan() { + if s := toByte(frag.Frag().StartOffset); s > start { + start = s + } + } + end := statementEnd(blob, start) + + converter := &cc{toByte: toByte} + out := converter.convert(stmt) + if _, ok := out.(*ast.TODO); ok { + loc = end + continue + } + + stmts = append(stmts, ast.Statement{ + Raw: &ast.RawStmt{ + Stmt: out, + StmtLocation: loc, + StmtLen: end - loc, + }, + }) + loc = end + } + } + + return stmts, nil +} + +// byteOffsets returns a function mapping a UTF-16 code-unit offset — how +// teesql records source spans, mirroring ScriptDom — to a byte offset in +// blob. For ASCII input the two are identical and the identity is returned. +func byteOffsets(blob []byte) func(int) int { + ascii := true + for _, b := range blob { + if b >= utf8.RuneSelf { + ascii = false + break + } + } + if ascii { + return func(off int) int { return off } + } + // Walk the blob once, recording the byte index at which each UTF-16 + // offset begins. + byteAt := make([]int, 0, len(blob)+1) + for i := 0; i < len(blob); { + r, size := utf8.DecodeRune(blob[i:]) + units := 1 + if r > 0xFFFF { + units = 2 + } + for u := 0; u < units; u++ { + byteAt = append(byteAt, i) + } + i += size + } + byteAt = append(byteAt, len(blob)) + return func(off int) int { + if off < 0 { + return 0 + } + if off >= len(byteAt) { + return len(blob) + } + return byteAt[off] + } +} + +// statementEnd scans from start for the semicolon ending the statement, +// skipping string literals, quoted and bracketed identifiers, and comments. +func statementEnd(blob []byte, start int) int { + for i := start; i < len(blob); i++ { + switch blob[i] { + case '\'', '"': + i = skipQuoted(blob, i) + case '[': + i = skipBracketed(blob, i) + case '-': + if i+1 < len(blob) && blob[i+1] == '-' { + i = skipLineComment(blob, i) + } + case '/': + if i+1 < len(blob) && blob[i+1] == '*' { + i = skipBlockComment(blob, i) + } + case ';': + return i + 1 + } + } + return len(blob) +} + +// skipQuoted skips a string literal or quoted identifier; T-SQL escapes the +// quote character by doubling it. +func skipQuoted(blob []byte, i int) int { + q := blob[i] + for j := i + 1; j < len(blob); j++ { + if blob[j] == q { + if j+1 < len(blob) && blob[j+1] == q { + j++ + continue + } + return j + } + } + return len(blob) - 1 +} + +// skipBracketed skips a [bracketed identifier]; a closing bracket is escaped +// by doubling it. +func skipBracketed(blob []byte, i int) int { + for j := i + 1; j < len(blob); j++ { + if blob[j] == ']' { + if j+1 < len(blob) && blob[j+1] == ']' { + j++ + continue + } + return j + } + } + return len(blob) - 1 +} + +func skipLineComment(blob []byte, i int) int { + for j := i; j < len(blob); j++ { + if blob[j] == '\n' { + return j + } + } + return len(blob) - 1 +} + +func skipBlockComment(blob []byte, i int) int { + for j := i + 2; j < len(blob); j++ { + if blob[j] == '*' && j+1 < len(blob) && blob[j+1] == '/' { + return j + 1 + } + } + return len(blob) - 1 +} + +// https://learn.microsoft.com/en-us/sql/t-sql/language-elements/comment-transact-sql +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ + Dash: true, // -- comment + SlashStar: true, // /* comment */ + } +} diff --git a/internal/engine/mssql/reserved.go b/internal/engine/mssql/reserved.go new file mode 100644 index 0000000000..e1a697a1ca --- /dev/null +++ b/internal/engine/mssql/reserved.go @@ -0,0 +1,196 @@ +package mssql + +import "strings" + +// https://learn.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql +func (p *Parser) IsReservedKeyword(s string) bool { + switch strings.ToLower(s) { + case "add": + case "all": + case "alter": + case "and": + case "any": + case "as": + case "asc": + case "authorization": + case "backup": + case "begin": + case "between": + case "break": + case "browse": + case "bulk": + case "by": + case "cascade": + case "case": + case "check": + case "checkpoint": + case "close": + case "clustered": + case "coalesce": + case "collate": + case "column": + case "commit": + case "compute": + case "constraint": + case "contains": + case "containstable": + case "continue": + case "convert": + case "create": + case "cross": + case "current": + case "current_date": + case "current_time": + case "current_timestamp": + case "current_user": + case "cursor": + case "database": + case "dbcc": + case "deallocate": + case "declare": + case "default": + case "delete": + case "deny": + case "desc": + case "disk": + case "distinct": + case "distributed": + case "double": + case "drop": + case "dump": + case "else": + case "end": + case "errlvl": + case "escape": + case "except": + case "exec": + case "execute": + case "exists": + case "exit": + case "external": + case "fetch": + case "file": + case "fillfactor": + case "for": + case "foreign": + case "freetext": + case "freetexttable": + case "from": + case "full": + case "function": + case "goto": + case "grant": + case "group": + case "having": + case "holdlock": + case "identity": + case "identity_insert": + case "identitycol": + case "if": + case "in": + case "index": + case "inner": + case "insert": + case "intersect": + case "into": + case "is": + case "join": + case "key": + case "kill": + case "left": + case "like": + case "lineno": + case "load": + case "merge": + case "national": + case "nocheck": + case "nonclustered": + case "not": + case "null": + case "nullif": + case "of": + case "off": + case "offsets": + case "on": + case "open": + case "opendatasource": + case "openquery": + case "openrowset": + case "openxml": + case "option": + case "or": + case "order": + case "outer": + case "over": + case "percent": + case "pivot": + case "plan": + case "precision": + case "primary": + case "print": + case "proc": + case "procedure": + case "public": + case "raiserror": + case "read": + case "readtext": + case "reconfigure": + case "references": + case "replication": + case "restore": + case "restrict": + case "return": + case "revert": + case "revoke": + case "right": + case "rollback": + case "rowcount": + case "rowguidcol": + case "rule": + case "save": + case "schema": + case "securityaudit": + case "select": + case "semantickeyphrasetable": + case "semanticsimilaritydetailstable": + case "semanticsimilaritytable": + case "session_user": + case "set": + case "setuser": + case "shutdown": + case "some": + case "statistics": + case "system_user": + case "table": + case "tablesample": + case "textsize": + case "then": + case "to": + case "top": + case "tran": + case "transaction": + case "trigger": + case "truncate": + case "try_convert": + case "tsequal": + case "union": + case "unique": + case "unpivot": + case "update": + case "updatetext": + case "use": + case "user": + case "values": + case "varying": + case "view": + case "waitfor": + case "when": + case "where": + case "while": + case "with": + case "writetext": + default: + return false + } + return true +} diff --git a/internal/engine/mssql/seed.go b/internal/engine/mssql/seed.go new file mode 100644 index 0000000000..7ce732b129 --- /dev/null +++ b/internal/engine/mssql/seed.go @@ -0,0 +1,16 @@ +package mssql + +import ( + "embed" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/seed" +) + +//go:embed dialect +var dialectFS embed.FS + +// Dialect returns the catalog option that seeds SQL Server's type system. +func Dialect() core.Option { + return seed.Dialect(dialectFS, "dialect") +} diff --git a/internal/engine/mssql/utils.go b/internal/engine/mssql/utils.go new file mode 100644 index 0000000000..067566912d --- /dev/null +++ b/internal/engine/mssql/utils.go @@ -0,0 +1,65 @@ +package mssql + +import ( + "log" + "strings" + + tsql "github.com/sqlc-dev/teesql/ast" + + "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/sql/ast" +) + +// fragmented is satisfied by every teesql node via its embedded Fragment. +type fragmented interface { + Frag() *tsql.Fragment +} + +func todo(n tsql.Node) *ast.TODO { + if debug.Active { + log.Printf("mssql.convert: Unknown node type %T\n", n) + } + return &ast.TODO{} +} + +// identifier normalizes an identifier. T-SQL identifiers are +// case-insensitive under the default collations. +func identifier(id string) string { + return strings.ToLower(id) +} + +func NewIdentifier(t string) *ast.String { + return &ast.String{Str: identifier(t)} +} + +func identifierValue(id *tsql.Identifier) string { + if id == nil { + return "" + } + return identifier(id.Value) +} + +// schemaName returns the schema an object name qualifies it with. The "dbo" +// default schema maps to the catalog's default namespace, so it is treated +// as unqualified. +func schemaName(n *tsql.SchemaObjectName) string { + if n == nil || n.SchemaIdentifier == nil { + return "" + } + s := identifier(n.SchemaIdentifier.Value) + if s == "dbo" { + return "" + } + return s +} + +func parseTableName(n *tsql.SchemaObjectName) *ast.TableName { + if n == nil { + return &ast.TableName{} + } + return &ast.TableName{ + Schema: schemaName(n), + Name: identifierValue(n.BaseIdentifier), + } +} + diff --git a/internal/engine/postgresql/analyzer/analyze.go b/internal/engine/postgresql/analyzer/analyze.go index ab34eb348e..c25dd81fe0 100644 --- a/internal/engine/postgresql/analyzer/analyze.go +++ b/internal/engine/postgresql/analyzer/analyze.go @@ -11,28 +11,33 @@ import ( "github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgxpool" - core "github.com/sqlc-dev/sqlc/internal/analyzer" + core "github.com/sqlc-dev/sqlc/internal/analysis" "github.com/sqlc-dev/sqlc/internal/config" - pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" + "github.com/sqlc-dev/sqlc/internal/dbmanager" + "github.com/sqlc-dev/sqlc/internal/shfmt" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/named" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" ) -type Analyzer struct { - db config.Database - client pb.QuickClient - pool *pgxpool.Pool +var debugDatabases = sqlcdebug.New("databases") - formats sync.Map - columns sync.Map - tables sync.Map +type Analyzer struct { + db config.Database + client dbmanager.Client + pool *pgxpool.Pool + replacer *shfmt.Replacer + formats sync.Map + columns sync.Map + tables sync.Map } -func New(client pb.QuickClient, db config.Database) *Analyzer { +func New(client dbmanager.Client, db config.Database) *Analyzer { return &Analyzer{ - db: db, - client: client, + db: db, + client: client, + replacer: shfmt.NewReplacer(nil), } } @@ -101,7 +106,7 @@ func (a *Analyzer) columnInfo(ctx context.Context, field pgconn.FieldDescription if ok { return cinfo.(*pgColumn), nil } - rows, err := a.pool.Query(ctx, columnQuery, field.TableOID, field.TableAttributeNumber) + rows, err := a.pool.Query(ctx, columnQuery, field.TableOID, int16(field.TableAttributeNumber)) if err != nil { return nil, err } @@ -196,7 +201,7 @@ func (a *Analyzer) Analyze(ctx context.Context, n ast.Node, query string, migrat if a.client == nil { return nil, fmt.Errorf("client is nil") } - edb, err := a.client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{ + edb, err := a.client.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{ Engine: "postgresql", Migrations: migrations, }) @@ -204,8 +209,10 @@ func (a *Analyzer) Analyze(ctx context.Context, n ast.Node, query string, migrat return nil, err } uri = edb.Uri + } else if debugDatabases.Value() == "managed" { + return nil, fmt.Errorf("database: connections disabled via SQLCDEBUG=databases=managed") } else { - uri = a.db.URI + uri = a.replacer.Replace(a.db.URI) } conf, err := pgxpool.ParseConfig(uri) if err != nil { @@ -246,18 +253,17 @@ func (a *Analyzer) Analyze(ctx context.Context, n ast.Node, query string, migrat if err != nil { return nil, err } - // TODO: Why are these dims different? - dt, isArray, _ := parseType(col.DataType) + dt, isArray, dims := parseType(col.DataType) notNull := col.NotNull name := field.Name - result.Columns = append(result.Columns, core.Column{ + result.Columns = append(result.Columns, &core.Column{ Name: name, OriginalName: field.Name, DataType: dt, NotNull: notNull, IsArray: isArray, - ArrayDims: col.ArrayDims, - Table: &ast.TableName{ + ArrayDims: int32(max(col.ArrayDims, dims)), + Table: &core.Identifier{ Schema: tbl.SchemaName, Name: tbl.TableName, }, @@ -271,13 +277,13 @@ func (a *Analyzer) Analyze(ctx context.Context, n ast.Node, query string, migrat notNull := false name := field.Name dt, isArray, dims := parseType(dataType) - result.Columns = append(result.Columns, core.Column{ + result.Columns = append(result.Columns, &core.Column{ Name: name, OriginalName: field.Name, DataType: dt, NotNull: notNull, IsArray: isArray, - ArrayDims: dims, + ArrayDims: int32(dims), }) } } @@ -293,13 +299,13 @@ func (a *Analyzer) Analyze(ctx context.Context, n ast.Node, query string, migrat if ps != nil { name, _ = ps.NameFor(i + 1) } - result.Params = append(result.Params, core.Parameter{ - Number: i + 1, + result.Params = append(result.Params, &core.Parameter{ + Number: int32(i + 1), Column: &core.Column{ Name: name, DataType: dt, IsArray: isArray, - ArrayDims: dims, + ArrayDims: int32(dims), NotNull: notNull, }, }) diff --git a/internal/engine/postgresql/catalog.go b/internal/engine/postgresql/catalog.go index 3c262122a2..08049b78f4 100644 --- a/internal/engine/postgresql/catalog.go +++ b/internal/engine/postgresql/catalog.go @@ -1,12 +1,9 @@ package postgresql -import "github.com/sqlc-dev/sqlc/internal/sql/catalog" - -// toPointer converts an int to a pointer without a temporary -// variable at the call-site, and is used by the generated schemas -func toPointer(x int) *int { - return &x -} +import ( + "github.com/sqlc-dev/sqlc/internal/core/seed" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) func NewCatalog() *catalog.Catalog { c := catalog.New("public") @@ -17,3 +14,27 @@ func NewCatalog() *catalog.Catalog { c.LoadExtension = loadExtension return c } + +// genPGCatalog and genInformationSchema build the schemas sqlc knows +// PostgreSQL by. Both read the dialect directory, which goldeneye writes, +// and which the analysis core seeds its catalog from as well. +func genPGCatalog() *catalog.Schema { + return systemSchema("pg_catalog", pgCatalogFuncs()) +} + +func genInformationSchema() *catalog.Schema { + return systemSchema("information_schema", nil) +} + +// systemSchema builds a schema from the relations recorded for it. The tables +// are read fresh each time, because a catalog is free to change the schemas it +// was built with. +func systemSchema(name string, funcs []*catalog.Function) *catalog.Schema { + tables, err := seed.Relations(dialectFS, "dialect", name) + if err != nil { + // The relations are embedded in the binary: a failure here means sqlc + // was built from a broken tree, which no caller can do anything about. + panic(err) + } + return &catalog.Schema{Name: name, Funcs: funcs, Tables: tables} +} diff --git a/internal/engine/postgresql/contrib/adminpack.go b/internal/engine/postgresql/contrib/adminpack.go deleted file mode 100644 index 1e47e12434..0000000000 --- a/internal/engine/postgresql/contrib/adminpack.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsAdminpack = []*catalog.Function{ - { - Name: "pg_file_rename", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_file_rename", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_file_sync", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_file_unlink", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_file_write", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_logdir_ls", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, -} - -func Adminpack() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsAdminpack - return s -} diff --git a/internal/engine/postgresql/contrib/amcheck.go b/internal/engine/postgresql/contrib/amcheck.go deleted file mode 100644 index 156cb43eb7..0000000000 --- a/internal/engine/postgresql/contrib/amcheck.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsAmcheck = []*catalog.Function{ - { - Name: "bt_index_check", - Args: []*catalog.Argument{ - { - Name: "index", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "bt_index_check", - Args: []*catalog.Argument{ - { - Name: "index", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "heapallindexed", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "bt_index_parent_check", - Args: []*catalog.Argument{ - { - Name: "index", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "bt_index_parent_check", - Args: []*catalog.Argument{ - { - Name: "index", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "heapallindexed", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "bt_index_parent_check", - Args: []*catalog.Argument{ - { - Name: "index", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "heapallindexed", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "rootdescend", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "verify_heapam", - Args: []*catalog.Argument{ - { - Name: "relation", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "on_error_stop", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "check_toast", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "skip", - HasDefault: true, - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "startblock", - HasDefault: true, - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "endblock", - HasDefault: true, - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, -} - -func Amcheck() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsAmcheck - return s -} diff --git a/internal/engine/postgresql/contrib/btree_gin.go b/internal/engine/postgresql/contrib/btree_gin.go deleted file mode 100644 index 54a5000a26..0000000000 --- a/internal/engine/postgresql/contrib/btree_gin.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsBtreeGin = []*catalog.Function{ - { - Name: "gin_enum_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "gin_numeric_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, -} - -func BtreeGin() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsBtreeGin - return s -} diff --git a/internal/engine/postgresql/contrib/btree_gist.go b/internal/engine/postgresql/contrib/btree_gist.go deleted file mode 100644 index b5b3ddaf6f..0000000000 --- a/internal/engine/postgresql/contrib/btree_gist.go +++ /dev/null @@ -1,269 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsBtreeGist = []*catalog.Function{ - { - Name: "cash_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "date_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "float4_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float8_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "gbtreekey16_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "gbtreekey16"}, - }, - { - Name: "gbtreekey16_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "gbtreekey16"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "gbtreekey2_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "gbtreekey2"}, - }, - { - Name: "gbtreekey2_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "gbtreekey2"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "gbtreekey32_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "gbtreekey32"}, - }, - { - Name: "gbtreekey32_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "gbtreekey32"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "gbtreekey4_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "gbtreekey4"}, - }, - { - Name: "gbtreekey4_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "gbtreekey4"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "gbtreekey8_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "gbtreekey8"}, - }, - { - Name: "gbtreekey8_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "gbtreekey8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "gbtreekey_var_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "gbtreekey_var"}, - }, - { - Name: "gbtreekey_var_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "gbtreekey_var"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "int2_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int4_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int8_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "interval_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "oid_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "time_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "ts_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "tstz_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, -} - -func BtreeGist() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsBtreeGist - return s -} diff --git a/internal/engine/postgresql/contrib/citext.go b/internal/engine/postgresql/contrib/citext.go deleted file mode 100644 index d5749cacdf..0000000000 --- a/internal/engine/postgresql/contrib/citext.go +++ /dev/null @@ -1,572 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsCitext = []*catalog.Function{ - { - Name: "citext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "citext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "citext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "citext_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "citext_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "citext_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "citext_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "citext_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_pattern_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "citext_pattern_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_pattern_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_pattern_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_pattern_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "citext_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "citextin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "citextout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "citextsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "citext"}, - }, - { - Name: "regexp_match", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_match", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_matches", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_matches", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_split_to_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_split_to_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_split_to_table", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_split_to_table", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "split_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "strpos", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "texticlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "translate", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "citext"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, -} - -func Citext() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsCitext - return s -} diff --git a/internal/engine/postgresql/contrib/cube.go b/internal/engine/postgresql/contrib/cube.go deleted file mode 100644 index cb883db658..0000000000 --- a/internal/engine/postgresql/contrib/cube.go +++ /dev/null @@ -1,395 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsCube = []*catalog.Function{ - { - Name: "cube", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "cube_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_contains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_coord", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cube_coord_llur", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cube_dim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "cube_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cube_enlarge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube_inter", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube_is_point", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_ll_coord", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cube_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "cube_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cube_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "cube_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cube_subset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube_union", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "cube_ur_coord", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "distance_chebyshev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "distance_taxicab", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cube"}, - }, - { - Type: &ast.TypeName{Name: "cube"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, -} - -func Cube() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsCube - return s -} diff --git a/internal/engine/postgresql/contrib/dblink.go b/internal/engine/postgresql/contrib/dblink.go deleted file mode 100644 index b24cd16a52..0000000000 --- a/internal/engine/postgresql/contrib/dblink.go +++ /dev/null @@ -1,505 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsDblink = []*catalog.Function{ - { - Name: "dblink", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_build_sql_delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int2vector"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_build_sql_insert", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int2vector"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_build_sql_update", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "int2vector"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_cancel_query", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_close", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_close", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_close", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_close", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_connect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_connect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_connect_u", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_connect_u", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_current_query", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_disconnect", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_disconnect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_error_message", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_exec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_exec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_exec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_exec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_fdw_validator", - Args: []*catalog.Argument{ - { - Name: "options", - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "catalog", - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "dblink_fetch", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_fetch", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_fetch", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_fetch", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_get_connections", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "dblink_get_notify", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_get_notify", - Args: []*catalog.Argument{ - { - Name: "conname", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_get_pkey", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "dblink_pkey_results"}, - }, - { - Name: "dblink_get_result", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_get_result", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "dblink_is_busy", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "dblink_open", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_open", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_open", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_open", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dblink_send_query", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, -} - -func Dblink() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsDblink - return s -} diff --git a/internal/engine/postgresql/contrib/earthdistance.go b/internal/engine/postgresql/contrib/earthdistance.go deleted file mode 100644 index 5c0bfa7cd5..0000000000 --- a/internal/engine/postgresql/contrib/earthdistance.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsEarthdistance = []*catalog.Function{ - { - Name: "earth", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "earth_box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "earth"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cube"}, - }, - { - Name: "earth_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "earth"}, - }, - { - Type: &ast.TypeName{Name: "earth"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "gc_to_sec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "geo_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "latitude", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "earth"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ll_to_earth", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "earth"}, - }, - { - Name: "longitude", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "earth"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sec_to_gc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, -} - -func Earthdistance() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsEarthdistance - return s -} diff --git a/internal/engine/postgresql/contrib/file_fdw.go b/internal/engine/postgresql/contrib/file_fdw.go deleted file mode 100644 index 36d6db31d5..0000000000 --- a/internal/engine/postgresql/contrib/file_fdw.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsFileFdw = []*catalog.Function{ - { - Name: "file_fdw_handler", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "fdw_handler"}, - }, - { - Name: "file_fdw_validator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, -} - -func FileFdw() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsFileFdw - return s -} diff --git a/internal/engine/postgresql/contrib/fuzzystrmatch.go b/internal/engine/postgresql/contrib/fuzzystrmatch.go deleted file mode 100644 index fcf0ddea83..0000000000 --- a/internal/engine/postgresql/contrib/fuzzystrmatch.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsFuzzystrmatch = []*catalog.Function{ - { - Name: "difference", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "dmetaphone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dmetaphone_alt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "levenshtein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "levenshtein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "levenshtein_less_equal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "levenshtein_less_equal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "metaphone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "soundex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text_soundex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, -} - -func Fuzzystrmatch() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsFuzzystrmatch - return s -} diff --git a/internal/engine/postgresql/contrib/hstore.go b/internal/engine/postgresql/contrib/hstore.go deleted file mode 100644 index 77403f1913..0000000000 --- a/internal/engine/postgresql/contrib/hstore.go +++ /dev/null @@ -1,522 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsHstore = []*catalog.Function{ - { - Name: "akeys", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "avals", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "defined", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "each", - Args: []*catalog.Argument{ - { - Name: "hs", - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "exist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "exists_all", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "exists_any", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "fetchval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ghstore_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ghstore"}, - }, - { - Name: "ghstore_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ghstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "hs_concat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "hs_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hs_contains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hstore", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "hstore", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "hstore", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "hstore", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "hstore_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hstore_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hstore_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hstore_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hstore_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hstore_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hstore_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "hstore_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hstore_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hstore_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hstore_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "hstore_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "hstore_to_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "hstore_to_json", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "hstore_to_json_loose", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "hstore_to_jsonb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "hstore_to_jsonb_loose", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "hstore_to_matrix", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "hstore_version_diag", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "isdefined", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isexists", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "populate_record", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "skeys", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "slice", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, - { - Name: "slice_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "svals", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "hstore"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "tconvert", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "hstore"}, - }, -} - -func Hstore() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsHstore - return s -} diff --git a/internal/engine/postgresql/contrib/intagg.go b/internal/engine/postgresql/contrib/intagg.go deleted file mode 100644 index a1c1b83c33..0000000000 --- a/internal/engine/postgresql/contrib/intagg.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsIntagg = []*catalog.Function{ - { - Name: "int_array_aggregate", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "int_array_enum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, -} - -func Intagg() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsIntagg - return s -} diff --git a/internal/engine/postgresql/contrib/intarray.go b/internal/engine/postgresql/contrib/intarray.go deleted file mode 100644 index 24005a8bc1..0000000000 --- a/internal/engine/postgresql/contrib/intarray.go +++ /dev/null @@ -1,335 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsIntarray = []*catalog.Function{ - { - Name: "_int_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_int_contains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_int_different", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_int_inter", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "_int_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_int_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_int_union", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "_intbig_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "intbig_gkey"}, - }, - { - Name: "_intbig_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "intbig_gkey"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "boolop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "query_int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bqarr_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "query_int"}, - }, - { - Name: "bqarr_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "query_int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "icount", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "idx", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "intarray_del_elem", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "intarray_push_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "intarray_push_elem", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "intset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "intset_subtract", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "intset_union_elem", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "querytree", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "query_int"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "rboolop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "query_int"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "sort", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "sort", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "sort_asc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "sort_desc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "subarray", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "subarray", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "uniq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, -} - -func Intarray() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsIntarray - return s -} diff --git a/internal/engine/postgresql/contrib/isn.go b/internal/engine/postgresql/contrib/isn.go deleted file mode 100644 index 98220a434a..0000000000 --- a/internal/engine/postgresql/contrib/isn.go +++ /dev/null @@ -1,2806 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsIsn = []*catalog.Function{ - { - Name: "btean13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btean13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btean13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btean13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btean13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btean13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btean13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btean13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btisbn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btisbn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btisbn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btisbncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btisbncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btisbncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btismn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btismn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btismn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btismncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btismncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btismncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btissn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btissn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btissn13cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btissncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btissncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btissncmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btupccmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btupccmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "ean13_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ean13"}, - }, - { - Name: "ean13_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "ean13_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "ean13_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "ean13_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "hashean13", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashisbn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashisbn13", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashismn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashismn13", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashissn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashissn13", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashupc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "is_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "is_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "is_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "is_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "is_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "is_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "is_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "is_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isbn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "isbn"}, - }, - { - Name: "isbn13", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "isbn13"}, - }, - { - Name: "isbn13_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "isbn13"}, - }, - { - Name: "isbn_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "isbn"}, - }, - { - Name: "ismn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ismn"}, - }, - { - Name: "ismn13", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ismn13"}, - }, - { - Name: "ismn13_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ismn13"}, - }, - { - Name: "ismn_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ismn"}, - }, - { - Name: "isn_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "isn_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "isn_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "isn_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "isn_weak", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isn_weak", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isngt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isnne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "issn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "issn"}, - }, - { - Name: "issn13", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "issn13"}, - }, - { - Name: "issn13_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "issn13"}, - }, - { - Name: "issn_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "issn"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ean13"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "isbn"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "isbn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "isbn13"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ismn"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ismn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ismn13"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "issn"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "issn13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "issn13"}, - }, - { - Name: "make_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "upc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "upc"}, - }, - { - Name: "upc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ean13"}, - }, - }, - ReturnType: &ast.TypeName{Name: "upc"}, - }, - { - Name: "upc_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "upc"}, - }, -} - -func Isn() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsIsn - return s -} diff --git a/internal/engine/postgresql/contrib/lo.go b/internal/engine/postgresql/contrib/lo.go deleted file mode 100644 index 1e6869c1d6..0000000000 --- a/internal/engine/postgresql/contrib/lo.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsLo = []*catalog.Function{ - { - Name: "lo_manage", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "lo_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lo"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, -} - -func Lo() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsLo - return s -} diff --git a/internal/engine/postgresql/contrib/ltree.go b/internal/engine/postgresql/contrib/ltree.go deleted file mode 100644 index d149aee058..0000000000 --- a/internal/engine/postgresql/contrib/ltree.go +++ /dev/null @@ -1,752 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsLtree = []*catalog.Function{ - { - Name: "_lt_q_regex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "lquery[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_lt_q_rregex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lquery[]"}, - }, - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_ltq_extract_regex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "lquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "_ltq_regex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "lquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_ltq_rregex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lquery"}, - }, - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_ltree_extract_isparent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "_ltree_extract_risparent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "_ltree_isparent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_ltree_r_isparent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_ltree_r_risparent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_ltree_risparent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_ltxtq_exec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "ltxtquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "_ltxtq_extract_exec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - { - Type: &ast.TypeName{Name: "ltxtquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "_ltxtq_rexec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltxtquery"}, - }, - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "index", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "index", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lca", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "lca", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "lca", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "lca", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "lca", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "lca", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "lca", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "lca", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "lquery_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "lquery"}, - }, - { - Name: "lquery_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "lquery_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "lt_q_regex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "lquery[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lt_q_rregex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lquery[]"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltq_regex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "lquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltq_rregex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lquery"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree2text", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ltree_addltree", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "ltree_addtext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "ltree_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "ltree_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree_gist_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree_gist"}, - }, - { - Name: "ltree_gist_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree_gist"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "ltree_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "ltree_isparent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "ltree_risparent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltree_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "ltree_textadd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "ltxtq_exec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "ltxtquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltxtq_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltxtquery"}, - }, - { - Name: "ltxtq_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltxtquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "ltxtq_rexec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltxtquery"}, - }, - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltxtq_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltxtquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "nlevel", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "subltree", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "subpath", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "subpath", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "ltree"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, - { - Name: "text2ltree", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "ltree"}, - }, -} - -func Ltree() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsLtree - return s -} diff --git a/internal/engine/postgresql/contrib/pageinspect.go b/internal/engine/postgresql/contrib/pageinspect.go deleted file mode 100644 index 5a733eec2e..0000000000 --- a/internal/engine/postgresql/contrib/pageinspect.go +++ /dev/null @@ -1,400 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPageinspect = []*catalog.Function{ - { - Name: "brin_metapage_info", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "brin_page_items", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "index_oid", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "brin_page_type", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "brin_revmap_data", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "bt_metap", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "bt_page_items", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "bt_page_items", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "blkno", - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "bt_page_stats", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "blkno", - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "fsm_page_contents", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "get_raw_page", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "get_raw_page", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "gin_leafpage_items", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "gin_metapage_info", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "gin_page_opaque_info", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "gist_page_items", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "index_oid", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "gist_page_items_bytea", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "gist_page_opaque_info", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "hash_bitmap_info", - Args: []*catalog.Argument{ - { - Name: "index_oid", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "blkno", - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "hash_metapage_info", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "hash_page_items", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "hash_page_stats", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "hash_page_type", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "heap_page_item_attrs", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "rel_oid", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "heap_page_item_attrs", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "rel_oid", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "do_detoast", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "heap_page_items", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "heap_tuple_infomask_flags", - Args: []*catalog.Argument{ - { - Name: "t_infomask", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "t_infomask2", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "page_checksum", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "blkno", - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "page_header", - Args: []*catalog.Argument{ - { - Name: "page", - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "tuple_data_split", - Args: []*catalog.Argument{ - { - Name: "rel_oid", - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "t_data", - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "t_infomask", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "t_infomask2", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "t_bits", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea[]"}, - }, - { - Name: "tuple_data_split", - Args: []*catalog.Argument{ - { - Name: "rel_oid", - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "t_data", - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "t_infomask", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "t_infomask2", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "t_bits", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "do_detoast", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea[]"}, - }, -} - -func Pageinspect() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPageinspect - return s -} diff --git a/internal/engine/postgresql/contrib/pg_buffercache.go b/internal/engine/postgresql/contrib/pg_buffercache.go deleted file mode 100644 index 8f10545121..0000000000 --- a/internal/engine/postgresql/contrib/pg_buffercache.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgBuffercache = []*catalog.Function{ - { - Name: "pg_buffercache_pages", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, -} - -func PgBuffercache() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgBuffercache - return s -} diff --git a/internal/engine/postgresql/contrib/pg_freespacemap.go b/internal/engine/postgresql/contrib/pg_freespacemap.go deleted file mode 100644 index 02aed8630e..0000000000 --- a/internal/engine/postgresql/contrib/pg_freespacemap.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgFreespacemap = []*catalog.Function{ - { - Name: "pg_freespace", - Args: []*catalog.Argument{ - { - Name: "rel", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_freespace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, -} - -func PgFreespacemap() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgFreespacemap - return s -} diff --git a/internal/engine/postgresql/contrib/pg_prewarm.go b/internal/engine/postgresql/contrib/pg_prewarm.go deleted file mode 100644 index 4fbd8910aa..0000000000 --- a/internal/engine/postgresql/contrib/pg_prewarm.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgPrewarm = []*catalog.Function{ - { - Name: "autoprewarm_dump_now", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "autoprewarm_start_worker", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_prewarm", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "mode", - HasDefault: true, - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "fork", - HasDefault: true, - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "first_block", - HasDefault: true, - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "last_block", - HasDefault: true, - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, -} - -func PgPrewarm() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgPrewarm - return s -} diff --git a/internal/engine/postgresql/contrib/pg_stat_statements.go b/internal/engine/postgresql/contrib/pg_stat_statements.go deleted file mode 100644 index a0c5fc73d7..0000000000 --- a/internal/engine/postgresql/contrib/pg_stat_statements.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgStatStatements = []*catalog.Function{ - { - Name: "pg_stat_statements", - Args: []*catalog.Argument{ - { - Name: "showtext", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_statements_info", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_statements_reset", - Args: []*catalog.Argument{ - { - Name: "userid", - HasDefault: true, - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "dbid", - HasDefault: true, - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "queryid", - HasDefault: true, - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, -} - -func PgStatStatements() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgStatStatements - return s -} diff --git a/internal/engine/postgresql/contrib/pg_trgm.go b/internal/engine/postgresql/contrib/pg_trgm.go deleted file mode 100644 index 92639009eb..0000000000 --- a/internal/engine/postgresql/contrib/pg_trgm.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgTrgm = []*catalog.Function{ - { - Name: "gtrgm_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "gtrgm"}, - }, - { - Name: "gtrgm_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "gtrgm"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "set_limit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "show_limit", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "show_trgm", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "similarity", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "similarity_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "similarity_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "strict_word_similarity", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "strict_word_similarity_commutator_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "strict_word_similarity_dist_commutator_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "strict_word_similarity_dist_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "strict_word_similarity_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "word_similarity", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "word_similarity_commutator_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "word_similarity_dist_commutator_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "word_similarity_dist_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "word_similarity_op", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, -} - -func PgTrgm() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgTrgm - return s -} diff --git a/internal/engine/postgresql/contrib/pg_visibility.go b/internal/engine/postgresql/contrib/pg_visibility.go deleted file mode 100644 index f546ad0f12..0000000000 --- a/internal/engine/postgresql/contrib/pg_visibility.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgVisibility = []*catalog.Function{ - { - Name: "pg_check_frozen", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "pg_check_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "pg_truncate_visibility_map", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_visibility", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_visibility", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "blkno", - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_visibility_map", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_visibility_map", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "blkno", - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_visibility_map_summary", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, -} - -func PgVisibility() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgVisibility - return s -} diff --git a/internal/engine/postgresql/contrib/pgcrypto.go b/internal/engine/postgresql/contrib/pgcrypto.go deleted file mode 100644 index ef1fc073bc..0000000000 --- a/internal/engine/postgresql/contrib/pgcrypto.go +++ /dev/null @@ -1,482 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgcrypto = []*catalog.Function{ - { - Name: "armor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "armor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "crypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "dearmor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "decrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "decrypt_iv", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "digest", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "digest", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "encrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "encrypt_iv", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "gen_random_bytes", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "gen_salt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "gen_salt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "hmac", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "hmac", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_armor_headers", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pgp_key_id", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pgp_pub_decrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pgp_pub_decrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pgp_pub_decrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pgp_pub_decrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_pub_decrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_pub_decrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_pub_encrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_pub_encrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_pub_encrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_pub_encrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_sym_decrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pgp_sym_decrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pgp_sym_decrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_sym_decrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_sym_encrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_sym_encrypt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_sym_encrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pgp_sym_encrypt_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, -} - -func Pgcrypto() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgcrypto - return s -} diff --git a/internal/engine/postgresql/contrib/pgrowlocks.go b/internal/engine/postgresql/contrib/pgrowlocks.go deleted file mode 100644 index 1bd8af0163..0000000000 --- a/internal/engine/postgresql/contrib/pgrowlocks.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgrowlocks = []*catalog.Function{ - { - Name: "pgrowlocks", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, -} - -func Pgrowlocks() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgrowlocks - return s -} diff --git a/internal/engine/postgresql/contrib/pgstattuple.go b/internal/engine/postgresql/contrib/pgstattuple.go deleted file mode 100644 index 4ac5b18345..0000000000 --- a/internal/engine/postgresql/contrib/pgstattuple.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPgstattuple = []*catalog.Function{ - { - Name: "pg_relpages", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_relpages", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pgstatginindex", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pgstathashindex", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pgstatindex", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pgstatindex", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pgstattuple", - Args: []*catalog.Argument{ - { - Name: "reloid", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pgstattuple", - Args: []*catalog.Argument{ - { - Name: "relname", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pgstattuple_approx", - Args: []*catalog.Argument{ - { - Name: "reloid", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, -} - -func Pgstattuple() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPgstattuple - return s -} diff --git a/internal/engine/postgresql/contrib/postgres_fdw.go b/internal/engine/postgresql/contrib/postgres_fdw.go deleted file mode 100644 index cf8d9746ff..0000000000 --- a/internal/engine/postgresql/contrib/postgres_fdw.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsPostgresFdw = []*catalog.Function{ - { - Name: "postgres_fdw_disconnect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "postgres_fdw_disconnect_all", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "postgres_fdw_get_connections", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "postgres_fdw_handler", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "fdw_handler"}, - }, - { - Name: "postgres_fdw_validator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, -} - -func PostgresFdw() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsPostgresFdw - return s -} diff --git a/internal/engine/postgresql/contrib/seg.go b/internal/engine/postgresql/contrib/seg.go deleted file mode 100644 index 20de65a1ef..0000000000 --- a/internal/engine/postgresql/contrib/seg.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsSeg = []*catalog.Function{ - { - Name: "seg_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "seg_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "seg_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_contains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_different", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "seg"}, - }, - { - Name: "seg_inter", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "seg"}, - }, - { - Name: "seg_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_lower", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "seg_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "seg_over_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_over_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "seg_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "seg_union", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "seg"}, - }, - { - Name: "seg_upper", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "seg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, -} - -func Seg() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsSeg - return s -} diff --git a/internal/engine/postgresql/contrib/sslinfo.go b/internal/engine/postgresql/contrib/sslinfo.go deleted file mode 100644 index b7327d0a3f..0000000000 --- a/internal/engine/postgresql/contrib/sslinfo.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsSslinfo = []*catalog.Function{ - { - Name: "ssl_cipher", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ssl_client_cert_present", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ssl_client_dn", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ssl_client_dn_field", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ssl_client_serial", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "ssl_extension_info", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "ssl_is_used", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ssl_issuer_dn", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ssl_issuer_field", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ssl_version", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, -} - -func Sslinfo() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsSslinfo - return s -} diff --git a/internal/engine/postgresql/contrib/tablefunc.go b/internal/engine/postgresql/contrib/tablefunc.go deleted file mode 100644 index 611a36ed19..0000000000 --- a/internal/engine/postgresql/contrib/tablefunc.go +++ /dev/null @@ -1,188 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsTablefunc = []*catalog.Function{ - { - Name: "connectby", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "connectby", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "connectby", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "connectby", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "crosstab", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "crosstab", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "crosstab", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "crosstab2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tablefunc_crosstab_2"}, - }, - { - Name: "crosstab3", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tablefunc_crosstab_3"}, - }, - { - Name: "crosstab4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tablefunc_crosstab_4"}, - }, - { - Name: "normal_rand", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, -} - -func Tablefunc() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsTablefunc - return s -} diff --git a/internal/engine/postgresql/contrib/tcn.go b/internal/engine/postgresql/contrib/tcn.go deleted file mode 100644 index 6a227216aa..0000000000 --- a/internal/engine/postgresql/contrib/tcn.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsTcn = []*catalog.Function{ - { - Name: "triggered_change_notification", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, -} - -func Tcn() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsTcn - return s -} diff --git a/internal/engine/postgresql/contrib/unaccent.go b/internal/engine/postgresql/contrib/unaccent.go deleted file mode 100644 index 07e2e1ae9a..0000000000 --- a/internal/engine/postgresql/contrib/unaccent.go +++ /dev/null @@ -1,38 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsUnaccent = []*catalog.Function{ - { - Name: "unaccent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regdictionary"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "unaccent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, -} - -func Unaccent() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsUnaccent - return s -} diff --git a/internal/engine/postgresql/contrib/uuid_ossp.go b/internal/engine/postgresql/contrib/uuid_ossp.go deleted file mode 100644 index 1703e323a2..0000000000 --- a/internal/engine/postgresql/contrib/uuid_ossp.go +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsUuidOssp = []*catalog.Function{ - { - Name: "uuid_generate_v1", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_generate_v1mc", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_generate_v3", - Args: []*catalog.Argument{ - { - Name: "namespace", - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_generate_v4", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_generate_v5", - Args: []*catalog.Argument{ - { - Name: "namespace", - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_nil", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_ns_dns", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_ns_oid", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_ns_url", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_ns_x500", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, -} - -func UuidOssp() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsUuidOssp - return s -} diff --git a/internal/engine/postgresql/contrib/xml2.go b/internal/engine/postgresql/contrib/xml2.go deleted file mode 100644 index 6fac3f04b9..0000000000 --- a/internal/engine/postgresql/contrib/xml2.go +++ /dev/null @@ -1,191 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package contrib - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsXml2 = []*catalog.Function{ - { - Name: "xml_encode_special_chars", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "xml_valid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xpath_bool", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xpath_list", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "xpath_list", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "xpath_nodeset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "xpath_nodeset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "xpath_nodeset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "xpath_number", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "xpath_string", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "xpath_table", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "xslt_process", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "xslt_process", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, -} - -func Xml2() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsXml2 - return s -} diff --git a/internal/engine/postgresql/convert.go b/internal/engine/postgresql/convert.go index 38a5e62a26..586ebd7291 100644 --- a/internal/engine/postgresql/convert.go +++ b/internal/engine/postgresql/convert.go @@ -1,12 +1,9 @@ -//go:build !windows && cgo -// +build !windows,cgo - package postgresql import ( "fmt" - pg "github.com/pganalyze/pg_query_go/v4" + pg "github.com/sqlc-dev/oliphant" "github.com/sqlc-dev/sqlc/internal/sql/ast" ) @@ -186,7 +183,6 @@ func convertAggref(n *pg.Aggref) *ast.Aggref { Aggtype: ast.Oid(n.Aggtype), Aggcollid: ast.Oid(n.Aggcollid), Inputcollid: ast.Oid(n.Inputcollid), - Aggtranstype: ast.Oid(n.Aggtranstype), Aggargtypes: convertSlice(n.Aggargtypes), Aggdirectargs: convertSlice(n.Aggdirectargs), Args: convertSlice(n.Args), @@ -1422,15 +1418,36 @@ func convertDeleteStmt(n *pg.DeleteStmt) *ast.DeleteStmt { if n == nil { return nil } + oldAlias, newAlias := convertReturningOptions(n.ReturningClause) return &ast.DeleteStmt{ Relations: &ast.List{ Items: []ast.Node{convertRangeVar(n.Relation)}, }, - UsingClause: convertSlice(n.UsingClause), - WhereClause: convertNode(n.WhereClause), - ReturningList: convertSlice(n.ReturningList), - WithClause: convertWithClause(n.WithClause), + UsingClause: convertSlice(n.UsingClause), + WhereClause: convertNode(n.WhereClause), + ReturningList: convertSlice(n.ReturningClause.GetExprs()), + ReturningOldAlias: oldAlias, + ReturningNewAlias: newAlias, + WithClause: convertWithClause(n.WithClause), + } +} + +// convertReturningOptions extracts the aliases assigned to the OLD and NEW +// rows by a PostgreSQL 18 RETURNING WITH (...) option list. +func convertReturningOptions(n *pg.ReturningClause) (oldAlias, newAlias string) { + for _, option := range n.GetOptions() { + ro := option.GetReturningOption() + if ro == nil { + continue + } + switch ro.Option { + case pg.ReturningOptionKind_RETURNING_OPTION_OLD: + oldAlias = ro.Value + case pg.ReturningOptionKind_RETURNING_OPTION_NEW: + newAlias = ro.Value + } } + return oldAlias, newAlias } func convertDiscardStmt(n *pg.DiscardStmt) *ast.DiscardStmt { @@ -1666,7 +1683,6 @@ func convertGrantRoleStmt(n *pg.GrantRoleStmt) *ast.GrantRoleStmt { GrantedRoles: convertSlice(n.GrantedRoles), GranteeRoles: convertSlice(n.GranteeRoles), IsGrant: n.IsGrant, - AdminOpt: n.AdminOpt, Grantor: convertRoleSpec(n.Grantor), Behavior: ast.DropBehavior(n.Behavior), } @@ -1696,7 +1712,6 @@ func convertGroupingFunc(n *pg.GroupingFunc) *ast.GroupingFunc { Xpr: convertNode(n.Xpr), Args: convertSlice(n.Args), Refs: convertSlice(n.Refs), - Cols: convertSlice(n.Cols), Agglevelsup: ast.Index(n.Agglevelsup), Location: int(n.Location), } @@ -1757,7 +1772,6 @@ func convertIndexStmt(n *pg.IndexStmt) *ast.IndexStmt { ExcludeOpNames: convertSlice(n.ExcludeOpNames), Idxcomment: makeString(n.Idxcomment), IndexOid: ast.Oid(n.IndexOid), - OldNode: ast.Oid(n.OldNode), Unique: n.Unique, Primary: n.Primary, Isconstraint: n.Isconstraint, @@ -1808,14 +1822,17 @@ func convertInsertStmt(n *pg.InsertStmt) *ast.InsertStmt { if n == nil { return nil } + oldAlias, newAlias := convertReturningOptions(n.ReturningClause) return &ast.InsertStmt{ - Relation: convertRangeVar(n.Relation), - Cols: convertSlice(n.Cols), - SelectStmt: convertNode(n.SelectStmt), - OnConflictClause: convertOnConflictClause(n.OnConflictClause), - ReturningList: convertSlice(n.ReturningList), - WithClause: convertWithClause(n.WithClause), - Override: ast.OverridingKind(n.Override), + Relation: convertRangeVar(n.Relation), + Cols: convertSlice(n.Cols), + SelectStmt: convertNode(n.SelectStmt), + OnConflictClause: convertOnConflictClause(n.OnConflictClause), + ReturningList: convertSlice(n.ReturningClause.GetExprs()), + ReturningOldAlias: oldAlias, + ReturningNewAlias: newAlias, + WithClause: convertWithClause(n.WithClause), + Override: ast.OverridingKind(n.Override), } } @@ -1832,13 +1849,17 @@ func convertIntoClause(n *pg.IntoClause) *ast.IntoClause { if n == nil { return nil } + var viewQuery ast.Node = &ast.TODO{} + if n.ViewQuery != nil { + viewQuery = convertQuery(n.ViewQuery) + } return &ast.IntoClause{ Rel: convertRangeVar(n.Rel), ColNames: convertSlice(n.ColNames), Options: convertSlice(n.Options), OnCommit: ast.OnCommitAction(n.OnCommit), TableSpaceName: makeString(n.TableSpaceName), - ViewQuery: convertNode(n.ViewQuery), + ViewQuery: viewQuery, SkipData: n.SkipData, } } @@ -1847,8 +1868,16 @@ func convertJoinExpr(n *pg.JoinExpr) *ast.JoinExpr { if n == nil { return nil } + jointype := ast.JoinType(n.Jointype) + // PostgreSQL parses CROSS JOIN as an inner join with no condition — + // the only inner join its grammar allows without one — so that shape + // is CROSS JOIN, and must print as it: a bare JOIN with no ON or + // USING is a syntax error in PostgreSQL. + if jointype == ast.JoinTypeInner && !n.IsNatural && n.Quals == nil && len(n.UsingClause) == 0 { + jointype = ast.JoinTypeCross + } return &ast.JoinExpr{ - Jointype: ast.JoinType(n.Jointype), + Jointype: jointype, IsNatural: n.IsNatural, Larg: convertNode(n.Larg), Rarg: convertNode(n.Rarg), @@ -1972,6 +2001,22 @@ func convertNullTest(n *pg.NullTest) *ast.NullTest { } } +func convertNullIfExpr(n *pg.NullIfExpr) *ast.NullIfExpr { + if n == nil { + return nil + } + return &ast.NullIfExpr{ + Xpr: convertNode(n.Xpr), + Opno: ast.Oid(n.Opno), + Opresulttype: ast.Oid(n.Opresulttype), + Opretset: n.Opretset, + Opcollid: ast.Oid(n.Opcollid), + Inputcollid: ast.Oid(n.Inputcollid), + Args: convertSlice(n.Args), + Location: int(n.Location), + } +} + func convertObjectWithArgs(n *pg.ObjectWithArgs) *ast.ObjectWithArgs { if n == nil { return nil @@ -2019,7 +2064,6 @@ func convertOpExpr(n *pg.OpExpr) *ast.OpExpr { return &ast.OpExpr{ Xpr: convertNode(n.Xpr), Opno: ast.Oid(n.Opno), - Opfuncid: ast.Oid(n.Opfuncid), Opresulttype: ast.Oid(n.Opresulttype), Opretset: n.Opretset, Opcollid: ast.Oid(n.Opcollid), @@ -2111,7 +2155,7 @@ func convertPartitionSpec(n *pg.PartitionSpec) *ast.PartitionSpec { return nil } return &ast.PartitionSpec{ - Strategy: makeString(n.Strategy), + Strategy: makeString(n.Strategy.String()), PartParams: convertSlice(n.PartParams), Location: int(n.Location), } @@ -2269,11 +2313,6 @@ func convertRangeTblEntry(n *pg.RangeTblEntry) *ast.RangeTblEntry { Lateral: n.Lateral, Inh: n.Inh, InFromCl: n.InFromCl, - RequiredPerms: ast.AclMode(n.RequiredPerms), - CheckAsUser: ast.Oid(n.CheckAsUser), - SelectedCols: makeUint32Slice(n.SelectedCols), - InsertedCols: makeUint32Slice(n.InsertedCols), - UpdatedCols: makeUint32Slice(n.UpdatedCols), SecurityQuals: convertSlice(n.SecurityQuals), } } @@ -2431,7 +2470,7 @@ func convertRowCompareExpr(n *pg.RowCompareExpr) *ast.RowCompareExpr { } return &ast.RowCompareExpr{ Xpr: convertNode(n.Xpr), - Rctype: ast.RowCompareType(n.Rctype), + Rctype: ast.RowCompareType(n.Cmptype), Opnos: convertSlice(n.Opnos), Opfamilies: convertSlice(n.Opfamilies), Inputcollids: convertSlice(n.Inputcollids), @@ -2501,7 +2540,6 @@ func convertScalarArrayOpExpr(n *pg.ScalarArrayOpExpr) *ast.ScalarArrayOpExpr { return &ast.ScalarArrayOpExpr{ Xpr: convertNode(n.Xpr), Opno: ast.Oid(n.Opno), - Opfuncid: ast.Oid(n.Opfuncid), UseOr: n.UseOr, Inputcollid: ast.Oid(n.Inputcollid), Args: convertSlice(n.Args), @@ -2773,7 +2811,7 @@ func convertTypeName(n *pg.TypeName) *ast.TypeName { if n == nil { return nil } - return &ast.TypeName{ + out := &ast.TypeName{ Names: convertSlice(n.Names), TypeOid: ast.Oid(n.TypeOid), Setof: n.Setof, @@ -2783,6 +2821,43 @@ func convertTypeName(n *pg.TypeName) *ast.TypeName { ArrayBounds: convertSlice(n.ArrayBounds), Location: int(n.Location), } + decodeIntervalTypmods(out) + return out +} + +// decodeIntervalTypmods turns the field mask an interval's first type +// modifier carries — what the parser reports for CAST(x AS interval day to +// second) — into the words format_type prints, as a column definition's +// type does; the full range is dropped. +func decodeIntervalTypmods(tn *ast.TypeName) { + if tn.Typmods == nil || len(tn.Typmods.Items) == 0 || len(tn.Names.Items) == 0 { + return + } + last, ok := tn.Names.Items[len(tn.Names.Items)-1].(*ast.String) + if !ok || last.Str != "interval" { + return + } + c, ok := tn.Typmods.Items[0].(*ast.A_Const) + if !ok { + return + } + mask, ok := c.Val.(*ast.Integer) + if !ok { + return + } + fields, ok := intervalFields[int32(mask.Ival)] + if !ok { + return + } + rest := tn.Typmods.Items[1:] + if fields != "" { + rest = append([]ast.Node{&ast.String{Str: fields}}, rest...) + } + if len(rest) == 0 { + tn.Typmods = nil + return + } + tn.Typmods = &ast.List{Items: rest} } func convertUnlistenStmt(n *pg.UnlistenStmt) *ast.UnlistenStmt { @@ -2799,15 +2874,18 @@ func convertUpdateStmt(n *pg.UpdateStmt) *ast.UpdateStmt { return nil } + oldAlias, newAlias := convertReturningOptions(n.ReturningClause) return &ast.UpdateStmt{ Relations: &ast.List{ Items: []ast.Node{convertRangeVar(n.Relation)}, }, - TargetList: convertSlice(n.TargetList), - WhereClause: convertNode(n.WhereClause), - FromClause: convertSlice(n.FromClause), - ReturningList: convertSlice(n.ReturningList), - WithClause: convertWithClause(n.WithClause), + TargetList: convertSlice(n.TargetList), + WhereClause: convertNode(n.WhereClause), + FromClause: convertSlice(n.FromClause), + ReturningList: convertSlice(n.ReturningClause.GetExprs()), + ReturningOldAlias: oldAlias, + ReturningNewAlias: newAlias, + WithClause: convertWithClause(n.WithClause), } } @@ -3434,6 +3512,9 @@ func convertNode(node *pg.Node) ast.Node { case *pg.Node_NullTest: return convertNullTest(n.NullTest) + case *pg.Node_NullIfExpr: + return convertNullIfExpr(n.NullIfExpr) + case *pg.Node_ObjectWithArgs: return convertObjectWithArgs(n.ObjectWithArgs) diff --git a/internal/engine/postgresql/dialect/dialect.json b/internal/engine/postgresql/dialect/dialect.json new file mode 100644 index 0000000000..d8ae14185a --- /dev/null +++ b/internal/engine/postgresql/dialect/dialect.json @@ -0,0 +1,15 @@ +{ + "dialect": "postgresql", + "const": { + "integer": "integer", + "float": "numeric", + "string": "text", + "bool": "boolean" + }, + "bool": "boolean", + "comparison": ["=", "<>", "!=", "<", "<=", ">", ">=", "IS DISTINCT FROM", "IS NOT DISTINCT FROM"], + "comparison_categories": "BNSDTU", + "arithmetic": ["+", "-", "*", "/", "%"], + "arithmetic_categories": "N", + "cast_categories": "NSD" +} diff --git a/internal/engine/postgresql/dialect/extensions/adminpack/functions.jsonl b/internal/engine/postgresql/dialect/extensions/adminpack/functions.jsonl new file mode 100644 index 0000000000..2cc6fcad05 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/adminpack/functions.jsonl @@ -0,0 +1,6 @@ +{"name":"pg_file_rename","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_file_rename","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_file_sync","args":[{"type":"text"}],"returns":"void"} +{"name":"pg_file_unlink","args":[{"type":"text"}],"returns":"boolean"} +{"name":"pg_file_write","args":[{"type":"text"},{"type":"text"},{"type":"boolean"}],"returns":"bigint"} +{"name":"pg_logdir_ls","returns":"record"} diff --git a/internal/engine/postgresql/dialect/extensions/amcheck/functions.jsonl b/internal/engine/postgresql/dialect/extensions/amcheck/functions.jsonl new file mode 100644 index 0000000000..c0502f1b65 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/amcheck/functions.jsonl @@ -0,0 +1,6 @@ +{"name":"bt_index_check","args":[{"name":"index","type":"regclass"}],"returns":"void"} +{"name":"bt_index_check","args":[{"name":"index","type":"regclass"},{"name":"heapallindexed","type":"boolean"}],"returns":"void"} +{"name":"bt_index_parent_check","args":[{"name":"index","type":"regclass"}],"returns":"void"} +{"name":"bt_index_parent_check","args":[{"name":"index","type":"regclass"},{"name":"heapallindexed","type":"boolean"}],"returns":"void"} +{"name":"bt_index_parent_check","args":[{"name":"index","type":"regclass"},{"name":"heapallindexed","type":"boolean"},{"name":"rootdescend","type":"boolean"}],"returns":"void"} +{"name":"verify_heapam","args":[{"name":"relation","type":"regclass"},{"name":"on_error_stop","type":"boolean","has_default":true},{"name":"check_toast","type":"boolean","has_default":true},{"name":"skip","type":"text","has_default":true},{"name":"startblock","type":"bigint","has_default":true},{"name":"endblock","type":"bigint","has_default":true}],"returns":"record"} diff --git a/internal/engine/postgresql/dialect/extensions/btree_gin/functions.jsonl b/internal/engine/postgresql/dialect/extensions/btree_gin/functions.jsonl new file mode 100644 index 0000000000..4145ef35a7 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/btree_gin/functions.jsonl @@ -0,0 +1,2 @@ +{"name":"gin_enum_cmp","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"integer"} +{"name":"gin_numeric_cmp","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"integer"} diff --git a/internal/engine/postgresql/dialect/extensions/btree_gist/functions.jsonl b/internal/engine/postgresql/dialect/extensions/btree_gist/functions.jsonl new file mode 100644 index 0000000000..f160e6656c --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/btree_gist/functions.jsonl @@ -0,0 +1,24 @@ +{"name":"cash_dist","args":[{"type":"money"},{"type":"money"}],"returns":"money"} +{"name":"date_dist","args":[{"type":"date"},{"type":"date"}],"returns":"integer"} +{"name":"float4_dist","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"float8_dist","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"gbtreekey16_in","args":[{"type":"cstring"}],"returns":"gbtreekey16"} +{"name":"gbtreekey16_out","args":[{"type":"gbtreekey16"}],"returns":"cstring"} +{"name":"gbtreekey2_in","args":[{"type":"cstring"}],"returns":"gbtreekey2"} +{"name":"gbtreekey2_out","args":[{"type":"gbtreekey2"}],"returns":"cstring"} +{"name":"gbtreekey32_in","args":[{"type":"cstring"}],"returns":"gbtreekey32"} +{"name":"gbtreekey32_out","args":[{"type":"gbtreekey32"}],"returns":"cstring"} +{"name":"gbtreekey4_in","args":[{"type":"cstring"}],"returns":"gbtreekey4"} +{"name":"gbtreekey4_out","args":[{"type":"gbtreekey4"}],"returns":"cstring"} +{"name":"gbtreekey8_in","args":[{"type":"cstring"}],"returns":"gbtreekey8"} +{"name":"gbtreekey8_out","args":[{"type":"gbtreekey8"}],"returns":"cstring"} +{"name":"gbtreekey_var_in","args":[{"type":"cstring"}],"returns":"gbtreekey_var"} +{"name":"gbtreekey_var_out","args":[{"type":"gbtreekey_var"}],"returns":"cstring"} +{"name":"int2_dist","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int4_dist","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int8_dist","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"interval_dist","args":[{"type":"interval"},{"type":"interval"}],"returns":"interval"} +{"name":"oid_dist","args":[{"type":"oid"},{"type":"oid"}],"returns":"oid"} +{"name":"time_dist","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"interval"} +{"name":"ts_dist","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"interval"} +{"name":"tstz_dist","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"interval"} diff --git a/internal/engine/postgresql/dialect/extensions/btree_gist/types.jsonl b/internal/engine/postgresql/dialect/extensions/btree_gist/types.jsonl new file mode 100644 index 0000000000..63d38cda28 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/btree_gist/types.jsonl @@ -0,0 +1,6 @@ +{"name":"gbtreekey4","category":"U"} +{"name":"gbtreekey8","category":"U"} +{"name":"gbtreekey16","category":"U"} +{"name":"gbtreekey32","category":"U"} +{"name":"gbtreekey_var","category":"U"} +{"name":"gbtreekey2","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/citext/functions.jsonl b/internal/engine/postgresql/dialect/extensions/citext/functions.jsonl new file mode 100644 index 0000000000..38ab953edc --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/citext/functions.jsonl @@ -0,0 +1,46 @@ +{"name":"citext","args":[{"type":"boolean"}],"returns":"citext"} +{"name":"citext","args":[{"type":"character"}],"returns":"citext"} +{"name":"citext","args":[{"type":"inet"}],"returns":"citext"} +{"name":"citext_cmp","args":[{"type":"citext"},{"type":"citext"}],"returns":"integer"} +{"name":"citext_eq","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_ge","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_gt","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_hash","args":[{"type":"citext"}],"returns":"integer"} +{"name":"citext_hash_extended","args":[{"type":"citext"},{"type":"bigint"}],"returns":"bigint"} +{"name":"citext_larger","args":[{"type":"citext"},{"type":"citext"}],"returns":"citext"} +{"name":"citext_le","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_lt","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_ne","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_pattern_cmp","args":[{"type":"citext"},{"type":"citext"}],"returns":"integer"} +{"name":"citext_pattern_ge","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_pattern_gt","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_pattern_le","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_pattern_lt","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"citext_smaller","args":[{"type":"citext"},{"type":"citext"}],"returns":"citext"} +{"name":"citextin","args":[{"type":"cstring"}],"returns":"citext"} +{"name":"citextout","args":[{"type":"citext"}],"returns":"cstring"} +{"name":"citextsend","args":[{"type":"citext"}],"returns":"bytea"} +{"name":"max","args":[{"type":"citext"}],"returns":"citext"} +{"name":"min","args":[{"type":"citext"}],"returns":"citext"} +{"name":"regexp_match","args":[{"type":"citext"},{"type":"citext"}],"returns":"text[]"} +{"name":"regexp_match","args":[{"type":"citext"},{"type":"citext"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_matches","args":[{"type":"citext"},{"type":"citext"}],"returns":"text[]"} +{"name":"regexp_matches","args":[{"type":"citext"},{"type":"citext"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_replace","args":[{"type":"citext"},{"type":"citext"},{"type":"text"}],"returns":"text"} +{"name":"regexp_replace","args":[{"type":"citext"},{"type":"citext"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"regexp_split_to_array","args":[{"type":"citext"},{"type":"citext"}],"returns":"text[]"} +{"name":"regexp_split_to_array","args":[{"type":"citext"},{"type":"citext"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_split_to_table","args":[{"type":"citext"},{"type":"citext"}],"returns":"text"} +{"name":"regexp_split_to_table","args":[{"type":"citext"},{"type":"citext"},{"type":"text"}],"returns":"text"} +{"name":"replace","args":[{"type":"citext"},{"type":"citext"},{"type":"citext"}],"returns":"text"} +{"name":"split_part","args":[{"type":"citext"},{"type":"citext"},{"type":"integer"}],"returns":"text"} +{"name":"strpos","args":[{"type":"citext"},{"type":"citext"}],"returns":"integer"} +{"name":"texticlike","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"texticlike","args":[{"type":"citext"},{"type":"text"}],"returns":"boolean"} +{"name":"texticnlike","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"texticnlike","args":[{"type":"citext"},{"type":"text"}],"returns":"boolean"} +{"name":"texticregexeq","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"texticregexeq","args":[{"type":"citext"},{"type":"text"}],"returns":"boolean"} +{"name":"texticregexne","args":[{"type":"citext"},{"type":"citext"}],"returns":"boolean"} +{"name":"texticregexne","args":[{"type":"citext"},{"type":"text"}],"returns":"boolean"} +{"name":"translate","args":[{"type":"citext"},{"type":"citext"},{"type":"text"}],"returns":"text"} diff --git a/internal/engine/postgresql/dialect/extensions/citext/types.jsonl b/internal/engine/postgresql/dialect/extensions/citext/types.jsonl new file mode 100644 index 0000000000..ec2056cff8 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/citext/types.jsonl @@ -0,0 +1 @@ +{"name":"citext","category":"S"} diff --git a/internal/engine/postgresql/dialect/extensions/cube/functions.jsonl b/internal/engine/postgresql/dialect/extensions/cube/functions.jsonl new file mode 100644 index 0000000000..662689d0bc --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/cube/functions.jsonl @@ -0,0 +1,33 @@ +{"name":"cube","args":[{"type":"cube"},{"type":"double precision"}],"returns":"cube"} +{"name":"cube","args":[{"type":"cube"},{"type":"double precision"},{"type":"double precision"}],"returns":"cube"} +{"name":"cube","args":[{"type":"double precision"}],"returns":"cube"} +{"name":"cube","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"cube"} +{"name":"cube","args":[{"type":"double precision[]"}],"returns":"cube"} +{"name":"cube","args":[{"type":"double precision[]"},{"type":"double precision[]"}],"returns":"cube"} +{"name":"cube_cmp","args":[{"type":"cube"},{"type":"cube"}],"returns":"integer"} +{"name":"cube_contained","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_contains","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_coord","args":[{"type":"cube"},{"type":"integer"}],"returns":"double precision"} +{"name":"cube_coord_llur","args":[{"type":"cube"},{"type":"integer"}],"returns":"double precision"} +{"name":"cube_dim","args":[{"type":"cube"}],"returns":"integer"} +{"name":"cube_distance","args":[{"type":"cube"},{"type":"cube"}],"returns":"double precision"} +{"name":"cube_enlarge","args":[{"type":"cube"},{"type":"double precision"},{"type":"integer"}],"returns":"cube"} +{"name":"cube_eq","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_ge","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_gt","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_in","args":[{"type":"cstring"}],"returns":"cube"} +{"name":"cube_inter","args":[{"type":"cube"},{"type":"cube"}],"returns":"cube"} +{"name":"cube_is_point","args":[{"type":"cube"}],"returns":"boolean"} +{"name":"cube_le","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_ll_coord","args":[{"type":"cube"},{"type":"integer"}],"returns":"double precision"} +{"name":"cube_lt","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_ne","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_out","args":[{"type":"cube"}],"returns":"cstring"} +{"name":"cube_overlap","args":[{"type":"cube"},{"type":"cube"}],"returns":"boolean"} +{"name":"cube_send","args":[{"type":"cube"}],"returns":"bytea"} +{"name":"cube_size","args":[{"type":"cube"}],"returns":"double precision"} +{"name":"cube_subset","args":[{"type":"cube"},{"type":"integer[]"}],"returns":"cube"} +{"name":"cube_union","args":[{"type":"cube"},{"type":"cube"}],"returns":"cube"} +{"name":"cube_ur_coord","args":[{"type":"cube"},{"type":"integer"}],"returns":"double precision"} +{"name":"distance_chebyshev","args":[{"type":"cube"},{"type":"cube"}],"returns":"double precision"} +{"name":"distance_taxicab","args":[{"type":"cube"},{"type":"cube"}],"returns":"double precision"} diff --git a/internal/engine/postgresql/dialect/extensions/cube/types.jsonl b/internal/engine/postgresql/dialect/extensions/cube/types.jsonl new file mode 100644 index 0000000000..128600a5d3 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/cube/types.jsonl @@ -0,0 +1 @@ +{"name":"cube","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/dblink/functions.jsonl b/internal/engine/postgresql/dialect/extensions/dblink/functions.jsonl new file mode 100644 index 0000000000..1e6518b26f --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/dblink/functions.jsonl @@ -0,0 +1,41 @@ +{"name":"dblink","args":[{"type":"text"}],"returns":"record"} +{"name":"dblink","args":[{"type":"text"},{"type":"boolean"}],"returns":"record"} +{"name":"dblink","args":[{"type":"text"},{"type":"text"}],"returns":"record"} +{"name":"dblink","args":[{"type":"text"},{"type":"text"},{"type":"boolean"}],"returns":"record"} +{"name":"dblink_build_sql_delete","args":[{"type":"text"},{"type":"int2vector"},{"type":"integer"},{"type":"text[]"}],"returns":"text"} +{"name":"dblink_build_sql_insert","args":[{"type":"text"},{"type":"int2vector"},{"type":"integer"},{"type":"text[]"},{"type":"text[]"}],"returns":"text"} +{"name":"dblink_build_sql_update","args":[{"type":"text"},{"type":"int2vector"},{"type":"integer"},{"type":"text[]"},{"type":"text[]"}],"returns":"text"} +{"name":"dblink_cancel_query","args":[{"type":"text"}],"returns":"text"} +{"name":"dblink_close","args":[{"type":"text"}],"returns":"text"} +{"name":"dblink_close","args":[{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"dblink_close","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"dblink_close","args":[{"type":"text"},{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"dblink_connect","args":[{"type":"text"}],"returns":"text"} +{"name":"dblink_connect","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"dblink_connect_u","args":[{"type":"text"}],"returns":"text"} +{"name":"dblink_connect_u","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"dblink_current_query","returns":"text"} +{"name":"dblink_disconnect","returns":"text"} +{"name":"dblink_disconnect","args":[{"type":"text"}],"returns":"text"} +{"name":"dblink_error_message","args":[{"type":"text"}],"returns":"text"} +{"name":"dblink_exec","args":[{"type":"text"}],"returns":"text"} +{"name":"dblink_exec","args":[{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"dblink_exec","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"dblink_exec","args":[{"type":"text"},{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"dblink_fdw_validator","args":[{"name":"options","type":"text[]"},{"name":"catalog","type":"oid"}],"returns":"void"} +{"name":"dblink_fetch","args":[{"type":"text"},{"type":"integer"}],"returns":"record"} +{"name":"dblink_fetch","args":[{"type":"text"},{"type":"integer"},{"type":"boolean"}],"returns":"record"} +{"name":"dblink_fetch","args":[{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"record"} +{"name":"dblink_fetch","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"boolean"}],"returns":"record"} +{"name":"dblink_get_connections","returns":"text[]"} +{"name":"dblink_get_notify","returns":"record"} +{"name":"dblink_get_notify","args":[{"name":"conname","type":"text"}],"returns":"record"} +{"name":"dblink_get_pkey","args":[{"type":"text"}],"returns":"dblink_pkey_results"} +{"name":"dblink_get_result","args":[{"type":"text"}],"returns":"record"} +{"name":"dblink_get_result","args":[{"type":"text"},{"type":"boolean"}],"returns":"record"} +{"name":"dblink_is_busy","args":[{"type":"text"}],"returns":"integer"} +{"name":"dblink_open","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"dblink_open","args":[{"type":"text"},{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"dblink_open","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"dblink_open","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"dblink_send_query","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} diff --git a/internal/engine/postgresql/dialect/extensions/dblink/types.jsonl b/internal/engine/postgresql/dialect/extensions/dblink/types.jsonl new file mode 100644 index 0000000000..cf267d5fe2 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/dblink/types.jsonl @@ -0,0 +1 @@ +{"name":"dblink_pkey_results","category":"C"} diff --git a/internal/engine/postgresql/dialect/extensions/earthdistance/functions.jsonl b/internal/engine/postgresql/dialect/extensions/earthdistance/functions.jsonl new file mode 100644 index 0000000000..c2159f50a1 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/earthdistance/functions.jsonl @@ -0,0 +1,9 @@ +{"name":"earth","returns":"double precision"} +{"name":"earth_box","args":[{"type":"earth"},{"type":"double precision"}],"returns":"cube"} +{"name":"earth_distance","args":[{"type":"earth"},{"type":"earth"}],"returns":"double precision"} +{"name":"gc_to_sec","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"geo_distance","args":[{"type":"point"},{"type":"point"}],"returns":"double precision"} +{"name":"latitude","args":[{"type":"earth"}],"returns":"double precision"} +{"name":"ll_to_earth","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"earth"} +{"name":"longitude","args":[{"type":"earth"}],"returns":"double precision"} +{"name":"sec_to_gc","args":[{"type":"double precision"}],"returns":"double precision"} diff --git a/internal/engine/postgresql/dialect/extensions/earthdistance/types.jsonl b/internal/engine/postgresql/dialect/extensions/earthdistance/types.jsonl new file mode 100644 index 0000000000..49893bb34f --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/earthdistance/types.jsonl @@ -0,0 +1 @@ +{"name":"earth","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/file_fdw/functions.jsonl b/internal/engine/postgresql/dialect/extensions/file_fdw/functions.jsonl new file mode 100644 index 0000000000..7232d0d010 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/file_fdw/functions.jsonl @@ -0,0 +1,2 @@ +{"name":"file_fdw_handler","returns":"fdw_handler"} +{"name":"file_fdw_validator","args":[{"type":"text[]"},{"type":"oid"}],"returns":"void"} diff --git a/internal/engine/postgresql/dialect/extensions/fuzzystrmatch/functions.jsonl b/internal/engine/postgresql/dialect/extensions/fuzzystrmatch/functions.jsonl new file mode 100644 index 0000000000..b6e46b4b83 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/fuzzystrmatch/functions.jsonl @@ -0,0 +1,11 @@ +{"name":"daitch_mokotoff","args":[{"type":"text"}],"returns":"text[]"} +{"name":"difference","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"dmetaphone","args":[{"type":"text"}],"returns":"text"} +{"name":"dmetaphone_alt","args":[{"type":"text"}],"returns":"text"} +{"name":"levenshtein","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"levenshtein","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"levenshtein_less_equal","args":[{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"integer"} +{"name":"levenshtein_less_equal","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"},{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"metaphone","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"soundex","args":[{"type":"text"}],"returns":"text"} +{"name":"text_soundex","args":[{"type":"text"}],"returns":"text"} diff --git a/internal/engine/postgresql/dialect/extensions/hstore/functions.jsonl b/internal/engine/postgresql/dialect/extensions/hstore/functions.jsonl new file mode 100644 index 0000000000..4bb9f7a117 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/hstore/functions.jsonl @@ -0,0 +1,47 @@ +{"name":"akeys","args":[{"type":"hstore"}],"returns":"text[]"} +{"name":"avals","args":[{"type":"hstore"}],"returns":"text[]"} +{"name":"defined","args":[{"type":"hstore"},{"type":"text"}],"returns":"boolean"} +{"name":"delete","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"hstore"} +{"name":"delete","args":[{"type":"hstore"},{"type":"text"}],"returns":"hstore"} +{"name":"delete","args":[{"type":"hstore"},{"type":"text[]"}],"returns":"hstore"} +{"name":"each","args":[{"name":"hs","type":"hstore"}],"returns":"record"} +{"name":"exist","args":[{"type":"hstore"},{"type":"text"}],"returns":"boolean"} +{"name":"exists_all","args":[{"type":"hstore"},{"type":"text[]"}],"returns":"boolean"} +{"name":"exists_any","args":[{"type":"hstore"},{"type":"text[]"}],"returns":"boolean"} +{"name":"fetchval","args":[{"type":"hstore"},{"type":"text"}],"returns":"text"} +{"name":"ghstore_in","args":[{"type":"cstring"}],"returns":"ghstore"} +{"name":"ghstore_out","args":[{"type":"ghstore"}],"returns":"cstring"} +{"name":"hs_concat","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"hstore"} +{"name":"hs_contained","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"boolean"} +{"name":"hs_contains","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"boolean"} +{"name":"hstore","args":[{"type":"record"}],"returns":"hstore"} +{"name":"hstore","args":[{"type":"text"},{"type":"text"}],"returns":"hstore"} +{"name":"hstore","args":[{"type":"text[]"}],"returns":"hstore"} +{"name":"hstore","args":[{"type":"text[]"},{"type":"text[]"}],"returns":"hstore"} +{"name":"hstore_cmp","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"integer"} +{"name":"hstore_eq","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"boolean"} +{"name":"hstore_ge","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"boolean"} +{"name":"hstore_gt","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"boolean"} +{"name":"hstore_hash","args":[{"type":"hstore"}],"returns":"integer"} +{"name":"hstore_hash_extended","args":[{"type":"hstore"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hstore_in","args":[{"type":"cstring"}],"returns":"hstore"} +{"name":"hstore_le","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"boolean"} +{"name":"hstore_lt","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"boolean"} +{"name":"hstore_ne","args":[{"type":"hstore"},{"type":"hstore"}],"returns":"boolean"} +{"name":"hstore_out","args":[{"type":"hstore"}],"returns":"cstring"} +{"name":"hstore_send","args":[{"type":"hstore"}],"returns":"bytea"} +{"name":"hstore_to_array","args":[{"type":"hstore"}],"returns":"text[]"} +{"name":"hstore_to_json","args":[{"type":"hstore"}],"returns":"json"} +{"name":"hstore_to_json_loose","args":[{"type":"hstore"}],"returns":"json"} +{"name":"hstore_to_jsonb","args":[{"type":"hstore"}],"returns":"jsonb"} +{"name":"hstore_to_jsonb_loose","args":[{"type":"hstore"}],"returns":"jsonb"} +{"name":"hstore_to_matrix","args":[{"type":"hstore"}],"returns":"text[]"} +{"name":"hstore_version_diag","args":[{"type":"hstore"}],"returns":"integer"} +{"name":"isdefined","args":[{"type":"hstore"},{"type":"text"}],"returns":"boolean"} +{"name":"isexists","args":[{"type":"hstore"},{"type":"text"}],"returns":"boolean"} +{"name":"populate_record","args":[{"type":"anyelement"},{"type":"hstore"}],"returns":"anyelement"} +{"name":"skeys","args":[{"type":"hstore"}],"returns":"text"} +{"name":"slice","args":[{"type":"hstore"},{"type":"text[]"}],"returns":"hstore"} +{"name":"slice_array","args":[{"type":"hstore"},{"type":"text[]"}],"returns":"text[]"} +{"name":"svals","args":[{"type":"hstore"}],"returns":"text"} +{"name":"tconvert","args":[{"type":"text"},{"type":"text"}],"returns":"hstore"} diff --git a/internal/engine/postgresql/dialect/extensions/hstore/types.jsonl b/internal/engine/postgresql/dialect/extensions/hstore/types.jsonl new file mode 100644 index 0000000000..9329a0b12c --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/hstore/types.jsonl @@ -0,0 +1,2 @@ +{"name":"hstore","category":"U"} +{"name":"ghstore","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/intagg/functions.jsonl b/internal/engine/postgresql/dialect/extensions/intagg/functions.jsonl new file mode 100644 index 0000000000..98ac268e7e --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/intagg/functions.jsonl @@ -0,0 +1,2 @@ +{"name":"int_array_aggregate","args":[{"type":"integer"}],"returns":"integer[]"} +{"name":"int_array_enum","args":[{"type":"integer[]"}],"returns":"integer"} diff --git a/internal/engine/postgresql/dialect/extensions/intarray/functions.jsonl b/internal/engine/postgresql/dialect/extensions/intarray/functions.jsonl new file mode 100644 index 0000000000..2374c690db --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/intarray/functions.jsonl @@ -0,0 +1,29 @@ +{"name":"_int_contained","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"boolean"} +{"name":"_int_contains","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"boolean"} +{"name":"_int_different","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"boolean"} +{"name":"_int_inter","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"integer[]"} +{"name":"_int_overlap","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"boolean"} +{"name":"_int_same","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"boolean"} +{"name":"_int_union","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"integer[]"} +{"name":"_intbig_in","args":[{"type":"cstring"}],"returns":"intbig_gkey"} +{"name":"_intbig_out","args":[{"type":"intbig_gkey"}],"returns":"cstring"} +{"name":"boolop","args":[{"type":"integer[]"},{"type":"query_int"}],"returns":"boolean"} +{"name":"bqarr_in","args":[{"type":"cstring"}],"returns":"query_int"} +{"name":"bqarr_out","args":[{"type":"query_int"}],"returns":"cstring"} +{"name":"icount","args":[{"type":"integer[]"}],"returns":"integer"} +{"name":"idx","args":[{"type":"integer[]"},{"type":"integer"}],"returns":"integer"} +{"name":"intarray_del_elem","args":[{"type":"integer[]"},{"type":"integer"}],"returns":"integer[]"} +{"name":"intarray_push_array","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"integer[]"} +{"name":"intarray_push_elem","args":[{"type":"integer[]"},{"type":"integer"}],"returns":"integer[]"} +{"name":"intset","args":[{"type":"integer"}],"returns":"integer[]"} +{"name":"intset_subtract","args":[{"type":"integer[]"},{"type":"integer[]"}],"returns":"integer[]"} +{"name":"intset_union_elem","args":[{"type":"integer[]"},{"type":"integer"}],"returns":"integer[]"} +{"name":"querytree","args":[{"type":"query_int"}],"returns":"text"} +{"name":"rboolop","args":[{"type":"query_int"},{"type":"integer[]"}],"returns":"boolean"} +{"name":"sort","args":[{"type":"integer[]"}],"returns":"integer[]"} +{"name":"sort","args":[{"type":"integer[]"},{"type":"text"}],"returns":"integer[]"} +{"name":"sort_asc","args":[{"type":"integer[]"}],"returns":"integer[]"} +{"name":"sort_desc","args":[{"type":"integer[]"}],"returns":"integer[]"} +{"name":"subarray","args":[{"type":"integer[]"},{"type":"integer"}],"returns":"integer[]"} +{"name":"subarray","args":[{"type":"integer[]"},{"type":"integer"},{"type":"integer"}],"returns":"integer[]"} +{"name":"uniq","args":[{"type":"integer[]"}],"returns":"integer[]"} diff --git a/internal/engine/postgresql/dialect/extensions/intarray/types.jsonl b/internal/engine/postgresql/dialect/extensions/intarray/types.jsonl new file mode 100644 index 0000000000..fd41d4dc73 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/intarray/types.jsonl @@ -0,0 +1,2 @@ +{"name":"query_int","category":"U"} +{"name":"intbig_gkey","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/isn/functions.jsonl b/internal/engine/postgresql/dialect/extensions/isn/functions.jsonl new file mode 100644 index 0000000000..1b5d123cf4 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/isn/functions.jsonl @@ -0,0 +1,245 @@ +{"name":"btean13cmp","args":[{"type":"ean13"},{"type":"ean13"}],"returns":"integer"} +{"name":"btean13cmp","args":[{"type":"ean13"},{"type":"isbn"}],"returns":"integer"} +{"name":"btean13cmp","args":[{"type":"ean13"},{"type":"isbn13"}],"returns":"integer"} +{"name":"btean13cmp","args":[{"type":"ean13"},{"type":"ismn"}],"returns":"integer"} +{"name":"btean13cmp","args":[{"type":"ean13"},{"type":"ismn13"}],"returns":"integer"} +{"name":"btean13cmp","args":[{"type":"ean13"},{"type":"issn"}],"returns":"integer"} +{"name":"btean13cmp","args":[{"type":"ean13"},{"type":"issn13"}],"returns":"integer"} +{"name":"btean13cmp","args":[{"type":"ean13"},{"type":"upc"}],"returns":"integer"} +{"name":"btisbn13cmp","args":[{"type":"isbn13"},{"type":"ean13"}],"returns":"integer"} +{"name":"btisbn13cmp","args":[{"type":"isbn13"},{"type":"isbn"}],"returns":"integer"} +{"name":"btisbn13cmp","args":[{"type":"isbn13"},{"type":"isbn13"}],"returns":"integer"} +{"name":"btisbncmp","args":[{"type":"isbn"},{"type":"ean13"}],"returns":"integer"} +{"name":"btisbncmp","args":[{"type":"isbn"},{"type":"isbn"}],"returns":"integer"} +{"name":"btisbncmp","args":[{"type":"isbn"},{"type":"isbn13"}],"returns":"integer"} +{"name":"btismn13cmp","args":[{"type":"ismn13"},{"type":"ean13"}],"returns":"integer"} +{"name":"btismn13cmp","args":[{"type":"ismn13"},{"type":"ismn"}],"returns":"integer"} +{"name":"btismn13cmp","args":[{"type":"ismn13"},{"type":"ismn13"}],"returns":"integer"} +{"name":"btismncmp","args":[{"type":"ismn"},{"type":"ean13"}],"returns":"integer"} +{"name":"btismncmp","args":[{"type":"ismn"},{"type":"ismn"}],"returns":"integer"} +{"name":"btismncmp","args":[{"type":"ismn"},{"type":"ismn13"}],"returns":"integer"} +{"name":"btissn13cmp","args":[{"type":"issn13"},{"type":"ean13"}],"returns":"integer"} +{"name":"btissn13cmp","args":[{"type":"issn13"},{"type":"issn"}],"returns":"integer"} +{"name":"btissn13cmp","args":[{"type":"issn13"},{"type":"issn13"}],"returns":"integer"} +{"name":"btissncmp","args":[{"type":"issn"},{"type":"ean13"}],"returns":"integer"} +{"name":"btissncmp","args":[{"type":"issn"},{"type":"issn"}],"returns":"integer"} +{"name":"btissncmp","args":[{"type":"issn"},{"type":"issn13"}],"returns":"integer"} +{"name":"btupccmp","args":[{"type":"upc"},{"type":"ean13"}],"returns":"integer"} +{"name":"btupccmp","args":[{"type":"upc"},{"type":"upc"}],"returns":"integer"} +{"name":"ean13_in","args":[{"type":"cstring"}],"returns":"ean13"} +{"name":"ean13_out","args":[{"type":"ean13"}],"returns":"cstring"} +{"name":"ean13_out","args":[{"type":"isbn13"}],"returns":"cstring"} +{"name":"ean13_out","args":[{"type":"ismn13"}],"returns":"cstring"} +{"name":"ean13_out","args":[{"type":"issn13"}],"returns":"cstring"} +{"name":"hashean13","args":[{"type":"ean13"}],"returns":"integer"} +{"name":"hashisbn","args":[{"type":"isbn"}],"returns":"integer"} +{"name":"hashisbn13","args":[{"type":"isbn13"}],"returns":"integer"} +{"name":"hashismn","args":[{"type":"ismn"}],"returns":"integer"} +{"name":"hashismn13","args":[{"type":"ismn13"}],"returns":"integer"} +{"name":"hashissn","args":[{"type":"issn"}],"returns":"integer"} +{"name":"hashissn13","args":[{"type":"issn13"}],"returns":"integer"} +{"name":"hashupc","args":[{"type":"upc"}],"returns":"integer"} +{"name":"is_valid","args":[{"type":"ean13"}],"returns":"boolean"} +{"name":"is_valid","args":[{"type":"isbn"}],"returns":"boolean"} +{"name":"is_valid","args":[{"type":"isbn13"}],"returns":"boolean"} +{"name":"is_valid","args":[{"type":"ismn"}],"returns":"boolean"} +{"name":"is_valid","args":[{"type":"ismn13"}],"returns":"boolean"} +{"name":"is_valid","args":[{"type":"issn"}],"returns":"boolean"} +{"name":"is_valid","args":[{"type":"issn13"}],"returns":"boolean"} +{"name":"is_valid","args":[{"type":"upc"}],"returns":"boolean"} +{"name":"isbn","args":[{"type":"ean13"}],"returns":"isbn"} +{"name":"isbn13","args":[{"type":"ean13"}],"returns":"isbn13"} +{"name":"isbn13_in","args":[{"type":"cstring"}],"returns":"isbn13"} +{"name":"isbn_in","args":[{"type":"cstring"}],"returns":"isbn"} +{"name":"ismn","args":[{"type":"ean13"}],"returns":"ismn"} +{"name":"ismn13","args":[{"type":"ean13"}],"returns":"ismn13"} +{"name":"ismn13_in","args":[{"type":"cstring"}],"returns":"ismn13"} +{"name":"ismn_in","args":[{"type":"cstring"}],"returns":"ismn"} +{"name":"isn_out","args":[{"type":"isbn"}],"returns":"cstring"} +{"name":"isn_out","args":[{"type":"ismn"}],"returns":"cstring"} +{"name":"isn_out","args":[{"type":"issn"}],"returns":"cstring"} +{"name":"isn_out","args":[{"type":"upc"}],"returns":"cstring"} +{"name":"isn_weak","returns":"boolean"} +{"name":"isn_weak","args":[{"type":"boolean"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ean13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ean13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ean13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ean13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ean13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ean13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ean13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ean13"},{"type":"upc"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"isbn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"isbn"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"isbn"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"isbn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"isbn13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"isbn13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ismn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ismn"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ismn"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ismn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ismn13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"ismn13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"issn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"issn"},{"type":"issn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"issn"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"issn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"issn13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"issn13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"upc"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isneq","args":[{"type":"upc"},{"type":"upc"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ean13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ean13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ean13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ean13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ean13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ean13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ean13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ean13"},{"type":"upc"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"isbn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"isbn"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"isbn"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"isbn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"isbn13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"isbn13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ismn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ismn"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ismn"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ismn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ismn13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"ismn13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"issn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"issn"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"issn"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"issn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"issn13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"issn13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"upc"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnge","args":[{"type":"upc"},{"type":"upc"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ean13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ean13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ean13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ean13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ean13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ean13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ean13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ean13"},{"type":"upc"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"isbn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"isbn"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"isbn"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"isbn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"isbn13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"isbn13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ismn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ismn"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ismn"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ismn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ismn13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"ismn13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"issn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"issn"},{"type":"issn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"issn"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"issn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"issn13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"issn13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"upc"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isngt","args":[{"type":"upc"},{"type":"upc"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ean13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ean13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ean13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ean13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ean13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ean13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ean13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ean13"},{"type":"upc"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"isbn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"isbn"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"isbn"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"isbn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"isbn13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"isbn13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ismn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ismn"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ismn"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ismn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ismn13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"ismn13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"issn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"issn"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"issn"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"issn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"issn13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"issn13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"upc"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnle","args":[{"type":"upc"},{"type":"upc"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ean13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ean13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ean13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ean13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ean13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ean13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ean13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ean13"},{"type":"upc"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"isbn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"isbn"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"isbn"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"isbn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"isbn13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"isbn13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ismn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ismn"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ismn"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ismn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ismn13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"ismn13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"issn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"issn"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"issn"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"issn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"issn13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"issn13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"upc"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnlt","args":[{"type":"upc"},{"type":"upc"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ean13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ean13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ean13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ean13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ean13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ean13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ean13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ean13"},{"type":"upc"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"isbn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"isbn"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"isbn"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"isbn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"isbn13"},{"type":"isbn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"isbn13"},{"type":"isbn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ismn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ismn"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ismn"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ismn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ismn13"},{"type":"ismn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"ismn13"},{"type":"ismn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"issn"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"issn"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"issn"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"issn13"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"issn13"},{"type":"issn"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"issn13"},{"type":"issn13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"upc"},{"type":"ean13"}],"returns":"boolean"} +{"name":"isnne","args":[{"type":"upc"},{"type":"upc"}],"returns":"boolean"} +{"name":"issn","args":[{"type":"ean13"}],"returns":"issn"} +{"name":"issn13","args":[{"type":"ean13"}],"returns":"issn13"} +{"name":"issn13_in","args":[{"type":"cstring"}],"returns":"issn13"} +{"name":"issn_in","args":[{"type":"cstring"}],"returns":"issn"} +{"name":"make_valid","args":[{"type":"ean13"}],"returns":"ean13"} +{"name":"make_valid","args":[{"type":"isbn"}],"returns":"isbn"} +{"name":"make_valid","args":[{"type":"isbn13"}],"returns":"isbn13"} +{"name":"make_valid","args":[{"type":"ismn"}],"returns":"ismn"} +{"name":"make_valid","args":[{"type":"ismn13"}],"returns":"ismn13"} +{"name":"make_valid","args":[{"type":"issn"}],"returns":"issn"} +{"name":"make_valid","args":[{"type":"issn13"}],"returns":"issn13"} +{"name":"make_valid","args":[{"type":"upc"}],"returns":"upc"} +{"name":"upc","args":[{"type":"ean13"}],"returns":"upc"} +{"name":"upc_in","args":[{"type":"cstring"}],"returns":"upc"} diff --git a/internal/engine/postgresql/dialect/extensions/isn/types.jsonl b/internal/engine/postgresql/dialect/extensions/isn/types.jsonl new file mode 100644 index 0000000000..83539d1a2a --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/isn/types.jsonl @@ -0,0 +1,8 @@ +{"name":"ean13","category":"U"} +{"name":"isbn13","category":"U"} +{"name":"ismn13","category":"U"} +{"name":"issn13","category":"U"} +{"name":"isbn","category":"U"} +{"name":"ismn","category":"U"} +{"name":"issn","category":"U"} +{"name":"upc","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/lo/functions.jsonl b/internal/engine/postgresql/dialect/extensions/lo/functions.jsonl new file mode 100644 index 0000000000..f6f0f2b717 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/lo/functions.jsonl @@ -0,0 +1,2 @@ +{"name":"lo_manage","returns":"trigger"} +{"name":"lo_oid","args":[{"type":"lo"}],"returns":"oid"} diff --git a/internal/engine/postgresql/dialect/extensions/lo/types.jsonl b/internal/engine/postgresql/dialect/extensions/lo/types.jsonl new file mode 100644 index 0000000000..c28ad45401 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/lo/types.jsonl @@ -0,0 +1 @@ +{"name":"lo","category":"N"} diff --git a/internal/engine/postgresql/dialect/extensions/ltree/functions.jsonl b/internal/engine/postgresql/dialect/extensions/ltree/functions.jsonl new file mode 100644 index 0000000000..3f237ee9ee --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/ltree/functions.jsonl @@ -0,0 +1,59 @@ +{"name":"_lt_q_regex","args":[{"type":"ltree[]"},{"type":"lquery[]"}],"returns":"boolean"} +{"name":"_lt_q_rregex","args":[{"type":"lquery[]"},{"type":"ltree[]"}],"returns":"boolean"} +{"name":"_ltq_extract_regex","args":[{"type":"ltree[]"},{"type":"lquery"}],"returns":"ltree"} +{"name":"_ltq_regex","args":[{"type":"ltree[]"},{"type":"lquery"}],"returns":"boolean"} +{"name":"_ltq_rregex","args":[{"type":"lquery"},{"type":"ltree[]"}],"returns":"boolean"} +{"name":"_ltree_extract_isparent","args":[{"type":"ltree[]"},{"type":"ltree"}],"returns":"ltree"} +{"name":"_ltree_extract_risparent","args":[{"type":"ltree[]"},{"type":"ltree"}],"returns":"ltree"} +{"name":"_ltree_isparent","args":[{"type":"ltree[]"},{"type":"ltree"}],"returns":"boolean"} +{"name":"_ltree_r_isparent","args":[{"type":"ltree"},{"type":"ltree[]"}],"returns":"boolean"} +{"name":"_ltree_r_risparent","args":[{"type":"ltree"},{"type":"ltree[]"}],"returns":"boolean"} +{"name":"_ltree_risparent","args":[{"type":"ltree[]"},{"type":"ltree"}],"returns":"boolean"} +{"name":"_ltxtq_exec","args":[{"type":"ltree[]"},{"type":"ltxtquery"}],"returns":"boolean"} +{"name":"_ltxtq_extract_exec","args":[{"type":"ltree[]"},{"type":"ltxtquery"}],"returns":"ltree"} +{"name":"_ltxtq_rexec","args":[{"type":"ltxtquery"},{"type":"ltree[]"}],"returns":"boolean"} +{"name":"index","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"integer"} +{"name":"index","args":[{"type":"ltree"},{"type":"ltree"},{"type":"integer"}],"returns":"integer"} +{"name":"lca","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"ltree"} +{"name":"lca","args":[{"type":"ltree"},{"type":"ltree"},{"type":"ltree"}],"returns":"ltree"} +{"name":"lca","args":[{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"}],"returns":"ltree"} +{"name":"lca","args":[{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"}],"returns":"ltree"} +{"name":"lca","args":[{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"}],"returns":"ltree"} +{"name":"lca","args":[{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"}],"returns":"ltree"} +{"name":"lca","args":[{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"},{"type":"ltree"}],"returns":"ltree"} +{"name":"lca","args":[{"type":"ltree[]"}],"returns":"ltree"} +{"name":"lquery_in","args":[{"type":"cstring"}],"returns":"lquery"} +{"name":"lquery_out","args":[{"type":"lquery"}],"returns":"cstring"} +{"name":"lquery_send","args":[{"type":"lquery"}],"returns":"bytea"} +{"name":"lt_q_regex","args":[{"type":"ltree"},{"type":"lquery[]"}],"returns":"boolean"} +{"name":"lt_q_rregex","args":[{"type":"lquery[]"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltq_regex","args":[{"type":"ltree"},{"type":"lquery"}],"returns":"boolean"} +{"name":"ltq_rregex","args":[{"type":"lquery"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree2text","args":[{"type":"ltree"}],"returns":"text"} +{"name":"ltree_addltree","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"ltree"} +{"name":"ltree_addtext","args":[{"type":"ltree"},{"type":"text"}],"returns":"ltree"} +{"name":"ltree_cmp","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"integer"} +{"name":"ltree_eq","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree_ge","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree_gist_in","args":[{"type":"cstring"}],"returns":"ltree_gist"} +{"name":"ltree_gist_out","args":[{"type":"ltree_gist"}],"returns":"cstring"} +{"name":"ltree_gt","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree_in","args":[{"type":"cstring"}],"returns":"ltree"} +{"name":"ltree_isparent","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree_le","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree_lt","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree_ne","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree_out","args":[{"type":"ltree"}],"returns":"cstring"} +{"name":"ltree_risparent","args":[{"type":"ltree"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltree_send","args":[{"type":"ltree"}],"returns":"bytea"} +{"name":"ltree_textadd","args":[{"type":"text"},{"type":"ltree"}],"returns":"ltree"} +{"name":"ltxtq_exec","args":[{"type":"ltree"},{"type":"ltxtquery"}],"returns":"boolean"} +{"name":"ltxtq_in","args":[{"type":"cstring"}],"returns":"ltxtquery"} +{"name":"ltxtq_out","args":[{"type":"ltxtquery"}],"returns":"cstring"} +{"name":"ltxtq_rexec","args":[{"type":"ltxtquery"},{"type":"ltree"}],"returns":"boolean"} +{"name":"ltxtq_send","args":[{"type":"ltxtquery"}],"returns":"bytea"} +{"name":"nlevel","args":[{"type":"ltree"}],"returns":"integer"} +{"name":"subltree","args":[{"type":"ltree"},{"type":"integer"},{"type":"integer"}],"returns":"ltree"} +{"name":"subpath","args":[{"type":"ltree"},{"type":"integer"}],"returns":"ltree"} +{"name":"subpath","args":[{"type":"ltree"},{"type":"integer"},{"type":"integer"}],"returns":"ltree"} +{"name":"text2ltree","args":[{"type":"text"}],"returns":"ltree"} diff --git a/internal/engine/postgresql/dialect/extensions/ltree/types.jsonl b/internal/engine/postgresql/dialect/extensions/ltree/types.jsonl new file mode 100644 index 0000000000..94063cab70 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/ltree/types.jsonl @@ -0,0 +1,4 @@ +{"name":"ltree","category":"U"} +{"name":"lquery","category":"U"} +{"name":"ltxtquery","category":"U"} +{"name":"ltree_gist","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/pageinspect/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pageinspect/functions.jsonl new file mode 100644 index 0000000000..56f363c3c4 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pageinspect/functions.jsonl @@ -0,0 +1,31 @@ +{"name":"brin_metapage_info","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"brin_page_items","args":[{"name":"page","type":"bytea"},{"name":"index_oid","type":"regclass"}],"returns":"record"} +{"name":"brin_page_type","args":[{"name":"page","type":"bytea"}],"returns":"text"} +{"name":"brin_revmap_data","args":[{"name":"page","type":"bytea"}],"returns":"tid"} +{"name":"bt_metap","args":[{"name":"relname","type":"text"}],"returns":"record"} +{"name":"bt_multi_page_stats","args":[{"name":"relname","type":"text"},{"name":"blkno","type":"bigint"},{"name":"blk_count","type":"bigint"}],"returns":"record"} +{"name":"bt_page_items","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"bt_page_items","args":[{"name":"relname","type":"text"},{"name":"blkno","type":"bigint"}],"returns":"record"} +{"name":"bt_page_stats","args":[{"name":"relname","type":"text"},{"name":"blkno","type":"bigint"}],"returns":"record"} +{"name":"fsm_page_contents","args":[{"name":"page","type":"bytea"}],"returns":"text"} +{"name":"get_raw_page","args":[{"type":"text"},{"type":"bigint"}],"returns":"bytea"} +{"name":"get_raw_page","args":[{"type":"text"},{"type":"text"},{"type":"bigint"}],"returns":"bytea"} +{"name":"gin_leafpage_items","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"gin_metapage_info","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"gin_page_opaque_info","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"gist_page_items","args":[{"name":"page","type":"bytea"},{"name":"index_oid","type":"regclass"}],"returns":"record"} +{"name":"gist_page_items_bytea","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"gist_page_opaque_info","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"hash_bitmap_info","args":[{"name":"index_oid","type":"regclass"},{"name":"blkno","type":"bigint"}],"returns":"record"} +{"name":"hash_metapage_info","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"hash_page_items","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"hash_page_stats","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"hash_page_type","args":[{"name":"page","type":"bytea"}],"returns":"text"} +{"name":"heap_page_item_attrs","args":[{"name":"page","type":"bytea"},{"name":"rel_oid","type":"regclass"}],"returns":"record"} +{"name":"heap_page_item_attrs","args":[{"name":"page","type":"bytea"},{"name":"rel_oid","type":"regclass"},{"name":"do_detoast","type":"boolean"}],"returns":"record"} +{"name":"heap_page_items","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"heap_tuple_infomask_flags","args":[{"name":"t_infomask","type":"integer"},{"name":"t_infomask2","type":"integer"}],"returns":"record"} +{"name":"page_checksum","args":[{"name":"page","type":"bytea"},{"name":"blkno","type":"bigint"}],"returns":"smallint"} +{"name":"page_header","args":[{"name":"page","type":"bytea"}],"returns":"record"} +{"name":"tuple_data_split","args":[{"name":"rel_oid","type":"oid"},{"name":"t_data","type":"bytea"},{"name":"t_infomask","type":"integer"},{"name":"t_infomask2","type":"integer"},{"name":"t_bits","type":"text"}],"returns":"bytea[]"} +{"name":"tuple_data_split","args":[{"name":"rel_oid","type":"oid"},{"name":"t_data","type":"bytea"},{"name":"t_infomask","type":"integer"},{"name":"t_infomask2","type":"integer"},{"name":"t_bits","type":"text"},{"name":"do_detoast","type":"boolean"}],"returns":"bytea[]"} diff --git a/internal/engine/postgresql/dialect/extensions/pg_buffercache/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pg_buffercache/functions.jsonl new file mode 100644 index 0000000000..b0f446ea77 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pg_buffercache/functions.jsonl @@ -0,0 +1,3 @@ +{"name":"pg_buffercache_pages","returns":"record"} +{"name":"pg_buffercache_summary","returns":"record"} +{"name":"pg_buffercache_usage_counts","returns":"record"} diff --git a/internal/engine/postgresql/dialect/extensions/pg_freespacemap/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pg_freespacemap/functions.jsonl new file mode 100644 index 0000000000..19ffb50ed7 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pg_freespacemap/functions.jsonl @@ -0,0 +1,2 @@ +{"name":"pg_freespace","args":[{"name":"rel","type":"regclass"}],"returns":"record"} +{"name":"pg_freespace","args":[{"type":"regclass"},{"type":"bigint"}],"returns":"smallint"} diff --git a/internal/engine/postgresql/dialect/extensions/pg_prewarm/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pg_prewarm/functions.jsonl new file mode 100644 index 0000000000..3f6721e262 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pg_prewarm/functions.jsonl @@ -0,0 +1,3 @@ +{"name":"autoprewarm_dump_now","returns":"bigint"} +{"name":"autoprewarm_start_worker","returns":"void"} +{"name":"pg_prewarm","args":[{"type":"regclass"},{"name":"mode","type":"text","has_default":true},{"name":"fork","type":"text","has_default":true},{"name":"first_block","type":"bigint","has_default":true},{"name":"last_block","type":"bigint","has_default":true}],"returns":"bigint"} diff --git a/internal/engine/postgresql/dialect/extensions/pg_stat_statements/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pg_stat_statements/functions.jsonl new file mode 100644 index 0000000000..990af04216 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pg_stat_statements/functions.jsonl @@ -0,0 +1,3 @@ +{"name":"pg_stat_statements","args":[{"name":"showtext","type":"boolean"}],"returns":"record"} +{"name":"pg_stat_statements_info","returns":"record"} +{"name":"pg_stat_statements_reset","args":[{"name":"userid","type":"oid","has_default":true},{"name":"dbid","type":"oid","has_default":true},{"name":"queryid","type":"bigint","has_default":true}],"returns":"void"} diff --git a/internal/engine/postgresql/dialect/extensions/pg_trgm/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pg_trgm/functions.jsonl new file mode 100644 index 0000000000..160e43a486 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pg_trgm/functions.jsonl @@ -0,0 +1,18 @@ +{"name":"gtrgm_in","args":[{"type":"cstring"}],"returns":"gtrgm"} +{"name":"gtrgm_out","args":[{"type":"gtrgm"}],"returns":"cstring"} +{"name":"set_limit","args":[{"type":"real"}],"returns":"real"} +{"name":"show_limit","returns":"real"} +{"name":"show_trgm","args":[{"type":"text"}],"returns":"text[]"} +{"name":"similarity","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"similarity_dist","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"similarity_op","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"strict_word_similarity","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"strict_word_similarity_commutator_op","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"strict_word_similarity_dist_commutator_op","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"strict_word_similarity_dist_op","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"strict_word_similarity_op","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"word_similarity","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"word_similarity_commutator_op","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"word_similarity_dist_commutator_op","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"word_similarity_dist_op","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"word_similarity_op","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} diff --git a/internal/engine/postgresql/dialect/extensions/pg_trgm/types.jsonl b/internal/engine/postgresql/dialect/extensions/pg_trgm/types.jsonl new file mode 100644 index 0000000000..6823fc445c --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pg_trgm/types.jsonl @@ -0,0 +1 @@ +{"name":"gtrgm","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/pg_visibility/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pg_visibility/functions.jsonl new file mode 100644 index 0000000000..97503f9c28 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pg_visibility/functions.jsonl @@ -0,0 +1,8 @@ +{"name":"pg_check_frozen","args":[{"type":"regclass"}],"returns":"tid"} +{"name":"pg_check_visible","args":[{"type":"regclass"}],"returns":"tid"} +{"name":"pg_truncate_visibility_map","args":[{"type":"regclass"}],"returns":"void"} +{"name":"pg_visibility","args":[{"type":"regclass"}],"returns":"record"} +{"name":"pg_visibility","args":[{"type":"regclass"},{"name":"blkno","type":"bigint"}],"returns":"record"} +{"name":"pg_visibility_map","args":[{"type":"regclass"}],"returns":"record"} +{"name":"pg_visibility_map","args":[{"type":"regclass"},{"name":"blkno","type":"bigint"}],"returns":"record"} +{"name":"pg_visibility_map_summary","args":[{"type":"regclass"}],"returns":"record"} diff --git a/internal/engine/postgresql/dialect/extensions/pgcrypto/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pgcrypto/functions.jsonl new file mode 100644 index 0000000000..1574f8e62b --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pgcrypto/functions.jsonl @@ -0,0 +1,35 @@ +{"name":"armor","args":[{"type":"bytea"}],"returns":"text"} +{"name":"armor","args":[{"type":"bytea"},{"type":"text[]"},{"type":"text[]"}],"returns":"text"} +{"name":"crypt","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"dearmor","args":[{"type":"text"}],"returns":"bytea"} +{"name":"decrypt","args":[{"type":"bytea"},{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"decrypt_iv","args":[{"type":"bytea"},{"type":"bytea"},{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"digest","args":[{"type":"text"},{"type":"text"}],"returns":"bytea"} +{"name":"digest","args":[{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"encrypt","args":[{"type":"bytea"},{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"encrypt_iv","args":[{"type":"bytea"},{"type":"bytea"},{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"gen_random_bytes","args":[{"type":"integer"}],"returns":"bytea"} +{"name":"gen_salt","args":[{"type":"text"}],"returns":"text"} +{"name":"gen_salt","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"hmac","args":[{"type":"bytea"},{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"hmac","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_armor_headers","args":[{"type":"text"}],"returns":"record"} +{"name":"pgp_key_id","args":[{"type":"bytea"}],"returns":"text"} +{"name":"pgp_pub_decrypt","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"text"} +{"name":"pgp_pub_decrypt","args":[{"type":"bytea"},{"type":"bytea"},{"type":"text"}],"returns":"text"} +{"name":"pgp_pub_decrypt","args":[{"type":"bytea"},{"type":"bytea"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"pgp_pub_decrypt_bytea","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"bytea"} +{"name":"pgp_pub_decrypt_bytea","args":[{"type":"bytea"},{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_pub_decrypt_bytea","args":[{"type":"bytea"},{"type":"bytea"},{"type":"text"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_pub_encrypt","args":[{"type":"text"},{"type":"bytea"}],"returns":"bytea"} +{"name":"pgp_pub_encrypt","args":[{"type":"text"},{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_pub_encrypt_bytea","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"bytea"} +{"name":"pgp_pub_encrypt_bytea","args":[{"type":"bytea"},{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_sym_decrypt","args":[{"type":"bytea"},{"type":"text"}],"returns":"text"} +{"name":"pgp_sym_decrypt","args":[{"type":"bytea"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"pgp_sym_decrypt_bytea","args":[{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_sym_decrypt_bytea","args":[{"type":"bytea"},{"type":"text"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_sym_encrypt","args":[{"type":"text"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_sym_encrypt","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_sym_encrypt_bytea","args":[{"type":"bytea"},{"type":"text"}],"returns":"bytea"} +{"name":"pgp_sym_encrypt_bytea","args":[{"type":"bytea"},{"type":"text"},{"type":"text"}],"returns":"bytea"} diff --git a/internal/engine/postgresql/dialect/extensions/pgrowlocks/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pgrowlocks/functions.jsonl new file mode 100644 index 0000000000..c40d0a461c --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pgrowlocks/functions.jsonl @@ -0,0 +1 @@ +{"name":"pgrowlocks","args":[{"name":"relname","type":"text"}],"returns":"record"} diff --git a/internal/engine/postgresql/dialect/extensions/pgstattuple/functions.jsonl b/internal/engine/postgresql/dialect/extensions/pgstattuple/functions.jsonl new file mode 100644 index 0000000000..ac9ee05e26 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/pgstattuple/functions.jsonl @@ -0,0 +1,9 @@ +{"name":"pg_relpages","args":[{"name":"relname","type":"regclass"}],"returns":"bigint"} +{"name":"pg_relpages","args":[{"name":"relname","type":"text"}],"returns":"bigint"} +{"name":"pgstatginindex","args":[{"name":"relname","type":"regclass"}],"returns":"record"} +{"name":"pgstathashindex","args":[{"name":"relname","type":"regclass"}],"returns":"record"} +{"name":"pgstatindex","args":[{"name":"relname","type":"regclass"}],"returns":"record"} +{"name":"pgstatindex","args":[{"name":"relname","type":"text"}],"returns":"record"} +{"name":"pgstattuple","args":[{"name":"reloid","type":"regclass"}],"returns":"record"} +{"name":"pgstattuple","args":[{"name":"relname","type":"text"}],"returns":"record"} +{"name":"pgstattuple_approx","args":[{"name":"reloid","type":"regclass"}],"returns":"record"} diff --git a/internal/engine/postgresql/dialect/extensions/postgres_fdw/functions.jsonl b/internal/engine/postgresql/dialect/extensions/postgres_fdw/functions.jsonl new file mode 100644 index 0000000000..9ccf9f0000 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/postgres_fdw/functions.jsonl @@ -0,0 +1,5 @@ +{"name":"postgres_fdw_disconnect","args":[{"type":"text"}],"returns":"boolean"} +{"name":"postgres_fdw_disconnect_all","returns":"boolean"} +{"name":"postgres_fdw_get_connections","returns":"record"} +{"name":"postgres_fdw_handler","returns":"fdw_handler"} +{"name":"postgres_fdw_validator","args":[{"type":"text[]"},{"type":"oid"}],"returns":"void"} diff --git a/internal/engine/postgresql/dialect/extensions/seg/functions.jsonl b/internal/engine/postgresql/dialect/extensions/seg/functions.jsonl new file mode 100644 index 0000000000..63f0cdb4d9 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/seg/functions.jsonl @@ -0,0 +1,22 @@ +{"name":"seg_center","args":[{"type":"seg"}],"returns":"real"} +{"name":"seg_cmp","args":[{"type":"seg"},{"type":"seg"}],"returns":"integer"} +{"name":"seg_contained","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_contains","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_different","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_ge","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_gt","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_in","args":[{"type":"cstring"}],"returns":"seg"} +{"name":"seg_inter","args":[{"type":"seg"},{"type":"seg"}],"returns":"seg"} +{"name":"seg_le","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_left","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_lower","args":[{"type":"seg"}],"returns":"real"} +{"name":"seg_lt","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_out","args":[{"type":"seg"}],"returns":"cstring"} +{"name":"seg_over_left","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_over_right","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_overlap","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_right","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_same","args":[{"type":"seg"},{"type":"seg"}],"returns":"boolean"} +{"name":"seg_size","args":[{"type":"seg"}],"returns":"real"} +{"name":"seg_union","args":[{"type":"seg"},{"type":"seg"}],"returns":"seg"} +{"name":"seg_upper","args":[{"type":"seg"}],"returns":"real"} diff --git a/internal/engine/postgresql/dialect/extensions/seg/types.jsonl b/internal/engine/postgresql/dialect/extensions/seg/types.jsonl new file mode 100644 index 0000000000..d09b313648 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/seg/types.jsonl @@ -0,0 +1 @@ +{"name":"seg","category":"U"} diff --git a/internal/engine/postgresql/dialect/extensions/sslinfo/functions.jsonl b/internal/engine/postgresql/dialect/extensions/sslinfo/functions.jsonl new file mode 100644 index 0000000000..18b86c92ac --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/sslinfo/functions.jsonl @@ -0,0 +1,10 @@ +{"name":"ssl_cipher","returns":"text"} +{"name":"ssl_client_cert_present","returns":"boolean"} +{"name":"ssl_client_dn","returns":"text"} +{"name":"ssl_client_dn_field","args":[{"type":"text"}],"returns":"text"} +{"name":"ssl_client_serial","returns":"numeric"} +{"name":"ssl_extension_info","returns":"record"} +{"name":"ssl_is_used","returns":"boolean"} +{"name":"ssl_issuer_dn","returns":"text"} +{"name":"ssl_issuer_field","args":[{"type":"text"}],"returns":"text"} +{"name":"ssl_version","returns":"text"} diff --git a/internal/engine/postgresql/dialect/extensions/tablefunc/functions.jsonl b/internal/engine/postgresql/dialect/extensions/tablefunc/functions.jsonl new file mode 100644 index 0000000000..5b7bd5d268 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/tablefunc/functions.jsonl @@ -0,0 +1,11 @@ +{"name":"connectby","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"record"} +{"name":"connectby","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"text"}],"returns":"record"} +{"name":"connectby","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"record"} +{"name":"connectby","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"text"}],"returns":"record"} +{"name":"crosstab","args":[{"type":"text"}],"returns":"record"} +{"name":"crosstab","args":[{"type":"text"},{"type":"integer"}],"returns":"record"} +{"name":"crosstab","args":[{"type":"text"},{"type":"text"}],"returns":"record"} +{"name":"crosstab2","args":[{"type":"text"}],"returns":"tablefunc_crosstab_2"} +{"name":"crosstab3","args":[{"type":"text"}],"returns":"tablefunc_crosstab_3"} +{"name":"crosstab4","args":[{"type":"text"}],"returns":"tablefunc_crosstab_4"} +{"name":"normal_rand","args":[{"type":"integer"},{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} diff --git a/internal/engine/postgresql/dialect/extensions/tablefunc/types.jsonl b/internal/engine/postgresql/dialect/extensions/tablefunc/types.jsonl new file mode 100644 index 0000000000..099110ad23 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/tablefunc/types.jsonl @@ -0,0 +1,3 @@ +{"name":"tablefunc_crosstab_2","category":"C"} +{"name":"tablefunc_crosstab_3","category":"C"} +{"name":"tablefunc_crosstab_4","category":"C"} diff --git a/internal/engine/postgresql/dialect/extensions/tcn/functions.jsonl b/internal/engine/postgresql/dialect/extensions/tcn/functions.jsonl new file mode 100644 index 0000000000..208a10b993 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/tcn/functions.jsonl @@ -0,0 +1 @@ +{"name":"triggered_change_notification","returns":"trigger"} diff --git a/internal/engine/postgresql/dialect/extensions/unaccent/functions.jsonl b/internal/engine/postgresql/dialect/extensions/unaccent/functions.jsonl new file mode 100644 index 0000000000..2db64e2ed7 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/unaccent/functions.jsonl @@ -0,0 +1,2 @@ +{"name":"unaccent","args":[{"type":"regdictionary"},{"type":"text"}],"returns":"text"} +{"name":"unaccent","args":[{"type":"text"}],"returns":"text"} diff --git a/internal/engine/postgresql/dialect/extensions/uuid-ossp/functions.jsonl b/internal/engine/postgresql/dialect/extensions/uuid-ossp/functions.jsonl new file mode 100644 index 0000000000..b80703f7ca --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/uuid-ossp/functions.jsonl @@ -0,0 +1,10 @@ +{"name":"uuid_generate_v1","returns":"uuid"} +{"name":"uuid_generate_v1mc","returns":"uuid"} +{"name":"uuid_generate_v3","args":[{"name":"namespace","type":"uuid"},{"name":"name","type":"text"}],"returns":"uuid"} +{"name":"uuid_generate_v4","returns":"uuid"} +{"name":"uuid_generate_v5","args":[{"name":"namespace","type":"uuid"},{"name":"name","type":"text"}],"returns":"uuid"} +{"name":"uuid_nil","returns":"uuid"} +{"name":"uuid_ns_dns","returns":"uuid"} +{"name":"uuid_ns_oid","returns":"uuid"} +{"name":"uuid_ns_url","returns":"uuid"} +{"name":"uuid_ns_x500","returns":"uuid"} diff --git a/internal/engine/postgresql/dialect/extensions/xml2/functions.jsonl b/internal/engine/postgresql/dialect/extensions/xml2/functions.jsonl new file mode 100644 index 0000000000..8124863908 --- /dev/null +++ b/internal/engine/postgresql/dialect/extensions/xml2/functions.jsonl @@ -0,0 +1,13 @@ +{"name":"xml_encode_special_chars","args":[{"type":"text"}],"returns":"text"} +{"name":"xml_valid","args":[{"type":"text"}],"returns":"boolean"} +{"name":"xpath_bool","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"xpath_list","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"xpath_list","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"xpath_nodeset","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"xpath_nodeset","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"xpath_nodeset","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"xpath_number","args":[{"type":"text"},{"type":"text"}],"returns":"real"} +{"name":"xpath_string","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"xpath_table","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"record"} +{"name":"xslt_process","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"xslt_process","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} diff --git a/internal/engine/postgresql/dialect/functions.jsonl b/internal/engine/postgresql/dialect/functions.jsonl new file mode 100644 index 0000000000..daf9060fd3 --- /dev/null +++ b/internal/engine/postgresql/dialect/functions.jsonl @@ -0,0 +1,2776 @@ +{"name":"RI_FKey_cascade_del","returns":"trigger"} +{"name":"RI_FKey_cascade_upd","returns":"trigger"} +{"name":"RI_FKey_check_ins","returns":"trigger"} +{"name":"RI_FKey_check_upd","returns":"trigger"} +{"name":"RI_FKey_noaction_del","returns":"trigger"} +{"name":"RI_FKey_noaction_upd","returns":"trigger"} +{"name":"RI_FKey_restrict_del","returns":"trigger"} +{"name":"RI_FKey_restrict_upd","returns":"trigger"} +{"name":"RI_FKey_setdefault_del","returns":"trigger"} +{"name":"RI_FKey_setdefault_upd","returns":"trigger"} +{"name":"RI_FKey_setnull_del","returns":"trigger"} +{"name":"RI_FKey_setnull_upd","returns":"trigger"} +{"name":"abbrev","args":[{"type":"cidr"}],"returns":"text"} +{"name":"abbrev","args":[{"type":"inet"}],"returns":"text"} +{"name":"abs","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"abs","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"abs","args":[{"type":"integer"}],"returns":"integer"} +{"name":"abs","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"abs","args":[{"type":"real"}],"returns":"real"} +{"name":"abs","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"aclcontains","args":[{"type":"aclitem[]"},{"type":"aclitem"}],"returns":"boolean"} +{"name":"acldefault","args":[{"type":"char"},{"type":"oid"}],"returns":"aclitem[]"} +{"name":"aclexplode","args":[{"name":"acl","type":"aclitem[]"}],"returns":"record"} +{"name":"aclinsert","args":[{"type":"aclitem[]"},{"type":"aclitem"}],"returns":"aclitem[]"} +{"name":"aclitemeq","args":[{"type":"aclitem"},{"type":"aclitem"}],"returns":"boolean"} +{"name":"aclitemin","args":[{"type":"cstring"}],"returns":"aclitem"} +{"name":"aclitemout","args":[{"type":"aclitem"}],"returns":"cstring"} +{"name":"aclremove","args":[{"type":"aclitem[]"},{"type":"aclitem"}],"returns":"aclitem[]"} +{"name":"acos","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"acosd","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"acosh","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"age","args":[{"type":"xid"}],"returns":"integer"} +{"name":"age","args":[{"type":"timestamp with time zone"}],"returns":"interval"} +{"name":"age","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"interval"} +{"name":"age","args":[{"type":"timestamp without time zone"}],"returns":"interval"} +{"name":"age","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"interval"} +{"name":"amvalidate","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"any_in","args":[{"type":"cstring"}],"returns":"any"} +{"name":"any_out","args":[{"type":"any"}],"returns":"cstring"} +{"name":"any_value","args":[{"type":"anyelement"}],"returns":"anyelement"} +{"name":"any_value_transfn","args":[{"type":"anyelement"},{"type":"anyelement"}],"returns":"anyelement"} +{"name":"anyarray_in","args":[{"type":"cstring"}],"returns":"anyarray"} +{"name":"anyarray_out","args":[{"type":"anyarray"}],"returns":"cstring"} +{"name":"anyarray_send","args":[{"type":"anyarray"}],"returns":"bytea"} +{"name":"anycompatible_in","args":[{"type":"cstring"}],"returns":"anycompatible"} +{"name":"anycompatible_out","args":[{"type":"anycompatible"}],"returns":"cstring"} +{"name":"anycompatiblearray_in","args":[{"type":"cstring"}],"returns":"anycompatiblearray"} +{"name":"anycompatiblearray_out","args":[{"type":"anycompatiblearray"}],"returns":"cstring"} +{"name":"anycompatiblearray_send","args":[{"type":"anycompatiblearray"}],"returns":"bytea"} +{"name":"anycompatiblemultirange_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"anycompatiblemultirange"} +{"name":"anycompatiblemultirange_out","args":[{"type":"anycompatiblemultirange"}],"returns":"cstring"} +{"name":"anycompatiblenonarray_in","args":[{"type":"cstring"}],"returns":"anycompatiblenonarray"} +{"name":"anycompatiblenonarray_out","args":[{"type":"anycompatiblenonarray"}],"returns":"cstring"} +{"name":"anycompatiblerange_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"anycompatiblerange"} +{"name":"anycompatiblerange_out","args":[{"type":"anycompatiblerange"}],"returns":"cstring"} +{"name":"anyelement_in","args":[{"type":"cstring"}],"returns":"anyelement"} +{"name":"anyelement_out","args":[{"type":"anyelement"}],"returns":"cstring"} +{"name":"anyenum_in","args":[{"type":"cstring"}],"returns":"anyenum"} +{"name":"anyenum_out","args":[{"type":"anyenum"}],"returns":"cstring"} +{"name":"anymultirange_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"anymultirange"} +{"name":"anymultirange_out","args":[{"type":"anymultirange"}],"returns":"cstring"} +{"name":"anynonarray_in","args":[{"type":"cstring"}],"returns":"anynonarray"} +{"name":"anynonarray_out","args":[{"type":"anynonarray"}],"returns":"cstring"} +{"name":"anyrange_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"anyrange"} +{"name":"anyrange_out","args":[{"type":"anyrange"}],"returns":"cstring"} +{"name":"anytextcat","args":[{"type":"anynonarray"},{"type":"text"}],"returns":"text"} +{"name":"area","args":[{"type":"box"}],"returns":"double precision"} +{"name":"area","args":[{"type":"circle"}],"returns":"double precision"} +{"name":"area","args":[{"type":"path"}],"returns":"double precision"} +{"name":"array_agg","args":[{"type":"anyarray"}],"returns":"anyarray"} +{"name":"array_agg","args":[{"type":"anynonarray"}],"returns":"anyarray"} +{"name":"array_append","args":[{"type":"anycompatiblearray"},{"type":"anycompatible"}],"returns":"anycompatiblearray"} +{"name":"array_cat","args":[{"type":"anycompatiblearray"},{"type":"anycompatiblearray"}],"returns":"anycompatiblearray"} +{"name":"array_dims","args":[{"type":"anyarray"}],"returns":"text"} +{"name":"array_eq","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"array_fill","args":[{"type":"anyelement"},{"type":"integer[]"}],"returns":"anyarray"} +{"name":"array_fill","args":[{"type":"anyelement"},{"type":"integer[]"},{"type":"integer[]"}],"returns":"anyarray"} +{"name":"array_ge","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"array_gt","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"array_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"anyarray"} +{"name":"array_larger","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"anyarray"} +{"name":"array_le","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"array_length","args":[{"type":"anyarray"},{"type":"integer"}],"returns":"integer"} +{"name":"array_lower","args":[{"type":"anyarray"},{"type":"integer"}],"returns":"integer"} +{"name":"array_lt","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"array_ndims","args":[{"type":"anyarray"}],"returns":"integer"} +{"name":"array_ne","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"array_out","args":[{"type":"anyarray"}],"returns":"cstring"} +{"name":"array_position","args":[{"type":"anycompatiblearray"},{"type":"anycompatible"}],"returns":"integer"} +{"name":"array_position","args":[{"type":"anycompatiblearray"},{"type":"anycompatible"},{"type":"integer"}],"returns":"integer"} +{"name":"array_positions","args":[{"type":"anycompatiblearray"},{"type":"anycompatible"}],"returns":"integer[]"} +{"name":"array_prepend","args":[{"type":"anycompatible"},{"type":"anycompatiblearray"}],"returns":"anycompatiblearray"} +{"name":"array_remove","args":[{"type":"anycompatiblearray"},{"type":"anycompatible"}],"returns":"anycompatiblearray"} +{"name":"array_replace","args":[{"type":"anycompatiblearray"},{"type":"anycompatible"},{"type":"anycompatible"}],"returns":"anycompatiblearray"} +{"name":"array_sample","args":[{"type":"anyarray"},{"type":"integer"}],"returns":"anyarray"} +{"name":"array_send","args":[{"type":"anyarray"}],"returns":"bytea"} +{"name":"array_shuffle","args":[{"type":"anyarray"}],"returns":"anyarray"} +{"name":"array_smaller","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"anyarray"} +{"name":"array_to_json","args":[{"type":"anyarray"}],"returns":"json"} +{"name":"array_to_json","args":[{"type":"anyarray"},{"type":"boolean"}],"returns":"json"} +{"name":"array_to_string","args":[{"type":"anyarray"},{"type":"text"}],"returns":"text"} +{"name":"array_to_string","args":[{"type":"anyarray"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"array_to_tsvector","args":[{"type":"text[]"}],"returns":"tsvector"} +{"name":"array_upper","args":[{"type":"anyarray"},{"type":"integer"}],"returns":"integer"} +{"name":"arraycontained","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"arraycontains","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"arrayoverlap","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"boolean"} +{"name":"ascii","args":[{"type":"text"}],"returns":"integer"} +{"name":"asin","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"asind","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"asinh","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"atan","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"atan2","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"atan2d","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"atand","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"atanh","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"avg","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"avg","args":[{"type":"real"}],"returns":"double precision"} +{"name":"avg","args":[{"type":"interval"}],"returns":"interval"} +{"name":"avg","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"avg","args":[{"type":"integer"}],"returns":"numeric"} +{"name":"avg","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"avg","args":[{"type":"smallint"}],"returns":"numeric"} +{"name":"binary_upgrade_create_empty_extension","args":[{"type":"text"},{"type":"text"},{"type":"boolean"},{"type":"text"},{"type":"oid[]"},{"type":"text[]"},{"type":"text[]"}],"returns":"void"} +{"name":"binary_upgrade_set_missing_value","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"void"} +{"name":"binary_upgrade_set_next_array_pg_type_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_heap_pg_class_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_heap_relfilenode","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_index_pg_class_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_index_relfilenode","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_multirange_array_pg_type_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_multirange_pg_type_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_pg_authid_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_pg_enum_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_pg_tablespace_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_pg_type_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_toast_pg_class_oid","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_next_toast_relfilenode","args":[{"type":"oid"}],"returns":"void"} +{"name":"binary_upgrade_set_record_init_privs","args":[{"type":"boolean"}],"returns":"void"} +{"name":"bit","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bit"} +{"name":"bit","args":[{"type":"bit"},{"type":"integer"},{"type":"boolean"}],"returns":"bit"} +{"name":"bit","args":[{"type":"integer"},{"type":"integer"}],"returns":"bit"} +{"name":"bit_and","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"bit_and","args":[{"type":"bit"}],"returns":"bit"} +{"name":"bit_and","args":[{"type":"integer"}],"returns":"integer"} +{"name":"bit_and","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"bit_count","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"bit_count","args":[{"type":"bytea"}],"returns":"bigint"} +{"name":"bit_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"bit"} +{"name":"bit_length","args":[{"type":"bit"}],"returns":"integer"} +{"name":"bit_length","args":[{"type":"bytea"}],"returns":"integer"} +{"name":"bit_length","args":[{"type":"text"}],"returns":"integer"} +{"name":"bit_or","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"bit_or","args":[{"type":"bit"}],"returns":"bit"} +{"name":"bit_or","args":[{"type":"integer"}],"returns":"integer"} +{"name":"bit_or","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"bit_out","args":[{"type":"bit"}],"returns":"cstring"} +{"name":"bit_send","args":[{"type":"bit"}],"returns":"bytea"} +{"name":"bit_xor","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"bit_xor","args":[{"type":"bit"}],"returns":"bit"} +{"name":"bit_xor","args":[{"type":"integer"}],"returns":"integer"} +{"name":"bit_xor","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"bitand","args":[{"type":"bit"},{"type":"bit"}],"returns":"bit"} +{"name":"bitcat","args":[{"type":"bit varying"},{"type":"bit varying"}],"returns":"bit varying"} +{"name":"bitcmp","args":[{"type":"bit"},{"type":"bit"}],"returns":"integer"} +{"name":"biteq","args":[{"type":"bit"},{"type":"bit"}],"returns":"boolean"} +{"name":"bitge","args":[{"type":"bit"},{"type":"bit"}],"returns":"boolean"} +{"name":"bitgt","args":[{"type":"bit"},{"type":"bit"}],"returns":"boolean"} +{"name":"bitle","args":[{"type":"bit"},{"type":"bit"}],"returns":"boolean"} +{"name":"bitlt","args":[{"type":"bit"},{"type":"bit"}],"returns":"boolean"} +{"name":"bitne","args":[{"type":"bit"},{"type":"bit"}],"returns":"boolean"} +{"name":"bitnot","args":[{"type":"bit"}],"returns":"bit"} +{"name":"bitor","args":[{"type":"bit"},{"type":"bit"}],"returns":"bit"} +{"name":"bitshiftleft","args":[{"type":"bit"},{"type":"integer"}],"returns":"bit"} +{"name":"bitshiftright","args":[{"type":"bit"},{"type":"integer"}],"returns":"bit"} +{"name":"bittypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"bittypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"bitxor","args":[{"type":"bit"},{"type":"bit"}],"returns":"bit"} +{"name":"bool","args":[{"type":"integer"}],"returns":"boolean"} +{"name":"bool","args":[{"type":"jsonb"}],"returns":"boolean"} +{"name":"bool_and","args":[{"type":"boolean"}],"returns":"boolean"} +{"name":"bool_or","args":[{"type":"boolean"}],"returns":"boolean"} +{"name":"booland_statefunc","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"booleq","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"boolge","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"boolgt","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"boolin","args":[{"type":"cstring"}],"returns":"boolean"} +{"name":"boolle","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"boollt","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"boolne","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"boolor_statefunc","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"boolout","args":[{"type":"boolean"}],"returns":"cstring"} +{"name":"boolsend","args":[{"type":"boolean"}],"returns":"bytea"} +{"name":"bound_box","args":[{"type":"box"},{"type":"box"}],"returns":"box"} +{"name":"box","args":[{"type":"circle"}],"returns":"box"} +{"name":"box","args":[{"type":"point"}],"returns":"box"} +{"name":"box","args":[{"type":"point"},{"type":"point"}],"returns":"box"} +{"name":"box","args":[{"type":"polygon"}],"returns":"box"} +{"name":"box_above","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_above_eq","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_add","args":[{"type":"box"},{"type":"point"}],"returns":"box"} +{"name":"box_below","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_below_eq","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_center","args":[{"type":"box"}],"returns":"point"} +{"name":"box_contain","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_contain_pt","args":[{"type":"box"},{"type":"point"}],"returns":"boolean"} +{"name":"box_contained","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_distance","args":[{"type":"box"},{"type":"box"}],"returns":"double precision"} +{"name":"box_div","args":[{"type":"box"},{"type":"point"}],"returns":"box"} +{"name":"box_eq","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_ge","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_gt","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_in","args":[{"type":"cstring"}],"returns":"box"} +{"name":"box_intersect","args":[{"type":"box"},{"type":"box"}],"returns":"box"} +{"name":"box_le","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_left","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_lt","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_mul","args":[{"type":"box"},{"type":"point"}],"returns":"box"} +{"name":"box_out","args":[{"type":"box"}],"returns":"cstring"} +{"name":"box_overabove","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_overbelow","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_overlap","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_overleft","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_overright","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_right","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_same","args":[{"type":"box"},{"type":"box"}],"returns":"boolean"} +{"name":"box_send","args":[{"type":"box"}],"returns":"bytea"} +{"name":"box_sub","args":[{"type":"box"},{"type":"point"}],"returns":"box"} +{"name":"bpchar","args":[{"type":"char"}],"returns":"character"} +{"name":"bpchar","args":[{"type":"character"},{"type":"integer"},{"type":"boolean"}],"returns":"character"} +{"name":"bpchar","args":[{"type":"name"}],"returns":"character"} +{"name":"bpchar_larger","args":[{"type":"character"},{"type":"character"}],"returns":"character"} +{"name":"bpchar_pattern_ge","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpchar_pattern_gt","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpchar_pattern_le","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpchar_pattern_lt","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpchar_smaller","args":[{"type":"character"},{"type":"character"}],"returns":"character"} +{"name":"bpcharcmp","args":[{"type":"character"},{"type":"character"}],"returns":"integer"} +{"name":"bpchareq","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpcharge","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpchargt","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpchariclike","args":[{"type":"character"},{"type":"text"}],"returns":"boolean"} +{"name":"bpcharicnlike","args":[{"type":"character"},{"type":"text"}],"returns":"boolean"} +{"name":"bpcharicregexeq","args":[{"type":"character"},{"type":"text"}],"returns":"boolean"} +{"name":"bpcharicregexne","args":[{"type":"character"},{"type":"text"}],"returns":"boolean"} +{"name":"bpcharin","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"character"} +{"name":"bpcharle","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpcharlike","args":[{"type":"character"},{"type":"text"}],"returns":"boolean"} +{"name":"bpcharlt","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpcharne","args":[{"type":"character"},{"type":"character"}],"returns":"boolean"} +{"name":"bpcharnlike","args":[{"type":"character"},{"type":"text"}],"returns":"boolean"} +{"name":"bpcharout","args":[{"type":"character"}],"returns":"cstring"} +{"name":"bpcharregexeq","args":[{"type":"character"},{"type":"text"}],"returns":"boolean"} +{"name":"bpcharregexne","args":[{"type":"character"},{"type":"text"}],"returns":"boolean"} +{"name":"bpcharsend","args":[{"type":"character"}],"returns":"bytea"} +{"name":"bpchartypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"bpchartypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"brin_bloom_summary_in","args":[{"type":"cstring"}],"returns":"pg_brin_bloom_summary"} +{"name":"brin_bloom_summary_out","args":[{"type":"pg_brin_bloom_summary"}],"returns":"cstring"} +{"name":"brin_bloom_summary_send","args":[{"type":"pg_brin_bloom_summary"}],"returns":"bytea"} +{"name":"brin_desummarize_range","args":[{"type":"regclass"},{"type":"bigint"}],"returns":"void"} +{"name":"brin_minmax_multi_summary_in","args":[{"type":"cstring"}],"returns":"pg_brin_minmax_multi_summary"} +{"name":"brin_minmax_multi_summary_out","args":[{"type":"pg_brin_minmax_multi_summary"}],"returns":"cstring"} +{"name":"brin_minmax_multi_summary_send","args":[{"type":"pg_brin_minmax_multi_summary"}],"returns":"bytea"} +{"name":"brin_summarize_new_values","args":[{"type":"regclass"}],"returns":"integer"} +{"name":"brin_summarize_range","args":[{"type":"regclass"},{"type":"bigint"}],"returns":"integer"} +{"name":"broadcast","args":[{"type":"inet"}],"returns":"inet"} +{"name":"btarraycmp","args":[{"type":"anyarray"},{"type":"anyarray"}],"returns":"integer"} +{"name":"btboolcmp","args":[{"type":"boolean"},{"type":"boolean"}],"returns":"integer"} +{"name":"btbpchar_pattern_cmp","args":[{"type":"character"},{"type":"character"}],"returns":"integer"} +{"name":"btcharcmp","args":[{"type":"char"},{"type":"char"}],"returns":"integer"} +{"name":"btequalimage","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"btfloat48cmp","args":[{"type":"real"},{"type":"double precision"}],"returns":"integer"} +{"name":"btfloat4cmp","args":[{"type":"real"},{"type":"real"}],"returns":"integer"} +{"name":"btfloat84cmp","args":[{"type":"double precision"},{"type":"real"}],"returns":"integer"} +{"name":"btfloat8cmp","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"integer"} +{"name":"btint24cmp","args":[{"type":"smallint"},{"type":"integer"}],"returns":"integer"} +{"name":"btint28cmp","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"integer"} +{"name":"btint2cmp","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"integer"} +{"name":"btint42cmp","args":[{"type":"integer"},{"type":"smallint"}],"returns":"integer"} +{"name":"btint48cmp","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer"} +{"name":"btint4cmp","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"btint82cmp","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"integer"} +{"name":"btint84cmp","args":[{"type":"bigint"},{"type":"integer"}],"returns":"integer"} +{"name":"btint8cmp","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"integer"} +{"name":"btnamecmp","args":[{"type":"name"},{"type":"name"}],"returns":"integer"} +{"name":"btnametextcmp","args":[{"type":"name"},{"type":"text"}],"returns":"integer"} +{"name":"btoidcmp","args":[{"type":"oid"},{"type":"oid"}],"returns":"integer"} +{"name":"btoidvectorcmp","args":[{"type":"oidvector"},{"type":"oidvector"}],"returns":"integer"} +{"name":"btrecordcmp","args":[{"type":"record"},{"type":"record"}],"returns":"integer"} +{"name":"btrecordimagecmp","args":[{"type":"record"},{"type":"record"}],"returns":"integer"} +{"name":"btrim","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"bytea"} +{"name":"btrim","args":[{"type":"text"}],"returns":"text"} +{"name":"btrim","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"bttext_pattern_cmp","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"bttextcmp","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"bttextnamecmp","args":[{"type":"text"},{"type":"name"}],"returns":"integer"} +{"name":"bttidcmp","args":[{"type":"tid"},{"type":"tid"}],"returns":"integer"} +{"name":"btvarstrequalimage","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"byteacat","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"bytea"} +{"name":"byteacmp","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"integer"} +{"name":"byteaeq","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"byteage","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"byteagt","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"byteain","args":[{"type":"cstring"}],"returns":"bytea"} +{"name":"byteale","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"bytealike","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"bytealt","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"byteane","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"byteanlike","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"byteaout","args":[{"type":"bytea"}],"returns":"cstring"} +{"name":"byteasend","args":[{"type":"bytea"}],"returns":"bytea"} +{"name":"cardinality","args":[{"type":"anyarray"}],"returns":"integer"} +{"name":"cash_cmp","args":[{"type":"money"},{"type":"money"}],"returns":"integer"} +{"name":"cash_div_cash","args":[{"type":"money"},{"type":"money"}],"returns":"double precision"} +{"name":"cash_div_flt4","args":[{"type":"money"},{"type":"real"}],"returns":"money"} +{"name":"cash_div_flt8","args":[{"type":"money"},{"type":"double precision"}],"returns":"money"} +{"name":"cash_div_int2","args":[{"type":"money"},{"type":"smallint"}],"returns":"money"} +{"name":"cash_div_int4","args":[{"type":"money"},{"type":"integer"}],"returns":"money"} +{"name":"cash_div_int8","args":[{"type":"money"},{"type":"bigint"}],"returns":"money"} +{"name":"cash_eq","args":[{"type":"money"},{"type":"money"}],"returns":"boolean"} +{"name":"cash_ge","args":[{"type":"money"},{"type":"money"}],"returns":"boolean"} +{"name":"cash_gt","args":[{"type":"money"},{"type":"money"}],"returns":"boolean"} +{"name":"cash_in","args":[{"type":"cstring"}],"returns":"money"} +{"name":"cash_le","args":[{"type":"money"},{"type":"money"}],"returns":"boolean"} +{"name":"cash_lt","args":[{"type":"money"},{"type":"money"}],"returns":"boolean"} +{"name":"cash_mi","args":[{"type":"money"},{"type":"money"}],"returns":"money"} +{"name":"cash_mul_flt4","args":[{"type":"money"},{"type":"real"}],"returns":"money"} +{"name":"cash_mul_flt8","args":[{"type":"money"},{"type":"double precision"}],"returns":"money"} +{"name":"cash_mul_int2","args":[{"type":"money"},{"type":"smallint"}],"returns":"money"} +{"name":"cash_mul_int4","args":[{"type":"money"},{"type":"integer"}],"returns":"money"} +{"name":"cash_mul_int8","args":[{"type":"money"},{"type":"bigint"}],"returns":"money"} +{"name":"cash_ne","args":[{"type":"money"},{"type":"money"}],"returns":"boolean"} +{"name":"cash_out","args":[{"type":"money"}],"returns":"cstring"} +{"name":"cash_pl","args":[{"type":"money"},{"type":"money"}],"returns":"money"} +{"name":"cash_send","args":[{"type":"money"}],"returns":"bytea"} +{"name":"cash_words","args":[{"type":"money"}],"returns":"text"} +{"name":"cashlarger","args":[{"type":"money"},{"type":"money"}],"returns":"money"} +{"name":"cashsmaller","args":[{"type":"money"},{"type":"money"}],"returns":"money"} +{"name":"cbrt","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ceil","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ceil","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"ceiling","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ceiling","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"center","args":[{"type":"box"}],"returns":"point"} +{"name":"center","args":[{"type":"circle"}],"returns":"point"} +{"name":"char","args":[{"type":"integer"}],"returns":"char"} +{"name":"char","args":[{"type":"text"}],"returns":"char"} +{"name":"char_length","args":[{"type":"character"}],"returns":"integer"} +{"name":"char_length","args":[{"type":"text"}],"returns":"integer"} +{"name":"character_length","args":[{"type":"character"}],"returns":"integer"} +{"name":"character_length","args":[{"type":"text"}],"returns":"integer"} +{"name":"chareq","args":[{"type":"char"},{"type":"char"}],"returns":"boolean"} +{"name":"charge","args":[{"type":"char"},{"type":"char"}],"returns":"boolean"} +{"name":"chargt","args":[{"type":"char"},{"type":"char"}],"returns":"boolean"} +{"name":"charin","args":[{"type":"cstring"}],"returns":"char"} +{"name":"charle","args":[{"type":"char"},{"type":"char"}],"returns":"boolean"} +{"name":"charlt","args":[{"type":"char"},{"type":"char"}],"returns":"boolean"} +{"name":"charne","args":[{"type":"char"},{"type":"char"}],"returns":"boolean"} +{"name":"charout","args":[{"type":"char"}],"returns":"cstring"} +{"name":"charsend","args":[{"type":"char"}],"returns":"bytea"} +{"name":"chr","args":[{"type":"integer"}],"returns":"text"} +{"name":"cideq","args":[{"type":"cid"},{"type":"cid"}],"returns":"boolean"} +{"name":"cidin","args":[{"type":"cstring"}],"returns":"cid"} +{"name":"cidout","args":[{"type":"cid"}],"returns":"cstring"} +{"name":"cidr","args":[{"type":"inet"}],"returns":"cidr"} +{"name":"cidr_in","args":[{"type":"cstring"}],"returns":"cidr"} +{"name":"cidr_out","args":[{"type":"cidr"}],"returns":"cstring"} +{"name":"cidr_send","args":[{"type":"cidr"}],"returns":"bytea"} +{"name":"cidsend","args":[{"type":"cid"}],"returns":"bytea"} +{"name":"circle","args":[{"type":"box"}],"returns":"circle"} +{"name":"circle","args":[{"type":"point"},{"type":"double precision"}],"returns":"circle"} +{"name":"circle","args":[{"type":"polygon"}],"returns":"circle"} +{"name":"circle_above","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_add_pt","args":[{"type":"circle"},{"type":"point"}],"returns":"circle"} +{"name":"circle_below","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_center","args":[{"type":"circle"}],"returns":"point"} +{"name":"circle_contain","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_contain_pt","args":[{"type":"circle"},{"type":"point"}],"returns":"boolean"} +{"name":"circle_contained","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_distance","args":[{"type":"circle"},{"type":"circle"}],"returns":"double precision"} +{"name":"circle_div_pt","args":[{"type":"circle"},{"type":"point"}],"returns":"circle"} +{"name":"circle_eq","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_ge","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_gt","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_in","args":[{"type":"cstring"}],"returns":"circle"} +{"name":"circle_le","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_left","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_lt","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_mul_pt","args":[{"type":"circle"},{"type":"point"}],"returns":"circle"} +{"name":"circle_ne","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_out","args":[{"type":"circle"}],"returns":"cstring"} +{"name":"circle_overabove","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_overbelow","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_overlap","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_overleft","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_overright","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_right","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_same","args":[{"type":"circle"},{"type":"circle"}],"returns":"boolean"} +{"name":"circle_send","args":[{"type":"circle"}],"returns":"bytea"} +{"name":"circle_sub_pt","args":[{"type":"circle"},{"type":"point"}],"returns":"circle"} +{"name":"clock_timestamp","returns":"timestamp with time zone"} +{"name":"close_ls","args":[{"type":"line"},{"type":"lseg"}],"returns":"point"} +{"name":"close_lseg","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"point"} +{"name":"close_pb","args":[{"type":"point"},{"type":"box"}],"returns":"point"} +{"name":"close_pl","args":[{"type":"point"},{"type":"line"}],"returns":"point"} +{"name":"close_ps","args":[{"type":"point"},{"type":"lseg"}],"returns":"point"} +{"name":"close_sb","args":[{"type":"lseg"},{"type":"box"}],"returns":"point"} +{"name":"col_description","args":[{"type":"oid"},{"type":"integer"}],"returns":"text"} +{"name":"concat_ws","args":[{"type":"text"},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"convert","args":[{"type":"bytea"},{"type":"name"},{"type":"name"}],"returns":"bytea"} +{"name":"convert_from","args":[{"type":"bytea"},{"type":"name"}],"returns":"text"} +{"name":"convert_to","args":[{"type":"text"},{"type":"name"}],"returns":"bytea"} +{"name":"corr","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"cos","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"cosd","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"cosh","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"cot","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"cotd","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"count","returns":"bigint"} +{"name":"count","args":[{"type":"any"}],"returns":"bigint"} +{"name":"covar_pop","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"covar_samp","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"cstring_in","args":[{"type":"cstring"}],"returns":"cstring"} +{"name":"cstring_out","args":[{"type":"cstring"}],"returns":"cstring"} +{"name":"cstring_send","args":[{"type":"cstring"}],"returns":"bytea"} +{"name":"cume_dist","returns":"double precision"} +{"name":"cume_dist","args":[{"type":"any","mode":"v"}],"returns":"double precision"} +{"name":"current_database","returns":"name"} +{"name":"current_query","returns":"text"} +{"name":"current_schema","returns":"name"} +{"name":"current_schemas","args":[{"type":"boolean"}],"returns":"name[]"} +{"name":"current_setting","args":[{"type":"text"}],"returns":"text"} +{"name":"current_setting","args":[{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"current_user","returns":"name"} +{"name":"currtid2","args":[{"type":"text"},{"type":"tid"}],"returns":"tid"} +{"name":"currval","args":[{"type":"regclass"}],"returns":"bigint"} +{"name":"cursor_to_xml","args":[{"name":"cursor","type":"refcursor"},{"name":"count","type":"integer"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"cursor_to_xmlschema","args":[{"name":"cursor","type":"refcursor"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"database_to_xml","args":[{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"database_to_xml_and_xmlschema","args":[{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"database_to_xmlschema","args":[{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"date","args":[{"type":"timestamp with time zone"}],"returns":"date"} +{"name":"date","args":[{"type":"timestamp without time zone"}],"returns":"date"} +{"name":"date_add","args":[{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"timestamp with time zone"} +{"name":"date_add","args":[{"type":"timestamp with time zone"},{"type":"interval"},{"type":"text"}],"returns":"timestamp with time zone"} +{"name":"date_bin","args":[{"type":"interval"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"date_bin","args":[{"type":"interval"},{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"timestamp without time zone"} +{"name":"date_cmp","args":[{"type":"date"},{"type":"date"}],"returns":"integer"} +{"name":"date_cmp_timestamp","args":[{"type":"date"},{"type":"timestamp without time zone"}],"returns":"integer"} +{"name":"date_cmp_timestamptz","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"integer"} +{"name":"date_eq","args":[{"type":"date"},{"type":"date"}],"returns":"boolean"} +{"name":"date_eq_timestamp","args":[{"type":"date"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"date_eq_timestamptz","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"date_ge","args":[{"type":"date"},{"type":"date"}],"returns":"boolean"} +{"name":"date_ge_timestamp","args":[{"type":"date"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"date_ge_timestamptz","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"date_gt","args":[{"type":"date"},{"type":"date"}],"returns":"boolean"} +{"name":"date_gt_timestamp","args":[{"type":"date"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"date_gt_timestamptz","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"date_in","args":[{"type":"cstring"}],"returns":"date"} +{"name":"date_larger","args":[{"type":"date"},{"type":"date"}],"returns":"date"} +{"name":"date_le","args":[{"type":"date"},{"type":"date"}],"returns":"boolean"} +{"name":"date_le_timestamp","args":[{"type":"date"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"date_le_timestamptz","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"date_lt","args":[{"type":"date"},{"type":"date"}],"returns":"boolean"} +{"name":"date_lt_timestamp","args":[{"type":"date"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"date_lt_timestamptz","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"date_mi","args":[{"type":"date"},{"type":"date"}],"returns":"integer"} +{"name":"date_mi_interval","args":[{"type":"date"},{"type":"interval"}],"returns":"timestamp without time zone"} +{"name":"date_mii","args":[{"type":"date"},{"type":"integer"}],"returns":"date"} +{"name":"date_ne","args":[{"type":"date"},{"type":"date"}],"returns":"boolean"} +{"name":"date_ne_timestamp","args":[{"type":"date"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"date_ne_timestamptz","args":[{"type":"date"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"date_out","args":[{"type":"date"}],"returns":"cstring"} +{"name":"date_part","args":[{"type":"text"},{"type":"date"}],"returns":"double precision"} +{"name":"date_part","args":[{"type":"text"},{"type":"interval"}],"returns":"double precision"} +{"name":"date_part","args":[{"type":"text"},{"type":"time with time zone"}],"returns":"double precision"} +{"name":"date_part","args":[{"type":"text"},{"type":"time without time zone"}],"returns":"double precision"} +{"name":"date_part","args":[{"type":"text"},{"type":"timestamp with time zone"}],"returns":"double precision"} +{"name":"date_part","args":[{"type":"text"},{"type":"timestamp without time zone"}],"returns":"double precision"} +{"name":"date_pl_interval","args":[{"type":"date"},{"type":"interval"}],"returns":"timestamp without time zone"} +{"name":"date_pli","args":[{"type":"date"},{"type":"integer"}],"returns":"date"} +{"name":"date_send","args":[{"type":"date"}],"returns":"bytea"} +{"name":"date_smaller","args":[{"type":"date"},{"type":"date"}],"returns":"date"} +{"name":"date_subtract","args":[{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"timestamp with time zone"} +{"name":"date_subtract","args":[{"type":"timestamp with time zone"},{"type":"interval"},{"type":"text"}],"returns":"timestamp with time zone"} +{"name":"date_trunc","args":[{"type":"text"},{"type":"interval"}],"returns":"interval"} +{"name":"date_trunc","args":[{"type":"text"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"date_trunc","args":[{"type":"text"},{"type":"timestamp with time zone"},{"type":"text"}],"returns":"timestamp with time zone"} +{"name":"date_trunc","args":[{"type":"text"},{"type":"timestamp without time zone"}],"returns":"timestamp without time zone"} +{"name":"datemultirange","returns":"datemultirange"} +{"name":"datemultirange","args":[{"type":"daterange"}],"returns":"datemultirange"} +{"name":"datemultirange","args":[{"type":"daterange[]","mode":"v"}],"returns":"datemultirange"} +{"name":"daterange","args":[{"type":"date"},{"type":"date"}],"returns":"daterange"} +{"name":"daterange","args":[{"type":"date"},{"type":"date"},{"type":"text"}],"returns":"daterange"} +{"name":"daterange_canonical","args":[{"type":"daterange"}],"returns":"daterange"} +{"name":"daterange_subdiff","args":[{"type":"date"},{"type":"date"}],"returns":"double precision"} +{"name":"datetime_pl","args":[{"type":"date"},{"type":"time without time zone"}],"returns":"timestamp without time zone"} +{"name":"datetimetz_pl","args":[{"type":"date"},{"type":"time with time zone"}],"returns":"timestamp with time zone"} +{"name":"dcbrt","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"decode","args":[{"type":"text"},{"type":"text"}],"returns":"bytea"} +{"name":"degrees","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"dense_rank","returns":"bigint"} +{"name":"dense_rank","args":[{"type":"any","mode":"v"}],"returns":"bigint"} +{"name":"dexp","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"diagonal","args":[{"type":"box"}],"returns":"lseg"} +{"name":"diameter","args":[{"type":"circle"}],"returns":"double precision"} +{"name":"dist_bp","args":[{"type":"box"},{"type":"point"}],"returns":"double precision"} +{"name":"dist_bs","args":[{"type":"box"},{"type":"lseg"}],"returns":"double precision"} +{"name":"dist_cpoint","args":[{"type":"circle"},{"type":"point"}],"returns":"double precision"} +{"name":"dist_cpoly","args":[{"type":"circle"},{"type":"polygon"}],"returns":"double precision"} +{"name":"dist_lp","args":[{"type":"line"},{"type":"point"}],"returns":"double precision"} +{"name":"dist_ls","args":[{"type":"line"},{"type":"lseg"}],"returns":"double precision"} +{"name":"dist_pathp","args":[{"type":"path"},{"type":"point"}],"returns":"double precision"} +{"name":"dist_pb","args":[{"type":"point"},{"type":"box"}],"returns":"double precision"} +{"name":"dist_pc","args":[{"type":"point"},{"type":"circle"}],"returns":"double precision"} +{"name":"dist_pl","args":[{"type":"point"},{"type":"line"}],"returns":"double precision"} +{"name":"dist_polyc","args":[{"type":"polygon"},{"type":"circle"}],"returns":"double precision"} +{"name":"dist_polyp","args":[{"type":"polygon"},{"type":"point"}],"returns":"double precision"} +{"name":"dist_ppath","args":[{"type":"point"},{"type":"path"}],"returns":"double precision"} +{"name":"dist_ppoly","args":[{"type":"point"},{"type":"polygon"}],"returns":"double precision"} +{"name":"dist_ps","args":[{"type":"point"},{"type":"lseg"}],"returns":"double precision"} +{"name":"dist_sb","args":[{"type":"lseg"},{"type":"box"}],"returns":"double precision"} +{"name":"dist_sl","args":[{"type":"lseg"},{"type":"line"}],"returns":"double precision"} +{"name":"dist_sp","args":[{"type":"lseg"},{"type":"point"}],"returns":"double precision"} +{"name":"div","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"dlog1","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"dlog10","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"domain_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"any"} +{"name":"dpow","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"dround","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"dsqrt","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"dtrunc","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"elem_contained_by_multirange","args":[{"type":"anyelement"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"elem_contained_by_range","args":[{"type":"anyelement"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"encode","args":[{"type":"bytea"},{"type":"text"}],"returns":"text"} +{"name":"enum_cmp","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"integer"} +{"name":"enum_eq","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"boolean"} +{"name":"enum_first","args":[{"type":"anyenum"}],"returns":"anyenum"} +{"name":"enum_ge","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"boolean"} +{"name":"enum_gt","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"boolean"} +{"name":"enum_in","args":[{"type":"cstring"},{"type":"oid"}],"returns":"anyenum"} +{"name":"enum_larger","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"anyenum"} +{"name":"enum_last","args":[{"type":"anyenum"}],"returns":"anyenum"} +{"name":"enum_le","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"boolean"} +{"name":"enum_lt","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"boolean"} +{"name":"enum_ne","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"boolean"} +{"name":"enum_out","args":[{"type":"anyenum"}],"returns":"cstring"} +{"name":"enum_range","args":[{"type":"anyenum"}],"returns":"anyarray"} +{"name":"enum_range","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"anyarray"} +{"name":"enum_send","args":[{"type":"anyenum"}],"returns":"bytea"} +{"name":"enum_smaller","args":[{"type":"anyenum"},{"type":"anyenum"}],"returns":"anyenum"} +{"name":"erf","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"erfc","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"event_trigger_in","args":[{"type":"cstring"}],"returns":"event_trigger"} +{"name":"event_trigger_out","args":[{"type":"event_trigger"}],"returns":"cstring"} +{"name":"every","args":[{"type":"boolean"}],"returns":"boolean"} +{"name":"exp","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"exp","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"extract","args":[{"type":"text"},{"type":"date"}],"returns":"numeric"} +{"name":"extract","args":[{"type":"text"},{"type":"interval"}],"returns":"numeric"} +{"name":"extract","args":[{"type":"text"},{"type":"time with time zone"}],"returns":"numeric"} +{"name":"extract","args":[{"type":"text"},{"type":"time without time zone"}],"returns":"numeric"} +{"name":"extract","args":[{"type":"text"},{"type":"timestamp with time zone"}],"returns":"numeric"} +{"name":"extract","args":[{"type":"text"},{"type":"timestamp without time zone"}],"returns":"numeric"} +{"name":"factorial","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"family","args":[{"type":"inet"}],"returns":"integer"} +{"name":"fdw_handler_in","args":[{"type":"cstring"}],"returns":"fdw_handler"} +{"name":"fdw_handler_out","args":[{"type":"fdw_handler"}],"returns":"cstring"} +{"name":"first_value","args":[{"type":"anyelement"}],"returns":"anyelement"} +{"name":"float4","args":[{"type":"bigint"}],"returns":"real"} +{"name":"float4","args":[{"type":"double precision"}],"returns":"real"} +{"name":"float4","args":[{"type":"integer"}],"returns":"real"} +{"name":"float4","args":[{"type":"jsonb"}],"returns":"real"} +{"name":"float4","args":[{"type":"numeric"}],"returns":"real"} +{"name":"float4","args":[{"type":"smallint"}],"returns":"real"} +{"name":"float48div","args":[{"type":"real"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float48eq","args":[{"type":"real"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float48ge","args":[{"type":"real"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float48gt","args":[{"type":"real"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float48le","args":[{"type":"real"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float48lt","args":[{"type":"real"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float48mi","args":[{"type":"real"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float48mul","args":[{"type":"real"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float48ne","args":[{"type":"real"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float48pl","args":[{"type":"real"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float4_accum","args":[{"type":"double precision[]"},{"type":"real"}],"returns":"double precision[]"} +{"name":"float4abs","args":[{"type":"real"}],"returns":"real"} +{"name":"float4div","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"float4eq","args":[{"type":"real"},{"type":"real"}],"returns":"boolean"} +{"name":"float4ge","args":[{"type":"real"},{"type":"real"}],"returns":"boolean"} +{"name":"float4gt","args":[{"type":"real"},{"type":"real"}],"returns":"boolean"} +{"name":"float4in","args":[{"type":"cstring"}],"returns":"real"} +{"name":"float4larger","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"float4le","args":[{"type":"real"},{"type":"real"}],"returns":"boolean"} +{"name":"float4lt","args":[{"type":"real"},{"type":"real"}],"returns":"boolean"} +{"name":"float4mi","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"float4mul","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"float4ne","args":[{"type":"real"},{"type":"real"}],"returns":"boolean"} +{"name":"float4out","args":[{"type":"real"}],"returns":"cstring"} +{"name":"float4pl","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"float4send","args":[{"type":"real"}],"returns":"bytea"} +{"name":"float4smaller","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"float4um","args":[{"type":"real"}],"returns":"real"} +{"name":"float4up","args":[{"type":"real"}],"returns":"real"} +{"name":"float8","args":[{"type":"bigint"}],"returns":"double precision"} +{"name":"float8","args":[{"type":"integer"}],"returns":"double precision"} +{"name":"float8","args":[{"type":"jsonb"}],"returns":"double precision"} +{"name":"float8","args":[{"type":"numeric"}],"returns":"double precision"} +{"name":"float8","args":[{"type":"real"}],"returns":"double precision"} +{"name":"float8","args":[{"type":"smallint"}],"returns":"double precision"} +{"name":"float84div","args":[{"type":"double precision"},{"type":"real"}],"returns":"double precision"} +{"name":"float84eq","args":[{"type":"double precision"},{"type":"real"}],"returns":"boolean"} +{"name":"float84ge","args":[{"type":"double precision"},{"type":"real"}],"returns":"boolean"} +{"name":"float84gt","args":[{"type":"double precision"},{"type":"real"}],"returns":"boolean"} +{"name":"float84le","args":[{"type":"double precision"},{"type":"real"}],"returns":"boolean"} +{"name":"float84lt","args":[{"type":"double precision"},{"type":"real"}],"returns":"boolean"} +{"name":"float84mi","args":[{"type":"double precision"},{"type":"real"}],"returns":"double precision"} +{"name":"float84mul","args":[{"type":"double precision"},{"type":"real"}],"returns":"double precision"} +{"name":"float84ne","args":[{"type":"double precision"},{"type":"real"}],"returns":"boolean"} +{"name":"float84pl","args":[{"type":"double precision"},{"type":"real"}],"returns":"double precision"} +{"name":"float8_accum","args":[{"type":"double precision[]"},{"type":"double precision"}],"returns":"double precision[]"} +{"name":"float8_avg","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_combine","args":[{"type":"double precision[]"},{"type":"double precision[]"}],"returns":"double precision[]"} +{"name":"float8_corr","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_covar_pop","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_covar_samp","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_regr_accum","args":[{"type":"double precision[]"},{"type":"double precision"},{"type":"double precision"}],"returns":"double precision[]"} +{"name":"float8_regr_avgx","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_regr_avgy","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_regr_combine","args":[{"type":"double precision[]"},{"type":"double precision[]"}],"returns":"double precision[]"} +{"name":"float8_regr_intercept","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_regr_r2","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_regr_slope","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_regr_sxx","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_regr_sxy","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_regr_syy","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_stddev_pop","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_stddev_samp","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_var_pop","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8_var_samp","args":[{"type":"double precision[]"}],"returns":"double precision"} +{"name":"float8abs","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"float8div","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float8eq","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float8ge","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float8gt","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float8in","args":[{"type":"cstring"}],"returns":"double precision"} +{"name":"float8larger","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float8le","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float8lt","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float8mi","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float8mul","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float8ne","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"boolean"} +{"name":"float8out","args":[{"type":"double precision"}],"returns":"cstring"} +{"name":"float8pl","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float8send","args":[{"type":"double precision"}],"returns":"bytea"} +{"name":"float8smaller","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"float8um","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"float8up","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"floor","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"floor","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"flt4_mul_cash","args":[{"type":"real"},{"type":"money"}],"returns":"money"} +{"name":"flt8_mul_cash","args":[{"type":"double precision"},{"type":"money"}],"returns":"money"} +{"name":"fmgr_c_validator","args":[{"type":"oid"}],"returns":"void"} +{"name":"fmgr_internal_validator","args":[{"type":"oid"}],"returns":"void"} +{"name":"fmgr_sql_validator","args":[{"type":"oid"}],"returns":"void"} +{"name":"format","args":[{"type":"text"}],"returns":"text"} +{"name":"format","args":[{"type":"text"},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"format_type","args":[{"type":"oid"},{"type":"integer"}],"returns":"text"} +{"name":"gcd","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"gcd","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"gcd","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"gen_random_uuid","returns":"uuid"} +{"name":"generate_series","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"generate_series","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"generate_series","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"generate_series","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"generate_series","args":[{"type":"integer"},{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"generate_series","args":[{"type":"numeric"},{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"generate_series","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"timestamp with time zone"} +{"name":"generate_series","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"interval"},{"type":"text"}],"returns":"timestamp with time zone"} +{"name":"generate_series","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"},{"type":"interval"}],"returns":"timestamp without time zone"} +{"name":"generate_subscripts","args":[{"type":"anyarray"},{"type":"integer"}],"returns":"integer"} +{"name":"generate_subscripts","args":[{"type":"anyarray"},{"type":"integer"},{"type":"boolean"}],"returns":"integer"} +{"name":"get_bit","args":[{"type":"bit"},{"type":"integer"}],"returns":"integer"} +{"name":"get_bit","args":[{"type":"bytea"},{"type":"bigint"}],"returns":"integer"} +{"name":"get_byte","args":[{"type":"bytea"},{"type":"integer"}],"returns":"integer"} +{"name":"get_current_ts_config","returns":"regconfig"} +{"name":"getdatabaseencoding","returns":"name"} +{"name":"getpgusername","returns":"name"} +{"name":"gin_clean_pending_list","args":[{"type":"regclass"}],"returns":"bigint"} +{"name":"gin_cmp_tslexeme","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"gin_compare_jsonb","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"gtsvectorin","args":[{"type":"cstring"}],"returns":"gtsvector"} +{"name":"gtsvectorout","args":[{"type":"gtsvector"}],"returns":"cstring"} +{"name":"has_any_column_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_any_column_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_any_column_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_any_column_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_any_column_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_any_column_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"smallint"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"name"},{"type":"text"},{"type":"smallint"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"smallint"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"oid"},{"type":"smallint"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"smallint"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"text"},{"type":"smallint"},{"type":"text"}],"returns":"boolean"} +{"name":"has_column_privilege","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_database_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_database_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_database_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_database_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_database_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_database_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_foreign_data_wrapper_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_foreign_data_wrapper_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_foreign_data_wrapper_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_foreign_data_wrapper_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_foreign_data_wrapper_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_foreign_data_wrapper_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_function_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_function_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_function_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_function_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_function_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_function_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_language_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_language_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_language_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_language_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_language_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_language_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_parameter_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_parameter_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_parameter_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_schema_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_schema_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_schema_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_schema_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_schema_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_schema_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_sequence_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_sequence_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_sequence_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_sequence_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_sequence_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_sequence_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_server_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_server_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_server_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_server_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_server_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_server_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_table_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_table_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_table_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_table_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_table_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_table_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_tablespace_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_tablespace_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_tablespace_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_tablespace_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_tablespace_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_tablespace_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_type_privilege","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_type_privilege","args":[{"type":"name"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_type_privilege","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_type_privilege","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"has_type_privilege","args":[{"type":"oid"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"has_type_privilege","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"hash_aclitem","args":[{"type":"aclitem"}],"returns":"integer"} +{"name":"hash_aclitem_extended","args":[{"type":"aclitem"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hash_array","args":[{"type":"anyarray"}],"returns":"integer"} +{"name":"hash_array_extended","args":[{"type":"anyarray"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hash_multirange","args":[{"type":"anymultirange"}],"returns":"integer"} +{"name":"hash_multirange_extended","args":[{"type":"anymultirange"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hash_numeric","args":[{"type":"numeric"}],"returns":"integer"} +{"name":"hash_numeric_extended","args":[{"type":"numeric"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hash_range","args":[{"type":"anyrange"}],"returns":"integer"} +{"name":"hash_range_extended","args":[{"type":"anyrange"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hash_record","args":[{"type":"record"}],"returns":"integer"} +{"name":"hash_record_extended","args":[{"type":"record"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashbpchar","args":[{"type":"character"}],"returns":"integer"} +{"name":"hashbpcharextended","args":[{"type":"character"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashchar","args":[{"type":"char"}],"returns":"integer"} +{"name":"hashcharextended","args":[{"type":"char"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashenum","args":[{"type":"anyenum"}],"returns":"integer"} +{"name":"hashenumextended","args":[{"type":"anyenum"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashfloat4","args":[{"type":"real"}],"returns":"integer"} +{"name":"hashfloat4extended","args":[{"type":"real"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashfloat8","args":[{"type":"double precision"}],"returns":"integer"} +{"name":"hashfloat8extended","args":[{"type":"double precision"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashinet","args":[{"type":"inet"}],"returns":"integer"} +{"name":"hashinetextended","args":[{"type":"inet"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashint2","args":[{"type":"smallint"}],"returns":"integer"} +{"name":"hashint2extended","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashint4","args":[{"type":"integer"}],"returns":"integer"} +{"name":"hashint4extended","args":[{"type":"integer"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashint8","args":[{"type":"bigint"}],"returns":"integer"} +{"name":"hashint8extended","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashmacaddr","args":[{"type":"macaddr"}],"returns":"integer"} +{"name":"hashmacaddr8","args":[{"type":"macaddr8"}],"returns":"integer"} +{"name":"hashmacaddr8extended","args":[{"type":"macaddr8"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashmacaddrextended","args":[{"type":"macaddr"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashname","args":[{"type":"name"}],"returns":"integer"} +{"name":"hashnameextended","args":[{"type":"name"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashoid","args":[{"type":"oid"}],"returns":"integer"} +{"name":"hashoidextended","args":[{"type":"oid"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashoidvector","args":[{"type":"oidvector"}],"returns":"integer"} +{"name":"hashoidvectorextended","args":[{"type":"oidvector"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashtext","args":[{"type":"text"}],"returns":"integer"} +{"name":"hashtextextended","args":[{"type":"text"},{"type":"bigint"}],"returns":"bigint"} +{"name":"hashtid","args":[{"type":"tid"}],"returns":"integer"} +{"name":"hashtidextended","args":[{"type":"tid"},{"type":"bigint"}],"returns":"bigint"} +{"name":"height","args":[{"type":"box"}],"returns":"double precision"} +{"name":"host","args":[{"type":"inet"}],"returns":"text"} +{"name":"hostmask","args":[{"type":"inet"}],"returns":"inet"} +{"name":"in_range","args":[{"type":"bigint"},{"type":"bigint"},{"type":"bigint"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"date"},{"type":"date"},{"type":"interval"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"double precision"},{"type":"double precision"},{"type":"double precision"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"integer"},{"type":"integer"},{"type":"bigint"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"integer"},{"type":"integer"},{"type":"integer"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"integer"},{"type":"integer"},{"type":"smallint"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"interval"},{"type":"interval"},{"type":"interval"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"numeric"},{"type":"numeric"},{"type":"numeric"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"real"},{"type":"real"},{"type":"double precision"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"smallint"},{"type":"smallint"},{"type":"bigint"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"smallint"},{"type":"smallint"},{"type":"integer"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"smallint"},{"type":"smallint"},{"type":"smallint"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"time with time zone"},{"type":"time with time zone"},{"type":"interval"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"time without time zone"},{"type":"time without time zone"},{"type":"interval"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"interval"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"in_range","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"},{"type":"interval"},{"type":"boolean"},{"type":"boolean"}],"returns":"boolean"} +{"name":"index_am_handler_in","args":[{"type":"cstring"}],"returns":"index_am_handler"} +{"name":"index_am_handler_out","args":[{"type":"index_am_handler"}],"returns":"cstring"} +{"name":"inet_client_addr","returns":"inet"} +{"name":"inet_client_port","returns":"integer"} +{"name":"inet_in","args":[{"type":"cstring"}],"returns":"inet"} +{"name":"inet_merge","args":[{"type":"inet"},{"type":"inet"}],"returns":"cidr"} +{"name":"inet_out","args":[{"type":"inet"}],"returns":"cstring"} +{"name":"inet_same_family","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"inet_send","args":[{"type":"inet"}],"returns":"bytea"} +{"name":"inet_server_addr","returns":"inet"} +{"name":"inet_server_port","returns":"integer"} +{"name":"inetand","args":[{"type":"inet"},{"type":"inet"}],"returns":"inet"} +{"name":"inetmi","args":[{"type":"inet"},{"type":"inet"}],"returns":"bigint"} +{"name":"inetmi_int8","args":[{"type":"inet"},{"type":"bigint"}],"returns":"inet"} +{"name":"inetnot","args":[{"type":"inet"}],"returns":"inet"} +{"name":"inetor","args":[{"type":"inet"},{"type":"inet"}],"returns":"inet"} +{"name":"inetpl","args":[{"type":"inet"},{"type":"bigint"}],"returns":"inet"} +{"name":"initcap","args":[{"type":"text"}],"returns":"text"} +{"name":"int2","args":[{"type":"bigint"}],"returns":"smallint"} +{"name":"int2","args":[{"type":"double precision"}],"returns":"smallint"} +{"name":"int2","args":[{"type":"integer"}],"returns":"smallint"} +{"name":"int2","args":[{"type":"jsonb"}],"returns":"smallint"} +{"name":"int2","args":[{"type":"numeric"}],"returns":"smallint"} +{"name":"int2","args":[{"type":"real"}],"returns":"smallint"} +{"name":"int24div","args":[{"type":"smallint"},{"type":"integer"}],"returns":"integer"} +{"name":"int24eq","args":[{"type":"smallint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int24ge","args":[{"type":"smallint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int24gt","args":[{"type":"smallint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int24le","args":[{"type":"smallint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int24lt","args":[{"type":"smallint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int24mi","args":[{"type":"smallint"},{"type":"integer"}],"returns":"integer"} +{"name":"int24mul","args":[{"type":"smallint"},{"type":"integer"}],"returns":"integer"} +{"name":"int24ne","args":[{"type":"smallint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int24pl","args":[{"type":"smallint"},{"type":"integer"}],"returns":"integer"} +{"name":"int28div","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int28eq","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int28ge","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int28gt","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int28le","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int28lt","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int28mi","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int28mul","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int28ne","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int28pl","args":[{"type":"smallint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int2_avg_accum","args":[{"type":"bigint[]"},{"type":"smallint"}],"returns":"bigint[]"} +{"name":"int2_avg_accum_inv","args":[{"type":"bigint[]"},{"type":"smallint"}],"returns":"bigint[]"} +{"name":"int2_mul_cash","args":[{"type":"smallint"},{"type":"money"}],"returns":"money"} +{"name":"int2_sum","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"bigint"} +{"name":"int2abs","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"int2and","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2div","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2eq","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int2ge","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int2gt","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int2in","args":[{"type":"cstring"}],"returns":"smallint"} +{"name":"int2int4_sum","args":[{"type":"bigint[]"}],"returns":"bigint"} +{"name":"int2larger","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2le","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int2lt","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int2mi","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2mod","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2mul","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2ne","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int2not","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"int2or","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2out","args":[{"type":"smallint"}],"returns":"cstring"} +{"name":"int2pl","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2send","args":[{"type":"smallint"}],"returns":"bytea"} +{"name":"int2shl","args":[{"type":"smallint"},{"type":"integer"}],"returns":"smallint"} +{"name":"int2shr","args":[{"type":"smallint"},{"type":"integer"}],"returns":"smallint"} +{"name":"int2smaller","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int2um","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"int2up","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"int2vectorin","args":[{"type":"cstring"}],"returns":"int2vector"} +{"name":"int2vectorout","args":[{"type":"int2vector"}],"returns":"cstring"} +{"name":"int2vectorsend","args":[{"type":"int2vector"}],"returns":"bytea"} +{"name":"int2xor","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"int4","args":[{"type":"char"}],"returns":"integer"} +{"name":"int4","args":[{"type":"bigint"}],"returns":"integer"} +{"name":"int4","args":[{"type":"bit"}],"returns":"integer"} +{"name":"int4","args":[{"type":"boolean"}],"returns":"integer"} +{"name":"int4","args":[{"type":"double precision"}],"returns":"integer"} +{"name":"int4","args":[{"type":"jsonb"}],"returns":"integer"} +{"name":"int4","args":[{"type":"numeric"}],"returns":"integer"} +{"name":"int4","args":[{"type":"real"}],"returns":"integer"} +{"name":"int4","args":[{"type":"smallint"}],"returns":"integer"} +{"name":"int42div","args":[{"type":"integer"},{"type":"smallint"}],"returns":"integer"} +{"name":"int42eq","args":[{"type":"integer"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int42ge","args":[{"type":"integer"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int42gt","args":[{"type":"integer"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int42le","args":[{"type":"integer"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int42lt","args":[{"type":"integer"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int42mi","args":[{"type":"integer"},{"type":"smallint"}],"returns":"integer"} +{"name":"int42mul","args":[{"type":"integer"},{"type":"smallint"}],"returns":"integer"} +{"name":"int42ne","args":[{"type":"integer"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int42pl","args":[{"type":"integer"},{"type":"smallint"}],"returns":"integer"} +{"name":"int48div","args":[{"type":"integer"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int48eq","args":[{"type":"integer"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int48ge","args":[{"type":"integer"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int48gt","args":[{"type":"integer"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int48le","args":[{"type":"integer"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int48lt","args":[{"type":"integer"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int48mi","args":[{"type":"integer"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int48mul","args":[{"type":"integer"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int48ne","args":[{"type":"integer"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int48pl","args":[{"type":"integer"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int4_avg_accum","args":[{"type":"bigint[]"},{"type":"integer"}],"returns":"bigint[]"} +{"name":"int4_avg_accum_inv","args":[{"type":"bigint[]"},{"type":"integer"}],"returns":"bigint[]"} +{"name":"int4_avg_combine","args":[{"type":"bigint[]"},{"type":"bigint[]"}],"returns":"bigint[]"} +{"name":"int4_mul_cash","args":[{"type":"integer"},{"type":"money"}],"returns":"money"} +{"name":"int4_sum","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"int4abs","args":[{"type":"integer"}],"returns":"integer"} +{"name":"int4and","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4div","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4eq","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"int4ge","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"int4gt","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"int4in","args":[{"type":"cstring"}],"returns":"integer"} +{"name":"int4inc","args":[{"type":"integer"}],"returns":"integer"} +{"name":"int4larger","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4le","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"int4lt","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"int4mi","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4mod","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4mul","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4multirange","returns":"int4multirange"} +{"name":"int4multirange","args":[{"type":"int4range"}],"returns":"int4multirange"} +{"name":"int4multirange","args":[{"type":"int4range[]","mode":"v"}],"returns":"int4multirange"} +{"name":"int4ne","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"int4not","args":[{"type":"integer"}],"returns":"integer"} +{"name":"int4or","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4out","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"int4pl","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4range","args":[{"type":"integer"},{"type":"integer"}],"returns":"int4range"} +{"name":"int4range","args":[{"type":"integer"},{"type":"integer"},{"type":"text"}],"returns":"int4range"} +{"name":"int4range_canonical","args":[{"type":"int4range"}],"returns":"int4range"} +{"name":"int4range_subdiff","args":[{"type":"integer"},{"type":"integer"}],"returns":"double precision"} +{"name":"int4send","args":[{"type":"integer"}],"returns":"bytea"} +{"name":"int4shl","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4shr","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4smaller","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int4um","args":[{"type":"integer"}],"returns":"integer"} +{"name":"int4up","args":[{"type":"integer"}],"returns":"integer"} +{"name":"int4xor","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"int8","args":[{"type":"bit"}],"returns":"bigint"} +{"name":"int8","args":[{"type":"double precision"}],"returns":"bigint"} +{"name":"int8","args":[{"type":"integer"}],"returns":"bigint"} +{"name":"int8","args":[{"type":"jsonb"}],"returns":"bigint"} +{"name":"int8","args":[{"type":"numeric"}],"returns":"bigint"} +{"name":"int8","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"int8","args":[{"type":"real"}],"returns":"bigint"} +{"name":"int8","args":[{"type":"smallint"}],"returns":"bigint"} +{"name":"int82div","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"bigint"} +{"name":"int82eq","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int82ge","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int82gt","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int82le","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int82lt","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int82mi","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"bigint"} +{"name":"int82mul","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"bigint"} +{"name":"int82ne","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"boolean"} +{"name":"int82pl","args":[{"type":"bigint"},{"type":"smallint"}],"returns":"bigint"} +{"name":"int84div","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"int84eq","args":[{"type":"bigint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int84ge","args":[{"type":"bigint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int84gt","args":[{"type":"bigint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int84le","args":[{"type":"bigint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int84lt","args":[{"type":"bigint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int84mi","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"int84mul","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"int84ne","args":[{"type":"bigint"},{"type":"integer"}],"returns":"boolean"} +{"name":"int84pl","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"int8_avg","args":[{"type":"bigint[]"}],"returns":"numeric"} +{"name":"int8_mul_cash","args":[{"type":"bigint"},{"type":"money"}],"returns":"money"} +{"name":"int8_sum","args":[{"type":"numeric"},{"type":"bigint"}],"returns":"numeric"} +{"name":"int8abs","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"int8and","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8dec","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"int8dec_any","args":[{"type":"bigint"},{"type":"any"}],"returns":"bigint"} +{"name":"int8div","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8eq","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int8ge","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int8gt","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int8in","args":[{"type":"cstring"}],"returns":"bigint"} +{"name":"int8inc","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"int8inc_any","args":[{"type":"bigint"},{"type":"any"}],"returns":"bigint"} +{"name":"int8inc_float8_float8","args":[{"type":"bigint"},{"type":"double precision"},{"type":"double precision"}],"returns":"bigint"} +{"name":"int8larger","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8le","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int8lt","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int8mi","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8mod","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8mul","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8multirange","returns":"int8multirange"} +{"name":"int8multirange","args":[{"type":"int8range"}],"returns":"int8multirange"} +{"name":"int8multirange","args":[{"type":"int8range[]","mode":"v"}],"returns":"int8multirange"} +{"name":"int8ne","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"boolean"} +{"name":"int8not","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"int8or","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8out","args":[{"type":"bigint"}],"returns":"cstring"} +{"name":"int8pl","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8pl_inet","args":[{"type":"bigint"},{"type":"inet"}],"returns":"inet"} +{"name":"int8range","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"int8range"} +{"name":"int8range","args":[{"type":"bigint"},{"type":"bigint"},{"type":"text"}],"returns":"int8range"} +{"name":"int8range_canonical","args":[{"type":"int8range"}],"returns":"int8range"} +{"name":"int8range_subdiff","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"double precision"} +{"name":"int8send","args":[{"type":"bigint"}],"returns":"bytea"} +{"name":"int8shl","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"int8shr","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"int8smaller","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"int8um","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"int8up","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"int8xor","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"integer_pl_date","args":[{"type":"integer"},{"type":"date"}],"returns":"date"} +{"name":"inter_lb","args":[{"type":"line"},{"type":"box"}],"returns":"boolean"} +{"name":"inter_sb","args":[{"type":"lseg"},{"type":"box"}],"returns":"boolean"} +{"name":"inter_sl","args":[{"type":"lseg"},{"type":"line"}],"returns":"boolean"} +{"name":"interval","args":[{"type":"interval"},{"type":"integer"}],"returns":"interval"} +{"name":"interval","args":[{"type":"time without time zone"}],"returns":"interval"} +{"name":"interval_accum","args":[{"type":"interval[]"},{"type":"interval"}],"returns":"interval[]"} +{"name":"interval_accum_inv","args":[{"type":"interval[]"},{"type":"interval"}],"returns":"interval[]"} +{"name":"interval_avg","args":[{"type":"interval[]"}],"returns":"interval"} +{"name":"interval_cmp","args":[{"type":"interval"},{"type":"interval"}],"returns":"integer"} +{"name":"interval_combine","args":[{"type":"interval[]"},{"type":"interval[]"}],"returns":"interval[]"} +{"name":"interval_div","args":[{"type":"interval"},{"type":"double precision"}],"returns":"interval"} +{"name":"interval_eq","args":[{"type":"interval"},{"type":"interval"}],"returns":"boolean"} +{"name":"interval_ge","args":[{"type":"interval"},{"type":"interval"}],"returns":"boolean"} +{"name":"interval_gt","args":[{"type":"interval"},{"type":"interval"}],"returns":"boolean"} +{"name":"interval_hash","args":[{"type":"interval"}],"returns":"integer"} +{"name":"interval_hash_extended","args":[{"type":"interval"},{"type":"bigint"}],"returns":"bigint"} +{"name":"interval_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"interval"} +{"name":"interval_larger","args":[{"type":"interval"},{"type":"interval"}],"returns":"interval"} +{"name":"interval_le","args":[{"type":"interval"},{"type":"interval"}],"returns":"boolean"} +{"name":"interval_lt","args":[{"type":"interval"},{"type":"interval"}],"returns":"boolean"} +{"name":"interval_mi","args":[{"type":"interval"},{"type":"interval"}],"returns":"interval"} +{"name":"interval_mul","args":[{"type":"interval"},{"type":"double precision"}],"returns":"interval"} +{"name":"interval_ne","args":[{"type":"interval"},{"type":"interval"}],"returns":"boolean"} +{"name":"interval_out","args":[{"type":"interval"}],"returns":"cstring"} +{"name":"interval_pl","args":[{"type":"interval"},{"type":"interval"}],"returns":"interval"} +{"name":"interval_pl_date","args":[{"type":"interval"},{"type":"date"}],"returns":"timestamp without time zone"} +{"name":"interval_pl_time","args":[{"type":"interval"},{"type":"time without time zone"}],"returns":"time without time zone"} +{"name":"interval_pl_timestamp","args":[{"type":"interval"},{"type":"timestamp without time zone"}],"returns":"timestamp without time zone"} +{"name":"interval_pl_timestamptz","args":[{"type":"interval"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"interval_pl_timetz","args":[{"type":"interval"},{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"interval_send","args":[{"type":"interval"}],"returns":"bytea"} +{"name":"interval_smaller","args":[{"type":"interval"},{"type":"interval"}],"returns":"interval"} +{"name":"interval_um","args":[{"type":"interval"}],"returns":"interval"} +{"name":"intervaltypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"intervaltypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"is_normalized","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"isclosed","args":[{"type":"path"}],"returns":"boolean"} +{"name":"isempty","args":[{"type":"anymultirange"}],"returns":"boolean"} +{"name":"isempty","args":[{"type":"anyrange"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"date"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"interval"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"isfinite","args":[{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"ishorizontal","args":[{"type":"line"}],"returns":"boolean"} +{"name":"ishorizontal","args":[{"type":"lseg"}],"returns":"boolean"} +{"name":"ishorizontal","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"isopen","args":[{"type":"path"}],"returns":"boolean"} +{"name":"isparallel","args":[{"type":"line"},{"type":"line"}],"returns":"boolean"} +{"name":"isparallel","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"isperp","args":[{"type":"line"},{"type":"line"}],"returns":"boolean"} +{"name":"isperp","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"isvertical","args":[{"type":"line"}],"returns":"boolean"} +{"name":"isvertical","args":[{"type":"lseg"}],"returns":"boolean"} +{"name":"isvertical","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"json_agg","args":[{"type":"anyelement"}],"returns":"json"} +{"name":"json_agg_strict","args":[{"type":"anyelement"}],"returns":"json"} +{"name":"json_array_element","args":[{"name":"from_json","type":"json"},{"name":"element_index","type":"integer"}],"returns":"json"} +{"name":"json_array_element_text","args":[{"name":"from_json","type":"json"},{"name":"element_index","type":"integer"}],"returns":"text"} +{"name":"json_array_elements","args":[{"name":"from_json","type":"json"}],"returns":"json"} +{"name":"json_array_elements_text","args":[{"name":"from_json","type":"json"}],"returns":"text"} +{"name":"json_array_length","args":[{"type":"json"}],"returns":"integer"} +{"name":"json_build_array","returns":"json"} +{"name":"json_build_array","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"json_build_object","returns":"json"} +{"name":"json_build_object","args":[{"type":"any","mode":"v"}],"returns":"json"} +{"name":"json_each","args":[{"name":"from_json","type":"json"}],"returns":"record"} +{"name":"json_each_text","args":[{"name":"from_json","type":"json"}],"returns":"record"} +{"name":"json_extract_path","args":[{"name":"from_json","type":"json"},{"name":"path_elems","type":"text[]","mode":"v"}],"returns":"json"} +{"name":"json_extract_path_text","args":[{"name":"from_json","type":"json"},{"name":"path_elems","type":"text[]","mode":"v"}],"returns":"text"} +{"name":"json_in","args":[{"type":"cstring"}],"returns":"json"} +{"name":"json_object","args":[{"type":"text[]"}],"returns":"json"} +{"name":"json_object","args":[{"type":"text[]"},{"type":"text[]"}],"returns":"json"} +{"name":"json_object_agg","args":[{"type":"any"},{"type":"any"}],"returns":"json"} +{"name":"json_object_agg_strict","args":[{"type":"any"},{"type":"any"}],"returns":"json"} +{"name":"json_object_agg_unique","args":[{"type":"any"},{"type":"any"}],"returns":"json"} +{"name":"json_object_agg_unique_strict","args":[{"type":"any"},{"type":"any"}],"returns":"json"} +{"name":"json_object_field","args":[{"name":"from_json","type":"json"},{"name":"field_name","type":"text"}],"returns":"json"} +{"name":"json_object_field_text","args":[{"name":"from_json","type":"json"},{"name":"field_name","type":"text"}],"returns":"text"} +{"name":"json_object_keys","args":[{"type":"json"}],"returns":"text"} +{"name":"json_out","args":[{"type":"json"}],"returns":"cstring"} +{"name":"json_populate_record","args":[{"name":"base","type":"anyelement"},{"name":"from_json","type":"json"},{"name":"use_json_as_text","type":"boolean","has_default":true}],"returns":"anyelement"} +{"name":"json_populate_recordset","args":[{"name":"base","type":"anyelement"},{"name":"from_json","type":"json"},{"name":"use_json_as_text","type":"boolean","has_default":true}],"returns":"anyelement"} +{"name":"json_send","args":[{"type":"json"}],"returns":"bytea"} +{"name":"json_strip_nulls","args":[{"type":"json"}],"returns":"json"} +{"name":"json_to_record","args":[{"type":"json"}],"returns":"record"} +{"name":"json_to_recordset","args":[{"type":"json"}],"returns":"record"} +{"name":"json_to_tsvector","args":[{"type":"json"},{"type":"jsonb"}],"returns":"tsvector"} +{"name":"json_to_tsvector","args":[{"type":"regconfig"},{"type":"json"},{"type":"jsonb"}],"returns":"tsvector"} +{"name":"json_typeof","args":[{"type":"json"}],"returns":"text"} +{"name":"jsonb_agg","args":[{"type":"anyelement"}],"returns":"jsonb"} +{"name":"jsonb_agg_strict","args":[{"type":"anyelement"}],"returns":"jsonb"} +{"name":"jsonb_array_element","args":[{"name":"from_json","type":"jsonb"},{"name":"element_index","type":"integer"}],"returns":"jsonb"} +{"name":"jsonb_array_element_text","args":[{"name":"from_json","type":"jsonb"},{"name":"element_index","type":"integer"}],"returns":"text"} +{"name":"jsonb_array_elements","args":[{"name":"from_json","type":"jsonb"}],"returns":"jsonb"} +{"name":"jsonb_array_elements_text","args":[{"name":"from_json","type":"jsonb"}],"returns":"text"} +{"name":"jsonb_array_length","args":[{"type":"jsonb"}],"returns":"integer"} +{"name":"jsonb_build_array","returns":"jsonb"} +{"name":"jsonb_build_array","args":[{"type":"any","mode":"v"}],"returns":"jsonb"} +{"name":"jsonb_build_object","returns":"jsonb"} +{"name":"jsonb_build_object","args":[{"type":"any","mode":"v"}],"returns":"jsonb"} +{"name":"jsonb_cmp","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"integer"} +{"name":"jsonb_concat","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"jsonb"} +{"name":"jsonb_contained","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"boolean"} +{"name":"jsonb_contains","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"boolean"} +{"name":"jsonb_delete","args":[{"type":"jsonb"},{"type":"integer"}],"returns":"jsonb"} +{"name":"jsonb_delete","args":[{"type":"jsonb"},{"type":"text"}],"returns":"jsonb"} +{"name":"jsonb_delete","args":[{"name":"from_json","type":"jsonb"},{"name":"path_elems","type":"text[]","mode":"v"}],"returns":"jsonb"} +{"name":"jsonb_delete_path","args":[{"type":"jsonb"},{"type":"text[]"}],"returns":"jsonb"} +{"name":"jsonb_each","args":[{"name":"from_json","type":"jsonb"}],"returns":"record"} +{"name":"jsonb_each_text","args":[{"name":"from_json","type":"jsonb"}],"returns":"record"} +{"name":"jsonb_eq","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"boolean"} +{"name":"jsonb_exists","args":[{"type":"jsonb"},{"type":"text"}],"returns":"boolean"} +{"name":"jsonb_exists_all","args":[{"type":"jsonb"},{"type":"text[]"}],"returns":"boolean"} +{"name":"jsonb_exists_any","args":[{"type":"jsonb"},{"type":"text[]"}],"returns":"boolean"} +{"name":"jsonb_extract_path","args":[{"name":"from_json","type":"jsonb"},{"name":"path_elems","type":"text[]","mode":"v"}],"returns":"jsonb"} +{"name":"jsonb_extract_path_text","args":[{"name":"from_json","type":"jsonb"},{"name":"path_elems","type":"text[]","mode":"v"}],"returns":"text"} +{"name":"jsonb_ge","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"boolean"} +{"name":"jsonb_gt","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"boolean"} +{"name":"jsonb_hash","args":[{"type":"jsonb"}],"returns":"integer"} +{"name":"jsonb_hash_extended","args":[{"type":"jsonb"},{"type":"bigint"}],"returns":"bigint"} +{"name":"jsonb_in","args":[{"type":"cstring"}],"returns":"jsonb"} +{"name":"jsonb_insert","args":[{"name":"jsonb_in","type":"jsonb"},{"name":"path","type":"text[]"},{"name":"replacement","type":"jsonb"},{"name":"insert_after","type":"boolean","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_le","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"boolean"} +{"name":"jsonb_lt","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"boolean"} +{"name":"jsonb_ne","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"boolean"} +{"name":"jsonb_object","args":[{"type":"text[]"}],"returns":"jsonb"} +{"name":"jsonb_object","args":[{"type":"text[]"},{"type":"text[]"}],"returns":"jsonb"} +{"name":"jsonb_object_agg","args":[{"type":"any"},{"type":"any"}],"returns":"jsonb"} +{"name":"jsonb_object_agg_strict","args":[{"type":"any"},{"type":"any"}],"returns":"jsonb"} +{"name":"jsonb_object_agg_unique","args":[{"type":"any"},{"type":"any"}],"returns":"jsonb"} +{"name":"jsonb_object_agg_unique_strict","args":[{"type":"any"},{"type":"any"}],"returns":"jsonb"} +{"name":"jsonb_object_field","args":[{"name":"from_json","type":"jsonb"},{"name":"field_name","type":"text"}],"returns":"jsonb"} +{"name":"jsonb_object_field_text","args":[{"name":"from_json","type":"jsonb"},{"name":"field_name","type":"text"}],"returns":"text"} +{"name":"jsonb_object_keys","args":[{"type":"jsonb"}],"returns":"text"} +{"name":"jsonb_out","args":[{"type":"jsonb"}],"returns":"cstring"} +{"name":"jsonb_path_exists","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"boolean"} +{"name":"jsonb_path_exists_opr","args":[{"type":"jsonb"},{"type":"jsonpath"}],"returns":"boolean"} +{"name":"jsonb_path_exists_tz","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"boolean"} +{"name":"jsonb_path_match","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"boolean"} +{"name":"jsonb_path_match_opr","args":[{"type":"jsonb"},{"type":"jsonpath"}],"returns":"boolean"} +{"name":"jsonb_path_match_tz","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"boolean"} +{"name":"jsonb_path_query","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_path_query_array","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_path_query_array_tz","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_path_query_first","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_path_query_first_tz","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_path_query_tz","args":[{"name":"target","type":"jsonb"},{"name":"path","type":"jsonpath"},{"name":"vars","type":"jsonb","has_default":true},{"name":"silent","type":"boolean","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_populate_record","args":[{"type":"anyelement"},{"type":"jsonb"}],"returns":"anyelement"} +{"name":"jsonb_populate_recordset","args":[{"type":"anyelement"},{"type":"jsonb"}],"returns":"anyelement"} +{"name":"jsonb_pretty","args":[{"type":"jsonb"}],"returns":"text"} +{"name":"jsonb_send","args":[{"type":"jsonb"}],"returns":"bytea"} +{"name":"jsonb_set","args":[{"name":"jsonb_in","type":"jsonb"},{"name":"path","type":"text[]"},{"name":"replacement","type":"jsonb"},{"name":"create_if_missing","type":"boolean","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_set_lax","args":[{"name":"jsonb_in","type":"jsonb"},{"name":"path","type":"text[]"},{"name":"replacement","type":"jsonb"},{"name":"create_if_missing","type":"boolean","has_default":true},{"name":"null_value_treatment","type":"text","has_default":true}],"returns":"jsonb"} +{"name":"jsonb_strip_nulls","args":[{"type":"jsonb"}],"returns":"jsonb"} +{"name":"jsonb_to_record","args":[{"type":"jsonb"}],"returns":"record"} +{"name":"jsonb_to_recordset","args":[{"type":"jsonb"}],"returns":"record"} +{"name":"jsonb_to_tsvector","args":[{"type":"jsonb"},{"type":"jsonb"}],"returns":"tsvector"} +{"name":"jsonb_to_tsvector","args":[{"type":"regconfig"},{"type":"jsonb"},{"type":"jsonb"}],"returns":"tsvector"} +{"name":"jsonb_typeof","args":[{"type":"jsonb"}],"returns":"text"} +{"name":"jsonpath_in","args":[{"type":"cstring"}],"returns":"jsonpath"} +{"name":"jsonpath_out","args":[{"type":"jsonpath"}],"returns":"cstring"} +{"name":"jsonpath_send","args":[{"type":"jsonpath"}],"returns":"bytea"} +{"name":"justify_days","args":[{"type":"interval"}],"returns":"interval"} +{"name":"justify_hours","args":[{"type":"interval"}],"returns":"interval"} +{"name":"justify_interval","args":[{"type":"interval"}],"returns":"interval"} +{"name":"lag","args":[{"type":"anycompatible"},{"type":"integer"},{"type":"anycompatible"}],"returns":"anycompatible"} +{"name":"lag","args":[{"type":"anyelement"}],"returns":"anyelement"} +{"name":"lag","args":[{"type":"anyelement"},{"type":"integer"}],"returns":"anyelement"} +{"name":"language_handler_in","args":[{"type":"cstring"}],"returns":"language_handler"} +{"name":"language_handler_out","args":[{"type":"language_handler"}],"returns":"cstring"} +{"name":"last_value","args":[{"type":"anyelement"}],"returns":"anyelement"} +{"name":"lastval","returns":"bigint"} +{"name":"lcm","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"lcm","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"lcm","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"lead","args":[{"type":"anycompatible"},{"type":"integer"},{"type":"anycompatible"}],"returns":"anycompatible"} +{"name":"lead","args":[{"type":"anyelement"}],"returns":"anyelement"} +{"name":"lead","args":[{"type":"anyelement"},{"type":"integer"}],"returns":"anyelement"} +{"name":"left","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"length","args":[{"type":"lseg"}],"returns":"double precision"} +{"name":"length","args":[{"type":"path"}],"returns":"double precision"} +{"name":"length","args":[{"type":"bit"}],"returns":"integer"} +{"name":"length","args":[{"type":"bytea"}],"returns":"integer"} +{"name":"length","args":[{"type":"bytea"},{"type":"name"}],"returns":"integer"} +{"name":"length","args":[{"type":"character"}],"returns":"integer"} +{"name":"length","args":[{"type":"text"}],"returns":"integer"} +{"name":"length","args":[{"type":"tsvector"}],"returns":"integer"} +{"name":"like","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"like","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"like","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"like_escape","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"bytea"} +{"name":"like_escape","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"line","args":[{"type":"point"},{"type":"point"}],"returns":"line"} +{"name":"line_distance","args":[{"type":"line"},{"type":"line"}],"returns":"double precision"} +{"name":"line_eq","args":[{"type":"line"},{"type":"line"}],"returns":"boolean"} +{"name":"line_horizontal","args":[{"type":"line"}],"returns":"boolean"} +{"name":"line_in","args":[{"type":"cstring"}],"returns":"line"} +{"name":"line_interpt","args":[{"type":"line"},{"type":"line"}],"returns":"point"} +{"name":"line_intersect","args":[{"type":"line"},{"type":"line"}],"returns":"boolean"} +{"name":"line_out","args":[{"type":"line"}],"returns":"cstring"} +{"name":"line_parallel","args":[{"type":"line"},{"type":"line"}],"returns":"boolean"} +{"name":"line_perp","args":[{"type":"line"},{"type":"line"}],"returns":"boolean"} +{"name":"line_send","args":[{"type":"line"}],"returns":"bytea"} +{"name":"line_vertical","args":[{"type":"line"}],"returns":"boolean"} +{"name":"ln","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"ln","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"lo_close","args":[{"type":"integer"}],"returns":"integer"} +{"name":"lo_creat","args":[{"type":"integer"}],"returns":"oid"} +{"name":"lo_create","args":[{"type":"oid"}],"returns":"oid"} +{"name":"lo_export","args":[{"type":"oid"},{"type":"text"}],"returns":"integer"} +{"name":"lo_from_bytea","args":[{"type":"oid"},{"type":"bytea"}],"returns":"oid"} +{"name":"lo_get","args":[{"type":"oid"}],"returns":"bytea"} +{"name":"lo_get","args":[{"type":"oid"},{"type":"bigint"},{"type":"integer"}],"returns":"bytea"} +{"name":"lo_import","args":[{"type":"text"}],"returns":"oid"} +{"name":"lo_import","args":[{"type":"text"},{"type":"oid"}],"returns":"oid"} +{"name":"lo_lseek","args":[{"type":"integer"},{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"lo_lseek64","args":[{"type":"integer"},{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"lo_open","args":[{"type":"oid"},{"type":"integer"}],"returns":"integer"} +{"name":"lo_put","args":[{"type":"oid"},{"type":"bigint"},{"type":"bytea"}],"returns":"void"} +{"name":"lo_tell","args":[{"type":"integer"}],"returns":"integer"} +{"name":"lo_tell64","args":[{"type":"integer"}],"returns":"bigint"} +{"name":"lo_truncate","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"lo_truncate64","args":[{"type":"integer"},{"type":"bigint"}],"returns":"integer"} +{"name":"lo_unlink","args":[{"type":"oid"}],"returns":"integer"} +{"name":"log","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"log","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"log","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"log10","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"log10","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"loread","args":[{"type":"integer"},{"type":"integer"}],"returns":"bytea"} +{"name":"lower","args":[{"type":"text"}],"returns":"text"} +{"name":"lower","args":[{"type":"anymultirange"}],"returns":"anyelement"} +{"name":"lower","args":[{"type":"anyrange"}],"returns":"anyelement"} +{"name":"lower_inc","args":[{"type":"anymultirange"}],"returns":"boolean"} +{"name":"lower_inc","args":[{"type":"anyrange"}],"returns":"boolean"} +{"name":"lower_inf","args":[{"type":"anymultirange"}],"returns":"boolean"} +{"name":"lower_inf","args":[{"type":"anyrange"}],"returns":"boolean"} +{"name":"lowrite","args":[{"type":"integer"},{"type":"bytea"}],"returns":"integer"} +{"name":"lpad","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"lpad","args":[{"type":"text"},{"type":"integer"},{"type":"text"}],"returns":"text"} +{"name":"lseg","args":[{"type":"box"}],"returns":"lseg"} +{"name":"lseg","args":[{"type":"point"},{"type":"point"}],"returns":"lseg"} +{"name":"lseg_center","args":[{"type":"lseg"}],"returns":"point"} +{"name":"lseg_distance","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"double precision"} +{"name":"lseg_eq","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_ge","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_gt","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_horizontal","args":[{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_in","args":[{"type":"cstring"}],"returns":"lseg"} +{"name":"lseg_interpt","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"point"} +{"name":"lseg_intersect","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_le","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_length","args":[{"type":"lseg"}],"returns":"double precision"} +{"name":"lseg_lt","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_ne","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_out","args":[{"type":"lseg"}],"returns":"cstring"} +{"name":"lseg_parallel","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_perp","args":[{"type":"lseg"},{"type":"lseg"}],"returns":"boolean"} +{"name":"lseg_send","args":[{"type":"lseg"}],"returns":"bytea"} +{"name":"lseg_vertical","args":[{"type":"lseg"}],"returns":"boolean"} +{"name":"ltrim","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"bytea"} +{"name":"ltrim","args":[{"type":"text"}],"returns":"text"} +{"name":"ltrim","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"macaddr","args":[{"type":"macaddr8"}],"returns":"macaddr"} +{"name":"macaddr8","args":[{"type":"macaddr"}],"returns":"macaddr8"} +{"name":"macaddr8_and","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"macaddr8"} +{"name":"macaddr8_cmp","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"integer"} +{"name":"macaddr8_eq","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"boolean"} +{"name":"macaddr8_ge","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"boolean"} +{"name":"macaddr8_gt","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"boolean"} +{"name":"macaddr8_in","args":[{"type":"cstring"}],"returns":"macaddr8"} +{"name":"macaddr8_le","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"boolean"} +{"name":"macaddr8_lt","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"boolean"} +{"name":"macaddr8_ne","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"boolean"} +{"name":"macaddr8_not","args":[{"type":"macaddr8"}],"returns":"macaddr8"} +{"name":"macaddr8_or","args":[{"type":"macaddr8"},{"type":"macaddr8"}],"returns":"macaddr8"} +{"name":"macaddr8_out","args":[{"type":"macaddr8"}],"returns":"cstring"} +{"name":"macaddr8_send","args":[{"type":"macaddr8"}],"returns":"bytea"} +{"name":"macaddr8_set7bit","args":[{"type":"macaddr8"}],"returns":"macaddr8"} +{"name":"macaddr_and","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"macaddr"} +{"name":"macaddr_cmp","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"integer"} +{"name":"macaddr_eq","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"boolean"} +{"name":"macaddr_ge","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"boolean"} +{"name":"macaddr_gt","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"boolean"} +{"name":"macaddr_in","args":[{"type":"cstring"}],"returns":"macaddr"} +{"name":"macaddr_le","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"boolean"} +{"name":"macaddr_lt","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"boolean"} +{"name":"macaddr_ne","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"boolean"} +{"name":"macaddr_not","args":[{"type":"macaddr"}],"returns":"macaddr"} +{"name":"macaddr_or","args":[{"type":"macaddr"},{"type":"macaddr"}],"returns":"macaddr"} +{"name":"macaddr_out","args":[{"type":"macaddr"}],"returns":"cstring"} +{"name":"macaddr_send","args":[{"type":"macaddr"}],"returns":"bytea"} +{"name":"make_date","args":[{"name":"year","type":"integer"},{"name":"month","type":"integer"},{"name":"day","type":"integer"}],"returns":"date"} +{"name":"make_interval","args":[{"name":"years","type":"integer","has_default":true},{"name":"months","type":"integer","has_default":true},{"name":"weeks","type":"integer","has_default":true},{"name":"days","type":"integer","has_default":true},{"name":"hours","type":"integer","has_default":true},{"name":"mins","type":"integer","has_default":true},{"name":"secs","type":"double precision","has_default":true}],"returns":"interval"} +{"name":"make_time","args":[{"name":"hour","type":"integer"},{"name":"min","type":"integer"},{"name":"sec","type":"double precision"}],"returns":"time without time zone"} +{"name":"make_timestamp","args":[{"name":"year","type":"integer"},{"name":"month","type":"integer"},{"name":"mday","type":"integer"},{"name":"hour","type":"integer"},{"name":"min","type":"integer"},{"name":"sec","type":"double precision"}],"returns":"timestamp without time zone"} +{"name":"make_timestamptz","args":[{"name":"year","type":"integer"},{"name":"month","type":"integer"},{"name":"mday","type":"integer"},{"name":"hour","type":"integer"},{"name":"min","type":"integer"},{"name":"sec","type":"double precision"}],"returns":"timestamp with time zone"} +{"name":"make_timestamptz","args":[{"name":"year","type":"integer"},{"name":"month","type":"integer"},{"name":"mday","type":"integer"},{"name":"hour","type":"integer"},{"name":"min","type":"integer"},{"name":"sec","type":"double precision"},{"name":"timezone","type":"text"}],"returns":"timestamp with time zone"} +{"name":"makeaclitem","args":[{"type":"oid"},{"type":"oid"},{"type":"text"},{"type":"boolean"}],"returns":"aclitem"} +{"name":"masklen","args":[{"type":"inet"}],"returns":"integer"} +{"name":"max","args":[{"type":"anyarray"}],"returns":"anyarray"} +{"name":"max","args":[{"type":"anyenum"}],"returns":"anyenum"} +{"name":"max","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"max","args":[{"type":"character"}],"returns":"character"} +{"name":"max","args":[{"type":"date"}],"returns":"date"} +{"name":"max","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"max","args":[{"type":"inet"}],"returns":"inet"} +{"name":"max","args":[{"type":"integer"}],"returns":"integer"} +{"name":"max","args":[{"type":"interval"}],"returns":"interval"} +{"name":"max","args":[{"type":"money"}],"returns":"money"} +{"name":"max","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"max","args":[{"type":"oid"}],"returns":"oid"} +{"name":"max","args":[{"type":"pg_lsn"}],"returns":"pg_lsn"} +{"name":"max","args":[{"type":"real"}],"returns":"real"} +{"name":"max","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"max","args":[{"type":"text"}],"returns":"text"} +{"name":"max","args":[{"type":"tid"}],"returns":"tid"} +{"name":"max","args":[{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"max","args":[{"type":"time without time zone"}],"returns":"time without time zone"} +{"name":"max","args":[{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"max","args":[{"type":"timestamp without time zone"}],"returns":"timestamp without time zone"} +{"name":"max","args":[{"type":"xid8"}],"returns":"xid8"} +{"name":"md5","args":[{"type":"bytea"}],"returns":"text"} +{"name":"md5","args":[{"type":"text"}],"returns":"text"} +{"name":"min","args":[{"type":"anyarray"}],"returns":"anyarray"} +{"name":"min","args":[{"type":"anyenum"}],"returns":"anyenum"} +{"name":"min","args":[{"type":"bigint"}],"returns":"bigint"} +{"name":"min","args":[{"type":"character"}],"returns":"character"} +{"name":"min","args":[{"type":"date"}],"returns":"date"} +{"name":"min","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"min","args":[{"type":"inet"}],"returns":"inet"} +{"name":"min","args":[{"type":"integer"}],"returns":"integer"} +{"name":"min","args":[{"type":"interval"}],"returns":"interval"} +{"name":"min","args":[{"type":"money"}],"returns":"money"} +{"name":"min","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"min","args":[{"type":"oid"}],"returns":"oid"} +{"name":"min","args":[{"type":"pg_lsn"}],"returns":"pg_lsn"} +{"name":"min","args":[{"type":"real"}],"returns":"real"} +{"name":"min","args":[{"type":"smallint"}],"returns":"smallint"} +{"name":"min","args":[{"type":"text"}],"returns":"text"} +{"name":"min","args":[{"type":"tid"}],"returns":"tid"} +{"name":"min","args":[{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"min","args":[{"type":"time without time zone"}],"returns":"time without time zone"} +{"name":"min","args":[{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"min","args":[{"type":"timestamp without time zone"}],"returns":"timestamp without time zone"} +{"name":"min","args":[{"type":"xid8"}],"returns":"xid8"} +{"name":"min_scale","args":[{"type":"numeric"}],"returns":"integer"} +{"name":"mod","args":[{"type":"bigint"},{"type":"bigint"}],"returns":"bigint"} +{"name":"mod","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"mod","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"mod","args":[{"type":"smallint"},{"type":"smallint"}],"returns":"smallint"} +{"name":"mode","returns":"anyelement"} +{"name":"money","args":[{"type":"bigint"}],"returns":"money"} +{"name":"money","args":[{"type":"integer"}],"returns":"money"} +{"name":"money","args":[{"type":"numeric"}],"returns":"money"} +{"name":"mul_d_interval","args":[{"type":"double precision"},{"type":"interval"}],"returns":"interval"} +{"name":"multirange","args":[{"type":"anyrange"}],"returns":"anymultirange"} +{"name":"multirange_adjacent_multirange","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_adjacent_range","args":[{"type":"anymultirange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"multirange_after_multirange","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_after_range","args":[{"type":"anymultirange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"multirange_before_multirange","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_before_range","args":[{"type":"anymultirange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"multirange_cmp","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"integer"} +{"name":"multirange_contained_by_multirange","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_contained_by_range","args":[{"type":"anymultirange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"multirange_contains_elem","args":[{"type":"anymultirange"},{"type":"anyelement"}],"returns":"boolean"} +{"name":"multirange_contains_multirange","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_contains_range","args":[{"type":"anymultirange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"multirange_eq","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_ge","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_gt","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"anymultirange"} +{"name":"multirange_intersect","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"anymultirange"} +{"name":"multirange_intersect_agg_transfn","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"anymultirange"} +{"name":"multirange_le","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_lt","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_minus","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"anymultirange"} +{"name":"multirange_ne","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_out","args":[{"type":"anymultirange"}],"returns":"cstring"} +{"name":"multirange_overlaps_multirange","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_overlaps_range","args":[{"type":"anymultirange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"multirange_overleft_multirange","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_overleft_range","args":[{"type":"anymultirange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"multirange_overright_multirange","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"multirange_overright_range","args":[{"type":"anymultirange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"multirange_send","args":[{"type":"anymultirange"}],"returns":"bytea"} +{"name":"multirange_union","args":[{"type":"anymultirange"},{"type":"anymultirange"}],"returns":"anymultirange"} +{"name":"mxid_age","args":[{"type":"xid"}],"returns":"integer"} +{"name":"name","args":[{"type":"character"}],"returns":"name"} +{"name":"name","args":[{"type":"character varying"}],"returns":"name"} +{"name":"name","args":[{"type":"text"}],"returns":"name"} +{"name":"nameconcatoid","args":[{"type":"name"},{"type":"oid"}],"returns":"name"} +{"name":"nameeq","args":[{"type":"name"},{"type":"name"}],"returns":"boolean"} +{"name":"nameeqtext","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"namege","args":[{"type":"name"},{"type":"name"}],"returns":"boolean"} +{"name":"namegetext","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"namegt","args":[{"type":"name"},{"type":"name"}],"returns":"boolean"} +{"name":"namegttext","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"nameiclike","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"nameicnlike","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"nameicregexeq","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"nameicregexne","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"namein","args":[{"type":"cstring"}],"returns":"name"} +{"name":"namele","args":[{"type":"name"},{"type":"name"}],"returns":"boolean"} +{"name":"nameletext","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"namelike","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"namelt","args":[{"type":"name"},{"type":"name"}],"returns":"boolean"} +{"name":"namelttext","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"namene","args":[{"type":"name"},{"type":"name"}],"returns":"boolean"} +{"name":"namenetext","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"namenlike","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"nameout","args":[{"type":"name"}],"returns":"cstring"} +{"name":"nameregexeq","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"nameregexne","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"namesend","args":[{"type":"name"}],"returns":"bytea"} +{"name":"netmask","args":[{"type":"inet"}],"returns":"inet"} +{"name":"network","args":[{"type":"inet"}],"returns":"cidr"} +{"name":"network_cmp","args":[{"type":"inet"},{"type":"inet"}],"returns":"integer"} +{"name":"network_eq","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_ge","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_gt","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_larger","args":[{"type":"inet"},{"type":"inet"}],"returns":"inet"} +{"name":"network_le","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_lt","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_ne","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_overlap","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_smaller","args":[{"type":"inet"},{"type":"inet"}],"returns":"inet"} +{"name":"network_sub","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_subeq","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_sup","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"network_supeq","args":[{"type":"inet"},{"type":"inet"}],"returns":"boolean"} +{"name":"nextval","args":[{"type":"regclass"}],"returns":"bigint"} +{"name":"normalize","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"notlike","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"boolean"} +{"name":"notlike","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"notlike","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"now","returns":"timestamp with time zone"} +{"name":"npoints","args":[{"type":"path"}],"returns":"integer"} +{"name":"npoints","args":[{"type":"polygon"}],"returns":"integer"} +{"name":"nth_value","args":[{"type":"anyelement"},{"type":"integer"}],"returns":"anyelement"} +{"name":"ntile","args":[{"type":"integer"}],"returns":"integer"} +{"name":"num_nonnulls","args":[{"type":"any","mode":"v"}],"returns":"integer"} +{"name":"num_nulls","args":[{"type":"any","mode":"v"}],"returns":"integer"} +{"name":"numeric","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"numeric","args":[{"type":"double precision"}],"returns":"numeric"} +{"name":"numeric","args":[{"type":"integer"}],"returns":"numeric"} +{"name":"numeric","args":[{"type":"jsonb"}],"returns":"numeric"} +{"name":"numeric","args":[{"type":"money"}],"returns":"numeric"} +{"name":"numeric","args":[{"type":"numeric"},{"type":"integer"}],"returns":"numeric"} +{"name":"numeric","args":[{"type":"real"}],"returns":"numeric"} +{"name":"numeric","args":[{"type":"smallint"}],"returns":"numeric"} +{"name":"numeric_abs","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_add","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_cmp","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"integer"} +{"name":"numeric_div","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_div_trunc","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_eq","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"boolean"} +{"name":"numeric_exp","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_ge","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"boolean"} +{"name":"numeric_gt","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"boolean"} +{"name":"numeric_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"numeric"} +{"name":"numeric_inc","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_larger","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_le","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"boolean"} +{"name":"numeric_ln","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_log","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_lt","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"boolean"} +{"name":"numeric_mod","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_mul","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_ne","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"boolean"} +{"name":"numeric_out","args":[{"type":"numeric"}],"returns":"cstring"} +{"name":"numeric_pl_pg_lsn","args":[{"type":"numeric"},{"type":"pg_lsn"}],"returns":"pg_lsn"} +{"name":"numeric_power","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_send","args":[{"type":"numeric"}],"returns":"bytea"} +{"name":"numeric_smaller","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_sqrt","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_sub","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_uminus","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"numeric_uplus","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"numerictypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"numerictypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"nummultirange","returns":"nummultirange"} +{"name":"nummultirange","args":[{"type":"numrange"}],"returns":"nummultirange"} +{"name":"nummultirange","args":[{"type":"numrange[]","mode":"v"}],"returns":"nummultirange"} +{"name":"numnode","args":[{"type":"tsquery"}],"returns":"integer"} +{"name":"numrange","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numrange"} +{"name":"numrange","args":[{"type":"numeric"},{"type":"numeric"},{"type":"text"}],"returns":"numrange"} +{"name":"numrange_subdiff","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"double precision"} +{"name":"obj_description","args":[{"type":"oid"}],"returns":"text"} +{"name":"obj_description","args":[{"type":"oid"},{"type":"name"}],"returns":"text"} +{"name":"octet_length","args":[{"type":"bit"}],"returns":"integer"} +{"name":"octet_length","args":[{"type":"bytea"}],"returns":"integer"} +{"name":"octet_length","args":[{"type":"character"}],"returns":"integer"} +{"name":"octet_length","args":[{"type":"text"}],"returns":"integer"} +{"name":"oid","args":[{"type":"bigint"}],"returns":"oid"} +{"name":"oideq","args":[{"type":"oid"},{"type":"oid"}],"returns":"boolean"} +{"name":"oidge","args":[{"type":"oid"},{"type":"oid"}],"returns":"boolean"} +{"name":"oidgt","args":[{"type":"oid"},{"type":"oid"}],"returns":"boolean"} +{"name":"oidin","args":[{"type":"cstring"}],"returns":"oid"} +{"name":"oidlarger","args":[{"type":"oid"},{"type":"oid"}],"returns":"oid"} +{"name":"oidle","args":[{"type":"oid"},{"type":"oid"}],"returns":"boolean"} +{"name":"oidlt","args":[{"type":"oid"},{"type":"oid"}],"returns":"boolean"} +{"name":"oidne","args":[{"type":"oid"},{"type":"oid"}],"returns":"boolean"} +{"name":"oidout","args":[{"type":"oid"}],"returns":"cstring"} +{"name":"oidsend","args":[{"type":"oid"}],"returns":"bytea"} +{"name":"oidsmaller","args":[{"type":"oid"},{"type":"oid"}],"returns":"oid"} +{"name":"oidvectoreq","args":[{"type":"oidvector"},{"type":"oidvector"}],"returns":"boolean"} +{"name":"oidvectorge","args":[{"type":"oidvector"},{"type":"oidvector"}],"returns":"boolean"} +{"name":"oidvectorgt","args":[{"type":"oidvector"},{"type":"oidvector"}],"returns":"boolean"} +{"name":"oidvectorin","args":[{"type":"cstring"}],"returns":"oidvector"} +{"name":"oidvectorle","args":[{"type":"oidvector"},{"type":"oidvector"}],"returns":"boolean"} +{"name":"oidvectorlt","args":[{"type":"oidvector"},{"type":"oidvector"}],"returns":"boolean"} +{"name":"oidvectorne","args":[{"type":"oidvector"},{"type":"oidvector"}],"returns":"boolean"} +{"name":"oidvectorout","args":[{"type":"oidvector"}],"returns":"cstring"} +{"name":"oidvectorsend","args":[{"type":"oidvector"}],"returns":"bytea"} +{"name":"oidvectortypes","args":[{"type":"oidvector"}],"returns":"text"} +{"name":"on_pb","args":[{"type":"point"},{"type":"box"}],"returns":"boolean"} +{"name":"on_pl","args":[{"type":"point"},{"type":"line"}],"returns":"boolean"} +{"name":"on_ppath","args":[{"type":"point"},{"type":"path"}],"returns":"boolean"} +{"name":"on_ps","args":[{"type":"point"},{"type":"lseg"}],"returns":"boolean"} +{"name":"on_sb","args":[{"type":"lseg"},{"type":"box"}],"returns":"boolean"} +{"name":"on_sl","args":[{"type":"lseg"},{"type":"line"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"time with time zone"},{"type":"time with time zone"},{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"time without time zone"},{"type":"interval"},{"type":"time without time zone"},{"type":"interval"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"time without time zone"},{"type":"interval"},{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"time without time zone"},{"type":"time without time zone"},{"type":"time without time zone"},{"type":"interval"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"time without time zone"},{"type":"time without time zone"},{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"timestamp with time zone"},{"type":"interval"},{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"timestamp with time zone"},{"type":"interval"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"timestamp without time zone"},{"type":"interval"},{"type":"timestamp without time zone"},{"type":"interval"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"timestamp without time zone"},{"type":"interval"},{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"},{"type":"timestamp without time zone"},{"type":"interval"}],"returns":"boolean"} +{"name":"overlaps","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"},{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"overlay","args":[{"type":"bit"},{"type":"bit"},{"type":"integer"}],"returns":"bit"} +{"name":"overlay","args":[{"type":"bit"},{"type":"bit"},{"type":"integer"},{"type":"integer"}],"returns":"bit"} +{"name":"overlay","args":[{"type":"bytea"},{"type":"bytea"},{"type":"integer"}],"returns":"bytea"} +{"name":"overlay","args":[{"type":"bytea"},{"type":"bytea"},{"type":"integer"},{"type":"integer"}],"returns":"bytea"} +{"name":"overlay","args":[{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"overlay","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"}],"returns":"text"} +{"name":"parse_ident","args":[{"name":"str","type":"text"},{"name":"strict","type":"boolean","has_default":true}],"returns":"text[]"} +{"name":"path","args":[{"type":"polygon"}],"returns":"path"} +{"name":"path_add","args":[{"type":"path"},{"type":"path"}],"returns":"path"} +{"name":"path_add_pt","args":[{"type":"path"},{"type":"point"}],"returns":"path"} +{"name":"path_contain_pt","args":[{"type":"path"},{"type":"point"}],"returns":"boolean"} +{"name":"path_distance","args":[{"type":"path"},{"type":"path"}],"returns":"double precision"} +{"name":"path_div_pt","args":[{"type":"path"},{"type":"point"}],"returns":"path"} +{"name":"path_in","args":[{"type":"cstring"}],"returns":"path"} +{"name":"path_inter","args":[{"type":"path"},{"type":"path"}],"returns":"boolean"} +{"name":"path_length","args":[{"type":"path"}],"returns":"double precision"} +{"name":"path_mul_pt","args":[{"type":"path"},{"type":"point"}],"returns":"path"} +{"name":"path_n_eq","args":[{"type":"path"},{"type":"path"}],"returns":"boolean"} +{"name":"path_n_ge","args":[{"type":"path"},{"type":"path"}],"returns":"boolean"} +{"name":"path_n_gt","args":[{"type":"path"},{"type":"path"}],"returns":"boolean"} +{"name":"path_n_le","args":[{"type":"path"},{"type":"path"}],"returns":"boolean"} +{"name":"path_n_lt","args":[{"type":"path"},{"type":"path"}],"returns":"boolean"} +{"name":"path_npoints","args":[{"type":"path"}],"returns":"integer"} +{"name":"path_out","args":[{"type":"path"}],"returns":"cstring"} +{"name":"path_send","args":[{"type":"path"}],"returns":"bytea"} +{"name":"path_sub_pt","args":[{"type":"path"},{"type":"point"}],"returns":"path"} +{"name":"pclose","args":[{"type":"path"}],"returns":"path"} +{"name":"percent_rank","returns":"double precision"} +{"name":"percent_rank","args":[{"type":"any","mode":"v"}],"returns":"double precision"} +{"name":"percentile_cont","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"percentile_cont","args":[{"type":"double precision[]"}],"returns":"double precision[]"} +{"name":"percentile_cont","args":[{"type":"double precision"}],"returns":"interval"} +{"name":"percentile_cont","args":[{"type":"double precision[]"}],"returns":"interval[]"} +{"name":"percentile_disc","args":[{"type":"double precision[]"}],"returns":"anyarray"} +{"name":"percentile_disc","args":[{"type":"double precision"}],"returns":"anyelement"} +{"name":"pg_advisory_lock","args":[{"type":"bigint"}],"returns":"void"} +{"name":"pg_advisory_lock","args":[{"type":"integer"},{"type":"integer"}],"returns":"void"} +{"name":"pg_advisory_lock_shared","args":[{"type":"bigint"}],"returns":"void"} +{"name":"pg_advisory_lock_shared","args":[{"type":"integer"},{"type":"integer"}],"returns":"void"} +{"name":"pg_advisory_unlock","args":[{"type":"bigint"}],"returns":"boolean"} +{"name":"pg_advisory_unlock","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"pg_advisory_unlock_all","returns":"void"} +{"name":"pg_advisory_unlock_shared","args":[{"type":"bigint"}],"returns":"boolean"} +{"name":"pg_advisory_unlock_shared","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"pg_advisory_xact_lock","args":[{"type":"bigint"}],"returns":"void"} +{"name":"pg_advisory_xact_lock","args":[{"type":"integer"},{"type":"integer"}],"returns":"void"} +{"name":"pg_advisory_xact_lock_shared","args":[{"type":"bigint"}],"returns":"void"} +{"name":"pg_advisory_xact_lock_shared","args":[{"type":"integer"},{"type":"integer"}],"returns":"void"} +{"name":"pg_available_extension_versions","returns":"record"} +{"name":"pg_available_extensions","returns":"record"} +{"name":"pg_backend_pid","returns":"integer"} +{"name":"pg_backup_start","args":[{"name":"label","type":"text"},{"name":"fast","type":"boolean","has_default":true}],"returns":"pg_lsn"} +{"name":"pg_backup_stop","args":[{"name":"wait_for_archive","type":"boolean","has_default":true}],"returns":"record"} +{"name":"pg_blocking_pids","args":[{"type":"integer"}],"returns":"integer[]"} +{"name":"pg_cancel_backend","args":[{"type":"integer"}],"returns":"boolean"} +{"name":"pg_char_to_encoding","args":[{"type":"name"}],"returns":"integer"} +{"name":"pg_client_encoding","returns":"name"} +{"name":"pg_collation_actual_version","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_collation_for","args":[{"type":"any"}],"returns":"text"} +{"name":"pg_collation_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_column_compression","args":[{"type":"any"}],"returns":"text"} +{"name":"pg_column_is_updatable","args":[{"type":"regclass"},{"type":"smallint"},{"type":"boolean"}],"returns":"boolean"} +{"name":"pg_column_size","args":[{"type":"any"}],"returns":"integer"} +{"name":"pg_conf_load_time","returns":"timestamp with time zone"} +{"name":"pg_config","returns":"record"} +{"name":"pg_control_checkpoint","returns":"record"} +{"name":"pg_control_init","returns":"record"} +{"name":"pg_control_recovery","returns":"record"} +{"name":"pg_control_system","returns":"record"} +{"name":"pg_conversion_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_copy_logical_replication_slot","args":[{"name":"src_slot_name","type":"name"},{"name":"dst_slot_name","type":"name"}],"returns":"record"} +{"name":"pg_copy_logical_replication_slot","args":[{"name":"src_slot_name","type":"name"},{"name":"dst_slot_name","type":"name"},{"name":"temporary","type":"boolean"}],"returns":"record"} +{"name":"pg_copy_logical_replication_slot","args":[{"name":"src_slot_name","type":"name"},{"name":"dst_slot_name","type":"name"},{"name":"temporary","type":"boolean"},{"name":"plugin","type":"name"}],"returns":"record"} +{"name":"pg_copy_physical_replication_slot","args":[{"name":"src_slot_name","type":"name"},{"name":"dst_slot_name","type":"name"}],"returns":"record"} +{"name":"pg_copy_physical_replication_slot","args":[{"name":"src_slot_name","type":"name"},{"name":"dst_slot_name","type":"name"},{"name":"temporary","type":"boolean"}],"returns":"record"} +{"name":"pg_create_logical_replication_slot","args":[{"name":"slot_name","type":"name"},{"name":"plugin","type":"name"},{"name":"temporary","type":"boolean","has_default":true},{"name":"twophase","type":"boolean","has_default":true}],"returns":"record"} +{"name":"pg_create_physical_replication_slot","args":[{"name":"slot_name","type":"name"},{"name":"immediately_reserve","type":"boolean","has_default":true},{"name":"temporary","type":"boolean","has_default":true}],"returns":"record"} +{"name":"pg_create_restore_point","args":[{"type":"text"}],"returns":"pg_lsn"} +{"name":"pg_current_logfile","returns":"text"} +{"name":"pg_current_logfile","args":[{"type":"text"}],"returns":"text"} +{"name":"pg_current_snapshot","returns":"pg_snapshot"} +{"name":"pg_current_wal_flush_lsn","returns":"pg_lsn"} +{"name":"pg_current_wal_insert_lsn","returns":"pg_lsn"} +{"name":"pg_current_wal_lsn","returns":"pg_lsn"} +{"name":"pg_current_xact_id","returns":"xid8"} +{"name":"pg_current_xact_id_if_assigned","returns":"xid8"} +{"name":"pg_cursor","returns":"record"} +{"name":"pg_database_collation_actual_version","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_database_size","args":[{"type":"name"}],"returns":"bigint"} +{"name":"pg_database_size","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_ddl_command_in","args":[{"type":"cstring"}],"returns":"pg_ddl_command"} +{"name":"pg_ddl_command_out","args":[{"type":"pg_ddl_command"}],"returns":"cstring"} +{"name":"pg_ddl_command_send","args":[{"type":"pg_ddl_command"}],"returns":"bytea"} +{"name":"pg_dependencies_in","args":[{"type":"cstring"}],"returns":"pg_dependencies"} +{"name":"pg_dependencies_out","args":[{"type":"pg_dependencies"}],"returns":"cstring"} +{"name":"pg_dependencies_send","args":[{"type":"pg_dependencies"}],"returns":"bytea"} +{"name":"pg_describe_object","args":[{"type":"oid"},{"type":"oid"},{"type":"integer"}],"returns":"text"} +{"name":"pg_drop_replication_slot","args":[{"type":"name"}],"returns":"void"} +{"name":"pg_encoding_max_length","args":[{"type":"integer"}],"returns":"integer"} +{"name":"pg_encoding_to_char","args":[{"type":"integer"}],"returns":"name"} +{"name":"pg_event_trigger_ddl_commands","returns":"record"} +{"name":"pg_event_trigger_dropped_objects","returns":"record"} +{"name":"pg_event_trigger_table_rewrite_oid","returns":"oid"} +{"name":"pg_event_trigger_table_rewrite_reason","returns":"integer"} +{"name":"pg_export_snapshot","returns":"text"} +{"name":"pg_extension_config_dump","args":[{"type":"regclass"},{"type":"text"}],"returns":"void"} +{"name":"pg_extension_update_paths","args":[{"name":"name","type":"name"}],"returns":"record"} +{"name":"pg_filenode_relation","args":[{"type":"oid"},{"type":"oid"}],"returns":"regclass"} +{"name":"pg_function_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_get_backend_memory_contexts","returns":"record"} +{"name":"pg_get_catalog_foreign_keys","returns":"record"} +{"name":"pg_get_constraintdef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_constraintdef","args":[{"type":"oid"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_get_expr","args":[{"type":"pg_node_tree"},{"type":"oid"}],"returns":"text"} +{"name":"pg_get_expr","args":[{"type":"pg_node_tree"},{"type":"oid"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_get_function_arg_default","args":[{"type":"oid"},{"type":"integer"}],"returns":"text"} +{"name":"pg_get_function_arguments","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_function_identity_arguments","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_function_result","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_function_sqlbody","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_functiondef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_indexdef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_indexdef","args":[{"type":"oid"},{"type":"integer"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_get_keywords","returns":"record"} +{"name":"pg_get_multixact_members","args":[{"name":"multixid","type":"xid"}],"returns":"record"} +{"name":"pg_get_object_address","args":[{"name":"type","type":"text"},{"name":"object_names","type":"text[]"},{"name":"object_args","type":"text[]"}],"returns":"record"} +{"name":"pg_get_partition_constraintdef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_partkeydef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_publication_tables","args":[{"name":"pubname","type":"text[]","mode":"v"}],"returns":"record"} +{"name":"pg_get_replica_identity_index","args":[{"type":"regclass"}],"returns":"regclass"} +{"name":"pg_get_replication_slots","returns":"record"} +{"name":"pg_get_ruledef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_ruledef","args":[{"type":"oid"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_get_serial_sequence","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"pg_get_shmem_allocations","returns":"record"} +{"name":"pg_get_statisticsobjdef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_statisticsobjdef_columns","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_statisticsobjdef_expressions","args":[{"type":"oid"}],"returns":"text[]"} +{"name":"pg_get_triggerdef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_triggerdef","args":[{"type":"oid"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_get_userbyid","args":[{"type":"oid"}],"returns":"name"} +{"name":"pg_get_viewdef","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_get_viewdef","args":[{"type":"oid"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_get_viewdef","args":[{"type":"oid"},{"type":"integer"}],"returns":"text"} +{"name":"pg_get_viewdef","args":[{"type":"text"}],"returns":"text"} +{"name":"pg_get_viewdef","args":[{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_get_wal_replay_pause_state","returns":"text"} +{"name":"pg_get_wal_resource_managers","returns":"record"} +{"name":"pg_has_role","args":[{"type":"name"},{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_has_role","args":[{"type":"name"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_has_role","args":[{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_has_role","args":[{"type":"oid"},{"type":"name"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_has_role","args":[{"type":"oid"},{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_has_role","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_hba_file_rules","returns":"record"} +{"name":"pg_ident_file_mappings","returns":"record"} +{"name":"pg_identify_object","args":[{"name":"classid","type":"oid"},{"name":"objid","type":"oid"},{"name":"objsubid","type":"integer"}],"returns":"record"} +{"name":"pg_identify_object_as_address","args":[{"name":"classid","type":"oid"},{"name":"objid","type":"oid"},{"name":"objsubid","type":"integer"}],"returns":"record"} +{"name":"pg_import_system_collations","args":[{"type":"regnamespace"}],"returns":"integer"} +{"name":"pg_index_column_has_property","args":[{"type":"regclass"},{"type":"integer"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_index_has_property","args":[{"type":"regclass"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_indexam_has_property","args":[{"type":"oid"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_indexam_progress_phasename","args":[{"type":"oid"},{"type":"bigint"}],"returns":"text"} +{"name":"pg_indexes_size","args":[{"type":"regclass"}],"returns":"bigint"} +{"name":"pg_input_error_info","args":[{"name":"value","type":"text"},{"name":"type_name","type":"text"}],"returns":"record"} +{"name":"pg_input_is_valid","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"pg_is_in_recovery","returns":"boolean"} +{"name":"pg_is_other_temp_schema","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_is_wal_replay_paused","returns":"boolean"} +{"name":"pg_isolation_test_session_is_blocked","args":[{"type":"integer"},{"type":"integer[]"}],"returns":"boolean"} +{"name":"pg_jit_available","returns":"boolean"} +{"name":"pg_last_committed_xact","returns":"record"} +{"name":"pg_last_wal_receive_lsn","returns":"pg_lsn"} +{"name":"pg_last_wal_replay_lsn","returns":"pg_lsn"} +{"name":"pg_last_xact_replay_timestamp","returns":"timestamp with time zone"} +{"name":"pg_listening_channels","returns":"text"} +{"name":"pg_lock_status","returns":"record"} +{"name":"pg_log_backend_memory_contexts","args":[{"type":"integer"}],"returns":"boolean"} +{"name":"pg_log_standby_snapshot","returns":"pg_lsn"} +{"name":"pg_logical_emit_message","args":[{"type":"boolean"},{"type":"text"},{"type":"bytea"}],"returns":"pg_lsn"} +{"name":"pg_logical_emit_message","args":[{"type":"boolean"},{"type":"text"},{"type":"text"}],"returns":"pg_lsn"} +{"name":"pg_logical_slot_get_binary_changes","args":[{"name":"slot_name","type":"name"},{"name":"upto_lsn","type":"pg_lsn"},{"name":"upto_nchanges","type":"integer"},{"name":"options","type":"text[]","mode":"v","has_default":true}],"returns":"record"} +{"name":"pg_logical_slot_get_changes","args":[{"name":"slot_name","type":"name"},{"name":"upto_lsn","type":"pg_lsn"},{"name":"upto_nchanges","type":"integer"},{"name":"options","type":"text[]","mode":"v","has_default":true}],"returns":"record"} +{"name":"pg_logical_slot_peek_binary_changes","args":[{"name":"slot_name","type":"name"},{"name":"upto_lsn","type":"pg_lsn"},{"name":"upto_nchanges","type":"integer"},{"name":"options","type":"text[]","mode":"v","has_default":true}],"returns":"record"} +{"name":"pg_logical_slot_peek_changes","args":[{"name":"slot_name","type":"name"},{"name":"upto_lsn","type":"pg_lsn"},{"name":"upto_nchanges","type":"integer"},{"name":"options","type":"text[]","mode":"v","has_default":true}],"returns":"record"} +{"name":"pg_ls_archive_statusdir","returns":"record"} +{"name":"pg_ls_dir","args":[{"type":"text"}],"returns":"text"} +{"name":"pg_ls_dir","args":[{"type":"text"},{"type":"boolean"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_ls_logdir","returns":"record"} +{"name":"pg_ls_logicalmapdir","returns":"record"} +{"name":"pg_ls_logicalsnapdir","returns":"record"} +{"name":"pg_ls_replslotdir","args":[{"name":"slot_name","type":"text"}],"returns":"record"} +{"name":"pg_ls_tmpdir","returns":"record"} +{"name":"pg_ls_tmpdir","args":[{"name":"tablespace","type":"oid"}],"returns":"record"} +{"name":"pg_ls_waldir","returns":"record"} +{"name":"pg_lsn","args":[{"type":"numeric"}],"returns":"pg_lsn"} +{"name":"pg_lsn_cmp","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"integer"} +{"name":"pg_lsn_eq","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"boolean"} +{"name":"pg_lsn_ge","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"boolean"} +{"name":"pg_lsn_gt","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"boolean"} +{"name":"pg_lsn_hash","args":[{"type":"pg_lsn"}],"returns":"integer"} +{"name":"pg_lsn_hash_extended","args":[{"type":"pg_lsn"},{"type":"bigint"}],"returns":"bigint"} +{"name":"pg_lsn_in","args":[{"type":"cstring"}],"returns":"pg_lsn"} +{"name":"pg_lsn_larger","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"pg_lsn"} +{"name":"pg_lsn_le","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"boolean"} +{"name":"pg_lsn_lt","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"boolean"} +{"name":"pg_lsn_mi","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"numeric"} +{"name":"pg_lsn_mii","args":[{"type":"pg_lsn"},{"type":"numeric"}],"returns":"pg_lsn"} +{"name":"pg_lsn_ne","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"boolean"} +{"name":"pg_lsn_out","args":[{"type":"pg_lsn"}],"returns":"cstring"} +{"name":"pg_lsn_pli","args":[{"type":"pg_lsn"},{"type":"numeric"}],"returns":"pg_lsn"} +{"name":"pg_lsn_send","args":[{"type":"pg_lsn"}],"returns":"bytea"} +{"name":"pg_lsn_smaller","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"pg_lsn"} +{"name":"pg_mcv_list_in","args":[{"type":"cstring"}],"returns":"pg_mcv_list"} +{"name":"pg_mcv_list_items","args":[{"name":"mcv_list","type":"pg_mcv_list"}],"returns":"record"} +{"name":"pg_mcv_list_out","args":[{"type":"pg_mcv_list"}],"returns":"cstring"} +{"name":"pg_mcv_list_send","args":[{"type":"pg_mcv_list"}],"returns":"bytea"} +{"name":"pg_my_temp_schema","returns":"oid"} +{"name":"pg_ndistinct_in","args":[{"type":"cstring"}],"returns":"pg_ndistinct"} +{"name":"pg_ndistinct_out","args":[{"type":"pg_ndistinct"}],"returns":"cstring"} +{"name":"pg_ndistinct_send","args":[{"type":"pg_ndistinct"}],"returns":"bytea"} +{"name":"pg_nextoid","args":[{"type":"regclass"},{"type":"name"},{"type":"regclass"}],"returns":"oid"} +{"name":"pg_node_tree_in","args":[{"type":"cstring"}],"returns":"pg_node_tree"} +{"name":"pg_node_tree_out","args":[{"type":"pg_node_tree"}],"returns":"cstring"} +{"name":"pg_node_tree_send","args":[{"type":"pg_node_tree"}],"returns":"bytea"} +{"name":"pg_notification_queue_usage","returns":"double precision"} +{"name":"pg_notify","args":[{"type":"text"},{"type":"text"}],"returns":"void"} +{"name":"pg_opclass_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_operator_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_opfamily_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_options_to_table","args":[{"name":"options_array","type":"text[]"}],"returns":"record"} +{"name":"pg_partition_ancestors","args":[{"name":"partitionid","type":"regclass"}],"returns":"regclass"} +{"name":"pg_partition_root","args":[{"type":"regclass"}],"returns":"regclass"} +{"name":"pg_partition_tree","args":[{"name":"rootrelid","type":"regclass"}],"returns":"record"} +{"name":"pg_postmaster_start_time","returns":"timestamp with time zone"} +{"name":"pg_prepared_statement","returns":"record"} +{"name":"pg_prepared_xact","returns":"record"} +{"name":"pg_promote","args":[{"name":"wait","type":"boolean","has_default":true},{"name":"wait_seconds","type":"integer","has_default":true}],"returns":"boolean"} +{"name":"pg_read_binary_file","args":[{"type":"text"}],"returns":"bytea"} +{"name":"pg_read_binary_file","args":[{"type":"text"},{"type":"bigint"},{"type":"bigint"}],"returns":"bytea"} +{"name":"pg_read_binary_file","args":[{"type":"text"},{"type":"bigint"},{"type":"bigint"},{"type":"boolean"}],"returns":"bytea"} +{"name":"pg_read_binary_file","args":[{"type":"text"},{"type":"boolean"}],"returns":"bytea"} +{"name":"pg_read_file","args":[{"type":"text"}],"returns":"text"} +{"name":"pg_read_file","args":[{"type":"text"},{"type":"bigint"},{"type":"bigint"}],"returns":"text"} +{"name":"pg_read_file","args":[{"type":"text"},{"type":"bigint"},{"type":"bigint"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_read_file","args":[{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"pg_read_file_old","args":[{"type":"text"},{"type":"bigint"},{"type":"bigint"}],"returns":"text"} +{"name":"pg_relation_filenode","args":[{"type":"regclass"}],"returns":"oid"} +{"name":"pg_relation_filepath","args":[{"type":"regclass"}],"returns":"text"} +{"name":"pg_relation_is_publishable","args":[{"type":"regclass"}],"returns":"boolean"} +{"name":"pg_relation_is_updatable","args":[{"type":"regclass"},{"type":"boolean"}],"returns":"integer"} +{"name":"pg_relation_size","args":[{"type":"regclass"}],"returns":"bigint"} +{"name":"pg_relation_size","args":[{"type":"regclass"},{"type":"text"}],"returns":"bigint"} +{"name":"pg_reload_conf","returns":"boolean"} +{"name":"pg_replication_origin_advance","args":[{"type":"text"},{"type":"pg_lsn"}],"returns":"void"} +{"name":"pg_replication_origin_create","args":[{"type":"text"}],"returns":"oid"} +{"name":"pg_replication_origin_drop","args":[{"type":"text"}],"returns":"void"} +{"name":"pg_replication_origin_oid","args":[{"type":"text"}],"returns":"oid"} +{"name":"pg_replication_origin_progress","args":[{"type":"text"},{"type":"boolean"}],"returns":"pg_lsn"} +{"name":"pg_replication_origin_session_is_setup","returns":"boolean"} +{"name":"pg_replication_origin_session_progress","args":[{"type":"boolean"}],"returns":"pg_lsn"} +{"name":"pg_replication_origin_session_reset","returns":"void"} +{"name":"pg_replication_origin_session_setup","args":[{"type":"text"}],"returns":"void"} +{"name":"pg_replication_origin_xact_reset","returns":"void"} +{"name":"pg_replication_origin_xact_setup","args":[{"type":"pg_lsn"},{"type":"timestamp with time zone"}],"returns":"void"} +{"name":"pg_replication_slot_advance","args":[{"name":"slot_name","type":"name"},{"name":"upto_lsn","type":"pg_lsn"}],"returns":"record"} +{"name":"pg_rotate_logfile","returns":"boolean"} +{"name":"pg_rotate_logfile_old","returns":"boolean"} +{"name":"pg_safe_snapshot_blocking_pids","args":[{"type":"integer"}],"returns":"integer[]"} +{"name":"pg_sequence_last_value","args":[{"type":"regclass"}],"returns":"bigint"} +{"name":"pg_sequence_parameters","args":[{"name":"sequence_oid","type":"oid"}],"returns":"record"} +{"name":"pg_settings_get_flags","args":[{"type":"text"}],"returns":"text[]"} +{"name":"pg_show_all_file_settings","returns":"record"} +{"name":"pg_show_all_settings","returns":"record"} +{"name":"pg_show_replication_origin_status","returns":"record"} +{"name":"pg_size_bytes","args":[{"type":"text"}],"returns":"bigint"} +{"name":"pg_size_pretty","args":[{"type":"bigint"}],"returns":"text"} +{"name":"pg_size_pretty","args":[{"type":"numeric"}],"returns":"text"} +{"name":"pg_sleep","args":[{"type":"double precision"}],"returns":"void"} +{"name":"pg_sleep_for","args":[{"type":"interval"}],"returns":"void"} +{"name":"pg_sleep_until","args":[{"type":"timestamp with time zone"}],"returns":"void"} +{"name":"pg_snapshot_in","args":[{"type":"cstring"}],"returns":"pg_snapshot"} +{"name":"pg_snapshot_out","args":[{"type":"pg_snapshot"}],"returns":"cstring"} +{"name":"pg_snapshot_send","args":[{"type":"pg_snapshot"}],"returns":"bytea"} +{"name":"pg_snapshot_xip","args":[{"type":"pg_snapshot"}],"returns":"xid8"} +{"name":"pg_snapshot_xmax","args":[{"type":"pg_snapshot"}],"returns":"xid8"} +{"name":"pg_snapshot_xmin","args":[{"type":"pg_snapshot"}],"returns":"xid8"} +{"name":"pg_split_walfile_name","args":[{"name":"file_name","type":"text"}],"returns":"record"} +{"name":"pg_stat_clear_snapshot","returns":"void"} +{"name":"pg_stat_file","args":[{"name":"filename","type":"text"}],"returns":"record"} +{"name":"pg_stat_file","args":[{"name":"filename","type":"text"},{"name":"missing_ok","type":"boolean"}],"returns":"record"} +{"name":"pg_stat_force_next_flush","returns":"void"} +{"name":"pg_stat_get_activity","args":[{"name":"pid","type":"integer"}],"returns":"record"} +{"name":"pg_stat_get_analyze_count","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_archiver","returns":"record"} +{"name":"pg_stat_get_autoanalyze_count","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_autovacuum_count","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_backend_activity","args":[{"type":"integer"}],"returns":"text"} +{"name":"pg_stat_get_backend_activity_start","args":[{"type":"integer"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_backend_client_addr","args":[{"type":"integer"}],"returns":"inet"} +{"name":"pg_stat_get_backend_client_port","args":[{"type":"integer"}],"returns":"integer"} +{"name":"pg_stat_get_backend_dbid","args":[{"type":"integer"}],"returns":"oid"} +{"name":"pg_stat_get_backend_idset","returns":"integer"} +{"name":"pg_stat_get_backend_pid","args":[{"type":"integer"}],"returns":"integer"} +{"name":"pg_stat_get_backend_start","args":[{"type":"integer"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_backend_subxact","args":[{"name":"bid","type":"integer"}],"returns":"record"} +{"name":"pg_stat_get_backend_userid","args":[{"type":"integer"}],"returns":"oid"} +{"name":"pg_stat_get_backend_wait_event","args":[{"type":"integer"}],"returns":"text"} +{"name":"pg_stat_get_backend_wait_event_type","args":[{"type":"integer"}],"returns":"text"} +{"name":"pg_stat_get_backend_xact_start","args":[{"type":"integer"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_bgwriter_buf_written_checkpoints","returns":"bigint"} +{"name":"pg_stat_get_bgwriter_buf_written_clean","returns":"bigint"} +{"name":"pg_stat_get_bgwriter_maxwritten_clean","returns":"bigint"} +{"name":"pg_stat_get_bgwriter_requested_checkpoints","returns":"bigint"} +{"name":"pg_stat_get_bgwriter_stat_reset_time","returns":"timestamp with time zone"} +{"name":"pg_stat_get_bgwriter_timed_checkpoints","returns":"bigint"} +{"name":"pg_stat_get_blocks_fetched","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_blocks_hit","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_buf_alloc","returns":"bigint"} +{"name":"pg_stat_get_buf_fsync_backend","returns":"bigint"} +{"name":"pg_stat_get_buf_written_backend","returns":"bigint"} +{"name":"pg_stat_get_checkpoint_sync_time","returns":"double precision"} +{"name":"pg_stat_get_checkpoint_write_time","returns":"double precision"} +{"name":"pg_stat_get_db_active_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_db_blk_read_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_db_blk_write_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_db_blocks_fetched","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_blocks_hit","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_checksum_failures","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_checksum_last_failure","args":[{"type":"oid"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_db_conflict_all","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_conflict_bufferpin","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_conflict_lock","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_conflict_logicalslot","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_conflict_snapshot","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_conflict_startup_deadlock","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_conflict_tablespace","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_deadlocks","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_idle_in_transaction_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_db_numbackends","args":[{"type":"oid"}],"returns":"integer"} +{"name":"pg_stat_get_db_session_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_db_sessions","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_sessions_abandoned","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_sessions_fatal","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_sessions_killed","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_stat_reset_time","args":[{"type":"oid"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_db_temp_bytes","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_temp_files","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_tuples_deleted","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_tuples_fetched","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_tuples_inserted","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_tuples_returned","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_tuples_updated","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_xact_commit","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_db_xact_rollback","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_dead_tuples","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_function_calls","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_function_self_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_function_total_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_ins_since_vacuum","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_io","returns":"record"} +{"name":"pg_stat_get_last_analyze_time","args":[{"type":"oid"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_last_autoanalyze_time","args":[{"type":"oid"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_last_autovacuum_time","args":[{"type":"oid"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_last_vacuum_time","args":[{"type":"oid"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_lastscan","args":[{"type":"oid"}],"returns":"timestamp with time zone"} +{"name":"pg_stat_get_live_tuples","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_mod_since_analyze","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_numscans","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_progress_info","args":[{"name":"cmdtype","type":"text"}],"returns":"record"} +{"name":"pg_stat_get_recovery_prefetch","returns":"record"} +{"name":"pg_stat_get_replication_slot","args":[{"name":"slot_name","type":"text"}],"returns":"record"} +{"name":"pg_stat_get_slru","returns":"record"} +{"name":"pg_stat_get_snapshot_timestamp","returns":"timestamp with time zone"} +{"name":"pg_stat_get_subscription","args":[{"name":"subid","type":"oid"}],"returns":"record"} +{"name":"pg_stat_get_subscription_stats","args":[{"name":"subid","type":"oid"}],"returns":"record"} +{"name":"pg_stat_get_tuples_deleted","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_tuples_fetched","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_tuples_hot_updated","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_tuples_inserted","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_tuples_newpage_updated","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_tuples_returned","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_tuples_updated","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_vacuum_count","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_wal","returns":"record"} +{"name":"pg_stat_get_wal_receiver","returns":"record"} +{"name":"pg_stat_get_wal_senders","returns":"record"} +{"name":"pg_stat_get_xact_blocks_fetched","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_blocks_hit","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_function_calls","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_function_self_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_xact_function_total_time","args":[{"type":"oid"}],"returns":"double precision"} +{"name":"pg_stat_get_xact_numscans","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_tuples_deleted","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_tuples_fetched","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_tuples_hot_updated","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_tuples_inserted","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_tuples_newpage_updated","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_tuples_returned","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_get_xact_tuples_updated","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_stat_have_stats","args":[{"type":"text"},{"type":"oid"},{"type":"oid"}],"returns":"boolean"} +{"name":"pg_stat_reset","returns":"void"} +{"name":"pg_stat_reset_replication_slot","args":[{"type":"text"}],"returns":"void"} +{"name":"pg_stat_reset_shared","args":[{"type":"text"}],"returns":"void"} +{"name":"pg_stat_reset_single_function_counters","args":[{"type":"oid"}],"returns":"void"} +{"name":"pg_stat_reset_single_table_counters","args":[{"type":"oid"}],"returns":"void"} +{"name":"pg_stat_reset_slru","args":[{"type":"text"}],"returns":"void"} +{"name":"pg_stat_reset_subscription_stats","args":[{"type":"oid"}],"returns":"void"} +{"name":"pg_statistics_obj_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_stop_making_pinned_objects","returns":"void"} +{"name":"pg_switch_wal","returns":"pg_lsn"} +{"name":"pg_table_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_table_size","args":[{"type":"regclass"}],"returns":"bigint"} +{"name":"pg_tablespace_databases","args":[{"type":"oid"}],"returns":"oid"} +{"name":"pg_tablespace_location","args":[{"type":"oid"}],"returns":"text"} +{"name":"pg_tablespace_size","args":[{"type":"name"}],"returns":"bigint"} +{"name":"pg_tablespace_size","args":[{"type":"oid"}],"returns":"bigint"} +{"name":"pg_terminate_backend","args":[{"name":"pid","type":"integer"},{"name":"timeout","type":"bigint","has_default":true}],"returns":"boolean"} +{"name":"pg_timezone_abbrevs","returns":"record"} +{"name":"pg_timezone_names","returns":"record"} +{"name":"pg_total_relation_size","args":[{"type":"regclass"}],"returns":"bigint"} +{"name":"pg_trigger_depth","returns":"integer"} +{"name":"pg_try_advisory_lock","args":[{"type":"bigint"}],"returns":"boolean"} +{"name":"pg_try_advisory_lock","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"pg_try_advisory_lock_shared","args":[{"type":"bigint"}],"returns":"boolean"} +{"name":"pg_try_advisory_lock_shared","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"pg_try_advisory_xact_lock","args":[{"type":"bigint"}],"returns":"boolean"} +{"name":"pg_try_advisory_xact_lock","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"pg_try_advisory_xact_lock_shared","args":[{"type":"bigint"}],"returns":"boolean"} +{"name":"pg_try_advisory_xact_lock_shared","args":[{"type":"integer"},{"type":"integer"}],"returns":"boolean"} +{"name":"pg_ts_config_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_ts_dict_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_ts_parser_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_ts_template_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_type_is_visible","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"pg_typeof","args":[{"type":"any"}],"returns":"regtype"} +{"name":"pg_visible_in_snapshot","args":[{"type":"xid8"},{"type":"pg_snapshot"}],"returns":"boolean"} +{"name":"pg_wal_lsn_diff","args":[{"type":"pg_lsn"},{"type":"pg_lsn"}],"returns":"numeric"} +{"name":"pg_wal_replay_pause","returns":"void"} +{"name":"pg_wal_replay_resume","returns":"void"} +{"name":"pg_walfile_name","args":[{"type":"pg_lsn"}],"returns":"text"} +{"name":"pg_walfile_name_offset","args":[{"name":"lsn","type":"pg_lsn"}],"returns":"record"} +{"name":"pg_xact_commit_timestamp","args":[{"type":"xid"}],"returns":"timestamp with time zone"} +{"name":"pg_xact_commit_timestamp_origin","args":[{"name":"xid","type":"xid"}],"returns":"record"} +{"name":"pg_xact_status","args":[{"type":"xid8"}],"returns":"text"} +{"name":"phraseto_tsquery","args":[{"type":"regconfig"},{"type":"text"}],"returns":"tsquery"} +{"name":"phraseto_tsquery","args":[{"type":"text"}],"returns":"tsquery"} +{"name":"pi","returns":"double precision"} +{"name":"plainto_tsquery","args":[{"type":"regconfig"},{"type":"text"}],"returns":"tsquery"} +{"name":"plainto_tsquery","args":[{"type":"text"}],"returns":"tsquery"} +{"name":"plpgsql_call_handler","returns":"language_handler"} +{"name":"plpgsql_validator","args":[{"type":"oid"}],"returns":"void"} +{"name":"point","args":[{"type":"box"}],"returns":"point"} +{"name":"point","args":[{"type":"circle"}],"returns":"point"} +{"name":"point","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"point"} +{"name":"point","args":[{"type":"lseg"}],"returns":"point"} +{"name":"point","args":[{"type":"polygon"}],"returns":"point"} +{"name":"point_above","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"point_add","args":[{"type":"point"},{"type":"point"}],"returns":"point"} +{"name":"point_below","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"point_distance","args":[{"type":"point"},{"type":"point"}],"returns":"double precision"} +{"name":"point_div","args":[{"type":"point"},{"type":"point"}],"returns":"point"} +{"name":"point_eq","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"point_horiz","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"point_in","args":[{"type":"cstring"}],"returns":"point"} +{"name":"point_left","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"point_mul","args":[{"type":"point"},{"type":"point"}],"returns":"point"} +{"name":"point_ne","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"point_out","args":[{"type":"point"}],"returns":"cstring"} +{"name":"point_right","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"point_send","args":[{"type":"point"}],"returns":"bytea"} +{"name":"point_sub","args":[{"type":"point"},{"type":"point"}],"returns":"point"} +{"name":"point_vert","args":[{"type":"point"},{"type":"point"}],"returns":"boolean"} +{"name":"poly_above","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_below","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_center","args":[{"type":"polygon"}],"returns":"point"} +{"name":"poly_contain","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_contain_pt","args":[{"type":"polygon"},{"type":"point"}],"returns":"boolean"} +{"name":"poly_contained","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_distance","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"double precision"} +{"name":"poly_in","args":[{"type":"cstring"}],"returns":"polygon"} +{"name":"poly_left","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_npoints","args":[{"type":"polygon"}],"returns":"integer"} +{"name":"poly_out","args":[{"type":"polygon"}],"returns":"cstring"} +{"name":"poly_overabove","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_overbelow","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_overlap","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_overleft","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_overright","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_right","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_same","args":[{"type":"polygon"},{"type":"polygon"}],"returns":"boolean"} +{"name":"poly_send","args":[{"type":"polygon"}],"returns":"bytea"} +{"name":"polygon","args":[{"type":"box"}],"returns":"polygon"} +{"name":"polygon","args":[{"type":"circle"}],"returns":"polygon"} +{"name":"polygon","args":[{"type":"integer"},{"type":"circle"}],"returns":"polygon"} +{"name":"polygon","args":[{"type":"path"}],"returns":"polygon"} +{"name":"popen","args":[{"type":"path"}],"returns":"path"} +{"name":"position","args":[{"type":"bit"},{"type":"bit"}],"returns":"integer"} +{"name":"position","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"integer"} +{"name":"position","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"postgresql_fdw_validator","args":[{"type":"text[]"},{"type":"oid"}],"returns":"boolean"} +{"name":"pow","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"pow","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"power","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"power","args":[{"type":"numeric"},{"type":"numeric"}],"returns":"numeric"} +{"name":"pt_contained_circle","args":[{"type":"point"},{"type":"circle"}],"returns":"boolean"} +{"name":"pt_contained_poly","args":[{"type":"point"},{"type":"polygon"}],"returns":"boolean"} +{"name":"query_to_xml","args":[{"name":"query","type":"text"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"query_to_xml_and_xmlschema","args":[{"name":"query","type":"text"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"query_to_xmlschema","args":[{"name":"query","type":"text"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"querytree","args":[{"type":"tsquery"}],"returns":"text"} +{"name":"quote_ident","args":[{"type":"text"}],"returns":"text"} +{"name":"quote_literal","args":[{"type":"anyelement"}],"returns":"text"} +{"name":"quote_literal","args":[{"type":"text"}],"returns":"text"} +{"name":"quote_nullable","args":[{"type":"anyelement"}],"returns":"text"} +{"name":"quote_nullable","args":[{"type":"text"}],"returns":"text"} +{"name":"radians","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"radius","args":[{"type":"circle"}],"returns":"double precision"} +{"name":"random","returns":"double precision"} +{"name":"random_normal","args":[{"name":"mean","type":"double precision","has_default":true},{"name":"stddev","type":"double precision","has_default":true}],"returns":"double precision"} +{"name":"range_adjacent","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_adjacent_multirange","args":[{"type":"anyrange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"range_after","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_after_multirange","args":[{"type":"anyrange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"range_agg","args":[{"type":"anymultirange"}],"returns":"anymultirange"} +{"name":"range_agg","args":[{"type":"anyrange"}],"returns":"anymultirange"} +{"name":"range_before","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_before_multirange","args":[{"type":"anyrange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"range_cmp","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"integer"} +{"name":"range_contained_by","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_contained_by_multirange","args":[{"type":"anyrange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"range_contains","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_contains_elem","args":[{"type":"anyrange"},{"type":"anyelement"}],"returns":"boolean"} +{"name":"range_contains_multirange","args":[{"type":"anyrange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"range_eq","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_ge","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_gt","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"anyrange"} +{"name":"range_intersect","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"anyrange"} +{"name":"range_intersect_agg","args":[{"type":"anymultirange"}],"returns":"anymultirange"} +{"name":"range_intersect_agg","args":[{"type":"anyrange"}],"returns":"anyrange"} +{"name":"range_intersect_agg_transfn","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"anyrange"} +{"name":"range_le","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_lt","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_merge","args":[{"type":"anymultirange"}],"returns":"anyrange"} +{"name":"range_merge","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"anyrange"} +{"name":"range_minus","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"anyrange"} +{"name":"range_ne","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_out","args":[{"type":"anyrange"}],"returns":"cstring"} +{"name":"range_overlaps","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_overlaps_multirange","args":[{"type":"anyrange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"range_overleft","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_overleft_multirange","args":[{"type":"anyrange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"range_overright","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"boolean"} +{"name":"range_overright_multirange","args":[{"type":"anyrange"},{"type":"anymultirange"}],"returns":"boolean"} +{"name":"range_send","args":[{"type":"anyrange"}],"returns":"bytea"} +{"name":"range_union","args":[{"type":"anyrange"},{"type":"anyrange"}],"returns":"anyrange"} +{"name":"rank","returns":"bigint"} +{"name":"rank","args":[{"type":"any","mode":"v"}],"returns":"bigint"} +{"name":"record_eq","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_ge","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_gt","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_image_eq","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_image_ge","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_image_gt","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_image_le","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_image_lt","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_image_ne","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"record"} +{"name":"record_le","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_lt","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_ne","args":[{"type":"record"},{"type":"record"}],"returns":"boolean"} +{"name":"record_out","args":[{"type":"record"}],"returns":"cstring"} +{"name":"record_send","args":[{"type":"record"}],"returns":"bytea"} +{"name":"regclass","args":[{"type":"text"}],"returns":"regclass"} +{"name":"regclassin","args":[{"type":"cstring"}],"returns":"regclass"} +{"name":"regclassout","args":[{"type":"regclass"}],"returns":"cstring"} +{"name":"regclasssend","args":[{"type":"regclass"}],"returns":"bytea"} +{"name":"regcollationin","args":[{"type":"cstring"}],"returns":"regcollation"} +{"name":"regcollationout","args":[{"type":"regcollation"}],"returns":"cstring"} +{"name":"regcollationsend","args":[{"type":"regcollation"}],"returns":"bytea"} +{"name":"regconfigin","args":[{"type":"cstring"}],"returns":"regconfig"} +{"name":"regconfigout","args":[{"type":"regconfig"}],"returns":"cstring"} +{"name":"regconfigsend","args":[{"type":"regconfig"}],"returns":"bytea"} +{"name":"regdictionaryin","args":[{"type":"cstring"}],"returns":"regdictionary"} +{"name":"regdictionaryout","args":[{"type":"regdictionary"}],"returns":"cstring"} +{"name":"regdictionarysend","args":[{"type":"regdictionary"}],"returns":"bytea"} +{"name":"regexp_count","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"regexp_count","args":[{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"integer"} +{"name":"regexp_count","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"text"}],"returns":"integer"} +{"name":"regexp_instr","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"regexp_instr","args":[{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"integer"} +{"name":"regexp_instr","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"regexp_instr","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"regexp_instr","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"},{"type":"integer"},{"type":"text"}],"returns":"integer"} +{"name":"regexp_instr","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"},{"type":"integer"},{"type":"text"},{"type":"integer"}],"returns":"integer"} +{"name":"regexp_like","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"regexp_like","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"regexp_match","args":[{"type":"text"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_match","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_matches","args":[{"type":"text"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_matches","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_replace","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"regexp_replace","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"regexp_replace","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"}],"returns":"text"} +{"name":"regexp_replace","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"},{"type":"text"}],"returns":"text"} +{"name":"regexp_replace","args":[{"type":"text"},{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"regexp_split_to_array","args":[{"type":"text"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_split_to_array","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text[]"} +{"name":"regexp_split_to_table","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"regexp_split_to_table","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"regexp_substr","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"regexp_substr","args":[{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"regexp_substr","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"}],"returns":"text"} +{"name":"regexp_substr","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"},{"type":"text"}],"returns":"text"} +{"name":"regexp_substr","args":[{"type":"text"},{"type":"text"},{"type":"integer"},{"type":"integer"},{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"regnamespacein","args":[{"type":"cstring"}],"returns":"regnamespace"} +{"name":"regnamespaceout","args":[{"type":"regnamespace"}],"returns":"cstring"} +{"name":"regnamespacesend","args":[{"type":"regnamespace"}],"returns":"bytea"} +{"name":"regoperatorin","args":[{"type":"cstring"}],"returns":"regoperator"} +{"name":"regoperatorout","args":[{"type":"regoperator"}],"returns":"cstring"} +{"name":"regoperatorsend","args":[{"type":"regoperator"}],"returns":"bytea"} +{"name":"regoperin","args":[{"type":"cstring"}],"returns":"regoper"} +{"name":"regoperout","args":[{"type":"regoper"}],"returns":"cstring"} +{"name":"regopersend","args":[{"type":"regoper"}],"returns":"bytea"} +{"name":"regprocedurein","args":[{"type":"cstring"}],"returns":"regprocedure"} +{"name":"regprocedureout","args":[{"type":"regprocedure"}],"returns":"cstring"} +{"name":"regproceduresend","args":[{"type":"regprocedure"}],"returns":"bytea"} +{"name":"regprocin","args":[{"type":"cstring"}],"returns":"regproc"} +{"name":"regprocout","args":[{"type":"regproc"}],"returns":"cstring"} +{"name":"regprocsend","args":[{"type":"regproc"}],"returns":"bytea"} +{"name":"regr_avgx","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"regr_avgy","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"regr_count","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"bigint"} +{"name":"regr_intercept","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"regr_r2","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"regr_slope","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"regr_sxx","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"regr_sxy","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"regr_syy","args":[{"type":"double precision"},{"type":"double precision"}],"returns":"double precision"} +{"name":"regrolein","args":[{"type":"cstring"}],"returns":"regrole"} +{"name":"regroleout","args":[{"type":"regrole"}],"returns":"cstring"} +{"name":"regrolesend","args":[{"type":"regrole"}],"returns":"bytea"} +{"name":"regtypein","args":[{"type":"cstring"}],"returns":"regtype"} +{"name":"regtypeout","args":[{"type":"regtype"}],"returns":"cstring"} +{"name":"regtypesend","args":[{"type":"regtype"}],"returns":"bytea"} +{"name":"repeat","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"replace","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"reverse","args":[{"type":"text"}],"returns":"text"} +{"name":"right","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"round","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"round","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"round","args":[{"type":"numeric"},{"type":"integer"}],"returns":"numeric"} +{"name":"row_number","returns":"bigint"} +{"name":"row_security_active","args":[{"type":"oid"}],"returns":"boolean"} +{"name":"row_security_active","args":[{"type":"text"}],"returns":"boolean"} +{"name":"row_to_json","args":[{"type":"record"}],"returns":"json"} +{"name":"row_to_json","args":[{"type":"record"},{"type":"boolean"}],"returns":"json"} +{"name":"rpad","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"rpad","args":[{"type":"text"},{"type":"integer"},{"type":"text"}],"returns":"text"} +{"name":"rtrim","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"bytea"} +{"name":"rtrim","args":[{"type":"text"}],"returns":"text"} +{"name":"rtrim","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"satisfies_hash_partition","args":[{"type":"oid"},{"type":"integer"},{"type":"integer"},{"type":"any","mode":"v"}],"returns":"boolean"} +{"name":"scale","args":[{"type":"numeric"}],"returns":"integer"} +{"name":"schema_to_xml","args":[{"name":"schema","type":"name"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"schema_to_xml_and_xmlschema","args":[{"name":"schema","type":"name"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"schema_to_xmlschema","args":[{"name":"schema","type":"name"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"session_user","returns":"name"} +{"name":"set_bit","args":[{"type":"bit"},{"type":"integer"},{"type":"integer"}],"returns":"bit"} +{"name":"set_bit","args":[{"type":"bytea"},{"type":"bigint"},{"type":"integer"}],"returns":"bytea"} +{"name":"set_byte","args":[{"type":"bytea"},{"type":"integer"},{"type":"integer"}],"returns":"bytea"} +{"name":"set_config","args":[{"type":"text"},{"type":"text"},{"type":"boolean"}],"returns":"text"} +{"name":"set_masklen","args":[{"type":"cidr"},{"type":"integer"}],"returns":"cidr"} +{"name":"set_masklen","args":[{"type":"inet"},{"type":"integer"}],"returns":"inet"} +{"name":"setseed","args":[{"type":"double precision"}],"returns":"void"} +{"name":"setval","args":[{"type":"regclass"},{"type":"bigint"}],"returns":"bigint"} +{"name":"setval","args":[{"type":"regclass"},{"type":"bigint"},{"type":"boolean"}],"returns":"bigint"} +{"name":"setweight","args":[{"type":"tsvector"},{"type":"char"}],"returns":"tsvector"} +{"name":"setweight","args":[{"type":"tsvector"},{"type":"char"},{"type":"text[]"}],"returns":"tsvector"} +{"name":"sha224","args":[{"type":"bytea"}],"returns":"bytea"} +{"name":"sha256","args":[{"type":"bytea"}],"returns":"bytea"} +{"name":"sha384","args":[{"type":"bytea"}],"returns":"bytea"} +{"name":"sha512","args":[{"type":"bytea"}],"returns":"bytea"} +{"name":"shell_in","args":[{"type":"cstring"}],"returns":"void"} +{"name":"shell_out","args":[{"type":"void"}],"returns":"cstring"} +{"name":"shobj_description","args":[{"type":"oid"},{"type":"name"}],"returns":"text"} +{"name":"sign","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"sign","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"similar_escape","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"similar_to_escape","args":[{"type":"text"}],"returns":"text"} +{"name":"similar_to_escape","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"sin","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"sind","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"sinh","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"slope","args":[{"type":"point"},{"type":"point"}],"returns":"double precision"} +{"name":"spg_poly_quad_compress","args":[{"type":"polygon"}],"returns":"box"} +{"name":"split_part","args":[{"type":"text"},{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"sqrt","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"sqrt","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"starts_with","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"statement_timestamp","returns":"timestamp with time zone"} +{"name":"stddev","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"stddev","args":[{"type":"real"}],"returns":"double precision"} +{"name":"stddev","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"stddev","args":[{"type":"integer"}],"returns":"numeric"} +{"name":"stddev","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"stddev","args":[{"type":"smallint"}],"returns":"numeric"} +{"name":"stddev_pop","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"stddev_pop","args":[{"type":"real"}],"returns":"double precision"} +{"name":"stddev_pop","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"stddev_pop","args":[{"type":"integer"}],"returns":"numeric"} +{"name":"stddev_pop","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"stddev_pop","args":[{"type":"smallint"}],"returns":"numeric"} +{"name":"stddev_samp","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"stddev_samp","args":[{"type":"real"}],"returns":"double precision"} +{"name":"stddev_samp","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"stddev_samp","args":[{"type":"integer"}],"returns":"numeric"} +{"name":"stddev_samp","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"stddev_samp","args":[{"type":"smallint"}],"returns":"numeric"} +{"name":"string_agg","args":[{"type":"bytea"},{"type":"bytea"}],"returns":"bytea"} +{"name":"string_agg","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"string_to_array","args":[{"type":"text"},{"type":"text"}],"returns":"text[]"} +{"name":"string_to_array","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text[]"} +{"name":"string_to_table","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"string_to_table","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"strip","args":[{"type":"tsvector"}],"returns":"tsvector"} +{"name":"strpos","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"substr","args":[{"type":"bytea"},{"type":"integer"}],"returns":"bytea"} +{"name":"substr","args":[{"type":"bytea"},{"type":"integer"},{"type":"integer"}],"returns":"bytea"} +{"name":"substr","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"substr","args":[{"type":"text"},{"type":"integer"},{"type":"integer"}],"returns":"text"} +{"name":"substring","args":[{"type":"bit"},{"type":"integer"}],"returns":"bit"} +{"name":"substring","args":[{"type":"bit"},{"type":"integer"},{"type":"integer"}],"returns":"bit"} +{"name":"substring","args":[{"type":"bytea"},{"type":"integer"}],"returns":"bytea"} +{"name":"substring","args":[{"type":"bytea"},{"type":"integer"},{"type":"integer"}],"returns":"bytea"} +{"name":"substring","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"substring","args":[{"type":"text"},{"type":"integer"},{"type":"integer"}],"returns":"text"} +{"name":"substring","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"substring","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"sum","args":[{"type":"integer"}],"returns":"bigint"} +{"name":"sum","args":[{"type":"smallint"}],"returns":"bigint"} +{"name":"sum","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"sum","args":[{"type":"interval"}],"returns":"interval"} +{"name":"sum","args":[{"type":"money"}],"returns":"money"} +{"name":"sum","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"sum","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"sum","args":[{"type":"real"}],"returns":"real"} +{"name":"suppress_redundant_updates_trigger","returns":"trigger"} +{"name":"system_user","returns":"text"} +{"name":"table_am_handler_in","args":[{"type":"cstring"}],"returns":"table_am_handler"} +{"name":"table_am_handler_out","args":[{"type":"table_am_handler"}],"returns":"cstring"} +{"name":"table_to_xml","args":[{"name":"tbl","type":"regclass"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"table_to_xml_and_xmlschema","args":[{"name":"tbl","type":"regclass"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"table_to_xmlschema","args":[{"name":"tbl","type":"regclass"},{"name":"nulls","type":"boolean"},{"name":"tableforest","type":"boolean"},{"name":"targetns","type":"text"}],"returns":"xml"} +{"name":"tan","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"tand","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"tanh","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"text","args":[{"type":"char"}],"returns":"text"} +{"name":"text","args":[{"type":"boolean"}],"returns":"text"} +{"name":"text","args":[{"type":"character"}],"returns":"text"} +{"name":"text","args":[{"type":"inet"}],"returns":"text"} +{"name":"text","args":[{"type":"name"}],"returns":"text"} +{"name":"text","args":[{"type":"xml"}],"returns":"text"} +{"name":"text_ge","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"text_gt","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"text_larger","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"text_le","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"text_lt","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"text_pattern_ge","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"text_pattern_gt","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"text_pattern_le","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"text_pattern_lt","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"text_smaller","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"textanycat","args":[{"type":"text"},{"type":"anynonarray"}],"returns":"text"} +{"name":"textcat","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"texteq","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"texteqname","args":[{"type":"text"},{"type":"name"}],"returns":"boolean"} +{"name":"textgename","args":[{"type":"text"},{"type":"name"}],"returns":"boolean"} +{"name":"textgtname","args":[{"type":"text"},{"type":"name"}],"returns":"boolean"} +{"name":"texticlike","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"texticnlike","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"texticregexeq","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"texticregexne","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"textin","args":[{"type":"cstring"}],"returns":"text"} +{"name":"textlen","args":[{"type":"text"}],"returns":"integer"} +{"name":"textlename","args":[{"type":"text"},{"type":"name"}],"returns":"boolean"} +{"name":"textlike","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"textltname","args":[{"type":"text"},{"type":"name"}],"returns":"boolean"} +{"name":"textne","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"textnename","args":[{"type":"text"},{"type":"name"}],"returns":"boolean"} +{"name":"textnlike","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"textout","args":[{"type":"text"}],"returns":"cstring"} +{"name":"textregexeq","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"textregexne","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"textsend","args":[{"type":"text"}],"returns":"bytea"} +{"name":"tideq","args":[{"type":"tid"},{"type":"tid"}],"returns":"boolean"} +{"name":"tidge","args":[{"type":"tid"},{"type":"tid"}],"returns":"boolean"} +{"name":"tidgt","args":[{"type":"tid"},{"type":"tid"}],"returns":"boolean"} +{"name":"tidin","args":[{"type":"cstring"}],"returns":"tid"} +{"name":"tidlarger","args":[{"type":"tid"},{"type":"tid"}],"returns":"tid"} +{"name":"tidle","args":[{"type":"tid"},{"type":"tid"}],"returns":"boolean"} +{"name":"tidlt","args":[{"type":"tid"},{"type":"tid"}],"returns":"boolean"} +{"name":"tidne","args":[{"type":"tid"},{"type":"tid"}],"returns":"boolean"} +{"name":"tidout","args":[{"type":"tid"}],"returns":"cstring"} +{"name":"tidsend","args":[{"type":"tid"}],"returns":"bytea"} +{"name":"tidsmaller","args":[{"type":"tid"},{"type":"tid"}],"returns":"tid"} +{"name":"time","args":[{"type":"interval"}],"returns":"time without time zone"} +{"name":"time","args":[{"type":"time with time zone"}],"returns":"time without time zone"} +{"name":"time","args":[{"type":"time without time zone"},{"type":"integer"}],"returns":"time without time zone"} +{"name":"time","args":[{"type":"timestamp with time zone"}],"returns":"time without time zone"} +{"name":"time","args":[{"type":"timestamp without time zone"}],"returns":"time without time zone"} +{"name":"time_cmp","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"integer"} +{"name":"time_eq","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"boolean"} +{"name":"time_ge","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"boolean"} +{"name":"time_gt","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"boolean"} +{"name":"time_hash","args":[{"type":"time without time zone"}],"returns":"integer"} +{"name":"time_hash_extended","args":[{"type":"time without time zone"},{"type":"bigint"}],"returns":"bigint"} +{"name":"time_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"time without time zone"} +{"name":"time_larger","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"time without time zone"} +{"name":"time_le","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"boolean"} +{"name":"time_lt","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"boolean"} +{"name":"time_mi_interval","args":[{"type":"time without time zone"},{"type":"interval"}],"returns":"time without time zone"} +{"name":"time_mi_time","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"interval"} +{"name":"time_ne","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"boolean"} +{"name":"time_out","args":[{"type":"time without time zone"}],"returns":"cstring"} +{"name":"time_pl_interval","args":[{"type":"time without time zone"},{"type":"interval"}],"returns":"time without time zone"} +{"name":"time_send","args":[{"type":"time without time zone"}],"returns":"bytea"} +{"name":"time_smaller","args":[{"type":"time without time zone"},{"type":"time without time zone"}],"returns":"time without time zone"} +{"name":"timedate_pl","args":[{"type":"time without time zone"},{"type":"date"}],"returns":"timestamp without time zone"} +{"name":"timeofday","returns":"text"} +{"name":"timestamp","args":[{"type":"date"}],"returns":"timestamp without time zone"} +{"name":"timestamp","args":[{"type":"date"},{"type":"time without time zone"}],"returns":"timestamp without time zone"} +{"name":"timestamp","args":[{"type":"timestamp with time zone"}],"returns":"timestamp without time zone"} +{"name":"timestamp","args":[{"type":"timestamp without time zone"},{"type":"integer"}],"returns":"timestamp without time zone"} +{"name":"timestamp_cmp","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"integer"} +{"name":"timestamp_cmp_date","args":[{"type":"timestamp without time zone"},{"type":"date"}],"returns":"integer"} +{"name":"timestamp_cmp_timestamptz","args":[{"type":"timestamp without time zone"},{"type":"timestamp with time zone"}],"returns":"integer"} +{"name":"timestamp_eq","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamp_eq_date","args":[{"type":"timestamp without time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamp_eq_timestamptz","args":[{"type":"timestamp without time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamp_ge","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamp_ge_date","args":[{"type":"timestamp without time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamp_ge_timestamptz","args":[{"type":"timestamp without time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamp_gt","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamp_gt_date","args":[{"type":"timestamp without time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamp_gt_timestamptz","args":[{"type":"timestamp without time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamp_hash","args":[{"type":"timestamp without time zone"}],"returns":"integer"} +{"name":"timestamp_hash_extended","args":[{"type":"timestamp without time zone"},{"type":"bigint"}],"returns":"bigint"} +{"name":"timestamp_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"timestamp without time zone"} +{"name":"timestamp_larger","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"timestamp without time zone"} +{"name":"timestamp_le","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamp_le_date","args":[{"type":"timestamp without time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamp_le_timestamptz","args":[{"type":"timestamp without time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamp_lt","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamp_lt_date","args":[{"type":"timestamp without time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamp_lt_timestamptz","args":[{"type":"timestamp without time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamp_mi","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"interval"} +{"name":"timestamp_mi_interval","args":[{"type":"timestamp without time zone"},{"type":"interval"}],"returns":"timestamp without time zone"} +{"name":"timestamp_ne","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamp_ne_date","args":[{"type":"timestamp without time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamp_ne_timestamptz","args":[{"type":"timestamp without time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamp_out","args":[{"type":"timestamp without time zone"}],"returns":"cstring"} +{"name":"timestamp_pl_interval","args":[{"type":"timestamp without time zone"},{"type":"interval"}],"returns":"timestamp without time zone"} +{"name":"timestamp_send","args":[{"type":"timestamp without time zone"}],"returns":"bytea"} +{"name":"timestamp_smaller","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"timestamp without time zone"} +{"name":"timestamptypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"timestamptypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"timestamptz","args":[{"type":"date"}],"returns":"timestamp with time zone"} +{"name":"timestamptz","args":[{"type":"date"},{"type":"time with time zone"}],"returns":"timestamp with time zone"} +{"name":"timestamptz","args":[{"type":"date"},{"type":"time without time zone"}],"returns":"timestamp with time zone"} +{"name":"timestamptz","args":[{"type":"timestamp with time zone"},{"type":"integer"}],"returns":"timestamp with time zone"} +{"name":"timestamptz","args":[{"type":"timestamp without time zone"}],"returns":"timestamp with time zone"} +{"name":"timestamptz_cmp","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"integer"} +{"name":"timestamptz_cmp_date","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"integer"} +{"name":"timestamptz_cmp_timestamp","args":[{"type":"timestamp with time zone"},{"type":"timestamp without time zone"}],"returns":"integer"} +{"name":"timestamptz_eq","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamptz_eq_date","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamptz_eq_timestamp","args":[{"type":"timestamp with time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamptz_ge","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamptz_ge_date","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamptz_ge_timestamp","args":[{"type":"timestamp with time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamptz_gt","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamptz_gt_date","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamptz_gt_timestamp","args":[{"type":"timestamp with time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamptz_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"timestamp with time zone"} +{"name":"timestamptz_larger","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"timestamptz_le","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamptz_le_date","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamptz_le_timestamp","args":[{"type":"timestamp with time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamptz_lt","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamptz_lt_date","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamptz_lt_timestamp","args":[{"type":"timestamp with time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamptz_mi","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"interval"} +{"name":"timestamptz_mi_interval","args":[{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"timestamp with time zone"} +{"name":"timestamptz_ne","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"boolean"} +{"name":"timestamptz_ne_date","args":[{"type":"timestamp with time zone"},{"type":"date"}],"returns":"boolean"} +{"name":"timestamptz_ne_timestamp","args":[{"type":"timestamp with time zone"},{"type":"timestamp without time zone"}],"returns":"boolean"} +{"name":"timestamptz_out","args":[{"type":"timestamp with time zone"}],"returns":"cstring"} +{"name":"timestamptz_pl_interval","args":[{"type":"timestamp with time zone"},{"type":"interval"}],"returns":"timestamp with time zone"} +{"name":"timestamptz_send","args":[{"type":"timestamp with time zone"}],"returns":"bytea"} +{"name":"timestamptz_smaller","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"timestamp with time zone"} +{"name":"timestamptztypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"timestamptztypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"timetypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"timetypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"timetz","args":[{"type":"time with time zone"},{"type":"integer"}],"returns":"time with time zone"} +{"name":"timetz","args":[{"type":"time without time zone"}],"returns":"time with time zone"} +{"name":"timetz","args":[{"type":"timestamp with time zone"}],"returns":"time with time zone"} +{"name":"timetz_cmp","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"integer"} +{"name":"timetz_eq","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"boolean"} +{"name":"timetz_ge","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"boolean"} +{"name":"timetz_gt","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"boolean"} +{"name":"timetz_hash","args":[{"type":"time with time zone"}],"returns":"integer"} +{"name":"timetz_hash_extended","args":[{"type":"time with time zone"},{"type":"bigint"}],"returns":"bigint"} +{"name":"timetz_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"time with time zone"} +{"name":"timetz_larger","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"timetz_le","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"boolean"} +{"name":"timetz_lt","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"boolean"} +{"name":"timetz_mi_interval","args":[{"type":"time with time zone"},{"type":"interval"}],"returns":"time with time zone"} +{"name":"timetz_ne","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"boolean"} +{"name":"timetz_out","args":[{"type":"time with time zone"}],"returns":"cstring"} +{"name":"timetz_pl_interval","args":[{"type":"time with time zone"},{"type":"interval"}],"returns":"time with time zone"} +{"name":"timetz_send","args":[{"type":"time with time zone"}],"returns":"bytea"} +{"name":"timetz_smaller","args":[{"type":"time with time zone"},{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"timetzdate_pl","args":[{"type":"time with time zone"},{"type":"date"}],"returns":"timestamp with time zone"} +{"name":"timetztypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"timetztypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"timezone","args":[{"type":"interval"},{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"timezone","args":[{"type":"text"},{"type":"time with time zone"}],"returns":"time with time zone"} +{"name":"timezone","args":[{"type":"interval"},{"type":"timestamp without time zone"}],"returns":"timestamp with time zone"} +{"name":"timezone","args":[{"type":"text"},{"type":"timestamp without time zone"}],"returns":"timestamp with time zone"} +{"name":"timezone","args":[{"type":"interval"},{"type":"timestamp with time zone"}],"returns":"timestamp without time zone"} +{"name":"timezone","args":[{"type":"text"},{"type":"timestamp with time zone"}],"returns":"timestamp without time zone"} +{"name":"to_ascii","args":[{"type":"text"}],"returns":"text"} +{"name":"to_ascii","args":[{"type":"text"},{"type":"integer"}],"returns":"text"} +{"name":"to_ascii","args":[{"type":"text"},{"type":"name"}],"returns":"text"} +{"name":"to_char","args":[{"type":"bigint"},{"type":"text"}],"returns":"text"} +{"name":"to_char","args":[{"type":"double precision"},{"type":"text"}],"returns":"text"} +{"name":"to_char","args":[{"type":"integer"},{"type":"text"}],"returns":"text"} +{"name":"to_char","args":[{"type":"interval"},{"type":"text"}],"returns":"text"} +{"name":"to_char","args":[{"type":"numeric"},{"type":"text"}],"returns":"text"} +{"name":"to_char","args":[{"type":"real"},{"type":"text"}],"returns":"text"} +{"name":"to_char","args":[{"type":"timestamp with time zone"},{"type":"text"}],"returns":"text"} +{"name":"to_char","args":[{"type":"timestamp without time zone"},{"type":"text"}],"returns":"text"} +{"name":"to_date","args":[{"type":"text"},{"type":"text"}],"returns":"date"} +{"name":"to_hex","args":[{"type":"bigint"}],"returns":"text"} +{"name":"to_hex","args":[{"type":"integer"}],"returns":"text"} +{"name":"to_json","args":[{"type":"anyelement"}],"returns":"json"} +{"name":"to_jsonb","args":[{"type":"anyelement"}],"returns":"jsonb"} +{"name":"to_number","args":[{"type":"text"},{"type":"text"}],"returns":"numeric"} +{"name":"to_regclass","args":[{"type":"text"}],"returns":"regclass"} +{"name":"to_regcollation","args":[{"type":"text"}],"returns":"regcollation"} +{"name":"to_regnamespace","args":[{"type":"text"}],"returns":"regnamespace"} +{"name":"to_regoper","args":[{"type":"text"}],"returns":"regoper"} +{"name":"to_regoperator","args":[{"type":"text"}],"returns":"regoperator"} +{"name":"to_regproc","args":[{"type":"text"}],"returns":"regproc"} +{"name":"to_regprocedure","args":[{"type":"text"}],"returns":"regprocedure"} +{"name":"to_regrole","args":[{"type":"text"}],"returns":"regrole"} +{"name":"to_regtype","args":[{"type":"text"}],"returns":"regtype"} +{"name":"to_timestamp","args":[{"type":"double precision"}],"returns":"timestamp with time zone"} +{"name":"to_timestamp","args":[{"type":"text"},{"type":"text"}],"returns":"timestamp with time zone"} +{"name":"to_tsquery","args":[{"type":"regconfig"},{"type":"text"}],"returns":"tsquery"} +{"name":"to_tsquery","args":[{"type":"text"}],"returns":"tsquery"} +{"name":"to_tsvector","args":[{"type":"json"}],"returns":"tsvector"} +{"name":"to_tsvector","args":[{"type":"jsonb"}],"returns":"tsvector"} +{"name":"to_tsvector","args":[{"type":"regconfig"},{"type":"json"}],"returns":"tsvector"} +{"name":"to_tsvector","args":[{"type":"regconfig"},{"type":"jsonb"}],"returns":"tsvector"} +{"name":"to_tsvector","args":[{"type":"regconfig"},{"type":"text"}],"returns":"tsvector"} +{"name":"to_tsvector","args":[{"type":"text"}],"returns":"tsvector"} +{"name":"transaction_timestamp","returns":"timestamp with time zone"} +{"name":"translate","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"trigger_in","args":[{"type":"cstring"}],"returns":"trigger"} +{"name":"trigger_out","args":[{"type":"trigger"}],"returns":"cstring"} +{"name":"trim_array","args":[{"type":"anyarray"},{"type":"integer"}],"returns":"anyarray"} +{"name":"trim_scale","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"trunc","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"trunc","args":[{"type":"macaddr"}],"returns":"macaddr"} +{"name":"trunc","args":[{"type":"macaddr8"}],"returns":"macaddr8"} +{"name":"trunc","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"trunc","args":[{"type":"numeric"},{"type":"integer"}],"returns":"numeric"} +{"name":"ts_debug","args":[{"name":"config","type":"regconfig"},{"name":"document","type":"text"}],"returns":"record"} +{"name":"ts_debug","args":[{"name":"document","type":"text"}],"returns":"record"} +{"name":"ts_delete","args":[{"type":"tsvector"},{"type":"text"}],"returns":"tsvector"} +{"name":"ts_delete","args":[{"type":"tsvector"},{"type":"text[]"}],"returns":"tsvector"} +{"name":"ts_filter","args":[{"type":"tsvector"},{"type":"char[]"}],"returns":"tsvector"} +{"name":"ts_headline","args":[{"type":"json"},{"type":"tsquery"}],"returns":"json"} +{"name":"ts_headline","args":[{"type":"json"},{"type":"tsquery"},{"type":"text"}],"returns":"json"} +{"name":"ts_headline","args":[{"type":"regconfig"},{"type":"json"},{"type":"tsquery"}],"returns":"json"} +{"name":"ts_headline","args":[{"type":"regconfig"},{"type":"json"},{"type":"tsquery"},{"type":"text"}],"returns":"json"} +{"name":"ts_headline","args":[{"type":"jsonb"},{"type":"tsquery"}],"returns":"jsonb"} +{"name":"ts_headline","args":[{"type":"jsonb"},{"type":"tsquery"},{"type":"text"}],"returns":"jsonb"} +{"name":"ts_headline","args":[{"type":"regconfig"},{"type":"jsonb"},{"type":"tsquery"}],"returns":"jsonb"} +{"name":"ts_headline","args":[{"type":"regconfig"},{"type":"jsonb"},{"type":"tsquery"},{"type":"text"}],"returns":"jsonb"} +{"name":"ts_headline","args":[{"type":"regconfig"},{"type":"text"},{"type":"tsquery"}],"returns":"text"} +{"name":"ts_headline","args":[{"type":"regconfig"},{"type":"text"},{"type":"tsquery"},{"type":"text"}],"returns":"text"} +{"name":"ts_headline","args":[{"type":"text"},{"type":"tsquery"}],"returns":"text"} +{"name":"ts_headline","args":[{"type":"text"},{"type":"tsquery"},{"type":"text"}],"returns":"text"} +{"name":"ts_lexize","args":[{"type":"regdictionary"},{"type":"text"}],"returns":"text[]"} +{"name":"ts_match_qv","args":[{"type":"tsquery"},{"type":"tsvector"}],"returns":"boolean"} +{"name":"ts_match_tq","args":[{"type":"text"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"ts_match_tt","args":[{"type":"text"},{"type":"text"}],"returns":"boolean"} +{"name":"ts_match_vq","args":[{"type":"tsvector"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"ts_parse","args":[{"name":"parser_oid","type":"oid"},{"name":"txt","type":"text"}],"returns":"record"} +{"name":"ts_parse","args":[{"name":"parser_name","type":"text"},{"name":"txt","type":"text"}],"returns":"record"} +{"name":"ts_rank","args":[{"type":"real[]"},{"type":"tsvector"},{"type":"tsquery"}],"returns":"real"} +{"name":"ts_rank","args":[{"type":"real[]"},{"type":"tsvector"},{"type":"tsquery"},{"type":"integer"}],"returns":"real"} +{"name":"ts_rank","args":[{"type":"tsvector"},{"type":"tsquery"}],"returns":"real"} +{"name":"ts_rank","args":[{"type":"tsvector"},{"type":"tsquery"},{"type":"integer"}],"returns":"real"} +{"name":"ts_rank_cd","args":[{"type":"real[]"},{"type":"tsvector"},{"type":"tsquery"}],"returns":"real"} +{"name":"ts_rank_cd","args":[{"type":"real[]"},{"type":"tsvector"},{"type":"tsquery"},{"type":"integer"}],"returns":"real"} +{"name":"ts_rank_cd","args":[{"type":"tsvector"},{"type":"tsquery"}],"returns":"real"} +{"name":"ts_rank_cd","args":[{"type":"tsvector"},{"type":"tsquery"},{"type":"integer"}],"returns":"real"} +{"name":"ts_rewrite","args":[{"type":"tsquery"},{"type":"text"}],"returns":"tsquery"} +{"name":"ts_rewrite","args":[{"type":"tsquery"},{"type":"tsquery"},{"type":"tsquery"}],"returns":"tsquery"} +{"name":"ts_stat","args":[{"name":"query","type":"text"}],"returns":"record"} +{"name":"ts_stat","args":[{"name":"query","type":"text"},{"name":"weights","type":"text"}],"returns":"record"} +{"name":"ts_token_type","args":[{"name":"parser_oid","type":"oid"}],"returns":"record"} +{"name":"ts_token_type","args":[{"name":"parser_name","type":"text"}],"returns":"record"} +{"name":"tsm_handler_in","args":[{"type":"cstring"}],"returns":"tsm_handler"} +{"name":"tsm_handler_out","args":[{"type":"tsm_handler"}],"returns":"cstring"} +{"name":"tsmultirange","returns":"tsmultirange"} +{"name":"tsmultirange","args":[{"type":"tsrange"}],"returns":"tsmultirange"} +{"name":"tsmultirange","args":[{"type":"tsrange[]","mode":"v"}],"returns":"tsmultirange"} +{"name":"tsq_mcontained","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"tsq_mcontains","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"tsquery_and","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"tsquery"} +{"name":"tsquery_cmp","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"integer"} +{"name":"tsquery_eq","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"tsquery_ge","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"tsquery_gt","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"tsquery_le","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"tsquery_lt","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"tsquery_ne","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"boolean"} +{"name":"tsquery_not","args":[{"type":"tsquery"}],"returns":"tsquery"} +{"name":"tsquery_or","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"tsquery"} +{"name":"tsquery_phrase","args":[{"type":"tsquery"},{"type":"tsquery"}],"returns":"tsquery"} +{"name":"tsquery_phrase","args":[{"type":"tsquery"},{"type":"tsquery"},{"type":"integer"}],"returns":"tsquery"} +{"name":"tsqueryin","args":[{"type":"cstring"}],"returns":"tsquery"} +{"name":"tsqueryout","args":[{"type":"tsquery"}],"returns":"cstring"} +{"name":"tsquerysend","args":[{"type":"tsquery"}],"returns":"bytea"} +{"name":"tsrange","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"tsrange"} +{"name":"tsrange","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"},{"type":"text"}],"returns":"tsrange"} +{"name":"tsrange_subdiff","args":[{"type":"timestamp without time zone"},{"type":"timestamp without time zone"}],"returns":"double precision"} +{"name":"tstzmultirange","returns":"tstzmultirange"} +{"name":"tstzmultirange","args":[{"type":"tstzrange"}],"returns":"tstzmultirange"} +{"name":"tstzmultirange","args":[{"type":"tstzrange[]","mode":"v"}],"returns":"tstzmultirange"} +{"name":"tstzrange","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"tstzrange"} +{"name":"tstzrange","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"},{"type":"text"}],"returns":"tstzrange"} +{"name":"tstzrange_subdiff","args":[{"type":"timestamp with time zone"},{"type":"timestamp with time zone"}],"returns":"double precision"} +{"name":"tsvector_cmp","args":[{"type":"tsvector"},{"type":"tsvector"}],"returns":"integer"} +{"name":"tsvector_concat","args":[{"type":"tsvector"},{"type":"tsvector"}],"returns":"tsvector"} +{"name":"tsvector_eq","args":[{"type":"tsvector"},{"type":"tsvector"}],"returns":"boolean"} +{"name":"tsvector_ge","args":[{"type":"tsvector"},{"type":"tsvector"}],"returns":"boolean"} +{"name":"tsvector_gt","args":[{"type":"tsvector"},{"type":"tsvector"}],"returns":"boolean"} +{"name":"tsvector_le","args":[{"type":"tsvector"},{"type":"tsvector"}],"returns":"boolean"} +{"name":"tsvector_lt","args":[{"type":"tsvector"},{"type":"tsvector"}],"returns":"boolean"} +{"name":"tsvector_ne","args":[{"type":"tsvector"},{"type":"tsvector"}],"returns":"boolean"} +{"name":"tsvector_to_array","args":[{"type":"tsvector"}],"returns":"text[]"} +{"name":"tsvector_update_trigger","returns":"trigger"} +{"name":"tsvector_update_trigger_column","returns":"trigger"} +{"name":"tsvectorin","args":[{"type":"cstring"}],"returns":"tsvector"} +{"name":"tsvectorout","args":[{"type":"tsvector"}],"returns":"cstring"} +{"name":"tsvectorsend","args":[{"type":"tsvector"}],"returns":"bytea"} +{"name":"txid_current","returns":"bigint"} +{"name":"txid_current_if_assigned","returns":"bigint"} +{"name":"txid_current_snapshot","returns":"txid_snapshot"} +{"name":"txid_snapshot_in","args":[{"type":"cstring"}],"returns":"txid_snapshot"} +{"name":"txid_snapshot_out","args":[{"type":"txid_snapshot"}],"returns":"cstring"} +{"name":"txid_snapshot_send","args":[{"type":"txid_snapshot"}],"returns":"bytea"} +{"name":"txid_snapshot_xip","args":[{"type":"txid_snapshot"}],"returns":"bigint"} +{"name":"txid_snapshot_xmax","args":[{"type":"txid_snapshot"}],"returns":"bigint"} +{"name":"txid_snapshot_xmin","args":[{"type":"txid_snapshot"}],"returns":"bigint"} +{"name":"txid_status","args":[{"type":"bigint"}],"returns":"text"} +{"name":"txid_visible_in_snapshot","args":[{"type":"bigint"},{"type":"txid_snapshot"}],"returns":"boolean"} +{"name":"unique_key_recheck","returns":"trigger"} +{"name":"unistr","args":[{"type":"text"}],"returns":"text"} +{"name":"unknownin","args":[{"type":"cstring"}],"returns":"unknown"} +{"name":"unknownout","args":[{"type":"unknown"}],"returns":"cstring"} +{"name":"unknownsend","args":[{"type":"unknown"}],"returns":"bytea"} +{"name":"unnest","args":[{"type":"anyarray"}],"returns":"anyelement"} +{"name":"unnest","args":[{"type":"anymultirange"}],"returns":"anyrange"} +{"name":"unnest","args":[{"name":"tsvector","type":"tsvector"}],"returns":"record"} +{"name":"upper","args":[{"type":"anymultirange"}],"returns":"anyelement"} +{"name":"upper","args":[{"type":"anyrange"}],"returns":"anyelement"} +{"name":"upper","args":[{"type":"text"}],"returns":"text"} +{"name":"upper_inc","args":[{"type":"anymultirange"}],"returns":"boolean"} +{"name":"upper_inc","args":[{"type":"anyrange"}],"returns":"boolean"} +{"name":"upper_inf","args":[{"type":"anymultirange"}],"returns":"boolean"} +{"name":"upper_inf","args":[{"type":"anyrange"}],"returns":"boolean"} +{"name":"uuid_cmp","args":[{"type":"uuid"},{"type":"uuid"}],"returns":"integer"} +{"name":"uuid_eq","args":[{"type":"uuid"},{"type":"uuid"}],"returns":"boolean"} +{"name":"uuid_ge","args":[{"type":"uuid"},{"type":"uuid"}],"returns":"boolean"} +{"name":"uuid_gt","args":[{"type":"uuid"},{"type":"uuid"}],"returns":"boolean"} +{"name":"uuid_hash","args":[{"type":"uuid"}],"returns":"integer"} +{"name":"uuid_hash_extended","args":[{"type":"uuid"},{"type":"bigint"}],"returns":"bigint"} +{"name":"uuid_in","args":[{"type":"cstring"}],"returns":"uuid"} +{"name":"uuid_le","args":[{"type":"uuid"},{"type":"uuid"}],"returns":"boolean"} +{"name":"uuid_lt","args":[{"type":"uuid"},{"type":"uuid"}],"returns":"boolean"} +{"name":"uuid_ne","args":[{"type":"uuid"},{"type":"uuid"}],"returns":"boolean"} +{"name":"uuid_out","args":[{"type":"uuid"}],"returns":"cstring"} +{"name":"uuid_send","args":[{"type":"uuid"}],"returns":"bytea"} +{"name":"var_pop","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"var_pop","args":[{"type":"real"}],"returns":"double precision"} +{"name":"var_pop","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"var_pop","args":[{"type":"integer"}],"returns":"numeric"} +{"name":"var_pop","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"var_pop","args":[{"type":"smallint"}],"returns":"numeric"} +{"name":"var_samp","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"var_samp","args":[{"type":"real"}],"returns":"double precision"} +{"name":"var_samp","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"var_samp","args":[{"type":"integer"}],"returns":"numeric"} +{"name":"var_samp","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"var_samp","args":[{"type":"smallint"}],"returns":"numeric"} +{"name":"varbit","args":[{"type":"bit varying"},{"type":"integer"},{"type":"boolean"}],"returns":"bit varying"} +{"name":"varbit_in","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"bit varying"} +{"name":"varbit_out","args":[{"type":"bit varying"}],"returns":"cstring"} +{"name":"varbit_send","args":[{"type":"bit varying"}],"returns":"bytea"} +{"name":"varbitcmp","args":[{"type":"bit varying"},{"type":"bit varying"}],"returns":"integer"} +{"name":"varbiteq","args":[{"type":"bit varying"},{"type":"bit varying"}],"returns":"boolean"} +{"name":"varbitge","args":[{"type":"bit varying"},{"type":"bit varying"}],"returns":"boolean"} +{"name":"varbitgt","args":[{"type":"bit varying"},{"type":"bit varying"}],"returns":"boolean"} +{"name":"varbitle","args":[{"type":"bit varying"},{"type":"bit varying"}],"returns":"boolean"} +{"name":"varbitlt","args":[{"type":"bit varying"},{"type":"bit varying"}],"returns":"boolean"} +{"name":"varbitne","args":[{"type":"bit varying"},{"type":"bit varying"}],"returns":"boolean"} +{"name":"varbittypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"varbittypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"varchar","args":[{"type":"character varying"},{"type":"integer"},{"type":"boolean"}],"returns":"character varying"} +{"name":"varchar","args":[{"type":"name"}],"returns":"character varying"} +{"name":"varcharin","args":[{"type":"cstring"},{"type":"oid"},{"type":"integer"}],"returns":"character varying"} +{"name":"varcharout","args":[{"type":"character varying"}],"returns":"cstring"} +{"name":"varcharsend","args":[{"type":"character varying"}],"returns":"bytea"} +{"name":"varchartypmodin","args":[{"type":"cstring[]"}],"returns":"integer"} +{"name":"varchartypmodout","args":[{"type":"integer"}],"returns":"cstring"} +{"name":"variance","args":[{"type":"double precision"}],"returns":"double precision"} +{"name":"variance","args":[{"type":"real"}],"returns":"double precision"} +{"name":"variance","args":[{"type":"bigint"}],"returns":"numeric"} +{"name":"variance","args":[{"type":"integer"}],"returns":"numeric"} +{"name":"variance","args":[{"type":"numeric"}],"returns":"numeric"} +{"name":"variance","args":[{"type":"smallint"}],"returns":"numeric"} +{"name":"version","returns":"text"} +{"name":"void_in","args":[{"type":"cstring"}],"returns":"void"} +{"name":"void_out","args":[{"type":"void"}],"returns":"cstring"} +{"name":"void_send","args":[{"type":"void"}],"returns":"bytea"} +{"name":"websearch_to_tsquery","args":[{"type":"regconfig"},{"type":"text"}],"returns":"tsquery"} +{"name":"websearch_to_tsquery","args":[{"type":"text"}],"returns":"tsquery"} +{"name":"width","args":[{"type":"box"}],"returns":"double precision"} +{"name":"width_bucket","args":[{"type":"anycompatible"},{"type":"anycompatiblearray"}],"returns":"integer"} +{"name":"width_bucket","args":[{"type":"double precision"},{"type":"double precision"},{"type":"double precision"},{"type":"integer"}],"returns":"integer"} +{"name":"width_bucket","args":[{"type":"numeric"},{"type":"numeric"},{"type":"numeric"},{"type":"integer"}],"returns":"integer"} +{"name":"xid","args":[{"type":"xid8"}],"returns":"xid"} +{"name":"xid8_larger","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"xid8"} +{"name":"xid8_smaller","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"xid8"} +{"name":"xid8cmp","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"integer"} +{"name":"xid8eq","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"boolean"} +{"name":"xid8ge","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"boolean"} +{"name":"xid8gt","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"boolean"} +{"name":"xid8in","args":[{"type":"cstring"}],"returns":"xid8"} +{"name":"xid8le","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"boolean"} +{"name":"xid8lt","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"boolean"} +{"name":"xid8ne","args":[{"type":"xid8"},{"type":"xid8"}],"returns":"boolean"} +{"name":"xid8out","args":[{"type":"xid8"}],"returns":"cstring"} +{"name":"xid8send","args":[{"type":"xid8"}],"returns":"bytea"} +{"name":"xideq","args":[{"type":"xid"},{"type":"xid"}],"returns":"boolean"} +{"name":"xideqint4","args":[{"type":"xid"},{"type":"integer"}],"returns":"boolean"} +{"name":"xidin","args":[{"type":"cstring"}],"returns":"xid"} +{"name":"xidneq","args":[{"type":"xid"},{"type":"xid"}],"returns":"boolean"} +{"name":"xidneqint4","args":[{"type":"xid"},{"type":"integer"}],"returns":"boolean"} +{"name":"xidout","args":[{"type":"xid"}],"returns":"cstring"} +{"name":"xidsend","args":[{"type":"xid"}],"returns":"bytea"} +{"name":"xml","args":[{"type":"text"}],"returns":"xml"} +{"name":"xml_in","args":[{"type":"cstring"}],"returns":"xml"} +{"name":"xml_is_well_formed","args":[{"type":"text"}],"returns":"boolean"} +{"name":"xml_is_well_formed_content","args":[{"type":"text"}],"returns":"boolean"} +{"name":"xml_is_well_formed_document","args":[{"type":"text"}],"returns":"boolean"} +{"name":"xml_out","args":[{"type":"xml"}],"returns":"cstring"} +{"name":"xml_send","args":[{"type":"xml"}],"returns":"bytea"} +{"name":"xmlagg","args":[{"type":"xml"}],"returns":"xml"} +{"name":"xmlcomment","args":[{"type":"text"}],"returns":"xml"} +{"name":"xmlconcat2","args":[{"type":"xml"},{"type":"xml"}],"returns":"xml"} +{"name":"xmlexists","args":[{"type":"text"},{"type":"xml"}],"returns":"boolean"} +{"name":"xmlvalidate","args":[{"type":"xml"},{"type":"text"}],"returns":"boolean"} +{"name":"xpath","args":[{"type":"text"},{"type":"xml"}],"returns":"xml[]"} +{"name":"xpath","args":[{"type":"text"},{"type":"xml"},{"type":"text[]"}],"returns":"xml[]"} +{"name":"xpath_exists","args":[{"type":"text"},{"type":"xml"}],"returns":"boolean"} +{"name":"xpath_exists","args":[{"type":"text"},{"type":"xml"},{"type":"text[]"}],"returns":"boolean"} diff --git a/internal/engine/postgresql/dialect/operators.jsonl b/internal/engine/postgresql/dialect/operators.jsonl new file mode 100644 index 0000000000..877264944c --- /dev/null +++ b/internal/engine/postgresql/dialect/operators.jsonl @@ -0,0 +1,21 @@ +{"name": "||", "left": "text", "right": "text", "result": "text"} +{"name": "~~", "left": "text", "right": "text", "result": "bool"} +{"name": "!~~", "left": "text", "right": "text", "result": "bool"} +{"name": "~~*", "left": "text", "right": "text", "result": "bool"} +{"name": "!~~*", "left": "text", "right": "text", "result": "bool"} +{"name": "~", "left": "text", "right": "text", "result": "bool"} +{"name": "!~", "left": "text", "right": "text", "result": "bool"} +{"name": "~*", "left": "text", "right": "text", "result": "bool"} +{"name": "!~*", "left": "text", "right": "text", "result": "bool"} +{"name": "@>", "left": "jsonb", "right": "jsonb", "result": "bool"} +{"name": "<@", "left": "jsonb", "right": "jsonb", "result": "bool"} +{"name": "->", "left": "jsonb", "right": "text", "result": "jsonb"} +{"name": "->>", "left": "jsonb", "right": "text", "result": "text"} +{"name": "->", "left": "json", "right": "text", "result": "json"} +{"name": "->>", "left": "json", "right": "text", "result": "text"} +{"name": "+", "left": "date", "right": "int4", "result": "date"} +{"name": "-", "left": "date", "right": "int4", "result": "date"} +{"name": "+", "left": "timestamptz", "right": "interval", "result": "timestamptz"} +{"name": "-", "left": "timestamptz", "right": "interval", "result": "timestamptz"} +{"name": "+", "left": "timestamp", "right": "interval", "result": "timestamp"} +{"name": "-", "left": "timestamp", "right": "interval", "result": "timestamp"} diff --git a/internal/engine/postgresql/dialect/relations.jsonl b/internal/engine/postgresql/dialect/relations.jsonl new file mode 100644 index 0000000000..b93fada4ac --- /dev/null +++ b/internal/engine/postgresql/dialect/relations.jsonl @@ -0,0 +1,209 @@ +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_aggregate","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"aggfnoid","type":"regproc","not_null":true,"length":4},{"name":"aggkind","type":"char","not_null":true,"length":1},{"name":"aggnumdirectargs","type":"int2","not_null":true,"length":2},{"name":"aggtransfn","type":"regproc","not_null":true,"length":4},{"name":"aggfinalfn","type":"regproc","not_null":true,"length":4},{"name":"aggcombinefn","type":"regproc","not_null":true,"length":4},{"name":"aggserialfn","type":"regproc","not_null":true,"length":4},{"name":"aggdeserialfn","type":"regproc","not_null":true,"length":4},{"name":"aggmtransfn","type":"regproc","not_null":true,"length":4},{"name":"aggminvtransfn","type":"regproc","not_null":true,"length":4},{"name":"aggmfinalfn","type":"regproc","not_null":true,"length":4},{"name":"aggfinalextra","type":"bool","not_null":true,"length":1},{"name":"aggmfinalextra","type":"bool","not_null":true,"length":1},{"name":"aggfinalmodify","type":"char","not_null":true,"length":1},{"name":"aggmfinalmodify","type":"char","not_null":true,"length":1},{"name":"aggsortop","type":"oid","not_null":true,"length":4},{"name":"aggtranstype","type":"oid","not_null":true,"length":4},{"name":"aggtransspace","type":"int4","not_null":true,"length":4},{"name":"aggmtranstype","type":"oid","not_null":true,"length":4},{"name":"aggmtransspace","type":"int4","not_null":true,"length":4},{"name":"agginitval","type":"text"},{"name":"aggminitval","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_am","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"amname","type":"name","not_null":true,"length":64},{"name":"amhandler","type":"regproc","not_null":true,"length":4},{"name":"amtype","type":"char","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_amop","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"amopfamily","type":"oid","not_null":true,"length":4},{"name":"amoplefttype","type":"oid","not_null":true,"length":4},{"name":"amoprighttype","type":"oid","not_null":true,"length":4},{"name":"amopstrategy","type":"int2","not_null":true,"length":2},{"name":"amoppurpose","type":"char","not_null":true,"length":1},{"name":"amopopr","type":"oid","not_null":true,"length":4},{"name":"amopmethod","type":"oid","not_null":true,"length":4},{"name":"amopsortfamily","type":"oid","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_amproc","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"amprocfamily","type":"oid","not_null":true,"length":4},{"name":"amproclefttype","type":"oid","not_null":true,"length":4},{"name":"amprocrighttype","type":"oid","not_null":true,"length":4},{"name":"amprocnum","type":"int2","not_null":true,"length":2},{"name":"amproc","type":"regproc","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_attrdef","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"adrelid","type":"oid","not_null":true,"length":4},{"name":"adnum","type":"int2","not_null":true,"length":2},{"name":"adbin","type":"pg_node_tree","not_null":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_attribute","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"attrelid","type":"oid","not_null":true,"length":4},{"name":"attname","type":"name","not_null":true,"length":64},{"name":"atttypid","type":"oid","not_null":true,"length":4},{"name":"attlen","type":"int2","not_null":true,"length":2},{"name":"attnum","type":"int2","not_null":true,"length":2},{"name":"attcacheoff","type":"int4","not_null":true,"length":4},{"name":"atttypmod","type":"int4","not_null":true,"length":4},{"name":"attndims","type":"int2","not_null":true,"length":2},{"name":"attbyval","type":"bool","not_null":true,"length":1},{"name":"attalign","type":"char","not_null":true,"length":1},{"name":"attstorage","type":"char","not_null":true,"length":1},{"name":"attcompression","type":"char","not_null":true,"length":1},{"name":"attnotnull","type":"bool","not_null":true,"length":1},{"name":"atthasdef","type":"bool","not_null":true,"length":1},{"name":"atthasmissing","type":"bool","not_null":true,"length":1},{"name":"attidentity","type":"char","not_null":true,"length":1},{"name":"attgenerated","type":"char","not_null":true,"length":1},{"name":"attisdropped","type":"bool","not_null":true,"length":1},{"name":"attislocal","type":"bool","not_null":true,"length":1},{"name":"attinhcount","type":"int2","not_null":true,"length":2},{"name":"attstattarget","type":"int2","not_null":true,"length":2},{"name":"attcollation","type":"oid","not_null":true,"length":4},{"name":"attacl","type":"aclitem","array":true,"length":16},{"name":"attoptions","type":"text","array":true},{"name":"attfdwoptions","type":"text","array":true},{"name":"attmissingval","type":"anyarray"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_auth_members","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"roleid","type":"oid","not_null":true,"length":4},{"name":"member","type":"oid","not_null":true,"length":4},{"name":"grantor","type":"oid","not_null":true,"length":4},{"name":"admin_option","type":"bool","not_null":true,"length":1},{"name":"inherit_option","type":"bool","not_null":true,"length":1},{"name":"set_option","type":"bool","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_authid","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"rolname","type":"name","not_null":true,"length":64},{"name":"rolsuper","type":"bool","not_null":true,"length":1},{"name":"rolinherit","type":"bool","not_null":true,"length":1},{"name":"rolcreaterole","type":"bool","not_null":true,"length":1},{"name":"rolcreatedb","type":"bool","not_null":true,"length":1},{"name":"rolcanlogin","type":"bool","not_null":true,"length":1},{"name":"rolreplication","type":"bool","not_null":true,"length":1},{"name":"rolbypassrls","type":"bool","not_null":true,"length":1},{"name":"rolconnlimit","type":"int4","not_null":true,"length":4},{"name":"rolpassword","type":"text"},{"name":"rolvaliduntil","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_available_extension_versions","columns":[{"name":"name","type":"name","length":64},{"name":"version","type":"text"},{"name":"installed","type":"bool","length":1},{"name":"superuser","type":"bool","length":1},{"name":"trusted","type":"bool","length":1},{"name":"relocatable","type":"bool","length":1},{"name":"schema","type":"name","length":64},{"name":"requires","type":"name","array":true,"length":64},{"name":"comment","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_available_extensions","columns":[{"name":"name","type":"name","length":64},{"name":"default_version","type":"text"},{"name":"installed_version","type":"text"},{"name":"comment","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_backend_memory_contexts","columns":[{"name":"name","type":"text"},{"name":"ident","type":"text"},{"name":"parent","type":"text"},{"name":"level","type":"int4","length":4},{"name":"total_bytes","type":"int8","length":8},{"name":"total_nblocks","type":"int8","length":8},{"name":"free_bytes","type":"int8","length":8},{"name":"free_chunks","type":"int8","length":8},{"name":"used_bytes","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_cast","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"castsource","type":"oid","not_null":true,"length":4},{"name":"casttarget","type":"oid","not_null":true,"length":4},{"name":"castfunc","type":"oid","not_null":true,"length":4},{"name":"castcontext","type":"char","not_null":true,"length":1},{"name":"castmethod","type":"char","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_class","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"relname","type":"name","not_null":true,"length":64},{"name":"relnamespace","type":"oid","not_null":true,"length":4},{"name":"reltype","type":"oid","not_null":true,"length":4},{"name":"reloftype","type":"oid","not_null":true,"length":4},{"name":"relowner","type":"oid","not_null":true,"length":4},{"name":"relam","type":"oid","not_null":true,"length":4},{"name":"relfilenode","type":"oid","not_null":true,"length":4},{"name":"reltablespace","type":"oid","not_null":true,"length":4},{"name":"relpages","type":"int4","not_null":true,"length":4},{"name":"reltuples","type":"float4","not_null":true,"length":4},{"name":"relallvisible","type":"int4","not_null":true,"length":4},{"name":"reltoastrelid","type":"oid","not_null":true,"length":4},{"name":"relhasindex","type":"bool","not_null":true,"length":1},{"name":"relisshared","type":"bool","not_null":true,"length":1},{"name":"relpersistence","type":"char","not_null":true,"length":1},{"name":"relkind","type":"char","not_null":true,"length":1},{"name":"relnatts","type":"int2","not_null":true,"length":2},{"name":"relchecks","type":"int2","not_null":true,"length":2},{"name":"relhasrules","type":"bool","not_null":true,"length":1},{"name":"relhastriggers","type":"bool","not_null":true,"length":1},{"name":"relhassubclass","type":"bool","not_null":true,"length":1},{"name":"relrowsecurity","type":"bool","not_null":true,"length":1},{"name":"relforcerowsecurity","type":"bool","not_null":true,"length":1},{"name":"relispopulated","type":"bool","not_null":true,"length":1},{"name":"relreplident","type":"char","not_null":true,"length":1},{"name":"relispartition","type":"bool","not_null":true,"length":1},{"name":"relrewrite","type":"oid","not_null":true,"length":4},{"name":"relfrozenxid","type":"xid","not_null":true,"length":4},{"name":"relminmxid","type":"xid","not_null":true,"length":4},{"name":"relacl","type":"aclitem","array":true,"length":16},{"name":"reloptions","type":"text","array":true},{"name":"relpartbound","type":"pg_node_tree"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_collation","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"collname","type":"name","not_null":true,"length":64},{"name":"collnamespace","type":"oid","not_null":true,"length":4},{"name":"collowner","type":"oid","not_null":true,"length":4},{"name":"collprovider","type":"char","not_null":true,"length":1},{"name":"collisdeterministic","type":"bool","not_null":true,"length":1},{"name":"collencoding","type":"int4","not_null":true,"length":4},{"name":"collcollate","type":"text"},{"name":"collctype","type":"text"},{"name":"colliculocale","type":"text"},{"name":"collicurules","type":"text"},{"name":"collversion","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_config","columns":[{"name":"name","type":"text"},{"name":"setting","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_constraint","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"conname","type":"name","not_null":true,"length":64},{"name":"connamespace","type":"oid","not_null":true,"length":4},{"name":"contype","type":"char","not_null":true,"length":1},{"name":"condeferrable","type":"bool","not_null":true,"length":1},{"name":"condeferred","type":"bool","not_null":true,"length":1},{"name":"convalidated","type":"bool","not_null":true,"length":1},{"name":"conrelid","type":"oid","not_null":true,"length":4},{"name":"contypid","type":"oid","not_null":true,"length":4},{"name":"conindid","type":"oid","not_null":true,"length":4},{"name":"conparentid","type":"oid","not_null":true,"length":4},{"name":"confrelid","type":"oid","not_null":true,"length":4},{"name":"confupdtype","type":"char","not_null":true,"length":1},{"name":"confdeltype","type":"char","not_null":true,"length":1},{"name":"confmatchtype","type":"char","not_null":true,"length":1},{"name":"conislocal","type":"bool","not_null":true,"length":1},{"name":"coninhcount","type":"int2","not_null":true,"length":2},{"name":"connoinherit","type":"bool","not_null":true,"length":1},{"name":"conkey","type":"int2","array":true,"length":2},{"name":"confkey","type":"int2","array":true,"length":2},{"name":"conpfeqop","type":"oid","array":true,"length":4},{"name":"conppeqop","type":"oid","array":true,"length":4},{"name":"conffeqop","type":"oid","array":true,"length":4},{"name":"confdelsetcols","type":"int2","array":true,"length":2},{"name":"conexclop","type":"oid","array":true,"length":4},{"name":"conbin","type":"pg_node_tree"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_conversion","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"conname","type":"name","not_null":true,"length":64},{"name":"connamespace","type":"oid","not_null":true,"length":4},{"name":"conowner","type":"oid","not_null":true,"length":4},{"name":"conforencoding","type":"int4","not_null":true,"length":4},{"name":"contoencoding","type":"int4","not_null":true,"length":4},{"name":"conproc","type":"regproc","not_null":true,"length":4},{"name":"condefault","type":"bool","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_cursors","columns":[{"name":"name","type":"text"},{"name":"statement","type":"text"},{"name":"is_holdable","type":"bool","length":1},{"name":"is_binary","type":"bool","length":1},{"name":"is_scrollable","type":"bool","length":1},{"name":"creation_time","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_database","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"datname","type":"name","not_null":true,"length":64},{"name":"datdba","type":"oid","not_null":true,"length":4},{"name":"encoding","type":"int4","not_null":true,"length":4},{"name":"datlocprovider","type":"char","not_null":true,"length":1},{"name":"datistemplate","type":"bool","not_null":true,"length":1},{"name":"datallowconn","type":"bool","not_null":true,"length":1},{"name":"datconnlimit","type":"int4","not_null":true,"length":4},{"name":"datfrozenxid","type":"xid","not_null":true,"length":4},{"name":"datminmxid","type":"xid","not_null":true,"length":4},{"name":"dattablespace","type":"oid","not_null":true,"length":4},{"name":"datcollate","type":"text","not_null":true},{"name":"datctype","type":"text","not_null":true},{"name":"daticulocale","type":"text"},{"name":"daticurules","type":"text"},{"name":"datcollversion","type":"text"},{"name":"datacl","type":"aclitem","array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_db_role_setting","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"setdatabase","type":"oid","not_null":true,"length":4},{"name":"setrole","type":"oid","not_null":true,"length":4},{"name":"setconfig","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_default_acl","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"defaclrole","type":"oid","not_null":true,"length":4},{"name":"defaclnamespace","type":"oid","not_null":true,"length":4},{"name":"defaclobjtype","type":"char","not_null":true,"length":1},{"name":"defaclacl","type":"aclitem","not_null":true,"array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_depend","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"classid","type":"oid","not_null":true,"length":4},{"name":"objid","type":"oid","not_null":true,"length":4},{"name":"objsubid","type":"int4","not_null":true,"length":4},{"name":"refclassid","type":"oid","not_null":true,"length":4},{"name":"refobjid","type":"oid","not_null":true,"length":4},{"name":"refobjsubid","type":"int4","not_null":true,"length":4},{"name":"deptype","type":"char","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_description","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"objoid","type":"oid","not_null":true,"length":4},{"name":"classoid","type":"oid","not_null":true,"length":4},{"name":"objsubid","type":"int4","not_null":true,"length":4},{"name":"description","type":"text","not_null":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_enum","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"enumtypid","type":"oid","not_null":true,"length":4},{"name":"enumsortorder","type":"float4","not_null":true,"length":4},{"name":"enumlabel","type":"name","not_null":true,"length":64}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_event_trigger","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"evtname","type":"name","not_null":true,"length":64},{"name":"evtevent","type":"name","not_null":true,"length":64},{"name":"evtowner","type":"oid","not_null":true,"length":4},{"name":"evtfoid","type":"oid","not_null":true,"length":4},{"name":"evtenabled","type":"char","not_null":true,"length":1},{"name":"evttags","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_extension","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"extname","type":"name","not_null":true,"length":64},{"name":"extowner","type":"oid","not_null":true,"length":4},{"name":"extnamespace","type":"oid","not_null":true,"length":4},{"name":"extrelocatable","type":"bool","not_null":true,"length":1},{"name":"extversion","type":"text","not_null":true},{"name":"extconfig","type":"oid","array":true,"length":4},{"name":"extcondition","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_file_settings","columns":[{"name":"sourcefile","type":"text"},{"name":"sourceline","type":"int4","length":4},{"name":"seqno","type":"int4","length":4},{"name":"name","type":"text"},{"name":"setting","type":"text"},{"name":"applied","type":"bool","length":1},{"name":"error","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_foreign_data_wrapper","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"fdwname","type":"name","not_null":true,"length":64},{"name":"fdwowner","type":"oid","not_null":true,"length":4},{"name":"fdwhandler","type":"oid","not_null":true,"length":4},{"name":"fdwvalidator","type":"oid","not_null":true,"length":4},{"name":"fdwacl","type":"aclitem","array":true,"length":16},{"name":"fdwoptions","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_foreign_server","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"srvname","type":"name","not_null":true,"length":64},{"name":"srvowner","type":"oid","not_null":true,"length":4},{"name":"srvfdw","type":"oid","not_null":true,"length":4},{"name":"srvtype","type":"text"},{"name":"srvversion","type":"text"},{"name":"srvacl","type":"aclitem","array":true,"length":16},{"name":"srvoptions","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_foreign_table","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"ftrelid","type":"oid","not_null":true,"length":4},{"name":"ftserver","type":"oid","not_null":true,"length":4},{"name":"ftoptions","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_group","columns":[{"name":"groname","type":"name","length":64},{"name":"grosysid","type":"oid","length":4},{"name":"grolist","type":"oid","array":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_hba_file_rules","columns":[{"name":"rule_number","type":"int4","length":4},{"name":"file_name","type":"text"},{"name":"line_number","type":"int4","length":4},{"name":"type","type":"text"},{"name":"database","type":"text","array":true},{"name":"user_name","type":"text","array":true},{"name":"address","type":"text"},{"name":"netmask","type":"text"},{"name":"auth_method","type":"text"},{"name":"options","type":"text","array":true},{"name":"error","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_ident_file_mappings","columns":[{"name":"map_number","type":"int4","length":4},{"name":"file_name","type":"text"},{"name":"line_number","type":"int4","length":4},{"name":"map_name","type":"text"},{"name":"sys_name","type":"text"},{"name":"pg_username","type":"text"},{"name":"error","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_index","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"indexrelid","type":"oid","not_null":true,"length":4},{"name":"indrelid","type":"oid","not_null":true,"length":4},{"name":"indnatts","type":"int2","not_null":true,"length":2},{"name":"indnkeyatts","type":"int2","not_null":true,"length":2},{"name":"indisunique","type":"bool","not_null":true,"length":1},{"name":"indnullsnotdistinct","type":"bool","not_null":true,"length":1},{"name":"indisprimary","type":"bool","not_null":true,"length":1},{"name":"indisexclusion","type":"bool","not_null":true,"length":1},{"name":"indimmediate","type":"bool","not_null":true,"length":1},{"name":"indisclustered","type":"bool","not_null":true,"length":1},{"name":"indisvalid","type":"bool","not_null":true,"length":1},{"name":"indcheckxmin","type":"bool","not_null":true,"length":1},{"name":"indisready","type":"bool","not_null":true,"length":1},{"name":"indislive","type":"bool","not_null":true,"length":1},{"name":"indisreplident","type":"bool","not_null":true,"length":1},{"name":"indkey","type":"int2vector","not_null":true},{"name":"indcollation","type":"oidvector","not_null":true},{"name":"indclass","type":"oidvector","not_null":true},{"name":"indoption","type":"int2vector","not_null":true},{"name":"indexprs","type":"pg_node_tree"},{"name":"indpred","type":"pg_node_tree"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_indexes","columns":[{"name":"schemaname","type":"name","length":64},{"name":"tablename","type":"name","length":64},{"name":"indexname","type":"name","length":64},{"name":"tablespace","type":"name","length":64},{"name":"indexdef","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_inherits","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"inhrelid","type":"oid","not_null":true,"length":4},{"name":"inhparent","type":"oid","not_null":true,"length":4},{"name":"inhseqno","type":"int4","not_null":true,"length":4},{"name":"inhdetachpending","type":"bool","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_init_privs","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"objoid","type":"oid","not_null":true,"length":4},{"name":"classoid","type":"oid","not_null":true,"length":4},{"name":"objsubid","type":"int4","not_null":true,"length":4},{"name":"privtype","type":"char","not_null":true,"length":1},{"name":"initprivs","type":"aclitem","not_null":true,"array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_language","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"lanname","type":"name","not_null":true,"length":64},{"name":"lanowner","type":"oid","not_null":true,"length":4},{"name":"lanispl","type":"bool","not_null":true,"length":1},{"name":"lanpltrusted","type":"bool","not_null":true,"length":1},{"name":"lanplcallfoid","type":"oid","not_null":true,"length":4},{"name":"laninline","type":"oid","not_null":true,"length":4},{"name":"lanvalidator","type":"oid","not_null":true,"length":4},{"name":"lanacl","type":"aclitem","array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_largeobject","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"loid","type":"oid","not_null":true,"length":4},{"name":"pageno","type":"int4","not_null":true,"length":4},{"name":"data","type":"bytea","not_null":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_largeobject_metadata","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"lomowner","type":"oid","not_null":true,"length":4},{"name":"lomacl","type":"aclitem","array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_locks","columns":[{"name":"locktype","type":"text"},{"name":"database","type":"oid","length":4},{"name":"relation","type":"oid","length":4},{"name":"page","type":"int4","length":4},{"name":"tuple","type":"int2","length":2},{"name":"virtualxid","type":"text"},{"name":"transactionid","type":"xid","length":4},{"name":"classid","type":"oid","length":4},{"name":"objid","type":"oid","length":4},{"name":"objsubid","type":"int2","length":2},{"name":"virtualtransaction","type":"text"},{"name":"pid","type":"int4","length":4},{"name":"mode","type":"text"},{"name":"granted","type":"bool","length":1},{"name":"fastpath","type":"bool","length":1},{"name":"waitstart","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_matviews","columns":[{"name":"schemaname","type":"name","length":64},{"name":"matviewname","type":"name","length":64},{"name":"matviewowner","type":"name","length":64},{"name":"tablespace","type":"name","length":64},{"name":"hasindexes","type":"bool","length":1},{"name":"ispopulated","type":"bool","length":1},{"name":"definition","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_namespace","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"nspname","type":"name","not_null":true,"length":64},{"name":"nspowner","type":"oid","not_null":true,"length":4},{"name":"nspacl","type":"aclitem","array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_opclass","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"opcmethod","type":"oid","not_null":true,"length":4},{"name":"opcname","type":"name","not_null":true,"length":64},{"name":"opcnamespace","type":"oid","not_null":true,"length":4},{"name":"opcowner","type":"oid","not_null":true,"length":4},{"name":"opcfamily","type":"oid","not_null":true,"length":4},{"name":"opcintype","type":"oid","not_null":true,"length":4},{"name":"opcdefault","type":"bool","not_null":true,"length":1},{"name":"opckeytype","type":"oid","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_operator","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"oprname","type":"name","not_null":true,"length":64},{"name":"oprnamespace","type":"oid","not_null":true,"length":4},{"name":"oprowner","type":"oid","not_null":true,"length":4},{"name":"oprkind","type":"char","not_null":true,"length":1},{"name":"oprcanmerge","type":"bool","not_null":true,"length":1},{"name":"oprcanhash","type":"bool","not_null":true,"length":1},{"name":"oprleft","type":"oid","not_null":true,"length":4},{"name":"oprright","type":"oid","not_null":true,"length":4},{"name":"oprresult","type":"oid","not_null":true,"length":4},{"name":"oprcom","type":"oid","not_null":true,"length":4},{"name":"oprnegate","type":"oid","not_null":true,"length":4},{"name":"oprcode","type":"regproc","not_null":true,"length":4},{"name":"oprrest","type":"regproc","not_null":true,"length":4},{"name":"oprjoin","type":"regproc","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_opfamily","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"opfmethod","type":"oid","not_null":true,"length":4},{"name":"opfname","type":"name","not_null":true,"length":64},{"name":"opfnamespace","type":"oid","not_null":true,"length":4},{"name":"opfowner","type":"oid","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_parameter_acl","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"parname","type":"text","not_null":true},{"name":"paracl","type":"aclitem","array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_partitioned_table","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"partrelid","type":"oid","not_null":true,"length":4},{"name":"partstrat","type":"char","not_null":true,"length":1},{"name":"partnatts","type":"int2","not_null":true,"length":2},{"name":"partdefid","type":"oid","not_null":true,"length":4},{"name":"partattrs","type":"int2vector","not_null":true},{"name":"partclass","type":"oidvector","not_null":true},{"name":"partcollation","type":"oidvector","not_null":true},{"name":"partexprs","type":"pg_node_tree"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_policies","columns":[{"name":"schemaname","type":"name","length":64},{"name":"tablename","type":"name","length":64},{"name":"policyname","type":"name","length":64},{"name":"permissive","type":"text"},{"name":"roles","type":"name","array":true,"length":64},{"name":"cmd","type":"text"},{"name":"qual","type":"text"},{"name":"with_check","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_policy","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"polname","type":"name","not_null":true,"length":64},{"name":"polrelid","type":"oid","not_null":true,"length":4},{"name":"polcmd","type":"char","not_null":true,"length":1},{"name":"polpermissive","type":"bool","not_null":true,"length":1},{"name":"polroles","type":"oid","not_null":true,"array":true,"length":4},{"name":"polqual","type":"pg_node_tree"},{"name":"polwithcheck","type":"pg_node_tree"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_prepared_statements","columns":[{"name":"name","type":"text"},{"name":"statement","type":"text"},{"name":"prepare_time","type":"timestamptz","length":8},{"name":"parameter_types","type":"regtype","array":true,"length":4},{"name":"result_types","type":"regtype","array":true,"length":4},{"name":"from_sql","type":"bool","length":1},{"name":"generic_plans","type":"int8","length":8},{"name":"custom_plans","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_prepared_xacts","columns":[{"name":"transaction","type":"xid","length":4},{"name":"gid","type":"text"},{"name":"prepared","type":"timestamptz","length":8},{"name":"owner","type":"name","length":64},{"name":"database","type":"name","length":64}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_proc","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"proname","type":"name","not_null":true,"length":64},{"name":"pronamespace","type":"oid","not_null":true,"length":4},{"name":"proowner","type":"oid","not_null":true,"length":4},{"name":"prolang","type":"oid","not_null":true,"length":4},{"name":"procost","type":"float4","not_null":true,"length":4},{"name":"prorows","type":"float4","not_null":true,"length":4},{"name":"provariadic","type":"oid","not_null":true,"length":4},{"name":"prosupport","type":"regproc","not_null":true,"length":4},{"name":"prokind","type":"char","not_null":true,"length":1},{"name":"prosecdef","type":"bool","not_null":true,"length":1},{"name":"proleakproof","type":"bool","not_null":true,"length":1},{"name":"proisstrict","type":"bool","not_null":true,"length":1},{"name":"proretset","type":"bool","not_null":true,"length":1},{"name":"provolatile","type":"char","not_null":true,"length":1},{"name":"proparallel","type":"char","not_null":true,"length":1},{"name":"pronargs","type":"int2","not_null":true,"length":2},{"name":"pronargdefaults","type":"int2","not_null":true,"length":2},{"name":"prorettype","type":"oid","not_null":true,"length":4},{"name":"proargtypes","type":"oidvector","not_null":true},{"name":"proallargtypes","type":"oid","array":true,"length":4},{"name":"proargmodes","type":"char","array":true,"length":1},{"name":"proargnames","type":"text","array":true},{"name":"proargdefaults","type":"pg_node_tree"},{"name":"protrftypes","type":"oid","array":true,"length":4},{"name":"prosrc","type":"text","not_null":true},{"name":"probin","type":"text"},{"name":"prosqlbody","type":"pg_node_tree"},{"name":"proconfig","type":"text","array":true},{"name":"proacl","type":"aclitem","array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_publication","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"pubname","type":"name","not_null":true,"length":64},{"name":"pubowner","type":"oid","not_null":true,"length":4},{"name":"puballtables","type":"bool","not_null":true,"length":1},{"name":"pubinsert","type":"bool","not_null":true,"length":1},{"name":"pubupdate","type":"bool","not_null":true,"length":1},{"name":"pubdelete","type":"bool","not_null":true,"length":1},{"name":"pubtruncate","type":"bool","not_null":true,"length":1},{"name":"pubviaroot","type":"bool","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_publication_namespace","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"pnpubid","type":"oid","not_null":true,"length":4},{"name":"pnnspid","type":"oid","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_publication_rel","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"prpubid","type":"oid","not_null":true,"length":4},{"name":"prrelid","type":"oid","not_null":true,"length":4},{"name":"prqual","type":"pg_node_tree"},{"name":"prattrs","type":"int2vector"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_publication_tables","columns":[{"name":"pubname","type":"name","length":64},{"name":"schemaname","type":"name","length":64},{"name":"tablename","type":"name","length":64},{"name":"attnames","type":"name","array":true,"length":64},{"name":"rowfilter","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_range","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"rngtypid","type":"oid","not_null":true,"length":4},{"name":"rngsubtype","type":"oid","not_null":true,"length":4},{"name":"rngmultitypid","type":"oid","not_null":true,"length":4},{"name":"rngcollation","type":"oid","not_null":true,"length":4},{"name":"rngsubopc","type":"oid","not_null":true,"length":4},{"name":"rngcanonical","type":"regproc","not_null":true,"length":4},{"name":"rngsubdiff","type":"regproc","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_replication_origin","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"roident","type":"oid","not_null":true,"length":4},{"name":"roname","type":"text","not_null":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_replication_origin_status","columns":[{"name":"local_id","type":"oid","length":4},{"name":"external_id","type":"text"},{"name":"remote_lsn","type":"pg_lsn","length":8},{"name":"local_lsn","type":"pg_lsn","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_replication_slots","columns":[{"name":"slot_name","type":"name","length":64},{"name":"plugin","type":"name","length":64},{"name":"slot_type","type":"text"},{"name":"datoid","type":"oid","length":4},{"name":"database","type":"name","length":64},{"name":"temporary","type":"bool","length":1},{"name":"active","type":"bool","length":1},{"name":"active_pid","type":"int4","length":4},{"name":"xmin","type":"xid","length":4},{"name":"catalog_xmin","type":"xid","length":4},{"name":"restart_lsn","type":"pg_lsn","length":8},{"name":"confirmed_flush_lsn","type":"pg_lsn","length":8},{"name":"wal_status","type":"text"},{"name":"safe_wal_size","type":"int8","length":8},{"name":"two_phase","type":"bool","length":1},{"name":"conflicting","type":"bool","length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_rewrite","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"rulename","type":"name","not_null":true,"length":64},{"name":"ev_class","type":"oid","not_null":true,"length":4},{"name":"ev_type","type":"char","not_null":true,"length":1},{"name":"ev_enabled","type":"char","not_null":true,"length":1},{"name":"is_instead","type":"bool","not_null":true,"length":1},{"name":"ev_qual","type":"pg_node_tree","not_null":true},{"name":"ev_action","type":"pg_node_tree","not_null":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_roles","columns":[{"name":"rolname","type":"name","length":64},{"name":"rolsuper","type":"bool","length":1},{"name":"rolinherit","type":"bool","length":1},{"name":"rolcreaterole","type":"bool","length":1},{"name":"rolcreatedb","type":"bool","length":1},{"name":"rolcanlogin","type":"bool","length":1},{"name":"rolreplication","type":"bool","length":1},{"name":"rolconnlimit","type":"int4","length":4},{"name":"rolpassword","type":"text"},{"name":"rolvaliduntil","type":"timestamptz","length":8},{"name":"rolbypassrls","type":"bool","length":1},{"name":"rolconfig","type":"text","array":true},{"name":"oid","type":"oid","length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_rules","columns":[{"name":"schemaname","type":"name","length":64},{"name":"tablename","type":"name","length":64},{"name":"rulename","type":"name","length":64},{"name":"definition","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_seclabel","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"objoid","type":"oid","not_null":true,"length":4},{"name":"classoid","type":"oid","not_null":true,"length":4},{"name":"objsubid","type":"int4","not_null":true,"length":4},{"name":"provider","type":"text","not_null":true},{"name":"label","type":"text","not_null":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_seclabels","columns":[{"name":"objoid","type":"oid","length":4},{"name":"classoid","type":"oid","length":4},{"name":"objsubid","type":"int4","length":4},{"name":"objtype","type":"text"},{"name":"objnamespace","type":"oid","length":4},{"name":"objname","type":"text"},{"name":"provider","type":"text"},{"name":"label","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_sequence","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"seqrelid","type":"oid","not_null":true,"length":4},{"name":"seqtypid","type":"oid","not_null":true,"length":4},{"name":"seqstart","type":"int8","not_null":true,"length":8},{"name":"seqincrement","type":"int8","not_null":true,"length":8},{"name":"seqmax","type":"int8","not_null":true,"length":8},{"name":"seqmin","type":"int8","not_null":true,"length":8},{"name":"seqcache","type":"int8","not_null":true,"length":8},{"name":"seqcycle","type":"bool","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_sequences","columns":[{"name":"schemaname","type":"name","length":64},{"name":"sequencename","type":"name","length":64},{"name":"sequenceowner","type":"name","length":64},{"name":"data_type","type":"regtype","length":4},{"name":"start_value","type":"int8","length":8},{"name":"min_value","type":"int8","length":8},{"name":"max_value","type":"int8","length":8},{"name":"increment_by","type":"int8","length":8},{"name":"cycle","type":"bool","length":1},{"name":"cache_size","type":"int8","length":8},{"name":"last_value","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_settings","columns":[{"name":"name","type":"text"},{"name":"setting","type":"text"},{"name":"unit","type":"text"},{"name":"category","type":"text"},{"name":"short_desc","type":"text"},{"name":"extra_desc","type":"text"},{"name":"context","type":"text"},{"name":"vartype","type":"text"},{"name":"source","type":"text"},{"name":"min_val","type":"text"},{"name":"max_val","type":"text"},{"name":"enumvals","type":"text","array":true},{"name":"boot_val","type":"text"},{"name":"reset_val","type":"text"},{"name":"sourcefile","type":"text"},{"name":"sourceline","type":"int4","length":4},{"name":"pending_restart","type":"bool","length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_shadow","columns":[{"name":"usename","type":"name","length":64},{"name":"usesysid","type":"oid","length":4},{"name":"usecreatedb","type":"bool","length":1},{"name":"usesuper","type":"bool","length":1},{"name":"userepl","type":"bool","length":1},{"name":"usebypassrls","type":"bool","length":1},{"name":"passwd","type":"text"},{"name":"valuntil","type":"timestamptz","length":8},{"name":"useconfig","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_shdepend","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"dbid","type":"oid","not_null":true,"length":4},{"name":"classid","type":"oid","not_null":true,"length":4},{"name":"objid","type":"oid","not_null":true,"length":4},{"name":"objsubid","type":"int4","not_null":true,"length":4},{"name":"refclassid","type":"oid","not_null":true,"length":4},{"name":"refobjid","type":"oid","not_null":true,"length":4},{"name":"deptype","type":"char","not_null":true,"length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_shdescription","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"objoid","type":"oid","not_null":true,"length":4},{"name":"classoid","type":"oid","not_null":true,"length":4},{"name":"description","type":"text","not_null":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_shmem_allocations","columns":[{"name":"name","type":"text"},{"name":"off","type":"int8","length":8},{"name":"size","type":"int8","length":8},{"name":"allocated_size","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_shseclabel","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"objoid","type":"oid","not_null":true,"length":4},{"name":"classoid","type":"oid","not_null":true,"length":4},{"name":"provider","type":"text","not_null":true},{"name":"label","type":"text","not_null":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_activity","columns":[{"name":"datid","type":"oid","length":4},{"name":"datname","type":"name","length":64},{"name":"pid","type":"int4","length":4},{"name":"leader_pid","type":"int4","length":4},{"name":"usesysid","type":"oid","length":4},{"name":"usename","type":"name","length":64},{"name":"application_name","type":"text"},{"name":"client_addr","type":"inet"},{"name":"client_hostname","type":"text"},{"name":"client_port","type":"int4","length":4},{"name":"backend_start","type":"timestamptz","length":8},{"name":"xact_start","type":"timestamptz","length":8},{"name":"query_start","type":"timestamptz","length":8},{"name":"state_change","type":"timestamptz","length":8},{"name":"wait_event_type","type":"text"},{"name":"wait_event","type":"text"},{"name":"state","type":"text"},{"name":"backend_xid","type":"xid","length":4},{"name":"backend_xmin","type":"xid","length":4},{"name":"query_id","type":"int8","length":8},{"name":"query","type":"text"},{"name":"backend_type","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_all_indexes","columns":[{"name":"relid","type":"oid","length":4},{"name":"indexrelid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"indexrelname","type":"name","length":64},{"name":"idx_scan","type":"int8","length":8},{"name":"last_idx_scan","type":"timestamptz","length":8},{"name":"idx_tup_read","type":"int8","length":8},{"name":"idx_tup_fetch","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_all_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"seq_scan","type":"int8","length":8},{"name":"last_seq_scan","type":"timestamptz","length":8},{"name":"seq_tup_read","type":"int8","length":8},{"name":"idx_scan","type":"int8","length":8},{"name":"last_idx_scan","type":"timestamptz","length":8},{"name":"idx_tup_fetch","type":"int8","length":8},{"name":"n_tup_ins","type":"int8","length":8},{"name":"n_tup_upd","type":"int8","length":8},{"name":"n_tup_del","type":"int8","length":8},{"name":"n_tup_hot_upd","type":"int8","length":8},{"name":"n_tup_newpage_upd","type":"int8","length":8},{"name":"n_live_tup","type":"int8","length":8},{"name":"n_dead_tup","type":"int8","length":8},{"name":"n_mod_since_analyze","type":"int8","length":8},{"name":"n_ins_since_vacuum","type":"int8","length":8},{"name":"last_vacuum","type":"timestamptz","length":8},{"name":"last_autovacuum","type":"timestamptz","length":8},{"name":"last_analyze","type":"timestamptz","length":8},{"name":"last_autoanalyze","type":"timestamptz","length":8},{"name":"vacuum_count","type":"int8","length":8},{"name":"autovacuum_count","type":"int8","length":8},{"name":"analyze_count","type":"int8","length":8},{"name":"autoanalyze_count","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_archiver","columns":[{"name":"archived_count","type":"int8","length":8},{"name":"last_archived_wal","type":"text"},{"name":"last_archived_time","type":"timestamptz","length":8},{"name":"failed_count","type":"int8","length":8},{"name":"last_failed_wal","type":"text"},{"name":"last_failed_time","type":"timestamptz","length":8},{"name":"stats_reset","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_bgwriter","columns":[{"name":"checkpoints_timed","type":"int8","length":8},{"name":"checkpoints_req","type":"int8","length":8},{"name":"checkpoint_write_time","type":"float8","length":8},{"name":"checkpoint_sync_time","type":"float8","length":8},{"name":"buffers_checkpoint","type":"int8","length":8},{"name":"buffers_clean","type":"int8","length":8},{"name":"maxwritten_clean","type":"int8","length":8},{"name":"buffers_backend","type":"int8","length":8},{"name":"buffers_backend_fsync","type":"int8","length":8},{"name":"buffers_alloc","type":"int8","length":8},{"name":"stats_reset","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_database","columns":[{"name":"datid","type":"oid","length":4},{"name":"datname","type":"name","length":64},{"name":"numbackends","type":"int4","length":4},{"name":"xact_commit","type":"int8","length":8},{"name":"xact_rollback","type":"int8","length":8},{"name":"blks_read","type":"int8","length":8},{"name":"blks_hit","type":"int8","length":8},{"name":"tup_returned","type":"int8","length":8},{"name":"tup_fetched","type":"int8","length":8},{"name":"tup_inserted","type":"int8","length":8},{"name":"tup_updated","type":"int8","length":8},{"name":"tup_deleted","type":"int8","length":8},{"name":"conflicts","type":"int8","length":8},{"name":"temp_files","type":"int8","length":8},{"name":"temp_bytes","type":"int8","length":8},{"name":"deadlocks","type":"int8","length":8},{"name":"checksum_failures","type":"int8","length":8},{"name":"checksum_last_failure","type":"timestamptz","length":8},{"name":"blk_read_time","type":"float8","length":8},{"name":"blk_write_time","type":"float8","length":8},{"name":"session_time","type":"float8","length":8},{"name":"active_time","type":"float8","length":8},{"name":"idle_in_transaction_time","type":"float8","length":8},{"name":"sessions","type":"int8","length":8},{"name":"sessions_abandoned","type":"int8","length":8},{"name":"sessions_fatal","type":"int8","length":8},{"name":"sessions_killed","type":"int8","length":8},{"name":"stats_reset","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_database_conflicts","columns":[{"name":"datid","type":"oid","length":4},{"name":"datname","type":"name","length":64},{"name":"confl_tablespace","type":"int8","length":8},{"name":"confl_lock","type":"int8","length":8},{"name":"confl_snapshot","type":"int8","length":8},{"name":"confl_bufferpin","type":"int8","length":8},{"name":"confl_deadlock","type":"int8","length":8},{"name":"confl_active_logicalslot","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_gssapi","columns":[{"name":"pid","type":"int4","length":4},{"name":"gss_authenticated","type":"bool","length":1},{"name":"principal","type":"text"},{"name":"encrypted","type":"bool","length":1},{"name":"credentials_delegated","type":"bool","length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_io","columns":[{"name":"backend_type","type":"text"},{"name":"object","type":"text"},{"name":"context","type":"text"},{"name":"reads","type":"int8","length":8},{"name":"read_time","type":"float8","length":8},{"name":"writes","type":"int8","length":8},{"name":"write_time","type":"float8","length":8},{"name":"writebacks","type":"int8","length":8},{"name":"writeback_time","type":"float8","length":8},{"name":"extends","type":"int8","length":8},{"name":"extend_time","type":"float8","length":8},{"name":"op_bytes","type":"int8","length":8},{"name":"hits","type":"int8","length":8},{"name":"evictions","type":"int8","length":8},{"name":"reuses","type":"int8","length":8},{"name":"fsyncs","type":"int8","length":8},{"name":"fsync_time","type":"float8","length":8},{"name":"stats_reset","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_progress_analyze","columns":[{"name":"pid","type":"int4","length":4},{"name":"datid","type":"oid","length":4},{"name":"datname","type":"name","length":64},{"name":"relid","type":"oid","length":4},{"name":"phase","type":"text"},{"name":"sample_blks_total","type":"int8","length":8},{"name":"sample_blks_scanned","type":"int8","length":8},{"name":"ext_stats_total","type":"int8","length":8},{"name":"ext_stats_computed","type":"int8","length":8},{"name":"child_tables_total","type":"int8","length":8},{"name":"child_tables_done","type":"int8","length":8},{"name":"current_child_table_relid","type":"oid","length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_progress_basebackup","columns":[{"name":"pid","type":"int4","length":4},{"name":"phase","type":"text"},{"name":"backup_total","type":"int8","length":8},{"name":"backup_streamed","type":"int8","length":8},{"name":"tablespaces_total","type":"int8","length":8},{"name":"tablespaces_streamed","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_progress_cluster","columns":[{"name":"pid","type":"int4","length":4},{"name":"datid","type":"oid","length":4},{"name":"datname","type":"name","length":64},{"name":"relid","type":"oid","length":4},{"name":"command","type":"text"},{"name":"phase","type":"text"},{"name":"cluster_index_relid","type":"oid","length":4},{"name":"heap_tuples_scanned","type":"int8","length":8},{"name":"heap_tuples_written","type":"int8","length":8},{"name":"heap_blks_total","type":"int8","length":8},{"name":"heap_blks_scanned","type":"int8","length":8},{"name":"index_rebuild_count","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_progress_copy","columns":[{"name":"pid","type":"int4","length":4},{"name":"datid","type":"oid","length":4},{"name":"datname","type":"name","length":64},{"name":"relid","type":"oid","length":4},{"name":"command","type":"text"},{"name":"type","type":"text"},{"name":"bytes_processed","type":"int8","length":8},{"name":"bytes_total","type":"int8","length":8},{"name":"tuples_processed","type":"int8","length":8},{"name":"tuples_excluded","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_progress_create_index","columns":[{"name":"pid","type":"int4","length":4},{"name":"datid","type":"oid","length":4},{"name":"datname","type":"name","length":64},{"name":"relid","type":"oid","length":4},{"name":"index_relid","type":"oid","length":4},{"name":"command","type":"text"},{"name":"phase","type":"text"},{"name":"lockers_total","type":"int8","length":8},{"name":"lockers_done","type":"int8","length":8},{"name":"current_locker_pid","type":"int8","length":8},{"name":"blocks_total","type":"int8","length":8},{"name":"blocks_done","type":"int8","length":8},{"name":"tuples_total","type":"int8","length":8},{"name":"tuples_done","type":"int8","length":8},{"name":"partitions_total","type":"int8","length":8},{"name":"partitions_done","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_progress_vacuum","columns":[{"name":"pid","type":"int4","length":4},{"name":"datid","type":"oid","length":4},{"name":"datname","type":"name","length":64},{"name":"relid","type":"oid","length":4},{"name":"phase","type":"text"},{"name":"heap_blks_total","type":"int8","length":8},{"name":"heap_blks_scanned","type":"int8","length":8},{"name":"heap_blks_vacuumed","type":"int8","length":8},{"name":"index_vacuum_count","type":"int8","length":8},{"name":"max_dead_tuples","type":"int8","length":8},{"name":"num_dead_tuples","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_recovery_prefetch","columns":[{"name":"stats_reset","type":"timestamptz","length":8},{"name":"prefetch","type":"int8","length":8},{"name":"hit","type":"int8","length":8},{"name":"skip_init","type":"int8","length":8},{"name":"skip_new","type":"int8","length":8},{"name":"skip_fpw","type":"int8","length":8},{"name":"skip_rep","type":"int8","length":8},{"name":"wal_distance","type":"int4","length":4},{"name":"block_distance","type":"int4","length":4},{"name":"io_depth","type":"int4","length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_replication","columns":[{"name":"pid","type":"int4","length":4},{"name":"usesysid","type":"oid","length":4},{"name":"usename","type":"name","length":64},{"name":"application_name","type":"text"},{"name":"client_addr","type":"inet"},{"name":"client_hostname","type":"text"},{"name":"client_port","type":"int4","length":4},{"name":"backend_start","type":"timestamptz","length":8},{"name":"backend_xmin","type":"xid","length":4},{"name":"state","type":"text"},{"name":"sent_lsn","type":"pg_lsn","length":8},{"name":"write_lsn","type":"pg_lsn","length":8},{"name":"flush_lsn","type":"pg_lsn","length":8},{"name":"replay_lsn","type":"pg_lsn","length":8},{"name":"write_lag","type":"interval","length":16},{"name":"flush_lag","type":"interval","length":16},{"name":"replay_lag","type":"interval","length":16},{"name":"sync_priority","type":"int4","length":4},{"name":"sync_state","type":"text"},{"name":"reply_time","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_replication_slots","columns":[{"name":"slot_name","type":"text"},{"name":"spill_txns","type":"int8","length":8},{"name":"spill_count","type":"int8","length":8},{"name":"spill_bytes","type":"int8","length":8},{"name":"stream_txns","type":"int8","length":8},{"name":"stream_count","type":"int8","length":8},{"name":"stream_bytes","type":"int8","length":8},{"name":"total_txns","type":"int8","length":8},{"name":"total_bytes","type":"int8","length":8},{"name":"stats_reset","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_slru","columns":[{"name":"name","type":"text"},{"name":"blks_zeroed","type":"int8","length":8},{"name":"blks_hit","type":"int8","length":8},{"name":"blks_read","type":"int8","length":8},{"name":"blks_written","type":"int8","length":8},{"name":"blks_exists","type":"int8","length":8},{"name":"flushes","type":"int8","length":8},{"name":"truncates","type":"int8","length":8},{"name":"stats_reset","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_ssl","columns":[{"name":"pid","type":"int4","length":4},{"name":"ssl","type":"bool","length":1},{"name":"version","type":"text"},{"name":"cipher","type":"text"},{"name":"bits","type":"int4","length":4},{"name":"client_dn","type":"text"},{"name":"client_serial","type":"numeric"},{"name":"issuer_dn","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_subscription","columns":[{"name":"subid","type":"oid","length":4},{"name":"subname","type":"name","length":64},{"name":"pid","type":"int4","length":4},{"name":"leader_pid","type":"int4","length":4},{"name":"relid","type":"oid","length":4},{"name":"received_lsn","type":"pg_lsn","length":8},{"name":"last_msg_send_time","type":"timestamptz","length":8},{"name":"last_msg_receipt_time","type":"timestamptz","length":8},{"name":"latest_end_lsn","type":"pg_lsn","length":8},{"name":"latest_end_time","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_subscription_stats","columns":[{"name":"subid","type":"oid","length":4},{"name":"subname","type":"name","length":64},{"name":"apply_error_count","type":"int8","length":8},{"name":"sync_error_count","type":"int8","length":8},{"name":"stats_reset","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_sys_indexes","columns":[{"name":"relid","type":"oid","length":4},{"name":"indexrelid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"indexrelname","type":"name","length":64},{"name":"idx_scan","type":"int8","length":8},{"name":"last_idx_scan","type":"timestamptz","length":8},{"name":"idx_tup_read","type":"int8","length":8},{"name":"idx_tup_fetch","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_sys_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"seq_scan","type":"int8","length":8},{"name":"last_seq_scan","type":"timestamptz","length":8},{"name":"seq_tup_read","type":"int8","length":8},{"name":"idx_scan","type":"int8","length":8},{"name":"last_idx_scan","type":"timestamptz","length":8},{"name":"idx_tup_fetch","type":"int8","length":8},{"name":"n_tup_ins","type":"int8","length":8},{"name":"n_tup_upd","type":"int8","length":8},{"name":"n_tup_del","type":"int8","length":8},{"name":"n_tup_hot_upd","type":"int8","length":8},{"name":"n_tup_newpage_upd","type":"int8","length":8},{"name":"n_live_tup","type":"int8","length":8},{"name":"n_dead_tup","type":"int8","length":8},{"name":"n_mod_since_analyze","type":"int8","length":8},{"name":"n_ins_since_vacuum","type":"int8","length":8},{"name":"last_vacuum","type":"timestamptz","length":8},{"name":"last_autovacuum","type":"timestamptz","length":8},{"name":"last_analyze","type":"timestamptz","length":8},{"name":"last_autoanalyze","type":"timestamptz","length":8},{"name":"vacuum_count","type":"int8","length":8},{"name":"autovacuum_count","type":"int8","length":8},{"name":"analyze_count","type":"int8","length":8},{"name":"autoanalyze_count","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_user_functions","columns":[{"name":"funcid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"funcname","type":"name","length":64},{"name":"calls","type":"int8","length":8},{"name":"total_time","type":"float8","length":8},{"name":"self_time","type":"float8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_user_indexes","columns":[{"name":"relid","type":"oid","length":4},{"name":"indexrelid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"indexrelname","type":"name","length":64},{"name":"idx_scan","type":"int8","length":8},{"name":"last_idx_scan","type":"timestamptz","length":8},{"name":"idx_tup_read","type":"int8","length":8},{"name":"idx_tup_fetch","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_user_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"seq_scan","type":"int8","length":8},{"name":"last_seq_scan","type":"timestamptz","length":8},{"name":"seq_tup_read","type":"int8","length":8},{"name":"idx_scan","type":"int8","length":8},{"name":"last_idx_scan","type":"timestamptz","length":8},{"name":"idx_tup_fetch","type":"int8","length":8},{"name":"n_tup_ins","type":"int8","length":8},{"name":"n_tup_upd","type":"int8","length":8},{"name":"n_tup_del","type":"int8","length":8},{"name":"n_tup_hot_upd","type":"int8","length":8},{"name":"n_tup_newpage_upd","type":"int8","length":8},{"name":"n_live_tup","type":"int8","length":8},{"name":"n_dead_tup","type":"int8","length":8},{"name":"n_mod_since_analyze","type":"int8","length":8},{"name":"n_ins_since_vacuum","type":"int8","length":8},{"name":"last_vacuum","type":"timestamptz","length":8},{"name":"last_autovacuum","type":"timestamptz","length":8},{"name":"last_analyze","type":"timestamptz","length":8},{"name":"last_autoanalyze","type":"timestamptz","length":8},{"name":"vacuum_count","type":"int8","length":8},{"name":"autovacuum_count","type":"int8","length":8},{"name":"analyze_count","type":"int8","length":8},{"name":"autoanalyze_count","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_wal","columns":[{"name":"wal_records","type":"int8","length":8},{"name":"wal_fpi","type":"int8","length":8},{"name":"wal_bytes","type":"numeric"},{"name":"wal_buffers_full","type":"int8","length":8},{"name":"wal_write","type":"int8","length":8},{"name":"wal_sync","type":"int8","length":8},{"name":"wal_write_time","type":"float8","length":8},{"name":"wal_sync_time","type":"float8","length":8},{"name":"stats_reset","type":"timestamptz","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_wal_receiver","columns":[{"name":"pid","type":"int4","length":4},{"name":"status","type":"text"},{"name":"receive_start_lsn","type":"pg_lsn","length":8},{"name":"receive_start_tli","type":"int4","length":4},{"name":"written_lsn","type":"pg_lsn","length":8},{"name":"flushed_lsn","type":"pg_lsn","length":8},{"name":"received_tli","type":"int4","length":4},{"name":"last_msg_send_time","type":"timestamptz","length":8},{"name":"last_msg_receipt_time","type":"timestamptz","length":8},{"name":"latest_end_lsn","type":"pg_lsn","length":8},{"name":"latest_end_time","type":"timestamptz","length":8},{"name":"slot_name","type":"text"},{"name":"sender_host","type":"text"},{"name":"sender_port","type":"int4","length":4},{"name":"conninfo","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_xact_all_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"seq_scan","type":"int8","length":8},{"name":"seq_tup_read","type":"int8","length":8},{"name":"idx_scan","type":"int8","length":8},{"name":"idx_tup_fetch","type":"int8","length":8},{"name":"n_tup_ins","type":"int8","length":8},{"name":"n_tup_upd","type":"int8","length":8},{"name":"n_tup_del","type":"int8","length":8},{"name":"n_tup_hot_upd","type":"int8","length":8},{"name":"n_tup_newpage_upd","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_xact_sys_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"seq_scan","type":"int8","length":8},{"name":"seq_tup_read","type":"int8","length":8},{"name":"idx_scan","type":"int8","length":8},{"name":"idx_tup_fetch","type":"int8","length":8},{"name":"n_tup_ins","type":"int8","length":8},{"name":"n_tup_upd","type":"int8","length":8},{"name":"n_tup_del","type":"int8","length":8},{"name":"n_tup_hot_upd","type":"int8","length":8},{"name":"n_tup_newpage_upd","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_xact_user_functions","columns":[{"name":"funcid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"funcname","type":"name","length":64},{"name":"calls","type":"int8","length":8},{"name":"total_time","type":"float8","length":8},{"name":"self_time","type":"float8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stat_xact_user_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"seq_scan","type":"int8","length":8},{"name":"seq_tup_read","type":"int8","length":8},{"name":"idx_scan","type":"int8","length":8},{"name":"idx_tup_fetch","type":"int8","length":8},{"name":"n_tup_ins","type":"int8","length":8},{"name":"n_tup_upd","type":"int8","length":8},{"name":"n_tup_del","type":"int8","length":8},{"name":"n_tup_hot_upd","type":"int8","length":8},{"name":"n_tup_newpage_upd","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_all_indexes","columns":[{"name":"relid","type":"oid","length":4},{"name":"indexrelid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"indexrelname","type":"name","length":64},{"name":"idx_blks_read","type":"int8","length":8},{"name":"idx_blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_all_sequences","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"blks_read","type":"int8","length":8},{"name":"blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_all_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"heap_blks_read","type":"int8","length":8},{"name":"heap_blks_hit","type":"int8","length":8},{"name":"idx_blks_read","type":"int8","length":8},{"name":"idx_blks_hit","type":"int8","length":8},{"name":"toast_blks_read","type":"int8","length":8},{"name":"toast_blks_hit","type":"int8","length":8},{"name":"tidx_blks_read","type":"int8","length":8},{"name":"tidx_blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_sys_indexes","columns":[{"name":"relid","type":"oid","length":4},{"name":"indexrelid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"indexrelname","type":"name","length":64},{"name":"idx_blks_read","type":"int8","length":8},{"name":"idx_blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_sys_sequences","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"blks_read","type":"int8","length":8},{"name":"blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_sys_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"heap_blks_read","type":"int8","length":8},{"name":"heap_blks_hit","type":"int8","length":8},{"name":"idx_blks_read","type":"int8","length":8},{"name":"idx_blks_hit","type":"int8","length":8},{"name":"toast_blks_read","type":"int8","length":8},{"name":"toast_blks_hit","type":"int8","length":8},{"name":"tidx_blks_read","type":"int8","length":8},{"name":"tidx_blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_user_indexes","columns":[{"name":"relid","type":"oid","length":4},{"name":"indexrelid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"indexrelname","type":"name","length":64},{"name":"idx_blks_read","type":"int8","length":8},{"name":"idx_blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_user_sequences","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"blks_read","type":"int8","length":8},{"name":"blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statio_user_tables","columns":[{"name":"relid","type":"oid","length":4},{"name":"schemaname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"heap_blks_read","type":"int8","length":8},{"name":"heap_blks_hit","type":"int8","length":8},{"name":"idx_blks_read","type":"int8","length":8},{"name":"idx_blks_hit","type":"int8","length":8},{"name":"toast_blks_read","type":"int8","length":8},{"name":"toast_blks_hit","type":"int8","length":8},{"name":"tidx_blks_read","type":"int8","length":8},{"name":"tidx_blks_hit","type":"int8","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statistic","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"starelid","type":"oid","not_null":true,"length":4},{"name":"staattnum","type":"int2","not_null":true,"length":2},{"name":"stainherit","type":"bool","not_null":true,"length":1},{"name":"stanullfrac","type":"float4","not_null":true,"length":4},{"name":"stawidth","type":"int4","not_null":true,"length":4},{"name":"stadistinct","type":"float4","not_null":true,"length":4},{"name":"stakind1","type":"int2","not_null":true,"length":2},{"name":"stakind2","type":"int2","not_null":true,"length":2},{"name":"stakind3","type":"int2","not_null":true,"length":2},{"name":"stakind4","type":"int2","not_null":true,"length":2},{"name":"stakind5","type":"int2","not_null":true,"length":2},{"name":"staop1","type":"oid","not_null":true,"length":4},{"name":"staop2","type":"oid","not_null":true,"length":4},{"name":"staop3","type":"oid","not_null":true,"length":4},{"name":"staop4","type":"oid","not_null":true,"length":4},{"name":"staop5","type":"oid","not_null":true,"length":4},{"name":"stacoll1","type":"oid","not_null":true,"length":4},{"name":"stacoll2","type":"oid","not_null":true,"length":4},{"name":"stacoll3","type":"oid","not_null":true,"length":4},{"name":"stacoll4","type":"oid","not_null":true,"length":4},{"name":"stacoll5","type":"oid","not_null":true,"length":4},{"name":"stanumbers1","type":"float4","array":true,"length":4},{"name":"stanumbers2","type":"float4","array":true,"length":4},{"name":"stanumbers3","type":"float4","array":true,"length":4},{"name":"stanumbers4","type":"float4","array":true,"length":4},{"name":"stanumbers5","type":"float4","array":true,"length":4},{"name":"stavalues1","type":"anyarray"},{"name":"stavalues2","type":"anyarray"},{"name":"stavalues3","type":"anyarray"},{"name":"stavalues4","type":"anyarray"},{"name":"stavalues5","type":"anyarray"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statistic_ext","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"stxrelid","type":"oid","not_null":true,"length":4},{"name":"stxname","type":"name","not_null":true,"length":64},{"name":"stxnamespace","type":"oid","not_null":true,"length":4},{"name":"stxowner","type":"oid","not_null":true,"length":4},{"name":"stxstattarget","type":"int4","not_null":true,"length":4},{"name":"stxkeys","type":"int2vector","not_null":true},{"name":"stxkind","type":"char","not_null":true,"array":true,"length":1},{"name":"stxexprs","type":"pg_node_tree"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_statistic_ext_data","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"stxoid","type":"oid","not_null":true,"length":4},{"name":"stxdinherit","type":"bool","not_null":true,"length":1},{"name":"stxdndistinct","type":"pg_ndistinct"},{"name":"stxddependencies","type":"pg_dependencies"},{"name":"stxdmcv","type":"pg_mcv_list"},{"name":"stxdexpr","type":"pg_statistic","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stats","columns":[{"name":"schemaname","type":"name","length":64},{"name":"tablename","type":"name","length":64},{"name":"attname","type":"name","length":64},{"name":"inherited","type":"bool","length":1},{"name":"null_frac","type":"float4","length":4},{"name":"avg_width","type":"int4","length":4},{"name":"n_distinct","type":"float4","length":4},{"name":"most_common_vals","type":"anyarray"},{"name":"most_common_freqs","type":"float4","array":true,"length":4},{"name":"histogram_bounds","type":"anyarray"},{"name":"correlation","type":"float4","length":4},{"name":"most_common_elems","type":"anyarray"},{"name":"most_common_elem_freqs","type":"float4","array":true,"length":4},{"name":"elem_count_histogram","type":"float4","array":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stats_ext","columns":[{"name":"schemaname","type":"name","length":64},{"name":"tablename","type":"name","length":64},{"name":"statistics_schemaname","type":"name","length":64},{"name":"statistics_name","type":"name","length":64},{"name":"statistics_owner","type":"name","length":64},{"name":"attnames","type":"name","array":true,"length":64},{"name":"exprs","type":"text","array":true},{"name":"kinds","type":"char","array":true,"length":1},{"name":"inherited","type":"bool","length":1},{"name":"n_distinct","type":"pg_ndistinct"},{"name":"dependencies","type":"pg_dependencies"},{"name":"most_common_vals","type":"text","array":true},{"name":"most_common_val_nulls","type":"bool","array":true,"length":1},{"name":"most_common_freqs","type":"float8","array":true,"length":8},{"name":"most_common_base_freqs","type":"float8","array":true,"length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_stats_ext_exprs","columns":[{"name":"schemaname","type":"name","length":64},{"name":"tablename","type":"name","length":64},{"name":"statistics_schemaname","type":"name","length":64},{"name":"statistics_name","type":"name","length":64},{"name":"statistics_owner","type":"name","length":64},{"name":"expr","type":"text"},{"name":"inherited","type":"bool","length":1},{"name":"null_frac","type":"float4","length":4},{"name":"avg_width","type":"int4","length":4},{"name":"n_distinct","type":"float4","length":4},{"name":"most_common_vals","type":"anyarray"},{"name":"most_common_freqs","type":"float4","array":true,"length":4},{"name":"histogram_bounds","type":"anyarray"},{"name":"correlation","type":"float4","length":4},{"name":"most_common_elems","type":"anyarray"},{"name":"most_common_elem_freqs","type":"float4","array":true,"length":4},{"name":"elem_count_histogram","type":"float4","array":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_subscription","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"subdbid","type":"oid","not_null":true,"length":4},{"name":"subskiplsn","type":"pg_lsn","not_null":true,"length":8},{"name":"subname","type":"name","not_null":true,"length":64},{"name":"subowner","type":"oid","not_null":true,"length":4},{"name":"subenabled","type":"bool","not_null":true,"length":1},{"name":"subbinary","type":"bool","not_null":true,"length":1},{"name":"substream","type":"char","not_null":true,"length":1},{"name":"subtwophasestate","type":"char","not_null":true,"length":1},{"name":"subdisableonerr","type":"bool","not_null":true,"length":1},{"name":"subpasswordrequired","type":"bool","not_null":true,"length":1},{"name":"subrunasowner","type":"bool","not_null":true,"length":1},{"name":"subconninfo","type":"text","not_null":true},{"name":"subslotname","type":"name","length":64},{"name":"subsynccommit","type":"text","not_null":true},{"name":"subpublications","type":"text","not_null":true,"array":true},{"name":"suborigin","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_subscription_rel","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"srsubid","type":"oid","not_null":true,"length":4},{"name":"srrelid","type":"oid","not_null":true,"length":4},{"name":"srsubstate","type":"char","not_null":true,"length":1},{"name":"srsublsn","type":"pg_lsn","length":8}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_tables","columns":[{"name":"schemaname","type":"name","length":64},{"name":"tablename","type":"name","length":64},{"name":"tableowner","type":"name","length":64},{"name":"tablespace","type":"name","length":64},{"name":"hasindexes","type":"bool","length":1},{"name":"hasrules","type":"bool","length":1},{"name":"hastriggers","type":"bool","length":1},{"name":"rowsecurity","type":"bool","length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_tablespace","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"spcname","type":"name","not_null":true,"length":64},{"name":"spcowner","type":"oid","not_null":true,"length":4},{"name":"spcacl","type":"aclitem","array":true,"length":16},{"name":"spcoptions","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_timezone_abbrevs","columns":[{"name":"abbrev","type":"text"},{"name":"utc_offset","type":"interval","length":16},{"name":"is_dst","type":"bool","length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_timezone_names","columns":[{"name":"name","type":"text"},{"name":"abbrev","type":"text"},{"name":"utc_offset","type":"interval","length":16},{"name":"is_dst","type":"bool","length":1}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_transform","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"trftype","type":"oid","not_null":true,"length":4},{"name":"trflang","type":"oid","not_null":true,"length":4},{"name":"trffromsql","type":"regproc","not_null":true,"length":4},{"name":"trftosql","type":"regproc","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_trigger","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"tgrelid","type":"oid","not_null":true,"length":4},{"name":"tgparentid","type":"oid","not_null":true,"length":4},{"name":"tgname","type":"name","not_null":true,"length":64},{"name":"tgfoid","type":"oid","not_null":true,"length":4},{"name":"tgtype","type":"int2","not_null":true,"length":2},{"name":"tgenabled","type":"char","not_null":true,"length":1},{"name":"tgisinternal","type":"bool","not_null":true,"length":1},{"name":"tgconstrrelid","type":"oid","not_null":true,"length":4},{"name":"tgconstrindid","type":"oid","not_null":true,"length":4},{"name":"tgconstraint","type":"oid","not_null":true,"length":4},{"name":"tgdeferrable","type":"bool","not_null":true,"length":1},{"name":"tginitdeferred","type":"bool","not_null":true,"length":1},{"name":"tgnargs","type":"int2","not_null":true,"length":2},{"name":"tgattr","type":"int2vector","not_null":true},{"name":"tgargs","type":"bytea","not_null":true},{"name":"tgqual","type":"pg_node_tree"},{"name":"tgoldtable","type":"name","length":64},{"name":"tgnewtable","type":"name","length":64}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_ts_config","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"cfgname","type":"name","not_null":true,"length":64},{"name":"cfgnamespace","type":"oid","not_null":true,"length":4},{"name":"cfgowner","type":"oid","not_null":true,"length":4},{"name":"cfgparser","type":"oid","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_ts_config_map","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"mapcfg","type":"oid","not_null":true,"length":4},{"name":"maptokentype","type":"int4","not_null":true,"length":4},{"name":"mapseqno","type":"int4","not_null":true,"length":4},{"name":"mapdict","type":"oid","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_ts_dict","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"dictname","type":"name","not_null":true,"length":64},{"name":"dictnamespace","type":"oid","not_null":true,"length":4},{"name":"dictowner","type":"oid","not_null":true,"length":4},{"name":"dicttemplate","type":"oid","not_null":true,"length":4},{"name":"dictinitoption","type":"text"}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_ts_parser","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"prsname","type":"name","not_null":true,"length":64},{"name":"prsnamespace","type":"oid","not_null":true,"length":4},{"name":"prsstart","type":"regproc","not_null":true,"length":4},{"name":"prstoken","type":"regproc","not_null":true,"length":4},{"name":"prsend","type":"regproc","not_null":true,"length":4},{"name":"prsheadline","type":"regproc","not_null":true,"length":4},{"name":"prslextype","type":"regproc","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_ts_template","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"tmplname","type":"name","not_null":true,"length":64},{"name":"tmplnamespace","type":"oid","not_null":true,"length":4},{"name":"tmplinit","type":"regproc","not_null":true,"length":4},{"name":"tmpllexize","type":"regproc","not_null":true,"length":4}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_type","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"typname","type":"name","not_null":true,"length":64},{"name":"typnamespace","type":"oid","not_null":true,"length":4},{"name":"typowner","type":"oid","not_null":true,"length":4},{"name":"typlen","type":"int2","not_null":true,"length":2},{"name":"typbyval","type":"bool","not_null":true,"length":1},{"name":"typtype","type":"char","not_null":true,"length":1},{"name":"typcategory","type":"char","not_null":true,"length":1},{"name":"typispreferred","type":"bool","not_null":true,"length":1},{"name":"typisdefined","type":"bool","not_null":true,"length":1},{"name":"typdelim","type":"char","not_null":true,"length":1},{"name":"typrelid","type":"oid","not_null":true,"length":4},{"name":"typsubscript","type":"regproc","not_null":true,"length":4},{"name":"typelem","type":"oid","not_null":true,"length":4},{"name":"typarray","type":"oid","not_null":true,"length":4},{"name":"typinput","type":"regproc","not_null":true,"length":4},{"name":"typoutput","type":"regproc","not_null":true,"length":4},{"name":"typreceive","type":"regproc","not_null":true,"length":4},{"name":"typsend","type":"regproc","not_null":true,"length":4},{"name":"typmodin","type":"regproc","not_null":true,"length":4},{"name":"typmodout","type":"regproc","not_null":true,"length":4},{"name":"typanalyze","type":"regproc","not_null":true,"length":4},{"name":"typalign","type":"char","not_null":true,"length":1},{"name":"typstorage","type":"char","not_null":true,"length":1},{"name":"typnotnull","type":"bool","not_null":true,"length":1},{"name":"typbasetype","type":"oid","not_null":true,"length":4},{"name":"typtypmod","type":"int4","not_null":true,"length":4},{"name":"typndims","type":"int4","not_null":true,"length":4},{"name":"typcollation","type":"oid","not_null":true,"length":4},{"name":"typdefaultbin","type":"pg_node_tree"},{"name":"typdefault","type":"text"},{"name":"typacl","type":"aclitem","array":true,"length":16}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_user","columns":[{"name":"usename","type":"name","length":64},{"name":"usesysid","type":"oid","length":4},{"name":"usecreatedb","type":"bool","length":1},{"name":"usesuper","type":"bool","length":1},{"name":"userepl","type":"bool","length":1},{"name":"usebypassrls","type":"bool","length":1},{"name":"passwd","type":"text"},{"name":"valuntil","type":"timestamptz","length":8},{"name":"useconfig","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_user_mapping","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"oid","type":"oid","not_null":true,"length":4},{"name":"umuser","type":"oid","not_null":true,"length":4},{"name":"umserver","type":"oid","not_null":true,"length":4},{"name":"umoptions","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_user_mappings","columns":[{"name":"umid","type":"oid","length":4},{"name":"srvid","type":"oid","length":4},{"name":"srvname","type":"name","length":64},{"name":"umuser","type":"oid","length":4},{"name":"usename","type":"name","length":64},{"name":"umoptions","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"pg_catalog","name":"pg_views","columns":[{"name":"schemaname","type":"name","length":64},{"name":"viewname","type":"name","length":64},{"name":"viewowner","type":"name","length":64},{"name":"definition","type":"text"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"_pg_foreign_data_wrappers","columns":[{"name":"oid","type":"oid","length":4},{"name":"fdwowner","type":"oid","length":4},{"name":"fdwoptions","type":"text","array":true},{"name":"foreign_data_wrapper_catalog","type":"sql_identifier","length":64},{"name":"foreign_data_wrapper_name","type":"sql_identifier","length":64},{"name":"authorization_identifier","type":"sql_identifier","length":64},{"name":"foreign_data_wrapper_language","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"_pg_foreign_servers","columns":[{"name":"oid","type":"oid","length":4},{"name":"srvoptions","type":"text","array":true},{"name":"foreign_server_catalog","type":"sql_identifier","length":64},{"name":"foreign_server_name","type":"sql_identifier","length":64},{"name":"foreign_data_wrapper_catalog","type":"sql_identifier","length":64},{"name":"foreign_data_wrapper_name","type":"sql_identifier","length":64},{"name":"foreign_server_type","type":"character_data"},{"name":"foreign_server_version","type":"character_data"},{"name":"authorization_identifier","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"_pg_foreign_table_columns","columns":[{"name":"nspname","type":"name","length":64},{"name":"relname","type":"name","length":64},{"name":"attname","type":"name","length":64},{"name":"attfdwoptions","type":"text","array":true}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"_pg_foreign_tables","columns":[{"name":"foreign_table_catalog","type":"sql_identifier","length":64},{"name":"foreign_table_schema","type":"sql_identifier","length":64},{"name":"foreign_table_name","type":"sql_identifier","length":64},{"name":"ftoptions","type":"text","array":true},{"name":"foreign_server_catalog","type":"sql_identifier","length":64},{"name":"foreign_server_name","type":"sql_identifier","length":64},{"name":"authorization_identifier","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"_pg_user_mappings","columns":[{"name":"oid","type":"oid","length":4},{"name":"umoptions","type":"text","array":true},{"name":"umuser","type":"oid","length":4},{"name":"authorization_identifier","type":"sql_identifier","length":64},{"name":"foreign_server_catalog","type":"sql_identifier","length":64},{"name":"foreign_server_name","type":"sql_identifier","length":64},{"name":"srvowner","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"administrable_role_authorizations","columns":[{"name":"grantee","type":"sql_identifier","length":64},{"name":"role_name","type":"sql_identifier","length":64},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"applicable_roles","columns":[{"name":"grantee","type":"sql_identifier","length":64},{"name":"role_name","type":"sql_identifier","length":64},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"attributes","columns":[{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"attribute_name","type":"sql_identifier","length":64},{"name":"ordinal_position","type":"cardinal_number","length":4},{"name":"attribute_default","type":"character_data"},{"name":"is_nullable","type":"yes_or_no"},{"name":"data_type","type":"character_data"},{"name":"character_maximum_length","type":"cardinal_number","length":4},{"name":"character_octet_length","type":"cardinal_number","length":4},{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64},{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"numeric_precision","type":"cardinal_number","length":4},{"name":"numeric_precision_radix","type":"cardinal_number","length":4},{"name":"numeric_scale","type":"cardinal_number","length":4},{"name":"datetime_precision","type":"cardinal_number","length":4},{"name":"interval_type","type":"character_data"},{"name":"interval_precision","type":"cardinal_number","length":4},{"name":"attribute_udt_catalog","type":"sql_identifier","length":64},{"name":"attribute_udt_schema","type":"sql_identifier","length":64},{"name":"attribute_udt_name","type":"sql_identifier","length":64},{"name":"scope_catalog","type":"sql_identifier","length":64},{"name":"scope_schema","type":"sql_identifier","length":64},{"name":"scope_name","type":"sql_identifier","length":64},{"name":"maximum_cardinality","type":"cardinal_number","length":4},{"name":"dtd_identifier","type":"sql_identifier","length":64},{"name":"is_derived_reference_attribute","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"character_sets","columns":[{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64},{"name":"character_repertoire","type":"sql_identifier","length":64},{"name":"form_of_use","type":"sql_identifier","length":64},{"name":"default_collate_catalog","type":"sql_identifier","length":64},{"name":"default_collate_schema","type":"sql_identifier","length":64},{"name":"default_collate_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"check_constraint_routine_usage","columns":[{"name":"constraint_catalog","type":"sql_identifier","length":64},{"name":"constraint_schema","type":"sql_identifier","length":64},{"name":"constraint_name","type":"sql_identifier","length":64},{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"check_constraints","columns":[{"name":"constraint_catalog","type":"sql_identifier","length":64},{"name":"constraint_schema","type":"sql_identifier","length":64},{"name":"constraint_name","type":"sql_identifier","length":64},{"name":"check_clause","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"collation_character_set_applicability","columns":[{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"collations","columns":[{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"pad_attribute","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"column_column_usage","columns":[{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64},{"name":"dependent_column","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"column_domain_usage","columns":[{"name":"domain_catalog","type":"sql_identifier","length":64},{"name":"domain_schema","type":"sql_identifier","length":64},{"name":"domain_name","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"column_options","columns":[{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64},{"name":"option_name","type":"sql_identifier","length":64},{"name":"option_value","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"column_privileges","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"column_udt_usage","columns":[{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"columns","columns":[{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64},{"name":"ordinal_position","type":"cardinal_number","length":4},{"name":"column_default","type":"character_data"},{"name":"is_nullable","type":"yes_or_no"},{"name":"data_type","type":"character_data"},{"name":"character_maximum_length","type":"cardinal_number","length":4},{"name":"character_octet_length","type":"cardinal_number","length":4},{"name":"numeric_precision","type":"cardinal_number","length":4},{"name":"numeric_precision_radix","type":"cardinal_number","length":4},{"name":"numeric_scale","type":"cardinal_number","length":4},{"name":"datetime_precision","type":"cardinal_number","length":4},{"name":"interval_type","type":"character_data"},{"name":"interval_precision","type":"cardinal_number","length":4},{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64},{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"domain_catalog","type":"sql_identifier","length":64},{"name":"domain_schema","type":"sql_identifier","length":64},{"name":"domain_name","type":"sql_identifier","length":64},{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"scope_catalog","type":"sql_identifier","length":64},{"name":"scope_schema","type":"sql_identifier","length":64},{"name":"scope_name","type":"sql_identifier","length":64},{"name":"maximum_cardinality","type":"cardinal_number","length":4},{"name":"dtd_identifier","type":"sql_identifier","length":64},{"name":"is_self_referencing","type":"yes_or_no"},{"name":"is_identity","type":"yes_or_no"},{"name":"identity_generation","type":"character_data"},{"name":"identity_start","type":"character_data"},{"name":"identity_increment","type":"character_data"},{"name":"identity_maximum","type":"character_data"},{"name":"identity_minimum","type":"character_data"},{"name":"identity_cycle","type":"yes_or_no"},{"name":"is_generated","type":"character_data"},{"name":"generation_expression","type":"character_data"},{"name":"is_updatable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"constraint_column_usage","columns":[{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64},{"name":"constraint_catalog","type":"sql_identifier","length":64},{"name":"constraint_schema","type":"sql_identifier","length":64},{"name":"constraint_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"constraint_table_usage","columns":[{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"constraint_catalog","type":"sql_identifier","length":64},{"name":"constraint_schema","type":"sql_identifier","length":64},{"name":"constraint_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"data_type_privileges","columns":[{"name":"object_catalog","type":"sql_identifier","length":64},{"name":"object_schema","type":"sql_identifier","length":64},{"name":"object_name","type":"sql_identifier","length":64},{"name":"object_type","type":"character_data"},{"name":"dtd_identifier","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"domain_constraints","columns":[{"name":"constraint_catalog","type":"sql_identifier","length":64},{"name":"constraint_schema","type":"sql_identifier","length":64},{"name":"constraint_name","type":"sql_identifier","length":64},{"name":"domain_catalog","type":"sql_identifier","length":64},{"name":"domain_schema","type":"sql_identifier","length":64},{"name":"domain_name","type":"sql_identifier","length":64},{"name":"is_deferrable","type":"yes_or_no"},{"name":"initially_deferred","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"domain_udt_usage","columns":[{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"domain_catalog","type":"sql_identifier","length":64},{"name":"domain_schema","type":"sql_identifier","length":64},{"name":"domain_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"domains","columns":[{"name":"domain_catalog","type":"sql_identifier","length":64},{"name":"domain_schema","type":"sql_identifier","length":64},{"name":"domain_name","type":"sql_identifier","length":64},{"name":"data_type","type":"character_data"},{"name":"character_maximum_length","type":"cardinal_number","length":4},{"name":"character_octet_length","type":"cardinal_number","length":4},{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64},{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"numeric_precision","type":"cardinal_number","length":4},{"name":"numeric_precision_radix","type":"cardinal_number","length":4},{"name":"numeric_scale","type":"cardinal_number","length":4},{"name":"datetime_precision","type":"cardinal_number","length":4},{"name":"interval_type","type":"character_data"},{"name":"interval_precision","type":"cardinal_number","length":4},{"name":"domain_default","type":"character_data"},{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"scope_catalog","type":"sql_identifier","length":64},{"name":"scope_schema","type":"sql_identifier","length":64},{"name":"scope_name","type":"sql_identifier","length":64},{"name":"maximum_cardinality","type":"cardinal_number","length":4},{"name":"dtd_identifier","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"element_types","columns":[{"name":"object_catalog","type":"sql_identifier","length":64},{"name":"object_schema","type":"sql_identifier","length":64},{"name":"object_name","type":"sql_identifier","length":64},{"name":"object_type","type":"character_data"},{"name":"collection_type_identifier","type":"sql_identifier","length":64},{"name":"data_type","type":"character_data"},{"name":"character_maximum_length","type":"cardinal_number","length":4},{"name":"character_octet_length","type":"cardinal_number","length":4},{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64},{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"numeric_precision","type":"cardinal_number","length":4},{"name":"numeric_precision_radix","type":"cardinal_number","length":4},{"name":"numeric_scale","type":"cardinal_number","length":4},{"name":"datetime_precision","type":"cardinal_number","length":4},{"name":"interval_type","type":"character_data"},{"name":"interval_precision","type":"cardinal_number","length":4},{"name":"domain_default","type":"character_data"},{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"scope_catalog","type":"sql_identifier","length":64},{"name":"scope_schema","type":"sql_identifier","length":64},{"name":"scope_name","type":"sql_identifier","length":64},{"name":"maximum_cardinality","type":"cardinal_number","length":4},{"name":"dtd_identifier","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"enabled_roles","columns":[{"name":"role_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"foreign_data_wrapper_options","columns":[{"name":"foreign_data_wrapper_catalog","type":"sql_identifier","length":64},{"name":"foreign_data_wrapper_name","type":"sql_identifier","length":64},{"name":"option_name","type":"sql_identifier","length":64},{"name":"option_value","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"foreign_data_wrappers","columns":[{"name":"foreign_data_wrapper_catalog","type":"sql_identifier","length":64},{"name":"foreign_data_wrapper_name","type":"sql_identifier","length":64},{"name":"authorization_identifier","type":"sql_identifier","length":64},{"name":"library_name","type":"character_data"},{"name":"foreign_data_wrapper_language","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"foreign_server_options","columns":[{"name":"foreign_server_catalog","type":"sql_identifier","length":64},{"name":"foreign_server_name","type":"sql_identifier","length":64},{"name":"option_name","type":"sql_identifier","length":64},{"name":"option_value","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"foreign_servers","columns":[{"name":"foreign_server_catalog","type":"sql_identifier","length":64},{"name":"foreign_server_name","type":"sql_identifier","length":64},{"name":"foreign_data_wrapper_catalog","type":"sql_identifier","length":64},{"name":"foreign_data_wrapper_name","type":"sql_identifier","length":64},{"name":"foreign_server_type","type":"character_data"},{"name":"foreign_server_version","type":"character_data"},{"name":"authorization_identifier","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"foreign_table_options","columns":[{"name":"foreign_table_catalog","type":"sql_identifier","length":64},{"name":"foreign_table_schema","type":"sql_identifier","length":64},{"name":"foreign_table_name","type":"sql_identifier","length":64},{"name":"option_name","type":"sql_identifier","length":64},{"name":"option_value","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"foreign_tables","columns":[{"name":"foreign_table_catalog","type":"sql_identifier","length":64},{"name":"foreign_table_schema","type":"sql_identifier","length":64},{"name":"foreign_table_name","type":"sql_identifier","length":64},{"name":"foreign_server_catalog","type":"sql_identifier","length":64},{"name":"foreign_server_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"information_schema_catalog_name","columns":[{"name":"catalog_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"key_column_usage","columns":[{"name":"constraint_catalog","type":"sql_identifier","length":64},{"name":"constraint_schema","type":"sql_identifier","length":64},{"name":"constraint_name","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64},{"name":"ordinal_position","type":"cardinal_number","length":4},{"name":"position_in_unique_constraint","type":"cardinal_number","length":4}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"parameters","columns":[{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"ordinal_position","type":"cardinal_number","length":4},{"name":"parameter_mode","type":"character_data"},{"name":"is_result","type":"yes_or_no"},{"name":"as_locator","type":"yes_or_no"},{"name":"parameter_name","type":"sql_identifier","length":64},{"name":"data_type","type":"character_data"},{"name":"character_maximum_length","type":"cardinal_number","length":4},{"name":"character_octet_length","type":"cardinal_number","length":4},{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64},{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"numeric_precision","type":"cardinal_number","length":4},{"name":"numeric_precision_radix","type":"cardinal_number","length":4},{"name":"numeric_scale","type":"cardinal_number","length":4},{"name":"datetime_precision","type":"cardinal_number","length":4},{"name":"interval_type","type":"character_data"},{"name":"interval_precision","type":"cardinal_number","length":4},{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"scope_catalog","type":"sql_identifier","length":64},{"name":"scope_schema","type":"sql_identifier","length":64},{"name":"scope_name","type":"sql_identifier","length":64},{"name":"maximum_cardinality","type":"cardinal_number","length":4},{"name":"dtd_identifier","type":"sql_identifier","length":64},{"name":"parameter_default","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"referential_constraints","columns":[{"name":"constraint_catalog","type":"sql_identifier","length":64},{"name":"constraint_schema","type":"sql_identifier","length":64},{"name":"constraint_name","type":"sql_identifier","length":64},{"name":"unique_constraint_catalog","type":"sql_identifier","length":64},{"name":"unique_constraint_schema","type":"sql_identifier","length":64},{"name":"unique_constraint_name","type":"sql_identifier","length":64},{"name":"match_option","type":"character_data"},{"name":"update_rule","type":"character_data"},{"name":"delete_rule","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"role_column_grants","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"role_routine_grants","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"routine_catalog","type":"sql_identifier","length":64},{"name":"routine_schema","type":"sql_identifier","length":64},{"name":"routine_name","type":"sql_identifier","length":64},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"role_table_grants","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"},{"name":"with_hierarchy","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"role_udt_grants","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"role_usage_grants","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"object_catalog","type":"sql_identifier","length":64},{"name":"object_schema","type":"sql_identifier","length":64},{"name":"object_name","type":"sql_identifier","length":64},{"name":"object_type","type":"character_data"},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"routine_column_usage","columns":[{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"routine_catalog","type":"sql_identifier","length":64},{"name":"routine_schema","type":"sql_identifier","length":64},{"name":"routine_name","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"routine_privileges","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"routine_catalog","type":"sql_identifier","length":64},{"name":"routine_schema","type":"sql_identifier","length":64},{"name":"routine_name","type":"sql_identifier","length":64},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"routine_routine_usage","columns":[{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"routine_catalog","type":"sql_identifier","length":64},{"name":"routine_schema","type":"sql_identifier","length":64},{"name":"routine_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"routine_sequence_usage","columns":[{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"routine_catalog","type":"sql_identifier","length":64},{"name":"routine_schema","type":"sql_identifier","length":64},{"name":"routine_name","type":"sql_identifier","length":64},{"name":"sequence_catalog","type":"sql_identifier","length":64},{"name":"sequence_schema","type":"sql_identifier","length":64},{"name":"sequence_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"routine_table_usage","columns":[{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"routine_catalog","type":"sql_identifier","length":64},{"name":"routine_schema","type":"sql_identifier","length":64},{"name":"routine_name","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"routines","columns":[{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"routine_catalog","type":"sql_identifier","length":64},{"name":"routine_schema","type":"sql_identifier","length":64},{"name":"routine_name","type":"sql_identifier","length":64},{"name":"routine_type","type":"character_data"},{"name":"module_catalog","type":"sql_identifier","length":64},{"name":"module_schema","type":"sql_identifier","length":64},{"name":"module_name","type":"sql_identifier","length":64},{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"data_type","type":"character_data"},{"name":"character_maximum_length","type":"cardinal_number","length":4},{"name":"character_octet_length","type":"cardinal_number","length":4},{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64},{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"numeric_precision","type":"cardinal_number","length":4},{"name":"numeric_precision_radix","type":"cardinal_number","length":4},{"name":"numeric_scale","type":"cardinal_number","length":4},{"name":"datetime_precision","type":"cardinal_number","length":4},{"name":"interval_type","type":"character_data"},{"name":"interval_precision","type":"cardinal_number","length":4},{"name":"type_udt_catalog","type":"sql_identifier","length":64},{"name":"type_udt_schema","type":"sql_identifier","length":64},{"name":"type_udt_name","type":"sql_identifier","length":64},{"name":"scope_catalog","type":"sql_identifier","length":64},{"name":"scope_schema","type":"sql_identifier","length":64},{"name":"scope_name","type":"sql_identifier","length":64},{"name":"maximum_cardinality","type":"cardinal_number","length":4},{"name":"dtd_identifier","type":"sql_identifier","length":64},{"name":"routine_body","type":"character_data"},{"name":"routine_definition","type":"character_data"},{"name":"external_name","type":"character_data"},{"name":"external_language","type":"character_data"},{"name":"parameter_style","type":"character_data"},{"name":"is_deterministic","type":"yes_or_no"},{"name":"sql_data_access","type":"character_data"},{"name":"is_null_call","type":"yes_or_no"},{"name":"sql_path","type":"character_data"},{"name":"schema_level_routine","type":"yes_or_no"},{"name":"max_dynamic_result_sets","type":"cardinal_number","length":4},{"name":"is_user_defined_cast","type":"yes_or_no"},{"name":"is_implicitly_invocable","type":"yes_or_no"},{"name":"security_type","type":"character_data"},{"name":"to_sql_specific_catalog","type":"sql_identifier","length":64},{"name":"to_sql_specific_schema","type":"sql_identifier","length":64},{"name":"to_sql_specific_name","type":"sql_identifier","length":64},{"name":"as_locator","type":"yes_or_no"},{"name":"created","type":"time_stamp","length":8},{"name":"last_altered","type":"time_stamp","length":8},{"name":"new_savepoint_level","type":"yes_or_no"},{"name":"is_udt_dependent","type":"yes_or_no"},{"name":"result_cast_from_data_type","type":"character_data"},{"name":"result_cast_as_locator","type":"yes_or_no"},{"name":"result_cast_char_max_length","type":"cardinal_number","length":4},{"name":"result_cast_char_octet_length","type":"cardinal_number","length":4},{"name":"result_cast_char_set_catalog","type":"sql_identifier","length":64},{"name":"result_cast_char_set_schema","type":"sql_identifier","length":64},{"name":"result_cast_char_set_name","type":"sql_identifier","length":64},{"name":"result_cast_collation_catalog","type":"sql_identifier","length":64},{"name":"result_cast_collation_schema","type":"sql_identifier","length":64},{"name":"result_cast_collation_name","type":"sql_identifier","length":64},{"name":"result_cast_numeric_precision","type":"cardinal_number","length":4},{"name":"result_cast_numeric_precision_radix","type":"cardinal_number","length":4},{"name":"result_cast_numeric_scale","type":"cardinal_number","length":4},{"name":"result_cast_datetime_precision","type":"cardinal_number","length":4},{"name":"result_cast_interval_type","type":"character_data"},{"name":"result_cast_interval_precision","type":"cardinal_number","length":4},{"name":"result_cast_type_udt_catalog","type":"sql_identifier","length":64},{"name":"result_cast_type_udt_schema","type":"sql_identifier","length":64},{"name":"result_cast_type_udt_name","type":"sql_identifier","length":64},{"name":"result_cast_scope_catalog","type":"sql_identifier","length":64},{"name":"result_cast_scope_schema","type":"sql_identifier","length":64},{"name":"result_cast_scope_name","type":"sql_identifier","length":64},{"name":"result_cast_maximum_cardinality","type":"cardinal_number","length":4},{"name":"result_cast_dtd_identifier","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"schemata","columns":[{"name":"catalog_name","type":"sql_identifier","length":64},{"name":"schema_name","type":"sql_identifier","length":64},{"name":"schema_owner","type":"sql_identifier","length":64},{"name":"default_character_set_catalog","type":"sql_identifier","length":64},{"name":"default_character_set_schema","type":"sql_identifier","length":64},{"name":"default_character_set_name","type":"sql_identifier","length":64},{"name":"sql_path","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"sequences","columns":[{"name":"sequence_catalog","type":"sql_identifier","length":64},{"name":"sequence_schema","type":"sql_identifier","length":64},{"name":"sequence_name","type":"sql_identifier","length":64},{"name":"data_type","type":"character_data"},{"name":"numeric_precision","type":"cardinal_number","length":4},{"name":"numeric_precision_radix","type":"cardinal_number","length":4},{"name":"numeric_scale","type":"cardinal_number","length":4},{"name":"start_value","type":"character_data"},{"name":"minimum_value","type":"character_data"},{"name":"maximum_value","type":"character_data"},{"name":"increment","type":"character_data"},{"name":"cycle_option","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"sql_features","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"feature_id","type":"character_data"},{"name":"feature_name","type":"character_data"},{"name":"sub_feature_id","type":"character_data"},{"name":"sub_feature_name","type":"character_data"},{"name":"is_supported","type":"yes_or_no"},{"name":"is_verified_by","type":"character_data"},{"name":"comments","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"sql_implementation_info","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"implementation_info_id","type":"character_data"},{"name":"implementation_info_name","type":"character_data"},{"name":"integer_value","type":"cardinal_number","length":4},{"name":"character_value","type":"character_data"},{"name":"comments","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"sql_parts","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"feature_id","type":"character_data"},{"name":"feature_name","type":"character_data"},{"name":"is_supported","type":"yes_or_no"},{"name":"is_verified_by","type":"character_data"},{"name":"comments","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"sql_sizing","columns":[{"name":"tableoid","type":"oid","not_null":true,"length":4},{"name":"cmax","type":"cid","not_null":true,"length":4},{"name":"xmax","type":"xid","not_null":true,"length":4},{"name":"cmin","type":"cid","not_null":true,"length":4},{"name":"xmin","type":"xid","not_null":true,"length":4},{"name":"ctid","type":"tid","not_null":true,"length":6},{"name":"sizing_id","type":"cardinal_number","length":4},{"name":"sizing_name","type":"character_data"},{"name":"supported_value","type":"cardinal_number","length":4},{"name":"comments","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"table_constraints","columns":[{"name":"constraint_catalog","type":"sql_identifier","length":64},{"name":"constraint_schema","type":"sql_identifier","length":64},{"name":"constraint_name","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"constraint_type","type":"character_data"},{"name":"is_deferrable","type":"yes_or_no"},{"name":"initially_deferred","type":"yes_or_no"},{"name":"enforced","type":"yes_or_no"},{"name":"nulls_distinct","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"table_privileges","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"},{"name":"with_hierarchy","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"tables","columns":[{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"table_type","type":"character_data"},{"name":"self_referencing_column_name","type":"sql_identifier","length":64},{"name":"reference_generation","type":"character_data"},{"name":"user_defined_type_catalog","type":"sql_identifier","length":64},{"name":"user_defined_type_schema","type":"sql_identifier","length":64},{"name":"user_defined_type_name","type":"sql_identifier","length":64},{"name":"is_insertable_into","type":"yes_or_no"},{"name":"is_typed","type":"yes_or_no"},{"name":"commit_action","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"transforms","columns":[{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64},{"name":"group_name","type":"sql_identifier","length":64},{"name":"transform_type","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"triggered_update_columns","columns":[{"name":"trigger_catalog","type":"sql_identifier","length":64},{"name":"trigger_schema","type":"sql_identifier","length":64},{"name":"trigger_name","type":"sql_identifier","length":64},{"name":"event_object_catalog","type":"sql_identifier","length":64},{"name":"event_object_schema","type":"sql_identifier","length":64},{"name":"event_object_table","type":"sql_identifier","length":64},{"name":"event_object_column","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"triggers","columns":[{"name":"trigger_catalog","type":"sql_identifier","length":64},{"name":"trigger_schema","type":"sql_identifier","length":64},{"name":"trigger_name","type":"sql_identifier","length":64},{"name":"event_manipulation","type":"character_data"},{"name":"event_object_catalog","type":"sql_identifier","length":64},{"name":"event_object_schema","type":"sql_identifier","length":64},{"name":"event_object_table","type":"sql_identifier","length":64},{"name":"action_order","type":"cardinal_number","length":4},{"name":"action_condition","type":"character_data"},{"name":"action_statement","type":"character_data"},{"name":"action_orientation","type":"character_data"},{"name":"action_timing","type":"character_data"},{"name":"action_reference_old_table","type":"sql_identifier","length":64},{"name":"action_reference_new_table","type":"sql_identifier","length":64},{"name":"action_reference_old_row","type":"sql_identifier","length":64},{"name":"action_reference_new_row","type":"sql_identifier","length":64},{"name":"created","type":"time_stamp","length":8}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"udt_privileges","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"udt_catalog","type":"sql_identifier","length":64},{"name":"udt_schema","type":"sql_identifier","length":64},{"name":"udt_name","type":"sql_identifier","length":64},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"usage_privileges","columns":[{"name":"grantor","type":"sql_identifier","length":64},{"name":"grantee","type":"sql_identifier","length":64},{"name":"object_catalog","type":"sql_identifier","length":64},{"name":"object_schema","type":"sql_identifier","length":64},{"name":"object_name","type":"sql_identifier","length":64},{"name":"object_type","type":"character_data"},{"name":"privilege_type","type":"character_data"},{"name":"is_grantable","type":"yes_or_no"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"user_defined_types","columns":[{"name":"user_defined_type_catalog","type":"sql_identifier","length":64},{"name":"user_defined_type_schema","type":"sql_identifier","length":64},{"name":"user_defined_type_name","type":"sql_identifier","length":64},{"name":"user_defined_type_category","type":"character_data"},{"name":"is_instantiable","type":"yes_or_no"},{"name":"is_final","type":"yes_or_no"},{"name":"ordering_form","type":"character_data"},{"name":"ordering_category","type":"character_data"},{"name":"ordering_routine_catalog","type":"sql_identifier","length":64},{"name":"ordering_routine_schema","type":"sql_identifier","length":64},{"name":"ordering_routine_name","type":"sql_identifier","length":64},{"name":"reference_type","type":"character_data"},{"name":"data_type","type":"character_data"},{"name":"character_maximum_length","type":"cardinal_number","length":4},{"name":"character_octet_length","type":"cardinal_number","length":4},{"name":"character_set_catalog","type":"sql_identifier","length":64},{"name":"character_set_schema","type":"sql_identifier","length":64},{"name":"character_set_name","type":"sql_identifier","length":64},{"name":"collation_catalog","type":"sql_identifier","length":64},{"name":"collation_schema","type":"sql_identifier","length":64},{"name":"collation_name","type":"sql_identifier","length":64},{"name":"numeric_precision","type":"cardinal_number","length":4},{"name":"numeric_precision_radix","type":"cardinal_number","length":4},{"name":"numeric_scale","type":"cardinal_number","length":4},{"name":"datetime_precision","type":"cardinal_number","length":4},{"name":"interval_type","type":"character_data"},{"name":"interval_precision","type":"cardinal_number","length":4},{"name":"source_dtd_identifier","type":"sql_identifier","length":64},{"name":"ref_dtd_identifier","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"user_mapping_options","columns":[{"name":"authorization_identifier","type":"sql_identifier","length":64},{"name":"foreign_server_catalog","type":"sql_identifier","length":64},{"name":"foreign_server_name","type":"sql_identifier","length":64},{"name":"option_name","type":"sql_identifier","length":64},{"name":"option_value","type":"character_data"}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"user_mappings","columns":[{"name":"authorization_identifier","type":"sql_identifier","length":64},{"name":"foreign_server_catalog","type":"sql_identifier","length":64},{"name":"foreign_server_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"view_column_usage","columns":[{"name":"view_catalog","type":"sql_identifier","length":64},{"name":"view_schema","type":"sql_identifier","length":64},{"name":"view_name","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"column_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"view_routine_usage","columns":[{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"specific_catalog","type":"sql_identifier","length":64},{"name":"specific_schema","type":"sql_identifier","length":64},{"name":"specific_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"view_table_usage","columns":[{"name":"view_catalog","type":"sql_identifier","length":64},{"name":"view_schema","type":"sql_identifier","length":64},{"name":"view_name","type":"sql_identifier","length":64},{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64}]} +{"catalog":"pg_catalog","schema":"information_schema","name":"views","columns":[{"name":"table_catalog","type":"sql_identifier","length":64},{"name":"table_schema","type":"sql_identifier","length":64},{"name":"table_name","type":"sql_identifier","length":64},{"name":"view_definition","type":"character_data"},{"name":"check_option","type":"character_data"},{"name":"is_updatable","type":"yes_or_no"},{"name":"is_insertable_into","type":"yes_or_no"},{"name":"is_trigger_updatable","type":"yes_or_no"},{"name":"is_trigger_deletable","type":"yes_or_no"},{"name":"is_trigger_insertable_into","type":"yes_or_no"}]} diff --git a/internal/engine/postgresql/dialect/types.jsonl b/internal/engine/postgresql/dialect/types.jsonl new file mode 100644 index 0000000000..ac394f1616 --- /dev/null +++ b/internal/engine/postgresql/dialect/types.jsonl @@ -0,0 +1,48 @@ +{"name": "boolean", "category": "B", "aliases": ["bool"]} +{"name": "smallint", "category": "N", "aliases": ["int2", "smallserial", "serial2"]} +{"name": "integer", "category": "N", "aliases": ["int4", "int", "serial", "serial4"]} +{"name": "bigint", "category": "N", "aliases": ["int8", "bigserial", "serial8"]} +{"name": "real", "category": "N", "aliases": ["float4"]} +{"name": "double precision", "category": "N", "aliases": ["float8"]} +{"name": "numeric", "category": "N", "aliases": ["decimal"]} +{"name": "money", "category": "N"} +{"name": "oid", "category": "N"} +{"name": "text", "category": "S"} +{"name": "character varying", "category": "S", "aliases": ["varchar"]} +{"name": "character", "category": "S", "aliases": ["bpchar", "char"]} +{"name": "name", "category": "S"} +{"name": "citext", "category": "S"} +{"name": "date", "category": "D"} +{"name": "time without time zone", "category": "D", "aliases": ["time"]} +{"name": "time with time zone", "category": "D", "aliases": ["timetz"]} +{"name": "timestamp without time zone", "category": "D", "aliases": ["timestamp"]} +{"name": "timestamp with time zone", "category": "D", "aliases": ["timestamptz"]} +{"name": "interval", "category": "T"} +{"name": "uuid", "category": "U"} +{"name": "bytea", "category": "U"} +{"name": "json", "category": "U"} +{"name": "jsonb", "category": "U"} +{"name": "xml", "category": "U"} +{"name": "inet", "category": "U"} +{"name": "cidr", "category": "U"} +{"name": "macaddr", "category": "U"} +{"name": "macaddr8", "category": "U"} +{"name": "bit", "category": "U"} +{"name": "bit varying", "category": "U", "aliases": ["varbit"]} +{"name": "tsvector", "category": "U"} +{"name": "tsquery", "category": "U"} +{"name": "point", "category": "U"} +{"name": "line", "category": "U"} +{"name": "lseg", "category": "U"} +{"name": "box", "category": "U"} +{"name": "path", "category": "U"} +{"name": "polygon", "category": "U"} +{"name": "circle", "category": "U"} +{"name": "int4range", "category": "U"} +{"name": "int8range", "category": "U"} +{"name": "numrange", "category": "U"} +{"name": "tsrange", "category": "U"} +{"name": "tstzrange", "category": "U"} +{"name": "daterange", "category": "U"} +{"name": "anyarray", "category": "A"} +{"name": "array", "category": "A"} diff --git a/internal/engine/postgresql/extension.go b/internal/engine/postgresql/extension.go index c2bfed5c5c..6d81f9f08c 100644 --- a/internal/engine/postgresql/extension.go +++ b/internal/engine/postgresql/extension.go @@ -1,82 +1,27 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - package postgresql import ( - "github.com/sqlc-dev/sqlc/internal/engine/postgresql/contrib" + "io/fs" + "path" + + "github.com/sqlc-dev/sqlc/internal/core/seed" "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) +// loadExtension reads the named extension's function list from the dialect +// directory, where goldeneye writes one directory per extension. An +// extension sqlc does not know is nil, which CREATE EXTENSION treats as +// nothing to add. func loadExtension(name string) *catalog.Schema { - switch name { - case "adminpack": - return contrib.Adminpack() - case "amcheck": - return contrib.Amcheck() - case "btree_gin": - return contrib.BtreeGin() - case "btree_gist": - return contrib.BtreeGist() - case "citext": - return contrib.Citext() - case "cube": - return contrib.Cube() - case "dblink": - return contrib.Dblink() - case "earthdistance": - return contrib.Earthdistance() - case "file_fdw": - return contrib.FileFdw() - case "fuzzystrmatch": - return contrib.Fuzzystrmatch() - case "hstore": - return contrib.Hstore() - case "intagg": - return contrib.Intagg() - case "intarray": - return contrib.Intarray() - case "isn": - return contrib.Isn() - case "lo": - return contrib.Lo() - case "ltree": - return contrib.Ltree() - case "pageinspect": - return contrib.Pageinspect() - case "pg_buffercache": - return contrib.PgBuffercache() - case "pg_freespacemap": - return contrib.PgFreespacemap() - case "pg_prewarm": - return contrib.PgPrewarm() - case "pg_stat_statements": - return contrib.PgStatStatements() - case "pg_trgm": - return contrib.PgTrgm() - case "pg_visibility": - return contrib.PgVisibility() - case "pgcrypto": - return contrib.Pgcrypto() - case "pgrowlocks": - return contrib.Pgrowlocks() - case "pgstattuple": - return contrib.Pgstattuple() - case "postgres_fdw": - return contrib.PostgresFdw() - case "seg": - return contrib.Seg() - case "sslinfo": - return contrib.Sslinfo() - case "tablefunc": - return contrib.Tablefunc() - case "tcn": - return contrib.Tcn() - case "unaccent": - return contrib.Unaccent() - case "uuid-ossp": - return contrib.UuidOssp() - case "xml2": - return contrib.Xml2() + dir := path.Join("dialect", "extensions", name) + if _, err := fs.Stat(dialectFS, path.Join(dir, seed.FunctionsFile)); err != nil { + return nil + } + funcs, err := seed.Functions(dialectFS, dir) + if err != nil { + // The list is embedded in the binary: a failure here means sqlc was + // built from a broken tree, which no caller can do anything about. + panic(err) } - return nil + return &catalog.Schema{Name: "pg_catalog", Funcs: funcs} } diff --git a/internal/engine/postgresql/information_schema.go b/internal/engine/postgresql/information_schema.go deleted file mode 100644 index ac76d47905..0000000000 --- a/internal/engine/postgresql/information_schema.go +++ /dev/null @@ -1,4111 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package postgresql - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsgenInformationSchema = []*catalog.Function{} - -func genInformationSchema() *catalog.Schema { - s := &catalog.Schema{Name: "information_schema"} - s.Funcs = funcsgenInformationSchema - s.Tables = []*catalog.Table{ - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "_pg_foreign_data_wrappers", - }, - Columns: []*catalog.Column{ - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "fdwowner", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "fdwoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "foreign_data_wrapper_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_data_wrapper_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "authorization_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_data_wrapper_language", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "_pg_foreign_servers", - }, - Columns: []*catalog.Column{ - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "srvoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "foreign_server_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_data_wrapper_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_data_wrapper_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "foreign_server_version", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "authorization_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "_pg_foreign_table_columns", - }, - Columns: []*catalog.Column{ - { - Name: "nspname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "attname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "attfdwoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "_pg_foreign_tables", - }, - Columns: []*catalog.Column{ - { - Name: "foreign_table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "ftoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "foreign_server_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "authorization_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "_pg_user_mappings", - }, - Columns: []*catalog.Column{ - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "umoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "umuser", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "authorization_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "srvowner", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "administrable_role_authorizations", - }, - Columns: []*catalog.Column{ - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "role_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "applicable_roles", - }, - Columns: []*catalog.Column{ - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "role_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "attributes", - }, - Columns: []*catalog.Column{ - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "attribute_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "ordinal_position", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "attribute_default", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_nullable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "character_maximum_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_octet_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "datetime_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "interval_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "interval_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "attribute_udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "attribute_udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "attribute_udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "maximum_cardinality", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "is_derived_reference_attribute", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "character_sets", - }, - Columns: []*catalog.Column{ - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_repertoire", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "form_of_use", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "default_collate_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "default_collate_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "default_collate_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "check_constraint_routine_usage", - }, - Columns: []*catalog.Column{ - { - Name: "constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "check_constraints", - }, - Columns: []*catalog.Column{ - { - Name: "constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "check_clause", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "collation_character_set_applicability", - }, - Columns: []*catalog.Column{ - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "collations", - }, - Columns: []*catalog.Column{ - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "pad_attribute", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "column_column_usage", - }, - Columns: []*catalog.Column{ - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "dependent_column", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "column_domain_usage", - }, - Columns: []*catalog.Column{ - { - Name: "domain_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "column_options", - }, - Columns: []*catalog.Column{ - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_value", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "column_privileges", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "column_udt_usage", - }, - Columns: []*catalog.Column{ - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "columns", - }, - Columns: []*catalog.Column{ - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "ordinal_position", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "column_default", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_nullable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "character_maximum_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_octet_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "datetime_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "interval_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "interval_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "maximum_cardinality", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "is_self_referencing", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_identity", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "identity_generation", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "identity_start", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "identity_increment", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "identity_maximum", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "identity_minimum", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "identity_cycle", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_generated", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "generation_expression", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_updatable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "constraint_column_usage", - }, - Columns: []*catalog.Column{ - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "constraint_table_usage", - }, - Columns: []*catalog.Column{ - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "data_type_privileges", - }, - Columns: []*catalog.Column{ - { - Name: "object_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "domain_constraints", - }, - Columns: []*catalog.Column{ - { - Name: "constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "is_deferrable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "initially_deferred", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "domain_udt_usage", - }, - Columns: []*catalog.Column{ - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "domains", - }, - Columns: []*catalog.Column{ - { - Name: "domain_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "domain_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "character_maximum_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_octet_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "datetime_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "interval_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "interval_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "domain_default", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "maximum_cardinality", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "element_types", - }, - Columns: []*catalog.Column{ - { - Name: "object_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "collection_type_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "character_maximum_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_octet_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "datetime_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "interval_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "interval_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "domain_default", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "maximum_cardinality", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "enabled_roles", - }, - Columns: []*catalog.Column{ - { - Name: "role_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "foreign_data_wrapper_options", - }, - Columns: []*catalog.Column{ - { - Name: "foreign_data_wrapper_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_data_wrapper_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_value", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "foreign_data_wrappers", - }, - Columns: []*catalog.Column{ - { - Name: "foreign_data_wrapper_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_data_wrapper_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "authorization_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "library_name", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "foreign_data_wrapper_language", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "foreign_server_options", - }, - Columns: []*catalog.Column{ - { - Name: "foreign_server_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_value", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "foreign_servers", - }, - Columns: []*catalog.Column{ - { - Name: "foreign_server_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_data_wrapper_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_data_wrapper_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "foreign_server_version", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "authorization_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "foreign_table_options", - }, - Columns: []*catalog.Column{ - { - Name: "foreign_table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_value", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "foreign_tables", - }, - Columns: []*catalog.Column{ - { - Name: "foreign_table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "information_schema_catalog_name", - }, - Columns: []*catalog.Column{ - { - Name: "catalog_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "key_column_usage", - }, - Columns: []*catalog.Column{ - { - Name: "constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "ordinal_position", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "position_in_unique_constraint", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "parameters", - }, - Columns: []*catalog.Column{ - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "ordinal_position", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "parameter_mode", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_result", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "as_locator", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "parameter_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "character_maximum_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_octet_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "datetime_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "interval_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "interval_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "maximum_cardinality", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "parameter_default", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "referential_constraints", - }, - Columns: []*catalog.Column{ - { - Name: "constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "unique_constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "unique_constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "unique_constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "match_option", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "update_rule", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "delete_rule", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "role_column_grants", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "role_routine_grants", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "role_table_grants", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "with_hierarchy", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "role_udt_grants", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "role_usage_grants", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "routine_column_usage", - }, - Columns: []*catalog.Column{ - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "routine_privileges", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "routine_routine_usage", - }, - Columns: []*catalog.Column{ - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "routine_sequence_usage", - }, - Columns: []*catalog.Column{ - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "sequence_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "sequence_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "sequence_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "routine_table_usage", - }, - Columns: []*catalog.Column{ - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "routines", - }, - Columns: []*catalog.Column{ - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "module_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "module_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "module_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "character_maximum_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_octet_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "datetime_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "interval_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "interval_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "type_udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "type_udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "type_udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "scope_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "maximum_cardinality", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "routine_body", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "routine_definition", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "external_name", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "external_language", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "parameter_style", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_deterministic", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "sql_data_access", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_null_call", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "sql_path", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "schema_level_routine", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "max_dynamic_result_sets", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "is_user_defined_cast", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_implicitly_invocable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "security_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "to_sql_specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "to_sql_specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "to_sql_specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "as_locator", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "created", - Type: ast.TypeName{Name: "time_stamp"}, - Length: toPointer(8), - }, - { - Name: "last_altered", - Type: ast.TypeName{Name: "time_stamp"}, - Length: toPointer(8), - }, - { - Name: "new_savepoint_level", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_udt_dependent", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "result_cast_from_data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "result_cast_as_locator", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "result_cast_char_max_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "result_cast_char_octet_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "result_cast_char_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_char_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_char_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "result_cast_numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "result_cast_numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "result_cast_datetime_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "result_cast_interval_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "result_cast_interval_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "result_cast_type_udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_type_udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_type_udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_scope_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_scope_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_scope_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "result_cast_maximum_cardinality", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "result_cast_dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "schemata", - }, - Columns: []*catalog.Column{ - { - Name: "catalog_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "schema_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "schema_owner", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "default_character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "default_character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "default_character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "sql_path", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "sequences", - }, - Columns: []*catalog.Column{ - { - Name: "sequence_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "sequence_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "sequence_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "start_value", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "minimum_value", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "maximum_value", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "increment", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "cycle_option", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "sql_features", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "feature_id", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "feature_name", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "sub_feature_id", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "sub_feature_name", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_supported", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_verified_by", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "comments", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "sql_implementation_info", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "implementation_info_id", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "implementation_info_name", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "integer_value", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_value", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "comments", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "sql_parts", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "feature_id", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "feature_name", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_supported", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_verified_by", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "comments", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "sql_sizing", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "sizing_id", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "sizing_name", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "supported_value", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "comments", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "table_constraints", - }, - Columns: []*catalog.Column{ - { - Name: "constraint_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "constraint_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_deferrable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "initially_deferred", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "enforced", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "nulls_distinct", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "table_privileges", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "with_hierarchy", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "tables", - }, - Columns: []*catalog.Column{ - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "self_referencing_column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "reference_generation", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "user_defined_type_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "user_defined_type_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "user_defined_type_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "is_insertable_into", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_typed", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "commit_action", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "transforms", - }, - Columns: []*catalog.Column{ - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "group_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "transform_type", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "triggered_update_columns", - }, - Columns: []*catalog.Column{ - { - Name: "trigger_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "trigger_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "trigger_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "event_object_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "event_object_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "event_object_table", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "event_object_column", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "triggers", - }, - Columns: []*catalog.Column{ - { - Name: "trigger_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "trigger_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "trigger_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "event_manipulation", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "event_object_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "event_object_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "event_object_table", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "action_order", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "action_condition", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "action_statement", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "action_orientation", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "action_timing", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "action_reference_old_table", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "action_reference_new_table", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "action_reference_old_row", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "action_reference_new_row", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "created", - Type: ast.TypeName{Name: "time_stamp"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "udt_privileges", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "udt_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "usage_privileges", - }, - Columns: []*catalog.Column{ - { - Name: "grantor", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "grantee", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "object_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "privilege_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_grantable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "user_defined_types", - }, - Columns: []*catalog.Column{ - { - Name: "user_defined_type_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "user_defined_type_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "user_defined_type_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "user_defined_type_category", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_instantiable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_final", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "ordering_form", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "ordering_category", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "ordering_routine_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "ordering_routine_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "ordering_routine_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "reference_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "character_maximum_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_octet_length", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "character_set_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "character_set_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "collation_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "numeric_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_precision_radix", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "numeric_scale", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "datetime_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "interval_type", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "interval_precision", - Type: ast.TypeName{Name: "cardinal_number"}, - Length: toPointer(4), - }, - { - Name: "source_dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "ref_dtd_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "user_mapping_options", - }, - Columns: []*catalog.Column{ - { - Name: "authorization_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "option_value", - Type: ast.TypeName{Name: "character_data"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "user_mappings", - }, - Columns: []*catalog.Column{ - { - Name: "authorization_identifier", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "foreign_server_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "view_column_usage", - }, - Columns: []*catalog.Column{ - { - Name: "view_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "view_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "view_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "column_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "view_routine_usage", - }, - Columns: []*catalog.Column{ - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "specific_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "view_table_usage", - }, - Columns: []*catalog.Column{ - { - Name: "view_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "view_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "view_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "information_schema", - Name: "views", - }, - Columns: []*catalog.Column{ - { - Name: "table_catalog", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_schema", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "table_name", - Type: ast.TypeName{Name: "sql_identifier"}, - Length: toPointer(64), - }, - { - Name: "view_definition", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "check_option", - Type: ast.TypeName{Name: "character_data"}, - }, - { - Name: "is_updatable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_insertable_into", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_trigger_updatable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_trigger_deletable", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - { - Name: "is_trigger_insertable_into", - Type: ast.TypeName{Name: "yes_or_no"}, - }, - }, - }, - } - return s -} diff --git a/internal/engine/postgresql/parse.go b/internal/engine/postgresql/parse.go index 49ec981484..58f7c3d431 100644 --- a/internal/engine/postgresql/parse.go +++ b/internal/engine/postgresql/parse.go @@ -1,6 +1,3 @@ -//go:build !windows && cgo -// +build !windows,cgo - package postgresql import ( @@ -9,14 +6,17 @@ import ( "io" "strings" - nodes "github.com/pganalyze/pg_query_go/v4" - "github.com/pganalyze/pg_query_go/v4/parser" + nodes "github.com/sqlc-dev/oliphant" + "github.com/sqlc-dev/oliphant/parser" - "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) +var Parse = nodes.Parse +var Fingerprint = nodes.Fingerprint + func stringSlice(list *nodes.List) []string { items := []string{} for _, item := range list.Items { @@ -150,18 +150,54 @@ type Parser struct { var errSkip = errors.New("skip stmt") func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { - contents, err := io.ReadAll(r) + f, err := p.ParseFile(r) + if err != nil { + return nil, err + } + return f.Stmts, nil +} + +// ParseFile parses like Parse and also carries the file's comments, which +// oliphant's parser collects from the same pass its scanner already makes +// over the input. +func (p *Parser) ParseFile(r io.Reader) (*ast.File, error) { + blob, err := io.ReadAll(r) if err != nil { return nil, err } - tree, err := nodes.Parse(string(contents)) + contents := string(blob) + parsed, err := parser.ParseFile(contents) if err != nil { pErr := normalizeErr(err) return nil, pErr } + tree := parsed.ParseResult var stmts []ast.Statement + // PostgreSQL 18 changed stmt_location to point at the statement's first + // token. The rest of the compiler expects the earlier convention, where a + // statement begins where the previous one ended and so carries its leading + // comments (that's where `-- name:` lives). + loc := 0 for _, raw := range tree.Stmts { + start := loc + end := int(raw.StmtLocation) + int(raw.StmtLen) + next := end + for next < len(contents) && contents[next] != ';' { + next++ + } + terminated := next < len(contents) + if terminated { + next++ + } + loc = next + length := end - start + if !terminated { + // A zero length marked an unterminated final statement before + // PostgreSQL 18, and the compiler still reports it that way. + length = 0 + } + n, err := translate(raw.Stmt) if err == errSkip { continue @@ -175,12 +211,38 @@ func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { stmts = append(stmts, ast.Statement{ Raw: &ast.RawStmt{ Stmt: n, - StmtLocation: int(raw.StmtLocation), - StmtLen: int(raw.StmtLen), + StmtLocation: start, + StmtLen: length, }, }) } - return stmts, nil + + var comments []ast.Comment + for _, tok := range parsed.Comments { + comments = append(comments, ast.Comment{ + Text: strings.TrimRight(contents[tok.Start:tok.End], " \t\r\n"), + Start: int(tok.Start), + End: int(tok.End), + OwnLine: ownLine(contents, int(tok.Start)), + }) + } + return &ast.File{Stmts: stmts, Comments: comments}, nil +} + +// ownLine reports that only blank space sits between the preceding line +// break and pos. +func ownLine(src string, pos int) bool { + for j := pos - 1; j >= 0; j-- { + switch src[j] { + case '\n': + return true + case ' ', '\t', '\r': + continue + default: + return false + } + } + return true } func normalizeErr(err error) error { @@ -199,8 +261,8 @@ func normalizeErr(err error) error { } // https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ Dash: true, SlashStar: true, } @@ -274,7 +336,7 @@ func translate(node *nodes.Node) (ast.Node, error) { case nodes.AlterTableType_AT_AddColumn: d, ok := altercmd.Def.Node.(*nodes.Node_ColumnDef) if !ok { - return nil, fmt.Errorf("expected alter table defintion to be a ColumnDef") + return nil, fmt.Errorf("expected alter table definition to be a ColumnDef") } rel, err := parseRelationFromNodes(d.ColumnDef.TypeName.Names) @@ -284,7 +346,7 @@ func translate(node *nodes.Node) (ast.Node, error) { item.Subtype = ast.AT_AddColumn item.Def = &ast.ColumnDef{ Colname: d.ColumnDef.Colname, - TypeName: rel.TypeName(), + TypeName: columnTypeName(rel, d.ColumnDef.TypeName), IsNotNull: isNotNull(d.ColumnDef), IsArray: isArray(d.ColumnDef.TypeName), ArrayDims: len(d.ColumnDef.TypeName.ArrayBounds), @@ -293,7 +355,7 @@ func translate(node *nodes.Node) (ast.Node, error) { case nodes.AlterTableType_AT_AlterColumnType: d, ok := altercmd.Def.Node.(*nodes.Node_ColumnDef) if !ok { - return nil, fmt.Errorf("expected alter table defintion to be a ColumnDef") + return nil, fmt.Errorf("expected alter table definition to be a ColumnDef") } col := "" if altercmd.Name != "" { @@ -310,7 +372,7 @@ func translate(node *nodes.Node) (ast.Node, error) { item.Subtype = ast.AT_AlterColumnType item.Def = &ast.ColumnDef{ Colname: col, - TypeName: rel.TypeName(), + TypeName: columnTypeName(rel, d.ColumnDef.TypeName), IsNotNull: isNotNull(d.ColumnDef), IsArray: isArray(d.ColumnDef.TypeName), ArrayDims: len(d.ColumnDef.TypeName.ArrayBounds), @@ -395,9 +457,27 @@ func translate(node *nodes.Node) (ast.Node, error) { case *nodes.Node_CompositeTypeStmt: n := inner.CompositeTypeStmt rel := parseRelationFromRangeVar(n.Typevar) - return &ast.CompositeTypeStmt{ - TypeName: rel.TypeName(), - }, nil + stmt := &ast.CompositeTypeStmt{ + TypeName: rel.TypeName(), + Coldeflist: &ast.List{}, + } + for _, node := range n.Coldeflist { + field, ok := node.Node.(*nodes.Node_ColumnDef) + if !ok { + continue + } + rel, err := parseRelationFromNodes(field.ColumnDef.TypeName.Names) + if err != nil { + return nil, err + } + stmt.Coldeflist.Items = append(stmt.Coldeflist.Items, &ast.ColumnDef{ + Colname: field.ColumnDef.Colname, + TypeName: columnTypeName(rel, field.ColumnDef.TypeName), + IsArray: isArray(field.ColumnDef.TypeName), + ArrayDims: len(field.ColumnDef.TypeName.ArrayBounds), + }) + } + return stmt, nil case *nodes.Node_CreateStmt: n := inner.CreateStmt @@ -448,7 +528,7 @@ func translate(node *nodes.Node) (ast.Node, error) { create.Cols = append(create.Cols, &ast.ColumnDef{ Colname: item.ColumnDef.Colname, - TypeName: rel.TypeName(), + TypeName: columnTypeName(rel, item.ColumnDef.TypeName), IsNotNull: isNotNull(item.ColumnDef) || primaryKey[item.ColumnDef.Colname], IsArray: isArray(item.ColumnDef.TypeName), ArrayDims: len(item.ColumnDef.TypeName.ArrayBounds), @@ -497,6 +577,7 @@ func translate(node *nodes.Node) (ast.Node, error) { ReturnType: rt, Replace: n.Replace, Params: &ast.List{}, + Options: convertSlice(n.Options), } for _, item := range n.Parameters { arg := item.Node.(*nodes.Node_FunctionParameter).FunctionParameter @@ -620,7 +701,7 @@ func translate(node *nodes.Node) (ast.Node, error) { MissingOk: n.MissingOk, }, nil - case nodes.ObjectType_OBJECT_TABLE: + case nodes.ObjectType_OBJECT_TABLE, nodes.ObjectType_OBJECT_MATVIEW, nodes.ObjectType_OBJECT_VIEW: rel := parseRelationFromRangeVar(n.Relation) return &ast.RenameTableStmt{ Table: rel.TableName(), @@ -645,3 +726,73 @@ func translate(node *nodes.Node) (ast.Node, error) { return convert(node) } } + +// columnTypeName is a column's type as the catalog needs it: the name the +// relation resolves, with the type modifiers the parser reported. Every +// modifier is an integer constant, except that an interval's first one is a +// bit mask of the fields it keeps, which is decoded into the words +// format_type prints, so that "interval day to second" carries "day to +// second" as its first argument. +func columnTypeName(rel *relation, tn *nodes.TypeName) *ast.TypeName { + out := rel.TypeName() + if tn == nil || len(tn.Typmods) == 0 { + return out + } + out.Typmods = &ast.List{} + for i, mod := range tn.Typmods { + c, ok := mod.Node.(*nodes.Node_AConst) + if !ok { + continue + } + ival, ok := c.AConst.Val.(*nodes.A_Const_Ival) + if !ok { + continue + } + if i == 0 && rel.Name == "interval" { + fields, ok := intervalFields[ival.Ival.Ival] + if !ok { + continue + } + if fields != "" { + out.Typmods.Items = append(out.Typmods.Items, &ast.String{Str: fields}) + } + continue + } + out.Typmods.Items = append(out.Typmods.Items, &ast.A_Const{Val: &ast.Integer{Ival: int64(ival.Ival.Ival)}}) + } + if len(out.Typmods.Items) == 0 { + out.Typmods = nil + } + return out +} + +// intervalFields decodes the field mask an interval typmod starts with — +// INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH) and so on, with the field +// numbers PostgreSQL's datetime.h assigns — into the words a declaration +// spells. The full range is written as nothing. +var intervalFields = func() map[int32]string { + const ( + month = 1 << 1 + year = 1 << 2 + day = 1 << 3 + hour = 1 << 10 + minute = 1 << 11 + second = 1 << 12 + ) + return map[int32]string{ + 0x7FFF: "", + year: "year", + month: "month", + day: "day", + hour: "hour", + minute: "minute", + second: "second", + year | month: "year to month", + day | hour: "day to hour", + day | hour | minute: "day to minute", + day | hour | minute | second: "day to second", + hour | minute: "hour to minute", + hour | minute | second: "hour to second", + minute | second: "minute to second", + } +}() diff --git a/internal/engine/postgresql/parse_disabled.go b/internal/engine/postgresql/parse_disabled.go deleted file mode 100644 index ecc5158d43..0000000000 --- a/internal/engine/postgresql/parse_disabled.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build windows || !cgo -// +build windows !cgo - -package postgresql - -import ( - "errors" - "io" - "runtime" - - "github.com/sqlc-dev/sqlc/internal/metadata" - "github.com/sqlc-dev/sqlc/internal/sql/ast" -) - -func NewParser() *Parser { - return &Parser{} -} - -type Parser struct { -} - -func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { - if runtime.GOOS == "windows" { - return nil, errors.New("the PostgreSQL engine does not support Windows.") - } - return nil, errors.New("the PostgreSQL engine requires cgo. Please set CGO_ENABLED=1.") -} - -// https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ - Dash: true, - SlashStar: true, - } -} diff --git a/internal/engine/postgresql/pg_catalog.go b/internal/engine/postgresql/pg_catalog.go deleted file mode 100644 index 9000b592f4..0000000000 --- a/internal/engine/postgresql/pg_catalog.go +++ /dev/null @@ -1,40613 +0,0 @@ -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package postgresql - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcsgenPGCatalog = []*catalog.Function{ - { - Name: "RI_FKey_cascade_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_cascade_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_check_ins", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_check_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_noaction_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_noaction_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_restrict_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_restrict_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_setdefault_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_setdefault_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_setnull_del", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "RI_FKey_setnull_upd", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "abbrev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cidr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "abbrev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "aclcontains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "acldefault", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Name: "aclexplode", - Args: []*catalog.Argument{ - { - Name: "acl", - Type: &ast.TypeName{Name: "aclitem[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "aclinsert", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - }, - ReturnType: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Name: "aclitemeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "aclitemin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "aclitem"}, - }, - { - Name: "aclitemout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "aclremove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - }, - ReturnType: &ast.TypeName{Name: "aclitem[]"}, - }, - { - Name: "acos", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "acosd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "acosh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "amvalidate", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "any_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "any_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anyarray_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "anyarray_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anyarray_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "anycompatible_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatible"}, - }, - { - Name: "anycompatible_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anycompatiblearray_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Name: "anycompatiblearray_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anycompatiblearray_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "anycompatiblemultirange_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblemultirange"}, - }, - { - Name: "anycompatiblemultirange_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblemultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anycompatiblenonarray_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblenonarray"}, - }, - { - Name: "anycompatiblenonarray_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblenonarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anycompatiblerange_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblerange"}, - }, - { - Name: "anycompatiblerange_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblerange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anyelement_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "anyelement_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anyenum_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "anyenum_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anymultirange_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "anymultirange_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anynonarray_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anynonarray"}, - }, - { - Name: "anynonarray_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anynonarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anyrange_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "anyrange_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "anytextcat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anynonarray"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "area", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "area", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "area", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "array_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "array_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anynonarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "array_append", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Name: "array_cat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Name: "array_dims", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "array_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "array_fill", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "array_fill", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "array_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "array_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "array_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "array_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "array_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "array_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "array_lower", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "array_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "array_ndims", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "array_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "array_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "array_position", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "array_position", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "array_positions", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "array_prepend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Name: "array_remove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Name: "array_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatiblearray"}, - }, - { - Name: "array_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "array_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "array_to_json", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "array_to_json", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "array_to_string", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "array_to_string", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "array_to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "array_upper", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "arraycontained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "arraycontains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "arrayoverlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ascii", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "asin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "asind", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "asinh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "atan", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "atan2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "atan2d", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "atand", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "atanh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "binary_upgrade_create_empty_extension", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "oid[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_missing_value", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_array_pg_type_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_heap_pg_class_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_heap_relfilenode", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_index_pg_class_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_index_relfilenode", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_multirange_array_pg_type_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_multirange_pg_type_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_pg_authid_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_pg_enum_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_pg_tablespace_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_pg_type_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_toast_pg_class_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_next_toast_relfilenode", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "binary_upgrade_set_record_init_privs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bit_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "bit_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bit_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bit_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "bit_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "bit_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "bit_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bit_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bit_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bit_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bit_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "bit_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bit_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bit_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "bit_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "bit_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "bit_xor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "bit_xor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bit_xor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bit_xor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "bitand", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bitcat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit varying"}, - }, - { - Name: "bitcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "biteq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bitge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bitgt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bitle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bitlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bitne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bitnot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bitor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bitshiftleft", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bitshiftright", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bittypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bittypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "bitxor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "bool", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bool", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bool_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bool_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "booland_statefunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "booleq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boolge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boolgt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boolin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boolle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boollt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boolne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boolor_statefunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "boolout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "boolsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "bound_box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box_above", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_above_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_add", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box_below", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_below_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "box_contain", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_contain_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "box_div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box_intersect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "box_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "box_overabove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_overbelow", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_overleft", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_overright", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "box_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "box_sub", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "bpchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "bpchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "bpchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "bpchar_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "bpchar_pattern_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchar_pattern_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchar_pattern_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchar_pattern_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchar_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "bpcharcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bpchareq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchargt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpchariclike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharicnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharicregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharicregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "bpcharle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "bpcharregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bpcharsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "bpchartypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bpchartypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "brin_bloom_summary_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_brin_bloom_summary"}, - }, - { - Name: "brin_bloom_summary_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_brin_bloom_summary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "brin_bloom_summary_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_brin_bloom_summary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "brin_desummarize_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "brin_minmax_multi_summary_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_brin_minmax_multi_summary"}, - }, - { - Name: "brin_minmax_multi_summary_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_brin_minmax_multi_summary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "brin_minmax_multi_summary_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_brin_minmax_multi_summary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "brin_summarize_new_values", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "brin_summarize_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "broadcast", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "btarraycmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btboolcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btbpchar_pattern_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btcharcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btequalimage", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "btfloat48cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btfloat4cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btfloat84cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btfloat8cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint24cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint28cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint2cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint42cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint48cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint4cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint82cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint84cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btint8cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btnamecmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btnametextcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btoidcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btoidvectorcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btrecordcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btrecordimagecmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "btrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "btrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "bttext_pattern_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bttextcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bttextnamecmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "bttidcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "btvarstrequalimage", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "byteacat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "byteacmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "byteaeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "byteage", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "byteagt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "byteain", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "byteale", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bytealike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "bytealt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "byteane", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "byteanlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "byteaout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "byteasend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "cardinality", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "cash_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "cash_div_cash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cash_div_flt4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_div_flt8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_div_int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_div_int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_div_int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cash_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cash_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cash_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cash_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cash_mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_mul_flt4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_mul_flt8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_mul_int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_mul_int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_mul_int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cash_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "cash_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cash_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "cash_words", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "cashlarger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cashsmaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "cbrt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ceil", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ceil", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "ceiling", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ceiling", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "char"}, - }, - { - Name: "char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "char"}, - }, - { - Name: "char_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "char_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "character_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "character_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "chareq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "charge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "chargt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "charin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "char"}, - }, - { - Name: "charle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "charlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "charne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "charout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "charsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "chr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "cideq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cid"}, - }, - { - Type: &ast.TypeName{Name: "cid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "cidin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cid"}, - }, - { - Name: "cidout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "cidr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cidr"}, - }, - { - Name: "cidr_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cidr"}, - }, - { - Name: "cidr_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cidr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "cidr_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cidr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "cidsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "circle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "circle"}, - }, - { - Name: "circle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "circle"}, - }, - { - Name: "circle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "circle"}, - }, - { - Name: "circle_above", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_add_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "circle"}, - }, - { - Name: "circle_below", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "circle_contain", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_contain_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "circle_div_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "circle"}, - }, - { - Name: "circle_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "circle"}, - }, - { - Name: "circle_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_mul_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "circle"}, - }, - { - Name: "circle_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "circle_overabove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_overbelow", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_overleft", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_overright", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "circle_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "circle_sub_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "circle"}, - }, - { - Name: "clock_timestamp", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "close_ls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "close_lseg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "close_pb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "close_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "close_ps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "close_sb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "col_description", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "concat_ws", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "convert", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "convert_from", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "convert_to", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "corr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cos", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cosd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cosh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cotd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "count", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "covar_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "covar_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cstring_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "cstring_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "cstring_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "cume_dist", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "cume_dist", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "current_database", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "current_query", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "current_schema", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "current_schemas", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "name[]"}, - }, - { - Name: "current_setting", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "current_setting", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "current_user", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "currtid2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "currval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "cursor_to_xml", - Args: []*catalog.Argument{ - { - Name: "cursor", - Type: &ast.TypeName{Name: "refcursor"}, - }, - { - Name: "count", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "cursor_to_xmlschema", - Args: []*catalog.Argument{ - { - Name: "cursor", - Type: &ast.TypeName{Name: "refcursor"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "database_to_xml", - Args: []*catalog.Argument{ - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "database_to_xml_and_xmlschema", - Args: []*catalog.Argument{ - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "database_to_xmlschema", - Args: []*catalog.Argument{ - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "date_bin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "date_bin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "date_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "date_cmp_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "date_cmp_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "date_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_eq_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_eq_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_ge_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_ge_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_gt_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_gt_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "date_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "date_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_le_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_le_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_lt_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_lt_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "date_mi_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "date_mii", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "date_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_ne_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_ne_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "date_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "date_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "date_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "date_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "date_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "date_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "date_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "date_pl_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "date_pli", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "date_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "date_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "date_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "date_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "date_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "date_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "datemultirange", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "datemultirange"}, - }, - { - Name: "datemultirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "daterange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "datemultirange"}, - }, - { - Name: "datemultirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "daterange[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "datemultirange"}, - }, - { - Name: "daterange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "daterange"}, - }, - { - Name: "daterange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "daterange"}, - }, - { - Name: "daterange_canonical", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "daterange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "daterange"}, - }, - { - Name: "daterange_subdiff", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "datetime_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "datetimetz_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "dcbrt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "decode", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "degrees", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dense_rank", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "dense_rank", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "dexp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "diagonal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "lseg"}, - }, - { - Name: "diameter", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_bp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_bs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_cpoint", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_cpoly", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_lp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_ls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_pathp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_pb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_pc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_polyc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_polyp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_ppath", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_ppoly", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_ps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_sb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_sl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dist_sp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "dlog1", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dlog10", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "domain_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - }, - { - Name: "dpow", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dround", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dsqrt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "dtrunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "elem_contained_by_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "elem_contained_by_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "encode", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "enum_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "enum_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "enum_first", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "enum_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "enum_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "enum_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "enum_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "enum_last", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "enum_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "enum_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "enum_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "enum_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "enum_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "enum_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "enum_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "enum_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "event_trigger_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "event_trigger"}, - }, - { - Name: "event_trigger_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "event_trigger"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "every", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "exp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "exp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "extract", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "extract", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "extract", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "extract", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "extract", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "extract", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "factorial", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "family", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "fdw_handler_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "fdw_handler"}, - }, - { - Name: "fdw_handler_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "fdw_handler"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "first_value", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "float4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float48div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float48eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float48ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float48gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float48le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float48lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float48mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float48mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float48ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float48pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float4_accum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision[]"}, - }, - { - Name: "float4abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float4ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float4gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float4in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float4lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float4mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float4out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "float4pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "float4smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4um", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float4up", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "float8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float84div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float84eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float84ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float84gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float84le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float84lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float84mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float84mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float84ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float84pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_accum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision[]"}, - }, - { - Name: "float8_avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_combine", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision[]"}, - }, - { - Name: "float8_corr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_covar_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_covar_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_regr_accum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision[]"}, - }, - { - Name: "float8_regr_avgx", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_regr_avgy", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_regr_combine", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision[]"}, - }, - { - Name: "float8_regr_intercept", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_regr_r2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_regr_slope", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_regr_sxx", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_regr_sxy", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_regr_syy", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_stddev_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_stddev_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_var_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8_var_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float8ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float8gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float8in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float8lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float8mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "float8out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "float8pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "float8smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8um", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "float8up", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "floor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "floor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "flt4_mul_cash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "flt8_mul_cash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "fmgr_c_validator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "fmgr_internal_validator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "fmgr_sql_validator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "format", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "format", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "format_type", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "gcd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "gcd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "gcd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "gen_random_uuid", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "generate_series", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "generate_series", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "generate_series", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "generate_series", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "generate_series", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "generate_series", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "generate_series", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "generate_series", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "generate_subscripts", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "generate_subscripts", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "get_bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "get_bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "get_byte", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "get_current_ts_config", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "regconfig"}, - }, - { - Name: "getdatabaseencoding", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "getpgusername", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "gin_clean_pending_list", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "gin_cmp_tslexeme", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "gin_compare_jsonb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "gtsvectorin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "gtsvector"}, - }, - { - Name: "gtsvectorout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "gtsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "has_any_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_any_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_any_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_any_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_any_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_any_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_column_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_database_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_database_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_database_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_database_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_database_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_database_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_foreign_data_wrapper_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_foreign_data_wrapper_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_foreign_data_wrapper_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_foreign_data_wrapper_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_foreign_data_wrapper_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_foreign_data_wrapper_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_function_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_function_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_function_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_function_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_function_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_function_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_language_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_language_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_language_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_language_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_language_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_language_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_parameter_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_parameter_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_parameter_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_schema_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_schema_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_schema_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_schema_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_schema_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_schema_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_sequence_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_sequence_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_sequence_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_sequence_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_sequence_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_sequence_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_server_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_server_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_server_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_server_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_server_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_server_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_table_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_table_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_table_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_table_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_table_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_table_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_tablespace_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_tablespace_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_tablespace_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_tablespace_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_tablespace_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_tablespace_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_type_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_type_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_type_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_type_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_type_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "has_type_privilege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "hash_aclitem", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hash_aclitem_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "aclitem"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hash_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hash_array_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hash_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hash_multirange_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hash_numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hash_numeric_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hash_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hash_range_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hash_record", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hash_record_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashbpchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashbpcharextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashcharextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashenum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashenumextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashfloat4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashfloat4extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashfloat8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashfloat8extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashinet", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashinetextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashint2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashint2extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashint4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashint4extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashint8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashint8extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashmacaddr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashmacaddr8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashmacaddr8extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashmacaddrextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashname", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashnameextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashoid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashoidextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashoidvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashoidvectorextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashtext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashtextextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "hashtid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hashtidextended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "height", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "host", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "hostmask", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "in_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "index_am_handler_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "index_am_handler"}, - }, - { - Name: "index_am_handler_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "index_am_handler"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "inet_client_addr", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "inet_client_port", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "inet_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "inet_merge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cidr"}, - }, - { - Name: "inet_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "inet_same_family", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "inet_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "inet_server_addr", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "inet_server_port", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "inetand", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "inetmi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "inetmi_int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "inetnot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "inetor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "inetpl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "initcap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int24div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int24eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int24ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int24gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int24le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int24lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int24mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int24mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int24ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int24pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int28div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int28eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int28ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int28gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int28le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int28lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int28mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int28mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int28ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int28pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int2_avg_accum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint[]"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint[]"}, - }, - { - Name: "int2_avg_accum_inv", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint[]"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint[]"}, - }, - { - Name: "int2_mul_cash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "int2_sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int2abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int2ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int2gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int2in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2int4_sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int2larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int2lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int2mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int2not", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "int2pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "int2shl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2shr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2um", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2up", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int2vectorin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int2vector"}, - }, - { - Name: "int2vectorout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int2vector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "int2vectorsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int2vector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "int2xor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int42div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int42eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int42ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int42gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int42le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int42lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int42mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int42mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int42ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int42pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int48div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int48eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int48ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int48gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int48le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int48lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int48mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int48mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int48ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int48pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int4_avg_accum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint[]"}, - }, - { - Name: "int4_avg_accum_inv", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint[]"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint[]"}, - }, - { - Name: "int4_avg_combine", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint[]"}, - }, - { - Type: &ast.TypeName{Name: "bigint[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint[]"}, - }, - { - Name: "int4_mul_cash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "int4_sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int4abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int4ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int4gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int4in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4inc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int4lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int4mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4multirange", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int4multirange"}, - }, - { - Name: "int4multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int4range"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int4multirange"}, - }, - { - Name: "int4multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int4range[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "int4multirange"}, - }, - { - Name: "int4ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int4not", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "int4pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int4range"}, - }, - { - Name: "int4range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int4range"}, - }, - { - Name: "int4range_canonical", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int4range"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int4range"}, - }, - { - Name: "int4range_subdiff", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "int4send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "int4shl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4shr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4um", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4up", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int4xor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int82div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int82eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int82ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int82gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int82le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int82lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int82mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int82mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int82ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int82pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int84div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int84eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int84ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int84gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int84le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int84lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int84mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int84mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int84ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int84pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8_avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "int8_mul_cash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "int8_sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "int8abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8dec", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8dec_any", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int8ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int8gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int8in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8inc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8inc_any", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8inc_float8_float8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int8lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int8mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8multirange", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "int8multirange"}, - }, - { - Name: "int8multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int8range"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int8multirange"}, - }, - { - Name: "int8multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int8range[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "int8multirange"}, - }, - { - Name: "int8ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "int8not", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "int8pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8pl_inet", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "int8range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int8range"}, - }, - { - Name: "int8range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int8range"}, - }, - { - Name: "int8range_canonical", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int8range"}, - }, - }, - ReturnType: &ast.TypeName{Name: "int8range"}, - }, - { - Name: "int8range_subdiff", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "int8send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "int8shl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8shr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8um", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8up", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "int8xor", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "integer_pl_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "inter_lb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "inter_sb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "inter_sl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_accum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval[]"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval[]"}, - }, - { - Name: "interval_accum_inv", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval[]"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval[]"}, - }, - { - Name: "interval_avg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "interval_combine", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval[]"}, - }, - { - Type: &ast.TypeName{Name: "interval[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval[]"}, - }, - { - Name: "interval_div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "interval_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "interval_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "interval_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "interval_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "interval_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "interval_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "interval_mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "interval_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "interval_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_pl_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "interval_pl_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "interval_pl_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "interval_pl_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "interval_pl_timetz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "interval_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "interval_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "interval_um", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "intervaltypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "intervaltypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "is_normalized", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isclosed", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isempty", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isempty", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isfinite", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isfinite", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isfinite", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isfinite", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ishorizontal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ishorizontal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ishorizontal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isopen", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isparallel", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isparallel", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isperp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isperp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isvertical", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isvertical", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "isvertical", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "json_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_array_element", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - { - Name: "element_index", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_array_element_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - { - Name: "element_index", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "json_array_elements", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_array_elements_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "json_array_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "json_build_array", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_build_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_build_object", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_build_object", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_each", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "json_each_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "json_extract_path", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - { - Name: "path_elems", - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_extract_path_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - { - Name: "path_elems", - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "json_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_object", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_object", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_object_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_object_field", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - { - Name: "field_name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_object_field_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - { - Name: "field_name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "json_object_keys", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "json_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "json_populate_record", - Args: []*catalog.Argument{ - { - Name: "base", - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - { - Name: "use_json_as_text", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "json_populate_recordset", - Args: []*catalog.Argument{ - { - Name: "base", - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "from_json", - Type: &ast.TypeName{Name: "json"}, - }, - { - Name: "use_json_as_text", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "json_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "json_strip_nulls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "json_to_record", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "json_to_recordset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "json_to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "json_to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "json"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "json_typeof", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "jsonb_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_array_element", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "element_index", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_array_element_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "element_index", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "jsonb_array_elements", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_array_elements_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "jsonb_array_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "jsonb_build_array", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_build_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_build_object", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_build_object", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "jsonb_concat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_contains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_delete", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path_elems", - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_delete_path", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_each", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "jsonb_each_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "jsonb_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_exists", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_exists_all", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_exists_any", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_extract_path", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path_elems", - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_extract_path_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path_elems", - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "jsonb_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "jsonb_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "jsonb_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_insert", - Args: []*catalog.Argument{ - { - Name: "jsonb_in", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "replacement", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "insert_after", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_object", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_object", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_object_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_object_field", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "field_name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_object_field_text", - Args: []*catalog.Argument{ - { - Name: "from_json", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "field_name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "jsonb_object_keys", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "jsonb_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "jsonb_path_exists", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_path_exists_opr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonpath"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_path_exists_tz", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_path_match", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_path_match_opr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonpath"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_path_match_tz", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "jsonb_path_query", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_path_query_array", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_path_query_array_tz", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_path_query_first", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_path_query_first_tz", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_path_query_tz", - Args: []*catalog.Argument{ - { - Name: "target", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "vars", - HasDefault: true, - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "silent", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_populate_record", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "jsonb_populate_recordset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "jsonb_pretty", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "jsonb_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "jsonb_set", - Args: []*catalog.Argument{ - { - Name: "jsonb_in", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "replacement", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "create_if_missing", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_set_lax", - Args: []*catalog.Argument{ - { - Name: "jsonb_in", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "path", - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "replacement", - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "create_if_missing", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "null_value_treatment", - HasDefault: true, - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_strip_nulls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "jsonb_to_record", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "jsonb_to_recordset", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "jsonb_to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "jsonb_to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "jsonb_typeof", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "jsonpath_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonpath"}, - }, - { - Name: "jsonpath_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonpath"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "jsonpath_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonpath"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "justify_days", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "justify_hours", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "justify_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "lag", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatible"}, - }, - { - Name: "lag", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "lag", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "language_handler_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "language_handler"}, - }, - { - Name: "language_handler_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "language_handler"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "last_value", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "lastval", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "lcm", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "lcm", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lcm", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "lead", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anycompatible"}, - }, - { - Name: "lead", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "lead", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "like", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "like", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "like", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "like_escape", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "like_escape", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "line", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "line"}, - }, - { - Name: "line_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "line_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "line_horizontal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "line_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "line"}, - }, - { - Name: "line_interpt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "line_intersect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "line_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "line_parallel", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "line_perp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "line_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "line_vertical", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ln", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "ln", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "lo_close", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lo_creat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "lo_create", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "lo_export", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lo_from_bytea", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "lo_get", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "lo_get", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "lo_import", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "lo_import", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "lo_lseek", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lo_lseek64", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "lo_open", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lo_put", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "lo_tell", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lo_tell64", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "lo_truncate", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lo_truncate64", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lo_unlink", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "log", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "log", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "log", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "log10", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "log10", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "loread", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "lower", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "lower", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "lower", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "lower_inc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lower_inc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lower_inf", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lower_inf", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lowrite", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "lpad", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "lpad", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "lseg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "lseg"}, - }, - { - Name: "lseg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "lseg"}, - }, - { - Name: "lseg_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "lseg_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "lseg_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_horizontal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "lseg"}, - }, - { - Name: "lseg_interpt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "lseg_intersect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "lseg_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "lseg_parallel", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_perp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "lseg_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "lseg_vertical", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ltrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "ltrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ltrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "macaddr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr"}, - }, - { - Name: "macaddr8", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr8"}, - }, - { - Name: "macaddr8_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr8"}, - }, - { - Name: "macaddr8_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "macaddr8_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr8_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr8_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr8_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr8"}, - }, - { - Name: "macaddr8_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr8_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr8_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr8_not", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr8"}, - }, - { - Name: "macaddr8_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr8"}, - }, - { - Name: "macaddr8_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "macaddr8_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "macaddr8_set7bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr8"}, - }, - { - Name: "macaddr_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr"}, - }, - { - Name: "macaddr_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "macaddr_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr"}, - }, - { - Name: "macaddr_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "macaddr_not", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr"}, - }, - { - Name: "macaddr_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr"}, - }, - { - Name: "macaddr_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "macaddr_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "make_date", - Args: []*catalog.Argument{ - { - Name: "year", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "month", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "day", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "make_interval", - Args: []*catalog.Argument{ - { - Name: "years", - HasDefault: true, - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "months", - HasDefault: true, - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "weeks", - HasDefault: true, - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "days", - HasDefault: true, - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hours", - HasDefault: true, - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "mins", - HasDefault: true, - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "secs", - HasDefault: true, - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "make_time", - Args: []*catalog.Argument{ - { - Name: "hour", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "min", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "sec", - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "make_timestamp", - Args: []*catalog.Argument{ - { - Name: "year", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "month", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "mday", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hour", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "min", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "sec", - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "make_timestamptz", - Args: []*catalog.Argument{ - { - Name: "year", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "month", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "mday", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hour", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "min", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "sec", - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "make_timestamptz", - Args: []*catalog.Argument{ - { - Name: "year", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "month", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "mday", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "hour", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "min", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "sec", - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "timezone", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "makeaclitem", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "aclitem"}, - }, - { - Name: "masklen", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "max", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "md5", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "md5", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyenum"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyenum"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "min", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "min_scale", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "smallint"}, - }, - { - Name: "mode", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "money", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "money", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "money", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "mul_d_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "multirange_adjacent_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_adjacent_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_after_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_after_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_before_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_before_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "multirange_contained_by_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_contained_by_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_contains_elem", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_contains_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_contains_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "multirange_intersect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "multirange_intersect_agg_transfn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "multirange_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_minus", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "multirange_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "multirange_overlaps_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_overlaps_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_overleft_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_overleft_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_overright_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_overright_range", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "multirange_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "multirange_union", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "mxid_age", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "name", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "name", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "name", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "nameconcatoid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "nameeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameeqtext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namege", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namegetext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namegt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namegttext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameiclike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameicnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameicregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameicregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "namele", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameletext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namelike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namelt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namelttext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namene", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namenetext", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namenlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "nameregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nameregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "namesend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "netmask", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "network", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cidr"}, - }, - { - Name: "network_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "network_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "network_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "network_sub", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_subeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_sup", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "network_supeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "nextval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "normalize", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "notlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "notlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "notlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "now", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "npoints", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "npoints", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "nth_value", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "ntile", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "num_nonnulls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "num_nulls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_abs", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_add", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "numeric_div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_div_trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "numeric_exp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "numeric_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "numeric_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_inc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "numeric_ln", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_log", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "numeric_mod", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "numeric_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "numeric_pl_pg_lsn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "numeric_power", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "numeric_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_sqrt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_sub", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_uminus", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numeric_uplus", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "numerictypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "numerictypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "nummultirange", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "nummultirange"}, - }, - { - Name: "nummultirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "nummultirange"}, - }, - { - Name: "nummultirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numrange[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "nummultirange"}, - }, - { - Name: "numnode", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "numrange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numrange"}, - }, - { - Name: "numrange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numrange"}, - }, - { - Name: "numrange_subdiff", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "obj_description", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "obj_description", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "octet_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "octet_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "octet_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "octet_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "oideq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidgt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "oidlarger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "oidle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "oidsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "oidsmaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "oidvectoreq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorgt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oidvector"}, - }, - { - Name: "oidvectorle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "oidvectorout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "oidvectorsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "oidvectortypes", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oidvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "on_pb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_ppath", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_ps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_sb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "on_sl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - { - Type: &ast.TypeName{Name: "line"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "overlay", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "overlay", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "overlay", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "overlay", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "overlay", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "overlay", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "parse_ident", - Args: []*catalog.Argument{ - { - Name: "str", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "strict", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "path", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_add", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_add_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_contain_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "path_div_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_inter", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "path_mul_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "path_n_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_n_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_n_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_n_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_n_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "path_npoints", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "path_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "path_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "path_sub_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "pclose", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "percent_rank", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "percent_rank", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "percentile_cont", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "percentile_cont", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision[]"}, - }, - { - Name: "percentile_cont", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "percentile_cont", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval[]"}, - }, - { - Name: "percentile_disc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "percentile_disc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "pg_advisory_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_unlock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_advisory_unlock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_advisory_unlock_all", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_unlock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_advisory_unlock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_advisory_xact_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_xact_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_xact_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_advisory_xact_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_available_extension_versions", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_available_extensions", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_backend_pid", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_backup_start", - Args: []*catalog.Argument{ - { - Name: "label", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "fast", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_backup_stop", - Args: []*catalog.Argument{ - { - Name: "wait_for_archive", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_blocking_pids", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "pg_cancel_backend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_char_to_encoding", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_client_encoding", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "pg_collation_actual_version", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_collation_for", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_collation_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_column_compression", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_column_is_updatable", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "smallint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_column_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_conf_load_time", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_config", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_control_checkpoint", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_control_init", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_control_recovery", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_control_system", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_conversion_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_copy_logical_replication_slot", - Args: []*catalog.Argument{ - { - Name: "src_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "dst_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_copy_logical_replication_slot", - Args: []*catalog.Argument{ - { - Name: "src_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "dst_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "temporary", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_copy_logical_replication_slot", - Args: []*catalog.Argument{ - { - Name: "src_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "dst_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "temporary", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "plugin", - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_copy_physical_replication_slot", - Args: []*catalog.Argument{ - { - Name: "src_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "dst_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_copy_physical_replication_slot", - Args: []*catalog.Argument{ - { - Name: "src_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "dst_slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "temporary", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_create_logical_replication_slot", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "plugin", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "temporary", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "twophase", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_create_physical_replication_slot", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "immediately_reserve", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "temporary", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_create_restore_point", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_current_logfile", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_current_logfile", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_current_snapshot", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "pg_snapshot"}, - }, - { - Name: "pg_current_wal_flush_lsn", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_current_wal_insert_lsn", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_current_wal_lsn", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_current_xact_id", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "pg_current_xact_id_if_assigned", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "pg_cursor", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_database_collation_actual_version", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_database_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_database_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_ddl_command_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_ddl_command"}, - }, - { - Name: "pg_ddl_command_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_ddl_command"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_ddl_command_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_ddl_command"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_dependencies_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_dependencies"}, - }, - { - Name: "pg_dependencies_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_dependencies"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_dependencies_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_dependencies"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_describe_object", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_drop_replication_slot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_encoding_max_length", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_encoding_to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "pg_event_trigger_ddl_commands", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_event_trigger_dropped_objects", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_event_trigger_table_rewrite_oid", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_event_trigger_table_rewrite_reason", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_export_snapshot", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_extension_config_dump", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_extension_update_paths", - Args: []*catalog.Argument{ - { - Name: "name", - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_filenode_relation", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "pg_function_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_get_backend_memory_contexts", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_get_catalog_foreign_keys", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_get_constraintdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_constraintdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_expr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_node_tree"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_expr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_node_tree"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_function_arg_default", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_function_arguments", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_function_identity_arguments", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_function_result", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_function_sqlbody", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_functiondef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_indexdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_indexdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_keywords", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_get_multixact_members", - Args: []*catalog.Argument{ - { - Name: "multixid", - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_get_object_address", - Args: []*catalog.Argument{ - { - Name: "type", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "object_names", - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "object_args", - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_get_partition_constraintdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_partkeydef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_publication_tables", - Args: []*catalog.Argument{ - { - Name: "pubname", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_get_replica_identity_index", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "pg_get_replication_slots", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_get_ruledef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_ruledef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_serial_sequence", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_shmem_allocations", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_get_statisticsobjdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_statisticsobjdef_columns", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_statisticsobjdef_expressions", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "pg_get_triggerdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_triggerdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_userbyid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_viewdef", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_wal_replay_pause_state", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_get_wal_resource_managers", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_has_role", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_hba_file_rules", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ident_file_mappings", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_identify_object", - Args: []*catalog.Argument{ - { - Name: "classid", - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "objid", - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "objsubid", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_identify_object_as_address", - Args: []*catalog.Argument{ - { - Name: "classid", - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "objid", - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "objsubid", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_import_system_collations", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regnamespace"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_index_column_has_property", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_index_has_property", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_indexam_has_property", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_indexam_progress_phasename", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_indexes_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_is_in_recovery", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_is_other_temp_schema", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_is_wal_replay_paused", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_isolation_test_session_is_blocked", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_jit_available", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_last_committed_xact", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_last_wal_receive_lsn", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_last_wal_replay_lsn", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_last_xact_replay_timestamp", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_listening_channels", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_lock_status", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_log_backend_memory_contexts", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_logical_emit_message", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_logical_emit_message", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_logical_slot_get_binary_changes", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "upto_lsn", - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "upto_nchanges", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "options", - HasDefault: true, - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_logical_slot_get_changes", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "upto_lsn", - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "upto_nchanges", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "options", - HasDefault: true, - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_logical_slot_peek_binary_changes", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "upto_lsn", - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "upto_nchanges", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "options", - HasDefault: true, - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_logical_slot_peek_changes", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "upto_lsn", - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "upto_nchanges", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "options", - HasDefault: true, - Type: &ast.TypeName{Name: "text[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ls_archive_statusdir", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ls_dir", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_ls_dir", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_ls_logdir", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ls_logicalmapdir", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ls_logicalsnapdir", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ls_replslotdir", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ls_tmpdir", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ls_tmpdir", - Args: []*catalog.Argument{ - { - Name: "tablespace", - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_ls_waldir", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_lsn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_lsn_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_lsn_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_lsn_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_lsn_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_lsn_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_lsn_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "pg_lsn_mii", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_lsn_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_lsn_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_lsn_pli", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_lsn_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_lsn_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_mcv_list_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_mcv_list"}, - }, - { - Name: "pg_mcv_list_items", - Args: []*catalog.Argument{ - { - Name: "mcv_list", - Type: &ast.TypeName{Name: "pg_mcv_list"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_mcv_list_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_mcv_list"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_mcv_list_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_mcv_list"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_my_temp_schema", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_ndistinct_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_ndistinct"}, - }, - { - Name: "pg_ndistinct_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_ndistinct"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_ndistinct_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_ndistinct"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_nextoid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_node_tree_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "pg_node_tree_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_node_tree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_node_tree_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_node_tree"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_notification_queue_usage", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_notify", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_opclass_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_operator_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_opfamily_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_options_to_table", - Args: []*catalog.Argument{ - { - Name: "options_array", - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_partition_ancestors", - Args: []*catalog.Argument{ - { - Name: "partitionid", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "pg_partition_root", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "pg_partition_tree", - Args: []*catalog.Argument{ - { - Name: "rootrelid", - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_postmaster_start_time", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_prepared_statement", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_prepared_xact", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_promote", - Args: []*catalog.Argument{ - { - Name: "wait", - HasDefault: true, - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "wait_seconds", - HasDefault: true, - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_read_binary_file", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_read_binary_file", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_read_binary_file", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_read_file", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_read_file", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_read_file", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_read_file_old", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_relation_filenode", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_relation_filepath", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_relation_is_publishable", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_relation_is_updatable", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_relation_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_relation_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_reload_conf", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_replication_origin_advance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_replication_origin_create", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_replication_origin_drop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_replication_origin_oid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_replication_origin_progress", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_replication_origin_session_is_setup", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_replication_origin_session_progress", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_replication_origin_session_reset", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_replication_origin_session_setup", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_replication_origin_xact_reset", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_replication_origin_xact_setup", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_replication_slot_advance", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "upto_lsn", - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_rotate_logfile", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_rotate_logfile_old", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_safe_snapshot_blocking_pids", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer[]"}, - }, - { - Name: "pg_sequence_last_value", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_sequence_parameters", - Args: []*catalog.Argument{ - { - Name: "sequence_oid", - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_settings_get_flags", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "pg_show_all_file_settings", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_show_all_settings", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_show_replication_origin_status", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_size_bytes", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_size_pretty", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_size_pretty", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_sleep", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_sleep_for", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_sleep_until", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_snapshot_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "pg_snapshot"}, - }, - { - Name: "pg_snapshot_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "pg_snapshot_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "pg_snapshot_xip", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "pg_snapshot_xmax", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "pg_snapshot_xmin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "pg_stat_clear_snapshot", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_file", - Args: []*catalog.Argument{ - { - Name: "filename", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_file", - Args: []*catalog.Argument{ - { - Name: "filename", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "missing_ok", - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_force_next_flush", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_get_activity", - Args: []*catalog.Argument{ - { - Name: "pid", - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_analyze_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_archiver", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_autoanalyze_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_autovacuum_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_backend_activity", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_stat_get_backend_activity_start", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_backend_client_addr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "pg_stat_get_backend_client_port", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_stat_get_backend_dbid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_stat_get_backend_idset", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_stat_get_backend_pid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_stat_get_backend_start", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_backend_userid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_stat_get_backend_wait_event", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_stat_get_backend_wait_event_type", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_stat_get_backend_xact_start", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_bgwriter_buf_written_checkpoints", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_bgwriter_buf_written_clean", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_bgwriter_maxwritten_clean", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_bgwriter_requested_checkpoints", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_bgwriter_stat_reset_time", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_bgwriter_timed_checkpoints", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_blocks_fetched", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_blocks_hit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_buf_alloc", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_buf_fsync_backend", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_buf_written_backend", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_checkpoint_sync_time", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_checkpoint_write_time", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_db_active_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_db_blk_read_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_db_blk_write_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_db_blocks_fetched", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_blocks_hit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_checksum_failures", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_checksum_last_failure", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_db_conflict_all", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_bufferpin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_snapshot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_startup_deadlock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_conflict_tablespace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_deadlocks", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_idle_in_transaction_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_db_numbackends", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_stat_get_db_session_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_db_sessions", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_sessions_abandoned", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_sessions_fatal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_sessions_killed", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_stat_reset_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_db_temp_bytes", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_temp_files", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_deleted", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_fetched", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_inserted", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_returned", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_tuples_updated", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_xact_commit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_db_xact_rollback", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_dead_tuples", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_function_calls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_function_self_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_function_total_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_ins_since_vacuum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_last_analyze_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_last_autoanalyze_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_last_autovacuum_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_last_vacuum_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_live_tuples", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_mod_since_analyze", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_numscans", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_progress_info", - Args: []*catalog.Argument{ - { - Name: "cmdtype", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_recovery_prefetch", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_replication_slot", - Args: []*catalog.Argument{ - { - Name: "slot_name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_slru", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_snapshot_timestamp", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_stat_get_subscription", - Args: []*catalog.Argument{ - { - Name: "subid", - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_subscription_stats", - Args: []*catalog.Argument{ - { - Name: "subid", - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_tuples_deleted", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_fetched", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_hot_updated", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_inserted", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_returned", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_tuples_updated", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_vacuum_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_wal", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_wal_receiver", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_wal_senders", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_stat_get_xact_blocks_fetched", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_blocks_hit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_function_calls", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_function_self_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_xact_function_total_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pg_stat_get_xact_numscans", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_deleted", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_fetched", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_hot_updated", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_inserted", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_returned", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_get_xact_tuples_updated", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_stat_have_stats", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_stat_reset", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_replication_slot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_single_function_counters", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_single_table_counters", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_slru", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_stat_reset_subscription_stats", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_statistics_obj_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_stop_making_pinned_objects", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_switch_wal", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Name: "pg_table_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_table_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_tablespace_databases", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "oid"}, - }, - { - Name: "pg_tablespace_location", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_tablespace_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_tablespace_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_terminate_backend", - Args: []*catalog.Argument{ - { - Name: "pid", - Type: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timeout", - HasDefault: true, - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_timezone_abbrevs", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_timezone_names", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_total_relation_size", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "pg_trigger_depth", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "pg_try_advisory_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_xact_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_xact_lock", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_xact_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_try_advisory_xact_lock_shared", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_ts_config_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_ts_dict_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_ts_parser_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_ts_template_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_type_is_visible", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_typeof", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regtype"}, - }, - { - Name: "pg_visible_in_snapshot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "pg_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pg_wal_lsn_diff", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "pg_wal_replay_pause", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_wal_replay_resume", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "pg_walfile_name", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "pg_walfile_name_offset", - Args: []*catalog.Argument{ - { - Name: "lsn", - Type: &ast.TypeName{Name: "pg_lsn"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_xact_commit_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "pg_xact_commit_timestamp_origin", - Args: []*catalog.Argument{ - { - Name: "xid", - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "pg_xact_status", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "phraseto_tsquery", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "phraseto_tsquery", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "pi", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "plainto_tsquery", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "plainto_tsquery", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "plpgsql_call_handler", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "language_handler"}, - }, - { - Name: "plpgsql_validator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "lseg"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_above", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_add", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_below", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "point_div", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_horiz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_mul", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "point_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "point_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "point_sub", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "point_vert", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_above", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_below", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_center", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "point"}, - }, - { - Name: "poly_contain", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_contain_pt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_contained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_distance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "poly_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "polygon"}, - }, - { - Name: "poly_left", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_npoints", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "poly_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "poly_overabove", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_overbelow", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_overlap", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_overleft", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_overright", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_same", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "poly_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "polygon", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "polygon"}, - }, - { - Name: "polygon", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "polygon"}, - }, - { - Name: "polygon", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "polygon"}, - }, - { - Name: "polygon", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "polygon"}, - }, - { - Name: "popen", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "path"}, - }, - }, - ReturnType: &ast.TypeName{Name: "path"}, - }, - { - Name: "position", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "bit"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "position", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "position", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "postgresql_fdw_validator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text[]"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pow", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "pow", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "power", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "power", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "pt_contained_circle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "pt_contained_poly", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "query_to_xml", - Args: []*catalog.Argument{ - { - Name: "query", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "query_to_xml_and_xmlschema", - Args: []*catalog.Argument{ - { - Name: "query", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "query_to_xmlschema", - Args: []*catalog.Argument{ - { - Name: "query", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "querytree", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_ident", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_literal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_literal", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_nullable", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "quote_nullable", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "radians", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "radius", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "circle"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "random", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "range_adjacent", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_adjacent_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_after", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_after_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "range_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "range_before", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_before_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "range_contained_by", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_contained_by_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_contains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_contains_elem", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_contains_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_intersect", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_intersect_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anymultirange"}, - }, - { - Name: "range_intersect_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_intersect_agg_transfn", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_merge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_merge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_minus", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "range_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "range_overlaps", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_overlaps_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_overleft", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_overleft_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_overright", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_overright_multirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "range_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "range_union", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "rank", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "rank", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "record_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_image_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "record_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "record_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "record_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regclass", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "regclassin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "regclassout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regclasssend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regcollationin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regcollation"}, - }, - { - Name: "regcollationout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regcollation"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regcollationsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regcollation"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regconfigin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regconfig"}, - }, - { - Name: "regconfigout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regconfigsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regdictionaryin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regdictionary"}, - }, - { - Name: "regdictionaryout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regdictionary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regdictionarysend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regdictionary"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regexp_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_instr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_instr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_instr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_instr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_instr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_instr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "regexp_like", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "regexp_like", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "regexp_match", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_match", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_matches", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_matches", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_split_to_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_split_to_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "regexp_split_to_table", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_split_to_table", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regexp_substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "regnamespacein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regnamespace"}, - }, - { - Name: "regnamespaceout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regnamespace"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regnamespacesend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regnamespace"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regoperatorin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regoperator"}, - }, - { - Name: "regoperatorout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regoperator"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regoperatorsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regoperator"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regoperin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regoper"}, - }, - { - Name: "regoperout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regoper"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regopersend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regoper"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regprocedurein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regprocedure"}, - }, - { - Name: "regprocedureout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regprocedure"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regproceduresend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regprocedure"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regprocin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regproc"}, - }, - { - Name: "regprocout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regproc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regprocsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regproc"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regr_avgx", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_avgy", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_count", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "regr_intercept", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_r2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_slope", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_sxx", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_sxy", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regr_syy", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "regrolein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regrole"}, - }, - { - Name: "regroleout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regrole"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regrolesend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regrole"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "regtypein", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regtype"}, - }, - { - Name: "regtypeout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regtype"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "regtypesend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regtype"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "repeat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "replace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "reverse", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "right", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "round", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "round", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "round", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "row_number", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "row_security_active", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "row_security_active", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "row_to_json", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "row_to_json", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "record"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "rpad", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "rpad", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "rtrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "rtrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "rtrim", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "satisfies_hash_partition", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "scale", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "schema_to_xml", - Args: []*catalog.Argument{ - { - Name: "schema", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "schema_to_xml_and_xmlschema", - Args: []*catalog.Argument{ - { - Name: "schema", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "schema_to_xmlschema", - Args: []*catalog.Argument{ - { - Name: "schema", - Type: &ast.TypeName{Name: "name"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "session_user", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "name"}, - }, - { - Name: "set_bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "set_bit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "set_byte", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "set_config", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "set_masklen", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cidr"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cidr"}, - }, - { - Name: "set_masklen", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "inet"}, - }, - { - Name: "setseed", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "setval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "setval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "setweight", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "setweight", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "char"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "sha224", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "sha256", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "sha384", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "sha512", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "shell_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "shell_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "void"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "shobj_description", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "sign", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sign", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "similar_escape", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "similar_to_escape", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "similar_to_escape", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "sin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sind", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sinh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "slope", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "point"}, - }, - { - Type: &ast.TypeName{Name: "point"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "spg_poly_quad_compress", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "polygon"}, - }, - }, - ReturnType: &ast.TypeName{Name: "box"}, - }, - { - Name: "split_part", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "sqrt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sqrt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "starts_with", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "statement_timestamp", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "stddev_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "string_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "bytea"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "string_agg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "string_to_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "string_to_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "string_to_table", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "string_to_table", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "strip", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "strpos", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bytea"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "substring", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "money"}, - }, - }, - ReturnType: &ast.TypeName{Name: "money"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "sum", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "suppress_redundant_updates_trigger", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "table_am_handler_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "table_am_handler"}, - }, - { - Name: "table_am_handler_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "table_am_handler"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "table_to_xml", - Args: []*catalog.Argument{ - { - Name: "tbl", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "table_to_xml_and_xmlschema", - Args: []*catalog.Argument{ - { - Name: "tbl", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "table_to_xmlschema", - Args: []*catalog.Argument{ - { - Name: "tbl", - Type: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "nulls", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tableforest", - Type: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "targetns", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "tan", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "tand", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "tanh", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "char"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "inet"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xml"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "text_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_pattern_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_pattern_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_pattern_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_pattern_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "text_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "textanycat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "anynonarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "textcat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "texteq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texteqname", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textgename", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textgtname", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "texticregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "textlen", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "textlename", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textltname", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textnename", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textnlike", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "textregexeq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textregexne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "textsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "tideq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidgt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "tidlarger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "tidle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tidout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "tidsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "tidsmaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tid"}, - }, - { - Type: &ast.TypeName{Name: "tid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tid"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "time_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "time_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "time_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_mi_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_mi_time", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "time_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "time_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "time_pl_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "time_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "time_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time without time zone"}, - }, - { - Name: "timedate_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timeofday", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamp_cmp_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamp_cmp_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamp_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_eq_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_eq_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ge_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ge_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_gt_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_gt_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamp_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "timestamp_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_le_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_le_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_lt_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_lt_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "timestamp_mi_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ne_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_ne_timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamp_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timestamp_pl_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamp_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "timestamp_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timestamptypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "date"}, - }, - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptz_cmp_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptz_cmp_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptz_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_eq_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_eq_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ge_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ge_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_gt_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_gt_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_le_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_le_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_lt_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_lt_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_mi", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "interval"}, - }, - { - Name: "timestamptz_mi_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ne_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_ne_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timestamptz_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timestamptz_pl_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptz_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "timestamptz_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timestamptztypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timestamptztypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timetypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timetypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timetz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timetz_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timetz_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "timetz_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_mi_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "timetz_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timetz_pl_interval", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "interval"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetz_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "timetz_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timetzdate_pl", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - { - Type: &ast.TypeName{Name: "date"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timetztypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "timetztypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "time with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "time with time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "timezone", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Name: "to_ascii", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_ascii", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_ascii", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "interval"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_char", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_date", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "date"}, - }, - { - Name: "to_hex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_hex", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "to_json", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "to_jsonb", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyelement"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "to_number", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "to_regclass", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regclass"}, - }, - { - Name: "to_regcollation", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regcollation"}, - }, - { - Name: "to_regnamespace", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regnamespace"}, - }, - { - Name: "to_regoper", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regoper"}, - }, - { - Name: "to_regoperator", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regoperator"}, - }, - { - Name: "to_regproc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regproc"}, - }, - { - Name: "to_regprocedure", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regprocedure"}, - }, - { - Name: "to_regrole", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regrole"}, - }, - { - Name: "to_regtype", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "regtype"}, - }, - { - Name: "to_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "to_timestamp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "to_tsquery", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "to_tsquery", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "json"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "to_tsvector", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "transaction_timestamp", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Name: "translate", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "trigger_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "trigger_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "trigger"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "trim_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyarray"}, - }, - { - Name: "trim_scale", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "macaddr8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "macaddr8"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "trunc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "ts_debug", - Args: []*catalog.Argument{ - { - Name: "config", - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Name: "document", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "ts_debug", - Args: []*catalog.Argument{ - { - Name: "document", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "ts_delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "ts_delete", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "ts_filter", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "char[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "json"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "json"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "json"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "json"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "jsonb"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "jsonb"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ts_headline", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ts_lexize", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regdictionary"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "ts_match_qv", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ts_match_tq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ts_match_tt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ts_match_vq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "ts_parse", - Args: []*catalog.Argument{ - { - Name: "parser_oid", - Type: &ast.TypeName{Name: "oid"}, - }, - { - Name: "txt", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "ts_parse", - Args: []*catalog.Argument{ - { - Name: "parser_name", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "txt", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "ts_rank", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real[]"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real[]"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank_cd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real[]"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank_cd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real[]"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank_cd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rank_cd", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ts_rewrite", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "ts_rewrite", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "ts_stat", - Args: []*catalog.Argument{ - { - Name: "query", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "ts_stat", - Args: []*catalog.Argument{ - { - Name: "query", - Type: &ast.TypeName{Name: "text"}, - }, - { - Name: "weights", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "ts_token_type", - Args: []*catalog.Argument{ - { - Name: "parser_oid", - Type: &ast.TypeName{Name: "oid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "ts_token_type", - Args: []*catalog.Argument{ - { - Name: "parser_name", - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "tsm_handler_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsm_handler"}, - }, - { - Name: "tsm_handler_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsm_handler"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "tsmultirange", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "tsmultirange"}, - }, - { - Name: "tsmultirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsmultirange"}, - }, - { - Name: "tsmultirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsrange[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "tsmultirange"}, - }, - { - Name: "tsq_mcontained", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsq_mcontains", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_and", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsquery_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "tsquery_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsquery_not", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsquery_or", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsquery_phrase", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsquery_phrase", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsqueryin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "tsqueryout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "tsquerysend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsquery"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "tsrange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsrange"}, - }, - { - Name: "tsrange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsrange"}, - }, - { - Name: "tsrange_subdiff", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp without time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "tstzmultirange", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "tstzmultirange"}, - }, - { - Name: "tstzmultirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tstzrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tstzmultirange"}, - }, - { - Name: "tstzmultirange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tstzrange[]"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "tstzmultirange"}, - }, - { - Name: "tstzrange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tstzrange"}, - }, - { - Name: "tstzrange", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tstzrange"}, - }, - { - Name: "tstzrange_subdiff", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - { - Type: &ast.TypeName{Name: "timestamp with time zone"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "tsvector_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "tsvector_concat", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "tsvector_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "tsvector_to_array", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text[]"}, - }, - { - Name: "tsvector_update_trigger", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "tsvector_update_trigger_column", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "tsvectorin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsvector"}, - }, - { - Name: "tsvectorout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "tsvectorsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "txid_current", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "txid_current_if_assigned", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "txid_current_snapshot", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "txid_snapshot"}, - }, - { - Name: "txid_snapshot_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "txid_snapshot"}, - }, - { - Name: "txid_snapshot_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "txid_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "txid_snapshot_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "txid_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "txid_snapshot_xip", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "txid_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "txid_snapshot_xmax", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "txid_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "txid_snapshot_xmin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "txid_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "txid_status", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "txid_visible_in_snapshot", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - { - Type: &ast.TypeName{Name: "txid_snapshot"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "unique_key_recheck", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "trigger"}, - }, - { - Name: "unistr", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "unknownin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "unknown"}, - }, - { - Name: "unknownout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "unknown"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "unknownsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "unknown"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "unnest", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyarray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "unnest", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyrange"}, - }, - { - Name: "unnest", - Args: []*catalog.Argument{ - { - Name: "tsvector", - Type: &ast.TypeName{Name: "tsvector"}, - }, - }, - ReturnType: &ast.TypeName{Name: "record"}, - }, - { - Name: "upper", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "upper", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "anyelement"}, - }, - { - Name: "upper", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "upper_inc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "upper_inc", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "upper_inf", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anymultirange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "upper_inf", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anyrange"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "uuid_eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_hash", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "uuid_hash_extended", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bigint"}, - }, - { - Name: "uuid_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "uuid"}, - }, - { - Name: "uuid_le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "uuid_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "uuid_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "uuid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_pop", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "var_samp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "varbit", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit varying"}, - }, - { - Name: "varbit_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bit varying"}, - }, - { - Name: "varbit_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "varbit_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "varbitcmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "varbiteq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitgt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitle", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitlt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbitne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - { - Type: &ast.TypeName{Name: "bit varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "varbittypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "varbittypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "varchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character varying"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "boolean"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character varying"}, - }, - { - Name: "varchar", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "name"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character varying"}, - }, - { - Name: "varcharin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - { - Type: &ast.TypeName{Name: "oid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "character varying"}, - }, - { - Name: "varcharout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "varcharsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "character varying"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "varchartypmodin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "varchartypmodout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "bigint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "variance", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "smallint"}, - }, - }, - ReturnType: &ast.TypeName{Name: "numeric"}, - }, - { - Name: "version", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "void_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "void"}, - }, - { - Name: "void_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "void"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "void_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "void"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "websearch_to_tsquery", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "regconfig"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "websearch_to_tsquery", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "tsquery"}, - }, - { - Name: "width", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "box"}, - }, - }, - ReturnType: &ast.TypeName{Name: "double precision"}, - }, - { - Name: "width_bucket", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "anycompatible"}, - }, - { - Type: &ast.TypeName{Name: "anycompatiblearray"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "width_bucket", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "double precision"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "width_bucket", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "numeric"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "xid", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid"}, - }, - { - Name: "xid8_larger", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "xid8_smaller", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "xid8cmp", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "xid8eq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xid8ge", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xid8gt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xid8in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid8"}, - }, - { - Name: "xid8le", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xid8lt", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xid8ne", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xid8out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "xid8send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid8"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "xideq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - { - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xideqint4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xidin", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xid"}, - }, - { - Name: "xidneq", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - { - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xidneqint4", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xidout", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "xidsend", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xid"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "xml", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xml_in", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "cstring"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xml_is_well_formed", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xml_is_well_formed_content", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xml_is_well_formed_document", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xml_out", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xml"}, - }, - }, - ReturnType: &ast.TypeName{Name: "cstring"}, - }, - { - Name: "xml_send", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xml"}, - }, - }, - ReturnType: &ast.TypeName{Name: "bytea"}, - }, - { - Name: "xmlagg", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xml"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xmlcomment", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xmlconcat2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xml"}, - }, - { - Type: &ast.TypeName{Name: "xml"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml"}, - }, - { - Name: "xmlexists", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "xml"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xmlvalidate", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "xml"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xpath", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "xml"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml[]"}, - }, - { - Name: "xpath", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "xml"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "xml[]"}, - }, - { - Name: "xpath_exists", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "xml"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, - { - Name: "xpath_exists", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "xml"}, - }, - { - Type: &ast.TypeName{Name: "text[]"}, - }, - }, - ReturnType: &ast.TypeName{Name: "boolean"}, - }, -} - -func genPGCatalog() *catalog.Schema { - s := &catalog.Schema{Name: "pg_catalog"} - s.Funcs = funcsgenPGCatalog - s.Tables = []*catalog.Table{ - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_aggregate", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "aggfnoid", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggkind", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "aggnumdirectargs", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "aggtransfn", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggfinalfn", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggcombinefn", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggserialfn", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggdeserialfn", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggmtransfn", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggminvtransfn", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggmfinalfn", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggfinalextra", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "aggmfinalextra", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "aggfinalmodify", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "aggmfinalmodify", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "aggsortop", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggtranstype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggtransspace", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggmtranstype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "aggmtransspace", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "agginitval", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "aggminitval", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_am", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "amhandler", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amtype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_amop", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amopfamily", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amoplefttype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amoprighttype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amopstrategy", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "amoppurpose", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "amopopr", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amopmethod", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amopsortfamily", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_amproc", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amprocfamily", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amproclefttype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amprocrighttype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "amprocnum", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "amproc", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_attrdef", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "adrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "adnum", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "adbin", - Type: ast.TypeName{Name: "pg_node_tree"}, - IsNotNull: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_attribute", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "attrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "attname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "atttypid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "attstattarget", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "attlen", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "attnum", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "attndims", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "attcacheoff", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "atttypmod", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "attbyval", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attalign", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attstorage", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attcompression", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attnotnull", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "atthasdef", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "atthasmissing", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attidentity", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attgenerated", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attisdropped", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attislocal", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "attinhcount", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "attcollation", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "attacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - { - Name: "attoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "attfdwoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "attmissingval", - Type: ast.TypeName{Name: "anyarray"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_auth_members", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "roleid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "member", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "grantor", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "admin_option", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_authid", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rolname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "rolsuper", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "rolinherit", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "rolcreaterole", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "rolcreatedb", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "rolcanlogin", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "rolreplication", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "rolbypassrls", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "rolconnlimit", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rolpassword", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "rolvaliduntil", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_available_extension_versions", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "version", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "installed", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "superuser", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "trusted", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "relocatable", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "schema", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "requires", - Type: ast.TypeName{Name: "_name"}, - IsArray: true, - }, - { - Name: "comment", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_available_extensions", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "default_version", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "installed_version", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "comment", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_backend_memory_contexts", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "ident", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "parent", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "level", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "total_bytes", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "total_nblocks", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "free_bytes", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "free_chunks", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "used_bytes", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_cast", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "castsource", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "casttarget", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "castfunc", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "castcontext", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "castmethod", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_class", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "relnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "reltype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "reloftype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relam", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relfilenode", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "reltablespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relpages", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "reltuples", - Type: ast.TypeName{Name: "float4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relallvisible", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "reltoastrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relhasindex", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relisshared", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relpersistence", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relkind", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relnatts", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "relchecks", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "relhasrules", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relhastriggers", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relhassubclass", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relrowsecurity", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relforcerowsecurity", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relispopulated", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relreplident", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relispartition", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "relrewrite", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relfrozenxid", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relminmxid", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "relacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - { - Name: "reloptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "relpartbound", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_collation", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "collname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "collnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "collowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "collprovider", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "collisdeterministic", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "collencoding", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "collcollate", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "collctype", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "colliculocale", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "collversion", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_config", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "setting", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_constraint", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "conname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "connamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "contype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "condeferrable", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "condeferred", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "convalidated", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "conrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "contypid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "conindid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "conparentid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "confrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "confupdtype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "confdeltype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "confmatchtype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "conislocal", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "coninhcount", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "connoinherit", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "conkey", - Type: ast.TypeName{Name: "_int2"}, - IsArray: true, - }, - { - Name: "confkey", - Type: ast.TypeName{Name: "_int2"}, - IsArray: true, - }, - { - Name: "conpfeqop", - Type: ast.TypeName{Name: "_oid"}, - IsArray: true, - }, - { - Name: "conppeqop", - Type: ast.TypeName{Name: "_oid"}, - IsArray: true, - }, - { - Name: "conffeqop", - Type: ast.TypeName{Name: "_oid"}, - IsArray: true, - }, - { - Name: "confdelsetcols", - Type: ast.TypeName{Name: "_int2"}, - IsArray: true, - }, - { - Name: "conexclop", - Type: ast.TypeName{Name: "_oid"}, - IsArray: true, - }, - { - Name: "conbin", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_conversion", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "conname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "connamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "conowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "conforencoding", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "contoencoding", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "conproc", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "condefault", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_cursors", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "statement", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "is_holdable", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "is_binary", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "is_scrollable", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "creation_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_database", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "datdba", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "encoding", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "datlocprovider", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "datistemplate", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "datallowconn", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "datconnlimit", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "datfrozenxid", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "datminmxid", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "dattablespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "datcollate", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "datctype", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "daticulocale", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "datcollversion", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "datacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_db_role_setting", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "setdatabase", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "setrole", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "setconfig", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_default_acl", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "defaclrole", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "defaclnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "defaclobjtype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "defaclacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsNotNull: true, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_depend", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "classid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "objid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "objsubid", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "refclassid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "refobjid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "refobjsubid", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "deptype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_description", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "objoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "classoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "objsubid", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "description", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_enum", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "enumtypid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "enumsortorder", - Type: ast.TypeName{Name: "float4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "enumlabel", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_event_trigger", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "evtname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "evtevent", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "evtowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "evtfoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "evtenabled", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "evttags", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_extension", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "extname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "extowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "extnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "extrelocatable", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "extversion", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "extconfig", - Type: ast.TypeName{Name: "_oid"}, - IsArray: true, - }, - { - Name: "extcondition", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_file_settings", - }, - Columns: []*catalog.Column{ - { - Name: "sourcefile", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "sourceline", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "seqno", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "setting", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "applied", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "error", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_foreign_data_wrapper", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "fdwname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "fdwowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "fdwhandler", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "fdwvalidator", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "fdwacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - { - Name: "fdwoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_foreign_server", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "srvname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "srvowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "srvfdw", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "srvtype", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "srvversion", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "srvacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - { - Name: "srvoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_foreign_table", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "ftrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ftserver", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ftoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_group", - }, - Columns: []*catalog.Column{ - { - Name: "groname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "grosysid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "grolist", - Type: ast.TypeName{Name: "_oid"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_hba_file_rules", - }, - Columns: []*catalog.Column{ - { - Name: "line_number", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "type", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "database", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "user_name", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "address", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "netmask", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "auth_method", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "options", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "error", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_ident_file_mappings", - }, - Columns: []*catalog.Column{ - { - Name: "line_number", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "map_name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "sys_name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "pg_username", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "error", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_index", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "indexrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "indrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "indnatts", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "indnkeyatts", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "indisunique", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indnullsnotdistinct", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indisprimary", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indisexclusion", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indimmediate", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indisclustered", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indisvalid", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indcheckxmin", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indisready", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indislive", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indisreplident", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "indkey", - Type: ast.TypeName{Name: "int2vector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "indcollation", - Type: ast.TypeName{Name: "oidvector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "indclass", - Type: ast.TypeName{Name: "oidvector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "indoption", - Type: ast.TypeName{Name: "int2vector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "indexprs", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "indpred", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_indexes", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "indexname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablespace", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "indexdef", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_inherits", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "inhrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "inhparent", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "inhseqno", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "inhdetachpending", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_init_privs", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "objoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "classoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "objsubid", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "privtype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "initprivs", - Type: ast.TypeName{Name: "_aclitem"}, - IsNotNull: true, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_language", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "lanname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "lanowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "lanispl", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "lanpltrusted", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "lanplcallfoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "laninline", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "lanvalidator", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "lanacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_largeobject", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "loid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "pageno", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "data", - Type: ast.TypeName{Name: "bytea"}, - IsNotNull: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_largeobject_metadata", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "lomowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "lomacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_locks", - }, - Columns: []*catalog.Column{ - { - Name: "locktype", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "database", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "relation", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "page", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "tuple", - Type: ast.TypeName{Name: "int2"}, - Length: toPointer(2), - }, - { - Name: "virtualxid", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "transactionid", - Type: ast.TypeName{Name: "xid"}, - Length: toPointer(4), - }, - { - Name: "classid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "objid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "objsubid", - Type: ast.TypeName{Name: "int2"}, - Length: toPointer(2), - }, - { - Name: "virtualtransaction", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "mode", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "granted", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "fastpath", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "waitstart", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_matviews", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "matviewname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "matviewowner", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablespace", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "hasindexes", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "ispopulated", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "definition", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_namespace", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "nspname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "nspowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "nspacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_opclass", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opcmethod", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opcname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "opcnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opcowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opcfamily", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opcintype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opcdefault", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "opckeytype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_operator", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "oprnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprkind", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "oprcanmerge", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "oprcanhash", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "oprleft", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprright", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprresult", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprcom", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprnegate", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprcode", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprrest", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "oprjoin", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_opfamily", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opfmethod", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opfname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "opfnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "opfowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_parameter_acl", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "parname", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "paracl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_partitioned_table", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "partrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "partstrat", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "partnatts", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "partdefid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "partattrs", - Type: ast.TypeName{Name: "int2vector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "partclass", - Type: ast.TypeName{Name: "oidvector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "partcollation", - Type: ast.TypeName{Name: "oidvector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "partexprs", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_policies", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "policyname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "permissive", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "roles", - Type: ast.TypeName{Name: "_name"}, - IsArray: true, - }, - { - Name: "cmd", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "qual", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "with_check", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_policy", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "polname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "polrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "polcmd", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "polpermissive", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "polroles", - Type: ast.TypeName{Name: "_oid"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "polqual", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "polwithcheck", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_prepared_statements", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "statement", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "prepare_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "parameter_types", - Type: ast.TypeName{Name: "_regtype"}, - IsArray: true, - }, - { - Name: "from_sql", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "generic_plans", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "custom_plans", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_prepared_xacts", - }, - Columns: []*catalog.Column{ - { - Name: "transaction", - Type: ast.TypeName{Name: "xid"}, - Length: toPointer(4), - }, - { - Name: "gid", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "prepared", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "owner", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "database", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_proc", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "proname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "pronamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "proowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prolang", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "procost", - Type: ast.TypeName{Name: "float4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prorows", - Type: ast.TypeName{Name: "float4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "provariadic", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prosupport", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prokind", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "prosecdef", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "proleakproof", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "proisstrict", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "proretset", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "provolatile", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "proparallel", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "pronargs", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "pronargdefaults", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "prorettype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "proargtypes", - Type: ast.TypeName{Name: "oidvector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "proallargtypes", - Type: ast.TypeName{Name: "_oid"}, - IsArray: true, - }, - { - Name: "proargmodes", - Type: ast.TypeName{Name: "_char"}, - IsArray: true, - }, - { - Name: "proargnames", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "proargdefaults", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "protrftypes", - Type: ast.TypeName{Name: "_oid"}, - IsArray: true, - }, - { - Name: "prosrc", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "probin", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "prosqlbody", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "proconfig", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "proacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_publication", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "pubname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "pubowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "puballtables", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "pubinsert", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "pubupdate", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "pubdelete", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "pubtruncate", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "pubviaroot", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_publication_namespace", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "pnpubid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "pnnspid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_publication_rel", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prpubid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prqual", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "prattrs", - Type: ast.TypeName{Name: "int2vector"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_publication_tables", - }, - Columns: []*catalog.Column{ - { - Name: "pubname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "attnames", - Type: ast.TypeName{Name: "_name"}, - IsArray: true, - }, - { - Name: "rowfilter", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_range", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "rngtypid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rngsubtype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rngmultitypid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rngcollation", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rngsubopc", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rngcanonical", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rngsubdiff", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_replication_origin", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "roident", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "roname", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_replication_origin_status", - }, - Columns: []*catalog.Column{ - { - Name: "local_id", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "external_id", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "remote_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "local_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_replication_slots", - }, - Columns: []*catalog.Column{ - { - Name: "slot_name", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "plugin", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "slot_type", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "datoid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "database", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "temporary", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "active", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "active_pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - Length: toPointer(4), - }, - { - Name: "catalog_xmin", - Type: ast.TypeName{Name: "xid"}, - Length: toPointer(4), - }, - { - Name: "restart_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "confirmed_flush_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "wal_status", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "safe_wal_size", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "two_phase", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_rewrite", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "rulename", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "ev_class", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ev_type", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "ev_enabled", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "is_instead", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "ev_qual", - Type: ast.TypeName{Name: "pg_node_tree"}, - IsNotNull: true, - }, - { - Name: "ev_action", - Type: ast.TypeName{Name: "pg_node_tree"}, - IsNotNull: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_roles", - }, - Columns: []*catalog.Column{ - { - Name: "rolname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "rolsuper", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "rolinherit", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "rolcreaterole", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "rolcreatedb", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "rolcanlogin", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "rolreplication", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "rolconnlimit", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "rolpassword", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "rolvaliduntil", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "rolbypassrls", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "rolconfig", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_rules", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "rulename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "definition", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_seclabel", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "objoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "classoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "objsubid", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "provider", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "label", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_seclabels", - }, - Columns: []*catalog.Column{ - { - Name: "objoid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "classoid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "objsubid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "objtype", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "objnamespace", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "objname", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "provider", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "label", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_sequence", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "seqrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "seqtypid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "seqstart", - Type: ast.TypeName{Name: "int8"}, - IsNotNull: true, - Length: toPointer(8), - }, - { - Name: "seqincrement", - Type: ast.TypeName{Name: "int8"}, - IsNotNull: true, - Length: toPointer(8), - }, - { - Name: "seqmax", - Type: ast.TypeName{Name: "int8"}, - IsNotNull: true, - Length: toPointer(8), - }, - { - Name: "seqmin", - Type: ast.TypeName{Name: "int8"}, - IsNotNull: true, - Length: toPointer(8), - }, - { - Name: "seqcache", - Type: ast.TypeName{Name: "int8"}, - IsNotNull: true, - Length: toPointer(8), - }, - { - Name: "seqcycle", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_sequences", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "sequencename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "sequenceowner", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "data_type", - Type: ast.TypeName{Name: "regtype"}, - Length: toPointer(4), - }, - { - Name: "start_value", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "min_value", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "max_value", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "increment_by", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "cycle", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "cache_size", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "last_value", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_settings", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "setting", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "unit", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "category", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "short_desc", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "extra_desc", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "context", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "vartype", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "source", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "min_val", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "max_val", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "enumvals", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "boot_val", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "reset_val", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "sourcefile", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "sourceline", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "pending_restart", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_shadow", - }, - Columns: []*catalog.Column{ - { - Name: "usename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "usesysid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "usecreatedb", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "usesuper", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "userepl", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "usebypassrls", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "passwd", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "valuntil", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "useconfig", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_shdepend", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "dbid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "classid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "objid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "objsubid", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "refclassid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "refobjid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "deptype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_shdescription", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "objoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "classoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "description", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_shmem_allocations", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "off", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "size", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "allocated_size", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_shseclabel", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "objoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "classoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "provider", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "label", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_activity", - }, - Columns: []*catalog.Column{ - { - Name: "datid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "leader_pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "usesysid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "usename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "application_name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "client_addr", - Type: ast.TypeName{Name: "inet"}, - }, - { - Name: "client_hostname", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "client_port", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "backend_start", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "xact_start", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "query_start", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "state_change", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "wait_event_type", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "wait_event", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "state", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "backend_xid", - Type: ast.TypeName{Name: "xid"}, - Length: toPointer(4), - }, - { - Name: "backend_xmin", - Type: ast.TypeName{Name: "xid"}, - Length: toPointer(4), - }, - { - Name: "query_id", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "query", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "backend_type", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_all_indexes", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "indexrelid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "indexrelname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_all_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "seq_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "seq_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_ins", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_del", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_hot_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_live_tup", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_dead_tup", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_mod_since_analyze", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_ins_since_vacuum", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "last_vacuum", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_autovacuum", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_analyze", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_autoanalyze", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "vacuum_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "autovacuum_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "analyze_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "autoanalyze_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_archiver", - }, - Columns: []*catalog.Column{ - { - Name: "archived_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "last_archived_wal", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "last_archived_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "failed_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "last_failed_wal", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "last_failed_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "stats_reset", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_bgwriter", - }, - Columns: []*catalog.Column{ - { - Name: "checkpoints_timed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "checkpoints_req", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "checkpoint_write_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "checkpoint_sync_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "buffers_checkpoint", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "buffers_clean", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "maxwritten_clean", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "buffers_backend", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "buffers_backend_fsync", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "buffers_alloc", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "stats_reset", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_database", - }, - Columns: []*catalog.Column{ - { - Name: "datid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "numbackends", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "xact_commit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "xact_rollback", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tup_returned", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tup_fetched", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tup_inserted", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tup_updated", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tup_deleted", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "conflicts", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "temp_files", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "temp_bytes", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "deadlocks", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "checksum_failures", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "checksum_last_failure", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "blk_read_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "blk_write_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "session_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "active_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "idle_in_transaction_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "sessions", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "sessions_abandoned", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "sessions_fatal", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "sessions_killed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "stats_reset", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_database_conflicts", - }, - Columns: []*catalog.Column{ - { - Name: "datid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "confl_tablespace", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "confl_lock", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "confl_snapshot", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "confl_bufferpin", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "confl_deadlock", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_gssapi", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "gss_authenticated", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "principal", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "encrypted", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_progress_analyze", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "datid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "phase", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "sample_blks_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "sample_blks_scanned", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "ext_stats_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "ext_stats_computed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "child_tables_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "child_tables_done", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "current_child_table_relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_progress_basebackup", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "phase", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "backup_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "backup_streamed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tablespaces_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tablespaces_streamed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_progress_cluster", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "datid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "command", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "phase", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "cluster_index_relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "heap_tuples_scanned", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "heap_tuples_written", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "heap_blks_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "heap_blks_scanned", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "index_rebuild_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_progress_copy", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "datid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "command", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "type", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "bytes_processed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "bytes_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tuples_processed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tuples_excluded", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_progress_create_index", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "datid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "index_relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "command", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "phase", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "lockers_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "lockers_done", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "current_locker_pid", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blocks_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blocks_done", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tuples_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tuples_done", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "partitions_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "partitions_done", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_progress_vacuum", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "datid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "datname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "phase", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "heap_blks_total", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "heap_blks_scanned", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "heap_blks_vacuumed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "index_vacuum_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "max_dead_tuples", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "num_dead_tuples", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_recovery_prefetch", - }, - Columns: []*catalog.Column{ - { - Name: "stats_reset", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "prefetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "skip_init", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "skip_new", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "skip_fpw", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "skip_rep", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "wal_distance", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "block_distance", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "io_depth", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_replication", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "usesysid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "usename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "application_name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "client_addr", - Type: ast.TypeName{Name: "inet"}, - }, - { - Name: "client_hostname", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "client_port", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "backend_start", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "backend_xmin", - Type: ast.TypeName{Name: "xid"}, - Length: toPointer(4), - }, - { - Name: "state", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "sent_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "write_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "flush_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "replay_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "write_lag", - Type: ast.TypeName{Name: "interval"}, - Length: toPointer(16), - }, - { - Name: "flush_lag", - Type: ast.TypeName{Name: "interval"}, - Length: toPointer(16), - }, - { - Name: "replay_lag", - Type: ast.TypeName{Name: "interval"}, - Length: toPointer(16), - }, - { - Name: "sync_priority", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "sync_state", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "reply_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_replication_slots", - }, - Columns: []*catalog.Column{ - { - Name: "slot_name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "spill_txns", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "spill_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "spill_bytes", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "stream_txns", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "stream_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "stream_bytes", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "total_txns", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "total_bytes", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "stats_reset", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_slru", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "blks_zeroed", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_written", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_exists", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "flushes", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "truncates", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "stats_reset", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_ssl", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "ssl", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "version", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "cipher", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "bits", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "client_dn", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "client_serial", - Type: ast.TypeName{Name: "numeric"}, - }, - { - Name: "issuer_dn", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_subscription", - }, - Columns: []*catalog.Column{ - { - Name: "subid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "subname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "received_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "last_msg_send_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_msg_receipt_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "latest_end_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "latest_end_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_subscription_stats", - }, - Columns: []*catalog.Column{ - { - Name: "subid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "subname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "apply_error_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "sync_error_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "stats_reset", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_sys_indexes", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "indexrelid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "indexrelname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_sys_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "seq_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "seq_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_ins", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_del", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_hot_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_live_tup", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_dead_tup", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_mod_since_analyze", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_ins_since_vacuum", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "last_vacuum", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_autovacuum", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_analyze", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_autoanalyze", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "vacuum_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "autovacuum_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "analyze_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "autoanalyze_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_user_functions", - }, - Columns: []*catalog.Column{ - { - Name: "funcid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "funcname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "calls", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "total_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "self_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_user_indexes", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "indexrelid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "indexrelname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_user_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "seq_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "seq_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_ins", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_del", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_hot_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_live_tup", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_dead_tup", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_mod_since_analyze", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_ins_since_vacuum", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "last_vacuum", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_autovacuum", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_analyze", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_autoanalyze", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "vacuum_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "autovacuum_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "analyze_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "autoanalyze_count", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_wal", - }, - Columns: []*catalog.Column{ - { - Name: "wal_records", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "wal_fpi", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "wal_bytes", - Type: ast.TypeName{Name: "numeric"}, - }, - { - Name: "wal_buffers_full", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "wal_write", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "wal_sync", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "wal_write_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "wal_sync_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "stats_reset", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_wal_receiver", - }, - Columns: []*catalog.Column{ - { - Name: "pid", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "status", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "receive_start_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "receive_start_tli", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "written_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "flushed_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "received_tli", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "last_msg_send_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "last_msg_receipt_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "latest_end_lsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - { - Name: "latest_end_time", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "slot_name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "sender_host", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "sender_port", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "conninfo", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_xact_all_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "seq_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "seq_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_ins", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_del", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_hot_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_xact_sys_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "seq_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "seq_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_ins", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_del", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_hot_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_xact_user_functions", - }, - Columns: []*catalog.Column{ - { - Name: "funcid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "funcname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "calls", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "total_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - { - Name: "self_time", - Type: ast.TypeName{Name: "float8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stat_xact_user_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "seq_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "seq_tup_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_scan", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_tup_fetch", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_ins", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_del", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "n_tup_hot_upd", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_all_indexes", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "indexrelid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "indexrelname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "idx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_all_sequences", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_all_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "heap_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "heap_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "toast_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "toast_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tidx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tidx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_sys_indexes", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "indexrelid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "indexrelname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "idx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_sys_sequences", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_sys_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "heap_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "heap_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "toast_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "toast_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tidx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tidx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_user_indexes", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "indexrelid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "indexrelname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "idx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_user_sequences", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statio_user_tables", - }, - Columns: []*catalog.Column{ - { - Name: "relid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "relname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "heap_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "heap_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "idx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "toast_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "toast_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tidx_blks_read", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - { - Name: "tidx_blks_hit", - Type: ast.TypeName{Name: "int8"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statistic", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "starelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "staattnum", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "stainherit", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "stanullfrac", - Type: ast.TypeName{Name: "float4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stawidth", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stadistinct", - Type: ast.TypeName{Name: "float4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stakind1", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "stakind2", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "stakind3", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "stakind4", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "stakind5", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "staop1", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "staop2", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "staop3", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "staop4", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "staop5", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stacoll1", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stacoll2", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stacoll3", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stacoll4", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stacoll5", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stanumbers1", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "stanumbers2", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "stanumbers3", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "stanumbers4", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "stanumbers5", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "stavalues1", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "stavalues2", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "stavalues3", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "stavalues4", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "stavalues5", - Type: ast.TypeName{Name: "anyarray"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statistic_ext", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stxrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stxname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "stxnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stxowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stxstattarget", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stxkeys", - Type: ast.TypeName{Name: "int2vector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "stxkind", - Type: ast.TypeName{Name: "_char"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "stxexprs", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_statistic_ext_data", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "stxoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "stxdinherit", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "stxdndistinct", - Type: ast.TypeName{Name: "pg_ndistinct"}, - }, - { - Name: "stxddependencies", - Type: ast.TypeName{Name: "pg_dependencies"}, - }, - { - Name: "stxdmcv", - Type: ast.TypeName{Name: "pg_mcv_list"}, - }, - { - Name: "stxdexpr", - Type: ast.TypeName{Name: "_pg_statistic"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stats", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "attname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "inherited", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "null_frac", - Type: ast.TypeName{Name: "float4"}, - Length: toPointer(4), - }, - { - Name: "avg_width", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "n_distinct", - Type: ast.TypeName{Name: "float4"}, - Length: toPointer(4), - }, - { - Name: "most_common_vals", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "most_common_freqs", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "histogram_bounds", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "correlation", - Type: ast.TypeName{Name: "float4"}, - Length: toPointer(4), - }, - { - Name: "most_common_elems", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "most_common_elem_freqs", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "elem_count_histogram", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stats_ext", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "statistics_schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "statistics_name", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "statistics_owner", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "attnames", - Type: ast.TypeName{Name: "_name"}, - IsArray: true, - }, - { - Name: "exprs", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "kinds", - Type: ast.TypeName{Name: "_char"}, - IsArray: true, - }, - { - Name: "inherited", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "n_distinct", - Type: ast.TypeName{Name: "pg_ndistinct"}, - }, - { - Name: "dependencies", - Type: ast.TypeName{Name: "pg_dependencies"}, - }, - { - Name: "most_common_vals", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - { - Name: "most_common_val_nulls", - Type: ast.TypeName{Name: "_bool"}, - IsArray: true, - }, - { - Name: "most_common_freqs", - Type: ast.TypeName{Name: "_float8"}, - IsArray: true, - }, - { - Name: "most_common_base_freqs", - Type: ast.TypeName{Name: "_float8"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_stats_ext_exprs", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "statistics_schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "statistics_name", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "statistics_owner", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "expr", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "inherited", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "null_frac", - Type: ast.TypeName{Name: "float4"}, - Length: toPointer(4), - }, - { - Name: "avg_width", - Type: ast.TypeName{Name: "int4"}, - Length: toPointer(4), - }, - { - Name: "n_distinct", - Type: ast.TypeName{Name: "float4"}, - Length: toPointer(4), - }, - { - Name: "most_common_vals", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "most_common_freqs", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "histogram_bounds", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "correlation", - Type: ast.TypeName{Name: "float4"}, - Length: toPointer(4), - }, - { - Name: "most_common_elems", - Type: ast.TypeName{Name: "anyarray"}, - }, - { - Name: "most_common_elem_freqs", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - { - Name: "elem_count_histogram", - Type: ast.TypeName{Name: "_float4"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_subscription", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "subdbid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "subskiplsn", - Type: ast.TypeName{Name: "pg_lsn"}, - IsNotNull: true, - Length: toPointer(8), - }, - { - Name: "subname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "subowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "subenabled", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "subbinary", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "substream", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "subtwophasestate", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "subdisableonerr", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "subconninfo", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "subslotname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "subsynccommit", - Type: ast.TypeName{Name: "text"}, - IsNotNull: true, - }, - { - Name: "subpublications", - Type: ast.TypeName{Name: "_text"}, - IsNotNull: true, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_subscription_rel", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "srsubid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "srrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "srsubstate", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "srsublsn", - Type: ast.TypeName{Name: "pg_lsn"}, - Length: toPointer(8), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_tables", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tableowner", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tablespace", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "hasindexes", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "hasrules", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "hastriggers", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "rowsecurity", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_tablespace", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "spcname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "spcowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "spcacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - { - Name: "spcoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_timezone_abbrevs", - }, - Columns: []*catalog.Column{ - { - Name: "abbrev", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "utc_offset", - Type: ast.TypeName{Name: "interval"}, - Length: toPointer(16), - }, - { - Name: "is_dst", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_timezone_names", - }, - Columns: []*catalog.Column{ - { - Name: "name", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "abbrev", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "utc_offset", - Type: ast.TypeName{Name: "interval"}, - Length: toPointer(16), - }, - { - Name: "is_dst", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_transform", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "trftype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "trflang", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "trffromsql", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "trftosql", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_trigger", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tgrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tgparentid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tgname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "tgfoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tgtype", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "tgenabled", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "tgisinternal", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "tgconstrrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tgconstrindid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tgconstraint", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tgdeferrable", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "tginitdeferred", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "tgnargs", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "tgattr", - Type: ast.TypeName{Name: "int2vector"}, - IsNotNull: true, - IsArray: true, - }, - { - Name: "tgargs", - Type: ast.TypeName{Name: "bytea"}, - IsNotNull: true, - }, - { - Name: "tgqual", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "tgoldtable", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "tgnewtable", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_ts_config", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cfgname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "cfgnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cfgowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cfgparser", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_ts_config_map", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "mapcfg", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "maptokentype", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "mapseqno", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "mapdict", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_ts_dict", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "dictname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "dictnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "dictowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "dicttemplate", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "dictinitoption", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_ts_parser", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prsname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "prsnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prsstart", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prstoken", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prsend", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prsheadline", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "prslextype", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_ts_template", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tmplname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "tmplnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tmplinit", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "tmpllexize", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_type", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typname", - Type: ast.TypeName{Name: "name"}, - IsNotNull: true, - Length: toPointer(64), - }, - { - Name: "typnamespace", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typowner", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typlen", - Type: ast.TypeName{Name: "int2"}, - IsNotNull: true, - Length: toPointer(2), - }, - { - Name: "typbyval", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typtype", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typcategory", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typispreferred", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typisdefined", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typdelim", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typrelid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typsubscript", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typelem", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typarray", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typinput", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typoutput", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typreceive", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typsend", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typmodin", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typmodout", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typanalyze", - Type: ast.TypeName{Name: "regproc"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typalign", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typstorage", - Type: ast.TypeName{Name: "char"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typnotnull", - Type: ast.TypeName{Name: "bool"}, - IsNotNull: true, - Length: toPointer(1), - }, - { - Name: "typbasetype", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typtypmod", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typndims", - Type: ast.TypeName{Name: "int4"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typcollation", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "typdefaultbin", - Type: ast.TypeName{Name: "pg_node_tree"}, - }, - { - Name: "typdefault", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "typacl", - Type: ast.TypeName{Name: "_aclitem"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_user", - }, - Columns: []*catalog.Column{ - { - Name: "usename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "usesysid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "usecreatedb", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "usesuper", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "userepl", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "usebypassrls", - Type: ast.TypeName{Name: "bool"}, - Length: toPointer(1), - }, - { - Name: "passwd", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "valuntil", - Type: ast.TypeName{Name: "timestamptz"}, - Length: toPointer(8), - }, - { - Name: "useconfig", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_user_mapping", - }, - Columns: []*catalog.Column{ - { - Name: "tableoid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmax", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmax", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "cmin", - Type: ast.TypeName{Name: "cid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "xmin", - Type: ast.TypeName{Name: "xid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "ctid", - Type: ast.TypeName{Name: "tid"}, - IsNotNull: true, - Length: toPointer(6), - }, - { - Name: "oid", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "umuser", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "umserver", - Type: ast.TypeName{Name: "oid"}, - IsNotNull: true, - Length: toPointer(4), - }, - { - Name: "umoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_user_mappings", - }, - Columns: []*catalog.Column{ - { - Name: "umid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "srvid", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "srvname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "umuser", - Type: ast.TypeName{Name: "oid"}, - Length: toPointer(4), - }, - { - Name: "usename", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "umoptions", - Type: ast.TypeName{Name: "_text"}, - IsArray: true, - }, - }, - }, - { - Rel: &ast.TableName{ - Catalog: "pg_catalog", - Schema: "pg_catalog", - Name: "pg_views", - }, - Columns: []*catalog.Column{ - { - Name: "schemaname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "viewname", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "viewowner", - Type: ast.TypeName{Name: "name"}, - Length: toPointer(64), - }, - { - Name: "definition", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - } - return s -} diff --git a/internal/engine/postgresql/reserved.go b/internal/engine/postgresql/reserved.go index 8f796ffa19..12522fea94 100644 --- a/internal/engine/postgresql/reserved.go +++ b/internal/engine/postgresql/reserved.go @@ -1,6 +1,81 @@ package postgresql -import "strings" +import ( + "fmt" + "strings" +) + +// hasMixedCase returns true if the string has any uppercase letters +// (identifiers with mixed case need quoting in PostgreSQL) +func hasMixedCase(s string) bool { + for _, r := range s { + if r >= 'A' && r <= 'Z' { + return true + } + } + return false +} + +// QuoteIdent returns a quoted identifier if it needs quoting. +// This implements the format.Dialect interface. +func (p *Parser) QuoteIdent(s string) string { + if p.IsReservedKeyword(s) || hasMixedCase(s) { + return `"` + s + `"` + } + return s +} + +// TypeName returns the SQL type name for the given namespace and name. +// This implements the format.Dialect interface. +func (p *Parser) TypeName(ns, name string) string { + if ns == "pg_catalog" { + switch name { + case "int4": + return "integer" + case "int8": + return "bigint" + case "int2": + return "smallint" + case "float4": + return "real" + case "float8": + return "double precision" + case "bool": + return "boolean" + case "bpchar": + return "character" + case "timestamptz": + return "timestamp with time zone" + case "timetz": + return "time with time zone" + default: + return name + } + } + if ns != "" { + return ns + "." + name + } + return name +} + +// Param returns the parameter placeholder for the given number. +// PostgreSQL numbers every parameter: $1, $2, etc. +func (p *Parser) Param(n int, numbered bool) string { + return fmt.Sprintf("$%d", n) +} + +// Cast returns a type cast expression. +// PostgreSQL uses expr::type syntax. +func (p *Parser) Cast(arg, typeName string) string { + return arg + "::" + typeName +} + +// Fingerprint reduces a query to pg_query's fingerprint, which survives +// changes in whitespace, case and layout. sqlc fmt uses it to prove a +// formatted statement still parses to the same query. +func (p *Parser) Fingerprint(sql string) (string, error) { + return Fingerprint(sql) +} // https://www.postgresql.org/docs/current/sql-keywords-appendix.html func (p *Parser) IsReservedKeyword(s string) bool { diff --git a/internal/engine/postgresql/seed.go b/internal/engine/postgresql/seed.go new file mode 100644 index 0000000000..9cf184c50d --- /dev/null +++ b/internal/engine/postgresql/seed.go @@ -0,0 +1,45 @@ +package postgresql + +import ( + "embed" + "sync" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/seed" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +// The dialect directory describes PostgreSQL's type system. Two things in it +// are worth knowing about: the serial types are column definition sugar for an +// integer plus a sequence, but they are what a schema declares, so the catalog +// carries them as types of their own; and the numeric, string and datetime +// categories are listed as mutually castable, which is what an unadorned +// "WHERE bigint_col = 1" depends on. +// +// functions.jsonl and relations.jsonl are pg_catalog's functions and the +// tables and views of pg_catalog and information_schema, all generated from +// a live PostgreSQL 16 server by goldeneye (internal/goldeneye), which also +// checks them against one. Both the analysis core and the catalog the legacy +// compiler builds read them. Each contrib extension sqlc knows is a directory +// under extensions/ holding the types and functions CREATE EXTENSION adds. +// +//go:embed dialect +var dialectFS embed.FS + +// Dialect returns the catalog option that seeds PostgreSQL's type system. +func Dialect() core.Option { + return seed.Dialect(dialectFS, "dialect") +} + +// pgCatalogFuncs is pg_catalog's functions in the form the catalog uses. The +// list runs to thousands of entries and never changes within a run, so it is +// read once. +var pgCatalogFuncs = sync.OnceValue(func() []*catalog.Function { + funcs, err := seed.Functions(dialectFS, "dialect") + if err != nil { + // The list is embedded in the binary: a failure here means sqlc was + // built from a broken tree, which no caller can do anything about. + panic(err) + } + return funcs +}) diff --git a/internal/engine/postgresql/utils.go b/internal/engine/postgresql/utils.go index d0ddc392a1..3dbe6d8ba9 100644 --- a/internal/engine/postgresql/utils.go +++ b/internal/engine/postgresql/utils.go @@ -1,10 +1,7 @@ -//go:build !windows && cgo -// +build !windows,cgo - package postgresql import ( - nodes "github.com/pganalyze/pg_query_go/v4" + nodes "github.com/sqlc-dev/oliphant" ) func isArray(n *nodes.TypeName) bool { @@ -32,16 +29,6 @@ func isNotNull(n *nodes.ColumnDef) bool { return false } -func IsNamedParamFunc(node *nodes.Node) bool { - fun, ok := node.Node.(*nodes.Node_FuncCall) - return ok && joinNodes(fun.FuncCall.Funcname, ".") == "sqlc.arg" -} - -func IsNamedParamSign(node *nodes.Node) bool { - expr, ok := node.Node.(*nodes.Node_AExpr) - return ok && joinNodes(expr.AExpr.Name, ".") == "@" -} - func makeByte(s string) byte { var b byte if s == "" { diff --git a/internal/engine/sqlite/analyzer/analyze.go b/internal/engine/sqlite/analyzer/analyze.go new file mode 100644 index 0000000000..a9e7d9f1ff --- /dev/null +++ b/internal/engine/sqlite/analyzer/analyze.go @@ -0,0 +1,233 @@ +package analyzer + +import ( + "context" + "fmt" + "strings" + "sync" + + "github.com/ncruces/go-sqlite3" + + core "github.com/sqlc-dev/sqlc/internal/analysis" + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/shfmt" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/named" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" + _ "github.com/sqlc-dev/sqlc/internal/sqlite3ext" +) + +var debugDatabases = sqlcdebug.New("databases") + +type Analyzer struct { + db config.Database + conn *sqlite3.Conn + replacer *shfmt.Replacer + mu sync.Mutex +} + +func New(db config.Database) *Analyzer { + return &Analyzer{ + db: db, + replacer: shfmt.NewReplacer(nil), + } +} + +func (a *Analyzer) Analyze(ctx context.Context, n ast.Node, query string, migrations []string, ps *named.ParamSet) (*core.Analysis, error) { + a.mu.Lock() + defer a.mu.Unlock() + + if a.conn == nil { + var uri string + applyMigrations := a.db.Managed + if a.db.Managed { + // For managed databases, create an in-memory database + uri = ":memory:" + } else if debugDatabases.Value() == "managed" { + return nil, fmt.Errorf("database: connections disabled via SQLCDEBUG=databases=managed") + } else { + uri = a.replacer.Replace(a.db.URI) + // For in-memory databases, we need to apply migrations since the database starts empty + if isInMemoryDatabase(uri) { + applyMigrations = true + } + } + + conn, err := sqlite3.Open(uri) + if err != nil { + return nil, fmt.Errorf("failed to open sqlite database: %w", err) + } + a.conn = conn + + // Apply migrations for managed or in-memory databases + if applyMigrations { + for _, m := range migrations { + if len(strings.TrimSpace(m)) == 0 { + continue + } + if err := a.conn.Exec(m); err != nil { + a.conn.Close() + a.conn = nil + return nil, fmt.Errorf("migration failed: %s: %w", m, err) + } + } + } + } + + // Prepare the statement to get column and parameter information + stmt, _, err := a.conn.Prepare(query) + if err != nil { + return nil, a.extractSqlErr(n, err) + } + defer stmt.Close() + + var result core.Analysis + + // Get column information + colCount := stmt.ColumnCount() + for i := range colCount { + name := stmt.ColumnName(i) + declType := stmt.ColumnDeclType(i) + dbName := stmt.ColumnDatabaseName(i) + tableName := stmt.ColumnTableName(i) + originName := stmt.ColumnOriginName(i) + + // Determine if column is NOT NULL + var notNull bool + var dataType string + if originName != "" { + declType, _, notNull, _, _, _ = a.conn.TableColumnMetadata( + dbName, tableName, originName) + } + + // Normalize the data type + dataType = normalizeType(declType) + + col := &core.Column{ + Name: name, + OriginalName: originName, + DataType: dataType, + NotNull: notNull, + } + + if tableName != "" { + col.Table = &core.Identifier{ + Schema: dbName, + Name: tableName, + } + } + + result.Columns = append(result.Columns, col) + } + + // Get parameter information + bindCount := stmt.BindCount() + for i := 1; i <= bindCount; i++ { + paramName := stmt.BindName(i) + + // SQLite doesn't provide parameter types from prepared statements + // We use "any" as the default type + name := "" + if paramName != "" { + // Remove the prefix (?, :, @, $) from parameter names + name = strings.TrimLeft(paramName, "?:@$") + } + if ps != nil { + if n, ok := ps.NameFor(i); ok { + name = n + } + } + + result.Params = append(result.Params, &core.Parameter{ + Number: int32(i), + Column: &core.Column{ + Name: name, + DataType: "any", + NotNull: false, + }, + }) + } + + return &result, nil +} + +func (a *Analyzer) extractSqlErr(n ast.Node, err error) error { + if err == nil { + return nil + } + // Try to extract SQLite error details + var sqliteErr *sqlite3.Error + if e, ok := err.(*sqlite3.Error); ok { + sqliteErr = e + } + if sqliteErr != nil { + return &sqlerr.Error{ + Code: fmt.Sprintf("%d", sqliteErr.Code()), + Message: sqliteErr.Error(), + Location: n.Pos(), + } + } + return &sqlerr.Error{ + Message: err.Error(), + Location: n.Pos(), + } +} + +func (a *Analyzer) Close(_ context.Context) error { + a.mu.Lock() + defer a.mu.Unlock() + if a.conn != nil { + err := a.conn.Close() + a.conn = nil + return err + } + return nil +} + +// isInMemoryDatabase checks if a SQLite URI refers to an in-memory database +func isInMemoryDatabase(uri string) bool { + if uri == ":memory:" || uri == "" { + return true + } + // Check for file URI with mode=memory parameter + // e.g., "file:test?mode=memory&cache=shared" + if strings.Contains(uri, "mode=memory") { + return true + } + return false +} + +// normalizeType converts SQLite type declarations to standard type names +func normalizeType(declType string) string { + if declType == "" { + return "any" + } + + // Convert to lowercase for comparison + lower := strings.ToLower(declType) + + // SQLite type affinity rules (https://www.sqlite.org/datatype3.html) + switch { + case strings.Contains(lower, "int"): + return "integer" + case strings.Contains(lower, "char"), + strings.Contains(lower, "clob"), + strings.Contains(lower, "text"): + return "text" + case strings.Contains(lower, "blob"): + return "blob" + case strings.Contains(lower, "real"), + strings.Contains(lower, "floa"), + strings.Contains(lower, "doub"): + return "real" + case strings.Contains(lower, "bool"): + return "boolean" + case strings.Contains(lower, "date"), + strings.Contains(lower, "time"): + return "datetime" + default: + // Return as-is for numeric or other types + return lower + } +} diff --git a/internal/engine/sqlite/catalog.go b/internal/engine/sqlite/catalog.go index d7d27489a9..54d198ee9d 100644 --- a/internal/engine/sqlite/catalog.go +++ b/internal/engine/sqlite/catalog.go @@ -9,10 +9,7 @@ func NewCatalog() *catalog.Catalog { Schemas: []*catalog.Schema{ defaultSchema(def), }, - Extensions: map[string]struct{}{}, + LoadExtension: loadExtension, + Extensions: map[string]struct{}{}, } } - -func newTestCatalog() *catalog.Catalog { - return catalog.New("main") -} diff --git a/internal/engine/sqlite/catalog_test.go b/internal/engine/sqlite/catalog_test.go deleted file mode 100644 index bf6dcd8316..0000000000 --- a/internal/engine/sqlite/catalog_test.go +++ /dev/null @@ -1,269 +0,0 @@ -package sqlite - -import ( - "strconv" - "strings" - "testing" - - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" -) - -func TestUpdate(t *testing.T) { - p := NewParser() - - for i, tc := range []struct { - stmt string - s *catalog.Schema - }{ - { - ` - CREATE TABLE foo (bar text); - `, - &catalog.Schema{ - Name: "main", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Name: "foo"}, - Columns: []*catalog.Column{ - { - Name: "bar", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - }, - }, - }, - { - ` - CREATE TABLE foo (bar text); - ALTER TABLE foo RENAME TO baz; - `, - &catalog.Schema{ - Name: "main", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Name: "baz"}, - Columns: []*catalog.Column{ - { - Name: "bar", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - }, - }, - }, - { - ` - CREATE TABLE foo (bar text); - ALTER TABLE foo ADD COLUMN baz bool; - `, - &catalog.Schema{ - Name: "main", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Name: "foo"}, - Columns: []*catalog.Column{ - { - Name: "bar", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "baz", - Type: ast.TypeName{Name: "bool"}, - }, - }, - }, - }, - }, - }, - { - ` - CREATE TABLE foo (bar text); - ALTER TABLE foo RENAME COLUMN bar TO baz; - `, - &catalog.Schema{ - Name: "main", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Name: "foo"}, - Columns: []*catalog.Column{ - { - Name: "baz", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - }, - }, - }, - { - ` - CREATE TABLE foo (bar text); - ALTER TABLE foo RENAME bar TO baz; - `, - &catalog.Schema{ - Name: "main", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Name: "foo"}, - Columns: []*catalog.Column{ - { - Name: "baz", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - }, - }, - }, - { - ` - ATTACH ':memory:' as ns; - CREATE TABLE ns.foo (bar text); - `, - &catalog.Schema{ - Name: "ns", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Schema: "ns", Name: "foo"}, - Columns: []*catalog.Column{ - { - Name: "bar", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - }, - }, - }, - { - ` - ATTACH ':memory:' as ns; - CREATE TABLE ns.foo (bar text); - ALTER TABLE ns.foo RENAME TO baz; - `, - &catalog.Schema{ - Name: "ns", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Schema: "ns", Name: "baz"}, - Columns: []*catalog.Column{ - { - Name: "bar", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - }, - }, - }, - { - ` - ATTACH ':memory:' as ns; - CREATE TABLE ns.foo (bar text); - ALTER TABLE ns.foo ADD COLUMN baz bool; - `, - &catalog.Schema{ - Name: "ns", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Schema: "ns", Name: "foo"}, - Columns: []*catalog.Column{ - { - Name: "bar", - Type: ast.TypeName{Name: "text"}, - }, - { - Name: "baz", - Type: ast.TypeName{Name: "bool"}, - }, - }, - }, - }, - }, - }, - { - ` - ATTACH ':memory:' as ns; - CREATE TABLE ns.foo (bar text); - ALTER TABLE ns.foo RENAME COLUMN bar TO baz; - `, - &catalog.Schema{ - Name: "ns", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Schema: "ns", Name: "foo"}, - Columns: []*catalog.Column{ - { - Name: "baz", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - }, - }, - }, - { - ` - ATTACH ':memory:' as ns; - CREATE TABLE ns.foo (bar text); - ALTER TABLE ns.foo RENAME bar TO baz; - `, - &catalog.Schema{ - Name: "ns", - Tables: []*catalog.Table{ - { - Rel: &ast.TableName{Schema: "ns", Name: "foo"}, - Columns: []*catalog.Column{ - { - Name: "baz", - Type: ast.TypeName{Name: "text"}, - }, - }, - }, - }, - }, - }, - } { - test := tc - t.Run(strconv.Itoa(i), func(t *testing.T) { - stmts, err := p.Parse(strings.NewReader(test.stmt)) - if err != nil { - t.Log(test.stmt) - t.Fatal(err) - } - - c := newTestCatalog() - if err := c.Build(stmts); err != nil { - t.Log(test.stmt) - t.Fatal(err) - } - - e := newTestCatalog() - if test.s != nil { - var replaced bool - for i := range e.Schemas { - if e.Schemas[i].Name == test.s.Name { - e.Schemas[i] = test.s - replaced = true - break - } - } - if !replaced { - e.Schemas = append(e.Schemas, test.s) - } - } - - if diff := cmp.Diff(e, c, cmpopts.EquateEmpty(), cmpopts.IgnoreUnexported(catalog.Column{})); diff != "" { - t.Log(test.stmt) - t.Errorf("catalog mismatch:\n%s", diff) - } - }) - } -} diff --git a/internal/engine/sqlite/convert.go b/internal/engine/sqlite/convert.go index e941bb9121..dad36d4d1e 100644 --- a/internal/engine/sqlite/convert.go +++ b/internal/engine/sqlite/convert.go @@ -6,133 +6,313 @@ import ( "strconv" "strings" - "github.com/antlr/antlr4/runtime/Go/antlr/v4" + meyer "github.com/sqlc-dev/meyer/ast" "github.com/sqlc-dev/sqlc/internal/debug" - "github.com/sqlc-dev/sqlc/internal/engine/sqlite/parser" "github.com/sqlc-dev/sqlc/internal/sql/ast" ) +// cc converts a meyer syntax tree into sqlc's engine-independent AST. One +// converter is used per statement; paramCount numbers the anonymous "?" +// markers within it, and src is the source the statement was parsed from. type cc struct { paramCount int + src string } -type node interface { - GetParser() antlr.Parser -} - -func todo(funcname string, n node) *ast.TODO { +func todo(funcname string, n meyer.Node) *ast.TODO { if debug.Active { log.Printf("sqlite.%s: Unknown node type %T\n", funcname, n) } return &ast.TODO{} } -func identifier(id string) string { - if len(id) >= 2 && id[0] == '"' && id[len(id)-1] == '"' { - unquoted, _ := strconv.Unquote(id) - return unquoted +func (c *cc) convert(node meyer.Node) ast.Node { + switch n := node.(type) { + + // Statements + + case *meyer.AlterTableStmt: + return c.convertAlterTableStmt(n) + + case *meyer.AttachStmt: + return c.convertAttachStmt(n) + + case *meyer.CreateTableStmt: + return c.convertCreateTableStmt(n) + + case *meyer.CreateViewStmt: + return c.convertCreateViewStmt(n) + + case *meyer.CreateVirtualTableStmt: + return c.convertCreateVirtualTableStmt(n) + + case *meyer.DeleteStmt: + return c.convertDeleteStmt(n) + + case *meyer.DropTableStmt: + return c.convertDropStmt(n.Name, n.IfExists) + + case *meyer.DropViewStmt: + return c.convertDropStmt(n.Name, n.IfExists) + + case *meyer.ExplainStmt: + return c.convert(n.Stmt) + + case *meyer.InsertStmt: + return c.convertInsertStmt(n) + + case *meyer.SelectStmt: + return c.convertSelectStmt(n) + + case *meyer.UpdateStmt: + return c.convertUpdateStmt(n) + + // Expressions + + case *meyer.BetweenExpr: + return c.convertBetweenExpr(n) + + case *meyer.BinaryExpr: + return c.convertBinaryExpr(n) + + case *meyer.BindParam: + return c.convertBindParam(n) + + case *meyer.CaseExpr: + return c.convertCaseExpr(n) + + case *meyer.CastExpr: + return c.convertCastExpr(n) + + case *meyer.CollateExpr: + return c.convertCollateExpr(n) + + case *meyer.ExistsExpr: + return &ast.SubLink{ + SubLinkType: ast.EXISTS_SUBLINK, + Subselect: c.convert(n.Select), + Location: n.Pos(), + } + + case *meyer.FuncCall: + return c.convertFuncCall(n) + + case *meyer.Ident: + return c.columnRef(n.Pos(), n) + + case *meyer.InExpr: + return c.convertInExpr(n) + + case *meyer.IsExpr: + return c.convertIsExpr(n) + + case *meyer.LikeExpr: + return c.convertLikeExpr(n) + + case *meyer.Literal: + return c.convertLiteral(n) + + case *meyer.NullCheckExpr: + return c.convertNullCheckExpr(n) + + case *meyer.ParenExpr: + return c.convert(n.X) + + case *meyer.QualifiedRef: + return c.columnRef(n.Pos(), n.Parts...) + + case *meyer.Star: + return c.convertStar(n) + + case *meyer.SubqueryExpr: + return &ast.SubLink{ + SubLinkType: ast.EXPR_SUBLINK, + Subselect: c.convert(n.Select), + Location: n.Pos(), + } + + case *meyer.UnaryExpr: + return c.convertUnaryExpr(n) + + case *meyer.VectorExpr: + return c.convertExprList(n.List) + + default: + return todo("convert(case=default)", node) + } +} + +// convertExpr converts an optional expression, mapping an absent one to a +// nil node rather than to a TODO. +func (c *cc) convertExpr(e meyer.Expr) ast.Node { + if e == nil { + return nil } - return strings.ToLower(id) + return c.convert(e) } -func NewIdentifier(t string) *ast.String { - return &ast.String{Str: identifier(t)} +func (c *cc) convertExprList(exprs []meyer.Expr) *ast.List { + list := &ast.List{Items: []ast.Node{}} + for _, e := range exprs { + list.Items = append(list.Items, c.convert(e)) + } + return list } -func (c *cc) convertAlter_table_stmtContext(n *parser.Alter_table_stmtContext) ast.Node { - if n.RENAME_() != nil { - if newTable, ok := n.New_table_name().(*parser.New_table_nameContext); ok { - name := newTable.Any_name().GetText() - return &ast.RenameTableStmt{ - Table: parseTableName(n), - NewName: &name, - } +// columnRef builds the dotted reference sqlc uses for a column: a one, two +// or three part name of the form [[schema.]table.]column. +func (c *cc) columnRef(loc int, parts ...*meyer.Ident) *ast.ColumnRef { + items := make([]ast.Node, 0, len(parts)) + for _, p := range parts { + items = append(items, NewIdentifier(p)) + } + return &ast.ColumnRef{ + Fields: &ast.List{Items: items}, + Location: loc, + } +} + +func (c *cc) convertStar(n *meyer.Star) *ast.ColumnRef { + items := []ast.Node{} + if n.Table != nil { + items = append(items, NewIdentifier(n.Table)) + } + items = append(items, &ast.A_Star{}) + return &ast.ColumnRef{ + Fields: &ast.List{Items: items}, + Location: n.Pos(), + } +} + +// +// Statements +// + +func (c *cc) convertAlterTableStmt(n *meyer.AlterTableStmt) ast.Node { + switch n.Action { + case meyer.AlterRenameTable: + name := identifier(n.NewName) + return &ast.RenameTableStmt{ + Table: parseTableName(n.Table), + NewName: &name, } - if newCol, ok := n.GetNew_column_name().(*parser.Column_nameContext); ok { - name := newCol.Any_name().GetText() - return &ast.RenameColumnStmt{ - Table: parseTableName(n), - Col: &ast.ColumnRef{ - Name: n.GetOld_column_name().GetText(), - }, - NewName: &name, - } + case meyer.AlterRenameColumn: + name := identifier(n.NewName) + return &ast.RenameColumnStmt{ + Table: parseTableName(n.Table), + Col: &ast.ColumnRef{ + Name: identifier(n.Column), + }, + NewName: &name, } - } - if n.ADD_() != nil { - if def, ok := n.Column_def().(*parser.Column_defContext); ok { - stmt := &ast.AlterTableStmt{ - Table: parseTableName(n), - Cmds: &ast.List{}, - } - name := def.Column_name().GetText() - stmt.Cmds.Items = append(stmt.Cmds.Items, &ast.AlterTableCmd{ - Name: &name, - Subtype: ast.AT_AddColumn, - Def: &ast.ColumnDef{ - Colname: name, - TypeName: &ast.TypeName{ - Name: def.Type_name().GetText(), + case meyer.AlterAddColumn: + def := n.ColumnDef + if def == nil { + break + } + name := identifier(def.Name) + return &ast.AlterTableStmt{ + Table: parseTableName(n.Table), + Incomplete: !representableColumn(def), + Cmds: &ast.List{Items: []ast.Node{ + &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_AddColumn, + Def: &ast.ColumnDef{ + Colname: name, + TypeName: &ast.TypeName{ + Name: columnTypeName(def.Type), + Spelling: typeSpelling(def.Type), + }, + Typeless: def.Type == nil, + IsNotNull: hasNotNullConstraint(def.Constraints), + PrimaryKey: hasPrimaryKeyConstraint(def.Constraints), }, - IsNotNull: hasNotNullConstraint(def.AllColumn_constraint()), }, - }) - return stmt + }}, } - } - if n.DROP_() != nil { - stmt := &ast.AlterTableStmt{ - Table: parseTableName(n), - Cmds: &ast.List{}, + case meyer.AlterDropColumn: + name := identifier(n.Column) + return &ast.AlterTableStmt{ + Table: parseTableName(n.Table), + Cmds: &ast.List{Items: []ast.Node{ + &ast.AlterTableCmd{ + Name: &name, + Subtype: ast.AT_DropColumn, + }, + }}, } - name := n.Column_name(0).GetText() - stmt.Cmds.Items = append(stmt.Cmds.Items, &ast.AlterTableCmd{ - Name: &name, - Subtype: ast.AT_DropColumn, - }) - return stmt } - - return todo("convertAlter_table_stmtContext", n) + return todo("convertAlterTableStmt", n) } -func (c *cc) convertAttach_stmtContext(n *parser.Attach_stmtContext) ast.Node { - name := n.Schema_name().GetText() +// convertAttachStmt records an attached database as a schema. Only the name +// matters to sqlc; the file expression is a runtime concern. +func (c *cc) convertAttachStmt(n *meyer.AttachStmt) ast.Node { + name := schemaName(n.Name) return &ast.CreateSchemaStmt{ Name: &name, } } -func (c *cc) convertCreate_table_stmtContext(n *parser.Create_table_stmtContext) ast.Node { +// schemaName reads the schema out of the "AS " operand of ATTACH, +// which the grammar accepts as an arbitrary expression. +func schemaName(e meyer.Expr) string { + switch n := e.(type) { + case *meyer.Ident: + return identifier(n) + case *meyer.Literal: + return n.Value + default: + return "" + } +} + +// columnTypeName returns the declared type of a column, defaulting to +// SQLite's untyped "any" when the declaration omits one. +func columnTypeName(t *meyer.TypeName) string { + if t == nil { + return "any" + } + return typeName(t) +} + +func (c *cc) convertCreateTableStmt(n *meyer.CreateTableStmt) ast.Node { stmt := &ast.CreateTableStmt{ - Name: parseTableName(n), - IfNotExists: n.EXISTS_() != nil, - } - for _, idef := range n.AllColumn_def() { - if def, ok := idef.(*parser.Column_defContext); ok { - typeName := "any" - if def.Type_name() != nil { - typeName = def.Type_name().GetText() - } - stmt.Cols = append(stmt.Cols, &ast.ColumnDef{ - Colname: identifier(def.Column_name().GetText()), - IsNotNull: hasNotNullConstraint(def.AllColumn_constraint()), - TypeName: &ast.TypeName{Name: typeName}, - }) + Name: parseTableName(n.Name), + IfNotExists: n.IfNotExists, + // The node models none of these, so a statement carrying them has + // no faithful rendering and the formatter keeps it as written. + Incomplete: n.Temp || n.Select != nil || len(n.Constraints) > 0 || len(n.Options) > 0, + } + for _, def := range n.Columns { + if !representableColumn(def) { + stmt.Incomplete = true } + stmt.Cols = append(stmt.Cols, &ast.ColumnDef{ + Colname: identifier(def.Name), + IsNotNull: hasNotNullConstraint(def.Constraints), + PrimaryKey: hasPrimaryKeyConstraint(def.Constraints), + TypeName: &ast.TypeName{ + Name: columnTypeName(def.Type), + Spelling: typeSpelling(def.Type), + }, + Typeless: def.Type == nil, + Location: def.Pos(), + }) } return stmt } -func (c *cc) convertCreate_virtual_table_stmtContext(n *parser.Create_virtual_table_stmtContext) ast.Node { - switch moduleName := n.Module_name().GetText(); moduleName { +func (c *cc) convertCreateVirtualTableStmt(n *meyer.CreateVirtualTableStmt) ast.Node { + switch moduleName := identifier(n.Module); moduleName { case "fts5": // https://www.sqlite.org/fts5.html - return c.convertCreate_virtual_table_fts5(n) + return c.convertCreateVirtualTableFTS5(n) default: return todo( fmt.Sprintf("create_virtual_table. unsupported module name: %q", moduleName), @@ -141,1050 +321,865 @@ func (c *cc) convertCreate_virtual_table_stmtContext(n *parser.Create_virtual_ta } } -func (c *cc) convertCreate_virtual_table_fts5(n *parser.Create_virtual_table_stmtContext) ast.Node { +func (c *cc) convertCreateVirtualTableFTS5(n *meyer.CreateVirtualTableStmt) ast.Node { stmt := &ast.CreateTableStmt{ - Name: parseTableName(n), - IfNotExists: n.EXISTS_() != nil, - } - - for _, arg := range n.AllModule_argument() { - var columnName string - - // For example: CREATE VIRTUAL TABLE tbl_ft USING fts5(b, c UNINDEXED) - // * the 'b' column is parsed like Expr_qualified_column_nameContext - // * the 'c' column is parsed like Column_defContext - if columnExpr, ok := arg.Expr().(*parser.Expr_qualified_column_nameContext); ok { - columnName = columnExpr.Column_name().GetText() - } else if columnDef, ok := arg.Column_def().(*parser.Column_defContext); ok { - columnName = columnDef.Column_name().GetText() + Name: parseTableName(n.Name), + IfNotExists: n.IfNotExists, + Using: identifier(n.Module), + } + if n.HasArgs { + stmt.ModuleArgs = n.Args + if stmt.ModuleArgs == nil { + stmt.ModuleArgs = []string{} + } + // The arguments carry no spans of their own, so the author's exact + // breaks cannot be kept; a declaration written across lines keeps + // the canonical broken form instead. + if n.Pos() >= 0 && n.End() <= len(c.src) { + stmt.ModuleArgsMultiline = strings.Contains(c.src[n.Pos():n.End()], "\n") } + } - if columnName != "" { - stmt.Cols = append(stmt.Cols, &ast.ColumnDef{ - Colname: identifier(columnName), - // you can not specify any column constraints in fts5, so we pass them manually - IsNotNull: true, - TypeName: &ast.TypeName{Name: "text"}, - }) + // The module arguments of a virtual table are an arbitrary token + // sequence, so meyer hands them back as source text. For fts5 an + // argument is either a column ("b", or "c UNINDEXED") or one of the + // module's own options, which are always written as "key = value". + for _, arg := range n.Args { + name := fts5ColumnName(arg) + if name == "" { + continue } + stmt.Cols = append(stmt.Cols, &ast.ColumnDef{ + Colname: name, + // fts5 accepts no column constraints, so we supply them here + IsNotNull: true, + TypeName: &ast.TypeName{Name: "text"}, + }) } + // An fts5 table also offers hidden columns: one named after the table, + // matched against the whole row (`tbl MATCH ?`) and passed to the + // auxiliary functions (`bm25(tbl)`), `rank`, the current match's score, + // and `rowid`, which an external-content table maps to its content + // table. Hidden keeps them out of star expansions and the table's model. + stmt.Cols = append(stmt.Cols, + &ast.ColumnDef{ + Colname: stmt.Name.Name, + IsNotNull: true, + IsHidden: true, + TypeName: &ast.TypeName{Name: "text"}, + }, + &ast.ColumnDef{ + Colname: "rank", + IsHidden: true, + TypeName: &ast.TypeName{Name: "real"}, + }, + &ast.ColumnDef{ + Colname: "rowid", + IsNotNull: true, + IsHidden: true, + TypeName: &ast.TypeName{Name: "integer"}, + }, + ) + return stmt } -func (c *cc) convertCreate_view_stmtContext(n *parser.Create_view_stmtContext) ast.Node { - viewName := n.View_name().GetText() - relation := &ast.RangeVar{ - Relname: &viewName, +// fts5ColumnName returns the column an fts5 module argument declares, or the +// empty string when the argument configures the module instead. +func fts5ColumnName(arg string) string { + if strings.ContainsRune(arg, '=') { + return "" } + name, _, _ := strings.Cut(strings.TrimSpace(arg), " ") + return unquoteIdent(name) +} - if n.Schema_name() != nil { - schemaName := n.Schema_name().GetText() - relation.Schemaname = &schemaName +// unquoteIdent folds a name that has not been through the lexer, as happens +// for the raw module arguments of a virtual table. +func unquoteIdent(s string) string { + if len(s) >= 2 { + switch { + case s[0] == '"' && s[len(s)-1] == '"': + return strings.ReplaceAll(s[1:len(s)-1], `""`, `"`) + case s[0] == '`' && s[len(s)-1] == '`': + return strings.ReplaceAll(s[1:len(s)-1], "``", "`") + case s[0] == '[' && s[len(s)-1] == ']': + return s[1 : len(s)-1] + case s[0] == '\'' && s[len(s)-1] == '\'': + return strings.ReplaceAll(s[1:len(s)-1], `''`, `'`) + } } + return strings.ToLower(s) +} +func (c *cc) convertCreateViewStmt(n *meyer.CreateViewStmt) ast.Node { return &ast.ViewStmt{ - View: relation, + View: parseRangeVar(n.Name, nil), Aliases: &ast.List{}, - Query: c.convert(n.Select_stmt()), + Query: c.convert(n.Select), Replace: false, Options: &ast.List{}, WithCheckOption: ast.ViewCheckOption(0), } } -type Delete_stmt interface { - node - - Qualified_table_name() parser.IQualified_table_nameContext - WHERE_() antlr.TerminalNode - Expr() parser.IExprContext +func (c *cc) convertDropStmt(name *meyer.QualifiedName, ifExists bool) ast.Node { + return &ast.DropTableStmt{ + IfExists: ifExists, + Tables: []*ast.TableName{parseTableName(name)}, + } } -func (c *cc) convertDelete_stmtContext(n Delete_stmt) ast.Node { - if qualifiedName, ok := n.Qualified_table_name().(*parser.Qualified_table_nameContext); ok { - - tableName := qualifiedName.Table_name().GetText() - relation := &ast.RangeVar{ - Relname: &tableName, - } - - if qualifiedName.Schema_name() != nil { - schemaName := qualifiedName.Schema_name().GetText() - relation.Schemaname = &schemaName - } - - if qualifiedName.Alias() != nil { - alias := qualifiedName.Alias().GetText() - relation.Alias = &ast.Alias{Aliasname: &alias} - } - - relations := &ast.List{} - - relations.Items = append(relations.Items, relation) - - delete := &ast.DeleteStmt{ - Relations: relations, - WithClause: nil, - } - - if n.WHERE_() != nil && n.Expr() != nil { - delete.WhereClause = c.convert(n.Expr()) - } - - if n, ok := n.(interface { - Returning_clause() parser.IReturning_clauseContext - }); ok { - delete.ReturningList = c.convertReturning_caluseContext(n.Returning_clause()) - } else { - delete.ReturningList = c.convertReturning_caluseContext(nil) - } - if n, ok := n.(interface { - Limit_stmt() parser.ILimit_stmtContext - }); ok { - limitCount, _ := c.convertLimit_stmtContext(n.Limit_stmt()) - delete.LimitCount = limitCount - } - - return delete +func (c *cc) convertDeleteStmt(n *meyer.DeleteStmt) ast.Node { + return &ast.DeleteStmt{ + Relations: &ast.List{Items: []ast.Node{parseRangeVar(n.Table, n.Alias)}}, + WhereClause: c.convertExpr(n.Where), + LimitCount: c.limitCount(n.Limit), + ReturningList: c.convertReturning(n.Returning), + WithClause: c.convertWith(n.With), } - - return todo("convertDelete_stmtContext", n) } -func (c *cc) convertDrop_stmtContext(n *parser.Drop_stmtContext) ast.Node { - if n.TABLE_() != nil || n.VIEW_() != nil { - name := ast.TableName{ - Name: n.Any_name().GetText(), - } - if n.Schema_name() != nil { - name.Schema = n.Schema_name().GetText() - } - - return &ast.DropTableStmt{ - IfExists: n.EXISTS_() != nil, - Tables: []*ast.TableName{&name}, - } +// limitCount converts the LIMIT of an UPDATE or DELETE. sqlc has no place to +// put the OFFSET or the ORDER BY that can accompany it, so they are dropped. +func (c *cc) limitCount(n *meyer.Limit) ast.Node { + if n == nil { + return nil } - return todo("convertDrop_stmtContext", n) + return c.convertExpr(n.Count) } -func (c *cc) convertFuncContext(n *parser.Expr_functionContext) ast.Node { - if name, ok := n.Qualified_function_name().(*parser.Qualified_function_nameContext); ok { - funcName := strings.ToLower(name.Function_name().GetText()) - - schema := "" - if name.Schema_name() != nil { - schema = name.Schema_name().GetText() - } - - var argNodes []ast.Node - for _, exp := range n.AllExpr() { - argNodes = append(argNodes, c.convert(exp)) +func (c *cc) convertInsertStmt(n *meyer.InsertStmt) ast.Node { + insert := &ast.InsertStmt{ + Relation: parseRangeVar(n.Table, n.Alias), + Cols: c.convertColumnNames(n.Columns), + ReturningList: c.convertReturning(n.Returning), + WithClause: c.convertWith(n.With), + DefaultValues: n.DefaultValues, + } + if n.Select != nil { + if sel, ok := c.convertSelectStmt(n.Select).(*ast.SelectStmt); ok { + insert.SelectStmt = sel } - args := &ast.List{Items: argNodes} + } + if len(n.Upserts) > 0 { + insert.OnConflictClause = c.convertUpsert(n.Upserts[0]) + } + return insert +} - if funcName == "coalesce" { - return &ast.CoalesceExpr{ - Args: args, - Location: name.GetStart().GetStart(), - } - } else { - return &ast.FuncCall{ - Func: &ast.FuncName{ - Schema: schema, - Name: funcName, - }, - Funcname: &ast.List{ - Items: []ast.Node{ - NewIdentifier(funcName), - }, - }, - AggStar: n.STAR() != nil, - Args: args, - AggOrder: &ast.List{}, - AggDistinct: n.DISTINCT_() != nil, - Location: name.GetStart().GetStart(), - } +func (c *cc) convertUpsert(n *meyer.Upsert) *ast.OnConflictClause { + clause := &ast.OnConflictClause{ + Action: ast.OnConflictActionNothing, + Location: n.Pos(), + } + if len(n.Target) > 0 || n.TargetWhere != nil { + clause.Infer = &ast.InferClause{ + IndexElems: &ast.List{Items: c.convertOrderBy(n.Target)}, + WhereClause: c.convertExpr(n.TargetWhere), } } - - return todo("convertFuncContext", n) + if n.DoNothing { + return clause + } + clause.Action = ast.OnConflictActionUpdate + clause.TargetList = c.convertSetPairs(n.Set) + clause.WhereClause = c.convertExpr(n.Where) + return clause } -func (c *cc) convertExprContext(n *parser.ExprContext) ast.Node { - return &ast.Expr{} +func (c *cc) convertColumnNames(cols []*meyer.Ident) *ast.List { + list := &ast.List{Items: []ast.Node{}} + for _, col := range cols { + name := identifier(col) + list.Items = append(list.Items, &ast.ResTarget{ + Name: &name, + Location: col.Pos(), + }) + } + return list } -func (c *cc) convertColumnNameExpr(n *parser.Expr_qualified_column_nameContext) *ast.ColumnRef { - var items []ast.Node - if schema, ok := n.Schema_name().(*parser.Schema_nameContext); ok { - schemaText := schema.GetText() - if schemaText != "" { - items = append(items, NewIdentifier(schemaText)) +// convertSetPairs converts the assignment list of an UPDATE or of an upsert's +// DO UPDATE. SQLite allows "(a, b) = expr"; sqlc has no node for a +// multi-column assignment, so each name is given the same value expression. +func (c *cc) convertSetPairs(pairs []*meyer.SetPair) *ast.List { + list := &ast.List{} + for _, pair := range pairs { + val := c.convertExpr(pair.Value) + for _, col := range pair.Columns { + name := identifier(col) + list.Items = append(list.Items, &ast.ResTarget{ + Name: &name, + Val: val, + Location: col.Pos(), + }) } } - if table, ok := n.Table_name().(*parser.Table_nameContext); ok { - tableName := table.GetText() - if tableName != "" { - items = append(items, NewIdentifier(tableName)) - } + return list +} + +func (c *cc) convertUpdateStmt(n *meyer.UpdateStmt) ast.Node { + return &ast.UpdateStmt{ + Relations: &ast.List{Items: []ast.Node{parseRangeVar(n.Table, n.Alias)}}, + TargetList: c.convertSetPairs(n.Set), + FromClause: &ast.List{Items: c.convertFrom(n.From)}, + WhereClause: c.convertExpr(n.Where), + LimitCount: c.limitCount(n.Limit), + ReturningList: c.convertReturning(n.Returning), + WithClause: c.convertWith(n.With), } - items = append(items, NewIdentifier(n.Column_name().GetText())) - return &ast.ColumnRef{ - Fields: &ast.List{ - Items: items, - }, - Location: n.GetStart().GetStart(), +} + +func (c *cc) convertReturning(cols []*meyer.ResultColumn) *ast.List { + list := &ast.List{Items: []ast.Node{}} + for _, col := range cols { + list.Items = append(list.Items, &ast.ResTarget{ + Indirection: &ast.List{}, + Val: c.convertExpr(col.Expr), + Location: col.Pos(), + }) } + return list } -func (c *cc) convertComparison(n *parser.Expr_comparisonContext) ast.Node { - lexpr := c.convert(n.Expr(0)) +// +// SELECT +// - if n.IN_() != nil { - rexprs := []ast.Node{} - for _, expr := range n.AllExpr()[1:] { - e := c.convert(expr) - switch t := e.(type) { - case *ast.List: - rexprs = append(rexprs, t.Items...) - default: - rexprs = append(rexprs, t) +func (c *cc) convertSelectStmt(n *meyer.SelectStmt) ast.Node { + var stmt *ast.SelectStmt + for i, core := range n.Cores { + sel := c.convertSelectCore(core) + if stmt == nil { + stmt = sel + continue + } + op, all := ast.None, false + if i-1 < len(n.Ops) { + switch n.Ops[i-1].Op { + case "UNION": + op = ast.Union + all = n.Ops[i-1].All + case "INTERSECT": + op = ast.Intersect + case "EXCEPT": + op = ast.Except } } - - return &ast.In{ - Expr: lexpr, - List: rexprs, - Not: false, - Sel: nil, - Location: n.GetStart().GetStart(), + stmt = &ast.SelectStmt{ + TargetList: &ast.List{}, + FromClause: &ast.List{}, + Op: op, + All: all, + Larg: stmt, + Rarg: sel, } + // ORDER BY and LIMIT are written on the last core of a compound + // select but apply to the compound as a whole. + hoistTail(stmt, stmt.Rarg) } - - return &ast.A_Expr{ - Name: &ast.List{ - Items: []ast.Node{ - &ast.String{Str: "="}, // TODO: add actual comparison - }, - }, - Lexpr: lexpr, - Rexpr: c.convert(n.Expr(1)), + if stmt == nil { + return todo("convertSelectStmt", n) } + stmt.WithClause = c.convertWith(n.With) + return stmt } -func (c *cc) convertMultiSelect_stmtContext(n *parser.Select_stmtContext) ast.Node { - var ctes ast.List - if ct := n.Common_table_stmt(); ct != nil { - recursive := ct.RECURSIVE_() != nil - for _, cte := range ct.AllCommon_table_expression() { - tableName := identifier(cte.Table_name().GetText()) - var cteCols ast.List - for _, col := range cte.AllColumn_name() { - cteCols.Items = append(cteCols.Items, NewIdentifier(col.GetText())) - } - ctes.Items = append(ctes.Items, &ast.CommonTableExpr{ - Ctename: &tableName, - Ctequery: c.convert(cte.Select_stmt()), - Location: cte.GetStart().GetStart(), - Cterecursive: recursive, - Ctecolnames: &cteCols, - }) - } - } +// hoistTail moves the sort and limit clauses of a compound select's final +// core up onto the compound itself. +func hoistTail(outer, inner *ast.SelectStmt) { + outer.SortClause, inner.SortClause = inner.SortClause, nil + outer.LimitCount, inner.LimitCount = inner.LimitCount, nil + outer.LimitOffset, inner.LimitOffset = inner.LimitOffset, nil +} - var selectStmt *ast.SelectStmt - for s, icore := range n.AllSelect_core() { - core, ok := icore.(*parser.Select_coreContext) - if !ok { - continue +func (c *cc) convertSelectCore(core meyer.SelectCore) *ast.SelectStmt { + switch n := core.(type) { + case *meyer.SelectQuery: + stmt := &ast.SelectStmt{ + TargetList: &ast.List{Items: c.convertResultColumns(n.Columns)}, + FromClause: &ast.List{Items: c.convertFrom(n.From)}, + WhereClause: c.convertExpr(n.Where), + GroupClause: &ast.List{}, + HavingClause: c.convertExpr(n.Having), + WindowClause: &ast.List{}, + ValuesLists: &ast.List{}, } - cols := c.getCols(core) - tables := c.getTables(core) - - var where ast.Node - i := 0 - if core.WHERE_() != nil { - where = c.convert(core.Expr(i)) - i++ + for _, g := range n.GroupBy { + stmt.GroupClause.Items = append(stmt.GroupClause.Items, c.convert(g)) } - - var groups ast.List - var having ast.Node - if core.GROUP_() != nil { - l := len(core.AllExpr()) - i - if core.HAVING_() != nil { - having = c.convert(core.Expr(l)) - l-- - } - - for i < l { - groups.Items = append(groups.Items, c.convert(core.Expr(i))) - i++ - } + if n.Distinct == meyer.DistinctDistinct { + // SQLite has no DISTINCT ON, so the clause carries no columns. + stmt.DistinctClause = &ast.List{Items: []ast.Node{&ast.TODO{}}} } - var window ast.List - if core.WINDOW_() != nil { - for w, windowNameCtx := range core.AllWindow_name() { - windowName := identifier(windowNameCtx.GetText()) - windowDef := core.Window_defn(w) - - _ = windowDef.Base_window_name() - var partitionBy ast.List - if windowDef.PARTITION_() != nil { - for _, e := range windowDef.AllExpr() { - partitionBy.Items = append(partitionBy.Items, c.convert(e)) - } - } - var orderBy ast.List - if windowDef.ORDER_() != nil { - for _, e := range windowDef.AllOrdering_term() { - oterm := e.(*parser.Ordering_termContext) - sortByDir := ast.SortByDirDefault - if ad := oterm.Asc_desc(); ad != nil { - if ad.ASC_() != nil { - sortByDir = ast.SortByDirAsc - } else { - sortByDir = ast.SortByDirDesc - } - } - sortByNulls := ast.SortByNullsDefault - if oterm.NULLS_() != nil { - if oterm.FIRST_() != nil { - sortByNulls = ast.SortByNullsFirst - } else { - sortByNulls = ast.SortByNullsLast - } - } - - orderBy.Items = append(orderBy.Items, &ast.SortBy{ - Node: c.convert(oterm.Expr()), - SortbyDir: sortByDir, - SortbyNulls: sortByNulls, - UseOp: &ast.List{}, - }) - } - } - window.Items = append(window.Items, &ast.WindowDef{ - Name: &windowName, - PartitionClause: &partitionBy, - OrderClause: &orderBy, - FrameOptions: 0, // todo - StartOffset: &ast.TODO{}, - EndOffset: &ast.TODO{}, - Location: windowNameCtx.GetStart().GetStart(), - }) - } + for _, w := range n.Windows { + stmt.WindowClause.Items = append(stmt.WindowClause.Items, c.convertWindowDef(w)) } - sel := &ast.SelectStmt{ - FromClause: &ast.List{Items: tables}, - TargetList: &ast.List{Items: cols}, - WhereClause: where, - GroupClause: &groups, - HavingClause: having, - WindowClause: &window, - ValuesLists: &ast.List{}, + if len(n.OrderBy) > 0 { + stmt.SortClause = &ast.List{Items: c.convertOrderBy(n.OrderBy)} } - if selectStmt == nil { - selectStmt = sel - } else { - co := n.Compound_operator(s - 1) - so := ast.None - all := false - switch { - case co.UNION_() != nil: - so = ast.Union - all = co.ALL_() != nil - case co.INTERSECT_() != nil: - so = ast.Intersect - case co.EXCEPT_() != nil: - so = ast.Except - } - selectStmt = &ast.SelectStmt{ - TargetList: &ast.List{}, - FromClause: &ast.List{}, - Op: so, - All: all, - Larg: selectStmt, - Rarg: sel, - } + if n.Limit != nil { + stmt.LimitCount = c.convertExpr(n.Limit.Count) + stmt.LimitOffset = c.convertExpr(n.Limit.Offset) } - } - - limitCount, limitOffset := c.convertLimit_stmtContext(n.Limit_stmt()) - selectStmt.LimitCount = limitCount - selectStmt.LimitOffset = limitOffset - selectStmt.WithClause = &ast.WithClause{Ctes: &ctes} - return selectStmt -} + return stmt -func (c *cc) convertExprListContext(n *parser.Expr_listContext) ast.Node { - list := &ast.List{Items: []ast.Node{}} - for _, e := range n.AllExpr() { - list.Items = append(list.Items, c.convert(e)) - } - return list -} + case *meyer.ValuesClause: + values := &ast.List{} + for _, row := range n.Rows { + values.Items = append(values.Items, c.convertExprList(row)) + } + return &ast.SelectStmt{ + TargetList: &ast.List{}, + FromClause: &ast.List{}, + ValuesLists: values, + } -func (c *cc) getTables(core *parser.Select_coreContext) []ast.Node { - if core.Join_clause() != nil { - join := core.Join_clause().(*parser.Join_clauseContext) - tables := c.convertTablesOrSubquery(join.AllTable_or_subquery()) - table := tables[0] - for i, t := range tables[1:] { - joinExpr := &ast.JoinExpr{ - Larg: table, - Rarg: t, - } - jo := join.Join_operator(i) - if jo.NATURAL_() != nil { - joinExpr.IsNatural = true - } - switch { - case jo.CROSS_() != nil || jo.INNER_() != nil: - joinExpr.Jointype = ast.JoinTypeInner - case jo.LEFT_() != nil: - joinExpr.Jointype = ast.JoinTypeLeft - case jo.RIGHT_() != nil: - joinExpr.Jointype = ast.JoinTypeRight - case jo.FULL_() != nil: - joinExpr.Jointype = ast.JoinTypeFull - } - jc := join.Join_constraint(i) - switch { - case jc.ON_() != nil: - joinExpr.Quals = c.convert(jc.Expr()) - case jc.USING_() != nil: - var using ast.List - for _, cn := range jc.AllColumn_name() { - using.Items = append(using.Items, NewIdentifier(cn.GetText())) - } - joinExpr.UsingClause = &using - } - table = joinExpr + default: + return &ast.SelectStmt{ + TargetList: &ast.List{}, + FromClause: &ast.List{}, + ValuesLists: &ast.List{}, } - return []ast.Node{table} - } else { - return c.convertTablesOrSubquery(core.AllTable_or_subquery()) } } -func (c *cc) getCols(core *parser.Select_coreContext) []ast.Node { - var cols []ast.Node - for _, icol := range core.AllResult_column() { - col, ok := icol.(*parser.Result_columnContext) - if !ok { +func (c *cc) convertResultColumns(cols []*meyer.ResultColumn) []ast.Node { + var out []ast.Node + for _, col := range cols { + val := c.convertExpr(col.Expr) + if val == nil { continue } target := &ast.ResTarget{ - Location: col.GetStart().GetStart(), + Val: val, + Location: col.Pos(), } - var val ast.Node - iexpr := col.Expr() - switch { - case col.STAR() != nil: - val = c.convertWildCardField(col) - case iexpr != nil: - val = c.convert(iexpr) + if col.Alias != nil { + name := identifier(col.Alias) + target.Name = &name } + out = append(out, target) + } + return out +} - if val == nil { - continue +func (c *cc) convertOrderBy(terms []*meyer.OrderingTerm) []ast.Node { + var out []ast.Node + for _, term := range terms { + sortBy := &ast.SortBy{ + Node: c.convertExpr(term.Expr), + UseOp: &ast.List{}, + Location: term.Pos(), } - - if col.Column_alias() != nil { - name := identifier(col.Column_alias().GetText()) - target.Name = &name + switch term.Order { + case meyer.SortAsc: + sortBy.SortbyDir = ast.SortByDirAsc + case meyer.SortDesc: + sortBy.SortbyDir = ast.SortByDirDesc + default: + sortBy.SortbyDir = ast.SortByDirDefault } - - target.Val = val - cols = append(cols, target) + switch term.Nulls { + case meyer.NullsFirst: + sortBy.SortbyNulls = ast.SortByNullsFirst + case meyer.NullsLast: + sortBy.SortbyNulls = ast.SortByNullsLast + default: + sortBy.SortbyNulls = ast.SortByNullsDefault + } + out = append(out, sortBy) } - return cols + return out } -func (c *cc) convertWildCardField(n *parser.Result_columnContext) *ast.ColumnRef { - items := []ast.Node{} - if n.Table_name() != nil { - items = append(items, NewIdentifier(n.Table_name().GetText())) +func (c *cc) convertWindowDef(n *meyer.WindowDef) ast.Node { + def := &ast.WindowDef{ + PartitionClause: c.convertExprList(n.Partition), + OrderClause: &ast.List{Items: c.convertOrderBy(n.OrderBy)}, + Location: n.Pos(), } - items = append(items, &ast.A_Star{}) + if n.Name != nil { + name := identifier(n.Name) + def.Name = &name + } + if n.Base != nil { + base := identifier(n.Base) + def.Refname = &base + } + return def +} - return &ast.ColumnRef{ - Fields: &ast.List{ - Items: items, - }, - Location: n.GetStart().GetStart(), +func (c *cc) convertWith(n *meyer.With) *ast.WithClause { + if n == nil || len(n.CTEs) == 0 { + return nil + } + ctes := &ast.List{} + for _, cte := range n.CTEs { + name := identifier(cte.Name) + cols := &ast.List{} + for _, col := range cte.Columns { + cols.Items = append(cols.Items, NewIdentifier(col)) + } + ctes.Items = append(ctes.Items, &ast.CommonTableExpr{ + Ctename: &name, + Ctequery: c.convert(cte.Select), + Location: cte.Pos(), + Cterecursive: n.Recursive, + Ctecolnames: cols, + }) + } + return &ast.WithClause{ + Ctes: ctes, + Recursive: n.Recursive, + Location: n.Pos(), } } -func (c *cc) convertOrderby_stmtContext(n parser.IOrder_by_stmtContext) ast.Node { - if orderBy, ok := n.(*parser.Order_by_stmtContext); ok { - list := &ast.List{Items: []ast.Node{}} - for _, o := range orderBy.AllOrdering_term() { - term, ok := o.(*parser.Ordering_termContext) - if !ok { - continue +// convertFrom converts a SQLite source list. The list is flat, with each +// item recording how it attaches to the one before it, so a chain of joins +// is rebuilt here as a left-leaning tree. A list joined only by commas has +// no join conditions to carry and stays flat. +func (c *cc) convertFrom(refs []*meyer.TableRef) []ast.Node { + if len(refs) == 0 { + return nil + } + if commaOnly(refs) { + out := make([]ast.Node, 0, len(refs)) + for _, ref := range refs { + out = append(out, c.convertTableRef(ref)) + } + return out + } + table := c.convertTableRef(refs[0]) + for _, ref := range refs[1:] { + join := &ast.JoinExpr{ + Larg: table, + Rarg: c.convertTableRef(ref), + } + if op := ref.Join; op != nil { + join.IsNatural = op.Type&meyer.JoinNatural != 0 + left := op.Type&meyer.JoinLeft != 0 + right := op.Type&meyer.JoinRight != 0 + switch { + case left && right: + join.Jointype = ast.JoinTypeFull + case left: + join.Jointype = ast.JoinTypeLeft + case right: + join.Jointype = ast.JoinTypeRight + case op.Type&meyer.JoinComma != 0: + join.Jointype = ast.JoinTypeComma + case op.Type&meyer.JoinCross != 0: + join.Jointype = ast.JoinTypeCross + default: + join.Jointype = ast.JoinTypeInner } - list.Items = append(list.Items, &ast.CaseExpr{ - Xpr: c.convert(term.Expr()), - Location: term.Expr().GetStart().GetStart(), - }) } - return list + if ref.On != nil { + join.Quals = c.convert(ref.On) + } + if len(ref.Using) > 0 { + using := &ast.List{} + for _, col := range ref.Using { + using.Items = append(using.Items, NewIdentifier(col)) + } + join.UsingClause = using + } + table = join } - return todo("convertOrderby_stmtContext", n) + return []ast.Node{table} } -func (c *cc) convertLimit_stmtContext(n parser.ILimit_stmtContext) (ast.Node, ast.Node) { - if n == nil { - return nil, nil +func commaOnly(refs []*meyer.TableRef) bool { + for _, ref := range refs[1:] { + if ref.Join == nil || ref.Join.Type&meyer.JoinComma == 0 { + return false + } } + return true +} - var limitCount, limitOffset ast.Node - if limit, ok := n.(*parser.Limit_stmtContext); ok { - limitCount = c.convert(limit.Expr(0)) - if limit.OFFSET_() != nil { - limitOffset = c.convert(limit.Expr(1)) +func (c *cc) convertTableRef(n *meyer.TableRef) ast.Node { + switch { + case n.Name != nil && n.HasArgs: + // A table-valued function, such as generate_series(1, 10). + fn := &ast.FuncCall{ + Func: &ast.FuncName{Name: identifier(n.Name.Name)}, + Funcname: &ast.List{Items: []ast.Node{NewIdentifier(n.Name.Name)}}, + Args: c.convertExprList(n.Args), + Location: n.Pos(), } - } + if n.Name.Schema != nil { + fn.Func.Schema = identifier(n.Name.Schema) + } + rf := &ast.RangeFunction{ + Functions: &ast.List{Items: []ast.Node{fn}}, + } + if n.Alias != nil { + alias := identifier(n.Alias) + rf.Alias = &ast.Alias{Aliasname: &alias} + } + return rf - return limitCount, limitOffset -} + case n.Name != nil: + rv := parseRangeVar(n.Name, n.Alias) + rv.Location = n.Pos() + return rv -func (c *cc) convertSql_stmtContext(n *parser.Sql_stmtContext) ast.Node { - if stmt := n.Alter_table_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Analyze_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Attach_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Begin_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Commit_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Create_index_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Create_table_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Create_trigger_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Create_view_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Create_virtual_table_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Delete_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Delete_stmt_limited(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Detach_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Drop_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Insert_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Pragma_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Reindex_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Release_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Rollback_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Savepoint_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Select_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Update_stmt(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Update_stmt_limited(); stmt != nil { - return c.convert(stmt) - } - if stmt := n.Vacuum_stmt(); stmt != nil { - return c.convert(stmt) + case n.Select != nil: + rs := &ast.RangeSubselect{ + Subquery: c.convert(n.Select), + } + if n.Alias != nil { + alias := identifier(n.Alias) + rs.Alias = &ast.Alias{Aliasname: &alias} + } + return rs + + case len(n.List) > 0: + // A parenthesized source list, as in "FROM (a JOIN b ON ...)". + nested := c.convertFrom(n.List) + if len(nested) == 1 { + return nested[0] + } + return &ast.List{Items: nested} } - return nil + return todo("convertTableRef", n) } -func (c *cc) convertLiteral(n *parser.Expr_literalContext) ast.Node { - if literal, ok := n.Literal_value().(*parser.Literal_valueContext); ok { +// +// Expressions +// - if literal.NUMERIC_LITERAL() != nil { - i, _ := strconv.ParseInt(literal.GetText(), 10, 64) +func (c *cc) convertLiteral(n *meyer.Literal) ast.Node { + switch n.Kind { + case meyer.LitInteger: + if i, ok := parseInteger(n.Value); ok { return &ast.A_Const{ Val: &ast.Integer{Ival: i}, - Location: n.GetStart().GetStart(), + Location: n.Pos(), } } + // Too wide for an int64, or written with the digit separators + // SQLite accepts. Either way the value is still numeric. + return &ast.A_Const{ + Val: &ast.Float{Str: n.Value}, + Location: n.Pos(), + } - if literal.STRING_LITERAL() != nil { - // remove surrounding single quote - text := literal.GetText() - return &ast.A_Const{ - Val: &ast.String{Str: text[1 : len(text)-1]}, - Location: n.GetStart().GetStart(), - } + case meyer.LitFloat: + return &ast.A_Const{ + Val: &ast.Float{Str: n.Value}, + Location: n.Pos(), } - if literal.TRUE_() != nil || literal.FALSE_() != nil { - var i int64 - if literal.TRUE_() != nil { - i = 1 - } + case meyer.LitString, meyer.LitBlob: + return &ast.A_Const{ + Val: &ast.String{Str: n.Value}, + Location: n.Pos(), + } - return &ast.A_Const{ - Val: &ast.Integer{Ival: i}, - Location: n.GetStart().GetStart(), - } + case meyer.LitNull: + return &ast.A_Const{ + Val: &ast.Null{}, + Location: n.Pos(), } } - return todo("convertLiteral", n) -} - -func (c *cc) convertMathOperationNode(n *parser.Expr_math_opContext) ast.Node { - return &ast.A_Expr{ - Name: &ast.List{ - Items: []ast.Node{ - &ast.String{Str: "+"}, // todo: Convert operation types - }, - }, - Lexpr: c.convert(n.Expr(0)), - Rexpr: c.convert(n.Expr(1)), + // CURRENT_DATE, CURRENT_TIME and CURRENT_TIMESTAMP are keywords rather + // than function calls, but behave like niladic functions. + name := strings.ToLower(n.Raw) + return &ast.FuncCall{ + Func: &ast.FuncName{Name: name}, + Funcname: &ast.List{Items: []ast.Node{&ast.String{Str: name}}}, + Args: &ast.List{}, + AggOrder: &ast.List{}, + Location: n.Pos(), } } -func (c *cc) convertBinaryNode(n *parser.Expr_binaryContext) ast.Node { - return &ast.BoolExpr{ - // TODO: Set op - Args: &ast.List{ - Items: []ast.Node{ - c.convert(n.Expr(0)), - c.convert(n.Expr(1)), - }, - }, +// parseInteger reads an integer literal in either of the two forms SQLite +// writes: decimal, where a leading zero is not an octal prefix, and +// hexadecimal. +func parseInteger(s string) (int64, bool) { + if len(s) > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X') { + i, err := strconv.ParseInt(s[2:], 16, 64) + return i, err == nil } + i, err := strconv.ParseInt(s, 10, 64) + return i, err == nil } -func (c *cc) convertParam(n *parser.Expr_bindContext) ast.Node { - if n.NUMBERED_BIND_PARAMETER() != nil { - // Parameter numbers start at one +func (c *cc) convertBindParam(n *meyer.BindParam) ast.Node { + switch n.Kind { + case meyer.ParamAnon, meyer.ParamNumber: + // Parameter numbers start at one. c.paramCount += 1 - - text := n.GetText() number := c.paramCount - if len(text) > 1 { - number, _ = strconv.Atoi(text[1:]) + if n.Kind == meyer.ParamNumber { + number = n.Number } return &ast.ParamRef{ Number: number, - Location: n.GetStart().GetStart(), - Dollar: len(text) > 1, + Location: n.Pos(), + Dollar: n.Kind == meyer.ParamNumber, + } + default: + // A named parameter. sqlc carries the name through as the operand of + // a pseudo-operator and resolves it later. The operator is the + // parameter's own sigil, so the formatter can print the spelling the + // author chose — SQLite accepts :name, @name and $name, but sqlc + // gives them different meanings, so they must never be rewritten + // into one another. + sigil := "@" + switch n.Kind { + case meyer.ParamColon: + sigil = ":" + case meyer.ParamDollar: + sigil = "$" } - } - - if n.NAMED_BIND_PARAMETER() != nil { return &ast.A_Expr{ - Name: &ast.List{Items: []ast.Node{&ast.String{Str: "@"}}}, - Rexpr: &ast.String{Str: n.GetText()[1:]}, - Location: n.GetStart().GetStart(), + Name: &ast.List{Items: []ast.Node{&ast.String{Str: sigil}}}, + Rexpr: &ast.String{Str: n.Name}, + Location: n.Pos(), } } - - return todo("convertParam", n) -} - -func (c *cc) convertInSelectNode(n *parser.Expr_in_selectContext) ast.Node { - return c.convert(n.Select_stmt()) } -func (c *cc) convertReturning_caluseContext(n parser.IReturning_clauseContext) *ast.List { - list := &ast.List{Items: []ast.Node{}} - if n == nil { - return list - } - - r, ok := n.(*parser.Returning_clauseContext) - if !ok { - return list - } - - for _, exp := range r.AllExpr() { - list.Items = append(list.Items, &ast.ResTarget{ - Indirection: &ast.List{}, - Val: c.convert(exp), - }) - } - - for _, star := range r.AllSTAR() { - list.Items = append(list.Items, &ast.ResTarget{ - Indirection: &ast.List{}, - Val: &ast.ColumnRef{ - Fields: &ast.List{ - Items: []ast.Node{&ast.A_Star{}}, - }, - Location: star.GetSymbol().GetStart(), - }, - Location: star.GetSymbol().GetStart(), - }) - } - - return list -} - -func (c *cc) convertInsert_stmtContext(n *parser.Insert_stmtContext) ast.Node { - tableName := n.Table_name().GetText() - rel := &ast.RangeVar{ - Relname: &tableName, - } - if n.Schema_name() != nil { - schemaName := n.Schema_name().GetText() - rel.Schemaname = &schemaName - } - if n.Table_alias() != nil { - tableAlias := identifier(n.Table_alias().GetText()) - rel.Alias = &ast.Alias{ - Aliasname: &tableAlias, +func (c *cc) convertBinaryExpr(n *meyer.BinaryExpr) ast.Node { + switch n.Op { + case meyer.OpAnd, meyer.OpOr: + op := ast.BoolExprTypeAnd + if n.Op == meyer.OpOr { + op = ast.BoolExprTypeOr + } + return &ast.BoolExpr{ + Boolop: op, + Args: &ast.List{Items: []ast.Node{ + c.convert(n.X), + c.convert(n.Y), + }}, + Location: n.Pos(), } } - - insert := &ast.InsertStmt{ - Relation: rel, - Cols: c.convertColumnNames(n.AllColumn_name()), - ReturningList: c.convertReturning_caluseContext(n.Returning_clause()), - } - - if n.Select_stmt() != nil { - if ss, ok := c.convert(n.Select_stmt()).(*ast.SelectStmt); ok { - ss.ValuesLists = &ast.List{} - insert.SelectStmt = ss - } - } else { - var valuesLists ast.List - var values *ast.List - for _, cn := range n.GetChildren() { - switch cn := cn.(type) { - case antlr.TerminalNode: - switch cn.GetSymbol().GetTokenType() { - case parser.SQLiteParserVALUES_: - values = &ast.List{} - case parser.SQLiteParserOPEN_PAR: - if values != nil { - values = &ast.List{} - } - case parser.SQLiteParserCOMMA: - case parser.SQLiteParserCLOSE_PAR: - if values != nil { - valuesLists.Items = append(valuesLists.Items, values) - } - } - case parser.IExprContext: - if values != nil { - values.Items = append(values.Items, c.convert(cn)) - } - } + // SQLite spells some operators two ways (<> and !=, = and ==) and the + // tree keeps only the kind, so read the author's choice back out of the + // source between the operands; the compiler recognizes every spelling. + op := n.Op.String() + switch n.Op { + case meyer.OpNe: + if strings.Contains(c.operatorText(n.X, n.Y), "!=") { + op = "!=" } - - insert.SelectStmt = &ast.SelectStmt{ - FromClause: &ast.List{}, - TargetList: &ast.List{}, - ValuesLists: &valuesLists, + case meyer.OpEq: + if strings.Contains(c.operatorText(n.X, n.Y), "==") { + op = "==" } } - - return insert + return &ast.A_Expr{ + Name: &ast.List{Items: []ast.Node{&ast.String{Str: op}}}, + Lexpr: c.convert(n.X), + Rexpr: c.convert(n.Y), + Location: n.Pos(), + } } -func (c *cc) convertColumnNames(cols []parser.IColumn_nameContext) *ast.List { - list := &ast.List{Items: []ast.Node{}} - for _, c := range cols { - name := identifier(c.GetText()) - list.Items = append(list.Items, &ast.ResTarget{ - Name: &name, - }) +// operatorText returns the source text separating two adjacent operands, +// where the operator token sits. +func (c *cc) operatorText(x, y meyer.Expr) string { + start, end := x.End(), y.Pos() + if start < 0 || end > len(c.src) || start > end { + return "" } - return list + return c.src[start:end] } -func (c *cc) convertTablesOrSubquery(n []parser.ITable_or_subqueryContext) []ast.Node { - var tables []ast.Node - for _, ifrom := range n { - from, ok := ifrom.(*parser.Table_or_subqueryContext) - if !ok { - continue +func (c *cc) convertUnaryExpr(n *meyer.UnaryExpr) ast.Node { + expr := c.convert(n.X) + switch n.Op { + case meyer.OpNot: + return &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{Items: []ast.Node{expr}}, + Location: n.Pos(), } - - if from.Table_name() != nil { - rel := from.Table_name().GetText() - rv := &ast.RangeVar{ - Relname: &rel, - Location: from.GetStart().GetStart(), - } - - if from.Schema_name() != nil { - schema := from.Schema_name().GetText() - rv.Schemaname = &schema - } - if from.Table_alias() != nil { - alias := identifier(from.Table_alias().GetText()) - rv.Alias = &ast.Alias{Aliasname: &alias} - } - if from.Table_alias_fallback() != nil { - alias := identifier(from.Table_alias_fallback().GetText()) - rv.Alias = &ast.Alias{Aliasname: &alias} - } - - tables = append(tables, rv) - } else if from.Table_function_name() != nil { - rel := from.Table_function_name().GetText() - rf := &ast.RangeFunction{ - Functions: &ast.List{ - Items: []ast.Node{ - &ast.FuncCall{ - Func: &ast.FuncName{ - Name: rel, - }, - Funcname: &ast.List{ - Items: []ast.Node{ - NewIdentifier(rel), - }, - }, - Args: &ast.List{ - Items: []ast.Node{&ast.TODO{}}, - }, - Location: from.GetStart().GetStart(), - }, - }, - }, - } - - if from.Table_alias() != nil { - alias := identifier(from.Table_alias().GetText()) - rf.Alias = &ast.Alias{Aliasname: &alias} - } - - tables = append(tables, rf) - } else if from.Select_stmt() != nil { - rs := &ast.RangeSubselect{ - Subquery: c.convert(from.Select_stmt()), - } - - if from.Table_alias() != nil { - alias := identifier(from.Table_alias().GetText()) - rs.Alias = &ast.Alias{Aliasname: &alias} - } - - tables = append(tables, rs) + case meyer.OpPlus: + // A unary plus is a no-op on every operand SQLite accepts. + return expr + default: + return &ast.A_Expr{ + Name: &ast.List{Items: []ast.Node{&ast.String{Str: n.Op.String()}}}, + Rexpr: expr, + Location: n.Pos(), } } - - return tables } -type Update_stmt interface { - Qualified_table_name() parser.IQualified_table_nameContext - GetStart() antlr.Token - AllColumn_name() []parser.IColumn_nameContext - WHERE_() antlr.TerminalNode - Expr(i int) parser.IExprContext - AllExpr() []parser.IExprContext +func (c *cc) convertIsExpr(n *meyer.IsExpr) ast.Node { + expr := &ast.A_Expr{ + Lexpr: c.convert(n.X), + Rexpr: c.convert(n.Y), + Location: n.Pos(), + } + var name string + switch { + case n.Distinct && n.Not: + expr.Kind = ast.A_Expr_Kind_NOT_DISTINCT + name = "IS NOT DISTINCT FROM" + case n.Distinct: + expr.Kind = ast.A_Expr_Kind_DISTINCT + name = "IS DISTINCT FROM" + case n.Not: + name = "IS NOT" + default: + name = "IS" + } + expr.Name = &ast.List{Items: []ast.Node{&ast.String{Str: name}}} + return expr } -func (c *cc) convertUpdate_stmtContext(n Update_stmt) ast.Node { - if n == nil { - return nil +func (c *cc) convertNullCheckExpr(n *meyer.NullCheckExpr) ast.Node { + name := "NOT NULL" + switch n.Test { + case meyer.TestIsNull: + name = "ISNULL" + case meyer.TestNotNull: + name = "NOTNULL" } - - relations := &ast.List{} - tableName := n.Qualified_table_name().GetText() - rel := ast.RangeVar{ - Relname: &tableName, - Location: n.GetStart().GetStart(), + return &ast.A_Expr{ + Name: &ast.List{Items: []ast.Node{&ast.String{Str: name}}}, + Lexpr: c.convert(n.X), + Location: n.Pos(), } - relations.Items = append(relations.Items, &rel) +} - list := &ast.List{} - for i, col := range n.AllColumn_name() { - colName := identifier(col.GetText()) - target := &ast.ResTarget{ - Name: &colName, - Val: c.convert(n.Expr(i)), - } - list.Items = append(list.Items, target) +func (c *cc) convertLikeExpr(n *meyer.LikeExpr) ast.Node { + name := strings.ToUpper(n.Op.Name) + if n.Not { + name = "NOT " + name + } + return &ast.A_Expr{ + Name: &ast.List{Items: []ast.Node{&ast.String{Str: name}}}, + Lexpr: c.convert(n.X), + Rexpr: c.convert(n.Y), + Location: n.Pos(), } +} - var where ast.Node = nil - if n.WHERE_() != nil { - where = c.convert(n.Expr(len(n.AllExpr()) - 1)) +func (c *cc) convertInExpr(n *meyer.InExpr) ast.Node { + if n.Select != nil { + sublink := &ast.SubLink{ + SubLinkType: ast.ANY_SUBLINK, + Testexpr: c.convert(n.X), + Subselect: c.convertSelectStmt(n.Select), + Location: n.Pos(), + } + if !n.Not { + return sublink + } + return &ast.BoolExpr{ + Boolop: ast.BoolExprTypeNot, + Args: &ast.List{Items: []ast.Node{sublink}}, + Location: n.Pos(), + } } - stmt := &ast.UpdateStmt{ - Relations: relations, - TargetList: list, - WhereClause: where, - FromClause: &ast.List{}, - WithClause: nil, // TODO: support with clause + in := &ast.In{ + Expr: c.convert(n.X), + Not: n.Not, + Location: n.Pos(), } - if n, ok := n.(interface { - Returning_clause() parser.IReturning_clauseContext - }); ok { - stmt.ReturningList = c.convertReturning_caluseContext(n.Returning_clause()) - } else { - stmt.ReturningList = c.convertReturning_caluseContext(nil) + if n.Table != nil { + // "expr IN table" tests membership in the table's single column. + in.Sel = parseRangeVar(n.Table, nil) + return in } - if n, ok := n.(interface { - Limit_stmt() parser.ILimit_stmtContext - }); ok { - limitCount, _ := c.convertLimit_stmtContext(n.Limit_stmt()) - stmt.LimitCount = limitCount + for _, e := range n.List { + in.List = append(in.List, c.convert(e)) } - return stmt + return in } -func (c *cc) convertBetweenExpr(n *parser.Expr_betweenContext) ast.Node { +func (c *cc) convertBetweenExpr(n *meyer.BetweenExpr) ast.Node { return &ast.BetweenExpr{ - Expr: c.convert(n.Expr(0)), - Left: c.convert(n.Expr(1)), - Right: c.convert(n.Expr(2)), - Location: n.GetStart().GetStart(), - Not: n.NOT_() != nil, + Expr: c.convert(n.X), + Left: c.convert(n.Lo), + Right: c.convert(n.Hi), + Not: n.Not, + Location: n.Pos(), } } -func (c *cc) convertCastExpr(n *parser.Expr_castContext) ast.Node { - name := n.Type_name().GetText() +func (c *cc) convertCastExpr(n *meyer.CastExpr) ast.Node { + name := typeName(n.Type) return &ast.TypeCast{ - Arg: c.convert(n.Expr()), + Arg: c.convert(n.X), TypeName: &ast.TypeName{ - Name: name, - Names: &ast.List{Items: []ast.Node{ - NewIdentifier(name), - }}, + Name: name, + Spelling: typeSpelling(n.Type), + Names: &ast.List{Items: []ast.Node{&ast.String{Str: strings.ToLower(name)}}}, ArrayBounds: &ast.List{}, }, - Location: n.GetStart().GetStart(), + Location: n.Pos(), } } -func (c *cc) convertCollateExpr(n *parser.Expr_collateContext) ast.Node { +func (c *cc) convertCollateExpr(n *meyer.CollateExpr) ast.Node { return &ast.CollateExpr{ - Xpr: c.convert(n.Expr()), - Arg: NewIdentifier(n.Collation_name().GetText()), - Location: n.GetStart().GetStart(), + Xpr: c.convert(n.X), + Arg: NewIdentifier(n.Name), + Location: n.Pos(), } } -func (c *cc) convert(node node) ast.Node { - switch n := node.(type) { - - case *parser.Alter_table_stmtContext: - return c.convertAlter_table_stmtContext(n) - - case *parser.Attach_stmtContext: - return c.convertAttach_stmtContext(n) - - case *parser.Create_table_stmtContext: - return c.convertCreate_table_stmtContext(n) - - case *parser.Create_virtual_table_stmtContext: - return c.convertCreate_virtual_table_stmtContext(n) - - case *parser.Create_view_stmtContext: - return c.convertCreate_view_stmtContext(n) - - case *parser.Drop_stmtContext: - return c.convertDrop_stmtContext(n) - - case *parser.Delete_stmtContext: - return c.convertDelete_stmtContext(n) - - case *parser.Delete_stmt_limitedContext: - return c.convertDelete_stmtContext(n) - - case *parser.ExprContext: - return c.convertExprContext(n) - - case *parser.Expr_functionContext: - return c.convertFuncContext(n) - - case *parser.Expr_qualified_column_nameContext: - return c.convertColumnNameExpr(n) - - case *parser.Expr_comparisonContext: - return c.convertComparison(n) - - case *parser.Expr_bindContext: - return c.convertParam(n) - - case *parser.Expr_literalContext: - return c.convertLiteral(n) - - case *parser.Expr_binaryContext: - return c.convertBinaryNode(n) - - case *parser.Expr_listContext: - return c.convertExprListContext(n) - - case *parser.Expr_math_opContext: - return c.convertMathOperationNode(n) - - case *parser.Expr_in_selectContext: - return c.convertInSelectNode(n) - - case *parser.Expr_betweenContext: - return c.convertBetweenExpr(n) - - case *parser.Expr_collateContext: - return c.convertCollateExpr(n) - - case *parser.Factored_select_stmtContext: - // TODO: need to handle this - return todo("convert(case=parser.Factored_select_stmtContext)", n) - - case *parser.Insert_stmtContext: - return c.convertInsert_stmtContext(n) - - case *parser.Order_by_stmtContext: - return c.convertOrderby_stmtContext(n) - - case *parser.Select_stmtContext: - return c.convertMultiSelect_stmtContext(n) - - case *parser.Sql_stmtContext: - return c.convertSql_stmtContext(n) - - case *parser.Update_stmtContext: - return c.convertUpdate_stmtContext(n) +func (c *cc) convertCaseExpr(n *meyer.CaseExpr) ast.Node { + expr := &ast.CaseExpr{ + Arg: c.convertExpr(n.Operand), + Args: &ast.List{}, + Defresult: c.convertExpr(n.Else), + Location: n.Pos(), + } + for _, when := range n.Whens { + expr.Args.Items = append(expr.Args.Items, &ast.CaseWhen{ + Expr: c.convert(when.When), + Result: c.convert(when.Then), + Location: when.Pos(), + }) + } + return expr +} - case *parser.Update_stmt_limitedContext: - return c.convertUpdate_stmtContext(n) +func (c *cc) convertFuncCall(n *meyer.FuncCall) ast.Node { + funcName := identifier(n.Name) + args := c.convertExprList(n.Args) - case *parser.Expr_castContext: - return c.convertCastExpr(n) + if funcName == "coalesce" { + return &ast.CoalesceExpr{ + Args: args, + Location: n.Pos(), + } + } - default: - return todo("convert(case=default)", n) + call := &ast.FuncCall{ + Func: &ast.FuncName{ + Name: funcName, + }, + Funcname: &ast.List{Items: []ast.Node{ + &ast.String{Str: funcName}, + }}, + AggStar: n.Star, + Args: args, + AggOrder: &ast.List{Items: c.convertOrderBy(n.OrderBy)}, + AggDistinct: n.Distinct, + AggFilter: c.convertExpr(n.Filter), + Location: n.Pos(), + } + if n.Over != nil { + if over, ok := c.convertWindowDef(n.Over).(*ast.WindowDef); ok { + call.Over = over + } } + return call } diff --git a/internal/engine/sqlite/dialect/dialect.json b/internal/engine/sqlite/dialect/dialect.json new file mode 100644 index 0000000000..60bce0eaf3 --- /dev/null +++ b/internal/engine/sqlite/dialect/dialect.json @@ -0,0 +1,45 @@ +{ + "dialect": "sqlite", + "alias": "base", + "const": { + "integer": "integer", + "float": "real", + "string": "text", + "bool": "boolean" + }, + "bool": "boolean", + "comparison": ["=", "==", "<>", "!=", "<", "<=", ">", ">=", "IS", "IS NOT", "LIKE", "NOT LIKE", "GLOB", "NOT GLOB", "REGEXP", "NOT REGEXP", "MATCH", "NOT MATCH"], + "comparison_categories": "BNSDU", + "arithmetic": ["+", "-", "*", "/", "%"], + "arithmetic_categories": "N", + "cast_categories": "*", + "modules": { + "fts3": "enable_fts3", + "fts4": "enable_fts3", + "fts5": "enable_fts5", + "geopoly": "enable_geopoly", + "rtree": "enable_rtree", + "rtree_i32": "enable_rtree" + }, + "affinity": [ + { + "contains": ["INT"], + "type": "integer" + }, + { + "contains": ["CHAR", "CLOB", "TEXT"], + "type": "text" + }, + { + "contains": ["BLOB"], + "type": "blob" + }, + { + "contains": ["REAL", "FLOA", "DOUB"], + "type": "real" + }, + { + "type": "numeric" + } + ] +} diff --git a/internal/engine/sqlite/dialect/extensions/enable_fts3/functions.jsonl b/internal/engine/sqlite/dialect/extensions/enable_fts3/functions.jsonl new file mode 100644 index 0000000000..5f04bc6133 --- /dev/null +++ b/internal/engine/sqlite/dialect/extensions/enable_fts3/functions.jsonl @@ -0,0 +1,5 @@ +{"name":"matchinfo","args":[{"type":"any"}],"returns":"blob"} +{"name":"matchinfo","args":[{"type":"any"},{"type":"text"}],"returns":"blob"} +{"name":"offsets","args":[{"type":"any"}],"returns":"text"} +{"name":"optimize","args":[{"type":"any"}],"returns":"text"} +{"name":"snippet","args":[{"type":"any","has_default":true},{"type":"any","has_default":true},{"type":"text","has_default":true},{"type":"text","has_default":true},{"type":"integer","has_default":true},{"type":"integer","has_default":true},{"type":"any","mode":"v"}],"returns":"text"} diff --git a/internal/engine/sqlite/dialect/extensions/enable_fts5/functions.jsonl b/internal/engine/sqlite/dialect/extensions/enable_fts5/functions.jsonl new file mode 100644 index 0000000000..aac7a8163e --- /dev/null +++ b/internal/engine/sqlite/dialect/extensions/enable_fts5/functions.jsonl @@ -0,0 +1,7 @@ +{"name":"bm25","args":[{"type":"any","has_default":true},{"type":"real","mode":"v"}],"returns":"real"} +{"name":"fts5_get_locale","args":[{"type":"any","has_default":true},{"type":"integer","has_default":true},{"type":"any","mode":"v"}],"returns":"text","nullable":true} +{"name":"fts5_insttoken","args":[{"type":"any"}],"returns":"any"} +{"name":"fts5_locale","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"fts5_source_id","returns":"text"} +{"name":"highlight","args":[{"type":"any","has_default":true},{"type":"integer","has_default":true},{"type":"text","has_default":true},{"type":"text","has_default":true},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"snippet","args":[{"type":"any","has_default":true},{"type":"any","has_default":true},{"type":"text","has_default":true},{"type":"text","has_default":true},{"type":"integer","has_default":true},{"type":"integer","has_default":true},{"type":"any","mode":"v"}],"returns":"text"} diff --git a/internal/engine/sqlite/dialect/extensions/enable_geopoly/functions.jsonl b/internal/engine/sqlite/dialect/extensions/enable_geopoly/functions.jsonl new file mode 100644 index 0000000000..a37aa982b1 --- /dev/null +++ b/internal/engine/sqlite/dialect/extensions/enable_geopoly/functions.jsonl @@ -0,0 +1,15 @@ +{"name":"geopoly_area","args":[{"type":"any"}],"returns":"real","nullable":true} +{"name":"geopoly_bbox","args":[{"type":"any"}],"returns":"blob","nullable":true} +{"name":"geopoly_blob","args":[{"type":"any"}],"returns":"blob","nullable":true} +{"name":"geopoly_ccw","args":[{"type":"any"}],"returns":"blob","nullable":true} +{"name":"geopoly_contains_point","args":[{"type":"any"},{"type":"real"},{"type":"real"}],"returns":"integer","nullable":true} +{"name":"geopoly_group_bbox","kind":"a","args":[{"type":"any"}],"returns":"blob","nullable":true} +{"name":"geopoly_json","args":[{"type":"any"}],"returns":"text","nullable":true} +{"name":"geopoly_overlap","args":[{"type":"any"},{"type":"any"}],"returns":"integer","nullable":true} +{"name":"geopoly_regular","args":[{"type":"real"},{"type":"real"},{"type":"real"},{"type":"integer"}],"returns":"blob"} +{"name":"geopoly_svg","args":[{"type":"text","mode":"v"}],"returns":"text","nullable":true} +{"name":"geopoly_within","args":[{"type":"any"},{"type":"any"}],"returns":"integer","nullable":true} +{"name":"geopoly_xform","args":[{"type":"any"},{"type":"real"},{"type":"real"},{"type":"real"},{"type":"real"},{"type":"real"},{"type":"real"}],"returns":"blob","nullable":true} +{"name":"rtreecheck","args":[{"type":"text","has_default":true},{"type":"text","has_default":true},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"rtreedepth","args":[{"type":"blob"}],"returns":"integer"} +{"name":"rtreenode","args":[{"type":"integer"},{"type":"blob"}],"returns":"text"} diff --git a/internal/engine/sqlite/dialect/extensions/enable_offset_sql_func/functions.jsonl b/internal/engine/sqlite/dialect/extensions/enable_offset_sql_func/functions.jsonl new file mode 100644 index 0000000000..7e8563d626 --- /dev/null +++ b/internal/engine/sqlite/dialect/extensions/enable_offset_sql_func/functions.jsonl @@ -0,0 +1 @@ +{"name":"sqlite_offset","args":[{"type":"any"}],"returns":"integer","nullable":true} diff --git a/internal/engine/sqlite/dialect/extensions/enable_percentile/functions.jsonl b/internal/engine/sqlite/dialect/extensions/enable_percentile/functions.jsonl new file mode 100644 index 0000000000..d872692b01 --- /dev/null +++ b/internal/engine/sqlite/dialect/extensions/enable_percentile/functions.jsonl @@ -0,0 +1,4 @@ +{"name":"median","kind":"a","args":[{"type":"real"}],"returns":"real","nullable":true} +{"name":"percentile","kind":"a","args":[{"type":"real"},{"type":"real"}],"returns":"real","nullable":true} +{"name":"percentile_cont","kind":"a","args":[{"type":"real"},{"type":"real"}],"returns":"real","nullable":true} +{"name":"percentile_disc","kind":"a","args":[{"type":"real"},{"type":"real"}],"returns":"real","nullable":true} diff --git a/internal/engine/sqlite/dialect/extensions/enable_rtree/functions.jsonl b/internal/engine/sqlite/dialect/extensions/enable_rtree/functions.jsonl new file mode 100644 index 0000000000..a154d3bfc0 --- /dev/null +++ b/internal/engine/sqlite/dialect/extensions/enable_rtree/functions.jsonl @@ -0,0 +1,3 @@ +{"name":"rtreecheck","args":[{"type":"text","has_default":true},{"type":"text","has_default":true},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"rtreedepth","args":[{"type":"blob"}],"returns":"integer"} +{"name":"rtreenode","args":[{"type":"integer"},{"type":"blob"}],"returns":"text"} diff --git a/internal/engine/sqlite/dialect/extensions/soundex/functions.jsonl b/internal/engine/sqlite/dialect/extensions/soundex/functions.jsonl new file mode 100644 index 0000000000..2644ef5d0b --- /dev/null +++ b/internal/engine/sqlite/dialect/extensions/soundex/functions.jsonl @@ -0,0 +1 @@ +{"name":"soundex","args":[{"type":"text"}],"returns":"text"} diff --git a/internal/engine/sqlite/dialect/functions.jsonl b/internal/engine/sqlite/dialect/functions.jsonl new file mode 100644 index 0000000000..18012549de --- /dev/null +++ b/internal/engine/sqlite/dialect/functions.jsonl @@ -0,0 +1,236 @@ +{"name":"-\u003e","args":[{"type":"any"},{"type":"any"}],"returns":"text","nullable":true} +{"name":"-\u003e\u003e","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"abs","args":[{"type":"any"}],"returns":"real"} +{"name":"abs","args":[{"type":"integer"}],"returns":"integer"} +{"name":"abs","args":[{"type":"int"}],"returns":"integer"} +{"name":"abs","args":[{"type":"tinyint"}],"returns":"integer"} +{"name":"abs","args":[{"type":"smallint"}],"returns":"integer"} +{"name":"abs","args":[{"type":"mediumint"}],"returns":"integer"} +{"name":"abs","args":[{"type":"bigint"}],"returns":"integer"} +{"name":"abs","args":[{"type":"unsigned big int"}],"returns":"integer"} +{"name":"abs","args":[{"type":"int2"}],"returns":"integer"} +{"name":"abs","args":[{"type":"int8"}],"returns":"integer"} +{"name":"abs","args":[{"type":"real"}],"returns":"real"} +{"name":"abs","args":[{"type":"double"}],"returns":"real"} +{"name":"abs","args":[{"type":"double precision"}],"returns":"real"} +{"name":"abs","args":[{"type":"float"}],"returns":"real"} +{"name":"acos","args":[{"type":"real"}],"returns":"real"} +{"name":"acosh","args":[{"type":"real"}],"returns":"real"} +{"name":"asin","args":[{"type":"real"}],"returns":"real"} +{"name":"asinh","args":[{"type":"real"}],"returns":"real"} +{"name":"atan","args":[{"type":"real"}],"returns":"real"} +{"name":"atan2","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"atanh","args":[{"type":"real"}],"returns":"real"} +{"name":"avg","kind":"a","args":[{"type":"any"}],"returns":"real","nullable":true} +{"name":"ceil","args":[{"type":"any"}],"returns":"real"} +{"name":"ceil","args":[{"type":"integer"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"int"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"tinyint"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"smallint"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"mediumint"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"bigint"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"unsigned big int"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"int2"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"int8"}],"returns":"integer"} +{"name":"ceil","args":[{"type":"real"}],"returns":"real"} +{"name":"ceil","args":[{"type":"double"}],"returns":"real"} +{"name":"ceil","args":[{"type":"double precision"}],"returns":"real"} +{"name":"ceil","args":[{"type":"float"}],"returns":"real"} +{"name":"ceiling","args":[{"type":"any"}],"returns":"real"} +{"name":"ceiling","args":[{"type":"integer"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"int"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"tinyint"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"smallint"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"mediumint"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"bigint"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"unsigned big int"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"int2"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"int8"}],"returns":"integer"} +{"name":"ceiling","args":[{"type":"real"}],"returns":"real"} +{"name":"ceiling","args":[{"type":"double"}],"returns":"real"} +{"name":"ceiling","args":[{"type":"double precision"}],"returns":"real"} +{"name":"ceiling","args":[{"type":"float"}],"returns":"real"} +{"name":"changes","returns":"integer"} +{"name":"char","args":[{"type":"integer","mode":"v"}],"returns":"text"} +{"name":"coalesce","args":[{"type":"any"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"concat","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"concat_ws","args":[{"type":"text"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"cos","args":[{"type":"real"}],"returns":"real"} +{"name":"cosh","args":[{"type":"real"}],"returns":"real"} +{"name":"count","kind":"a","returns":"integer"} +{"name":"count","kind":"a","args":[{"type":"any"}],"returns":"integer"} +{"name":"cume_dist","kind":"w","returns":"real"} +{"name":"current_date","returns":"text"} +{"name":"current_time","returns":"text"} +{"name":"current_timestamp","returns":"text"} +{"name":"date","args":[{"type":"any","mode":"v"}],"returns":"text","nullable":true} +{"name":"datetime","args":[{"type":"any","mode":"v"}],"returns":"text","nullable":true} +{"name":"degrees","args":[{"type":"real"}],"returns":"real"} +{"name":"dense_rank","kind":"w","returns":"integer"} +{"name":"exp","args":[{"type":"real"}],"returns":"real"} +{"name":"first_value","kind":"w","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"floor","args":[{"type":"any"}],"returns":"real"} +{"name":"floor","args":[{"type":"integer"}],"returns":"integer"} +{"name":"floor","args":[{"type":"int"}],"returns":"integer"} +{"name":"floor","args":[{"type":"tinyint"}],"returns":"integer"} +{"name":"floor","args":[{"type":"smallint"}],"returns":"integer"} +{"name":"floor","args":[{"type":"mediumint"}],"returns":"integer"} +{"name":"floor","args":[{"type":"bigint"}],"returns":"integer"} +{"name":"floor","args":[{"type":"unsigned big int"}],"returns":"integer"} +{"name":"floor","args":[{"type":"int2"}],"returns":"integer"} +{"name":"floor","args":[{"type":"int8"}],"returns":"integer"} +{"name":"floor","args":[{"type":"real"}],"returns":"real"} +{"name":"floor","args":[{"type":"double"}],"returns":"real"} +{"name":"floor","args":[{"type":"double precision"}],"returns":"real"} +{"name":"floor","args":[{"type":"float"}],"returns":"real"} +{"name":"format","args":[{"type":"text","has_default":true},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"glob","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"group_concat","kind":"a","args":[{"type":"text"}],"returns":"text","nullable":true} +{"name":"group_concat","kind":"a","args":[{"type":"text"},{"type":"text"}],"returns":"text","nullable":true} +{"name":"hex","args":[{"type":"blob"}],"returns":"text"} +{"name":"if","args":[{"type":"any"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"ifnull","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"iif","args":[{"type":"any"},{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"instr","args":[{"type":"any"},{"type":"any"}],"returns":"integer"} +{"name":"json","args":[{"type":"any"}],"returns":"text"} +{"name":"json_array","args":[{"type":"any","mode":"v"}],"returns":"text"} +{"name":"json_array_insert","args":[{"type":"any","mode":"v"}],"returns":"text"} +{"name":"json_array_length","args":[{"type":"any"}],"returns":"integer","nullable":true} +{"name":"json_array_length","args":[{"type":"any"},{"type":"text"}],"returns":"integer","nullable":true} +{"name":"json_error_position","args":[{"type":"text"}],"returns":"integer"} +{"name":"json_extract","args":[{"type":"text","mode":"v"}],"returns":"any","nullable":true} +{"name":"json_group_array","kind":"a","args":[{"type":"any"}],"returns":"text"} +{"name":"json_group_object","kind":"a","args":[{"type":"text"},{"type":"any"}],"returns":"text"} +{"name":"json_insert","args":[{"type":"any","mode":"v"}],"returns":"text"} +{"name":"json_object","args":[{"type":"text","mode":"v"}],"returns":"text"} +{"name":"json_patch","args":[{"type":"any"},{"type":"any"}],"returns":"text"} +{"name":"json_pretty","args":[{"type":"any"}],"returns":"text"} +{"name":"json_pretty","args":[{"type":"any"},{"type":"text"}],"returns":"text"} +{"name":"json_quote","args":[{"type":"any"}],"returns":"text"} +{"name":"json_remove","args":[{"type":"text","mode":"v"}],"returns":"text"} +{"name":"json_replace","args":[{"type":"any","mode":"v"}],"returns":"text"} +{"name":"json_set","args":[{"type":"any","mode":"v"}],"returns":"text"} +{"name":"json_type","args":[{"type":"any"}],"returns":"text","nullable":true} +{"name":"json_type","args":[{"type":"any"},{"type":"text"}],"returns":"text","nullable":true} +{"name":"json_valid","args":[{"type":"any"}],"returns":"integer"} +{"name":"json_valid","args":[{"type":"any"},{"type":"integer"}],"returns":"integer"} +{"name":"jsonb","args":[{"type":"any"}],"returns":"blob"} +{"name":"jsonb_array","args":[{"type":"any","mode":"v"}],"returns":"blob"} +{"name":"jsonb_array_insert","args":[{"type":"any","mode":"v"}],"returns":"blob"} +{"name":"jsonb_extract","args":[{"type":"text","mode":"v"}],"returns":"any","nullable":true} +{"name":"jsonb_group_array","kind":"a","args":[{"type":"any"}],"returns":"blob"} +{"name":"jsonb_group_object","kind":"a","args":[{"type":"text"},{"type":"any"}],"returns":"blob"} +{"name":"jsonb_insert","args":[{"type":"any","mode":"v"}],"returns":"blob"} +{"name":"jsonb_object","args":[{"type":"text","mode":"v"}],"returns":"blob"} +{"name":"jsonb_patch","args":[{"type":"any"},{"type":"any"}],"returns":"blob"} +{"name":"jsonb_remove","args":[{"type":"text","mode":"v"}],"returns":"blob"} +{"name":"jsonb_replace","args":[{"type":"any","mode":"v"}],"returns":"blob"} +{"name":"jsonb_set","args":[{"type":"any","mode":"v"}],"returns":"blob"} +{"name":"julianday","args":[{"type":"any","mode":"v"}],"returns":"real","nullable":true} +{"name":"lag","kind":"w","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"lag","kind":"w","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"lag","kind":"w","args":[{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"last_insert_rowid","returns":"integer"} +{"name":"last_value","kind":"w","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"lead","kind":"w","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"lead","kind":"w","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"lead","kind":"w","args":[{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"length","args":[{"type":"text"}],"returns":"integer"} +{"name":"like","args":[{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"like","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"integer"} +{"name":"likelihood","args":[{"type":"any"},{"type":"any"}],"returns":"any"} +{"name":"likely","args":[{"type":"any"}],"returns":"any"} +{"name":"ln","args":[{"type":"real"}],"returns":"real"} +{"name":"log","args":[{"type":"real"}],"returns":"real"} +{"name":"log","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"log10","args":[{"type":"real"}],"returns":"real"} +{"name":"log2","args":[{"type":"real"}],"returns":"real"} +{"name":"lower","args":[{"type":"text"}],"returns":"text"} +{"name":"ltrim","args":[{"type":"text"}],"returns":"text"} +{"name":"ltrim","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"max","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"max","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"min","kind":"a","args":[{"type":"any"}],"returns":"any","nullable":true} +{"name":"min","args":[{"type":"any"},{"type":"any","mode":"v"}],"returns":"any"} +{"name":"mod","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"nth_value","kind":"w","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"ntile","kind":"w","args":[{"type":"integer"}],"returns":"integer"} +{"name":"nullif","args":[{"type":"any"},{"type":"any"}],"returns":"any","nullable":true} +{"name":"octet_length","args":[{"type":"any"}],"returns":"integer"} +{"name":"percent_rank","kind":"w","returns":"real"} +{"name":"pi","returns":"real"} +{"name":"pow","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"power","args":[{"type":"real"},{"type":"real"}],"returns":"real"} +{"name":"printf","args":[{"type":"text","has_default":true},{"type":"any","mode":"v"}],"returns":"text"} +{"name":"quote","args":[{"type":"any"}],"returns":"text"} +{"name":"radians","args":[{"type":"real"}],"returns":"real"} +{"name":"random","returns":"integer"} +{"name":"randomblob","args":[{"type":"integer"}],"returns":"blob"} +{"name":"rank","kind":"w","returns":"integer"} +{"name":"replace","args":[{"type":"text"},{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"round","args":[{"type":"real"}],"returns":"real"} +{"name":"round","args":[{"type":"real"},{"type":"integer"}],"returns":"real"} +{"name":"row_number","kind":"w","returns":"integer"} +{"name":"rtrim","args":[{"type":"text"}],"returns":"text"} +{"name":"rtrim","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"sign","args":[{"type":"real"}],"returns":"integer","nullable":true} +{"name":"sin","args":[{"type":"real"}],"returns":"real"} +{"name":"sinh","args":[{"type":"real"}],"returns":"real"} +{"name":"sqlite_compileoption_get","args":[{"type":"integer"}],"returns":"text","nullable":true} +{"name":"sqlite_compileoption_used","args":[{"type":"text"}],"returns":"integer"} +{"name":"sqlite_source_id","returns":"text"} +{"name":"sqlite_version","returns":"text"} +{"name":"sqrt","args":[{"type":"real"}],"returns":"real"} +{"name":"strftime","args":[{"type":"text","has_default":true},{"type":"any","mode":"v"}],"returns":"text","nullable":true} +{"name":"string_agg","kind":"a","args":[{"type":"text"},{"type":"text"}],"returns":"text","nullable":true} +{"name":"substr","args":[{"type":"any"},{"type":"integer"}],"returns":"text"} +{"name":"substr","args":[{"type":"any"},{"type":"integer"},{"type":"integer"}],"returns":"text"} +{"name":"substring","args":[{"type":"any"},{"type":"integer"}],"returns":"text"} +{"name":"substring","args":[{"type":"any"},{"type":"integer"},{"type":"integer"}],"returns":"text"} +{"name":"subtype","args":[{"type":"any"}],"returns":"integer"} +{"name":"sum","kind":"a","args":[{"type":"any"}],"returns":"real","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"integer"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"int"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"tinyint"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"smallint"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"mediumint"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"bigint"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"unsigned big int"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"int2"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"int8"}],"returns":"integer","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"real"}],"returns":"real","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"double"}],"returns":"real","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"double precision"}],"returns":"real","nullable":true} +{"name":"sum","kind":"a","args":[{"type":"float"}],"returns":"real","nullable":true} +{"name":"tan","args":[{"type":"real"}],"returns":"real"} +{"name":"tanh","args":[{"type":"real"}],"returns":"real"} +{"name":"time","args":[{"type":"any","mode":"v"}],"returns":"text","nullable":true} +{"name":"timediff","args":[{"type":"any"},{"type":"any"}],"returns":"text","nullable":true} +{"name":"total","kind":"a","args":[{"type":"any"}],"returns":"real"} +{"name":"total_changes","returns":"integer"} +{"name":"trim","args":[{"type":"text"}],"returns":"text"} +{"name":"trim","args":[{"type":"text"},{"type":"text"}],"returns":"text"} +{"name":"trunc","args":[{"type":"any"}],"returns":"real"} +{"name":"trunc","args":[{"type":"integer"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"int"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"tinyint"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"smallint"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"mediumint"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"bigint"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"unsigned big int"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"int2"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"int8"}],"returns":"integer"} +{"name":"trunc","args":[{"type":"real"}],"returns":"real"} +{"name":"trunc","args":[{"type":"double"}],"returns":"real"} +{"name":"trunc","args":[{"type":"double precision"}],"returns":"real"} +{"name":"trunc","args":[{"type":"float"}],"returns":"real"} +{"name":"typeof","args":[{"type":"any"}],"returns":"text"} +{"name":"unhex","args":[{"type":"text"}],"returns":"blob","nullable":true} +{"name":"unhex","args":[{"type":"text"},{"type":"text"}],"returns":"blob","nullable":true} +{"name":"unicode","args":[{"type":"text"}],"returns":"integer"} +{"name":"unistr","args":[{"type":"text"}],"returns":"text"} +{"name":"unistr_quote","args":[{"type":"any"}],"returns":"text"} +{"name":"unixepoch","args":[{"type":"any","mode":"v"}],"returns":"real","nullable":true} +{"name":"unlikely","args":[{"type":"any"}],"returns":"any"} +{"name":"upper","args":[{"type":"text"}],"returns":"text"} +{"name":"zeroblob","args":[{"type":"integer"}],"returns":"blob"} diff --git a/internal/engine/sqlite/dialect/operators.jsonl b/internal/engine/sqlite/dialect/operators.jsonl new file mode 100644 index 0000000000..9ed8beaf64 --- /dev/null +++ b/internal/engine/sqlite/dialect/operators.jsonl @@ -0,0 +1 @@ +{"name": "||", "left": "text", "right": "text", "result": "text"} diff --git a/internal/engine/sqlite/dialect/types.jsonl b/internal/engine/sqlite/dialect/types.jsonl new file mode 100644 index 0000000000..055975e369 --- /dev/null +++ b/internal/engine/sqlite/dialect/types.jsonl @@ -0,0 +1,10 @@ +{"name": "integer", "category": "N", "aliases": ["int", "tinyint", "smallint", "mediumint", "bigint", "unsigned big int", "int2", "int8"]} +{"name": "real", "category": "N", "aliases": ["double", "double precision", "float"]} +{"name": "numeric", "category": "N", "aliases": ["decimal"]} +{"name": "boolean", "category": "B", "aliases": ["bool"]} +{"name": "text", "category": "S", "aliases": ["character", "varchar", "varying character", "nchar", "native character", "nvarchar", "clob"]} +{"name": "blob", "category": "U"} +{"name": "any", "category": "U"} +{"name": "date", "category": "D"} +{"name": "datetime", "category": "D"} +{"name": "timestamp", "category": "D"} diff --git a/internal/engine/sqlite/extension.go b/internal/engine/sqlite/extension.go new file mode 100644 index 0000000000..44265489a9 --- /dev/null +++ b/internal/engine/sqlite/extension.go @@ -0,0 +1,26 @@ +package sqlite + +import ( + "github.com/sqlc-dev/sqlc/internal/core/seed" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +// loadExtension returns the functions a compile option adds, read from the +// option's directory under the dialect's extensions/. The name is either the +// directory's — enable_fts5 — or a virtual table module the dialect maps to +// one, since a schema that says CREATE VIRTUAL TABLE ... USING fts5 has said +// which build of SQLite it runs on. An option the dialect has no data for +// adds nothing. +func loadExtension(name string) *catalog.Schema { + dir, ok := seed.ExtensionDir(dialectFS, "dialect", name) + if !ok { + return nil + } + funcs, err := seed.Functions(dialectFS, dir) + if err != nil { + // The list is embedded in the binary: a failure here means sqlc was + // built from a broken tree, which no caller can do anything about. + panic(err) + } + return &catalog.Schema{Name: "main", Funcs: funcs} +} diff --git a/internal/engine/sqlite/format.go b/internal/engine/sqlite/format.go new file mode 100644 index 0000000000..d79e30d45e --- /dev/null +++ b/internal/engine/sqlite/format.go @@ -0,0 +1,59 @@ +package sqlite + +import ( + "strconv" + "strings" +) + +// QuoteIdent quotes an identifier when printing it bare would change what it +// names: the parser folds unquoted identifiers to lower case, so any name +// that is not already a plain lower-case identifier — or that collides with +// a keyword — only survives a parse round-trip inside double quotes. +func (p *Parser) QuoteIdent(s string) string { + if s == "" || p.IsReservedKeyword(s) || !plainIdent(s) { + return `"` + strings.ReplaceAll(s, `"`, `""`) + `"` + } + return s +} + +// plainIdent reports whether s parses back as itself unquoted: ASCII +// lower-case letters, digits and underscores, not starting with a digit. +func plainIdent(s string) bool { + for i, r := range s { + switch { + case r >= 'a' && r <= 'z', r == '_': + case r >= '0' && r <= '9': + if i == 0 { + return false + } + default: + return false + } + } + return true +} + +// TypeName returns the SQL type name for the given namespace and name. +func (p *Parser) TypeName(ns, name string) string { + if ns != "" { + return ns + "." + name + } + return name +} + +// Param returns the parameter placeholder for the given number. SQLite +// takes both a bare ? (the next index) and an explicit ?N, and they are +// not interchangeable — reordered ?N parameters bind by their numbers — +// so the one the author wrote is the one printed. +func (p *Parser) Param(n int, numbered bool) string { + if numbered { + return "?" + strconv.Itoa(n) + } + return "?" +} + +// Cast returns a type cast expression. +// SQLite uses CAST(expr AS type) syntax. +func (p *Parser) Cast(arg, typeName string) string { + return "CAST(" + arg + " AS " + typeName + ")" +} diff --git a/internal/engine/sqlite/parse.go b/internal/engine/sqlite/parse.go index bf0bacad9f..ce0a729b4c 100644 --- a/internal/engine/sqlite/parse.go +++ b/internal/engine/sqlite/parse.go @@ -2,35 +2,18 @@ package sqlite import ( "errors" - "fmt" "io" + "strings" - "github.com/antlr/antlr4/runtime/Go/antlr/v4" + meyer "github.com/sqlc-dev/meyer/ast" + "github.com/sqlc-dev/meyer/parser" + mtoken "github.com/sqlc-dev/meyer/token" - "github.com/sqlc-dev/sqlc/internal/engine/sqlite/parser" - "github.com/sqlc-dev/sqlc/internal/metadata" + "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) -type errorListener struct { - *antlr.DefaultErrorListener - - err string -} - -func (el *errorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException) { - el.err = msg -} - -// func (el *errorListener) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs antlr.ATNConfigSet) { -// } -// -// func (el *errorListener) ReportAttemptingFullContext(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, conflictingAlts *antlr.BitSet, configs antlr.ATNConfigSet) { -// } -// -// func (el *errorListener) ReportContextSensitivity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex, prediction int, configs antlr.ATNConfigSet) { -// } - func NewParser() *Parser { return &Parser{} } @@ -38,56 +21,136 @@ func NewParser() *Parser { type Parser struct { } +// parseOptions accepts ORDER BY and LIMIT on UPDATE and DELETE. SQLite has +// them only when built with SQLITE_ENABLE_UPDATE_DELETE_LIMIT, which meyer +// cannot tell from the SQL, so the caller has to ask. sqlc has always +// accepted them. +var parseOptions = parser.Options{UpdateDeleteLimit: true} + func (p *Parser) Parse(r io.Reader) ([]ast.Statement, error) { - blob, err := io.ReadAll(r) + f, err := p.ParseFile(r) if err != nil { return nil, err } - input := antlr.NewInputStream(string(blob)) - lexer := parser.NewSQLiteLexer(input) - stream := antlr.NewCommonTokenStream(lexer, 0) - pp := parser.NewSQLiteParser(stream) - el := &errorListener{} - pp.AddErrorListener(el) - // pp.BuildParseTrees = true - tree := pp.Parse() - if el.err != "" { - return nil, errors.New(el.err) + // The compiler skips statements sqlc has no node for (PRAGMA and + // friends); the formatter must see them, so the filter lives here, + // not in ParseFile. + var stmts []ast.Statement + for _, stmt := range f.Stmts { + if _, ok := stmt.Raw.Stmt.(*ast.TODO); ok { + continue + } + stmts = append(stmts, stmt) + } + return stmts, nil +} + +// ParseFile parses like Parse and also carries the file's comments, taken +// from the trivia meyer's single lexer pass produces alongside the tokens. +func (p *Parser) ParseFile(r io.Reader) (*ast.File, error) { + blob, err := io.ReadAll(r) + if err != nil { + return nil, err } - pctx, ok := tree.(*parser.ParseContext) - if !ok { - return nil, fmt.Errorf("expected ParserContext; got %T\n", tree) + src := string(blob) + parsed, err := parseOptions.ParseFile(src) + if err != nil { + return nil, normalizeErr(err) } + var stmts []ast.Statement - for _, istmt := range pctx.AllSql_stmt_list() { - list, ok := istmt.(*parser.Sql_stmt_listContext) - if !ok { - return nil, fmt.Errorf("expected Sql_stmt_listContext; got %T\n", istmt) + // loc tracks the first byte after the previous statement's terminator, so + // that a statement's extent covers the comments written above it. sqlc + // reads the "-- name:" annotation out of that range. + loc := 0 + for _, raw := range parsed.Stmts { + converter := &cc{src: src} + // A statement sqlc has no node for converts to a TODO and stays in + // the list: the formatter needs its extent to keep it as written, + // and Parse filters it out for the compiler. + stmts = append(stmts, ast.Statement{ + Raw: &ast.RawStmt{ + Stmt: converter.convert(raw), + StmtLocation: loc, + StmtLen: trimTerminator(src, raw) - loc, + }, + }) + loc = raw.End() + } + + var comments []ast.Comment + for _, tr := range parsed.Trivia { + if tr.Kind != mtoken.COMMENT { + continue } - loc := 0 + comments = append(comments, ast.Comment{ + Text: strings.TrimRight(tr.Text(src), " \t\r\n"), + Start: tr.Pos, + End: tr.End, + OwnLine: ownLine(src, tr.Pos), + }) + } + return &ast.File{Stmts: stmts, Comments: comments}, nil +} - for _, stmt := range list.AllSql_stmt() { - converter := &cc{} - out := converter.convert(stmt) - if _, ok := out.(*ast.TODO); ok { - continue - } - len := (stmt.GetStop().GetStop() + 1) - loc - stmts = append(stmts, ast.Statement{ - Raw: &ast.RawStmt{ - Stmt: out, - StmtLocation: loc, - StmtLen: len, - }, - }) - loc = stmt.GetStop().GetStop() + 2 +// ownLine reports that only blank space sits between the preceding line +// break and pos. +func ownLine(src string, pos int) bool { + for j := pos - 1; j >= 0; j-- { + switch src[j] { + case '\n': + return true + case ' ', '\t', '\r': + continue + default: + return false } } - return stmts, nil + return true +} + +// trimTerminator returns the end of stmt with its terminating semicolon, and +// any space before it, removed. A statement's span runs through the +// semicolon, but sqlc's statement text does not include it. +func trimTerminator(src string, stmt meyer.Stmt) int { + end := stmt.End() + if end > stmt.Pos() && end <= len(src) && src[end-1] == ';' { + end-- + } + for end > stmt.Pos() && isSpace(src[end-1]) { + end-- + } + return end +} + +func isSpace(b byte) bool { + switch b { + case ' ', '\t', '\n', '\r', '\f': + return true + } + return false +} + +// normalizeErr turns a meyer parse failure into the positioned error sqlc +// reports to the user. meyer's message and byte offset match SQLite's own. +func normalizeErr(err error) error { + var perr *parser.Error + if !errors.As(err, &perr) { + return err + } + line, column := parser.LineCol(perr.SQL, perr.Offset) + if line == 0 { + return errors.New(perr.Message) + } + return &sqlerr.Error{ + Message: perr.Message, + Line: line, + Column: column, + } } -func (p *Parser) CommentSyntax() metadata.CommentSyntax { - return metadata.CommentSyntax{ +func (p *Parser) CommentSyntax() source.CommentSyntax { + return source.CommentSyntax{ Dash: true, Hash: false, SlashStar: true, diff --git a/internal/engine/sqlite/parser/.gitignore b/internal/engine/sqlite/parser/.gitignore deleted file mode 100644 index 960048667f..0000000000 --- a/internal/engine/sqlite/parser/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ - -antlr-4.12.0-complete.jar diff --git a/internal/engine/sqlite/parser/Makefile b/internal/engine/sqlite/parser/Makefile deleted file mode 100644 index b925a1f6c1..0000000000 --- a/internal/engine/sqlite/parser/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -sqlite_parser.go: SQLiteLexer.g4 SQLiteParser.g4 antlr-4.12.0-complete.jar - java -jar antlr-4.12.0-complete.jar -Dlanguage=Go SQLiteLexer.g4 SQLiteParser.g4 - -antlr-4.12.0-complete.jar: - curl -O https://www.antlr.org/download/antlr-4.12.0-complete.jar - - diff --git a/internal/engine/sqlite/parser/SQLiteLexer.g4 b/internal/engine/sqlite/parser/SQLiteLexer.g4 deleted file mode 100644 index d7f7c97197..0000000000 --- a/internal/engine/sqlite/parser/SQLiteLexer.g4 +++ /dev/null @@ -1,271 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2020 by Martin Mirchev - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - * associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Project : sqlite-parser; an ANTLR4 grammar for SQLite https://github.com/bkiers/sqlite-parser - * Developed by : Bart Kiers, bart@big-o.nl - */ - -// $antlr-format alignTrailingComments on, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments off, useTab off -// $antlr-format allowShortRulesOnASingleLine on, alignSemicolons ownLine - -lexer grammar SQLiteLexer; - -SCOL: ';'; -DOT: '.'; -OPEN_PAR: '('; -CLOSE_PAR: ')'; -COMMA: ','; -ASSIGN: '='; -STAR: '*'; -PLUS: '+'; -MINUS: '-'; -TILDE: '~'; -PIPE2: '||'; -DIV: '/'; -MOD: '%'; -LT2: '<<'; -GT2: '>>'; -AMP: '&'; -PIPE: '|'; -LT: '<'; -LT_EQ: '<='; -GT: '>'; -GT_EQ: '>='; -EQ: '=='; -NOT_EQ1: '!='; -NOT_EQ2: '<>'; - -// http://www.sqlite.org/lang_keywords.html -ABORT_: A B O R T; -ACTION_: A C T I O N; -ADD_: A D D; -AFTER_: A F T E R; -ALL_: A L L; -ALTER_: A L T E R; -ANALYZE_: A N A L Y Z E; -AND_: A N D; -AS_: A S; -ASC_: A S C; -ATTACH_: A T T A C H; -AUTOINCREMENT_: A U T O I N C R E M E N T; -BEFORE_: B E F O R E; -BEGIN_: B E G I N; -BETWEEN_: B E T W E E N; -BY_: B Y; -CASCADE_: C A S C A D E; -CASE_: C A S E; -CAST_: C A S T; -CHECK_: C H E C K; -COLLATE_: C O L L A T E; -COLUMN_: C O L U M N; -COMMIT_: C O M M I T; -CONFLICT_: C O N F L I C T; -CONSTRAINT_: C O N S T R A I N T; -CREATE_: C R E A T E; -CROSS_: C R O S S; -CURRENT_DATE_: C U R R E N T '_' D A T E; -CURRENT_TIME_: C U R R E N T '_' T I M E; -CURRENT_TIMESTAMP_: C U R R E N T '_' T I M E S T A M P; -DATABASE_: D A T A B A S E; -DEFAULT_: D E F A U L T; -DEFERRABLE_: D E F E R R A B L E; -DEFERRED_: D E F E R R E D; -DELETE_: D E L E T E; -DESC_: D E S C; -DETACH_: D E T A C H; -DISTINCT_: D I S T I N C T; -DROP_: D R O P; -EACH_: E A C H; -ELSE_: E L S E; -END_: E N D; -ESCAPE_: E S C A P E; -EXCEPT_: E X C E P T; -EXCLUSIVE_: E X C L U S I V E; -EXISTS_: E X I S T S; -EXPLAIN_: E X P L A I N; -FAIL_: F A I L; -FOR_: F O R; -FOREIGN_: F O R E I G N; -FROM_: F R O M; -FULL_: F U L L; -GLOB_: G L O B; -GROUP_: G R O U P; -HAVING_: H A V I N G; -IF_: I F; -IGNORE_: I G N O R E; -IMMEDIATE_: I M M E D I A T E; -IN_: I N; -INDEX_: I N D E X; -INDEXED_: I N D E X E D; -INITIALLY_: I N I T I A L L Y; -INNER_: I N N E R; -INSERT_: I N S E R T; -INSTEAD_: I N S T E A D; -INTERSECT_: I N T E R S E C T; -INTO_: I N T O; -IS_: I S; -ISNULL_: I S N U L L; -JOIN_: J O I N; -KEY_: K E Y; -LEFT_: L E F T; -LIKE_: L I K E; -LIMIT_: L I M I T; -MATCH_: M A T C H; -NATURAL_: N A T U R A L; -NO_: N O; -NOT_: N O T; -NOTNULL_: N O T N U L L; -NULL_: N U L L; -OF_: O F; -OFFSET_: O F F S E T; -ON_: O N; -OR_: O R; -ORDER_: O R D E R; -OUTER_: O U T E R; -PLAN_: P L A N; -PRAGMA_: P R A G M A; -PRIMARY_: P R I M A R Y; -QUERY_: Q U E R Y; -RAISE_: R A I S E; -RECURSIVE_: R E C U R S I V E; -REFERENCES_: R E F E R E N C E S; -REGEXP_: R E G E X P; -REINDEX_: R E I N D E X; -RELEASE_: R E L E A S E; -RENAME_: R E N A M E; -REPLACE_: R E P L A C E; -RESTRICT_: R E S T R I C T; -RETURNING_: R E T U R N I N G; -RIGHT_: R I G H T; -ROLLBACK_: R O L L B A C K; -ROW_: R O W; -ROWS_: R O W S; -SAVEPOINT_: S A V E P O I N T; -SELECT_: S E L E C T; -SET_: S E T; -STRICT_: S T R I C T; -TABLE_: T A B L E; -TEMP_: T E M P; -TEMPORARY_: T E M P O R A R Y; -THEN_: T H E N; -TO_: T O; -TRANSACTION_: T R A N S A C T I O N; -TRIGGER_: T R I G G E R; -UNION_: U N I O N; -UNIQUE_: U N I Q U E; -UPDATE_: U P D A T E; -USING_: U S I N G; -VACUUM_: V A C U U M; -VALUES_: V A L U E S; -VIEW_: V I E W; -VIRTUAL_: V I R T U A L; -WHEN_: W H E N; -WHERE_: W H E R E; -WITH_: W I T H; -WITHOUT_: W I T H O U T; -FIRST_VALUE_: F I R S T '_' V A L U E; -OVER_: O V E R; -PARTITION_: P A R T I T I O N; -RANGE_: R A N G E; -PRECEDING_: P R E C E D I N G; -UNBOUNDED_: U N B O U N D E D; -CURRENT_: C U R R E N T; -FOLLOWING_: F O L L O W I N G; -CUME_DIST_: C U M E '_' D I S T; -DENSE_RANK_: D E N S E '_' R A N K; -LAG_: L A G; -LAST_VALUE_: L A S T '_' V A L U E; -LEAD_: L E A D; -NTH_VALUE_: N T H '_' V A L U E; -NTILE_: N T I L E; -PERCENT_RANK_: P E R C E N T '_' R A N K; -RANK_: R A N K; -ROW_NUMBER_: R O W '_' N U M B E R; -GENERATED_: G E N E R A T E D; -ALWAYS_: A L W A Y S; -STORED_: S T O R E D; -TRUE_: T R U E; -FALSE_: F A L S E; -WINDOW_: W I N D O W; -NULLS_: N U L L S; -FIRST_: F I R S T; -LAST_: L A S T; -FILTER_: F I L T E R; -GROUPS_: G R O U P S; -EXCLUDE_: E X C L U D E; -TIES_: T I E S; -OTHERS_: O T H E R S; -DO_: D O; -NOTHING_: N O T H I N G; - -IDENTIFIER: - '"' (~'"' | '""')* '"' - | '`' (~'`' | '``')* '`' - | '[' ~']'* ']' - | [a-zA-Z_] [a-zA-Z_0-9]* -; // TODO check: needs more chars in set - -NUMERIC_LITERAL: ((DIGIT+ ('.' DIGIT*)?) | ('.' DIGIT+)) (E [-+]? DIGIT+)? | '0x' HEX_DIGIT+; - -NUMBERED_BIND_PARAMETER: '?' DIGIT*; - -NAMED_BIND_PARAMETER: [:@$] IDENTIFIER; - -STRING_LITERAL: '\'' ( ~'\'' | '\'\'')* '\''; - -BLOB_LITERAL: X STRING_LITERAL; - -SINGLE_LINE_COMMENT: '--' ~[\r\n]* (('\r'? '\n') | EOF) -> channel(HIDDEN); - -MULTILINE_COMMENT: '/*' .*? '*/' -> channel(HIDDEN); - -SPACES: [ \u000B\t\r\n] -> channel(HIDDEN); - -UNEXPECTED_CHAR: .; - -fragment HEX_DIGIT: [0-9a-fA-F]; -fragment DIGIT: [0-9]; - -fragment A: [aA]; -fragment B: [bB]; -fragment C: [cC]; -fragment D: [dD]; -fragment E: [eE]; -fragment F: [fF]; -fragment G: [gG]; -fragment H: [hH]; -fragment I: [iI]; -fragment J: [jJ]; -fragment K: [kK]; -fragment L: [lL]; -fragment M: [mM]; -fragment N: [nN]; -fragment O: [oO]; -fragment P: [pP]; -fragment Q: [qQ]; -fragment R: [rR]; -fragment S: [sS]; -fragment T: [tT]; -fragment U: [uU]; -fragment V: [vV]; -fragment W: [wW]; -fragment X: [xX]; -fragment Y: [yY]; -fragment Z: [zZ]; diff --git a/internal/engine/sqlite/parser/SQLiteLexer.interp b/internal/engine/sqlite/parser/SQLiteLexer.interp deleted file mode 100644 index 9b6f7ec3e8..0000000000 --- a/internal/engine/sqlite/parser/SQLiteLexer.interp +++ /dev/null @@ -1,630 +0,0 @@ -token literal names: -null -';' -'.' -'(' -')' -',' -'=' -'*' -'+' -'-' -'~' -'||' -'/' -'%' -'<<' -'>>' -'&' -'|' -'<' -'<=' -'>' -'>=' -'==' -'!=' -'<>' -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null - -token symbolic names: -null -SCOL -DOT -OPEN_PAR -CLOSE_PAR -COMMA -ASSIGN -STAR -PLUS -MINUS -TILDE -PIPE2 -DIV -MOD -LT2 -GT2 -AMP -PIPE -LT -LT_EQ -GT -GT_EQ -EQ -NOT_EQ1 -NOT_EQ2 -ABORT_ -ACTION_ -ADD_ -AFTER_ -ALL_ -ALTER_ -ANALYZE_ -AND_ -AS_ -ASC_ -ATTACH_ -AUTOINCREMENT_ -BEFORE_ -BEGIN_ -BETWEEN_ -BY_ -CASCADE_ -CASE_ -CAST_ -CHECK_ -COLLATE_ -COLUMN_ -COMMIT_ -CONFLICT_ -CONSTRAINT_ -CREATE_ -CROSS_ -CURRENT_DATE_ -CURRENT_TIME_ -CURRENT_TIMESTAMP_ -DATABASE_ -DEFAULT_ -DEFERRABLE_ -DEFERRED_ -DELETE_ -DESC_ -DETACH_ -DISTINCT_ -DROP_ -EACH_ -ELSE_ -END_ -ESCAPE_ -EXCEPT_ -EXCLUSIVE_ -EXISTS_ -EXPLAIN_ -FAIL_ -FOR_ -FOREIGN_ -FROM_ -FULL_ -GLOB_ -GROUP_ -HAVING_ -IF_ -IGNORE_ -IMMEDIATE_ -IN_ -INDEX_ -INDEXED_ -INITIALLY_ -INNER_ -INSERT_ -INSTEAD_ -INTERSECT_ -INTO_ -IS_ -ISNULL_ -JOIN_ -KEY_ -LEFT_ -LIKE_ -LIMIT_ -MATCH_ -NATURAL_ -NO_ -NOT_ -NOTNULL_ -NULL_ -OF_ -OFFSET_ -ON_ -OR_ -ORDER_ -OUTER_ -PLAN_ -PRAGMA_ -PRIMARY_ -QUERY_ -RAISE_ -RECURSIVE_ -REFERENCES_ -REGEXP_ -REINDEX_ -RELEASE_ -RENAME_ -REPLACE_ -RESTRICT_ -RETURNING_ -RIGHT_ -ROLLBACK_ -ROW_ -ROWS_ -SAVEPOINT_ -SELECT_ -SET_ -STRICT_ -TABLE_ -TEMP_ -TEMPORARY_ -THEN_ -TO_ -TRANSACTION_ -TRIGGER_ -UNION_ -UNIQUE_ -UPDATE_ -USING_ -VACUUM_ -VALUES_ -VIEW_ -VIRTUAL_ -WHEN_ -WHERE_ -WITH_ -WITHOUT_ -FIRST_VALUE_ -OVER_ -PARTITION_ -RANGE_ -PRECEDING_ -UNBOUNDED_ -CURRENT_ -FOLLOWING_ -CUME_DIST_ -DENSE_RANK_ -LAG_ -LAST_VALUE_ -LEAD_ -NTH_VALUE_ -NTILE_ -PERCENT_RANK_ -RANK_ -ROW_NUMBER_ -GENERATED_ -ALWAYS_ -STORED_ -TRUE_ -FALSE_ -WINDOW_ -NULLS_ -FIRST_ -LAST_ -FILTER_ -GROUPS_ -EXCLUDE_ -TIES_ -OTHERS_ -DO_ -NOTHING_ -IDENTIFIER -NUMERIC_LITERAL -NUMBERED_BIND_PARAMETER -NAMED_BIND_PARAMETER -STRING_LITERAL -BLOB_LITERAL -SINGLE_LINE_COMMENT -MULTILINE_COMMENT -SPACES -UNEXPECTED_CHAR - -rule names: -SCOL -DOT -OPEN_PAR -CLOSE_PAR -COMMA -ASSIGN -STAR -PLUS -MINUS -TILDE -PIPE2 -DIV -MOD -LT2 -GT2 -AMP -PIPE -LT -LT_EQ -GT -GT_EQ -EQ -NOT_EQ1 -NOT_EQ2 -ABORT_ -ACTION_ -ADD_ -AFTER_ -ALL_ -ALTER_ -ANALYZE_ -AND_ -AS_ -ASC_ -ATTACH_ -AUTOINCREMENT_ -BEFORE_ -BEGIN_ -BETWEEN_ -BY_ -CASCADE_ -CASE_ -CAST_ -CHECK_ -COLLATE_ -COLUMN_ -COMMIT_ -CONFLICT_ -CONSTRAINT_ -CREATE_ -CROSS_ -CURRENT_DATE_ -CURRENT_TIME_ -CURRENT_TIMESTAMP_ -DATABASE_ -DEFAULT_ -DEFERRABLE_ -DEFERRED_ -DELETE_ -DESC_ -DETACH_ -DISTINCT_ -DROP_ -EACH_ -ELSE_ -END_ -ESCAPE_ -EXCEPT_ -EXCLUSIVE_ -EXISTS_ -EXPLAIN_ -FAIL_ -FOR_ -FOREIGN_ -FROM_ -FULL_ -GLOB_ -GROUP_ -HAVING_ -IF_ -IGNORE_ -IMMEDIATE_ -IN_ -INDEX_ -INDEXED_ -INITIALLY_ -INNER_ -INSERT_ -INSTEAD_ -INTERSECT_ -INTO_ -IS_ -ISNULL_ -JOIN_ -KEY_ -LEFT_ -LIKE_ -LIMIT_ -MATCH_ -NATURAL_ -NO_ -NOT_ -NOTNULL_ -NULL_ -OF_ -OFFSET_ -ON_ -OR_ -ORDER_ -OUTER_ -PLAN_ -PRAGMA_ -PRIMARY_ -QUERY_ -RAISE_ -RECURSIVE_ -REFERENCES_ -REGEXP_ -REINDEX_ -RELEASE_ -RENAME_ -REPLACE_ -RESTRICT_ -RETURNING_ -RIGHT_ -ROLLBACK_ -ROW_ -ROWS_ -SAVEPOINT_ -SELECT_ -SET_ -STRICT_ -TABLE_ -TEMP_ -TEMPORARY_ -THEN_ -TO_ -TRANSACTION_ -TRIGGER_ -UNION_ -UNIQUE_ -UPDATE_ -USING_ -VACUUM_ -VALUES_ -VIEW_ -VIRTUAL_ -WHEN_ -WHERE_ -WITH_ -WITHOUT_ -FIRST_VALUE_ -OVER_ -PARTITION_ -RANGE_ -PRECEDING_ -UNBOUNDED_ -CURRENT_ -FOLLOWING_ -CUME_DIST_ -DENSE_RANK_ -LAG_ -LAST_VALUE_ -LEAD_ -NTH_VALUE_ -NTILE_ -PERCENT_RANK_ -RANK_ -ROW_NUMBER_ -GENERATED_ -ALWAYS_ -STORED_ -TRUE_ -FALSE_ -WINDOW_ -NULLS_ -FIRST_ -LAST_ -FILTER_ -GROUPS_ -EXCLUDE_ -TIES_ -OTHERS_ -DO_ -NOTHING_ -IDENTIFIER -NUMERIC_LITERAL -NUMBERED_BIND_PARAMETER -NAMED_BIND_PARAMETER -STRING_LITERAL -BLOB_LITERAL -SINGLE_LINE_COMMENT -MULTILINE_COMMENT -SPACES -UNEXPECTED_CHAR -HEX_DIGIT -DIGIT -A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z - -channel names: -DEFAULT_TOKEN_CHANNEL -HIDDEN - -mode names: -DEFAULT_MODE - -atn: -[4, 0, 195, 1818, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, 2, 221, 7, 221, 2, 222, 7, 222, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 5, 185, 1625, 8, 185, 10, 185, 12, 185, 1628, 9, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 5, 185, 1635, 8, 185, 10, 185, 12, 185, 1638, 9, 185, 1, 185, 1, 185, 1, 185, 5, 185, 1643, 8, 185, 10, 185, 12, 185, 1646, 9, 185, 1, 185, 1, 185, 1, 185, 5, 185, 1651, 8, 185, 10, 185, 12, 185, 1654, 9, 185, 3, 185, 1656, 8, 185, 1, 186, 4, 186, 1659, 8, 186, 11, 186, 12, 186, 1660, 1, 186, 1, 186, 5, 186, 1665, 8, 186, 10, 186, 12, 186, 1668, 9, 186, 3, 186, 1670, 8, 186, 1, 186, 1, 186, 4, 186, 1674, 8, 186, 11, 186, 12, 186, 1675, 3, 186, 1678, 8, 186, 1, 186, 1, 186, 3, 186, 1682, 8, 186, 1, 186, 4, 186, 1685, 8, 186, 11, 186, 12, 186, 1686, 3, 186, 1689, 8, 186, 1, 186, 1, 186, 1, 186, 1, 186, 4, 186, 1695, 8, 186, 11, 186, 12, 186, 1696, 3, 186, 1699, 8, 186, 1, 187, 1, 187, 5, 187, 1703, 8, 187, 10, 187, 12, 187, 1706, 9, 187, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, 5, 189, 1715, 8, 189, 10, 189, 12, 189, 1718, 9, 189, 1, 189, 1, 189, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 5, 191, 1729, 8, 191, 10, 191, 12, 191, 1732, 9, 191, 1, 191, 3, 191, 1735, 8, 191, 1, 191, 1, 191, 3, 191, 1739, 8, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, 5, 192, 1747, 8, 192, 10, 192, 12, 192, 1750, 9, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, 195, 1, 195, 1, 196, 1, 196, 1, 197, 1, 197, 1, 198, 1, 198, 1, 199, 1, 199, 1, 200, 1, 200, 1, 201, 1, 201, 1, 202, 1, 202, 1, 203, 1, 203, 1, 204, 1, 204, 1, 205, 1, 205, 1, 206, 1, 206, 1, 207, 1, 207, 1, 208, 1, 208, 1, 209, 1, 209, 1, 210, 1, 210, 1, 211, 1, 211, 1, 212, 1, 212, 1, 213, 1, 213, 1, 214, 1, 214, 1, 215, 1, 215, 1, 216, 1, 216, 1, 217, 1, 217, 1, 218, 1, 218, 1, 219, 1, 219, 1, 220, 1, 220, 1, 221, 1, 221, 1, 222, 1, 222, 1, 1748, 0, 223, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, 137, 69, 139, 70, 141, 71, 143, 72, 145, 73, 147, 74, 149, 75, 151, 76, 153, 77, 155, 78, 157, 79, 159, 80, 161, 81, 163, 82, 165, 83, 167, 84, 169, 85, 171, 86, 173, 87, 175, 88, 177, 89, 179, 90, 181, 91, 183, 92, 185, 93, 187, 94, 189, 95, 191, 96, 193, 97, 195, 98, 197, 99, 199, 100, 201, 101, 203, 102, 205, 103, 207, 104, 209, 105, 211, 106, 213, 107, 215, 108, 217, 109, 219, 110, 221, 111, 223, 112, 225, 113, 227, 114, 229, 115, 231, 116, 233, 117, 235, 118, 237, 119, 239, 120, 241, 121, 243, 122, 245, 123, 247, 124, 249, 125, 251, 126, 253, 127, 255, 128, 257, 129, 259, 130, 261, 131, 263, 132, 265, 133, 267, 134, 269, 135, 271, 136, 273, 137, 275, 138, 277, 139, 279, 140, 281, 141, 283, 142, 285, 143, 287, 144, 289, 145, 291, 146, 293, 147, 295, 148, 297, 149, 299, 150, 301, 151, 303, 152, 305, 153, 307, 154, 309, 155, 311, 156, 313, 157, 315, 158, 317, 159, 319, 160, 321, 161, 323, 162, 325, 163, 327, 164, 329, 165, 331, 166, 333, 167, 335, 168, 337, 169, 339, 170, 341, 171, 343, 172, 345, 173, 347, 174, 349, 175, 351, 176, 353, 177, 355, 178, 357, 179, 359, 180, 361, 181, 363, 182, 365, 183, 367, 184, 369, 185, 371, 186, 373, 187, 375, 188, 377, 189, 379, 190, 381, 191, 383, 192, 385, 193, 387, 194, 389, 195, 391, 0, 393, 0, 395, 0, 397, 0, 399, 0, 401, 0, 403, 0, 405, 0, 407, 0, 409, 0, 411, 0, 413, 0, 415, 0, 417, 0, 419, 0, 421, 0, 423, 0, 425, 0, 427, 0, 429, 0, 431, 0, 433, 0, 435, 0, 437, 0, 439, 0, 441, 0, 443, 0, 445, 0, 1, 0, 38, 1, 0, 34, 34, 1, 0, 96, 96, 1, 0, 93, 93, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 43, 43, 45, 45, 3, 0, 36, 36, 58, 58, 64, 64, 1, 0, 39, 39, 2, 0, 10, 10, 13, 13, 3, 0, 9, 11, 13, 13, 32, 32, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 2, 0, 65, 65, 97, 97, 2, 0, 66, 66, 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, 2, 0, 69, 69, 101, 101, 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, 2, 0, 72, 72, 104, 104, 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, 2, 0, 75, 75, 107, 107, 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, 2, 0, 78, 78, 110, 110, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 81, 81, 113, 113, 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, 2, 0, 84, 84, 116, 116, 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, 122, 1815, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, 0, 271, 1, 0, 0, 0, 0, 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, 0, 0, 0, 0, 279, 1, 0, 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, 285, 1, 0, 0, 0, 0, 287, 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, 0, 0, 0, 293, 1, 0, 0, 0, 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, 1, 0, 0, 0, 0, 301, 1, 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, 0, 307, 1, 0, 0, 0, 0, 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, 0, 0, 0, 0, 315, 1, 0, 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, 321, 1, 0, 0, 0, 0, 323, 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, 0, 0, 0, 329, 1, 0, 0, 0, 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, 1, 0, 0, 0, 0, 337, 1, 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, 0, 343, 1, 0, 0, 0, 0, 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, 0, 0, 0, 0, 351, 1, 0, 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, 357, 1, 0, 0, 0, 0, 359, 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, 0, 0, 0, 365, 1, 0, 0, 0, 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, 1, 0, 0, 0, 0, 373, 1, 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, 0, 379, 1, 0, 0, 0, 0, 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, 0, 0, 0, 0, 387, 1, 0, 0, 0, 0, 389, 1, 0, 0, 0, 1, 447, 1, 0, 0, 0, 3, 449, 1, 0, 0, 0, 5, 451, 1, 0, 0, 0, 7, 453, 1, 0, 0, 0, 9, 455, 1, 0, 0, 0, 11, 457, 1, 0, 0, 0, 13, 459, 1, 0, 0, 0, 15, 461, 1, 0, 0, 0, 17, 463, 1, 0, 0, 0, 19, 465, 1, 0, 0, 0, 21, 467, 1, 0, 0, 0, 23, 470, 1, 0, 0, 0, 25, 472, 1, 0, 0, 0, 27, 474, 1, 0, 0, 0, 29, 477, 1, 0, 0, 0, 31, 480, 1, 0, 0, 0, 33, 482, 1, 0, 0, 0, 35, 484, 1, 0, 0, 0, 37, 486, 1, 0, 0, 0, 39, 489, 1, 0, 0, 0, 41, 491, 1, 0, 0, 0, 43, 494, 1, 0, 0, 0, 45, 497, 1, 0, 0, 0, 47, 500, 1, 0, 0, 0, 49, 503, 1, 0, 0, 0, 51, 509, 1, 0, 0, 0, 53, 516, 1, 0, 0, 0, 55, 520, 1, 0, 0, 0, 57, 526, 1, 0, 0, 0, 59, 530, 1, 0, 0, 0, 61, 536, 1, 0, 0, 0, 63, 544, 1, 0, 0, 0, 65, 548, 1, 0, 0, 0, 67, 551, 1, 0, 0, 0, 69, 555, 1, 0, 0, 0, 71, 562, 1, 0, 0, 0, 73, 576, 1, 0, 0, 0, 75, 583, 1, 0, 0, 0, 77, 589, 1, 0, 0, 0, 79, 597, 1, 0, 0, 0, 81, 600, 1, 0, 0, 0, 83, 608, 1, 0, 0, 0, 85, 613, 1, 0, 0, 0, 87, 618, 1, 0, 0, 0, 89, 624, 1, 0, 0, 0, 91, 632, 1, 0, 0, 0, 93, 639, 1, 0, 0, 0, 95, 646, 1, 0, 0, 0, 97, 655, 1, 0, 0, 0, 99, 666, 1, 0, 0, 0, 101, 673, 1, 0, 0, 0, 103, 679, 1, 0, 0, 0, 105, 692, 1, 0, 0, 0, 107, 705, 1, 0, 0, 0, 109, 723, 1, 0, 0, 0, 111, 732, 1, 0, 0, 0, 113, 740, 1, 0, 0, 0, 115, 751, 1, 0, 0, 0, 117, 760, 1, 0, 0, 0, 119, 767, 1, 0, 0, 0, 121, 772, 1, 0, 0, 0, 123, 779, 1, 0, 0, 0, 125, 788, 1, 0, 0, 0, 127, 793, 1, 0, 0, 0, 129, 798, 1, 0, 0, 0, 131, 803, 1, 0, 0, 0, 133, 807, 1, 0, 0, 0, 135, 814, 1, 0, 0, 0, 137, 821, 1, 0, 0, 0, 139, 831, 1, 0, 0, 0, 141, 838, 1, 0, 0, 0, 143, 846, 1, 0, 0, 0, 145, 851, 1, 0, 0, 0, 147, 855, 1, 0, 0, 0, 149, 863, 1, 0, 0, 0, 151, 868, 1, 0, 0, 0, 153, 873, 1, 0, 0, 0, 155, 878, 1, 0, 0, 0, 157, 884, 1, 0, 0, 0, 159, 891, 1, 0, 0, 0, 161, 894, 1, 0, 0, 0, 163, 901, 1, 0, 0, 0, 165, 911, 1, 0, 0, 0, 167, 914, 1, 0, 0, 0, 169, 920, 1, 0, 0, 0, 171, 928, 1, 0, 0, 0, 173, 938, 1, 0, 0, 0, 175, 944, 1, 0, 0, 0, 177, 951, 1, 0, 0, 0, 179, 959, 1, 0, 0, 0, 181, 969, 1, 0, 0, 0, 183, 974, 1, 0, 0, 0, 185, 977, 1, 0, 0, 0, 187, 984, 1, 0, 0, 0, 189, 989, 1, 0, 0, 0, 191, 993, 1, 0, 0, 0, 193, 998, 1, 0, 0, 0, 195, 1003, 1, 0, 0, 0, 197, 1009, 1, 0, 0, 0, 199, 1015, 1, 0, 0, 0, 201, 1023, 1, 0, 0, 0, 203, 1026, 1, 0, 0, 0, 205, 1030, 1, 0, 0, 0, 207, 1038, 1, 0, 0, 0, 209, 1043, 1, 0, 0, 0, 211, 1046, 1, 0, 0, 0, 213, 1053, 1, 0, 0, 0, 215, 1056, 1, 0, 0, 0, 217, 1059, 1, 0, 0, 0, 219, 1065, 1, 0, 0, 0, 221, 1071, 1, 0, 0, 0, 223, 1076, 1, 0, 0, 0, 225, 1083, 1, 0, 0, 0, 227, 1091, 1, 0, 0, 0, 229, 1097, 1, 0, 0, 0, 231, 1103, 1, 0, 0, 0, 233, 1113, 1, 0, 0, 0, 235, 1124, 1, 0, 0, 0, 237, 1131, 1, 0, 0, 0, 239, 1139, 1, 0, 0, 0, 241, 1147, 1, 0, 0, 0, 243, 1154, 1, 0, 0, 0, 245, 1162, 1, 0, 0, 0, 247, 1171, 1, 0, 0, 0, 249, 1181, 1, 0, 0, 0, 251, 1187, 1, 0, 0, 0, 253, 1196, 1, 0, 0, 0, 255, 1200, 1, 0, 0, 0, 257, 1205, 1, 0, 0, 0, 259, 1215, 1, 0, 0, 0, 261, 1222, 1, 0, 0, 0, 263, 1226, 1, 0, 0, 0, 265, 1233, 1, 0, 0, 0, 267, 1239, 1, 0, 0, 0, 269, 1244, 1, 0, 0, 0, 271, 1254, 1, 0, 0, 0, 273, 1259, 1, 0, 0, 0, 275, 1262, 1, 0, 0, 0, 277, 1274, 1, 0, 0, 0, 279, 1282, 1, 0, 0, 0, 281, 1288, 1, 0, 0, 0, 283, 1295, 1, 0, 0, 0, 285, 1302, 1, 0, 0, 0, 287, 1308, 1, 0, 0, 0, 289, 1315, 1, 0, 0, 0, 291, 1322, 1, 0, 0, 0, 293, 1327, 1, 0, 0, 0, 295, 1335, 1, 0, 0, 0, 297, 1340, 1, 0, 0, 0, 299, 1346, 1, 0, 0, 0, 301, 1351, 1, 0, 0, 0, 303, 1359, 1, 0, 0, 0, 305, 1371, 1, 0, 0, 0, 307, 1376, 1, 0, 0, 0, 309, 1386, 1, 0, 0, 0, 311, 1392, 1, 0, 0, 0, 313, 1402, 1, 0, 0, 0, 315, 1412, 1, 0, 0, 0, 317, 1420, 1, 0, 0, 0, 319, 1430, 1, 0, 0, 0, 321, 1440, 1, 0, 0, 0, 323, 1451, 1, 0, 0, 0, 325, 1455, 1, 0, 0, 0, 327, 1466, 1, 0, 0, 0, 329, 1471, 1, 0, 0, 0, 331, 1481, 1, 0, 0, 0, 333, 1487, 1, 0, 0, 0, 335, 1500, 1, 0, 0, 0, 337, 1505, 1, 0, 0, 0, 339, 1516, 1, 0, 0, 0, 341, 1526, 1, 0, 0, 0, 343, 1533, 1, 0, 0, 0, 345, 1540, 1, 0, 0, 0, 347, 1545, 1, 0, 0, 0, 349, 1551, 1, 0, 0, 0, 351, 1558, 1, 0, 0, 0, 353, 1564, 1, 0, 0, 0, 355, 1570, 1, 0, 0, 0, 357, 1575, 1, 0, 0, 0, 359, 1582, 1, 0, 0, 0, 361, 1589, 1, 0, 0, 0, 363, 1597, 1, 0, 0, 0, 365, 1602, 1, 0, 0, 0, 367, 1609, 1, 0, 0, 0, 369, 1612, 1, 0, 0, 0, 371, 1655, 1, 0, 0, 0, 373, 1698, 1, 0, 0, 0, 375, 1700, 1, 0, 0, 0, 377, 1707, 1, 0, 0, 0, 379, 1710, 1, 0, 0, 0, 381, 1721, 1, 0, 0, 0, 383, 1724, 1, 0, 0, 0, 385, 1742, 1, 0, 0, 0, 387, 1756, 1, 0, 0, 0, 389, 1760, 1, 0, 0, 0, 391, 1762, 1, 0, 0, 0, 393, 1764, 1, 0, 0, 0, 395, 1766, 1, 0, 0, 0, 397, 1768, 1, 0, 0, 0, 399, 1770, 1, 0, 0, 0, 401, 1772, 1, 0, 0, 0, 403, 1774, 1, 0, 0, 0, 405, 1776, 1, 0, 0, 0, 407, 1778, 1, 0, 0, 0, 409, 1780, 1, 0, 0, 0, 411, 1782, 1, 0, 0, 0, 413, 1784, 1, 0, 0, 0, 415, 1786, 1, 0, 0, 0, 417, 1788, 1, 0, 0, 0, 419, 1790, 1, 0, 0, 0, 421, 1792, 1, 0, 0, 0, 423, 1794, 1, 0, 0, 0, 425, 1796, 1, 0, 0, 0, 427, 1798, 1, 0, 0, 0, 429, 1800, 1, 0, 0, 0, 431, 1802, 1, 0, 0, 0, 433, 1804, 1, 0, 0, 0, 435, 1806, 1, 0, 0, 0, 437, 1808, 1, 0, 0, 0, 439, 1810, 1, 0, 0, 0, 441, 1812, 1, 0, 0, 0, 443, 1814, 1, 0, 0, 0, 445, 1816, 1, 0, 0, 0, 447, 448, 5, 59, 0, 0, 448, 2, 1, 0, 0, 0, 449, 450, 5, 46, 0, 0, 450, 4, 1, 0, 0, 0, 451, 452, 5, 40, 0, 0, 452, 6, 1, 0, 0, 0, 453, 454, 5, 41, 0, 0, 454, 8, 1, 0, 0, 0, 455, 456, 5, 44, 0, 0, 456, 10, 1, 0, 0, 0, 457, 458, 5, 61, 0, 0, 458, 12, 1, 0, 0, 0, 459, 460, 5, 42, 0, 0, 460, 14, 1, 0, 0, 0, 461, 462, 5, 43, 0, 0, 462, 16, 1, 0, 0, 0, 463, 464, 5, 45, 0, 0, 464, 18, 1, 0, 0, 0, 465, 466, 5, 126, 0, 0, 466, 20, 1, 0, 0, 0, 467, 468, 5, 124, 0, 0, 468, 469, 5, 124, 0, 0, 469, 22, 1, 0, 0, 0, 470, 471, 5, 47, 0, 0, 471, 24, 1, 0, 0, 0, 472, 473, 5, 37, 0, 0, 473, 26, 1, 0, 0, 0, 474, 475, 5, 60, 0, 0, 475, 476, 5, 60, 0, 0, 476, 28, 1, 0, 0, 0, 477, 478, 5, 62, 0, 0, 478, 479, 5, 62, 0, 0, 479, 30, 1, 0, 0, 0, 480, 481, 5, 38, 0, 0, 481, 32, 1, 0, 0, 0, 482, 483, 5, 124, 0, 0, 483, 34, 1, 0, 0, 0, 484, 485, 5, 60, 0, 0, 485, 36, 1, 0, 0, 0, 486, 487, 5, 60, 0, 0, 487, 488, 5, 61, 0, 0, 488, 38, 1, 0, 0, 0, 489, 490, 5, 62, 0, 0, 490, 40, 1, 0, 0, 0, 491, 492, 5, 62, 0, 0, 492, 493, 5, 61, 0, 0, 493, 42, 1, 0, 0, 0, 494, 495, 5, 61, 0, 0, 495, 496, 5, 61, 0, 0, 496, 44, 1, 0, 0, 0, 497, 498, 5, 33, 0, 0, 498, 499, 5, 61, 0, 0, 499, 46, 1, 0, 0, 0, 500, 501, 5, 60, 0, 0, 501, 502, 5, 62, 0, 0, 502, 48, 1, 0, 0, 0, 503, 504, 3, 395, 197, 0, 504, 505, 3, 397, 198, 0, 505, 506, 3, 423, 211, 0, 506, 507, 3, 429, 214, 0, 507, 508, 3, 433, 216, 0, 508, 50, 1, 0, 0, 0, 509, 510, 3, 395, 197, 0, 510, 511, 3, 399, 199, 0, 511, 512, 3, 433, 216, 0, 512, 513, 3, 411, 205, 0, 513, 514, 3, 423, 211, 0, 514, 515, 3, 421, 210, 0, 515, 52, 1, 0, 0, 0, 516, 517, 3, 395, 197, 0, 517, 518, 3, 401, 200, 0, 518, 519, 3, 401, 200, 0, 519, 54, 1, 0, 0, 0, 520, 521, 3, 395, 197, 0, 521, 522, 3, 405, 202, 0, 522, 523, 3, 433, 216, 0, 523, 524, 3, 403, 201, 0, 524, 525, 3, 429, 214, 0, 525, 56, 1, 0, 0, 0, 526, 527, 3, 395, 197, 0, 527, 528, 3, 417, 208, 0, 528, 529, 3, 417, 208, 0, 529, 58, 1, 0, 0, 0, 530, 531, 3, 395, 197, 0, 531, 532, 3, 417, 208, 0, 532, 533, 3, 433, 216, 0, 533, 534, 3, 403, 201, 0, 534, 535, 3, 429, 214, 0, 535, 60, 1, 0, 0, 0, 536, 537, 3, 395, 197, 0, 537, 538, 3, 421, 210, 0, 538, 539, 3, 395, 197, 0, 539, 540, 3, 417, 208, 0, 540, 541, 3, 443, 221, 0, 541, 542, 3, 445, 222, 0, 542, 543, 3, 403, 201, 0, 543, 62, 1, 0, 0, 0, 544, 545, 3, 395, 197, 0, 545, 546, 3, 421, 210, 0, 546, 547, 3, 401, 200, 0, 547, 64, 1, 0, 0, 0, 548, 549, 3, 395, 197, 0, 549, 550, 3, 431, 215, 0, 550, 66, 1, 0, 0, 0, 551, 552, 3, 395, 197, 0, 552, 553, 3, 431, 215, 0, 553, 554, 3, 399, 199, 0, 554, 68, 1, 0, 0, 0, 555, 556, 3, 395, 197, 0, 556, 557, 3, 433, 216, 0, 557, 558, 3, 433, 216, 0, 558, 559, 3, 395, 197, 0, 559, 560, 3, 399, 199, 0, 560, 561, 3, 409, 204, 0, 561, 70, 1, 0, 0, 0, 562, 563, 3, 395, 197, 0, 563, 564, 3, 435, 217, 0, 564, 565, 3, 433, 216, 0, 565, 566, 3, 423, 211, 0, 566, 567, 3, 411, 205, 0, 567, 568, 3, 421, 210, 0, 568, 569, 3, 399, 199, 0, 569, 570, 3, 429, 214, 0, 570, 571, 3, 403, 201, 0, 571, 572, 3, 419, 209, 0, 572, 573, 3, 403, 201, 0, 573, 574, 3, 421, 210, 0, 574, 575, 3, 433, 216, 0, 575, 72, 1, 0, 0, 0, 576, 577, 3, 397, 198, 0, 577, 578, 3, 403, 201, 0, 578, 579, 3, 405, 202, 0, 579, 580, 3, 423, 211, 0, 580, 581, 3, 429, 214, 0, 581, 582, 3, 403, 201, 0, 582, 74, 1, 0, 0, 0, 583, 584, 3, 397, 198, 0, 584, 585, 3, 403, 201, 0, 585, 586, 3, 407, 203, 0, 586, 587, 3, 411, 205, 0, 587, 588, 3, 421, 210, 0, 588, 76, 1, 0, 0, 0, 589, 590, 3, 397, 198, 0, 590, 591, 3, 403, 201, 0, 591, 592, 3, 433, 216, 0, 592, 593, 3, 439, 219, 0, 593, 594, 3, 403, 201, 0, 594, 595, 3, 403, 201, 0, 595, 596, 3, 421, 210, 0, 596, 78, 1, 0, 0, 0, 597, 598, 3, 397, 198, 0, 598, 599, 3, 443, 221, 0, 599, 80, 1, 0, 0, 0, 600, 601, 3, 399, 199, 0, 601, 602, 3, 395, 197, 0, 602, 603, 3, 431, 215, 0, 603, 604, 3, 399, 199, 0, 604, 605, 3, 395, 197, 0, 605, 606, 3, 401, 200, 0, 606, 607, 3, 403, 201, 0, 607, 82, 1, 0, 0, 0, 608, 609, 3, 399, 199, 0, 609, 610, 3, 395, 197, 0, 610, 611, 3, 431, 215, 0, 611, 612, 3, 403, 201, 0, 612, 84, 1, 0, 0, 0, 613, 614, 3, 399, 199, 0, 614, 615, 3, 395, 197, 0, 615, 616, 3, 431, 215, 0, 616, 617, 3, 433, 216, 0, 617, 86, 1, 0, 0, 0, 618, 619, 3, 399, 199, 0, 619, 620, 3, 409, 204, 0, 620, 621, 3, 403, 201, 0, 621, 622, 3, 399, 199, 0, 622, 623, 3, 415, 207, 0, 623, 88, 1, 0, 0, 0, 624, 625, 3, 399, 199, 0, 625, 626, 3, 423, 211, 0, 626, 627, 3, 417, 208, 0, 627, 628, 3, 417, 208, 0, 628, 629, 3, 395, 197, 0, 629, 630, 3, 433, 216, 0, 630, 631, 3, 403, 201, 0, 631, 90, 1, 0, 0, 0, 632, 633, 3, 399, 199, 0, 633, 634, 3, 423, 211, 0, 634, 635, 3, 417, 208, 0, 635, 636, 3, 435, 217, 0, 636, 637, 3, 419, 209, 0, 637, 638, 3, 421, 210, 0, 638, 92, 1, 0, 0, 0, 639, 640, 3, 399, 199, 0, 640, 641, 3, 423, 211, 0, 641, 642, 3, 419, 209, 0, 642, 643, 3, 419, 209, 0, 643, 644, 3, 411, 205, 0, 644, 645, 3, 433, 216, 0, 645, 94, 1, 0, 0, 0, 646, 647, 3, 399, 199, 0, 647, 648, 3, 423, 211, 0, 648, 649, 3, 421, 210, 0, 649, 650, 3, 405, 202, 0, 650, 651, 3, 417, 208, 0, 651, 652, 3, 411, 205, 0, 652, 653, 3, 399, 199, 0, 653, 654, 3, 433, 216, 0, 654, 96, 1, 0, 0, 0, 655, 656, 3, 399, 199, 0, 656, 657, 3, 423, 211, 0, 657, 658, 3, 421, 210, 0, 658, 659, 3, 431, 215, 0, 659, 660, 3, 433, 216, 0, 660, 661, 3, 429, 214, 0, 661, 662, 3, 395, 197, 0, 662, 663, 3, 411, 205, 0, 663, 664, 3, 421, 210, 0, 664, 665, 3, 433, 216, 0, 665, 98, 1, 0, 0, 0, 666, 667, 3, 399, 199, 0, 667, 668, 3, 429, 214, 0, 668, 669, 3, 403, 201, 0, 669, 670, 3, 395, 197, 0, 670, 671, 3, 433, 216, 0, 671, 672, 3, 403, 201, 0, 672, 100, 1, 0, 0, 0, 673, 674, 3, 399, 199, 0, 674, 675, 3, 429, 214, 0, 675, 676, 3, 423, 211, 0, 676, 677, 3, 431, 215, 0, 677, 678, 3, 431, 215, 0, 678, 102, 1, 0, 0, 0, 679, 680, 3, 399, 199, 0, 680, 681, 3, 435, 217, 0, 681, 682, 3, 429, 214, 0, 682, 683, 3, 429, 214, 0, 683, 684, 3, 403, 201, 0, 684, 685, 3, 421, 210, 0, 685, 686, 3, 433, 216, 0, 686, 687, 5, 95, 0, 0, 687, 688, 3, 401, 200, 0, 688, 689, 3, 395, 197, 0, 689, 690, 3, 433, 216, 0, 690, 691, 3, 403, 201, 0, 691, 104, 1, 0, 0, 0, 692, 693, 3, 399, 199, 0, 693, 694, 3, 435, 217, 0, 694, 695, 3, 429, 214, 0, 695, 696, 3, 429, 214, 0, 696, 697, 3, 403, 201, 0, 697, 698, 3, 421, 210, 0, 698, 699, 3, 433, 216, 0, 699, 700, 5, 95, 0, 0, 700, 701, 3, 433, 216, 0, 701, 702, 3, 411, 205, 0, 702, 703, 3, 419, 209, 0, 703, 704, 3, 403, 201, 0, 704, 106, 1, 0, 0, 0, 705, 706, 3, 399, 199, 0, 706, 707, 3, 435, 217, 0, 707, 708, 3, 429, 214, 0, 708, 709, 3, 429, 214, 0, 709, 710, 3, 403, 201, 0, 710, 711, 3, 421, 210, 0, 711, 712, 3, 433, 216, 0, 712, 713, 5, 95, 0, 0, 713, 714, 3, 433, 216, 0, 714, 715, 3, 411, 205, 0, 715, 716, 3, 419, 209, 0, 716, 717, 3, 403, 201, 0, 717, 718, 3, 431, 215, 0, 718, 719, 3, 433, 216, 0, 719, 720, 3, 395, 197, 0, 720, 721, 3, 419, 209, 0, 721, 722, 3, 425, 212, 0, 722, 108, 1, 0, 0, 0, 723, 724, 3, 401, 200, 0, 724, 725, 3, 395, 197, 0, 725, 726, 3, 433, 216, 0, 726, 727, 3, 395, 197, 0, 727, 728, 3, 397, 198, 0, 728, 729, 3, 395, 197, 0, 729, 730, 3, 431, 215, 0, 730, 731, 3, 403, 201, 0, 731, 110, 1, 0, 0, 0, 732, 733, 3, 401, 200, 0, 733, 734, 3, 403, 201, 0, 734, 735, 3, 405, 202, 0, 735, 736, 3, 395, 197, 0, 736, 737, 3, 435, 217, 0, 737, 738, 3, 417, 208, 0, 738, 739, 3, 433, 216, 0, 739, 112, 1, 0, 0, 0, 740, 741, 3, 401, 200, 0, 741, 742, 3, 403, 201, 0, 742, 743, 3, 405, 202, 0, 743, 744, 3, 403, 201, 0, 744, 745, 3, 429, 214, 0, 745, 746, 3, 429, 214, 0, 746, 747, 3, 395, 197, 0, 747, 748, 3, 397, 198, 0, 748, 749, 3, 417, 208, 0, 749, 750, 3, 403, 201, 0, 750, 114, 1, 0, 0, 0, 751, 752, 3, 401, 200, 0, 752, 753, 3, 403, 201, 0, 753, 754, 3, 405, 202, 0, 754, 755, 3, 403, 201, 0, 755, 756, 3, 429, 214, 0, 756, 757, 3, 429, 214, 0, 757, 758, 3, 403, 201, 0, 758, 759, 3, 401, 200, 0, 759, 116, 1, 0, 0, 0, 760, 761, 3, 401, 200, 0, 761, 762, 3, 403, 201, 0, 762, 763, 3, 417, 208, 0, 763, 764, 3, 403, 201, 0, 764, 765, 3, 433, 216, 0, 765, 766, 3, 403, 201, 0, 766, 118, 1, 0, 0, 0, 767, 768, 3, 401, 200, 0, 768, 769, 3, 403, 201, 0, 769, 770, 3, 431, 215, 0, 770, 771, 3, 399, 199, 0, 771, 120, 1, 0, 0, 0, 772, 773, 3, 401, 200, 0, 773, 774, 3, 403, 201, 0, 774, 775, 3, 433, 216, 0, 775, 776, 3, 395, 197, 0, 776, 777, 3, 399, 199, 0, 777, 778, 3, 409, 204, 0, 778, 122, 1, 0, 0, 0, 779, 780, 3, 401, 200, 0, 780, 781, 3, 411, 205, 0, 781, 782, 3, 431, 215, 0, 782, 783, 3, 433, 216, 0, 783, 784, 3, 411, 205, 0, 784, 785, 3, 421, 210, 0, 785, 786, 3, 399, 199, 0, 786, 787, 3, 433, 216, 0, 787, 124, 1, 0, 0, 0, 788, 789, 3, 401, 200, 0, 789, 790, 3, 429, 214, 0, 790, 791, 3, 423, 211, 0, 791, 792, 3, 425, 212, 0, 792, 126, 1, 0, 0, 0, 793, 794, 3, 403, 201, 0, 794, 795, 3, 395, 197, 0, 795, 796, 3, 399, 199, 0, 796, 797, 3, 409, 204, 0, 797, 128, 1, 0, 0, 0, 798, 799, 3, 403, 201, 0, 799, 800, 3, 417, 208, 0, 800, 801, 3, 431, 215, 0, 801, 802, 3, 403, 201, 0, 802, 130, 1, 0, 0, 0, 803, 804, 3, 403, 201, 0, 804, 805, 3, 421, 210, 0, 805, 806, 3, 401, 200, 0, 806, 132, 1, 0, 0, 0, 807, 808, 3, 403, 201, 0, 808, 809, 3, 431, 215, 0, 809, 810, 3, 399, 199, 0, 810, 811, 3, 395, 197, 0, 811, 812, 3, 425, 212, 0, 812, 813, 3, 403, 201, 0, 813, 134, 1, 0, 0, 0, 814, 815, 3, 403, 201, 0, 815, 816, 3, 441, 220, 0, 816, 817, 3, 399, 199, 0, 817, 818, 3, 403, 201, 0, 818, 819, 3, 425, 212, 0, 819, 820, 3, 433, 216, 0, 820, 136, 1, 0, 0, 0, 821, 822, 3, 403, 201, 0, 822, 823, 3, 441, 220, 0, 823, 824, 3, 399, 199, 0, 824, 825, 3, 417, 208, 0, 825, 826, 3, 435, 217, 0, 826, 827, 3, 431, 215, 0, 827, 828, 3, 411, 205, 0, 828, 829, 3, 437, 218, 0, 829, 830, 3, 403, 201, 0, 830, 138, 1, 0, 0, 0, 831, 832, 3, 403, 201, 0, 832, 833, 3, 441, 220, 0, 833, 834, 3, 411, 205, 0, 834, 835, 3, 431, 215, 0, 835, 836, 3, 433, 216, 0, 836, 837, 3, 431, 215, 0, 837, 140, 1, 0, 0, 0, 838, 839, 3, 403, 201, 0, 839, 840, 3, 441, 220, 0, 840, 841, 3, 425, 212, 0, 841, 842, 3, 417, 208, 0, 842, 843, 3, 395, 197, 0, 843, 844, 3, 411, 205, 0, 844, 845, 3, 421, 210, 0, 845, 142, 1, 0, 0, 0, 846, 847, 3, 405, 202, 0, 847, 848, 3, 395, 197, 0, 848, 849, 3, 411, 205, 0, 849, 850, 3, 417, 208, 0, 850, 144, 1, 0, 0, 0, 851, 852, 3, 405, 202, 0, 852, 853, 3, 423, 211, 0, 853, 854, 3, 429, 214, 0, 854, 146, 1, 0, 0, 0, 855, 856, 3, 405, 202, 0, 856, 857, 3, 423, 211, 0, 857, 858, 3, 429, 214, 0, 858, 859, 3, 403, 201, 0, 859, 860, 3, 411, 205, 0, 860, 861, 3, 407, 203, 0, 861, 862, 3, 421, 210, 0, 862, 148, 1, 0, 0, 0, 863, 864, 3, 405, 202, 0, 864, 865, 3, 429, 214, 0, 865, 866, 3, 423, 211, 0, 866, 867, 3, 419, 209, 0, 867, 150, 1, 0, 0, 0, 868, 869, 3, 405, 202, 0, 869, 870, 3, 435, 217, 0, 870, 871, 3, 417, 208, 0, 871, 872, 3, 417, 208, 0, 872, 152, 1, 0, 0, 0, 873, 874, 3, 407, 203, 0, 874, 875, 3, 417, 208, 0, 875, 876, 3, 423, 211, 0, 876, 877, 3, 397, 198, 0, 877, 154, 1, 0, 0, 0, 878, 879, 3, 407, 203, 0, 879, 880, 3, 429, 214, 0, 880, 881, 3, 423, 211, 0, 881, 882, 3, 435, 217, 0, 882, 883, 3, 425, 212, 0, 883, 156, 1, 0, 0, 0, 884, 885, 3, 409, 204, 0, 885, 886, 3, 395, 197, 0, 886, 887, 3, 437, 218, 0, 887, 888, 3, 411, 205, 0, 888, 889, 3, 421, 210, 0, 889, 890, 3, 407, 203, 0, 890, 158, 1, 0, 0, 0, 891, 892, 3, 411, 205, 0, 892, 893, 3, 405, 202, 0, 893, 160, 1, 0, 0, 0, 894, 895, 3, 411, 205, 0, 895, 896, 3, 407, 203, 0, 896, 897, 3, 421, 210, 0, 897, 898, 3, 423, 211, 0, 898, 899, 3, 429, 214, 0, 899, 900, 3, 403, 201, 0, 900, 162, 1, 0, 0, 0, 901, 902, 3, 411, 205, 0, 902, 903, 3, 419, 209, 0, 903, 904, 3, 419, 209, 0, 904, 905, 3, 403, 201, 0, 905, 906, 3, 401, 200, 0, 906, 907, 3, 411, 205, 0, 907, 908, 3, 395, 197, 0, 908, 909, 3, 433, 216, 0, 909, 910, 3, 403, 201, 0, 910, 164, 1, 0, 0, 0, 911, 912, 3, 411, 205, 0, 912, 913, 3, 421, 210, 0, 913, 166, 1, 0, 0, 0, 914, 915, 3, 411, 205, 0, 915, 916, 3, 421, 210, 0, 916, 917, 3, 401, 200, 0, 917, 918, 3, 403, 201, 0, 918, 919, 3, 441, 220, 0, 919, 168, 1, 0, 0, 0, 920, 921, 3, 411, 205, 0, 921, 922, 3, 421, 210, 0, 922, 923, 3, 401, 200, 0, 923, 924, 3, 403, 201, 0, 924, 925, 3, 441, 220, 0, 925, 926, 3, 403, 201, 0, 926, 927, 3, 401, 200, 0, 927, 170, 1, 0, 0, 0, 928, 929, 3, 411, 205, 0, 929, 930, 3, 421, 210, 0, 930, 931, 3, 411, 205, 0, 931, 932, 3, 433, 216, 0, 932, 933, 3, 411, 205, 0, 933, 934, 3, 395, 197, 0, 934, 935, 3, 417, 208, 0, 935, 936, 3, 417, 208, 0, 936, 937, 3, 443, 221, 0, 937, 172, 1, 0, 0, 0, 938, 939, 3, 411, 205, 0, 939, 940, 3, 421, 210, 0, 940, 941, 3, 421, 210, 0, 941, 942, 3, 403, 201, 0, 942, 943, 3, 429, 214, 0, 943, 174, 1, 0, 0, 0, 944, 945, 3, 411, 205, 0, 945, 946, 3, 421, 210, 0, 946, 947, 3, 431, 215, 0, 947, 948, 3, 403, 201, 0, 948, 949, 3, 429, 214, 0, 949, 950, 3, 433, 216, 0, 950, 176, 1, 0, 0, 0, 951, 952, 3, 411, 205, 0, 952, 953, 3, 421, 210, 0, 953, 954, 3, 431, 215, 0, 954, 955, 3, 433, 216, 0, 955, 956, 3, 403, 201, 0, 956, 957, 3, 395, 197, 0, 957, 958, 3, 401, 200, 0, 958, 178, 1, 0, 0, 0, 959, 960, 3, 411, 205, 0, 960, 961, 3, 421, 210, 0, 961, 962, 3, 433, 216, 0, 962, 963, 3, 403, 201, 0, 963, 964, 3, 429, 214, 0, 964, 965, 3, 431, 215, 0, 965, 966, 3, 403, 201, 0, 966, 967, 3, 399, 199, 0, 967, 968, 3, 433, 216, 0, 968, 180, 1, 0, 0, 0, 969, 970, 3, 411, 205, 0, 970, 971, 3, 421, 210, 0, 971, 972, 3, 433, 216, 0, 972, 973, 3, 423, 211, 0, 973, 182, 1, 0, 0, 0, 974, 975, 3, 411, 205, 0, 975, 976, 3, 431, 215, 0, 976, 184, 1, 0, 0, 0, 977, 978, 3, 411, 205, 0, 978, 979, 3, 431, 215, 0, 979, 980, 3, 421, 210, 0, 980, 981, 3, 435, 217, 0, 981, 982, 3, 417, 208, 0, 982, 983, 3, 417, 208, 0, 983, 186, 1, 0, 0, 0, 984, 985, 3, 413, 206, 0, 985, 986, 3, 423, 211, 0, 986, 987, 3, 411, 205, 0, 987, 988, 3, 421, 210, 0, 988, 188, 1, 0, 0, 0, 989, 990, 3, 415, 207, 0, 990, 991, 3, 403, 201, 0, 991, 992, 3, 443, 221, 0, 992, 190, 1, 0, 0, 0, 993, 994, 3, 417, 208, 0, 994, 995, 3, 403, 201, 0, 995, 996, 3, 405, 202, 0, 996, 997, 3, 433, 216, 0, 997, 192, 1, 0, 0, 0, 998, 999, 3, 417, 208, 0, 999, 1000, 3, 411, 205, 0, 1000, 1001, 3, 415, 207, 0, 1001, 1002, 3, 403, 201, 0, 1002, 194, 1, 0, 0, 0, 1003, 1004, 3, 417, 208, 0, 1004, 1005, 3, 411, 205, 0, 1005, 1006, 3, 419, 209, 0, 1006, 1007, 3, 411, 205, 0, 1007, 1008, 3, 433, 216, 0, 1008, 196, 1, 0, 0, 0, 1009, 1010, 3, 419, 209, 0, 1010, 1011, 3, 395, 197, 0, 1011, 1012, 3, 433, 216, 0, 1012, 1013, 3, 399, 199, 0, 1013, 1014, 3, 409, 204, 0, 1014, 198, 1, 0, 0, 0, 1015, 1016, 3, 421, 210, 0, 1016, 1017, 3, 395, 197, 0, 1017, 1018, 3, 433, 216, 0, 1018, 1019, 3, 435, 217, 0, 1019, 1020, 3, 429, 214, 0, 1020, 1021, 3, 395, 197, 0, 1021, 1022, 3, 417, 208, 0, 1022, 200, 1, 0, 0, 0, 1023, 1024, 3, 421, 210, 0, 1024, 1025, 3, 423, 211, 0, 1025, 202, 1, 0, 0, 0, 1026, 1027, 3, 421, 210, 0, 1027, 1028, 3, 423, 211, 0, 1028, 1029, 3, 433, 216, 0, 1029, 204, 1, 0, 0, 0, 1030, 1031, 3, 421, 210, 0, 1031, 1032, 3, 423, 211, 0, 1032, 1033, 3, 433, 216, 0, 1033, 1034, 3, 421, 210, 0, 1034, 1035, 3, 435, 217, 0, 1035, 1036, 3, 417, 208, 0, 1036, 1037, 3, 417, 208, 0, 1037, 206, 1, 0, 0, 0, 1038, 1039, 3, 421, 210, 0, 1039, 1040, 3, 435, 217, 0, 1040, 1041, 3, 417, 208, 0, 1041, 1042, 3, 417, 208, 0, 1042, 208, 1, 0, 0, 0, 1043, 1044, 3, 423, 211, 0, 1044, 1045, 3, 405, 202, 0, 1045, 210, 1, 0, 0, 0, 1046, 1047, 3, 423, 211, 0, 1047, 1048, 3, 405, 202, 0, 1048, 1049, 3, 405, 202, 0, 1049, 1050, 3, 431, 215, 0, 1050, 1051, 3, 403, 201, 0, 1051, 1052, 3, 433, 216, 0, 1052, 212, 1, 0, 0, 0, 1053, 1054, 3, 423, 211, 0, 1054, 1055, 3, 421, 210, 0, 1055, 214, 1, 0, 0, 0, 1056, 1057, 3, 423, 211, 0, 1057, 1058, 3, 429, 214, 0, 1058, 216, 1, 0, 0, 0, 1059, 1060, 3, 423, 211, 0, 1060, 1061, 3, 429, 214, 0, 1061, 1062, 3, 401, 200, 0, 1062, 1063, 3, 403, 201, 0, 1063, 1064, 3, 429, 214, 0, 1064, 218, 1, 0, 0, 0, 1065, 1066, 3, 423, 211, 0, 1066, 1067, 3, 435, 217, 0, 1067, 1068, 3, 433, 216, 0, 1068, 1069, 3, 403, 201, 0, 1069, 1070, 3, 429, 214, 0, 1070, 220, 1, 0, 0, 0, 1071, 1072, 3, 425, 212, 0, 1072, 1073, 3, 417, 208, 0, 1073, 1074, 3, 395, 197, 0, 1074, 1075, 3, 421, 210, 0, 1075, 222, 1, 0, 0, 0, 1076, 1077, 3, 425, 212, 0, 1077, 1078, 3, 429, 214, 0, 1078, 1079, 3, 395, 197, 0, 1079, 1080, 3, 407, 203, 0, 1080, 1081, 3, 419, 209, 0, 1081, 1082, 3, 395, 197, 0, 1082, 224, 1, 0, 0, 0, 1083, 1084, 3, 425, 212, 0, 1084, 1085, 3, 429, 214, 0, 1085, 1086, 3, 411, 205, 0, 1086, 1087, 3, 419, 209, 0, 1087, 1088, 3, 395, 197, 0, 1088, 1089, 3, 429, 214, 0, 1089, 1090, 3, 443, 221, 0, 1090, 226, 1, 0, 0, 0, 1091, 1092, 3, 427, 213, 0, 1092, 1093, 3, 435, 217, 0, 1093, 1094, 3, 403, 201, 0, 1094, 1095, 3, 429, 214, 0, 1095, 1096, 3, 443, 221, 0, 1096, 228, 1, 0, 0, 0, 1097, 1098, 3, 429, 214, 0, 1098, 1099, 3, 395, 197, 0, 1099, 1100, 3, 411, 205, 0, 1100, 1101, 3, 431, 215, 0, 1101, 1102, 3, 403, 201, 0, 1102, 230, 1, 0, 0, 0, 1103, 1104, 3, 429, 214, 0, 1104, 1105, 3, 403, 201, 0, 1105, 1106, 3, 399, 199, 0, 1106, 1107, 3, 435, 217, 0, 1107, 1108, 3, 429, 214, 0, 1108, 1109, 3, 431, 215, 0, 1109, 1110, 3, 411, 205, 0, 1110, 1111, 3, 437, 218, 0, 1111, 1112, 3, 403, 201, 0, 1112, 232, 1, 0, 0, 0, 1113, 1114, 3, 429, 214, 0, 1114, 1115, 3, 403, 201, 0, 1115, 1116, 3, 405, 202, 0, 1116, 1117, 3, 403, 201, 0, 1117, 1118, 3, 429, 214, 0, 1118, 1119, 3, 403, 201, 0, 1119, 1120, 3, 421, 210, 0, 1120, 1121, 3, 399, 199, 0, 1121, 1122, 3, 403, 201, 0, 1122, 1123, 3, 431, 215, 0, 1123, 234, 1, 0, 0, 0, 1124, 1125, 3, 429, 214, 0, 1125, 1126, 3, 403, 201, 0, 1126, 1127, 3, 407, 203, 0, 1127, 1128, 3, 403, 201, 0, 1128, 1129, 3, 441, 220, 0, 1129, 1130, 3, 425, 212, 0, 1130, 236, 1, 0, 0, 0, 1131, 1132, 3, 429, 214, 0, 1132, 1133, 3, 403, 201, 0, 1133, 1134, 3, 411, 205, 0, 1134, 1135, 3, 421, 210, 0, 1135, 1136, 3, 401, 200, 0, 1136, 1137, 3, 403, 201, 0, 1137, 1138, 3, 441, 220, 0, 1138, 238, 1, 0, 0, 0, 1139, 1140, 3, 429, 214, 0, 1140, 1141, 3, 403, 201, 0, 1141, 1142, 3, 417, 208, 0, 1142, 1143, 3, 403, 201, 0, 1143, 1144, 3, 395, 197, 0, 1144, 1145, 3, 431, 215, 0, 1145, 1146, 3, 403, 201, 0, 1146, 240, 1, 0, 0, 0, 1147, 1148, 3, 429, 214, 0, 1148, 1149, 3, 403, 201, 0, 1149, 1150, 3, 421, 210, 0, 1150, 1151, 3, 395, 197, 0, 1151, 1152, 3, 419, 209, 0, 1152, 1153, 3, 403, 201, 0, 1153, 242, 1, 0, 0, 0, 1154, 1155, 3, 429, 214, 0, 1155, 1156, 3, 403, 201, 0, 1156, 1157, 3, 425, 212, 0, 1157, 1158, 3, 417, 208, 0, 1158, 1159, 3, 395, 197, 0, 1159, 1160, 3, 399, 199, 0, 1160, 1161, 3, 403, 201, 0, 1161, 244, 1, 0, 0, 0, 1162, 1163, 3, 429, 214, 0, 1163, 1164, 3, 403, 201, 0, 1164, 1165, 3, 431, 215, 0, 1165, 1166, 3, 433, 216, 0, 1166, 1167, 3, 429, 214, 0, 1167, 1168, 3, 411, 205, 0, 1168, 1169, 3, 399, 199, 0, 1169, 1170, 3, 433, 216, 0, 1170, 246, 1, 0, 0, 0, 1171, 1172, 3, 429, 214, 0, 1172, 1173, 3, 403, 201, 0, 1173, 1174, 3, 433, 216, 0, 1174, 1175, 3, 435, 217, 0, 1175, 1176, 3, 429, 214, 0, 1176, 1177, 3, 421, 210, 0, 1177, 1178, 3, 411, 205, 0, 1178, 1179, 3, 421, 210, 0, 1179, 1180, 3, 407, 203, 0, 1180, 248, 1, 0, 0, 0, 1181, 1182, 3, 429, 214, 0, 1182, 1183, 3, 411, 205, 0, 1183, 1184, 3, 407, 203, 0, 1184, 1185, 3, 409, 204, 0, 1185, 1186, 3, 433, 216, 0, 1186, 250, 1, 0, 0, 0, 1187, 1188, 3, 429, 214, 0, 1188, 1189, 3, 423, 211, 0, 1189, 1190, 3, 417, 208, 0, 1190, 1191, 3, 417, 208, 0, 1191, 1192, 3, 397, 198, 0, 1192, 1193, 3, 395, 197, 0, 1193, 1194, 3, 399, 199, 0, 1194, 1195, 3, 415, 207, 0, 1195, 252, 1, 0, 0, 0, 1196, 1197, 3, 429, 214, 0, 1197, 1198, 3, 423, 211, 0, 1198, 1199, 3, 439, 219, 0, 1199, 254, 1, 0, 0, 0, 1200, 1201, 3, 429, 214, 0, 1201, 1202, 3, 423, 211, 0, 1202, 1203, 3, 439, 219, 0, 1203, 1204, 3, 431, 215, 0, 1204, 256, 1, 0, 0, 0, 1205, 1206, 3, 431, 215, 0, 1206, 1207, 3, 395, 197, 0, 1207, 1208, 3, 437, 218, 0, 1208, 1209, 3, 403, 201, 0, 1209, 1210, 3, 425, 212, 0, 1210, 1211, 3, 423, 211, 0, 1211, 1212, 3, 411, 205, 0, 1212, 1213, 3, 421, 210, 0, 1213, 1214, 3, 433, 216, 0, 1214, 258, 1, 0, 0, 0, 1215, 1216, 3, 431, 215, 0, 1216, 1217, 3, 403, 201, 0, 1217, 1218, 3, 417, 208, 0, 1218, 1219, 3, 403, 201, 0, 1219, 1220, 3, 399, 199, 0, 1220, 1221, 3, 433, 216, 0, 1221, 260, 1, 0, 0, 0, 1222, 1223, 3, 431, 215, 0, 1223, 1224, 3, 403, 201, 0, 1224, 1225, 3, 433, 216, 0, 1225, 262, 1, 0, 0, 0, 1226, 1227, 3, 431, 215, 0, 1227, 1228, 3, 433, 216, 0, 1228, 1229, 3, 429, 214, 0, 1229, 1230, 3, 411, 205, 0, 1230, 1231, 3, 399, 199, 0, 1231, 1232, 3, 433, 216, 0, 1232, 264, 1, 0, 0, 0, 1233, 1234, 3, 433, 216, 0, 1234, 1235, 3, 395, 197, 0, 1235, 1236, 3, 397, 198, 0, 1236, 1237, 3, 417, 208, 0, 1237, 1238, 3, 403, 201, 0, 1238, 266, 1, 0, 0, 0, 1239, 1240, 3, 433, 216, 0, 1240, 1241, 3, 403, 201, 0, 1241, 1242, 3, 419, 209, 0, 1242, 1243, 3, 425, 212, 0, 1243, 268, 1, 0, 0, 0, 1244, 1245, 3, 433, 216, 0, 1245, 1246, 3, 403, 201, 0, 1246, 1247, 3, 419, 209, 0, 1247, 1248, 3, 425, 212, 0, 1248, 1249, 3, 423, 211, 0, 1249, 1250, 3, 429, 214, 0, 1250, 1251, 3, 395, 197, 0, 1251, 1252, 3, 429, 214, 0, 1252, 1253, 3, 443, 221, 0, 1253, 270, 1, 0, 0, 0, 1254, 1255, 3, 433, 216, 0, 1255, 1256, 3, 409, 204, 0, 1256, 1257, 3, 403, 201, 0, 1257, 1258, 3, 421, 210, 0, 1258, 272, 1, 0, 0, 0, 1259, 1260, 3, 433, 216, 0, 1260, 1261, 3, 423, 211, 0, 1261, 274, 1, 0, 0, 0, 1262, 1263, 3, 433, 216, 0, 1263, 1264, 3, 429, 214, 0, 1264, 1265, 3, 395, 197, 0, 1265, 1266, 3, 421, 210, 0, 1266, 1267, 3, 431, 215, 0, 1267, 1268, 3, 395, 197, 0, 1268, 1269, 3, 399, 199, 0, 1269, 1270, 3, 433, 216, 0, 1270, 1271, 3, 411, 205, 0, 1271, 1272, 3, 423, 211, 0, 1272, 1273, 3, 421, 210, 0, 1273, 276, 1, 0, 0, 0, 1274, 1275, 3, 433, 216, 0, 1275, 1276, 3, 429, 214, 0, 1276, 1277, 3, 411, 205, 0, 1277, 1278, 3, 407, 203, 0, 1278, 1279, 3, 407, 203, 0, 1279, 1280, 3, 403, 201, 0, 1280, 1281, 3, 429, 214, 0, 1281, 278, 1, 0, 0, 0, 1282, 1283, 3, 435, 217, 0, 1283, 1284, 3, 421, 210, 0, 1284, 1285, 3, 411, 205, 0, 1285, 1286, 3, 423, 211, 0, 1286, 1287, 3, 421, 210, 0, 1287, 280, 1, 0, 0, 0, 1288, 1289, 3, 435, 217, 0, 1289, 1290, 3, 421, 210, 0, 1290, 1291, 3, 411, 205, 0, 1291, 1292, 3, 427, 213, 0, 1292, 1293, 3, 435, 217, 0, 1293, 1294, 3, 403, 201, 0, 1294, 282, 1, 0, 0, 0, 1295, 1296, 3, 435, 217, 0, 1296, 1297, 3, 425, 212, 0, 1297, 1298, 3, 401, 200, 0, 1298, 1299, 3, 395, 197, 0, 1299, 1300, 3, 433, 216, 0, 1300, 1301, 3, 403, 201, 0, 1301, 284, 1, 0, 0, 0, 1302, 1303, 3, 435, 217, 0, 1303, 1304, 3, 431, 215, 0, 1304, 1305, 3, 411, 205, 0, 1305, 1306, 3, 421, 210, 0, 1306, 1307, 3, 407, 203, 0, 1307, 286, 1, 0, 0, 0, 1308, 1309, 3, 437, 218, 0, 1309, 1310, 3, 395, 197, 0, 1310, 1311, 3, 399, 199, 0, 1311, 1312, 3, 435, 217, 0, 1312, 1313, 3, 435, 217, 0, 1313, 1314, 3, 419, 209, 0, 1314, 288, 1, 0, 0, 0, 1315, 1316, 3, 437, 218, 0, 1316, 1317, 3, 395, 197, 0, 1317, 1318, 3, 417, 208, 0, 1318, 1319, 3, 435, 217, 0, 1319, 1320, 3, 403, 201, 0, 1320, 1321, 3, 431, 215, 0, 1321, 290, 1, 0, 0, 0, 1322, 1323, 3, 437, 218, 0, 1323, 1324, 3, 411, 205, 0, 1324, 1325, 3, 403, 201, 0, 1325, 1326, 3, 439, 219, 0, 1326, 292, 1, 0, 0, 0, 1327, 1328, 3, 437, 218, 0, 1328, 1329, 3, 411, 205, 0, 1329, 1330, 3, 429, 214, 0, 1330, 1331, 3, 433, 216, 0, 1331, 1332, 3, 435, 217, 0, 1332, 1333, 3, 395, 197, 0, 1333, 1334, 3, 417, 208, 0, 1334, 294, 1, 0, 0, 0, 1335, 1336, 3, 439, 219, 0, 1336, 1337, 3, 409, 204, 0, 1337, 1338, 3, 403, 201, 0, 1338, 1339, 3, 421, 210, 0, 1339, 296, 1, 0, 0, 0, 1340, 1341, 3, 439, 219, 0, 1341, 1342, 3, 409, 204, 0, 1342, 1343, 3, 403, 201, 0, 1343, 1344, 3, 429, 214, 0, 1344, 1345, 3, 403, 201, 0, 1345, 298, 1, 0, 0, 0, 1346, 1347, 3, 439, 219, 0, 1347, 1348, 3, 411, 205, 0, 1348, 1349, 3, 433, 216, 0, 1349, 1350, 3, 409, 204, 0, 1350, 300, 1, 0, 0, 0, 1351, 1352, 3, 439, 219, 0, 1352, 1353, 3, 411, 205, 0, 1353, 1354, 3, 433, 216, 0, 1354, 1355, 3, 409, 204, 0, 1355, 1356, 3, 423, 211, 0, 1356, 1357, 3, 435, 217, 0, 1357, 1358, 3, 433, 216, 0, 1358, 302, 1, 0, 0, 0, 1359, 1360, 3, 405, 202, 0, 1360, 1361, 3, 411, 205, 0, 1361, 1362, 3, 429, 214, 0, 1362, 1363, 3, 431, 215, 0, 1363, 1364, 3, 433, 216, 0, 1364, 1365, 5, 95, 0, 0, 1365, 1366, 3, 437, 218, 0, 1366, 1367, 3, 395, 197, 0, 1367, 1368, 3, 417, 208, 0, 1368, 1369, 3, 435, 217, 0, 1369, 1370, 3, 403, 201, 0, 1370, 304, 1, 0, 0, 0, 1371, 1372, 3, 423, 211, 0, 1372, 1373, 3, 437, 218, 0, 1373, 1374, 3, 403, 201, 0, 1374, 1375, 3, 429, 214, 0, 1375, 306, 1, 0, 0, 0, 1376, 1377, 3, 425, 212, 0, 1377, 1378, 3, 395, 197, 0, 1378, 1379, 3, 429, 214, 0, 1379, 1380, 3, 433, 216, 0, 1380, 1381, 3, 411, 205, 0, 1381, 1382, 3, 433, 216, 0, 1382, 1383, 3, 411, 205, 0, 1383, 1384, 3, 423, 211, 0, 1384, 1385, 3, 421, 210, 0, 1385, 308, 1, 0, 0, 0, 1386, 1387, 3, 429, 214, 0, 1387, 1388, 3, 395, 197, 0, 1388, 1389, 3, 421, 210, 0, 1389, 1390, 3, 407, 203, 0, 1390, 1391, 3, 403, 201, 0, 1391, 310, 1, 0, 0, 0, 1392, 1393, 3, 425, 212, 0, 1393, 1394, 3, 429, 214, 0, 1394, 1395, 3, 403, 201, 0, 1395, 1396, 3, 399, 199, 0, 1396, 1397, 3, 403, 201, 0, 1397, 1398, 3, 401, 200, 0, 1398, 1399, 3, 411, 205, 0, 1399, 1400, 3, 421, 210, 0, 1400, 1401, 3, 407, 203, 0, 1401, 312, 1, 0, 0, 0, 1402, 1403, 3, 435, 217, 0, 1403, 1404, 3, 421, 210, 0, 1404, 1405, 3, 397, 198, 0, 1405, 1406, 3, 423, 211, 0, 1406, 1407, 3, 435, 217, 0, 1407, 1408, 3, 421, 210, 0, 1408, 1409, 3, 401, 200, 0, 1409, 1410, 3, 403, 201, 0, 1410, 1411, 3, 401, 200, 0, 1411, 314, 1, 0, 0, 0, 1412, 1413, 3, 399, 199, 0, 1413, 1414, 3, 435, 217, 0, 1414, 1415, 3, 429, 214, 0, 1415, 1416, 3, 429, 214, 0, 1416, 1417, 3, 403, 201, 0, 1417, 1418, 3, 421, 210, 0, 1418, 1419, 3, 433, 216, 0, 1419, 316, 1, 0, 0, 0, 1420, 1421, 3, 405, 202, 0, 1421, 1422, 3, 423, 211, 0, 1422, 1423, 3, 417, 208, 0, 1423, 1424, 3, 417, 208, 0, 1424, 1425, 3, 423, 211, 0, 1425, 1426, 3, 439, 219, 0, 1426, 1427, 3, 411, 205, 0, 1427, 1428, 3, 421, 210, 0, 1428, 1429, 3, 407, 203, 0, 1429, 318, 1, 0, 0, 0, 1430, 1431, 3, 399, 199, 0, 1431, 1432, 3, 435, 217, 0, 1432, 1433, 3, 419, 209, 0, 1433, 1434, 3, 403, 201, 0, 1434, 1435, 5, 95, 0, 0, 1435, 1436, 3, 401, 200, 0, 1436, 1437, 3, 411, 205, 0, 1437, 1438, 3, 431, 215, 0, 1438, 1439, 3, 433, 216, 0, 1439, 320, 1, 0, 0, 0, 1440, 1441, 3, 401, 200, 0, 1441, 1442, 3, 403, 201, 0, 1442, 1443, 3, 421, 210, 0, 1443, 1444, 3, 431, 215, 0, 1444, 1445, 3, 403, 201, 0, 1445, 1446, 5, 95, 0, 0, 1446, 1447, 3, 429, 214, 0, 1447, 1448, 3, 395, 197, 0, 1448, 1449, 3, 421, 210, 0, 1449, 1450, 3, 415, 207, 0, 1450, 322, 1, 0, 0, 0, 1451, 1452, 3, 417, 208, 0, 1452, 1453, 3, 395, 197, 0, 1453, 1454, 3, 407, 203, 0, 1454, 324, 1, 0, 0, 0, 1455, 1456, 3, 417, 208, 0, 1456, 1457, 3, 395, 197, 0, 1457, 1458, 3, 431, 215, 0, 1458, 1459, 3, 433, 216, 0, 1459, 1460, 5, 95, 0, 0, 1460, 1461, 3, 437, 218, 0, 1461, 1462, 3, 395, 197, 0, 1462, 1463, 3, 417, 208, 0, 1463, 1464, 3, 435, 217, 0, 1464, 1465, 3, 403, 201, 0, 1465, 326, 1, 0, 0, 0, 1466, 1467, 3, 417, 208, 0, 1467, 1468, 3, 403, 201, 0, 1468, 1469, 3, 395, 197, 0, 1469, 1470, 3, 401, 200, 0, 1470, 328, 1, 0, 0, 0, 1471, 1472, 3, 421, 210, 0, 1472, 1473, 3, 433, 216, 0, 1473, 1474, 3, 409, 204, 0, 1474, 1475, 5, 95, 0, 0, 1475, 1476, 3, 437, 218, 0, 1476, 1477, 3, 395, 197, 0, 1477, 1478, 3, 417, 208, 0, 1478, 1479, 3, 435, 217, 0, 1479, 1480, 3, 403, 201, 0, 1480, 330, 1, 0, 0, 0, 1481, 1482, 3, 421, 210, 0, 1482, 1483, 3, 433, 216, 0, 1483, 1484, 3, 411, 205, 0, 1484, 1485, 3, 417, 208, 0, 1485, 1486, 3, 403, 201, 0, 1486, 332, 1, 0, 0, 0, 1487, 1488, 3, 425, 212, 0, 1488, 1489, 3, 403, 201, 0, 1489, 1490, 3, 429, 214, 0, 1490, 1491, 3, 399, 199, 0, 1491, 1492, 3, 403, 201, 0, 1492, 1493, 3, 421, 210, 0, 1493, 1494, 3, 433, 216, 0, 1494, 1495, 5, 95, 0, 0, 1495, 1496, 3, 429, 214, 0, 1496, 1497, 3, 395, 197, 0, 1497, 1498, 3, 421, 210, 0, 1498, 1499, 3, 415, 207, 0, 1499, 334, 1, 0, 0, 0, 1500, 1501, 3, 429, 214, 0, 1501, 1502, 3, 395, 197, 0, 1502, 1503, 3, 421, 210, 0, 1503, 1504, 3, 415, 207, 0, 1504, 336, 1, 0, 0, 0, 1505, 1506, 3, 429, 214, 0, 1506, 1507, 3, 423, 211, 0, 1507, 1508, 3, 439, 219, 0, 1508, 1509, 5, 95, 0, 0, 1509, 1510, 3, 421, 210, 0, 1510, 1511, 3, 435, 217, 0, 1511, 1512, 3, 419, 209, 0, 1512, 1513, 3, 397, 198, 0, 1513, 1514, 3, 403, 201, 0, 1514, 1515, 3, 429, 214, 0, 1515, 338, 1, 0, 0, 0, 1516, 1517, 3, 407, 203, 0, 1517, 1518, 3, 403, 201, 0, 1518, 1519, 3, 421, 210, 0, 1519, 1520, 3, 403, 201, 0, 1520, 1521, 3, 429, 214, 0, 1521, 1522, 3, 395, 197, 0, 1522, 1523, 3, 433, 216, 0, 1523, 1524, 3, 403, 201, 0, 1524, 1525, 3, 401, 200, 0, 1525, 340, 1, 0, 0, 0, 1526, 1527, 3, 395, 197, 0, 1527, 1528, 3, 417, 208, 0, 1528, 1529, 3, 439, 219, 0, 1529, 1530, 3, 395, 197, 0, 1530, 1531, 3, 443, 221, 0, 1531, 1532, 3, 431, 215, 0, 1532, 342, 1, 0, 0, 0, 1533, 1534, 3, 431, 215, 0, 1534, 1535, 3, 433, 216, 0, 1535, 1536, 3, 423, 211, 0, 1536, 1537, 3, 429, 214, 0, 1537, 1538, 3, 403, 201, 0, 1538, 1539, 3, 401, 200, 0, 1539, 344, 1, 0, 0, 0, 1540, 1541, 3, 433, 216, 0, 1541, 1542, 3, 429, 214, 0, 1542, 1543, 3, 435, 217, 0, 1543, 1544, 3, 403, 201, 0, 1544, 346, 1, 0, 0, 0, 1545, 1546, 3, 405, 202, 0, 1546, 1547, 3, 395, 197, 0, 1547, 1548, 3, 417, 208, 0, 1548, 1549, 3, 431, 215, 0, 1549, 1550, 3, 403, 201, 0, 1550, 348, 1, 0, 0, 0, 1551, 1552, 3, 439, 219, 0, 1552, 1553, 3, 411, 205, 0, 1553, 1554, 3, 421, 210, 0, 1554, 1555, 3, 401, 200, 0, 1555, 1556, 3, 423, 211, 0, 1556, 1557, 3, 439, 219, 0, 1557, 350, 1, 0, 0, 0, 1558, 1559, 3, 421, 210, 0, 1559, 1560, 3, 435, 217, 0, 1560, 1561, 3, 417, 208, 0, 1561, 1562, 3, 417, 208, 0, 1562, 1563, 3, 431, 215, 0, 1563, 352, 1, 0, 0, 0, 1564, 1565, 3, 405, 202, 0, 1565, 1566, 3, 411, 205, 0, 1566, 1567, 3, 429, 214, 0, 1567, 1568, 3, 431, 215, 0, 1568, 1569, 3, 433, 216, 0, 1569, 354, 1, 0, 0, 0, 1570, 1571, 3, 417, 208, 0, 1571, 1572, 3, 395, 197, 0, 1572, 1573, 3, 431, 215, 0, 1573, 1574, 3, 433, 216, 0, 1574, 356, 1, 0, 0, 0, 1575, 1576, 3, 405, 202, 0, 1576, 1577, 3, 411, 205, 0, 1577, 1578, 3, 417, 208, 0, 1578, 1579, 3, 433, 216, 0, 1579, 1580, 3, 403, 201, 0, 1580, 1581, 3, 429, 214, 0, 1581, 358, 1, 0, 0, 0, 1582, 1583, 3, 407, 203, 0, 1583, 1584, 3, 429, 214, 0, 1584, 1585, 3, 423, 211, 0, 1585, 1586, 3, 435, 217, 0, 1586, 1587, 3, 425, 212, 0, 1587, 1588, 3, 431, 215, 0, 1588, 360, 1, 0, 0, 0, 1589, 1590, 3, 403, 201, 0, 1590, 1591, 3, 441, 220, 0, 1591, 1592, 3, 399, 199, 0, 1592, 1593, 3, 417, 208, 0, 1593, 1594, 3, 435, 217, 0, 1594, 1595, 3, 401, 200, 0, 1595, 1596, 3, 403, 201, 0, 1596, 362, 1, 0, 0, 0, 1597, 1598, 3, 433, 216, 0, 1598, 1599, 3, 411, 205, 0, 1599, 1600, 3, 403, 201, 0, 1600, 1601, 3, 431, 215, 0, 1601, 364, 1, 0, 0, 0, 1602, 1603, 3, 423, 211, 0, 1603, 1604, 3, 433, 216, 0, 1604, 1605, 3, 409, 204, 0, 1605, 1606, 3, 403, 201, 0, 1606, 1607, 3, 429, 214, 0, 1607, 1608, 3, 431, 215, 0, 1608, 366, 1, 0, 0, 0, 1609, 1610, 3, 401, 200, 0, 1610, 1611, 3, 423, 211, 0, 1611, 368, 1, 0, 0, 0, 1612, 1613, 3, 421, 210, 0, 1613, 1614, 3, 423, 211, 0, 1614, 1615, 3, 433, 216, 0, 1615, 1616, 3, 409, 204, 0, 1616, 1617, 3, 411, 205, 0, 1617, 1618, 3, 421, 210, 0, 1618, 1619, 3, 407, 203, 0, 1619, 370, 1, 0, 0, 0, 1620, 1626, 5, 34, 0, 0, 1621, 1625, 8, 0, 0, 0, 1622, 1623, 5, 34, 0, 0, 1623, 1625, 5, 34, 0, 0, 1624, 1621, 1, 0, 0, 0, 1624, 1622, 1, 0, 0, 0, 1625, 1628, 1, 0, 0, 0, 1626, 1624, 1, 0, 0, 0, 1626, 1627, 1, 0, 0, 0, 1627, 1629, 1, 0, 0, 0, 1628, 1626, 1, 0, 0, 0, 1629, 1656, 5, 34, 0, 0, 1630, 1636, 5, 96, 0, 0, 1631, 1635, 8, 1, 0, 0, 1632, 1633, 5, 96, 0, 0, 1633, 1635, 5, 96, 0, 0, 1634, 1631, 1, 0, 0, 0, 1634, 1632, 1, 0, 0, 0, 1635, 1638, 1, 0, 0, 0, 1636, 1634, 1, 0, 0, 0, 1636, 1637, 1, 0, 0, 0, 1637, 1639, 1, 0, 0, 0, 1638, 1636, 1, 0, 0, 0, 1639, 1656, 5, 96, 0, 0, 1640, 1644, 5, 91, 0, 0, 1641, 1643, 8, 2, 0, 0, 1642, 1641, 1, 0, 0, 0, 1643, 1646, 1, 0, 0, 0, 1644, 1642, 1, 0, 0, 0, 1644, 1645, 1, 0, 0, 0, 1645, 1647, 1, 0, 0, 0, 1646, 1644, 1, 0, 0, 0, 1647, 1656, 5, 93, 0, 0, 1648, 1652, 7, 3, 0, 0, 1649, 1651, 7, 4, 0, 0, 1650, 1649, 1, 0, 0, 0, 1651, 1654, 1, 0, 0, 0, 1652, 1650, 1, 0, 0, 0, 1652, 1653, 1, 0, 0, 0, 1653, 1656, 1, 0, 0, 0, 1654, 1652, 1, 0, 0, 0, 1655, 1620, 1, 0, 0, 0, 1655, 1630, 1, 0, 0, 0, 1655, 1640, 1, 0, 0, 0, 1655, 1648, 1, 0, 0, 0, 1656, 372, 1, 0, 0, 0, 1657, 1659, 3, 393, 196, 0, 1658, 1657, 1, 0, 0, 0, 1659, 1660, 1, 0, 0, 0, 1660, 1658, 1, 0, 0, 0, 1660, 1661, 1, 0, 0, 0, 1661, 1669, 1, 0, 0, 0, 1662, 1666, 5, 46, 0, 0, 1663, 1665, 3, 393, 196, 0, 1664, 1663, 1, 0, 0, 0, 1665, 1668, 1, 0, 0, 0, 1666, 1664, 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, 1670, 1, 0, 0, 0, 1668, 1666, 1, 0, 0, 0, 1669, 1662, 1, 0, 0, 0, 1669, 1670, 1, 0, 0, 0, 1670, 1678, 1, 0, 0, 0, 1671, 1673, 5, 46, 0, 0, 1672, 1674, 3, 393, 196, 0, 1673, 1672, 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, 1673, 1, 0, 0, 0, 1675, 1676, 1, 0, 0, 0, 1676, 1678, 1, 0, 0, 0, 1677, 1658, 1, 0, 0, 0, 1677, 1671, 1, 0, 0, 0, 1678, 1688, 1, 0, 0, 0, 1679, 1681, 3, 403, 201, 0, 1680, 1682, 7, 5, 0, 0, 1681, 1680, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1684, 1, 0, 0, 0, 1683, 1685, 3, 393, 196, 0, 1684, 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1689, 1, 0, 0, 0, 1688, 1679, 1, 0, 0, 0, 1688, 1689, 1, 0, 0, 0, 1689, 1699, 1, 0, 0, 0, 1690, 1691, 5, 48, 0, 0, 1691, 1692, 5, 120, 0, 0, 1692, 1694, 1, 0, 0, 0, 1693, 1695, 3, 391, 195, 0, 1694, 1693, 1, 0, 0, 0, 1695, 1696, 1, 0, 0, 0, 1696, 1694, 1, 0, 0, 0, 1696, 1697, 1, 0, 0, 0, 1697, 1699, 1, 0, 0, 0, 1698, 1677, 1, 0, 0, 0, 1698, 1690, 1, 0, 0, 0, 1699, 374, 1, 0, 0, 0, 1700, 1704, 5, 63, 0, 0, 1701, 1703, 3, 393, 196, 0, 1702, 1701, 1, 0, 0, 0, 1703, 1706, 1, 0, 0, 0, 1704, 1702, 1, 0, 0, 0, 1704, 1705, 1, 0, 0, 0, 1705, 376, 1, 0, 0, 0, 1706, 1704, 1, 0, 0, 0, 1707, 1708, 7, 6, 0, 0, 1708, 1709, 3, 371, 185, 0, 1709, 378, 1, 0, 0, 0, 1710, 1716, 5, 39, 0, 0, 1711, 1715, 8, 7, 0, 0, 1712, 1713, 5, 39, 0, 0, 1713, 1715, 5, 39, 0, 0, 1714, 1711, 1, 0, 0, 0, 1714, 1712, 1, 0, 0, 0, 1715, 1718, 1, 0, 0, 0, 1716, 1714, 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 1719, 1, 0, 0, 0, 1718, 1716, 1, 0, 0, 0, 1719, 1720, 5, 39, 0, 0, 1720, 380, 1, 0, 0, 0, 1721, 1722, 3, 441, 220, 0, 1722, 1723, 3, 379, 189, 0, 1723, 382, 1, 0, 0, 0, 1724, 1725, 5, 45, 0, 0, 1725, 1726, 5, 45, 0, 0, 1726, 1730, 1, 0, 0, 0, 1727, 1729, 8, 8, 0, 0, 1728, 1727, 1, 0, 0, 0, 1729, 1732, 1, 0, 0, 0, 1730, 1728, 1, 0, 0, 0, 1730, 1731, 1, 0, 0, 0, 1731, 1738, 1, 0, 0, 0, 1732, 1730, 1, 0, 0, 0, 1733, 1735, 5, 13, 0, 0, 1734, 1733, 1, 0, 0, 0, 1734, 1735, 1, 0, 0, 0, 1735, 1736, 1, 0, 0, 0, 1736, 1739, 5, 10, 0, 0, 1737, 1739, 5, 0, 0, 1, 1738, 1734, 1, 0, 0, 0, 1738, 1737, 1, 0, 0, 0, 1739, 1740, 1, 0, 0, 0, 1740, 1741, 6, 191, 0, 0, 1741, 384, 1, 0, 0, 0, 1742, 1743, 5, 47, 0, 0, 1743, 1744, 5, 42, 0, 0, 1744, 1748, 1, 0, 0, 0, 1745, 1747, 9, 0, 0, 0, 1746, 1745, 1, 0, 0, 0, 1747, 1750, 1, 0, 0, 0, 1748, 1749, 1, 0, 0, 0, 1748, 1746, 1, 0, 0, 0, 1749, 1751, 1, 0, 0, 0, 1750, 1748, 1, 0, 0, 0, 1751, 1752, 5, 42, 0, 0, 1752, 1753, 5, 47, 0, 0, 1753, 1754, 1, 0, 0, 0, 1754, 1755, 6, 192, 0, 0, 1755, 386, 1, 0, 0, 0, 1756, 1757, 7, 9, 0, 0, 1757, 1758, 1, 0, 0, 0, 1758, 1759, 6, 193, 0, 0, 1759, 388, 1, 0, 0, 0, 1760, 1761, 9, 0, 0, 0, 1761, 390, 1, 0, 0, 0, 1762, 1763, 7, 10, 0, 0, 1763, 392, 1, 0, 0, 0, 1764, 1765, 7, 11, 0, 0, 1765, 394, 1, 0, 0, 0, 1766, 1767, 7, 12, 0, 0, 1767, 396, 1, 0, 0, 0, 1768, 1769, 7, 13, 0, 0, 1769, 398, 1, 0, 0, 0, 1770, 1771, 7, 14, 0, 0, 1771, 400, 1, 0, 0, 0, 1772, 1773, 7, 15, 0, 0, 1773, 402, 1, 0, 0, 0, 1774, 1775, 7, 16, 0, 0, 1775, 404, 1, 0, 0, 0, 1776, 1777, 7, 17, 0, 0, 1777, 406, 1, 0, 0, 0, 1778, 1779, 7, 18, 0, 0, 1779, 408, 1, 0, 0, 0, 1780, 1781, 7, 19, 0, 0, 1781, 410, 1, 0, 0, 0, 1782, 1783, 7, 20, 0, 0, 1783, 412, 1, 0, 0, 0, 1784, 1785, 7, 21, 0, 0, 1785, 414, 1, 0, 0, 0, 1786, 1787, 7, 22, 0, 0, 1787, 416, 1, 0, 0, 0, 1788, 1789, 7, 23, 0, 0, 1789, 418, 1, 0, 0, 0, 1790, 1791, 7, 24, 0, 0, 1791, 420, 1, 0, 0, 0, 1792, 1793, 7, 25, 0, 0, 1793, 422, 1, 0, 0, 0, 1794, 1795, 7, 26, 0, 0, 1795, 424, 1, 0, 0, 0, 1796, 1797, 7, 27, 0, 0, 1797, 426, 1, 0, 0, 0, 1798, 1799, 7, 28, 0, 0, 1799, 428, 1, 0, 0, 0, 1800, 1801, 7, 29, 0, 0, 1801, 430, 1, 0, 0, 0, 1802, 1803, 7, 30, 0, 0, 1803, 432, 1, 0, 0, 0, 1804, 1805, 7, 31, 0, 0, 1805, 434, 1, 0, 0, 0, 1806, 1807, 7, 32, 0, 0, 1807, 436, 1, 0, 0, 0, 1808, 1809, 7, 33, 0, 0, 1809, 438, 1, 0, 0, 0, 1810, 1811, 7, 34, 0, 0, 1811, 440, 1, 0, 0, 0, 1812, 1813, 7, 35, 0, 0, 1813, 442, 1, 0, 0, 0, 1814, 1815, 7, 36, 0, 0, 1815, 444, 1, 0, 0, 0, 1816, 1817, 7, 37, 0, 0, 1817, 446, 1, 0, 0, 0, 25, 0, 1624, 1626, 1634, 1636, 1644, 1652, 1655, 1660, 1666, 1669, 1675, 1677, 1681, 1686, 1688, 1696, 1698, 1704, 1714, 1716, 1730, 1734, 1738, 1748, 1, 0, 1, 0] \ No newline at end of file diff --git a/internal/engine/sqlite/parser/SQLiteLexer.tokens b/internal/engine/sqlite/parser/SQLiteLexer.tokens deleted file mode 100644 index 928604c851..0000000000 --- a/internal/engine/sqlite/parser/SQLiteLexer.tokens +++ /dev/null @@ -1,219 +0,0 @@ -SCOL=1 -DOT=2 -OPEN_PAR=3 -CLOSE_PAR=4 -COMMA=5 -ASSIGN=6 -STAR=7 -PLUS=8 -MINUS=9 -TILDE=10 -PIPE2=11 -DIV=12 -MOD=13 -LT2=14 -GT2=15 -AMP=16 -PIPE=17 -LT=18 -LT_EQ=19 -GT=20 -GT_EQ=21 -EQ=22 -NOT_EQ1=23 -NOT_EQ2=24 -ABORT_=25 -ACTION_=26 -ADD_=27 -AFTER_=28 -ALL_=29 -ALTER_=30 -ANALYZE_=31 -AND_=32 -AS_=33 -ASC_=34 -ATTACH_=35 -AUTOINCREMENT_=36 -BEFORE_=37 -BEGIN_=38 -BETWEEN_=39 -BY_=40 -CASCADE_=41 -CASE_=42 -CAST_=43 -CHECK_=44 -COLLATE_=45 -COLUMN_=46 -COMMIT_=47 -CONFLICT_=48 -CONSTRAINT_=49 -CREATE_=50 -CROSS_=51 -CURRENT_DATE_=52 -CURRENT_TIME_=53 -CURRENT_TIMESTAMP_=54 -DATABASE_=55 -DEFAULT_=56 -DEFERRABLE_=57 -DEFERRED_=58 -DELETE_=59 -DESC_=60 -DETACH_=61 -DISTINCT_=62 -DROP_=63 -EACH_=64 -ELSE_=65 -END_=66 -ESCAPE_=67 -EXCEPT_=68 -EXCLUSIVE_=69 -EXISTS_=70 -EXPLAIN_=71 -FAIL_=72 -FOR_=73 -FOREIGN_=74 -FROM_=75 -FULL_=76 -GLOB_=77 -GROUP_=78 -HAVING_=79 -IF_=80 -IGNORE_=81 -IMMEDIATE_=82 -IN_=83 -INDEX_=84 -INDEXED_=85 -INITIALLY_=86 -INNER_=87 -INSERT_=88 -INSTEAD_=89 -INTERSECT_=90 -INTO_=91 -IS_=92 -ISNULL_=93 -JOIN_=94 -KEY_=95 -LEFT_=96 -LIKE_=97 -LIMIT_=98 -MATCH_=99 -NATURAL_=100 -NO_=101 -NOT_=102 -NOTNULL_=103 -NULL_=104 -OF_=105 -OFFSET_=106 -ON_=107 -OR_=108 -ORDER_=109 -OUTER_=110 -PLAN_=111 -PRAGMA_=112 -PRIMARY_=113 -QUERY_=114 -RAISE_=115 -RECURSIVE_=116 -REFERENCES_=117 -REGEXP_=118 -REINDEX_=119 -RELEASE_=120 -RENAME_=121 -REPLACE_=122 -RESTRICT_=123 -RETURNING_=124 -RIGHT_=125 -ROLLBACK_=126 -ROW_=127 -ROWS_=128 -SAVEPOINT_=129 -SELECT_=130 -SET_=131 -STRICT_=132 -TABLE_=133 -TEMP_=134 -TEMPORARY_=135 -THEN_=136 -TO_=137 -TRANSACTION_=138 -TRIGGER_=139 -UNION_=140 -UNIQUE_=141 -UPDATE_=142 -USING_=143 -VACUUM_=144 -VALUES_=145 -VIEW_=146 -VIRTUAL_=147 -WHEN_=148 -WHERE_=149 -WITH_=150 -WITHOUT_=151 -FIRST_VALUE_=152 -OVER_=153 -PARTITION_=154 -RANGE_=155 -PRECEDING_=156 -UNBOUNDED_=157 -CURRENT_=158 -FOLLOWING_=159 -CUME_DIST_=160 -DENSE_RANK_=161 -LAG_=162 -LAST_VALUE_=163 -LEAD_=164 -NTH_VALUE_=165 -NTILE_=166 -PERCENT_RANK_=167 -RANK_=168 -ROW_NUMBER_=169 -GENERATED_=170 -ALWAYS_=171 -STORED_=172 -TRUE_=173 -FALSE_=174 -WINDOW_=175 -NULLS_=176 -FIRST_=177 -LAST_=178 -FILTER_=179 -GROUPS_=180 -EXCLUDE_=181 -TIES_=182 -OTHERS_=183 -DO_=184 -NOTHING_=185 -IDENTIFIER=186 -NUMERIC_LITERAL=187 -NUMBERED_BIND_PARAMETER=188 -NAMED_BIND_PARAMETER=189 -STRING_LITERAL=190 -BLOB_LITERAL=191 -SINGLE_LINE_COMMENT=192 -MULTILINE_COMMENT=193 -SPACES=194 -UNEXPECTED_CHAR=195 -';'=1 -'.'=2 -'('=3 -')'=4 -','=5 -'='=6 -'*'=7 -'+'=8 -'-'=9 -'~'=10 -'||'=11 -'/'=12 -'%'=13 -'<<'=14 -'>>'=15 -'&'=16 -'|'=17 -'<'=18 -'<='=19 -'>'=20 -'>='=21 -'=='=22 -'!='=23 -'<>'=24 diff --git a/internal/engine/sqlite/parser/SQLiteParser.g4 b/internal/engine/sqlite/parser/SQLiteParser.g4 deleted file mode 100644 index d141603cbc..0000000000 --- a/internal/engine/sqlite/parser/SQLiteParser.g4 +++ /dev/null @@ -1,923 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014 by Bart Kiers - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - * associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Project : sqlite-parser; an ANTLR4 grammar for SQLite https://github.com/bkiers/sqlite-parser - * Developed by: - * Bart Kiers, bart@big-o.nl - * Martin Mirchev, marti_2203@abv.bg - * Mike Lische, mike@lischke-online.de - */ - -// $antlr-format alignTrailingComments on, columnLimit 130, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments off -// $antlr-format useTab off, allowShortRulesOnASingleLine off, allowShortBlocksOnASingleLine on, alignSemicolons ownLine - -parser grammar SQLiteParser; - -options { - tokenVocab = SQLiteLexer; -} - -parse: (sql_stmt_list)* EOF -; - -sql_stmt_list: - SCOL* sql_stmt (SCOL+ sql_stmt)* SCOL* -; - -sql_stmt: (EXPLAIN_ (QUERY_ PLAN_)?)? ( - alter_table_stmt - | analyze_stmt - | attach_stmt - | begin_stmt - | commit_stmt - | create_index_stmt - | create_table_stmt - | create_trigger_stmt - | create_view_stmt - | create_virtual_table_stmt - | delete_stmt - | delete_stmt_limited - | detach_stmt - | drop_stmt - | insert_stmt - | pragma_stmt - | reindex_stmt - | release_stmt - | rollback_stmt - | savepoint_stmt - | select_stmt - | update_stmt - | update_stmt_limited - | vacuum_stmt - ) -; - -alter_table_stmt: - ALTER_ TABLE_ (schema_name DOT)? table_name ( - RENAME_ ( - TO_ new_table_name - | COLUMN_? old_column_name = column_name TO_ new_column_name = column_name - ) - | ADD_ COLUMN_? column_def - | DROP_ COLUMN_? column_name - ) -; - -analyze_stmt: - ANALYZE_ (schema_name | (schema_name DOT)? table_or_index_name)? -; - -attach_stmt: - ATTACH_ DATABASE_? expr AS_ schema_name -; - -begin_stmt: - BEGIN_ (DEFERRED_ | IMMEDIATE_ | EXCLUSIVE_)? ( - TRANSACTION_ transaction_name? - )? -; - -commit_stmt: (COMMIT_ | END_) TRANSACTION_? -; - -rollback_stmt: - ROLLBACK_ TRANSACTION_? (TO_ SAVEPOINT_? savepoint_name)? -; - -savepoint_stmt: - SAVEPOINT_ savepoint_name -; - -release_stmt: - RELEASE_ SAVEPOINT_? savepoint_name -; - -create_index_stmt: - CREATE_ UNIQUE_? INDEX_ (IF_ NOT_ EXISTS_)? (schema_name DOT)? index_name ON_ table_name OPEN_PAR - indexed_column (COMMA indexed_column)* CLOSE_PAR (WHERE_ expr)? -; - -indexed_column: (column_name | expr) (COLLATE_ collation_name)? asc_desc? -; - -table_option: - WITHOUT_ row_ROW_ID = IDENTIFIER - | STRICT_ -; - -create_table_stmt: - CREATE_ (TEMP_ | TEMPORARY_)? TABLE_ (IF_ NOT_ EXISTS_)? ( - schema_name DOT - )? table_name ( - OPEN_PAR column_def (COMMA column_def)*? (COMMA table_constraint)* CLOSE_PAR ( - table_option (COMMA table_option)* - )? - | AS_ select_stmt - ) -; - -column_def: - column_name type_name? column_constraint* -; - -type_name: - name+? ( - OPEN_PAR signed_number CLOSE_PAR - | OPEN_PAR signed_number COMMA signed_number CLOSE_PAR - )? -; - -column_constraint: (CONSTRAINT_ name)? ( - (PRIMARY_ KEY_ asc_desc? conflict_clause? AUTOINCREMENT_?) - | (NOT_ NULL_ | UNIQUE_) conflict_clause? - | CHECK_ OPEN_PAR expr CLOSE_PAR - | DEFAULT_ (signed_number | literal_value | OPEN_PAR expr CLOSE_PAR) - | COLLATE_ collation_name - | foreign_key_clause - | (GENERATED_ ALWAYS_)? AS_ OPEN_PAR expr CLOSE_PAR ( - STORED_ - | VIRTUAL_ - )? - ) -; - -signed_number: (PLUS | MINUS)? NUMERIC_LITERAL -; - -table_constraint: (CONSTRAINT_ name)? ( - (PRIMARY_ KEY_ | UNIQUE_) OPEN_PAR indexed_column ( - COMMA indexed_column - )* CLOSE_PAR conflict_clause? - | CHECK_ OPEN_PAR expr CLOSE_PAR - | FOREIGN_ KEY_ OPEN_PAR column_name (COMMA column_name)* CLOSE_PAR foreign_key_clause - ) -; - -foreign_key_clause: - REFERENCES_ foreign_table ( - OPEN_PAR column_name (COMMA column_name)* CLOSE_PAR - )? ( - ON_ (DELETE_ | UPDATE_) ( - SET_ (NULL_ | DEFAULT_) - | CASCADE_ - | RESTRICT_ - | NO_ ACTION_ - ) - | MATCH_ name - )* (NOT_? DEFERRABLE_ (INITIALLY_ (DEFERRED_ | IMMEDIATE_))?)? -; - -conflict_clause: - ON_ CONFLICT_ ( - ROLLBACK_ - | ABORT_ - | FAIL_ - | IGNORE_ - | REPLACE_ - ) -; - -create_trigger_stmt: - CREATE_ (TEMP_ | TEMPORARY_)? TRIGGER_ (IF_ NOT_ EXISTS_)? ( - schema_name DOT - )? trigger_name (BEFORE_ | AFTER_ | INSTEAD_ OF_)? ( - DELETE_ - | INSERT_ - | UPDATE_ (OF_ column_name ( COMMA column_name)*)? - ) ON_ table_name (FOR_ EACH_ ROW_)? (WHEN_ expr)? BEGIN_ ( - (update_stmt | insert_stmt | delete_stmt | select_stmt) SCOL - )+ END_ -; - -create_view_stmt: - CREATE_ (TEMP_ | TEMPORARY_)? VIEW_ (IF_ NOT_ EXISTS_)? ( - schema_name DOT - )? view_name (OPEN_PAR column_name (COMMA column_name)* CLOSE_PAR)? AS_ select_stmt -; - -create_virtual_table_stmt: - CREATE_ VIRTUAL_ TABLE_ (IF_ NOT_ EXISTS_)? (schema_name DOT)? table_name USING_ module_name ( - OPEN_PAR module_argument (COMMA module_argument)* CLOSE_PAR - )? -; - -with_clause: - WITH_ RECURSIVE_? cte_table_name AS_ OPEN_PAR select_stmt CLOSE_PAR ( - COMMA cte_table_name AS_ OPEN_PAR select_stmt CLOSE_PAR - )* -; - -cte_table_name: - table_name (OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR)? -; - -recursive_cte: - cte_table_name AS_ OPEN_PAR initial_select UNION_ ALL_? recursive__select CLOSE_PAR -; - -common_table_expression: - table_name (OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR)? AS_ OPEN_PAR select_stmt CLOSE_PAR -; - -returning_clause: - RETURNING_ ( - (STAR | expr ( AS_? column_alias)?) ( - COMMA (STAR | expr ( AS_? column_alias)?) - )* - ) -; - -delete_stmt: - with_clause? DELETE_ FROM_ qualified_table_name (WHERE_ expr)? returning_clause? -; - -delete_stmt_limited: - with_clause? DELETE_ FROM_ qualified_table_name (WHERE_ expr)? ( - order_by_stmt? limit_stmt - )? returning_clause? -; - -detach_stmt: - DETACH_ DATABASE_? schema_name -; - -drop_stmt: - DROP_ object = (INDEX_ | TABLE_ | TRIGGER_ | VIEW_) ( - IF_ EXISTS_ - )? (schema_name DOT)? any_name -; - -/* - SQLite understands the following binary operators, in order from highest to lowest precedence: - || - * / % - + - - << >> & | - < <= > >= - = == != <> IS IS NOT IN LIKE GLOB MATCH REGEXP - AND - OR - */ -expr: - literal_value #expr_literal - | NUMBERED_BIND_PARAMETER #expr_bind - | NAMED_BIND_PARAMETER #expr_bind - | ((schema_name DOT)? table_name DOT)? column_name #expr_qualified_column_name - | unary_operator expr #expr_unary - | expr PIPE2 expr #expr_binary - | expr ( STAR | DIV | MOD) expr #expr_math_op - | expr ( PLUS | MINUS) expr #expr_math_op - | expr ( LT2 | GT2 | AMP | PIPE) expr #expr_comparison - | expr ( LT | LT_EQ | GT | GT_EQ) expr #expr_comparison - | expr ( - ASSIGN - | EQ - | NOT_EQ1 - | NOT_EQ2 - | IS_ - | IS_ NOT_ - | NOT_? IN_ - | LIKE_ - | GLOB_ - | MATCH_ - | REGEXP_ - ) expr #expr_comparison - | expr NOT_? IN_ ( - OPEN_PAR (select_stmt | expr ( COMMA expr)*)? CLOSE_PAR - | ( schema_name DOT)? table_name - | (schema_name DOT)? table_function_name OPEN_PAR (expr (COMMA expr)*)? CLOSE_PAR - ) #expr_in_select - | expr AND_ expr #expr_binary - | expr OR_ expr #expr_binary - | qualified_function_name OPEN_PAR ((DISTINCT_? expr ( COMMA expr)*) | STAR)? CLOSE_PAR filter_clause? over_clause? #expr_function - | OPEN_PAR expr (COMMA expr)* CLOSE_PAR #expr_list - | CAST_ OPEN_PAR expr AS_ type_name CLOSE_PAR #expr_cast - | expr COLLATE_ collation_name #expr_collate - | expr NOT_? (LIKE_ | GLOB_ | REGEXP_ | MATCH_) expr ( - ESCAPE_ expr - )? #expr_comparison - | expr ( ISNULL_ | NOTNULL_ | NOT_ NULL_) #expr_null_comp - | expr NOT_? BETWEEN_ expr AND_ expr #expr_between - | ((NOT_)? EXISTS_)? OPEN_PAR select_stmt CLOSE_PAR #expr_in_select - | CASE_ expr? (WHEN_ expr THEN_ expr)+ (ELSE_ expr)? END_ #expr_case - | raise_function #expr_raise -; - -raise_function: - RAISE_ OPEN_PAR ( - IGNORE_ - | (ROLLBACK_ | ABORT_ | FAIL_) COMMA error_message - ) CLOSE_PAR -; - -literal_value: - NUMERIC_LITERAL - | STRING_LITERAL - | BLOB_LITERAL - | NULL_ - | TRUE_ - | FALSE_ - | CURRENT_TIME_ - | CURRENT_DATE_ - | CURRENT_TIMESTAMP_ -; - -insert_stmt: - with_clause? ( - INSERT_ - | REPLACE_ - | INSERT_ OR_ ( - REPLACE_ - | ROLLBACK_ - | ABORT_ - | FAIL_ - | IGNORE_ - ) - ) INTO_ (schema_name DOT)? table_name (AS_ table_alias)? ( - OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR - )? ( - ( - VALUES_ OPEN_PAR expr (COMMA expr)* CLOSE_PAR ( - COMMA OPEN_PAR expr ( COMMA expr)* CLOSE_PAR - )* - | select_stmt - ) upsert_clause? returning_clause? - ) - | DEFAULT_ VALUES_ -; - -upsert_clause: - ON_ CONFLICT_ ( - OPEN_PAR indexed_column (COMMA indexed_column)* CLOSE_PAR (WHERE_ expr)? - )? DO_ ( - NOTHING_ - | UPDATE_ SET_ ( - (column_name | column_name_list) ASSIGN expr ( - COMMA (column_name | column_name_list) ASSIGN expr - )* (WHERE_ expr)? - ) - ) -; - -pragma_stmt: - PRAGMA_ (schema_name DOT)? pragma_name ( - ASSIGN pragma_value - | OPEN_PAR pragma_value CLOSE_PAR - )? -; - -pragma_value: - signed_number - | name - | STRING_LITERAL -; - -reindex_stmt: - REINDEX_ (collation_name | (schema_name DOT)? (table_name | index_name))? -; - -select_stmt: - common_table_stmt? select_core (compound_operator select_core)* order_by_stmt? limit_stmt? -; - -join_clause: - table_or_subquery (join_operator table_or_subquery join_constraint)* -; - -select_core: - ( - SELECT_ (DISTINCT_ | ALL_)? result_column (COMMA result_column)* ( - FROM_ (table_or_subquery (COMMA table_or_subquery)* | join_clause) - )? (WHERE_ expr)? (GROUP_ BY_ expr (COMMA expr)* (HAVING_ expr)?)? ( - WINDOW_ window_name AS_ window_defn ( - COMMA window_name AS_ window_defn - )* - )? - ) - | VALUES_ OPEN_PAR expr (COMMA expr)* CLOSE_PAR ( - COMMA OPEN_PAR expr ( COMMA expr)* CLOSE_PAR - )* -; - -factored_select_stmt: - select_stmt -; - -simple_select_stmt: - common_table_stmt? select_core order_by_stmt? limit_stmt? -; - -compound_select_stmt: - common_table_stmt? select_core ( - (UNION_ ALL_? | INTERSECT_ | EXCEPT_) select_core - )+ order_by_stmt? limit_stmt? -; - -table_or_subquery: - (schema_name DOT)? table_name (AS_? table_alias)? (INDEXED_ BY_ index_name | NOT_ INDEXED_)? - | (schema_name DOT)? table_function_name OPEN_PAR expr (COMMA expr)* CLOSE_PAR (AS_? table_alias)? - | OPEN_PAR (table_or_subquery (COMMA table_or_subquery)* | join_clause) CLOSE_PAR - | OPEN_PAR select_stmt CLOSE_PAR (AS_? table_alias)? - | (schema_name DOT)? table_name (AS_? table_alias_fallback)? (INDEXED_ BY_ index_name | NOT_ INDEXED_)? - | (schema_name DOT)? table_function_name OPEN_PAR expr (COMMA expr)* CLOSE_PAR (AS_? table_alias_fallback)? - | OPEN_PAR (table_or_subquery (COMMA table_or_subquery)* | join_clause) CLOSE_PAR - | OPEN_PAR select_stmt CLOSE_PAR (AS_? table_alias_fallback)? -; - -result_column: - STAR - | table_name DOT STAR - | expr ( AS_? column_alias)? -; - -join_operator: - COMMA - | NATURAL_? (((LEFT_ | RIGHT_ | FULL_) OUTER_?) | INNER_)? JOIN_ - | CROSS_ JOIN_ -; - -join_constraint: - (ON_ expr - | USING_ OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR)? -; - -compound_operator: - UNION_ ALL_? - | INTERSECT_ - | EXCEPT_ -; - -update_stmt: - with_clause? UPDATE_ ( - OR_ (ROLLBACK_ | ABORT_ | REPLACE_ | FAIL_ | IGNORE_) - )? qualified_table_name SET_ (column_name | column_name_list) ASSIGN expr ( - COMMA (column_name | column_name_list) ASSIGN expr - )* (WHERE_ expr)? returning_clause? -; - -column_name_list: - OPEN_PAR column_name (COMMA column_name)* CLOSE_PAR -; - -update_stmt_limited: - with_clause? UPDATE_ ( - OR_ (ROLLBACK_ | ABORT_ | REPLACE_ | FAIL_ | IGNORE_) - )? qualified_table_name SET_ (column_name | column_name_list) ASSIGN expr ( - COMMA (column_name | column_name_list) ASSIGN expr - )* (WHERE_ expr)? (order_by_stmt? limit_stmt)? -; - -qualified_table_name: (schema_name DOT)? table_name (AS_ alias)? ( - INDEXED_ BY_ index_name - | NOT_ INDEXED_ - )? -; - -vacuum_stmt: - VACUUM_ schema_name? (INTO_ filename)? -; - -filter_clause: - FILTER_ OPEN_PAR WHERE_ expr CLOSE_PAR -; - -window_defn: - OPEN_PAR base_window_name? (PARTITION_ BY_ expr (COMMA expr)*)? ( - ORDER_ BY_ ordering_term (COMMA ordering_term)* - ) frame_spec? CLOSE_PAR -; - -over_clause: - OVER_ ( - window_name - | OPEN_PAR base_window_name? (PARTITION_ BY_ expr (COMMA expr)*)? ( - ORDER_ BY_ ordering_term (COMMA ordering_term)* - )? frame_spec? CLOSE_PAR - ) -; - -frame_spec: - frame_clause ( - EXCLUDE_ (NO_ OTHERS_) - | CURRENT_ ROW_ - | GROUP_ - | TIES_ - )? -; - -frame_clause: (RANGE_ | ROWS_ | GROUPS_) ( - frame_single - | BETWEEN_ frame_left AND_ frame_right - ) -; - -simple_function_invocation: - simple_func OPEN_PAR (expr (COMMA expr)* | STAR) CLOSE_PAR -; - -aggregate_function_invocation: - aggregate_func OPEN_PAR (DISTINCT_? expr (COMMA expr)* | STAR)? CLOSE_PAR filter_clause? -; - -window_function_invocation: - window_function OPEN_PAR (expr (COMMA expr)* | STAR)? CLOSE_PAR filter_clause? OVER_ ( - window_defn - | window_name - ) -; - -common_table_stmt: //additional structures - WITH_ RECURSIVE_? common_table_expression (COMMA common_table_expression)* -; - -order_by_stmt: - ORDER_ BY_ ordering_term (COMMA ordering_term)* -; - -limit_stmt: - LIMIT_ expr ((OFFSET_ | COMMA) expr)? -; - -ordering_term: - expr (COLLATE_ collation_name)? asc_desc? (NULLS_ (FIRST_ | LAST_))? -; - -asc_desc: - ASC_ - | DESC_ -; - -frame_left: - expr PRECEDING_ - | expr FOLLOWING_ - | CURRENT_ ROW_ - | UNBOUNDED_ PRECEDING_ -; - -frame_right: - expr PRECEDING_ - | expr FOLLOWING_ - | CURRENT_ ROW_ - | UNBOUNDED_ FOLLOWING_ -; - -frame_single: - expr PRECEDING_ - | UNBOUNDED_ PRECEDING_ - | CURRENT_ ROW_ -; - -// unknown - -window_function: - (FIRST_VALUE_ | LAST_VALUE_) OPEN_PAR expr CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr_asc_desc frame_clause - ? CLOSE_PAR - | (CUME_DIST_ | PERCENT_RANK_) OPEN_PAR CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr? CLOSE_PAR - | (DENSE_RANK_ | RANK_ | ROW_NUMBER_) OPEN_PAR CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr_asc_desc - CLOSE_PAR - | (LAG_ | LEAD_) OPEN_PAR expr of_OF_fset? default_DEFAULT__value? CLOSE_PAR OVER_ OPEN_PAR partition_by? - order_by_expr_asc_desc CLOSE_PAR - | NTH_VALUE_ OPEN_PAR expr COMMA signed_number CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr_asc_desc - frame_clause? CLOSE_PAR - | NTILE_ OPEN_PAR expr CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr_asc_desc CLOSE_PAR -; - -of_OF_fset: - COMMA signed_number -; - -default_DEFAULT__value: - COMMA signed_number -; - -partition_by: - PARTITION_ BY_ expr+ -; - -order_by_expr: - ORDER_ BY_ expr+ -; - -order_by_expr_asc_desc: - ORDER_ BY_ order_by_expr_asc_desc -; - -expr_asc_desc: - expr asc_desc? (COMMA expr asc_desc?)* -; - -//TODO BOTH OF THESE HAVE TO BE REWORKED TO FOLLOW THE SPEC -initial_select: - select_stmt -; - -recursive__select: - select_stmt -; - -unary_operator: - MINUS - | PLUS - | TILDE - | NOT_ -; - -error_message: - STRING_LITERAL -; - -module_argument: // TODO check what exactly is permitted here - expr - | column_def -; - -column_alias: - IDENTIFIER - | STRING_LITERAL -; - -keyword: - ABORT_ - | ACTION_ - | ADD_ - | AFTER_ - | ALL_ - | ALTER_ - | ANALYZE_ - | AND_ - | AS_ - | ASC_ - | ATTACH_ - | AUTOINCREMENT_ - | BEFORE_ - | BEGIN_ - | BETWEEN_ - | BY_ - | CASCADE_ - | CASE_ - | CAST_ - | CHECK_ - | COLLATE_ - | COLUMN_ - | COMMIT_ - | CONFLICT_ - | CONSTRAINT_ - | CREATE_ - | CROSS_ - | CURRENT_DATE_ - | CURRENT_TIME_ - | CURRENT_TIMESTAMP_ - | DATABASE_ - | DEFAULT_ - | DEFERRABLE_ - | DEFERRED_ - | DELETE_ - | DESC_ - | DETACH_ - | DISTINCT_ - | DROP_ - | EACH_ - | ELSE_ - | END_ - | ESCAPE_ - | EXCEPT_ - | EXCLUSIVE_ - | EXISTS_ - | EXPLAIN_ - | FAIL_ - | FOR_ - | FOREIGN_ - | FROM_ - | FULL_ - | GLOB_ - | GROUP_ - | HAVING_ - | IF_ - | IGNORE_ - | IMMEDIATE_ - | IN_ - | INDEX_ - | INDEXED_ - | INITIALLY_ - | INNER_ - | INSERT_ - | INSTEAD_ - | INTERSECT_ - | INTO_ - | IS_ - | ISNULL_ - | JOIN_ - | KEY_ - | LEFT_ - | LIKE_ - | LIMIT_ - | MATCH_ - | NATURAL_ - | NO_ - | NOT_ - | NOTNULL_ - | NULL_ - | OF_ - | OFFSET_ - | ON_ - | OR_ - | ORDER_ - | OUTER_ - | PLAN_ - | PRAGMA_ - | PRIMARY_ - | QUERY_ - | RAISE_ - | RECURSIVE_ - | REFERENCES_ - | REGEXP_ - | REINDEX_ - | RELEASE_ - | RENAME_ - | REPLACE_ - | RESTRICT_ - | RETURNING_ - | RIGHT_ - | ROLLBACK_ - | ROW_ - | ROWS_ - | SAVEPOINT_ - | SELECT_ - | SET_ - | STRICT_ - | TABLE_ - | TEMP_ - | TEMPORARY_ - | THEN_ - | TO_ - | TRANSACTION_ - | TRIGGER_ - | UNION_ - | UNIQUE_ - | UPDATE_ - | USING_ - | VACUUM_ - | VALUES_ - | VIEW_ - | VIRTUAL_ - | WHEN_ - | WHERE_ - | WITH_ - | WITHOUT_ - | FIRST_VALUE_ - | OVER_ - | PARTITION_ - | RANGE_ - | PRECEDING_ - | UNBOUNDED_ - | CURRENT_ - | FOLLOWING_ - | CUME_DIST_ - | DENSE_RANK_ - | LAG_ - | LAST_VALUE_ - | LEAD_ - | NTH_VALUE_ - | NTILE_ - | PERCENT_RANK_ - | RANK_ - | ROW_NUMBER_ - | GENERATED_ - | ALWAYS_ - | STORED_ - | TRUE_ - | FALSE_ - | WINDOW_ - | NULLS_ - | FIRST_ - | LAST_ - | FILTER_ - | GROUPS_ - | EXCLUDE_ -; - -// TODO: check all names below - -name: - any_name -; - -function_name: - any_name -; - -qualified_function_name: - (schema_name DOT)? function_name -; - -schema_name: - any_name -; - -table_name: - any_name -; - -table_or_index_name: - any_name -; - -new_table_name: - any_name -; - -column_name: - any_name -; - -collation_name: - any_name -; - -foreign_table: - any_name -; - -index_name: - any_name -; - -trigger_name: - any_name -; - -view_name: - any_name -; - -module_name: - any_name -; - -pragma_name: - any_name -; - -savepoint_name: - any_name -; - -table_alias: IDENTIFIER | STRING_LITERAL; - -table_alias_fallback: any_name; - -transaction_name: - any_name -; - -window_name: - any_name -; - -alias: - any_name -; - -filename: - any_name -; - -base_window_name: - any_name -; - -simple_func: - any_name -; - -aggregate_func: - any_name -; - -table_function_name: - any_name -; - -any_name: - IDENTIFIER - | keyword - | STRING_LITERAL - | OPEN_PAR any_name CLOSE_PAR -; diff --git a/internal/engine/sqlite/parser/SQLiteParser.interp b/internal/engine/sqlite/parser/SQLiteParser.interp deleted file mode 100644 index 2617e0bc04..0000000000 --- a/internal/engine/sqlite/parser/SQLiteParser.interp +++ /dev/null @@ -1,516 +0,0 @@ -token literal names: -null -';' -'.' -'(' -')' -',' -'=' -'*' -'+' -'-' -'~' -'||' -'/' -'%' -'<<' -'>>' -'&' -'|' -'<' -'<=' -'>' -'>=' -'==' -'!=' -'<>' -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null - -token symbolic names: -null -SCOL -DOT -OPEN_PAR -CLOSE_PAR -COMMA -ASSIGN -STAR -PLUS -MINUS -TILDE -PIPE2 -DIV -MOD -LT2 -GT2 -AMP -PIPE -LT -LT_EQ -GT -GT_EQ -EQ -NOT_EQ1 -NOT_EQ2 -ABORT_ -ACTION_ -ADD_ -AFTER_ -ALL_ -ALTER_ -ANALYZE_ -AND_ -AS_ -ASC_ -ATTACH_ -AUTOINCREMENT_ -BEFORE_ -BEGIN_ -BETWEEN_ -BY_ -CASCADE_ -CASE_ -CAST_ -CHECK_ -COLLATE_ -COLUMN_ -COMMIT_ -CONFLICT_ -CONSTRAINT_ -CREATE_ -CROSS_ -CURRENT_DATE_ -CURRENT_TIME_ -CURRENT_TIMESTAMP_ -DATABASE_ -DEFAULT_ -DEFERRABLE_ -DEFERRED_ -DELETE_ -DESC_ -DETACH_ -DISTINCT_ -DROP_ -EACH_ -ELSE_ -END_ -ESCAPE_ -EXCEPT_ -EXCLUSIVE_ -EXISTS_ -EXPLAIN_ -FAIL_ -FOR_ -FOREIGN_ -FROM_ -FULL_ -GLOB_ -GROUP_ -HAVING_ -IF_ -IGNORE_ -IMMEDIATE_ -IN_ -INDEX_ -INDEXED_ -INITIALLY_ -INNER_ -INSERT_ -INSTEAD_ -INTERSECT_ -INTO_ -IS_ -ISNULL_ -JOIN_ -KEY_ -LEFT_ -LIKE_ -LIMIT_ -MATCH_ -NATURAL_ -NO_ -NOT_ -NOTNULL_ -NULL_ -OF_ -OFFSET_ -ON_ -OR_ -ORDER_ -OUTER_ -PLAN_ -PRAGMA_ -PRIMARY_ -QUERY_ -RAISE_ -RECURSIVE_ -REFERENCES_ -REGEXP_ -REINDEX_ -RELEASE_ -RENAME_ -REPLACE_ -RESTRICT_ -RETURNING_ -RIGHT_ -ROLLBACK_ -ROW_ -ROWS_ -SAVEPOINT_ -SELECT_ -SET_ -STRICT_ -TABLE_ -TEMP_ -TEMPORARY_ -THEN_ -TO_ -TRANSACTION_ -TRIGGER_ -UNION_ -UNIQUE_ -UPDATE_ -USING_ -VACUUM_ -VALUES_ -VIEW_ -VIRTUAL_ -WHEN_ -WHERE_ -WITH_ -WITHOUT_ -FIRST_VALUE_ -OVER_ -PARTITION_ -RANGE_ -PRECEDING_ -UNBOUNDED_ -CURRENT_ -FOLLOWING_ -CUME_DIST_ -DENSE_RANK_ -LAG_ -LAST_VALUE_ -LEAD_ -NTH_VALUE_ -NTILE_ -PERCENT_RANK_ -RANK_ -ROW_NUMBER_ -GENERATED_ -ALWAYS_ -STORED_ -TRUE_ -FALSE_ -WINDOW_ -NULLS_ -FIRST_ -LAST_ -FILTER_ -GROUPS_ -EXCLUDE_ -TIES_ -OTHERS_ -DO_ -NOTHING_ -IDENTIFIER -NUMERIC_LITERAL -NUMBERED_BIND_PARAMETER -NAMED_BIND_PARAMETER -STRING_LITERAL -BLOB_LITERAL -SINGLE_LINE_COMMENT -MULTILINE_COMMENT -SPACES -UNEXPECTED_CHAR - -rule names: -parse -sql_stmt_list -sql_stmt -alter_table_stmt -analyze_stmt -attach_stmt -begin_stmt -commit_stmt -rollback_stmt -savepoint_stmt -release_stmt -create_index_stmt -indexed_column -table_option -create_table_stmt -column_def -type_name -column_constraint -signed_number -table_constraint -foreign_key_clause -conflict_clause -create_trigger_stmt -create_view_stmt -create_virtual_table_stmt -with_clause -cte_table_name -recursive_cte -common_table_expression -returning_clause -delete_stmt -delete_stmt_limited -detach_stmt -drop_stmt -expr -raise_function -literal_value -insert_stmt -upsert_clause -pragma_stmt -pragma_value -reindex_stmt -select_stmt -join_clause -select_core -factored_select_stmt -simple_select_stmt -compound_select_stmt -table_or_subquery -result_column -join_operator -join_constraint -compound_operator -update_stmt -column_name_list -update_stmt_limited -qualified_table_name -vacuum_stmt -filter_clause -window_defn -over_clause -frame_spec -frame_clause -simple_function_invocation -aggregate_function_invocation -window_function_invocation -common_table_stmt -order_by_stmt -limit_stmt -ordering_term -asc_desc -frame_left -frame_right -frame_single -window_function -of_OF_fset -default_DEFAULT__value -partition_by -order_by_expr -order_by_expr_asc_desc -expr_asc_desc -initial_select -recursive__select -unary_operator -error_message -module_argument -column_alias -keyword -name -function_name -qualified_function_name -schema_name -table_name -table_or_index_name -new_table_name -column_name -collation_name -foreign_table -index_name -trigger_name -view_name -module_name -pragma_name -savepoint_name -table_alias -table_alias_fallback -transaction_name -window_name -alias -filename -base_window_name -simple_func -aggregate_func -table_function_name -any_name - - -atn: -[4, 1, 195, 2175, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 1, 0, 5, 0, 232, 8, 0, 10, 0, 12, 0, 235, 9, 0, 1, 0, 1, 0, 1, 1, 5, 1, 240, 8, 1, 10, 1, 12, 1, 243, 9, 1, 1, 1, 1, 1, 4, 1, 247, 8, 1, 11, 1, 12, 1, 248, 1, 1, 5, 1, 252, 8, 1, 10, 1, 12, 1, 255, 9, 1, 1, 1, 5, 1, 258, 8, 1, 10, 1, 12, 1, 261, 9, 1, 1, 2, 1, 2, 1, 2, 3, 2, 266, 8, 2, 3, 2, 268, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 294, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 301, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 308, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 314, 8, 3, 1, 3, 1, 3, 3, 3, 318, 8, 3, 1, 3, 1, 3, 1, 3, 3, 3, 323, 8, 3, 1, 3, 3, 3, 326, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 333, 8, 4, 1, 4, 3, 4, 336, 8, 4, 1, 5, 1, 5, 3, 5, 340, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 3, 6, 348, 8, 6, 1, 6, 1, 6, 3, 6, 352, 8, 6, 3, 6, 354, 8, 6, 1, 7, 1, 7, 3, 7, 358, 8, 7, 1, 8, 1, 8, 3, 8, 362, 8, 8, 1, 8, 1, 8, 3, 8, 366, 8, 8, 1, 8, 3, 8, 369, 8, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 376, 8, 10, 1, 10, 1, 10, 1, 11, 1, 11, 3, 11, 382, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 388, 8, 11, 1, 11, 1, 11, 1, 11, 3, 11, 393, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 402, 8, 11, 10, 11, 12, 11, 405, 9, 11, 1, 11, 1, 11, 1, 11, 3, 11, 410, 8, 11, 1, 12, 1, 12, 3, 12, 414, 8, 12, 1, 12, 1, 12, 3, 12, 418, 8, 12, 1, 12, 3, 12, 421, 8, 12, 1, 13, 1, 13, 1, 13, 3, 13, 426, 8, 13, 1, 14, 1, 14, 3, 14, 430, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 436, 8, 14, 1, 14, 1, 14, 1, 14, 3, 14, 441, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 448, 8, 14, 10, 14, 12, 14, 451, 9, 14, 1, 14, 1, 14, 5, 14, 455, 8, 14, 10, 14, 12, 14, 458, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 464, 8, 14, 10, 14, 12, 14, 467, 9, 14, 3, 14, 469, 8, 14, 1, 14, 1, 14, 3, 14, 473, 8, 14, 1, 15, 1, 15, 3, 15, 477, 8, 15, 1, 15, 5, 15, 480, 8, 15, 10, 15, 12, 15, 483, 9, 15, 1, 16, 4, 16, 486, 8, 16, 11, 16, 12, 16, 487, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 500, 8, 16, 1, 17, 1, 17, 3, 17, 504, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 509, 8, 17, 1, 17, 3, 17, 512, 8, 17, 1, 17, 3, 17, 515, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 520, 8, 17, 1, 17, 3, 17, 523, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 537, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 544, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 551, 8, 17, 3, 17, 553, 8, 17, 1, 18, 3, 18, 556, 8, 18, 1, 18, 1, 18, 1, 19, 1, 19, 3, 19, 562, 8, 19, 1, 19, 1, 19, 1, 19, 3, 19, 567, 8, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 573, 8, 19, 10, 19, 12, 19, 576, 9, 19, 1, 19, 1, 19, 3, 19, 580, 8, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 593, 8, 19, 10, 19, 12, 19, 596, 9, 19, 1, 19, 1, 19, 1, 19, 3, 19, 601, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 609, 8, 20, 10, 20, 12, 20, 612, 9, 20, 1, 20, 1, 20, 3, 20, 616, 8, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 626, 8, 20, 1, 20, 1, 20, 5, 20, 630, 8, 20, 10, 20, 12, 20, 633, 9, 20, 1, 20, 3, 20, 636, 8, 20, 1, 20, 1, 20, 1, 20, 3, 20, 641, 8, 20, 3, 20, 643, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 3, 22, 651, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 657, 8, 22, 1, 22, 1, 22, 1, 22, 3, 22, 662, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 669, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 678, 8, 22, 10, 22, 12, 22, 681, 9, 22, 3, 22, 683, 8, 22, 3, 22, 685, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 692, 8, 22, 1, 22, 1, 22, 3, 22, 696, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 703, 8, 22, 1, 22, 1, 22, 4, 22, 707, 8, 22, 11, 22, 12, 22, 708, 1, 22, 1, 22, 1, 23, 1, 23, 3, 23, 715, 8, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 721, 8, 23, 1, 23, 1, 23, 1, 23, 3, 23, 726, 8, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 733, 8, 23, 10, 23, 12, 23, 736, 9, 23, 1, 23, 1, 23, 3, 23, 740, 8, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 751, 8, 24, 1, 24, 1, 24, 1, 24, 3, 24, 756, 8, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 765, 8, 24, 10, 24, 12, 24, 768, 9, 24, 1, 24, 1, 24, 3, 24, 772, 8, 24, 1, 25, 1, 25, 3, 25, 776, 8, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 790, 8, 25, 10, 25, 12, 25, 793, 9, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 800, 8, 26, 10, 26, 12, 26, 803, 9, 26, 1, 26, 1, 26, 3, 26, 807, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 815, 8, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 825, 8, 28, 10, 28, 12, 28, 828, 9, 28, 1, 28, 1, 28, 3, 28, 832, 8, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 843, 8, 29, 1, 29, 3, 29, 846, 8, 29, 3, 29, 848, 8, 29, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 854, 8, 29, 1, 29, 3, 29, 857, 8, 29, 3, 29, 859, 8, 29, 5, 29, 861, 8, 29, 10, 29, 12, 29, 864, 9, 29, 1, 30, 3, 30, 867, 8, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 3, 30, 874, 8, 30, 1, 30, 3, 30, 877, 8, 30, 1, 31, 3, 31, 880, 8, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 887, 8, 31, 1, 31, 3, 31, 890, 8, 31, 1, 31, 3, 31, 893, 8, 31, 1, 31, 3, 31, 896, 8, 31, 1, 32, 1, 32, 3, 32, 900, 8, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 908, 8, 33, 1, 33, 1, 33, 1, 33, 3, 33, 913, 8, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 924, 8, 34, 1, 34, 1, 34, 1, 34, 3, 34, 929, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 938, 8, 34, 1, 34, 1, 34, 1, 34, 5, 34, 943, 8, 34, 10, 34, 12, 34, 946, 9, 34, 1, 34, 3, 34, 949, 8, 34, 1, 34, 1, 34, 3, 34, 953, 8, 34, 1, 34, 3, 34, 956, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 962, 8, 34, 10, 34, 12, 34, 965, 9, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 977, 8, 34, 1, 34, 3, 34, 980, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 988, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 4, 34, 995, 8, 34, 11, 34, 12, 34, 996, 1, 34, 1, 34, 3, 34, 1001, 8, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1006, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1032, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1039, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1050, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1059, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1067, 8, 34, 10, 34, 12, 34, 1070, 9, 34, 3, 34, 1072, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1078, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1084, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1091, 8, 34, 10, 34, 12, 34, 1094, 9, 34, 3, 34, 1096, 8, 34, 1, 34, 1, 34, 3, 34, 1100, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1107, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1113, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1120, 8, 34, 5, 34, 1122, 8, 34, 10, 34, 12, 34, 1125, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 1133, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, 37, 1140, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1147, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1153, 8, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1158, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1164, 8, 37, 10, 37, 12, 37, 1167, 9, 37, 1, 37, 1, 37, 3, 37, 1171, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1178, 8, 37, 10, 37, 12, 37, 1181, 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1189, 8, 37, 10, 37, 12, 37, 1192, 9, 37, 1, 37, 1, 37, 5, 37, 1196, 8, 37, 10, 37, 12, 37, 1199, 9, 37, 1, 37, 3, 37, 1202, 8, 37, 1, 37, 3, 37, 1205, 8, 37, 1, 37, 3, 37, 1208, 8, 37, 1, 37, 1, 37, 3, 37, 1212, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1220, 8, 38, 10, 38, 12, 38, 1223, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1228, 8, 38, 3, 38, 1230, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1238, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1245, 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1250, 8, 38, 10, 38, 12, 38, 1253, 9, 38, 1, 38, 1, 38, 3, 38, 1257, 8, 38, 3, 38, 1259, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1265, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1274, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1279, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1286, 8, 41, 1, 41, 1, 41, 3, 41, 1290, 8, 41, 3, 41, 1292, 8, 41, 1, 42, 3, 42, 1295, 8, 42, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 1301, 8, 42, 10, 42, 12, 42, 1304, 9, 42, 1, 42, 3, 42, 1307, 8, 42, 1, 42, 3, 42, 1310, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 5, 43, 1317, 8, 43, 10, 43, 12, 43, 1320, 9, 43, 1, 44, 1, 44, 3, 44, 1324, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1329, 8, 44, 10, 44, 12, 44, 1332, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1338, 8, 44, 10, 44, 12, 44, 1341, 9, 44, 1, 44, 3, 44, 1344, 8, 44, 3, 44, 1346, 8, 44, 1, 44, 1, 44, 3, 44, 1350, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1357, 8, 44, 10, 44, 12, 44, 1360, 9, 44, 1, 44, 1, 44, 3, 44, 1364, 8, 44, 3, 44, 1366, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1377, 8, 44, 10, 44, 12, 44, 1380, 9, 44, 3, 44, 1382, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1389, 8, 44, 10, 44, 12, 44, 1392, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1400, 8, 44, 10, 44, 12, 44, 1403, 9, 44, 1, 44, 1, 44, 5, 44, 1407, 8, 44, 10, 44, 12, 44, 1410, 9, 44, 3, 44, 1412, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, 1417, 8, 46, 1, 46, 1, 46, 3, 46, 1421, 8, 46, 1, 46, 3, 46, 1424, 8, 46, 1, 47, 3, 47, 1427, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1432, 8, 47, 1, 47, 1, 47, 3, 47, 1436, 8, 47, 1, 47, 4, 47, 1439, 8, 47, 11, 47, 12, 47, 1440, 1, 47, 3, 47, 1444, 8, 47, 1, 47, 3, 47, 1447, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1452, 8, 48, 1, 48, 1, 48, 3, 48, 1456, 8, 48, 1, 48, 3, 48, 1459, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1466, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1471, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1478, 8, 48, 10, 48, 12, 48, 1481, 9, 48, 1, 48, 1, 48, 3, 48, 1485, 8, 48, 1, 48, 3, 48, 1488, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1494, 8, 48, 10, 48, 12, 48, 1497, 9, 48, 1, 48, 3, 48, 1500, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1508, 8, 48, 1, 48, 3, 48, 1511, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1516, 8, 48, 1, 48, 1, 48, 3, 48, 1520, 8, 48, 1, 48, 3, 48, 1523, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1530, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1535, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1542, 8, 48, 10, 48, 12, 48, 1545, 9, 48, 1, 48, 1, 48, 3, 48, 1549, 8, 48, 1, 48, 3, 48, 1552, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1558, 8, 48, 10, 48, 12, 48, 1561, 9, 48, 1, 48, 3, 48, 1564, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1572, 8, 48, 1, 48, 3, 48, 1575, 8, 48, 3, 48, 1577, 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1586, 8, 49, 1, 49, 3, 49, 1589, 8, 49, 3, 49, 1591, 8, 49, 1, 50, 1, 50, 3, 50, 1595, 8, 50, 1, 50, 1, 50, 3, 50, 1599, 8, 50, 1, 50, 3, 50, 1602, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 1607, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 1616, 8, 51, 10, 51, 12, 51, 1619, 9, 51, 1, 51, 1, 51, 3, 51, 1623, 8, 51, 1, 52, 1, 52, 3, 52, 1627, 8, 52, 1, 52, 1, 52, 3, 52, 1631, 8, 52, 1, 53, 3, 53, 1634, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1639, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1645, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1652, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1657, 8, 53, 10, 53, 12, 53, 1660, 9, 53, 1, 53, 1, 53, 3, 53, 1664, 8, 53, 1, 53, 3, 53, 1667, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1673, 8, 54, 10, 54, 12, 54, 1676, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1681, 8, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1686, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1692, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1699, 8, 55, 1, 55, 1, 55, 1, 55, 5, 55, 1704, 8, 55, 10, 55, 12, 55, 1707, 9, 55, 1, 55, 1, 55, 3, 55, 1711, 8, 55, 1, 55, 3, 55, 1714, 8, 55, 1, 55, 3, 55, 1717, 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1722, 8, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1727, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1734, 8, 56, 1, 57, 1, 57, 3, 57, 1738, 8, 57, 1, 57, 1, 57, 3, 57, 1742, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1752, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1759, 8, 59, 10, 59, 12, 59, 1762, 9, 59, 3, 59, 1764, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1771, 8, 59, 10, 59, 12, 59, 1774, 9, 59, 1, 59, 3, 59, 1777, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1785, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1792, 8, 60, 10, 60, 12, 60, 1795, 9, 60, 3, 60, 1797, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1804, 8, 60, 10, 60, 12, 60, 1807, 9, 60, 3, 60, 1809, 8, 60, 1, 60, 3, 60, 1812, 8, 60, 1, 60, 3, 60, 1815, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 1825, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1834, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 1841, 8, 63, 10, 63, 12, 63, 1844, 9, 63, 1, 63, 3, 63, 1847, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1854, 8, 64, 1, 64, 1, 64, 1, 64, 5, 64, 1859, 8, 64, 10, 64, 12, 64, 1862, 9, 64, 1, 64, 3, 64, 1865, 8, 64, 1, 64, 1, 64, 3, 64, 1869, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1876, 8, 65, 10, 65, 12, 65, 1879, 9, 65, 1, 65, 3, 65, 1882, 8, 65, 1, 65, 1, 65, 3, 65, 1886, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1891, 8, 65, 1, 66, 1, 66, 3, 66, 1895, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1900, 8, 66, 10, 66, 12, 66, 1903, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1910, 8, 67, 10, 67, 12, 67, 1913, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1919, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1924, 8, 69, 1, 69, 3, 69, 1927, 8, 69, 1, 69, 1, 69, 3, 69, 1931, 8, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, 1945, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1957, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1966, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1975, 8, 74, 1, 74, 1, 74, 3, 74, 1979, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1989, 8, 74, 1, 74, 3, 74, 1992, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2001, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2010, 8, 74, 1, 74, 3, 74, 2013, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2019, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2033, 8, 74, 1, 74, 1, 74, 3, 74, 2037, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2048, 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2053, 8, 74, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2064, 8, 77, 11, 77, 12, 77, 2065, 1, 78, 1, 78, 1, 78, 4, 78, 2071, 8, 78, 11, 78, 12, 78, 2072, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2081, 8, 80, 1, 80, 1, 80, 1, 80, 3, 80, 2086, 8, 80, 5, 80, 2088, 8, 80, 10, 80, 12, 80, 2091, 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 3, 85, 2103, 8, 85, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 3, 90, 2116, 8, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 92, 1, 92, 1, 93, 1, 93, 1, 94, 1, 94, 1, 95, 1, 95, 1, 96, 1, 96, 1, 97, 1, 97, 1, 98, 1, 98, 1, 99, 1, 99, 1, 100, 1, 100, 1, 101, 1, 101, 1, 102, 1, 102, 1, 103, 1, 103, 1, 104, 1, 104, 1, 105, 1, 105, 1, 106, 1, 106, 1, 107, 1, 107, 1, 108, 1, 108, 1, 109, 1, 109, 1, 110, 1, 110, 1, 111, 1, 111, 1, 112, 1, 112, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 3, 114, 2173, 8, 114, 1, 114, 2, 449, 487, 1, 68, 115, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 0, 29, 3, 0, 58, 58, 69, 69, 82, 82, 2, 0, 47, 47, 66, 66, 1, 0, 134, 135, 2, 0, 147, 147, 172, 172, 1, 0, 8, 9, 2, 0, 59, 59, 142, 142, 2, 0, 56, 56, 104, 104, 2, 0, 58, 58, 82, 82, 5, 0, 25, 25, 72, 72, 81, 81, 122, 122, 126, 126, 4, 0, 84, 84, 133, 133, 139, 139, 146, 146, 2, 0, 7, 7, 12, 13, 1, 0, 14, 17, 1, 0, 18, 21, 4, 0, 77, 77, 97, 97, 99, 99, 118, 118, 3, 0, 25, 25, 72, 72, 126, 126, 5, 0, 52, 54, 104, 104, 173, 174, 187, 187, 190, 191, 2, 0, 29, 29, 62, 62, 3, 0, 76, 76, 96, 96, 125, 125, 3, 0, 128, 128, 155, 155, 180, 180, 2, 0, 5, 5, 106, 106, 1, 0, 177, 178, 2, 0, 34, 34, 60, 60, 2, 0, 152, 152, 163, 163, 2, 0, 160, 160, 167, 167, 2, 0, 161, 161, 168, 169, 2, 0, 162, 162, 164, 164, 2, 0, 8, 10, 102, 102, 2, 0, 186, 186, 190, 190, 1, 0, 25, 181, 2480, 0, 233, 1, 0, 0, 0, 2, 241, 1, 0, 0, 0, 4, 267, 1, 0, 0, 0, 6, 295, 1, 0, 0, 0, 8, 327, 1, 0, 0, 0, 10, 337, 1, 0, 0, 0, 12, 345, 1, 0, 0, 0, 14, 355, 1, 0, 0, 0, 16, 359, 1, 0, 0, 0, 18, 370, 1, 0, 0, 0, 20, 373, 1, 0, 0, 0, 22, 379, 1, 0, 0, 0, 24, 413, 1, 0, 0, 0, 26, 425, 1, 0, 0, 0, 28, 427, 1, 0, 0, 0, 30, 474, 1, 0, 0, 0, 32, 485, 1, 0, 0, 0, 34, 503, 1, 0, 0, 0, 36, 555, 1, 0, 0, 0, 38, 561, 1, 0, 0, 0, 40, 602, 1, 0, 0, 0, 42, 644, 1, 0, 0, 0, 44, 648, 1, 0, 0, 0, 46, 712, 1, 0, 0, 0, 48, 744, 1, 0, 0, 0, 50, 773, 1, 0, 0, 0, 52, 794, 1, 0, 0, 0, 54, 808, 1, 0, 0, 0, 56, 819, 1, 0, 0, 0, 58, 838, 1, 0, 0, 0, 60, 866, 1, 0, 0, 0, 62, 879, 1, 0, 0, 0, 64, 897, 1, 0, 0, 0, 66, 903, 1, 0, 0, 0, 68, 1005, 1, 0, 0, 0, 70, 1126, 1, 0, 0, 0, 72, 1136, 1, 0, 0, 0, 74, 1211, 1, 0, 0, 0, 76, 1213, 1, 0, 0, 0, 78, 1260, 1, 0, 0, 0, 80, 1278, 1, 0, 0, 0, 82, 1280, 1, 0, 0, 0, 84, 1294, 1, 0, 0, 0, 86, 1311, 1, 0, 0, 0, 88, 1411, 1, 0, 0, 0, 90, 1413, 1, 0, 0, 0, 92, 1416, 1, 0, 0, 0, 94, 1426, 1, 0, 0, 0, 96, 1576, 1, 0, 0, 0, 98, 1590, 1, 0, 0, 0, 100, 1606, 1, 0, 0, 0, 102, 1622, 1, 0, 0, 0, 104, 1630, 1, 0, 0, 0, 106, 1633, 1, 0, 0, 0, 108, 1668, 1, 0, 0, 0, 110, 1680, 1, 0, 0, 0, 112, 1721, 1, 0, 0, 0, 114, 1735, 1, 0, 0, 0, 116, 1743, 1, 0, 0, 0, 118, 1749, 1, 0, 0, 0, 120, 1780, 1, 0, 0, 0, 122, 1816, 1, 0, 0, 0, 124, 1826, 1, 0, 0, 0, 126, 1835, 1, 0, 0, 0, 128, 1850, 1, 0, 0, 0, 130, 1870, 1, 0, 0, 0, 132, 1892, 1, 0, 0, 0, 134, 1904, 1, 0, 0, 0, 136, 1914, 1, 0, 0, 0, 138, 1920, 1, 0, 0, 0, 140, 1932, 1, 0, 0, 0, 142, 1944, 1, 0, 0, 0, 144, 1956, 1, 0, 0, 0, 146, 1965, 1, 0, 0, 0, 148, 2052, 1, 0, 0, 0, 150, 2054, 1, 0, 0, 0, 152, 2057, 1, 0, 0, 0, 154, 2060, 1, 0, 0, 0, 156, 2067, 1, 0, 0, 0, 158, 2074, 1, 0, 0, 0, 160, 2078, 1, 0, 0, 0, 162, 2092, 1, 0, 0, 0, 164, 2094, 1, 0, 0, 0, 166, 2096, 1, 0, 0, 0, 168, 2098, 1, 0, 0, 0, 170, 2102, 1, 0, 0, 0, 172, 2104, 1, 0, 0, 0, 174, 2106, 1, 0, 0, 0, 176, 2108, 1, 0, 0, 0, 178, 2110, 1, 0, 0, 0, 180, 2115, 1, 0, 0, 0, 182, 2119, 1, 0, 0, 0, 184, 2121, 1, 0, 0, 0, 186, 2123, 1, 0, 0, 0, 188, 2125, 1, 0, 0, 0, 190, 2127, 1, 0, 0, 0, 192, 2129, 1, 0, 0, 0, 194, 2131, 1, 0, 0, 0, 196, 2133, 1, 0, 0, 0, 198, 2135, 1, 0, 0, 0, 200, 2137, 1, 0, 0, 0, 202, 2139, 1, 0, 0, 0, 204, 2141, 1, 0, 0, 0, 206, 2143, 1, 0, 0, 0, 208, 2145, 1, 0, 0, 0, 210, 2147, 1, 0, 0, 0, 212, 2149, 1, 0, 0, 0, 214, 2151, 1, 0, 0, 0, 216, 2153, 1, 0, 0, 0, 218, 2155, 1, 0, 0, 0, 220, 2157, 1, 0, 0, 0, 222, 2159, 1, 0, 0, 0, 224, 2161, 1, 0, 0, 0, 226, 2163, 1, 0, 0, 0, 228, 2172, 1, 0, 0, 0, 230, 232, 3, 2, 1, 0, 231, 230, 1, 0, 0, 0, 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 236, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, 237, 5, 0, 0, 1, 237, 1, 1, 0, 0, 0, 238, 240, 5, 1, 0, 0, 239, 238, 1, 0, 0, 0, 240, 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 241, 242, 1, 0, 0, 0, 242, 244, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 244, 253, 3, 4, 2, 0, 245, 247, 5, 1, 0, 0, 246, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 246, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 252, 3, 4, 2, 0, 251, 246, 1, 0, 0, 0, 252, 255, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 253, 254, 1, 0, 0, 0, 254, 259, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 256, 258, 5, 1, 0, 0, 257, 256, 1, 0, 0, 0, 258, 261, 1, 0, 0, 0, 259, 257, 1, 0, 0, 0, 259, 260, 1, 0, 0, 0, 260, 3, 1, 0, 0, 0, 261, 259, 1, 0, 0, 0, 262, 265, 5, 71, 0, 0, 263, 264, 5, 114, 0, 0, 264, 266, 5, 111, 0, 0, 265, 263, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 268, 1, 0, 0, 0, 267, 262, 1, 0, 0, 0, 267, 268, 1, 0, 0, 0, 268, 293, 1, 0, 0, 0, 269, 294, 3, 6, 3, 0, 270, 294, 3, 8, 4, 0, 271, 294, 3, 10, 5, 0, 272, 294, 3, 12, 6, 0, 273, 294, 3, 14, 7, 0, 274, 294, 3, 22, 11, 0, 275, 294, 3, 28, 14, 0, 276, 294, 3, 44, 22, 0, 277, 294, 3, 46, 23, 0, 278, 294, 3, 48, 24, 0, 279, 294, 3, 60, 30, 0, 280, 294, 3, 62, 31, 0, 281, 294, 3, 64, 32, 0, 282, 294, 3, 66, 33, 0, 283, 294, 3, 74, 37, 0, 284, 294, 3, 78, 39, 0, 285, 294, 3, 82, 41, 0, 286, 294, 3, 20, 10, 0, 287, 294, 3, 16, 8, 0, 288, 294, 3, 18, 9, 0, 289, 294, 3, 84, 42, 0, 290, 294, 3, 106, 53, 0, 291, 294, 3, 110, 55, 0, 292, 294, 3, 114, 57, 0, 293, 269, 1, 0, 0, 0, 293, 270, 1, 0, 0, 0, 293, 271, 1, 0, 0, 0, 293, 272, 1, 0, 0, 0, 293, 273, 1, 0, 0, 0, 293, 274, 1, 0, 0, 0, 293, 275, 1, 0, 0, 0, 293, 276, 1, 0, 0, 0, 293, 277, 1, 0, 0, 0, 293, 278, 1, 0, 0, 0, 293, 279, 1, 0, 0, 0, 293, 280, 1, 0, 0, 0, 293, 281, 1, 0, 0, 0, 293, 282, 1, 0, 0, 0, 293, 283, 1, 0, 0, 0, 293, 284, 1, 0, 0, 0, 293, 285, 1, 0, 0, 0, 293, 286, 1, 0, 0, 0, 293, 287, 1, 0, 0, 0, 293, 288, 1, 0, 0, 0, 293, 289, 1, 0, 0, 0, 293, 290, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 292, 1, 0, 0, 0, 294, 5, 1, 0, 0, 0, 295, 296, 5, 30, 0, 0, 296, 300, 5, 133, 0, 0, 297, 298, 3, 182, 91, 0, 298, 299, 5, 2, 0, 0, 299, 301, 1, 0, 0, 0, 300, 297, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 325, 3, 184, 92, 0, 303, 313, 5, 121, 0, 0, 304, 305, 5, 137, 0, 0, 305, 314, 3, 188, 94, 0, 306, 308, 5, 46, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 310, 3, 190, 95, 0, 310, 311, 5, 137, 0, 0, 311, 312, 3, 190, 95, 0, 312, 314, 1, 0, 0, 0, 313, 304, 1, 0, 0, 0, 313, 307, 1, 0, 0, 0, 314, 326, 1, 0, 0, 0, 315, 317, 5, 27, 0, 0, 316, 318, 5, 46, 0, 0, 317, 316, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 326, 3, 30, 15, 0, 320, 322, 5, 63, 0, 0, 321, 323, 5, 46, 0, 0, 322, 321, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 324, 326, 3, 190, 95, 0, 325, 303, 1, 0, 0, 0, 325, 315, 1, 0, 0, 0, 325, 320, 1, 0, 0, 0, 326, 7, 1, 0, 0, 0, 327, 335, 5, 31, 0, 0, 328, 336, 3, 182, 91, 0, 329, 330, 3, 182, 91, 0, 330, 331, 5, 2, 0, 0, 331, 333, 1, 0, 0, 0, 332, 329, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 334, 1, 0, 0, 0, 334, 336, 3, 186, 93, 0, 335, 328, 1, 0, 0, 0, 335, 332, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 9, 1, 0, 0, 0, 337, 339, 5, 35, 0, 0, 338, 340, 5, 55, 0, 0, 339, 338, 1, 0, 0, 0, 339, 340, 1, 0, 0, 0, 340, 341, 1, 0, 0, 0, 341, 342, 3, 68, 34, 0, 342, 343, 5, 33, 0, 0, 343, 344, 3, 182, 91, 0, 344, 11, 1, 0, 0, 0, 345, 347, 5, 38, 0, 0, 346, 348, 7, 0, 0, 0, 347, 346, 1, 0, 0, 0, 347, 348, 1, 0, 0, 0, 348, 353, 1, 0, 0, 0, 349, 351, 5, 138, 0, 0, 350, 352, 3, 212, 106, 0, 351, 350, 1, 0, 0, 0, 351, 352, 1, 0, 0, 0, 352, 354, 1, 0, 0, 0, 353, 349, 1, 0, 0, 0, 353, 354, 1, 0, 0, 0, 354, 13, 1, 0, 0, 0, 355, 357, 7, 1, 0, 0, 356, 358, 5, 138, 0, 0, 357, 356, 1, 0, 0, 0, 357, 358, 1, 0, 0, 0, 358, 15, 1, 0, 0, 0, 359, 361, 5, 126, 0, 0, 360, 362, 5, 138, 0, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 368, 1, 0, 0, 0, 363, 365, 5, 137, 0, 0, 364, 366, 5, 129, 0, 0, 365, 364, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 369, 3, 206, 103, 0, 368, 363, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 17, 1, 0, 0, 0, 370, 371, 5, 129, 0, 0, 371, 372, 3, 206, 103, 0, 372, 19, 1, 0, 0, 0, 373, 375, 5, 120, 0, 0, 374, 376, 5, 129, 0, 0, 375, 374, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 377, 1, 0, 0, 0, 377, 378, 3, 206, 103, 0, 378, 21, 1, 0, 0, 0, 379, 381, 5, 50, 0, 0, 380, 382, 5, 141, 0, 0, 381, 380, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 387, 5, 84, 0, 0, 384, 385, 5, 80, 0, 0, 385, 386, 5, 102, 0, 0, 386, 388, 5, 70, 0, 0, 387, 384, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 392, 1, 0, 0, 0, 389, 390, 3, 182, 91, 0, 390, 391, 5, 2, 0, 0, 391, 393, 1, 0, 0, 0, 392, 389, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, 394, 1, 0, 0, 0, 394, 395, 3, 196, 98, 0, 395, 396, 5, 107, 0, 0, 396, 397, 3, 184, 92, 0, 397, 398, 5, 3, 0, 0, 398, 403, 3, 24, 12, 0, 399, 400, 5, 5, 0, 0, 400, 402, 3, 24, 12, 0, 401, 399, 1, 0, 0, 0, 402, 405, 1, 0, 0, 0, 403, 401, 1, 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 406, 1, 0, 0, 0, 405, 403, 1, 0, 0, 0, 406, 409, 5, 4, 0, 0, 407, 408, 5, 149, 0, 0, 408, 410, 3, 68, 34, 0, 409, 407, 1, 0, 0, 0, 409, 410, 1, 0, 0, 0, 410, 23, 1, 0, 0, 0, 411, 414, 3, 190, 95, 0, 412, 414, 3, 68, 34, 0, 413, 411, 1, 0, 0, 0, 413, 412, 1, 0, 0, 0, 414, 417, 1, 0, 0, 0, 415, 416, 5, 45, 0, 0, 416, 418, 3, 192, 96, 0, 417, 415, 1, 0, 0, 0, 417, 418, 1, 0, 0, 0, 418, 420, 1, 0, 0, 0, 419, 421, 3, 140, 70, 0, 420, 419, 1, 0, 0, 0, 420, 421, 1, 0, 0, 0, 421, 25, 1, 0, 0, 0, 422, 423, 5, 151, 0, 0, 423, 426, 5, 186, 0, 0, 424, 426, 5, 132, 0, 0, 425, 422, 1, 0, 0, 0, 425, 424, 1, 0, 0, 0, 426, 27, 1, 0, 0, 0, 427, 429, 5, 50, 0, 0, 428, 430, 7, 2, 0, 0, 429, 428, 1, 0, 0, 0, 429, 430, 1, 0, 0, 0, 430, 431, 1, 0, 0, 0, 431, 435, 5, 133, 0, 0, 432, 433, 5, 80, 0, 0, 433, 434, 5, 102, 0, 0, 434, 436, 5, 70, 0, 0, 435, 432, 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, 436, 440, 1, 0, 0, 0, 437, 438, 3, 182, 91, 0, 438, 439, 5, 2, 0, 0, 439, 441, 1, 0, 0, 0, 440, 437, 1, 0, 0, 0, 440, 441, 1, 0, 0, 0, 441, 442, 1, 0, 0, 0, 442, 472, 3, 184, 92, 0, 443, 444, 5, 3, 0, 0, 444, 449, 3, 30, 15, 0, 445, 446, 5, 5, 0, 0, 446, 448, 3, 30, 15, 0, 447, 445, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 450, 456, 1, 0, 0, 0, 451, 449, 1, 0, 0, 0, 452, 453, 5, 5, 0, 0, 453, 455, 3, 38, 19, 0, 454, 452, 1, 0, 0, 0, 455, 458, 1, 0, 0, 0, 456, 454, 1, 0, 0, 0, 456, 457, 1, 0, 0, 0, 457, 459, 1, 0, 0, 0, 458, 456, 1, 0, 0, 0, 459, 468, 5, 4, 0, 0, 460, 465, 3, 26, 13, 0, 461, 462, 5, 5, 0, 0, 462, 464, 3, 26, 13, 0, 463, 461, 1, 0, 0, 0, 464, 467, 1, 0, 0, 0, 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 469, 1, 0, 0, 0, 467, 465, 1, 0, 0, 0, 468, 460, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 473, 1, 0, 0, 0, 470, 471, 5, 33, 0, 0, 471, 473, 3, 84, 42, 0, 472, 443, 1, 0, 0, 0, 472, 470, 1, 0, 0, 0, 473, 29, 1, 0, 0, 0, 474, 476, 3, 190, 95, 0, 475, 477, 3, 32, 16, 0, 476, 475, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, 477, 481, 1, 0, 0, 0, 478, 480, 3, 34, 17, 0, 479, 478, 1, 0, 0, 0, 480, 483, 1, 0, 0, 0, 481, 479, 1, 0, 0, 0, 481, 482, 1, 0, 0, 0, 482, 31, 1, 0, 0, 0, 483, 481, 1, 0, 0, 0, 484, 486, 3, 176, 88, 0, 485, 484, 1, 0, 0, 0, 486, 487, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 487, 485, 1, 0, 0, 0, 488, 499, 1, 0, 0, 0, 489, 490, 5, 3, 0, 0, 490, 491, 3, 36, 18, 0, 491, 492, 5, 4, 0, 0, 492, 500, 1, 0, 0, 0, 493, 494, 5, 3, 0, 0, 494, 495, 3, 36, 18, 0, 495, 496, 5, 5, 0, 0, 496, 497, 3, 36, 18, 0, 497, 498, 5, 4, 0, 0, 498, 500, 1, 0, 0, 0, 499, 489, 1, 0, 0, 0, 499, 493, 1, 0, 0, 0, 499, 500, 1, 0, 0, 0, 500, 33, 1, 0, 0, 0, 501, 502, 5, 49, 0, 0, 502, 504, 3, 176, 88, 0, 503, 501, 1, 0, 0, 0, 503, 504, 1, 0, 0, 0, 504, 552, 1, 0, 0, 0, 505, 506, 5, 113, 0, 0, 506, 508, 5, 95, 0, 0, 507, 509, 3, 140, 70, 0, 508, 507, 1, 0, 0, 0, 508, 509, 1, 0, 0, 0, 509, 511, 1, 0, 0, 0, 510, 512, 3, 42, 21, 0, 511, 510, 1, 0, 0, 0, 511, 512, 1, 0, 0, 0, 512, 514, 1, 0, 0, 0, 513, 515, 5, 36, 0, 0, 514, 513, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 553, 1, 0, 0, 0, 516, 517, 5, 102, 0, 0, 517, 520, 5, 104, 0, 0, 518, 520, 5, 141, 0, 0, 519, 516, 1, 0, 0, 0, 519, 518, 1, 0, 0, 0, 520, 522, 1, 0, 0, 0, 521, 523, 3, 42, 21, 0, 522, 521, 1, 0, 0, 0, 522, 523, 1, 0, 0, 0, 523, 553, 1, 0, 0, 0, 524, 525, 5, 44, 0, 0, 525, 526, 5, 3, 0, 0, 526, 527, 3, 68, 34, 0, 527, 528, 5, 4, 0, 0, 528, 553, 1, 0, 0, 0, 529, 536, 5, 56, 0, 0, 530, 537, 3, 36, 18, 0, 531, 537, 3, 72, 36, 0, 532, 533, 5, 3, 0, 0, 533, 534, 3, 68, 34, 0, 534, 535, 5, 4, 0, 0, 535, 537, 1, 0, 0, 0, 536, 530, 1, 0, 0, 0, 536, 531, 1, 0, 0, 0, 536, 532, 1, 0, 0, 0, 537, 553, 1, 0, 0, 0, 538, 539, 5, 45, 0, 0, 539, 553, 3, 192, 96, 0, 540, 553, 3, 40, 20, 0, 541, 542, 5, 170, 0, 0, 542, 544, 5, 171, 0, 0, 543, 541, 1, 0, 0, 0, 543, 544, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 5, 33, 0, 0, 546, 547, 5, 3, 0, 0, 547, 548, 3, 68, 34, 0, 548, 550, 5, 4, 0, 0, 549, 551, 7, 3, 0, 0, 550, 549, 1, 0, 0, 0, 550, 551, 1, 0, 0, 0, 551, 553, 1, 0, 0, 0, 552, 505, 1, 0, 0, 0, 552, 519, 1, 0, 0, 0, 552, 524, 1, 0, 0, 0, 552, 529, 1, 0, 0, 0, 552, 538, 1, 0, 0, 0, 552, 540, 1, 0, 0, 0, 552, 543, 1, 0, 0, 0, 553, 35, 1, 0, 0, 0, 554, 556, 7, 4, 0, 0, 555, 554, 1, 0, 0, 0, 555, 556, 1, 0, 0, 0, 556, 557, 1, 0, 0, 0, 557, 558, 5, 187, 0, 0, 558, 37, 1, 0, 0, 0, 559, 560, 5, 49, 0, 0, 560, 562, 3, 176, 88, 0, 561, 559, 1, 0, 0, 0, 561, 562, 1, 0, 0, 0, 562, 600, 1, 0, 0, 0, 563, 564, 5, 113, 0, 0, 564, 567, 5, 95, 0, 0, 565, 567, 5, 141, 0, 0, 566, 563, 1, 0, 0, 0, 566, 565, 1, 0, 0, 0, 567, 568, 1, 0, 0, 0, 568, 569, 5, 3, 0, 0, 569, 574, 3, 24, 12, 0, 570, 571, 5, 5, 0, 0, 571, 573, 3, 24, 12, 0, 572, 570, 1, 0, 0, 0, 573, 576, 1, 0, 0, 0, 574, 572, 1, 0, 0, 0, 574, 575, 1, 0, 0, 0, 575, 577, 1, 0, 0, 0, 576, 574, 1, 0, 0, 0, 577, 579, 5, 4, 0, 0, 578, 580, 3, 42, 21, 0, 579, 578, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 601, 1, 0, 0, 0, 581, 582, 5, 44, 0, 0, 582, 583, 5, 3, 0, 0, 583, 584, 3, 68, 34, 0, 584, 585, 5, 4, 0, 0, 585, 601, 1, 0, 0, 0, 586, 587, 5, 74, 0, 0, 587, 588, 5, 95, 0, 0, 588, 589, 5, 3, 0, 0, 589, 594, 3, 190, 95, 0, 590, 591, 5, 5, 0, 0, 591, 593, 3, 190, 95, 0, 592, 590, 1, 0, 0, 0, 593, 596, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, 594, 595, 1, 0, 0, 0, 595, 597, 1, 0, 0, 0, 596, 594, 1, 0, 0, 0, 597, 598, 5, 4, 0, 0, 598, 599, 3, 40, 20, 0, 599, 601, 1, 0, 0, 0, 600, 566, 1, 0, 0, 0, 600, 581, 1, 0, 0, 0, 600, 586, 1, 0, 0, 0, 601, 39, 1, 0, 0, 0, 602, 603, 5, 117, 0, 0, 603, 615, 3, 194, 97, 0, 604, 605, 5, 3, 0, 0, 605, 610, 3, 190, 95, 0, 606, 607, 5, 5, 0, 0, 607, 609, 3, 190, 95, 0, 608, 606, 1, 0, 0, 0, 609, 612, 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, 610, 611, 1, 0, 0, 0, 611, 613, 1, 0, 0, 0, 612, 610, 1, 0, 0, 0, 613, 614, 5, 4, 0, 0, 614, 616, 1, 0, 0, 0, 615, 604, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 631, 1, 0, 0, 0, 617, 618, 5, 107, 0, 0, 618, 625, 7, 5, 0, 0, 619, 620, 5, 131, 0, 0, 620, 626, 7, 6, 0, 0, 621, 626, 5, 41, 0, 0, 622, 626, 5, 123, 0, 0, 623, 624, 5, 101, 0, 0, 624, 626, 5, 26, 0, 0, 625, 619, 1, 0, 0, 0, 625, 621, 1, 0, 0, 0, 625, 622, 1, 0, 0, 0, 625, 623, 1, 0, 0, 0, 626, 630, 1, 0, 0, 0, 627, 628, 5, 99, 0, 0, 628, 630, 3, 176, 88, 0, 629, 617, 1, 0, 0, 0, 629, 627, 1, 0, 0, 0, 630, 633, 1, 0, 0, 0, 631, 629, 1, 0, 0, 0, 631, 632, 1, 0, 0, 0, 632, 642, 1, 0, 0, 0, 633, 631, 1, 0, 0, 0, 634, 636, 5, 102, 0, 0, 635, 634, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, 637, 640, 5, 57, 0, 0, 638, 639, 5, 86, 0, 0, 639, 641, 7, 7, 0, 0, 640, 638, 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 643, 1, 0, 0, 0, 642, 635, 1, 0, 0, 0, 642, 643, 1, 0, 0, 0, 643, 41, 1, 0, 0, 0, 644, 645, 5, 107, 0, 0, 645, 646, 5, 48, 0, 0, 646, 647, 7, 8, 0, 0, 647, 43, 1, 0, 0, 0, 648, 650, 5, 50, 0, 0, 649, 651, 7, 2, 0, 0, 650, 649, 1, 0, 0, 0, 650, 651, 1, 0, 0, 0, 651, 652, 1, 0, 0, 0, 652, 656, 5, 139, 0, 0, 653, 654, 5, 80, 0, 0, 654, 655, 5, 102, 0, 0, 655, 657, 5, 70, 0, 0, 656, 653, 1, 0, 0, 0, 656, 657, 1, 0, 0, 0, 657, 661, 1, 0, 0, 0, 658, 659, 3, 182, 91, 0, 659, 660, 5, 2, 0, 0, 660, 662, 1, 0, 0, 0, 661, 658, 1, 0, 0, 0, 661, 662, 1, 0, 0, 0, 662, 663, 1, 0, 0, 0, 663, 668, 3, 198, 99, 0, 664, 669, 5, 37, 0, 0, 665, 669, 5, 28, 0, 0, 666, 667, 5, 89, 0, 0, 667, 669, 5, 105, 0, 0, 668, 664, 1, 0, 0, 0, 668, 665, 1, 0, 0, 0, 668, 666, 1, 0, 0, 0, 668, 669, 1, 0, 0, 0, 669, 684, 1, 0, 0, 0, 670, 685, 5, 59, 0, 0, 671, 685, 5, 88, 0, 0, 672, 682, 5, 142, 0, 0, 673, 674, 5, 105, 0, 0, 674, 679, 3, 190, 95, 0, 675, 676, 5, 5, 0, 0, 676, 678, 3, 190, 95, 0, 677, 675, 1, 0, 0, 0, 678, 681, 1, 0, 0, 0, 679, 677, 1, 0, 0, 0, 679, 680, 1, 0, 0, 0, 680, 683, 1, 0, 0, 0, 681, 679, 1, 0, 0, 0, 682, 673, 1, 0, 0, 0, 682, 683, 1, 0, 0, 0, 683, 685, 1, 0, 0, 0, 684, 670, 1, 0, 0, 0, 684, 671, 1, 0, 0, 0, 684, 672, 1, 0, 0, 0, 685, 686, 1, 0, 0, 0, 686, 687, 5, 107, 0, 0, 687, 691, 3, 184, 92, 0, 688, 689, 5, 73, 0, 0, 689, 690, 5, 64, 0, 0, 690, 692, 5, 127, 0, 0, 691, 688, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 695, 1, 0, 0, 0, 693, 694, 5, 148, 0, 0, 694, 696, 3, 68, 34, 0, 695, 693, 1, 0, 0, 0, 695, 696, 1, 0, 0, 0, 696, 697, 1, 0, 0, 0, 697, 706, 5, 38, 0, 0, 698, 703, 3, 106, 53, 0, 699, 703, 3, 74, 37, 0, 700, 703, 3, 60, 30, 0, 701, 703, 3, 84, 42, 0, 702, 698, 1, 0, 0, 0, 702, 699, 1, 0, 0, 0, 702, 700, 1, 0, 0, 0, 702, 701, 1, 0, 0, 0, 703, 704, 1, 0, 0, 0, 704, 705, 5, 1, 0, 0, 705, 707, 1, 0, 0, 0, 706, 702, 1, 0, 0, 0, 707, 708, 1, 0, 0, 0, 708, 706, 1, 0, 0, 0, 708, 709, 1, 0, 0, 0, 709, 710, 1, 0, 0, 0, 710, 711, 5, 66, 0, 0, 711, 45, 1, 0, 0, 0, 712, 714, 5, 50, 0, 0, 713, 715, 7, 2, 0, 0, 714, 713, 1, 0, 0, 0, 714, 715, 1, 0, 0, 0, 715, 716, 1, 0, 0, 0, 716, 720, 5, 146, 0, 0, 717, 718, 5, 80, 0, 0, 718, 719, 5, 102, 0, 0, 719, 721, 5, 70, 0, 0, 720, 717, 1, 0, 0, 0, 720, 721, 1, 0, 0, 0, 721, 725, 1, 0, 0, 0, 722, 723, 3, 182, 91, 0, 723, 724, 5, 2, 0, 0, 724, 726, 1, 0, 0, 0, 725, 722, 1, 0, 0, 0, 725, 726, 1, 0, 0, 0, 726, 727, 1, 0, 0, 0, 727, 739, 3, 200, 100, 0, 728, 729, 5, 3, 0, 0, 729, 734, 3, 190, 95, 0, 730, 731, 5, 5, 0, 0, 731, 733, 3, 190, 95, 0, 732, 730, 1, 0, 0, 0, 733, 736, 1, 0, 0, 0, 734, 732, 1, 0, 0, 0, 734, 735, 1, 0, 0, 0, 735, 737, 1, 0, 0, 0, 736, 734, 1, 0, 0, 0, 737, 738, 5, 4, 0, 0, 738, 740, 1, 0, 0, 0, 739, 728, 1, 0, 0, 0, 739, 740, 1, 0, 0, 0, 740, 741, 1, 0, 0, 0, 741, 742, 5, 33, 0, 0, 742, 743, 3, 84, 42, 0, 743, 47, 1, 0, 0, 0, 744, 745, 5, 50, 0, 0, 745, 746, 5, 147, 0, 0, 746, 750, 5, 133, 0, 0, 747, 748, 5, 80, 0, 0, 748, 749, 5, 102, 0, 0, 749, 751, 5, 70, 0, 0, 750, 747, 1, 0, 0, 0, 750, 751, 1, 0, 0, 0, 751, 755, 1, 0, 0, 0, 752, 753, 3, 182, 91, 0, 753, 754, 5, 2, 0, 0, 754, 756, 1, 0, 0, 0, 755, 752, 1, 0, 0, 0, 755, 756, 1, 0, 0, 0, 756, 757, 1, 0, 0, 0, 757, 758, 3, 184, 92, 0, 758, 759, 5, 143, 0, 0, 759, 771, 3, 202, 101, 0, 760, 761, 5, 3, 0, 0, 761, 766, 3, 170, 85, 0, 762, 763, 5, 5, 0, 0, 763, 765, 3, 170, 85, 0, 764, 762, 1, 0, 0, 0, 765, 768, 1, 0, 0, 0, 766, 764, 1, 0, 0, 0, 766, 767, 1, 0, 0, 0, 767, 769, 1, 0, 0, 0, 768, 766, 1, 0, 0, 0, 769, 770, 5, 4, 0, 0, 770, 772, 1, 0, 0, 0, 771, 760, 1, 0, 0, 0, 771, 772, 1, 0, 0, 0, 772, 49, 1, 0, 0, 0, 773, 775, 5, 150, 0, 0, 774, 776, 5, 116, 0, 0, 775, 774, 1, 0, 0, 0, 775, 776, 1, 0, 0, 0, 776, 777, 1, 0, 0, 0, 777, 778, 3, 52, 26, 0, 778, 779, 5, 33, 0, 0, 779, 780, 5, 3, 0, 0, 780, 781, 3, 84, 42, 0, 781, 791, 5, 4, 0, 0, 782, 783, 5, 5, 0, 0, 783, 784, 3, 52, 26, 0, 784, 785, 5, 33, 0, 0, 785, 786, 5, 3, 0, 0, 786, 787, 3, 84, 42, 0, 787, 788, 5, 4, 0, 0, 788, 790, 1, 0, 0, 0, 789, 782, 1, 0, 0, 0, 790, 793, 1, 0, 0, 0, 791, 789, 1, 0, 0, 0, 791, 792, 1, 0, 0, 0, 792, 51, 1, 0, 0, 0, 793, 791, 1, 0, 0, 0, 794, 806, 3, 184, 92, 0, 795, 796, 5, 3, 0, 0, 796, 801, 3, 190, 95, 0, 797, 798, 5, 5, 0, 0, 798, 800, 3, 190, 95, 0, 799, 797, 1, 0, 0, 0, 800, 803, 1, 0, 0, 0, 801, 799, 1, 0, 0, 0, 801, 802, 1, 0, 0, 0, 802, 804, 1, 0, 0, 0, 803, 801, 1, 0, 0, 0, 804, 805, 5, 4, 0, 0, 805, 807, 1, 0, 0, 0, 806, 795, 1, 0, 0, 0, 806, 807, 1, 0, 0, 0, 807, 53, 1, 0, 0, 0, 808, 809, 3, 52, 26, 0, 809, 810, 5, 33, 0, 0, 810, 811, 5, 3, 0, 0, 811, 812, 3, 162, 81, 0, 812, 814, 5, 140, 0, 0, 813, 815, 5, 29, 0, 0, 814, 813, 1, 0, 0, 0, 814, 815, 1, 0, 0, 0, 815, 816, 1, 0, 0, 0, 816, 817, 3, 164, 82, 0, 817, 818, 5, 4, 0, 0, 818, 55, 1, 0, 0, 0, 819, 831, 3, 184, 92, 0, 820, 821, 5, 3, 0, 0, 821, 826, 3, 190, 95, 0, 822, 823, 5, 5, 0, 0, 823, 825, 3, 190, 95, 0, 824, 822, 1, 0, 0, 0, 825, 828, 1, 0, 0, 0, 826, 824, 1, 0, 0, 0, 826, 827, 1, 0, 0, 0, 827, 829, 1, 0, 0, 0, 828, 826, 1, 0, 0, 0, 829, 830, 5, 4, 0, 0, 830, 832, 1, 0, 0, 0, 831, 820, 1, 0, 0, 0, 831, 832, 1, 0, 0, 0, 832, 833, 1, 0, 0, 0, 833, 834, 5, 33, 0, 0, 834, 835, 5, 3, 0, 0, 835, 836, 3, 84, 42, 0, 836, 837, 5, 4, 0, 0, 837, 57, 1, 0, 0, 0, 838, 847, 5, 124, 0, 0, 839, 848, 5, 7, 0, 0, 840, 845, 3, 68, 34, 0, 841, 843, 5, 33, 0, 0, 842, 841, 1, 0, 0, 0, 842, 843, 1, 0, 0, 0, 843, 844, 1, 0, 0, 0, 844, 846, 3, 172, 86, 0, 845, 842, 1, 0, 0, 0, 845, 846, 1, 0, 0, 0, 846, 848, 1, 0, 0, 0, 847, 839, 1, 0, 0, 0, 847, 840, 1, 0, 0, 0, 848, 862, 1, 0, 0, 0, 849, 858, 5, 5, 0, 0, 850, 859, 5, 7, 0, 0, 851, 856, 3, 68, 34, 0, 852, 854, 5, 33, 0, 0, 853, 852, 1, 0, 0, 0, 853, 854, 1, 0, 0, 0, 854, 855, 1, 0, 0, 0, 855, 857, 3, 172, 86, 0, 856, 853, 1, 0, 0, 0, 856, 857, 1, 0, 0, 0, 857, 859, 1, 0, 0, 0, 858, 850, 1, 0, 0, 0, 858, 851, 1, 0, 0, 0, 859, 861, 1, 0, 0, 0, 860, 849, 1, 0, 0, 0, 861, 864, 1, 0, 0, 0, 862, 860, 1, 0, 0, 0, 862, 863, 1, 0, 0, 0, 863, 59, 1, 0, 0, 0, 864, 862, 1, 0, 0, 0, 865, 867, 3, 50, 25, 0, 866, 865, 1, 0, 0, 0, 866, 867, 1, 0, 0, 0, 867, 868, 1, 0, 0, 0, 868, 869, 5, 59, 0, 0, 869, 870, 5, 75, 0, 0, 870, 873, 3, 112, 56, 0, 871, 872, 5, 149, 0, 0, 872, 874, 3, 68, 34, 0, 873, 871, 1, 0, 0, 0, 873, 874, 1, 0, 0, 0, 874, 876, 1, 0, 0, 0, 875, 877, 3, 58, 29, 0, 876, 875, 1, 0, 0, 0, 876, 877, 1, 0, 0, 0, 877, 61, 1, 0, 0, 0, 878, 880, 3, 50, 25, 0, 879, 878, 1, 0, 0, 0, 879, 880, 1, 0, 0, 0, 880, 881, 1, 0, 0, 0, 881, 882, 5, 59, 0, 0, 882, 883, 5, 75, 0, 0, 883, 886, 3, 112, 56, 0, 884, 885, 5, 149, 0, 0, 885, 887, 3, 68, 34, 0, 886, 884, 1, 0, 0, 0, 886, 887, 1, 0, 0, 0, 887, 892, 1, 0, 0, 0, 888, 890, 3, 134, 67, 0, 889, 888, 1, 0, 0, 0, 889, 890, 1, 0, 0, 0, 890, 891, 1, 0, 0, 0, 891, 893, 3, 136, 68, 0, 892, 889, 1, 0, 0, 0, 892, 893, 1, 0, 0, 0, 893, 895, 1, 0, 0, 0, 894, 896, 3, 58, 29, 0, 895, 894, 1, 0, 0, 0, 895, 896, 1, 0, 0, 0, 896, 63, 1, 0, 0, 0, 897, 899, 5, 61, 0, 0, 898, 900, 5, 55, 0, 0, 899, 898, 1, 0, 0, 0, 899, 900, 1, 0, 0, 0, 900, 901, 1, 0, 0, 0, 901, 902, 3, 182, 91, 0, 902, 65, 1, 0, 0, 0, 903, 904, 5, 63, 0, 0, 904, 907, 7, 9, 0, 0, 905, 906, 5, 80, 0, 0, 906, 908, 5, 70, 0, 0, 907, 905, 1, 0, 0, 0, 907, 908, 1, 0, 0, 0, 908, 912, 1, 0, 0, 0, 909, 910, 3, 182, 91, 0, 910, 911, 5, 2, 0, 0, 911, 913, 1, 0, 0, 0, 912, 909, 1, 0, 0, 0, 912, 913, 1, 0, 0, 0, 913, 914, 1, 0, 0, 0, 914, 915, 3, 228, 114, 0, 915, 67, 1, 0, 0, 0, 916, 917, 6, 34, -1, 0, 917, 1006, 3, 72, 36, 0, 918, 1006, 5, 188, 0, 0, 919, 1006, 5, 189, 0, 0, 920, 921, 3, 182, 91, 0, 921, 922, 5, 2, 0, 0, 922, 924, 1, 0, 0, 0, 923, 920, 1, 0, 0, 0, 923, 924, 1, 0, 0, 0, 924, 925, 1, 0, 0, 0, 925, 926, 3, 184, 92, 0, 926, 927, 5, 2, 0, 0, 927, 929, 1, 0, 0, 0, 928, 923, 1, 0, 0, 0, 928, 929, 1, 0, 0, 0, 929, 930, 1, 0, 0, 0, 930, 1006, 3, 190, 95, 0, 931, 932, 3, 166, 83, 0, 932, 933, 3, 68, 34, 20, 933, 1006, 1, 0, 0, 0, 934, 935, 3, 180, 90, 0, 935, 948, 5, 3, 0, 0, 936, 938, 5, 62, 0, 0, 937, 936, 1, 0, 0, 0, 937, 938, 1, 0, 0, 0, 938, 939, 1, 0, 0, 0, 939, 944, 3, 68, 34, 0, 940, 941, 5, 5, 0, 0, 941, 943, 3, 68, 34, 0, 942, 940, 1, 0, 0, 0, 943, 946, 1, 0, 0, 0, 944, 942, 1, 0, 0, 0, 944, 945, 1, 0, 0, 0, 945, 949, 1, 0, 0, 0, 946, 944, 1, 0, 0, 0, 947, 949, 5, 7, 0, 0, 948, 937, 1, 0, 0, 0, 948, 947, 1, 0, 0, 0, 948, 949, 1, 0, 0, 0, 949, 950, 1, 0, 0, 0, 950, 952, 5, 4, 0, 0, 951, 953, 3, 116, 58, 0, 952, 951, 1, 0, 0, 0, 952, 953, 1, 0, 0, 0, 953, 955, 1, 0, 0, 0, 954, 956, 3, 120, 60, 0, 955, 954, 1, 0, 0, 0, 955, 956, 1, 0, 0, 0, 956, 1006, 1, 0, 0, 0, 957, 958, 5, 3, 0, 0, 958, 963, 3, 68, 34, 0, 959, 960, 5, 5, 0, 0, 960, 962, 3, 68, 34, 0, 961, 959, 1, 0, 0, 0, 962, 965, 1, 0, 0, 0, 963, 961, 1, 0, 0, 0, 963, 964, 1, 0, 0, 0, 964, 966, 1, 0, 0, 0, 965, 963, 1, 0, 0, 0, 966, 967, 5, 4, 0, 0, 967, 1006, 1, 0, 0, 0, 968, 969, 5, 43, 0, 0, 969, 970, 5, 3, 0, 0, 970, 971, 3, 68, 34, 0, 971, 972, 5, 33, 0, 0, 972, 973, 3, 32, 16, 0, 973, 974, 5, 4, 0, 0, 974, 1006, 1, 0, 0, 0, 975, 977, 5, 102, 0, 0, 976, 975, 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, 980, 5, 70, 0, 0, 979, 976, 1, 0, 0, 0, 979, 980, 1, 0, 0, 0, 980, 981, 1, 0, 0, 0, 981, 982, 5, 3, 0, 0, 982, 983, 3, 84, 42, 0, 983, 984, 5, 4, 0, 0, 984, 1006, 1, 0, 0, 0, 985, 987, 5, 42, 0, 0, 986, 988, 3, 68, 34, 0, 987, 986, 1, 0, 0, 0, 987, 988, 1, 0, 0, 0, 988, 994, 1, 0, 0, 0, 989, 990, 5, 148, 0, 0, 990, 991, 3, 68, 34, 0, 991, 992, 5, 136, 0, 0, 992, 993, 3, 68, 34, 0, 993, 995, 1, 0, 0, 0, 994, 989, 1, 0, 0, 0, 995, 996, 1, 0, 0, 0, 996, 994, 1, 0, 0, 0, 996, 997, 1, 0, 0, 0, 997, 1000, 1, 0, 0, 0, 998, 999, 5, 65, 0, 0, 999, 1001, 3, 68, 34, 0, 1000, 998, 1, 0, 0, 0, 1000, 1001, 1, 0, 0, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1003, 5, 66, 0, 0, 1003, 1006, 1, 0, 0, 0, 1004, 1006, 3, 70, 35, 0, 1005, 916, 1, 0, 0, 0, 1005, 918, 1, 0, 0, 0, 1005, 919, 1, 0, 0, 0, 1005, 928, 1, 0, 0, 0, 1005, 931, 1, 0, 0, 0, 1005, 934, 1, 0, 0, 0, 1005, 957, 1, 0, 0, 0, 1005, 968, 1, 0, 0, 0, 1005, 979, 1, 0, 0, 0, 1005, 985, 1, 0, 0, 0, 1005, 1004, 1, 0, 0, 0, 1006, 1123, 1, 0, 0, 0, 1007, 1008, 10, 19, 0, 0, 1008, 1009, 5, 11, 0, 0, 1009, 1122, 3, 68, 34, 20, 1010, 1011, 10, 18, 0, 0, 1011, 1012, 7, 10, 0, 0, 1012, 1122, 3, 68, 34, 19, 1013, 1014, 10, 17, 0, 0, 1014, 1015, 7, 4, 0, 0, 1015, 1122, 3, 68, 34, 18, 1016, 1017, 10, 16, 0, 0, 1017, 1018, 7, 11, 0, 0, 1018, 1122, 3, 68, 34, 17, 1019, 1020, 10, 15, 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1122, 3, 68, 34, 16, 1022, 1038, 10, 14, 0, 0, 1023, 1039, 5, 6, 0, 0, 1024, 1039, 5, 22, 0, 0, 1025, 1039, 5, 23, 0, 0, 1026, 1039, 5, 24, 0, 0, 1027, 1039, 5, 92, 0, 0, 1028, 1029, 5, 92, 0, 0, 1029, 1039, 5, 102, 0, 0, 1030, 1032, 5, 102, 0, 0, 1031, 1030, 1, 0, 0, 0, 1031, 1032, 1, 0, 0, 0, 1032, 1033, 1, 0, 0, 0, 1033, 1039, 5, 83, 0, 0, 1034, 1039, 5, 97, 0, 0, 1035, 1039, 5, 77, 0, 0, 1036, 1039, 5, 99, 0, 0, 1037, 1039, 5, 118, 0, 0, 1038, 1023, 1, 0, 0, 0, 1038, 1024, 1, 0, 0, 0, 1038, 1025, 1, 0, 0, 0, 1038, 1026, 1, 0, 0, 0, 1038, 1027, 1, 0, 0, 0, 1038, 1028, 1, 0, 0, 0, 1038, 1031, 1, 0, 0, 0, 1038, 1034, 1, 0, 0, 0, 1038, 1035, 1, 0, 0, 0, 1038, 1036, 1, 0, 0, 0, 1038, 1037, 1, 0, 0, 0, 1039, 1040, 1, 0, 0, 0, 1040, 1122, 3, 68, 34, 15, 1041, 1042, 10, 12, 0, 0, 1042, 1043, 5, 32, 0, 0, 1043, 1122, 3, 68, 34, 13, 1044, 1045, 10, 11, 0, 0, 1045, 1046, 5, 108, 0, 0, 1046, 1122, 3, 68, 34, 12, 1047, 1049, 10, 4, 0, 0, 1048, 1050, 5, 102, 0, 0, 1049, 1048, 1, 0, 0, 0, 1049, 1050, 1, 0, 0, 0, 1050, 1051, 1, 0, 0, 0, 1051, 1052, 5, 39, 0, 0, 1052, 1053, 3, 68, 34, 0, 1053, 1054, 5, 32, 0, 0, 1054, 1055, 3, 68, 34, 5, 1055, 1122, 1, 0, 0, 0, 1056, 1058, 10, 13, 0, 0, 1057, 1059, 5, 102, 0, 0, 1058, 1057, 1, 0, 0, 0, 1058, 1059, 1, 0, 0, 0, 1059, 1060, 1, 0, 0, 0, 1060, 1099, 5, 83, 0, 0, 1061, 1071, 5, 3, 0, 0, 1062, 1072, 3, 84, 42, 0, 1063, 1068, 3, 68, 34, 0, 1064, 1065, 5, 5, 0, 0, 1065, 1067, 3, 68, 34, 0, 1066, 1064, 1, 0, 0, 0, 1067, 1070, 1, 0, 0, 0, 1068, 1066, 1, 0, 0, 0, 1068, 1069, 1, 0, 0, 0, 1069, 1072, 1, 0, 0, 0, 1070, 1068, 1, 0, 0, 0, 1071, 1062, 1, 0, 0, 0, 1071, 1063, 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1073, 1, 0, 0, 0, 1073, 1100, 5, 4, 0, 0, 1074, 1075, 3, 182, 91, 0, 1075, 1076, 5, 2, 0, 0, 1076, 1078, 1, 0, 0, 0, 1077, 1074, 1, 0, 0, 0, 1077, 1078, 1, 0, 0, 0, 1078, 1079, 1, 0, 0, 0, 1079, 1100, 3, 184, 92, 0, 1080, 1081, 3, 182, 91, 0, 1081, 1082, 5, 2, 0, 0, 1082, 1084, 1, 0, 0, 0, 1083, 1080, 1, 0, 0, 0, 1083, 1084, 1, 0, 0, 0, 1084, 1085, 1, 0, 0, 0, 1085, 1086, 3, 226, 113, 0, 1086, 1095, 5, 3, 0, 0, 1087, 1092, 3, 68, 34, 0, 1088, 1089, 5, 5, 0, 0, 1089, 1091, 3, 68, 34, 0, 1090, 1088, 1, 0, 0, 0, 1091, 1094, 1, 0, 0, 0, 1092, 1090, 1, 0, 0, 0, 1092, 1093, 1, 0, 0, 0, 1093, 1096, 1, 0, 0, 0, 1094, 1092, 1, 0, 0, 0, 1095, 1087, 1, 0, 0, 0, 1095, 1096, 1, 0, 0, 0, 1096, 1097, 1, 0, 0, 0, 1097, 1098, 5, 4, 0, 0, 1098, 1100, 1, 0, 0, 0, 1099, 1061, 1, 0, 0, 0, 1099, 1077, 1, 0, 0, 0, 1099, 1083, 1, 0, 0, 0, 1100, 1122, 1, 0, 0, 0, 1101, 1102, 10, 7, 0, 0, 1102, 1103, 5, 45, 0, 0, 1103, 1122, 3, 192, 96, 0, 1104, 1106, 10, 6, 0, 0, 1105, 1107, 5, 102, 0, 0, 1106, 1105, 1, 0, 0, 0, 1106, 1107, 1, 0, 0, 0, 1107, 1108, 1, 0, 0, 0, 1108, 1109, 7, 13, 0, 0, 1109, 1112, 3, 68, 34, 0, 1110, 1111, 5, 67, 0, 0, 1111, 1113, 3, 68, 34, 0, 1112, 1110, 1, 0, 0, 0, 1112, 1113, 1, 0, 0, 0, 1113, 1122, 1, 0, 0, 0, 1114, 1119, 10, 5, 0, 0, 1115, 1120, 5, 93, 0, 0, 1116, 1120, 5, 103, 0, 0, 1117, 1118, 5, 102, 0, 0, 1118, 1120, 5, 104, 0, 0, 1119, 1115, 1, 0, 0, 0, 1119, 1116, 1, 0, 0, 0, 1119, 1117, 1, 0, 0, 0, 1120, 1122, 1, 0, 0, 0, 1121, 1007, 1, 0, 0, 0, 1121, 1010, 1, 0, 0, 0, 1121, 1013, 1, 0, 0, 0, 1121, 1016, 1, 0, 0, 0, 1121, 1019, 1, 0, 0, 0, 1121, 1022, 1, 0, 0, 0, 1121, 1041, 1, 0, 0, 0, 1121, 1044, 1, 0, 0, 0, 1121, 1047, 1, 0, 0, 0, 1121, 1056, 1, 0, 0, 0, 1121, 1101, 1, 0, 0, 0, 1121, 1104, 1, 0, 0, 0, 1121, 1114, 1, 0, 0, 0, 1122, 1125, 1, 0, 0, 0, 1123, 1121, 1, 0, 0, 0, 1123, 1124, 1, 0, 0, 0, 1124, 69, 1, 0, 0, 0, 1125, 1123, 1, 0, 0, 0, 1126, 1127, 5, 115, 0, 0, 1127, 1132, 5, 3, 0, 0, 1128, 1133, 5, 81, 0, 0, 1129, 1130, 7, 14, 0, 0, 1130, 1131, 5, 5, 0, 0, 1131, 1133, 3, 168, 84, 0, 1132, 1128, 1, 0, 0, 0, 1132, 1129, 1, 0, 0, 0, 1133, 1134, 1, 0, 0, 0, 1134, 1135, 5, 4, 0, 0, 1135, 71, 1, 0, 0, 0, 1136, 1137, 7, 15, 0, 0, 1137, 73, 1, 0, 0, 0, 1138, 1140, 3, 50, 25, 0, 1139, 1138, 1, 0, 0, 0, 1139, 1140, 1, 0, 0, 0, 1140, 1146, 1, 0, 0, 0, 1141, 1147, 5, 88, 0, 0, 1142, 1147, 5, 122, 0, 0, 1143, 1144, 5, 88, 0, 0, 1144, 1145, 5, 108, 0, 0, 1145, 1147, 7, 8, 0, 0, 1146, 1141, 1, 0, 0, 0, 1146, 1142, 1, 0, 0, 0, 1146, 1143, 1, 0, 0, 0, 1147, 1148, 1, 0, 0, 0, 1148, 1152, 5, 91, 0, 0, 1149, 1150, 3, 182, 91, 0, 1150, 1151, 5, 2, 0, 0, 1151, 1153, 1, 0, 0, 0, 1152, 1149, 1, 0, 0, 0, 1152, 1153, 1, 0, 0, 0, 1153, 1154, 1, 0, 0, 0, 1154, 1157, 3, 184, 92, 0, 1155, 1156, 5, 33, 0, 0, 1156, 1158, 3, 208, 104, 0, 1157, 1155, 1, 0, 0, 0, 1157, 1158, 1, 0, 0, 0, 1158, 1170, 1, 0, 0, 0, 1159, 1160, 5, 3, 0, 0, 1160, 1165, 3, 190, 95, 0, 1161, 1162, 5, 5, 0, 0, 1162, 1164, 3, 190, 95, 0, 1163, 1161, 1, 0, 0, 0, 1164, 1167, 1, 0, 0, 0, 1165, 1163, 1, 0, 0, 0, 1165, 1166, 1, 0, 0, 0, 1166, 1168, 1, 0, 0, 0, 1167, 1165, 1, 0, 0, 0, 1168, 1169, 5, 4, 0, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1159, 1, 0, 0, 0, 1170, 1171, 1, 0, 0, 0, 1171, 1201, 1, 0, 0, 0, 1172, 1173, 5, 145, 0, 0, 1173, 1174, 5, 3, 0, 0, 1174, 1179, 3, 68, 34, 0, 1175, 1176, 5, 5, 0, 0, 1176, 1178, 3, 68, 34, 0, 1177, 1175, 1, 0, 0, 0, 1178, 1181, 1, 0, 0, 0, 1179, 1177, 1, 0, 0, 0, 1179, 1180, 1, 0, 0, 0, 1180, 1182, 1, 0, 0, 0, 1181, 1179, 1, 0, 0, 0, 1182, 1197, 5, 4, 0, 0, 1183, 1184, 5, 5, 0, 0, 1184, 1185, 5, 3, 0, 0, 1185, 1190, 3, 68, 34, 0, 1186, 1187, 5, 5, 0, 0, 1187, 1189, 3, 68, 34, 0, 1188, 1186, 1, 0, 0, 0, 1189, 1192, 1, 0, 0, 0, 1190, 1188, 1, 0, 0, 0, 1190, 1191, 1, 0, 0, 0, 1191, 1193, 1, 0, 0, 0, 1192, 1190, 1, 0, 0, 0, 1193, 1194, 5, 4, 0, 0, 1194, 1196, 1, 0, 0, 0, 1195, 1183, 1, 0, 0, 0, 1196, 1199, 1, 0, 0, 0, 1197, 1195, 1, 0, 0, 0, 1197, 1198, 1, 0, 0, 0, 1198, 1202, 1, 0, 0, 0, 1199, 1197, 1, 0, 0, 0, 1200, 1202, 3, 84, 42, 0, 1201, 1172, 1, 0, 0, 0, 1201, 1200, 1, 0, 0, 0, 1202, 1204, 1, 0, 0, 0, 1203, 1205, 3, 76, 38, 0, 1204, 1203, 1, 0, 0, 0, 1204, 1205, 1, 0, 0, 0, 1205, 1207, 1, 0, 0, 0, 1206, 1208, 3, 58, 29, 0, 1207, 1206, 1, 0, 0, 0, 1207, 1208, 1, 0, 0, 0, 1208, 1212, 1, 0, 0, 0, 1209, 1210, 5, 56, 0, 0, 1210, 1212, 5, 145, 0, 0, 1211, 1139, 1, 0, 0, 0, 1211, 1209, 1, 0, 0, 0, 1212, 75, 1, 0, 0, 0, 1213, 1214, 5, 107, 0, 0, 1214, 1229, 5, 48, 0, 0, 1215, 1216, 5, 3, 0, 0, 1216, 1221, 3, 24, 12, 0, 1217, 1218, 5, 5, 0, 0, 1218, 1220, 3, 24, 12, 0, 1219, 1217, 1, 0, 0, 0, 1220, 1223, 1, 0, 0, 0, 1221, 1219, 1, 0, 0, 0, 1221, 1222, 1, 0, 0, 0, 1222, 1224, 1, 0, 0, 0, 1223, 1221, 1, 0, 0, 0, 1224, 1227, 5, 4, 0, 0, 1225, 1226, 5, 149, 0, 0, 1226, 1228, 3, 68, 34, 0, 1227, 1225, 1, 0, 0, 0, 1227, 1228, 1, 0, 0, 0, 1228, 1230, 1, 0, 0, 0, 1229, 1215, 1, 0, 0, 0, 1229, 1230, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1258, 5, 184, 0, 0, 1232, 1259, 5, 185, 0, 0, 1233, 1234, 5, 142, 0, 0, 1234, 1237, 5, 131, 0, 0, 1235, 1238, 3, 190, 95, 0, 1236, 1238, 3, 108, 54, 0, 1237, 1235, 1, 0, 0, 0, 1237, 1236, 1, 0, 0, 0, 1238, 1239, 1, 0, 0, 0, 1239, 1240, 5, 6, 0, 0, 1240, 1251, 3, 68, 34, 0, 1241, 1244, 5, 5, 0, 0, 1242, 1245, 3, 190, 95, 0, 1243, 1245, 3, 108, 54, 0, 1244, 1242, 1, 0, 0, 0, 1244, 1243, 1, 0, 0, 0, 1245, 1246, 1, 0, 0, 0, 1246, 1247, 5, 6, 0, 0, 1247, 1248, 3, 68, 34, 0, 1248, 1250, 1, 0, 0, 0, 1249, 1241, 1, 0, 0, 0, 1250, 1253, 1, 0, 0, 0, 1251, 1249, 1, 0, 0, 0, 1251, 1252, 1, 0, 0, 0, 1252, 1256, 1, 0, 0, 0, 1253, 1251, 1, 0, 0, 0, 1254, 1255, 5, 149, 0, 0, 1255, 1257, 3, 68, 34, 0, 1256, 1254, 1, 0, 0, 0, 1256, 1257, 1, 0, 0, 0, 1257, 1259, 1, 0, 0, 0, 1258, 1232, 1, 0, 0, 0, 1258, 1233, 1, 0, 0, 0, 1259, 77, 1, 0, 0, 0, 1260, 1264, 5, 112, 0, 0, 1261, 1262, 3, 182, 91, 0, 1262, 1263, 5, 2, 0, 0, 1263, 1265, 1, 0, 0, 0, 1264, 1261, 1, 0, 0, 0, 1264, 1265, 1, 0, 0, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1273, 3, 204, 102, 0, 1267, 1268, 5, 6, 0, 0, 1268, 1274, 3, 80, 40, 0, 1269, 1270, 5, 3, 0, 0, 1270, 1271, 3, 80, 40, 0, 1271, 1272, 5, 4, 0, 0, 1272, 1274, 1, 0, 0, 0, 1273, 1267, 1, 0, 0, 0, 1273, 1269, 1, 0, 0, 0, 1273, 1274, 1, 0, 0, 0, 1274, 79, 1, 0, 0, 0, 1275, 1279, 3, 36, 18, 0, 1276, 1279, 3, 176, 88, 0, 1277, 1279, 5, 190, 0, 0, 1278, 1275, 1, 0, 0, 0, 1278, 1276, 1, 0, 0, 0, 1278, 1277, 1, 0, 0, 0, 1279, 81, 1, 0, 0, 0, 1280, 1291, 5, 119, 0, 0, 1281, 1292, 3, 192, 96, 0, 1282, 1283, 3, 182, 91, 0, 1283, 1284, 5, 2, 0, 0, 1284, 1286, 1, 0, 0, 0, 1285, 1282, 1, 0, 0, 0, 1285, 1286, 1, 0, 0, 0, 1286, 1289, 1, 0, 0, 0, 1287, 1290, 3, 184, 92, 0, 1288, 1290, 3, 196, 98, 0, 1289, 1287, 1, 0, 0, 0, 1289, 1288, 1, 0, 0, 0, 1290, 1292, 1, 0, 0, 0, 1291, 1281, 1, 0, 0, 0, 1291, 1285, 1, 0, 0, 0, 1291, 1292, 1, 0, 0, 0, 1292, 83, 1, 0, 0, 0, 1293, 1295, 3, 132, 66, 0, 1294, 1293, 1, 0, 0, 0, 1294, 1295, 1, 0, 0, 0, 1295, 1296, 1, 0, 0, 0, 1296, 1302, 3, 88, 44, 0, 1297, 1298, 3, 104, 52, 0, 1298, 1299, 3, 88, 44, 0, 1299, 1301, 1, 0, 0, 0, 1300, 1297, 1, 0, 0, 0, 1301, 1304, 1, 0, 0, 0, 1302, 1300, 1, 0, 0, 0, 1302, 1303, 1, 0, 0, 0, 1303, 1306, 1, 0, 0, 0, 1304, 1302, 1, 0, 0, 0, 1305, 1307, 3, 134, 67, 0, 1306, 1305, 1, 0, 0, 0, 1306, 1307, 1, 0, 0, 0, 1307, 1309, 1, 0, 0, 0, 1308, 1310, 3, 136, 68, 0, 1309, 1308, 1, 0, 0, 0, 1309, 1310, 1, 0, 0, 0, 1310, 85, 1, 0, 0, 0, 1311, 1318, 3, 96, 48, 0, 1312, 1313, 3, 100, 50, 0, 1313, 1314, 3, 96, 48, 0, 1314, 1315, 3, 102, 51, 0, 1315, 1317, 1, 0, 0, 0, 1316, 1312, 1, 0, 0, 0, 1317, 1320, 1, 0, 0, 0, 1318, 1316, 1, 0, 0, 0, 1318, 1319, 1, 0, 0, 0, 1319, 87, 1, 0, 0, 0, 1320, 1318, 1, 0, 0, 0, 1321, 1323, 5, 130, 0, 0, 1322, 1324, 7, 16, 0, 0, 1323, 1322, 1, 0, 0, 0, 1323, 1324, 1, 0, 0, 0, 1324, 1325, 1, 0, 0, 0, 1325, 1330, 3, 98, 49, 0, 1326, 1327, 5, 5, 0, 0, 1327, 1329, 3, 98, 49, 0, 1328, 1326, 1, 0, 0, 0, 1329, 1332, 1, 0, 0, 0, 1330, 1328, 1, 0, 0, 0, 1330, 1331, 1, 0, 0, 0, 1331, 1345, 1, 0, 0, 0, 1332, 1330, 1, 0, 0, 0, 1333, 1343, 5, 75, 0, 0, 1334, 1339, 3, 96, 48, 0, 1335, 1336, 5, 5, 0, 0, 1336, 1338, 3, 96, 48, 0, 1337, 1335, 1, 0, 0, 0, 1338, 1341, 1, 0, 0, 0, 1339, 1337, 1, 0, 0, 0, 1339, 1340, 1, 0, 0, 0, 1340, 1344, 1, 0, 0, 0, 1341, 1339, 1, 0, 0, 0, 1342, 1344, 3, 86, 43, 0, 1343, 1334, 1, 0, 0, 0, 1343, 1342, 1, 0, 0, 0, 1344, 1346, 1, 0, 0, 0, 1345, 1333, 1, 0, 0, 0, 1345, 1346, 1, 0, 0, 0, 1346, 1349, 1, 0, 0, 0, 1347, 1348, 5, 149, 0, 0, 1348, 1350, 3, 68, 34, 0, 1349, 1347, 1, 0, 0, 0, 1349, 1350, 1, 0, 0, 0, 1350, 1365, 1, 0, 0, 0, 1351, 1352, 5, 78, 0, 0, 1352, 1353, 5, 40, 0, 0, 1353, 1358, 3, 68, 34, 0, 1354, 1355, 5, 5, 0, 0, 1355, 1357, 3, 68, 34, 0, 1356, 1354, 1, 0, 0, 0, 1357, 1360, 1, 0, 0, 0, 1358, 1356, 1, 0, 0, 0, 1358, 1359, 1, 0, 0, 0, 1359, 1363, 1, 0, 0, 0, 1360, 1358, 1, 0, 0, 0, 1361, 1362, 5, 79, 0, 0, 1362, 1364, 3, 68, 34, 0, 1363, 1361, 1, 0, 0, 0, 1363, 1364, 1, 0, 0, 0, 1364, 1366, 1, 0, 0, 0, 1365, 1351, 1, 0, 0, 0, 1365, 1366, 1, 0, 0, 0, 1366, 1381, 1, 0, 0, 0, 1367, 1368, 5, 175, 0, 0, 1368, 1369, 3, 214, 107, 0, 1369, 1370, 5, 33, 0, 0, 1370, 1378, 3, 118, 59, 0, 1371, 1372, 5, 5, 0, 0, 1372, 1373, 3, 214, 107, 0, 1373, 1374, 5, 33, 0, 0, 1374, 1375, 3, 118, 59, 0, 1375, 1377, 1, 0, 0, 0, 1376, 1371, 1, 0, 0, 0, 1377, 1380, 1, 0, 0, 0, 1378, 1376, 1, 0, 0, 0, 1378, 1379, 1, 0, 0, 0, 1379, 1382, 1, 0, 0, 0, 1380, 1378, 1, 0, 0, 0, 1381, 1367, 1, 0, 0, 0, 1381, 1382, 1, 0, 0, 0, 1382, 1412, 1, 0, 0, 0, 1383, 1384, 5, 145, 0, 0, 1384, 1385, 5, 3, 0, 0, 1385, 1390, 3, 68, 34, 0, 1386, 1387, 5, 5, 0, 0, 1387, 1389, 3, 68, 34, 0, 1388, 1386, 1, 0, 0, 0, 1389, 1392, 1, 0, 0, 0, 1390, 1388, 1, 0, 0, 0, 1390, 1391, 1, 0, 0, 0, 1391, 1393, 1, 0, 0, 0, 1392, 1390, 1, 0, 0, 0, 1393, 1408, 5, 4, 0, 0, 1394, 1395, 5, 5, 0, 0, 1395, 1396, 5, 3, 0, 0, 1396, 1401, 3, 68, 34, 0, 1397, 1398, 5, 5, 0, 0, 1398, 1400, 3, 68, 34, 0, 1399, 1397, 1, 0, 0, 0, 1400, 1403, 1, 0, 0, 0, 1401, 1399, 1, 0, 0, 0, 1401, 1402, 1, 0, 0, 0, 1402, 1404, 1, 0, 0, 0, 1403, 1401, 1, 0, 0, 0, 1404, 1405, 5, 4, 0, 0, 1405, 1407, 1, 0, 0, 0, 1406, 1394, 1, 0, 0, 0, 1407, 1410, 1, 0, 0, 0, 1408, 1406, 1, 0, 0, 0, 1408, 1409, 1, 0, 0, 0, 1409, 1412, 1, 0, 0, 0, 1410, 1408, 1, 0, 0, 0, 1411, 1321, 1, 0, 0, 0, 1411, 1383, 1, 0, 0, 0, 1412, 89, 1, 0, 0, 0, 1413, 1414, 3, 84, 42, 0, 1414, 91, 1, 0, 0, 0, 1415, 1417, 3, 132, 66, 0, 1416, 1415, 1, 0, 0, 0, 1416, 1417, 1, 0, 0, 0, 1417, 1418, 1, 0, 0, 0, 1418, 1420, 3, 88, 44, 0, 1419, 1421, 3, 134, 67, 0, 1420, 1419, 1, 0, 0, 0, 1420, 1421, 1, 0, 0, 0, 1421, 1423, 1, 0, 0, 0, 1422, 1424, 3, 136, 68, 0, 1423, 1422, 1, 0, 0, 0, 1423, 1424, 1, 0, 0, 0, 1424, 93, 1, 0, 0, 0, 1425, 1427, 3, 132, 66, 0, 1426, 1425, 1, 0, 0, 0, 1426, 1427, 1, 0, 0, 0, 1427, 1428, 1, 0, 0, 0, 1428, 1438, 3, 88, 44, 0, 1429, 1431, 5, 140, 0, 0, 1430, 1432, 5, 29, 0, 0, 1431, 1430, 1, 0, 0, 0, 1431, 1432, 1, 0, 0, 0, 1432, 1436, 1, 0, 0, 0, 1433, 1436, 5, 90, 0, 0, 1434, 1436, 5, 68, 0, 0, 1435, 1429, 1, 0, 0, 0, 1435, 1433, 1, 0, 0, 0, 1435, 1434, 1, 0, 0, 0, 1436, 1437, 1, 0, 0, 0, 1437, 1439, 3, 88, 44, 0, 1438, 1435, 1, 0, 0, 0, 1439, 1440, 1, 0, 0, 0, 1440, 1438, 1, 0, 0, 0, 1440, 1441, 1, 0, 0, 0, 1441, 1443, 1, 0, 0, 0, 1442, 1444, 3, 134, 67, 0, 1443, 1442, 1, 0, 0, 0, 1443, 1444, 1, 0, 0, 0, 1444, 1446, 1, 0, 0, 0, 1445, 1447, 3, 136, 68, 0, 1446, 1445, 1, 0, 0, 0, 1446, 1447, 1, 0, 0, 0, 1447, 95, 1, 0, 0, 0, 1448, 1449, 3, 182, 91, 0, 1449, 1450, 5, 2, 0, 0, 1450, 1452, 1, 0, 0, 0, 1451, 1448, 1, 0, 0, 0, 1451, 1452, 1, 0, 0, 0, 1452, 1453, 1, 0, 0, 0, 1453, 1458, 3, 184, 92, 0, 1454, 1456, 5, 33, 0, 0, 1455, 1454, 1, 0, 0, 0, 1455, 1456, 1, 0, 0, 0, 1456, 1457, 1, 0, 0, 0, 1457, 1459, 3, 208, 104, 0, 1458, 1455, 1, 0, 0, 0, 1458, 1459, 1, 0, 0, 0, 1459, 1465, 1, 0, 0, 0, 1460, 1461, 5, 85, 0, 0, 1461, 1462, 5, 40, 0, 0, 1462, 1466, 3, 196, 98, 0, 1463, 1464, 5, 102, 0, 0, 1464, 1466, 5, 85, 0, 0, 1465, 1460, 1, 0, 0, 0, 1465, 1463, 1, 0, 0, 0, 1465, 1466, 1, 0, 0, 0, 1466, 1577, 1, 0, 0, 0, 1467, 1468, 3, 182, 91, 0, 1468, 1469, 5, 2, 0, 0, 1469, 1471, 1, 0, 0, 0, 1470, 1467, 1, 0, 0, 0, 1470, 1471, 1, 0, 0, 0, 1471, 1472, 1, 0, 0, 0, 1472, 1473, 3, 226, 113, 0, 1473, 1474, 5, 3, 0, 0, 1474, 1479, 3, 68, 34, 0, 1475, 1476, 5, 5, 0, 0, 1476, 1478, 3, 68, 34, 0, 1477, 1475, 1, 0, 0, 0, 1478, 1481, 1, 0, 0, 0, 1479, 1477, 1, 0, 0, 0, 1479, 1480, 1, 0, 0, 0, 1480, 1482, 1, 0, 0, 0, 1481, 1479, 1, 0, 0, 0, 1482, 1487, 5, 4, 0, 0, 1483, 1485, 5, 33, 0, 0, 1484, 1483, 1, 0, 0, 0, 1484, 1485, 1, 0, 0, 0, 1485, 1486, 1, 0, 0, 0, 1486, 1488, 3, 208, 104, 0, 1487, 1484, 1, 0, 0, 0, 1487, 1488, 1, 0, 0, 0, 1488, 1577, 1, 0, 0, 0, 1489, 1499, 5, 3, 0, 0, 1490, 1495, 3, 96, 48, 0, 1491, 1492, 5, 5, 0, 0, 1492, 1494, 3, 96, 48, 0, 1493, 1491, 1, 0, 0, 0, 1494, 1497, 1, 0, 0, 0, 1495, 1493, 1, 0, 0, 0, 1495, 1496, 1, 0, 0, 0, 1496, 1500, 1, 0, 0, 0, 1497, 1495, 1, 0, 0, 0, 1498, 1500, 3, 86, 43, 0, 1499, 1490, 1, 0, 0, 0, 1499, 1498, 1, 0, 0, 0, 1500, 1501, 1, 0, 0, 0, 1501, 1502, 5, 4, 0, 0, 1502, 1577, 1, 0, 0, 0, 1503, 1504, 5, 3, 0, 0, 1504, 1505, 3, 84, 42, 0, 1505, 1510, 5, 4, 0, 0, 1506, 1508, 5, 33, 0, 0, 1507, 1506, 1, 0, 0, 0, 1507, 1508, 1, 0, 0, 0, 1508, 1509, 1, 0, 0, 0, 1509, 1511, 3, 208, 104, 0, 1510, 1507, 1, 0, 0, 0, 1510, 1511, 1, 0, 0, 0, 1511, 1577, 1, 0, 0, 0, 1512, 1513, 3, 182, 91, 0, 1513, 1514, 5, 2, 0, 0, 1514, 1516, 1, 0, 0, 0, 1515, 1512, 1, 0, 0, 0, 1515, 1516, 1, 0, 0, 0, 1516, 1517, 1, 0, 0, 0, 1517, 1522, 3, 184, 92, 0, 1518, 1520, 5, 33, 0, 0, 1519, 1518, 1, 0, 0, 0, 1519, 1520, 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1523, 3, 210, 105, 0, 1522, 1519, 1, 0, 0, 0, 1522, 1523, 1, 0, 0, 0, 1523, 1529, 1, 0, 0, 0, 1524, 1525, 5, 85, 0, 0, 1525, 1526, 5, 40, 0, 0, 1526, 1530, 3, 196, 98, 0, 1527, 1528, 5, 102, 0, 0, 1528, 1530, 5, 85, 0, 0, 1529, 1524, 1, 0, 0, 0, 1529, 1527, 1, 0, 0, 0, 1529, 1530, 1, 0, 0, 0, 1530, 1577, 1, 0, 0, 0, 1531, 1532, 3, 182, 91, 0, 1532, 1533, 5, 2, 0, 0, 1533, 1535, 1, 0, 0, 0, 1534, 1531, 1, 0, 0, 0, 1534, 1535, 1, 0, 0, 0, 1535, 1536, 1, 0, 0, 0, 1536, 1537, 3, 226, 113, 0, 1537, 1538, 5, 3, 0, 0, 1538, 1543, 3, 68, 34, 0, 1539, 1540, 5, 5, 0, 0, 1540, 1542, 3, 68, 34, 0, 1541, 1539, 1, 0, 0, 0, 1542, 1545, 1, 0, 0, 0, 1543, 1541, 1, 0, 0, 0, 1543, 1544, 1, 0, 0, 0, 1544, 1546, 1, 0, 0, 0, 1545, 1543, 1, 0, 0, 0, 1546, 1551, 5, 4, 0, 0, 1547, 1549, 5, 33, 0, 0, 1548, 1547, 1, 0, 0, 0, 1548, 1549, 1, 0, 0, 0, 1549, 1550, 1, 0, 0, 0, 1550, 1552, 3, 210, 105, 0, 1551, 1548, 1, 0, 0, 0, 1551, 1552, 1, 0, 0, 0, 1552, 1577, 1, 0, 0, 0, 1553, 1563, 5, 3, 0, 0, 1554, 1559, 3, 96, 48, 0, 1555, 1556, 5, 5, 0, 0, 1556, 1558, 3, 96, 48, 0, 1557, 1555, 1, 0, 0, 0, 1558, 1561, 1, 0, 0, 0, 1559, 1557, 1, 0, 0, 0, 1559, 1560, 1, 0, 0, 0, 1560, 1564, 1, 0, 0, 0, 1561, 1559, 1, 0, 0, 0, 1562, 1564, 3, 86, 43, 0, 1563, 1554, 1, 0, 0, 0, 1563, 1562, 1, 0, 0, 0, 1564, 1565, 1, 0, 0, 0, 1565, 1566, 5, 4, 0, 0, 1566, 1577, 1, 0, 0, 0, 1567, 1568, 5, 3, 0, 0, 1568, 1569, 3, 84, 42, 0, 1569, 1574, 5, 4, 0, 0, 1570, 1572, 5, 33, 0, 0, 1571, 1570, 1, 0, 0, 0, 1571, 1572, 1, 0, 0, 0, 1572, 1573, 1, 0, 0, 0, 1573, 1575, 3, 210, 105, 0, 1574, 1571, 1, 0, 0, 0, 1574, 1575, 1, 0, 0, 0, 1575, 1577, 1, 0, 0, 0, 1576, 1451, 1, 0, 0, 0, 1576, 1470, 1, 0, 0, 0, 1576, 1489, 1, 0, 0, 0, 1576, 1503, 1, 0, 0, 0, 1576, 1515, 1, 0, 0, 0, 1576, 1534, 1, 0, 0, 0, 1576, 1553, 1, 0, 0, 0, 1576, 1567, 1, 0, 0, 0, 1577, 97, 1, 0, 0, 0, 1578, 1591, 5, 7, 0, 0, 1579, 1580, 3, 184, 92, 0, 1580, 1581, 5, 2, 0, 0, 1581, 1582, 5, 7, 0, 0, 1582, 1591, 1, 0, 0, 0, 1583, 1588, 3, 68, 34, 0, 1584, 1586, 5, 33, 0, 0, 1585, 1584, 1, 0, 0, 0, 1585, 1586, 1, 0, 0, 0, 1586, 1587, 1, 0, 0, 0, 1587, 1589, 3, 172, 86, 0, 1588, 1585, 1, 0, 0, 0, 1588, 1589, 1, 0, 0, 0, 1589, 1591, 1, 0, 0, 0, 1590, 1578, 1, 0, 0, 0, 1590, 1579, 1, 0, 0, 0, 1590, 1583, 1, 0, 0, 0, 1591, 99, 1, 0, 0, 0, 1592, 1607, 5, 5, 0, 0, 1593, 1595, 5, 100, 0, 0, 1594, 1593, 1, 0, 0, 0, 1594, 1595, 1, 0, 0, 0, 1595, 1601, 1, 0, 0, 0, 1596, 1598, 7, 17, 0, 0, 1597, 1599, 5, 110, 0, 0, 1598, 1597, 1, 0, 0, 0, 1598, 1599, 1, 0, 0, 0, 1599, 1602, 1, 0, 0, 0, 1600, 1602, 5, 87, 0, 0, 1601, 1596, 1, 0, 0, 0, 1601, 1600, 1, 0, 0, 0, 1601, 1602, 1, 0, 0, 0, 1602, 1603, 1, 0, 0, 0, 1603, 1607, 5, 94, 0, 0, 1604, 1605, 5, 51, 0, 0, 1605, 1607, 5, 94, 0, 0, 1606, 1592, 1, 0, 0, 0, 1606, 1594, 1, 0, 0, 0, 1606, 1604, 1, 0, 0, 0, 1607, 101, 1, 0, 0, 0, 1608, 1609, 5, 107, 0, 0, 1609, 1623, 3, 68, 34, 0, 1610, 1611, 5, 143, 0, 0, 1611, 1612, 5, 3, 0, 0, 1612, 1617, 3, 190, 95, 0, 1613, 1614, 5, 5, 0, 0, 1614, 1616, 3, 190, 95, 0, 1615, 1613, 1, 0, 0, 0, 1616, 1619, 1, 0, 0, 0, 1617, 1615, 1, 0, 0, 0, 1617, 1618, 1, 0, 0, 0, 1618, 1620, 1, 0, 0, 0, 1619, 1617, 1, 0, 0, 0, 1620, 1621, 5, 4, 0, 0, 1621, 1623, 1, 0, 0, 0, 1622, 1608, 1, 0, 0, 0, 1622, 1610, 1, 0, 0, 0, 1622, 1623, 1, 0, 0, 0, 1623, 103, 1, 0, 0, 0, 1624, 1626, 5, 140, 0, 0, 1625, 1627, 5, 29, 0, 0, 1626, 1625, 1, 0, 0, 0, 1626, 1627, 1, 0, 0, 0, 1627, 1631, 1, 0, 0, 0, 1628, 1631, 5, 90, 0, 0, 1629, 1631, 5, 68, 0, 0, 1630, 1624, 1, 0, 0, 0, 1630, 1628, 1, 0, 0, 0, 1630, 1629, 1, 0, 0, 0, 1631, 105, 1, 0, 0, 0, 1632, 1634, 3, 50, 25, 0, 1633, 1632, 1, 0, 0, 0, 1633, 1634, 1, 0, 0, 0, 1634, 1635, 1, 0, 0, 0, 1635, 1638, 5, 142, 0, 0, 1636, 1637, 5, 108, 0, 0, 1637, 1639, 7, 8, 0, 0, 1638, 1636, 1, 0, 0, 0, 1638, 1639, 1, 0, 0, 0, 1639, 1640, 1, 0, 0, 0, 1640, 1641, 3, 112, 56, 0, 1641, 1644, 5, 131, 0, 0, 1642, 1645, 3, 190, 95, 0, 1643, 1645, 3, 108, 54, 0, 1644, 1642, 1, 0, 0, 0, 1644, 1643, 1, 0, 0, 0, 1645, 1646, 1, 0, 0, 0, 1646, 1647, 5, 6, 0, 0, 1647, 1658, 3, 68, 34, 0, 1648, 1651, 5, 5, 0, 0, 1649, 1652, 3, 190, 95, 0, 1650, 1652, 3, 108, 54, 0, 1651, 1649, 1, 0, 0, 0, 1651, 1650, 1, 0, 0, 0, 1652, 1653, 1, 0, 0, 0, 1653, 1654, 5, 6, 0, 0, 1654, 1655, 3, 68, 34, 0, 1655, 1657, 1, 0, 0, 0, 1656, 1648, 1, 0, 0, 0, 1657, 1660, 1, 0, 0, 0, 1658, 1656, 1, 0, 0, 0, 1658, 1659, 1, 0, 0, 0, 1659, 1663, 1, 0, 0, 0, 1660, 1658, 1, 0, 0, 0, 1661, 1662, 5, 149, 0, 0, 1662, 1664, 3, 68, 34, 0, 1663, 1661, 1, 0, 0, 0, 1663, 1664, 1, 0, 0, 0, 1664, 1666, 1, 0, 0, 0, 1665, 1667, 3, 58, 29, 0, 1666, 1665, 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, 107, 1, 0, 0, 0, 1668, 1669, 5, 3, 0, 0, 1669, 1674, 3, 190, 95, 0, 1670, 1671, 5, 5, 0, 0, 1671, 1673, 3, 190, 95, 0, 1672, 1670, 1, 0, 0, 0, 1673, 1676, 1, 0, 0, 0, 1674, 1672, 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, 1677, 1, 0, 0, 0, 1676, 1674, 1, 0, 0, 0, 1677, 1678, 5, 4, 0, 0, 1678, 109, 1, 0, 0, 0, 1679, 1681, 3, 50, 25, 0, 1680, 1679, 1, 0, 0, 0, 1680, 1681, 1, 0, 0, 0, 1681, 1682, 1, 0, 0, 0, 1682, 1685, 5, 142, 0, 0, 1683, 1684, 5, 108, 0, 0, 1684, 1686, 7, 8, 0, 0, 1685, 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1687, 1, 0, 0, 0, 1687, 1688, 3, 112, 56, 0, 1688, 1691, 5, 131, 0, 0, 1689, 1692, 3, 190, 95, 0, 1690, 1692, 3, 108, 54, 0, 1691, 1689, 1, 0, 0, 0, 1691, 1690, 1, 0, 0, 0, 1692, 1693, 1, 0, 0, 0, 1693, 1694, 5, 6, 0, 0, 1694, 1705, 3, 68, 34, 0, 1695, 1698, 5, 5, 0, 0, 1696, 1699, 3, 190, 95, 0, 1697, 1699, 3, 108, 54, 0, 1698, 1696, 1, 0, 0, 0, 1698, 1697, 1, 0, 0, 0, 1699, 1700, 1, 0, 0, 0, 1700, 1701, 5, 6, 0, 0, 1701, 1702, 3, 68, 34, 0, 1702, 1704, 1, 0, 0, 0, 1703, 1695, 1, 0, 0, 0, 1704, 1707, 1, 0, 0, 0, 1705, 1703, 1, 0, 0, 0, 1705, 1706, 1, 0, 0, 0, 1706, 1710, 1, 0, 0, 0, 1707, 1705, 1, 0, 0, 0, 1708, 1709, 5, 149, 0, 0, 1709, 1711, 3, 68, 34, 0, 1710, 1708, 1, 0, 0, 0, 1710, 1711, 1, 0, 0, 0, 1711, 1716, 1, 0, 0, 0, 1712, 1714, 3, 134, 67, 0, 1713, 1712, 1, 0, 0, 0, 1713, 1714, 1, 0, 0, 0, 1714, 1715, 1, 0, 0, 0, 1715, 1717, 3, 136, 68, 0, 1716, 1713, 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 111, 1, 0, 0, 0, 1718, 1719, 3, 182, 91, 0, 1719, 1720, 5, 2, 0, 0, 1720, 1722, 1, 0, 0, 0, 1721, 1718, 1, 0, 0, 0, 1721, 1722, 1, 0, 0, 0, 1722, 1723, 1, 0, 0, 0, 1723, 1726, 3, 184, 92, 0, 1724, 1725, 5, 33, 0, 0, 1725, 1727, 3, 216, 108, 0, 1726, 1724, 1, 0, 0, 0, 1726, 1727, 1, 0, 0, 0, 1727, 1733, 1, 0, 0, 0, 1728, 1729, 5, 85, 0, 0, 1729, 1730, 5, 40, 0, 0, 1730, 1734, 3, 196, 98, 0, 1731, 1732, 5, 102, 0, 0, 1732, 1734, 5, 85, 0, 0, 1733, 1728, 1, 0, 0, 0, 1733, 1731, 1, 0, 0, 0, 1733, 1734, 1, 0, 0, 0, 1734, 113, 1, 0, 0, 0, 1735, 1737, 5, 144, 0, 0, 1736, 1738, 3, 182, 91, 0, 1737, 1736, 1, 0, 0, 0, 1737, 1738, 1, 0, 0, 0, 1738, 1741, 1, 0, 0, 0, 1739, 1740, 5, 91, 0, 0, 1740, 1742, 3, 218, 109, 0, 1741, 1739, 1, 0, 0, 0, 1741, 1742, 1, 0, 0, 0, 1742, 115, 1, 0, 0, 0, 1743, 1744, 5, 179, 0, 0, 1744, 1745, 5, 3, 0, 0, 1745, 1746, 5, 149, 0, 0, 1746, 1747, 3, 68, 34, 0, 1747, 1748, 5, 4, 0, 0, 1748, 117, 1, 0, 0, 0, 1749, 1751, 5, 3, 0, 0, 1750, 1752, 3, 220, 110, 0, 1751, 1750, 1, 0, 0, 0, 1751, 1752, 1, 0, 0, 0, 1752, 1763, 1, 0, 0, 0, 1753, 1754, 5, 154, 0, 0, 1754, 1755, 5, 40, 0, 0, 1755, 1760, 3, 68, 34, 0, 1756, 1757, 5, 5, 0, 0, 1757, 1759, 3, 68, 34, 0, 1758, 1756, 1, 0, 0, 0, 1759, 1762, 1, 0, 0, 0, 1760, 1758, 1, 0, 0, 0, 1760, 1761, 1, 0, 0, 0, 1761, 1764, 1, 0, 0, 0, 1762, 1760, 1, 0, 0, 0, 1763, 1753, 1, 0, 0, 0, 1763, 1764, 1, 0, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, 5, 109, 0, 0, 1766, 1767, 5, 40, 0, 0, 1767, 1772, 3, 138, 69, 0, 1768, 1769, 5, 5, 0, 0, 1769, 1771, 3, 138, 69, 0, 1770, 1768, 1, 0, 0, 0, 1771, 1774, 1, 0, 0, 0, 1772, 1770, 1, 0, 0, 0, 1772, 1773, 1, 0, 0, 0, 1773, 1776, 1, 0, 0, 0, 1774, 1772, 1, 0, 0, 0, 1775, 1777, 3, 122, 61, 0, 1776, 1775, 1, 0, 0, 0, 1776, 1777, 1, 0, 0, 0, 1777, 1778, 1, 0, 0, 0, 1778, 1779, 5, 4, 0, 0, 1779, 119, 1, 0, 0, 0, 1780, 1814, 5, 153, 0, 0, 1781, 1815, 3, 214, 107, 0, 1782, 1784, 5, 3, 0, 0, 1783, 1785, 3, 220, 110, 0, 1784, 1783, 1, 0, 0, 0, 1784, 1785, 1, 0, 0, 0, 1785, 1796, 1, 0, 0, 0, 1786, 1787, 5, 154, 0, 0, 1787, 1788, 5, 40, 0, 0, 1788, 1793, 3, 68, 34, 0, 1789, 1790, 5, 5, 0, 0, 1790, 1792, 3, 68, 34, 0, 1791, 1789, 1, 0, 0, 0, 1792, 1795, 1, 0, 0, 0, 1793, 1791, 1, 0, 0, 0, 1793, 1794, 1, 0, 0, 0, 1794, 1797, 1, 0, 0, 0, 1795, 1793, 1, 0, 0, 0, 1796, 1786, 1, 0, 0, 0, 1796, 1797, 1, 0, 0, 0, 1797, 1808, 1, 0, 0, 0, 1798, 1799, 5, 109, 0, 0, 1799, 1800, 5, 40, 0, 0, 1800, 1805, 3, 138, 69, 0, 1801, 1802, 5, 5, 0, 0, 1802, 1804, 3, 138, 69, 0, 1803, 1801, 1, 0, 0, 0, 1804, 1807, 1, 0, 0, 0, 1805, 1803, 1, 0, 0, 0, 1805, 1806, 1, 0, 0, 0, 1806, 1809, 1, 0, 0, 0, 1807, 1805, 1, 0, 0, 0, 1808, 1798, 1, 0, 0, 0, 1808, 1809, 1, 0, 0, 0, 1809, 1811, 1, 0, 0, 0, 1810, 1812, 3, 122, 61, 0, 1811, 1810, 1, 0, 0, 0, 1811, 1812, 1, 0, 0, 0, 1812, 1813, 1, 0, 0, 0, 1813, 1815, 5, 4, 0, 0, 1814, 1781, 1, 0, 0, 0, 1814, 1782, 1, 0, 0, 0, 1815, 121, 1, 0, 0, 0, 1816, 1824, 3, 124, 62, 0, 1817, 1818, 5, 181, 0, 0, 1818, 1819, 5, 101, 0, 0, 1819, 1825, 5, 183, 0, 0, 1820, 1821, 5, 158, 0, 0, 1821, 1825, 5, 127, 0, 0, 1822, 1825, 5, 78, 0, 0, 1823, 1825, 5, 182, 0, 0, 1824, 1817, 1, 0, 0, 0, 1824, 1820, 1, 0, 0, 0, 1824, 1822, 1, 0, 0, 0, 1824, 1823, 1, 0, 0, 0, 1824, 1825, 1, 0, 0, 0, 1825, 123, 1, 0, 0, 0, 1826, 1833, 7, 18, 0, 0, 1827, 1834, 3, 146, 73, 0, 1828, 1829, 5, 39, 0, 0, 1829, 1830, 3, 142, 71, 0, 1830, 1831, 5, 32, 0, 0, 1831, 1832, 3, 144, 72, 0, 1832, 1834, 1, 0, 0, 0, 1833, 1827, 1, 0, 0, 0, 1833, 1828, 1, 0, 0, 0, 1834, 125, 1, 0, 0, 0, 1835, 1836, 3, 222, 111, 0, 1836, 1846, 5, 3, 0, 0, 1837, 1842, 3, 68, 34, 0, 1838, 1839, 5, 5, 0, 0, 1839, 1841, 3, 68, 34, 0, 1840, 1838, 1, 0, 0, 0, 1841, 1844, 1, 0, 0, 0, 1842, 1840, 1, 0, 0, 0, 1842, 1843, 1, 0, 0, 0, 1843, 1847, 1, 0, 0, 0, 1844, 1842, 1, 0, 0, 0, 1845, 1847, 5, 7, 0, 0, 1846, 1837, 1, 0, 0, 0, 1846, 1845, 1, 0, 0, 0, 1847, 1848, 1, 0, 0, 0, 1848, 1849, 5, 4, 0, 0, 1849, 127, 1, 0, 0, 0, 1850, 1851, 3, 224, 112, 0, 1851, 1864, 5, 3, 0, 0, 1852, 1854, 5, 62, 0, 0, 1853, 1852, 1, 0, 0, 0, 1853, 1854, 1, 0, 0, 0, 1854, 1855, 1, 0, 0, 0, 1855, 1860, 3, 68, 34, 0, 1856, 1857, 5, 5, 0, 0, 1857, 1859, 3, 68, 34, 0, 1858, 1856, 1, 0, 0, 0, 1859, 1862, 1, 0, 0, 0, 1860, 1858, 1, 0, 0, 0, 1860, 1861, 1, 0, 0, 0, 1861, 1865, 1, 0, 0, 0, 1862, 1860, 1, 0, 0, 0, 1863, 1865, 5, 7, 0, 0, 1864, 1853, 1, 0, 0, 0, 1864, 1863, 1, 0, 0, 0, 1864, 1865, 1, 0, 0, 0, 1865, 1866, 1, 0, 0, 0, 1866, 1868, 5, 4, 0, 0, 1867, 1869, 3, 116, 58, 0, 1868, 1867, 1, 0, 0, 0, 1868, 1869, 1, 0, 0, 0, 1869, 129, 1, 0, 0, 0, 1870, 1871, 3, 148, 74, 0, 1871, 1881, 5, 3, 0, 0, 1872, 1877, 3, 68, 34, 0, 1873, 1874, 5, 5, 0, 0, 1874, 1876, 3, 68, 34, 0, 1875, 1873, 1, 0, 0, 0, 1876, 1879, 1, 0, 0, 0, 1877, 1875, 1, 0, 0, 0, 1877, 1878, 1, 0, 0, 0, 1878, 1882, 1, 0, 0, 0, 1879, 1877, 1, 0, 0, 0, 1880, 1882, 5, 7, 0, 0, 1881, 1872, 1, 0, 0, 0, 1881, 1880, 1, 0, 0, 0, 1881, 1882, 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1885, 5, 4, 0, 0, 1884, 1886, 3, 116, 58, 0, 1885, 1884, 1, 0, 0, 0, 1885, 1886, 1, 0, 0, 0, 1886, 1887, 1, 0, 0, 0, 1887, 1890, 5, 153, 0, 0, 1888, 1891, 3, 118, 59, 0, 1889, 1891, 3, 214, 107, 0, 1890, 1888, 1, 0, 0, 0, 1890, 1889, 1, 0, 0, 0, 1891, 131, 1, 0, 0, 0, 1892, 1894, 5, 150, 0, 0, 1893, 1895, 5, 116, 0, 0, 1894, 1893, 1, 0, 0, 0, 1894, 1895, 1, 0, 0, 0, 1895, 1896, 1, 0, 0, 0, 1896, 1901, 3, 56, 28, 0, 1897, 1898, 5, 5, 0, 0, 1898, 1900, 3, 56, 28, 0, 1899, 1897, 1, 0, 0, 0, 1900, 1903, 1, 0, 0, 0, 1901, 1899, 1, 0, 0, 0, 1901, 1902, 1, 0, 0, 0, 1902, 133, 1, 0, 0, 0, 1903, 1901, 1, 0, 0, 0, 1904, 1905, 5, 109, 0, 0, 1905, 1906, 5, 40, 0, 0, 1906, 1911, 3, 138, 69, 0, 1907, 1908, 5, 5, 0, 0, 1908, 1910, 3, 138, 69, 0, 1909, 1907, 1, 0, 0, 0, 1910, 1913, 1, 0, 0, 0, 1911, 1909, 1, 0, 0, 0, 1911, 1912, 1, 0, 0, 0, 1912, 135, 1, 0, 0, 0, 1913, 1911, 1, 0, 0, 0, 1914, 1915, 5, 98, 0, 0, 1915, 1918, 3, 68, 34, 0, 1916, 1917, 7, 19, 0, 0, 1917, 1919, 3, 68, 34, 0, 1918, 1916, 1, 0, 0, 0, 1918, 1919, 1, 0, 0, 0, 1919, 137, 1, 0, 0, 0, 1920, 1923, 3, 68, 34, 0, 1921, 1922, 5, 45, 0, 0, 1922, 1924, 3, 192, 96, 0, 1923, 1921, 1, 0, 0, 0, 1923, 1924, 1, 0, 0, 0, 1924, 1926, 1, 0, 0, 0, 1925, 1927, 3, 140, 70, 0, 1926, 1925, 1, 0, 0, 0, 1926, 1927, 1, 0, 0, 0, 1927, 1930, 1, 0, 0, 0, 1928, 1929, 5, 176, 0, 0, 1929, 1931, 7, 20, 0, 0, 1930, 1928, 1, 0, 0, 0, 1930, 1931, 1, 0, 0, 0, 1931, 139, 1, 0, 0, 0, 1932, 1933, 7, 21, 0, 0, 1933, 141, 1, 0, 0, 0, 1934, 1935, 3, 68, 34, 0, 1935, 1936, 5, 156, 0, 0, 1936, 1945, 1, 0, 0, 0, 1937, 1938, 3, 68, 34, 0, 1938, 1939, 5, 159, 0, 0, 1939, 1945, 1, 0, 0, 0, 1940, 1941, 5, 158, 0, 0, 1941, 1945, 5, 127, 0, 0, 1942, 1943, 5, 157, 0, 0, 1943, 1945, 5, 156, 0, 0, 1944, 1934, 1, 0, 0, 0, 1944, 1937, 1, 0, 0, 0, 1944, 1940, 1, 0, 0, 0, 1944, 1942, 1, 0, 0, 0, 1945, 143, 1, 0, 0, 0, 1946, 1947, 3, 68, 34, 0, 1947, 1948, 5, 156, 0, 0, 1948, 1957, 1, 0, 0, 0, 1949, 1950, 3, 68, 34, 0, 1950, 1951, 5, 159, 0, 0, 1951, 1957, 1, 0, 0, 0, 1952, 1953, 5, 158, 0, 0, 1953, 1957, 5, 127, 0, 0, 1954, 1955, 5, 157, 0, 0, 1955, 1957, 5, 159, 0, 0, 1956, 1946, 1, 0, 0, 0, 1956, 1949, 1, 0, 0, 0, 1956, 1952, 1, 0, 0, 0, 1956, 1954, 1, 0, 0, 0, 1957, 145, 1, 0, 0, 0, 1958, 1959, 3, 68, 34, 0, 1959, 1960, 5, 156, 0, 0, 1960, 1966, 1, 0, 0, 0, 1961, 1962, 5, 157, 0, 0, 1962, 1966, 5, 156, 0, 0, 1963, 1964, 5, 158, 0, 0, 1964, 1966, 5, 127, 0, 0, 1965, 1958, 1, 0, 0, 0, 1965, 1961, 1, 0, 0, 0, 1965, 1963, 1, 0, 0, 0, 1966, 147, 1, 0, 0, 0, 1967, 1968, 7, 22, 0, 0, 1968, 1969, 5, 3, 0, 0, 1969, 1970, 3, 68, 34, 0, 1970, 1971, 5, 4, 0, 0, 1971, 1972, 5, 153, 0, 0, 1972, 1974, 5, 3, 0, 0, 1973, 1975, 3, 154, 77, 0, 1974, 1973, 1, 0, 0, 0, 1974, 1975, 1, 0, 0, 0, 1975, 1976, 1, 0, 0, 0, 1976, 1978, 3, 158, 79, 0, 1977, 1979, 3, 124, 62, 0, 1978, 1977, 1, 0, 0, 0, 1978, 1979, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, 1981, 5, 4, 0, 0, 1981, 2053, 1, 0, 0, 0, 1982, 1983, 7, 23, 0, 0, 1983, 1984, 5, 3, 0, 0, 1984, 1985, 5, 4, 0, 0, 1985, 1986, 5, 153, 0, 0, 1986, 1988, 5, 3, 0, 0, 1987, 1989, 3, 154, 77, 0, 1988, 1987, 1, 0, 0, 0, 1988, 1989, 1, 0, 0, 0, 1989, 1991, 1, 0, 0, 0, 1990, 1992, 3, 156, 78, 0, 1991, 1990, 1, 0, 0, 0, 1991, 1992, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, 2053, 5, 4, 0, 0, 1994, 1995, 7, 24, 0, 0, 1995, 1996, 5, 3, 0, 0, 1996, 1997, 5, 4, 0, 0, 1997, 1998, 5, 153, 0, 0, 1998, 2000, 5, 3, 0, 0, 1999, 2001, 3, 154, 77, 0, 2000, 1999, 1, 0, 0, 0, 2000, 2001, 1, 0, 0, 0, 2001, 2002, 1, 0, 0, 0, 2002, 2003, 3, 158, 79, 0, 2003, 2004, 5, 4, 0, 0, 2004, 2053, 1, 0, 0, 0, 2005, 2006, 7, 25, 0, 0, 2006, 2007, 5, 3, 0, 0, 2007, 2009, 3, 68, 34, 0, 2008, 2010, 3, 150, 75, 0, 2009, 2008, 1, 0, 0, 0, 2009, 2010, 1, 0, 0, 0, 2010, 2012, 1, 0, 0, 0, 2011, 2013, 3, 152, 76, 0, 2012, 2011, 1, 0, 0, 0, 2012, 2013, 1, 0, 0, 0, 2013, 2014, 1, 0, 0, 0, 2014, 2015, 5, 4, 0, 0, 2015, 2016, 5, 153, 0, 0, 2016, 2018, 5, 3, 0, 0, 2017, 2019, 3, 154, 77, 0, 2018, 2017, 1, 0, 0, 0, 2018, 2019, 1, 0, 0, 0, 2019, 2020, 1, 0, 0, 0, 2020, 2021, 3, 158, 79, 0, 2021, 2022, 5, 4, 0, 0, 2022, 2053, 1, 0, 0, 0, 2023, 2024, 5, 165, 0, 0, 2024, 2025, 5, 3, 0, 0, 2025, 2026, 3, 68, 34, 0, 2026, 2027, 5, 5, 0, 0, 2027, 2028, 3, 36, 18, 0, 2028, 2029, 5, 4, 0, 0, 2029, 2030, 5, 153, 0, 0, 2030, 2032, 5, 3, 0, 0, 2031, 2033, 3, 154, 77, 0, 2032, 2031, 1, 0, 0, 0, 2032, 2033, 1, 0, 0, 0, 2033, 2034, 1, 0, 0, 0, 2034, 2036, 3, 158, 79, 0, 2035, 2037, 3, 124, 62, 0, 2036, 2035, 1, 0, 0, 0, 2036, 2037, 1, 0, 0, 0, 2037, 2038, 1, 0, 0, 0, 2038, 2039, 5, 4, 0, 0, 2039, 2053, 1, 0, 0, 0, 2040, 2041, 5, 166, 0, 0, 2041, 2042, 5, 3, 0, 0, 2042, 2043, 3, 68, 34, 0, 2043, 2044, 5, 4, 0, 0, 2044, 2045, 5, 153, 0, 0, 2045, 2047, 5, 3, 0, 0, 2046, 2048, 3, 154, 77, 0, 2047, 2046, 1, 0, 0, 0, 2047, 2048, 1, 0, 0, 0, 2048, 2049, 1, 0, 0, 0, 2049, 2050, 3, 158, 79, 0, 2050, 2051, 5, 4, 0, 0, 2051, 2053, 1, 0, 0, 0, 2052, 1967, 1, 0, 0, 0, 2052, 1982, 1, 0, 0, 0, 2052, 1994, 1, 0, 0, 0, 2052, 2005, 1, 0, 0, 0, 2052, 2023, 1, 0, 0, 0, 2052, 2040, 1, 0, 0, 0, 2053, 149, 1, 0, 0, 0, 2054, 2055, 5, 5, 0, 0, 2055, 2056, 3, 36, 18, 0, 2056, 151, 1, 0, 0, 0, 2057, 2058, 5, 5, 0, 0, 2058, 2059, 3, 36, 18, 0, 2059, 153, 1, 0, 0, 0, 2060, 2061, 5, 154, 0, 0, 2061, 2063, 5, 40, 0, 0, 2062, 2064, 3, 68, 34, 0, 2063, 2062, 1, 0, 0, 0, 2064, 2065, 1, 0, 0, 0, 2065, 2063, 1, 0, 0, 0, 2065, 2066, 1, 0, 0, 0, 2066, 155, 1, 0, 0, 0, 2067, 2068, 5, 109, 0, 0, 2068, 2070, 5, 40, 0, 0, 2069, 2071, 3, 68, 34, 0, 2070, 2069, 1, 0, 0, 0, 2071, 2072, 1, 0, 0, 0, 2072, 2070, 1, 0, 0, 0, 2072, 2073, 1, 0, 0, 0, 2073, 157, 1, 0, 0, 0, 2074, 2075, 5, 109, 0, 0, 2075, 2076, 5, 40, 0, 0, 2076, 2077, 3, 158, 79, 0, 2077, 159, 1, 0, 0, 0, 2078, 2080, 3, 68, 34, 0, 2079, 2081, 3, 140, 70, 0, 2080, 2079, 1, 0, 0, 0, 2080, 2081, 1, 0, 0, 0, 2081, 2089, 1, 0, 0, 0, 2082, 2083, 5, 5, 0, 0, 2083, 2085, 3, 68, 34, 0, 2084, 2086, 3, 140, 70, 0, 2085, 2084, 1, 0, 0, 0, 2085, 2086, 1, 0, 0, 0, 2086, 2088, 1, 0, 0, 0, 2087, 2082, 1, 0, 0, 0, 2088, 2091, 1, 0, 0, 0, 2089, 2087, 1, 0, 0, 0, 2089, 2090, 1, 0, 0, 0, 2090, 161, 1, 0, 0, 0, 2091, 2089, 1, 0, 0, 0, 2092, 2093, 3, 84, 42, 0, 2093, 163, 1, 0, 0, 0, 2094, 2095, 3, 84, 42, 0, 2095, 165, 1, 0, 0, 0, 2096, 2097, 7, 26, 0, 0, 2097, 167, 1, 0, 0, 0, 2098, 2099, 5, 190, 0, 0, 2099, 169, 1, 0, 0, 0, 2100, 2103, 3, 68, 34, 0, 2101, 2103, 3, 30, 15, 0, 2102, 2100, 1, 0, 0, 0, 2102, 2101, 1, 0, 0, 0, 2103, 171, 1, 0, 0, 0, 2104, 2105, 7, 27, 0, 0, 2105, 173, 1, 0, 0, 0, 2106, 2107, 7, 28, 0, 0, 2107, 175, 1, 0, 0, 0, 2108, 2109, 3, 228, 114, 0, 2109, 177, 1, 0, 0, 0, 2110, 2111, 3, 228, 114, 0, 2111, 179, 1, 0, 0, 0, 2112, 2113, 3, 182, 91, 0, 2113, 2114, 5, 2, 0, 0, 2114, 2116, 1, 0, 0, 0, 2115, 2112, 1, 0, 0, 0, 2115, 2116, 1, 0, 0, 0, 2116, 2117, 1, 0, 0, 0, 2117, 2118, 3, 178, 89, 0, 2118, 181, 1, 0, 0, 0, 2119, 2120, 3, 228, 114, 0, 2120, 183, 1, 0, 0, 0, 2121, 2122, 3, 228, 114, 0, 2122, 185, 1, 0, 0, 0, 2123, 2124, 3, 228, 114, 0, 2124, 187, 1, 0, 0, 0, 2125, 2126, 3, 228, 114, 0, 2126, 189, 1, 0, 0, 0, 2127, 2128, 3, 228, 114, 0, 2128, 191, 1, 0, 0, 0, 2129, 2130, 3, 228, 114, 0, 2130, 193, 1, 0, 0, 0, 2131, 2132, 3, 228, 114, 0, 2132, 195, 1, 0, 0, 0, 2133, 2134, 3, 228, 114, 0, 2134, 197, 1, 0, 0, 0, 2135, 2136, 3, 228, 114, 0, 2136, 199, 1, 0, 0, 0, 2137, 2138, 3, 228, 114, 0, 2138, 201, 1, 0, 0, 0, 2139, 2140, 3, 228, 114, 0, 2140, 203, 1, 0, 0, 0, 2141, 2142, 3, 228, 114, 0, 2142, 205, 1, 0, 0, 0, 2143, 2144, 3, 228, 114, 0, 2144, 207, 1, 0, 0, 0, 2145, 2146, 7, 27, 0, 0, 2146, 209, 1, 0, 0, 0, 2147, 2148, 3, 228, 114, 0, 2148, 211, 1, 0, 0, 0, 2149, 2150, 3, 228, 114, 0, 2150, 213, 1, 0, 0, 0, 2151, 2152, 3, 228, 114, 0, 2152, 215, 1, 0, 0, 0, 2153, 2154, 3, 228, 114, 0, 2154, 217, 1, 0, 0, 0, 2155, 2156, 3, 228, 114, 0, 2156, 219, 1, 0, 0, 0, 2157, 2158, 3, 228, 114, 0, 2158, 221, 1, 0, 0, 0, 2159, 2160, 3, 228, 114, 0, 2160, 223, 1, 0, 0, 0, 2161, 2162, 3, 228, 114, 0, 2162, 225, 1, 0, 0, 0, 2163, 2164, 3, 228, 114, 0, 2164, 227, 1, 0, 0, 0, 2165, 2173, 5, 186, 0, 0, 2166, 2173, 3, 174, 87, 0, 2167, 2173, 5, 190, 0, 0, 2168, 2169, 5, 3, 0, 0, 2169, 2170, 3, 228, 114, 0, 2170, 2171, 5, 4, 0, 0, 2171, 2173, 1, 0, 0, 0, 2172, 2165, 1, 0, 0, 0, 2172, 2166, 1, 0, 0, 0, 2172, 2167, 1, 0, 0, 0, 2172, 2168, 1, 0, 0, 0, 2173, 229, 1, 0, 0, 0, 314, 233, 241, 248, 253, 259, 265, 267, 293, 300, 307, 313, 317, 322, 325, 332, 335, 339, 347, 351, 353, 357, 361, 365, 368, 375, 381, 387, 392, 403, 409, 413, 417, 420, 425, 429, 435, 440, 449, 456, 465, 468, 472, 476, 481, 487, 499, 503, 508, 511, 514, 519, 522, 536, 543, 550, 552, 555, 561, 566, 574, 579, 594, 600, 610, 615, 625, 629, 631, 635, 640, 642, 650, 656, 661, 668, 679, 682, 684, 691, 695, 702, 708, 714, 720, 725, 734, 739, 750, 755, 766, 771, 775, 791, 801, 806, 814, 826, 831, 842, 845, 847, 853, 856, 858, 862, 866, 873, 876, 879, 886, 889, 892, 895, 899, 907, 912, 923, 928, 937, 944, 948, 952, 955, 963, 976, 979, 987, 996, 1000, 1005, 1031, 1038, 1049, 1058, 1068, 1071, 1077, 1083, 1092, 1095, 1099, 1106, 1112, 1119, 1121, 1123, 1132, 1139, 1146, 1152, 1157, 1165, 1170, 1179, 1190, 1197, 1201, 1204, 1207, 1211, 1221, 1227, 1229, 1237, 1244, 1251, 1256, 1258, 1264, 1273, 1278, 1285, 1289, 1291, 1294, 1302, 1306, 1309, 1318, 1323, 1330, 1339, 1343, 1345, 1349, 1358, 1363, 1365, 1378, 1381, 1390, 1401, 1408, 1411, 1416, 1420, 1423, 1426, 1431, 1435, 1440, 1443, 1446, 1451, 1455, 1458, 1465, 1470, 1479, 1484, 1487, 1495, 1499, 1507, 1510, 1515, 1519, 1522, 1529, 1534, 1543, 1548, 1551, 1559, 1563, 1571, 1574, 1576, 1585, 1588, 1590, 1594, 1598, 1601, 1606, 1617, 1622, 1626, 1630, 1633, 1638, 1644, 1651, 1658, 1663, 1666, 1674, 1680, 1685, 1691, 1698, 1705, 1710, 1713, 1716, 1721, 1726, 1733, 1737, 1741, 1751, 1760, 1763, 1772, 1776, 1784, 1793, 1796, 1805, 1808, 1811, 1814, 1824, 1833, 1842, 1846, 1853, 1860, 1864, 1868, 1877, 1881, 1885, 1890, 1894, 1901, 1911, 1918, 1923, 1926, 1930, 1944, 1956, 1965, 1974, 1978, 1988, 1991, 2000, 2009, 2012, 2018, 2032, 2036, 2047, 2052, 2065, 2072, 2080, 2085, 2089, 2102, 2115, 2172] \ No newline at end of file diff --git a/internal/engine/sqlite/parser/SQLiteParser.tokens b/internal/engine/sqlite/parser/SQLiteParser.tokens deleted file mode 100644 index 928604c851..0000000000 --- a/internal/engine/sqlite/parser/SQLiteParser.tokens +++ /dev/null @@ -1,219 +0,0 @@ -SCOL=1 -DOT=2 -OPEN_PAR=3 -CLOSE_PAR=4 -COMMA=5 -ASSIGN=6 -STAR=7 -PLUS=8 -MINUS=9 -TILDE=10 -PIPE2=11 -DIV=12 -MOD=13 -LT2=14 -GT2=15 -AMP=16 -PIPE=17 -LT=18 -LT_EQ=19 -GT=20 -GT_EQ=21 -EQ=22 -NOT_EQ1=23 -NOT_EQ2=24 -ABORT_=25 -ACTION_=26 -ADD_=27 -AFTER_=28 -ALL_=29 -ALTER_=30 -ANALYZE_=31 -AND_=32 -AS_=33 -ASC_=34 -ATTACH_=35 -AUTOINCREMENT_=36 -BEFORE_=37 -BEGIN_=38 -BETWEEN_=39 -BY_=40 -CASCADE_=41 -CASE_=42 -CAST_=43 -CHECK_=44 -COLLATE_=45 -COLUMN_=46 -COMMIT_=47 -CONFLICT_=48 -CONSTRAINT_=49 -CREATE_=50 -CROSS_=51 -CURRENT_DATE_=52 -CURRENT_TIME_=53 -CURRENT_TIMESTAMP_=54 -DATABASE_=55 -DEFAULT_=56 -DEFERRABLE_=57 -DEFERRED_=58 -DELETE_=59 -DESC_=60 -DETACH_=61 -DISTINCT_=62 -DROP_=63 -EACH_=64 -ELSE_=65 -END_=66 -ESCAPE_=67 -EXCEPT_=68 -EXCLUSIVE_=69 -EXISTS_=70 -EXPLAIN_=71 -FAIL_=72 -FOR_=73 -FOREIGN_=74 -FROM_=75 -FULL_=76 -GLOB_=77 -GROUP_=78 -HAVING_=79 -IF_=80 -IGNORE_=81 -IMMEDIATE_=82 -IN_=83 -INDEX_=84 -INDEXED_=85 -INITIALLY_=86 -INNER_=87 -INSERT_=88 -INSTEAD_=89 -INTERSECT_=90 -INTO_=91 -IS_=92 -ISNULL_=93 -JOIN_=94 -KEY_=95 -LEFT_=96 -LIKE_=97 -LIMIT_=98 -MATCH_=99 -NATURAL_=100 -NO_=101 -NOT_=102 -NOTNULL_=103 -NULL_=104 -OF_=105 -OFFSET_=106 -ON_=107 -OR_=108 -ORDER_=109 -OUTER_=110 -PLAN_=111 -PRAGMA_=112 -PRIMARY_=113 -QUERY_=114 -RAISE_=115 -RECURSIVE_=116 -REFERENCES_=117 -REGEXP_=118 -REINDEX_=119 -RELEASE_=120 -RENAME_=121 -REPLACE_=122 -RESTRICT_=123 -RETURNING_=124 -RIGHT_=125 -ROLLBACK_=126 -ROW_=127 -ROWS_=128 -SAVEPOINT_=129 -SELECT_=130 -SET_=131 -STRICT_=132 -TABLE_=133 -TEMP_=134 -TEMPORARY_=135 -THEN_=136 -TO_=137 -TRANSACTION_=138 -TRIGGER_=139 -UNION_=140 -UNIQUE_=141 -UPDATE_=142 -USING_=143 -VACUUM_=144 -VALUES_=145 -VIEW_=146 -VIRTUAL_=147 -WHEN_=148 -WHERE_=149 -WITH_=150 -WITHOUT_=151 -FIRST_VALUE_=152 -OVER_=153 -PARTITION_=154 -RANGE_=155 -PRECEDING_=156 -UNBOUNDED_=157 -CURRENT_=158 -FOLLOWING_=159 -CUME_DIST_=160 -DENSE_RANK_=161 -LAG_=162 -LAST_VALUE_=163 -LEAD_=164 -NTH_VALUE_=165 -NTILE_=166 -PERCENT_RANK_=167 -RANK_=168 -ROW_NUMBER_=169 -GENERATED_=170 -ALWAYS_=171 -STORED_=172 -TRUE_=173 -FALSE_=174 -WINDOW_=175 -NULLS_=176 -FIRST_=177 -LAST_=178 -FILTER_=179 -GROUPS_=180 -EXCLUDE_=181 -TIES_=182 -OTHERS_=183 -DO_=184 -NOTHING_=185 -IDENTIFIER=186 -NUMERIC_LITERAL=187 -NUMBERED_BIND_PARAMETER=188 -NAMED_BIND_PARAMETER=189 -STRING_LITERAL=190 -BLOB_LITERAL=191 -SINGLE_LINE_COMMENT=192 -MULTILINE_COMMENT=193 -SPACES=194 -UNEXPECTED_CHAR=195 -';'=1 -'.'=2 -'('=3 -')'=4 -','=5 -'='=6 -'*'=7 -'+'=8 -'-'=9 -'~'=10 -'||'=11 -'/'=12 -'%'=13 -'<<'=14 -'>>'=15 -'&'=16 -'|'=17 -'<'=18 -'<='=19 -'>'=20 -'>='=21 -'=='=22 -'!='=23 -'<>'=24 diff --git a/internal/engine/sqlite/parser/sqlite_lexer.go b/internal/engine/sqlite/parser/sqlite_lexer.go deleted file mode 100644 index c2b35200b4..0000000000 --- a/internal/engine/sqlite/parser/sqlite_lexer.go +++ /dev/null @@ -1,1206 +0,0 @@ -// Code generated from SQLiteLexer.g4 by ANTLR 4.12.0. DO NOT EDIT. - -package parser - -import ( - "fmt" - "sync" - "unicode" - - "github.com/antlr/antlr4/runtime/Go/antlr/v4" -) - -// Suppress unused import error -var _ = fmt.Printf -var _ = sync.Once{} -var _ = unicode.IsLetter - -type SQLiteLexer struct { - *antlr.BaseLexer - channelNames []string - modeNames []string - // TODO: EOF string -} - -var sqlitelexerLexerStaticData struct { - once sync.Once - serializedATN []int32 - channelNames []string - modeNames []string - literalNames []string - symbolicNames []string - ruleNames []string - predictionContextCache *antlr.PredictionContextCache - atn *antlr.ATN - decisionToDFA []*antlr.DFA -} - -func sqlitelexerLexerInit() { - staticData := &sqlitelexerLexerStaticData - staticData.channelNames = []string{ - "DEFAULT_TOKEN_CHANNEL", "HIDDEN", - } - staticData.modeNames = []string{ - "DEFAULT_MODE", - } - staticData.literalNames = []string{ - "", "';'", "'.'", "'('", "')'", "','", "'='", "'*'", "'+'", "'-'", "'~'", - "'||'", "'/'", "'%'", "'<<'", "'>>'", "'&'", "'|'", "'<'", "'<='", "'>'", - "'>='", "'=='", "'!='", "'<>'", - } - staticData.symbolicNames = []string{ - "", "SCOL", "DOT", "OPEN_PAR", "CLOSE_PAR", "COMMA", "ASSIGN", "STAR", - "PLUS", "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", "GT2", "AMP", - "PIPE", "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", "NOT_EQ2", "ABORT_", - "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", "ANALYZE_", "AND_", "AS_", - "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", "BEGIN_", "BETWEEN_", - "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", "COLLATE_", "COLUMN_", - "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", "CROSS_", "CURRENT_DATE_", - "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", "DEFAULT_", "DEFERRABLE_", - "DEFERRED_", "DELETE_", "DESC_", "DETACH_", "DISTINCT_", "DROP_", "EACH_", - "ELSE_", "END_", "ESCAPE_", "EXCEPT_", "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", - "FAIL_", "FOR_", "FOREIGN_", "FROM_", "FULL_", "GLOB_", "GROUP_", "HAVING_", - "IF_", "IGNORE_", "IMMEDIATE_", "IN_", "INDEX_", "INDEXED_", "INITIALLY_", - "INNER_", "INSERT_", "INSTEAD_", "INTERSECT_", "INTO_", "IS_", "ISNULL_", - "JOIN_", "KEY_", "LEFT_", "LIKE_", "LIMIT_", "MATCH_", "NATURAL_", "NO_", - "NOT_", "NOTNULL_", "NULL_", "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", - "OUTER_", "PLAN_", "PRAGMA_", "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", - "REFERENCES_", "REGEXP_", "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", - "RESTRICT_", "RETURNING_", "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", - "SELECT_", "SET_", "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", - "TO_", "TRANSACTION_", "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", - "VACUUM_", "VALUES_", "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", - "WITHOUT_", "FIRST_VALUE_", "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", - "UNBOUNDED_", "CURRENT_", "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", - "LAG_", "LAST_VALUE_", "LEAD_", "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", - "RANK_", "ROW_NUMBER_", "GENERATED_", "ALWAYS_", "STORED_", "TRUE_", - "FALSE_", "WINDOW_", "NULLS_", "FIRST_", "LAST_", "FILTER_", "GROUPS_", - "EXCLUDE_", "TIES_", "OTHERS_", "DO_", "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", - "NUMBERED_BIND_PARAMETER", "NAMED_BIND_PARAMETER", "STRING_LITERAL", - "BLOB_LITERAL", "SINGLE_LINE_COMMENT", "MULTILINE_COMMENT", "SPACES", - "UNEXPECTED_CHAR", - } - staticData.ruleNames = []string{ - "SCOL", "DOT", "OPEN_PAR", "CLOSE_PAR", "COMMA", "ASSIGN", "STAR", "PLUS", - "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", "GT2", "AMP", "PIPE", - "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", "NOT_EQ2", "ABORT_", - "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", "ANALYZE_", "AND_", "AS_", - "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", "BEGIN_", "BETWEEN_", - "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", "COLLATE_", "COLUMN_", - "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", "CROSS_", "CURRENT_DATE_", - "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", "DEFAULT_", "DEFERRABLE_", - "DEFERRED_", "DELETE_", "DESC_", "DETACH_", "DISTINCT_", "DROP_", "EACH_", - "ELSE_", "END_", "ESCAPE_", "EXCEPT_", "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", - "FAIL_", "FOR_", "FOREIGN_", "FROM_", "FULL_", "GLOB_", "GROUP_", "HAVING_", - "IF_", "IGNORE_", "IMMEDIATE_", "IN_", "INDEX_", "INDEXED_", "INITIALLY_", - "INNER_", "INSERT_", "INSTEAD_", "INTERSECT_", "INTO_", "IS_", "ISNULL_", - "JOIN_", "KEY_", "LEFT_", "LIKE_", "LIMIT_", "MATCH_", "NATURAL_", "NO_", - "NOT_", "NOTNULL_", "NULL_", "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", - "OUTER_", "PLAN_", "PRAGMA_", "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", - "REFERENCES_", "REGEXP_", "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", - "RESTRICT_", "RETURNING_", "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", - "SELECT_", "SET_", "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", - "TO_", "TRANSACTION_", "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", - "VACUUM_", "VALUES_", "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", - "WITHOUT_", "FIRST_VALUE_", "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", - "UNBOUNDED_", "CURRENT_", "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", - "LAG_", "LAST_VALUE_", "LEAD_", "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", - "RANK_", "ROW_NUMBER_", "GENERATED_", "ALWAYS_", "STORED_", "TRUE_", - "FALSE_", "WINDOW_", "NULLS_", "FIRST_", "LAST_", "FILTER_", "GROUPS_", - "EXCLUDE_", "TIES_", "OTHERS_", "DO_", "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", - "NUMBERED_BIND_PARAMETER", "NAMED_BIND_PARAMETER", "STRING_LITERAL", - "BLOB_LITERAL", "SINGLE_LINE_COMMENT", "MULTILINE_COMMENT", "SPACES", - "UNEXPECTED_CHAR", "HEX_DIGIT", "DIGIT", "A", "B", "C", "D", "E", "F", - "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", - "U", "V", "W", "X", "Y", "Z", - } - staticData.predictionContextCache = antlr.NewPredictionContextCache() - staticData.serializedATN = []int32{ - 4, 0, 195, 1818, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, - 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, - 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, - 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, - 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, - 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, - 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, - 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, - 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, - 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, - 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, - 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, - 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, - 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, - 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, - 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, - 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, - 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, - 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, - 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, - 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, - 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, - 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, - 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, - 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, - 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, - 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, - 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, - 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, - 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, - 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, - 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, - 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, - 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, - 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, - 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, - 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, - 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, - 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, - 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, - 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, - 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, - 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, - 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, - 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, - 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, - 2, 221, 7, 221, 2, 222, 7, 222, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, - 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, - 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, - 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, - 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, - 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, - 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, - 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, - 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, - 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, - 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, - 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, - 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, - 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, - 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, - 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, - 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, - 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, - 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, - 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, - 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, - 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, - 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, - 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, - 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, - 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, - 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, - 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, - 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, - 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, - 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, - 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, - 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, - 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, - 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, - 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, - 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, - 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, - 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, - 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, - 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, - 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, - 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, - 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, - 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, - 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, - 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, - 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, - 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, - 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, - 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, - 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, - 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, - 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, - 1, 99, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, - 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, - 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, - 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, - 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, - 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, - 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, - 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, - 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, - 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, - 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, - 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, - 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, - 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, - 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, - 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, - 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, - 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, - 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, - 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, - 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, - 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, - 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, - 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, - 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, - 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, - 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, - 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, - 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, - 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, - 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, - 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, - 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, - 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, - 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, - 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, - 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, - 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, - 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, - 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, - 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, - 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, - 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, - 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, - 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, - 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, - 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, - 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, - 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, - 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, - 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, - 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, - 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, - 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, 168, 1, 168, - 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, - 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, - 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, - 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, - 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, - 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, - 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, - 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, - 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, - 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, - 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, - 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, - 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 5, 185, - 1625, 8, 185, 10, 185, 12, 185, 1628, 9, 185, 1, 185, 1, 185, 1, 185, 1, - 185, 1, 185, 5, 185, 1635, 8, 185, 10, 185, 12, 185, 1638, 9, 185, 1, 185, - 1, 185, 1, 185, 5, 185, 1643, 8, 185, 10, 185, 12, 185, 1646, 9, 185, 1, - 185, 1, 185, 1, 185, 5, 185, 1651, 8, 185, 10, 185, 12, 185, 1654, 9, 185, - 3, 185, 1656, 8, 185, 1, 186, 4, 186, 1659, 8, 186, 11, 186, 12, 186, 1660, - 1, 186, 1, 186, 5, 186, 1665, 8, 186, 10, 186, 12, 186, 1668, 9, 186, 3, - 186, 1670, 8, 186, 1, 186, 1, 186, 4, 186, 1674, 8, 186, 11, 186, 12, 186, - 1675, 3, 186, 1678, 8, 186, 1, 186, 1, 186, 3, 186, 1682, 8, 186, 1, 186, - 4, 186, 1685, 8, 186, 11, 186, 12, 186, 1686, 3, 186, 1689, 8, 186, 1, - 186, 1, 186, 1, 186, 1, 186, 4, 186, 1695, 8, 186, 11, 186, 12, 186, 1696, - 3, 186, 1699, 8, 186, 1, 187, 1, 187, 5, 187, 1703, 8, 187, 10, 187, 12, - 187, 1706, 9, 187, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, - 5, 189, 1715, 8, 189, 10, 189, 12, 189, 1718, 9, 189, 1, 189, 1, 189, 1, - 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 5, 191, 1729, 8, 191, - 10, 191, 12, 191, 1732, 9, 191, 1, 191, 3, 191, 1735, 8, 191, 1, 191, 1, - 191, 3, 191, 1739, 8, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, - 5, 192, 1747, 8, 192, 10, 192, 12, 192, 1750, 9, 192, 1, 192, 1, 192, 1, - 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, - 195, 1, 195, 1, 196, 1, 196, 1, 197, 1, 197, 1, 198, 1, 198, 1, 199, 1, - 199, 1, 200, 1, 200, 1, 201, 1, 201, 1, 202, 1, 202, 1, 203, 1, 203, 1, - 204, 1, 204, 1, 205, 1, 205, 1, 206, 1, 206, 1, 207, 1, 207, 1, 208, 1, - 208, 1, 209, 1, 209, 1, 210, 1, 210, 1, 211, 1, 211, 1, 212, 1, 212, 1, - 213, 1, 213, 1, 214, 1, 214, 1, 215, 1, 215, 1, 216, 1, 216, 1, 217, 1, - 217, 1, 218, 1, 218, 1, 219, 1, 219, 1, 220, 1, 220, 1, 221, 1, 221, 1, - 222, 1, 222, 1, 1748, 0, 223, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, - 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, - 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, - 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, - 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, - 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, - 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, - 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, - 137, 69, 139, 70, 141, 71, 143, 72, 145, 73, 147, 74, 149, 75, 151, 76, - 153, 77, 155, 78, 157, 79, 159, 80, 161, 81, 163, 82, 165, 83, 167, 84, - 169, 85, 171, 86, 173, 87, 175, 88, 177, 89, 179, 90, 181, 91, 183, 92, - 185, 93, 187, 94, 189, 95, 191, 96, 193, 97, 195, 98, 197, 99, 199, 100, - 201, 101, 203, 102, 205, 103, 207, 104, 209, 105, 211, 106, 213, 107, 215, - 108, 217, 109, 219, 110, 221, 111, 223, 112, 225, 113, 227, 114, 229, 115, - 231, 116, 233, 117, 235, 118, 237, 119, 239, 120, 241, 121, 243, 122, 245, - 123, 247, 124, 249, 125, 251, 126, 253, 127, 255, 128, 257, 129, 259, 130, - 261, 131, 263, 132, 265, 133, 267, 134, 269, 135, 271, 136, 273, 137, 275, - 138, 277, 139, 279, 140, 281, 141, 283, 142, 285, 143, 287, 144, 289, 145, - 291, 146, 293, 147, 295, 148, 297, 149, 299, 150, 301, 151, 303, 152, 305, - 153, 307, 154, 309, 155, 311, 156, 313, 157, 315, 158, 317, 159, 319, 160, - 321, 161, 323, 162, 325, 163, 327, 164, 329, 165, 331, 166, 333, 167, 335, - 168, 337, 169, 339, 170, 341, 171, 343, 172, 345, 173, 347, 174, 349, 175, - 351, 176, 353, 177, 355, 178, 357, 179, 359, 180, 361, 181, 363, 182, 365, - 183, 367, 184, 369, 185, 371, 186, 373, 187, 375, 188, 377, 189, 379, 190, - 381, 191, 383, 192, 385, 193, 387, 194, 389, 195, 391, 0, 393, 0, 395, - 0, 397, 0, 399, 0, 401, 0, 403, 0, 405, 0, 407, 0, 409, 0, 411, 0, 413, - 0, 415, 0, 417, 0, 419, 0, 421, 0, 423, 0, 425, 0, 427, 0, 429, 0, 431, - 0, 433, 0, 435, 0, 437, 0, 439, 0, 441, 0, 443, 0, 445, 0, 1, 0, 38, 1, - 0, 34, 34, 1, 0, 96, 96, 1, 0, 93, 93, 3, 0, 65, 90, 95, 95, 97, 122, 4, - 0, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 43, 43, 45, 45, 3, 0, 36, 36, - 58, 58, 64, 64, 1, 0, 39, 39, 2, 0, 10, 10, 13, 13, 3, 0, 9, 11, 13, 13, - 32, 32, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 2, 0, 65, 65, 97, - 97, 2, 0, 66, 66, 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, - 2, 0, 69, 69, 101, 101, 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, - 2, 0, 72, 72, 104, 104, 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, - 2, 0, 75, 75, 107, 107, 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, - 2, 0, 78, 78, 110, 110, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, - 2, 0, 81, 81, 113, 113, 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, - 2, 0, 84, 84, 116, 116, 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, - 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, - 2, 0, 90, 90, 122, 122, 1815, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, - 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, - 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, - 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, - 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, - 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, - 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, - 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, - 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, - 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, - 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, - 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, - 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, - 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, - 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, - 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, - 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, - 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, - 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, - 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, - 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, - 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, - 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, - 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, - 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, - 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, - 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, - 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, - 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, - 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, - 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, - 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, - 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, - 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, - 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, - 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, - 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, - 0, 271, 1, 0, 0, 0, 0, 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, - 0, 0, 0, 0, 279, 1, 0, 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, - 285, 1, 0, 0, 0, 0, 287, 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, - 0, 0, 0, 293, 1, 0, 0, 0, 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, - 1, 0, 0, 0, 0, 301, 1, 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, - 0, 307, 1, 0, 0, 0, 0, 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, - 0, 0, 0, 0, 315, 1, 0, 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, - 321, 1, 0, 0, 0, 0, 323, 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, - 0, 0, 0, 329, 1, 0, 0, 0, 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, - 1, 0, 0, 0, 0, 337, 1, 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, - 0, 343, 1, 0, 0, 0, 0, 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, - 0, 0, 0, 0, 351, 1, 0, 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, - 357, 1, 0, 0, 0, 0, 359, 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, - 0, 0, 0, 365, 1, 0, 0, 0, 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, - 1, 0, 0, 0, 0, 373, 1, 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, - 0, 379, 1, 0, 0, 0, 0, 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, - 0, 0, 0, 0, 387, 1, 0, 0, 0, 0, 389, 1, 0, 0, 0, 1, 447, 1, 0, 0, 0, 3, - 449, 1, 0, 0, 0, 5, 451, 1, 0, 0, 0, 7, 453, 1, 0, 0, 0, 9, 455, 1, 0, - 0, 0, 11, 457, 1, 0, 0, 0, 13, 459, 1, 0, 0, 0, 15, 461, 1, 0, 0, 0, 17, - 463, 1, 0, 0, 0, 19, 465, 1, 0, 0, 0, 21, 467, 1, 0, 0, 0, 23, 470, 1, - 0, 0, 0, 25, 472, 1, 0, 0, 0, 27, 474, 1, 0, 0, 0, 29, 477, 1, 0, 0, 0, - 31, 480, 1, 0, 0, 0, 33, 482, 1, 0, 0, 0, 35, 484, 1, 0, 0, 0, 37, 486, - 1, 0, 0, 0, 39, 489, 1, 0, 0, 0, 41, 491, 1, 0, 0, 0, 43, 494, 1, 0, 0, - 0, 45, 497, 1, 0, 0, 0, 47, 500, 1, 0, 0, 0, 49, 503, 1, 0, 0, 0, 51, 509, - 1, 0, 0, 0, 53, 516, 1, 0, 0, 0, 55, 520, 1, 0, 0, 0, 57, 526, 1, 0, 0, - 0, 59, 530, 1, 0, 0, 0, 61, 536, 1, 0, 0, 0, 63, 544, 1, 0, 0, 0, 65, 548, - 1, 0, 0, 0, 67, 551, 1, 0, 0, 0, 69, 555, 1, 0, 0, 0, 71, 562, 1, 0, 0, - 0, 73, 576, 1, 0, 0, 0, 75, 583, 1, 0, 0, 0, 77, 589, 1, 0, 0, 0, 79, 597, - 1, 0, 0, 0, 81, 600, 1, 0, 0, 0, 83, 608, 1, 0, 0, 0, 85, 613, 1, 0, 0, - 0, 87, 618, 1, 0, 0, 0, 89, 624, 1, 0, 0, 0, 91, 632, 1, 0, 0, 0, 93, 639, - 1, 0, 0, 0, 95, 646, 1, 0, 0, 0, 97, 655, 1, 0, 0, 0, 99, 666, 1, 0, 0, - 0, 101, 673, 1, 0, 0, 0, 103, 679, 1, 0, 0, 0, 105, 692, 1, 0, 0, 0, 107, - 705, 1, 0, 0, 0, 109, 723, 1, 0, 0, 0, 111, 732, 1, 0, 0, 0, 113, 740, - 1, 0, 0, 0, 115, 751, 1, 0, 0, 0, 117, 760, 1, 0, 0, 0, 119, 767, 1, 0, - 0, 0, 121, 772, 1, 0, 0, 0, 123, 779, 1, 0, 0, 0, 125, 788, 1, 0, 0, 0, - 127, 793, 1, 0, 0, 0, 129, 798, 1, 0, 0, 0, 131, 803, 1, 0, 0, 0, 133, - 807, 1, 0, 0, 0, 135, 814, 1, 0, 0, 0, 137, 821, 1, 0, 0, 0, 139, 831, - 1, 0, 0, 0, 141, 838, 1, 0, 0, 0, 143, 846, 1, 0, 0, 0, 145, 851, 1, 0, - 0, 0, 147, 855, 1, 0, 0, 0, 149, 863, 1, 0, 0, 0, 151, 868, 1, 0, 0, 0, - 153, 873, 1, 0, 0, 0, 155, 878, 1, 0, 0, 0, 157, 884, 1, 0, 0, 0, 159, - 891, 1, 0, 0, 0, 161, 894, 1, 0, 0, 0, 163, 901, 1, 0, 0, 0, 165, 911, - 1, 0, 0, 0, 167, 914, 1, 0, 0, 0, 169, 920, 1, 0, 0, 0, 171, 928, 1, 0, - 0, 0, 173, 938, 1, 0, 0, 0, 175, 944, 1, 0, 0, 0, 177, 951, 1, 0, 0, 0, - 179, 959, 1, 0, 0, 0, 181, 969, 1, 0, 0, 0, 183, 974, 1, 0, 0, 0, 185, - 977, 1, 0, 0, 0, 187, 984, 1, 0, 0, 0, 189, 989, 1, 0, 0, 0, 191, 993, - 1, 0, 0, 0, 193, 998, 1, 0, 0, 0, 195, 1003, 1, 0, 0, 0, 197, 1009, 1, - 0, 0, 0, 199, 1015, 1, 0, 0, 0, 201, 1023, 1, 0, 0, 0, 203, 1026, 1, 0, - 0, 0, 205, 1030, 1, 0, 0, 0, 207, 1038, 1, 0, 0, 0, 209, 1043, 1, 0, 0, - 0, 211, 1046, 1, 0, 0, 0, 213, 1053, 1, 0, 0, 0, 215, 1056, 1, 0, 0, 0, - 217, 1059, 1, 0, 0, 0, 219, 1065, 1, 0, 0, 0, 221, 1071, 1, 0, 0, 0, 223, - 1076, 1, 0, 0, 0, 225, 1083, 1, 0, 0, 0, 227, 1091, 1, 0, 0, 0, 229, 1097, - 1, 0, 0, 0, 231, 1103, 1, 0, 0, 0, 233, 1113, 1, 0, 0, 0, 235, 1124, 1, - 0, 0, 0, 237, 1131, 1, 0, 0, 0, 239, 1139, 1, 0, 0, 0, 241, 1147, 1, 0, - 0, 0, 243, 1154, 1, 0, 0, 0, 245, 1162, 1, 0, 0, 0, 247, 1171, 1, 0, 0, - 0, 249, 1181, 1, 0, 0, 0, 251, 1187, 1, 0, 0, 0, 253, 1196, 1, 0, 0, 0, - 255, 1200, 1, 0, 0, 0, 257, 1205, 1, 0, 0, 0, 259, 1215, 1, 0, 0, 0, 261, - 1222, 1, 0, 0, 0, 263, 1226, 1, 0, 0, 0, 265, 1233, 1, 0, 0, 0, 267, 1239, - 1, 0, 0, 0, 269, 1244, 1, 0, 0, 0, 271, 1254, 1, 0, 0, 0, 273, 1259, 1, - 0, 0, 0, 275, 1262, 1, 0, 0, 0, 277, 1274, 1, 0, 0, 0, 279, 1282, 1, 0, - 0, 0, 281, 1288, 1, 0, 0, 0, 283, 1295, 1, 0, 0, 0, 285, 1302, 1, 0, 0, - 0, 287, 1308, 1, 0, 0, 0, 289, 1315, 1, 0, 0, 0, 291, 1322, 1, 0, 0, 0, - 293, 1327, 1, 0, 0, 0, 295, 1335, 1, 0, 0, 0, 297, 1340, 1, 0, 0, 0, 299, - 1346, 1, 0, 0, 0, 301, 1351, 1, 0, 0, 0, 303, 1359, 1, 0, 0, 0, 305, 1371, - 1, 0, 0, 0, 307, 1376, 1, 0, 0, 0, 309, 1386, 1, 0, 0, 0, 311, 1392, 1, - 0, 0, 0, 313, 1402, 1, 0, 0, 0, 315, 1412, 1, 0, 0, 0, 317, 1420, 1, 0, - 0, 0, 319, 1430, 1, 0, 0, 0, 321, 1440, 1, 0, 0, 0, 323, 1451, 1, 0, 0, - 0, 325, 1455, 1, 0, 0, 0, 327, 1466, 1, 0, 0, 0, 329, 1471, 1, 0, 0, 0, - 331, 1481, 1, 0, 0, 0, 333, 1487, 1, 0, 0, 0, 335, 1500, 1, 0, 0, 0, 337, - 1505, 1, 0, 0, 0, 339, 1516, 1, 0, 0, 0, 341, 1526, 1, 0, 0, 0, 343, 1533, - 1, 0, 0, 0, 345, 1540, 1, 0, 0, 0, 347, 1545, 1, 0, 0, 0, 349, 1551, 1, - 0, 0, 0, 351, 1558, 1, 0, 0, 0, 353, 1564, 1, 0, 0, 0, 355, 1570, 1, 0, - 0, 0, 357, 1575, 1, 0, 0, 0, 359, 1582, 1, 0, 0, 0, 361, 1589, 1, 0, 0, - 0, 363, 1597, 1, 0, 0, 0, 365, 1602, 1, 0, 0, 0, 367, 1609, 1, 0, 0, 0, - 369, 1612, 1, 0, 0, 0, 371, 1655, 1, 0, 0, 0, 373, 1698, 1, 0, 0, 0, 375, - 1700, 1, 0, 0, 0, 377, 1707, 1, 0, 0, 0, 379, 1710, 1, 0, 0, 0, 381, 1721, - 1, 0, 0, 0, 383, 1724, 1, 0, 0, 0, 385, 1742, 1, 0, 0, 0, 387, 1756, 1, - 0, 0, 0, 389, 1760, 1, 0, 0, 0, 391, 1762, 1, 0, 0, 0, 393, 1764, 1, 0, - 0, 0, 395, 1766, 1, 0, 0, 0, 397, 1768, 1, 0, 0, 0, 399, 1770, 1, 0, 0, - 0, 401, 1772, 1, 0, 0, 0, 403, 1774, 1, 0, 0, 0, 405, 1776, 1, 0, 0, 0, - 407, 1778, 1, 0, 0, 0, 409, 1780, 1, 0, 0, 0, 411, 1782, 1, 0, 0, 0, 413, - 1784, 1, 0, 0, 0, 415, 1786, 1, 0, 0, 0, 417, 1788, 1, 0, 0, 0, 419, 1790, - 1, 0, 0, 0, 421, 1792, 1, 0, 0, 0, 423, 1794, 1, 0, 0, 0, 425, 1796, 1, - 0, 0, 0, 427, 1798, 1, 0, 0, 0, 429, 1800, 1, 0, 0, 0, 431, 1802, 1, 0, - 0, 0, 433, 1804, 1, 0, 0, 0, 435, 1806, 1, 0, 0, 0, 437, 1808, 1, 0, 0, - 0, 439, 1810, 1, 0, 0, 0, 441, 1812, 1, 0, 0, 0, 443, 1814, 1, 0, 0, 0, - 445, 1816, 1, 0, 0, 0, 447, 448, 5, 59, 0, 0, 448, 2, 1, 0, 0, 0, 449, - 450, 5, 46, 0, 0, 450, 4, 1, 0, 0, 0, 451, 452, 5, 40, 0, 0, 452, 6, 1, - 0, 0, 0, 453, 454, 5, 41, 0, 0, 454, 8, 1, 0, 0, 0, 455, 456, 5, 44, 0, - 0, 456, 10, 1, 0, 0, 0, 457, 458, 5, 61, 0, 0, 458, 12, 1, 0, 0, 0, 459, - 460, 5, 42, 0, 0, 460, 14, 1, 0, 0, 0, 461, 462, 5, 43, 0, 0, 462, 16, - 1, 0, 0, 0, 463, 464, 5, 45, 0, 0, 464, 18, 1, 0, 0, 0, 465, 466, 5, 126, - 0, 0, 466, 20, 1, 0, 0, 0, 467, 468, 5, 124, 0, 0, 468, 469, 5, 124, 0, - 0, 469, 22, 1, 0, 0, 0, 470, 471, 5, 47, 0, 0, 471, 24, 1, 0, 0, 0, 472, - 473, 5, 37, 0, 0, 473, 26, 1, 0, 0, 0, 474, 475, 5, 60, 0, 0, 475, 476, - 5, 60, 0, 0, 476, 28, 1, 0, 0, 0, 477, 478, 5, 62, 0, 0, 478, 479, 5, 62, - 0, 0, 479, 30, 1, 0, 0, 0, 480, 481, 5, 38, 0, 0, 481, 32, 1, 0, 0, 0, - 482, 483, 5, 124, 0, 0, 483, 34, 1, 0, 0, 0, 484, 485, 5, 60, 0, 0, 485, - 36, 1, 0, 0, 0, 486, 487, 5, 60, 0, 0, 487, 488, 5, 61, 0, 0, 488, 38, - 1, 0, 0, 0, 489, 490, 5, 62, 0, 0, 490, 40, 1, 0, 0, 0, 491, 492, 5, 62, - 0, 0, 492, 493, 5, 61, 0, 0, 493, 42, 1, 0, 0, 0, 494, 495, 5, 61, 0, 0, - 495, 496, 5, 61, 0, 0, 496, 44, 1, 0, 0, 0, 497, 498, 5, 33, 0, 0, 498, - 499, 5, 61, 0, 0, 499, 46, 1, 0, 0, 0, 500, 501, 5, 60, 0, 0, 501, 502, - 5, 62, 0, 0, 502, 48, 1, 0, 0, 0, 503, 504, 3, 395, 197, 0, 504, 505, 3, - 397, 198, 0, 505, 506, 3, 423, 211, 0, 506, 507, 3, 429, 214, 0, 507, 508, - 3, 433, 216, 0, 508, 50, 1, 0, 0, 0, 509, 510, 3, 395, 197, 0, 510, 511, - 3, 399, 199, 0, 511, 512, 3, 433, 216, 0, 512, 513, 3, 411, 205, 0, 513, - 514, 3, 423, 211, 0, 514, 515, 3, 421, 210, 0, 515, 52, 1, 0, 0, 0, 516, - 517, 3, 395, 197, 0, 517, 518, 3, 401, 200, 0, 518, 519, 3, 401, 200, 0, - 519, 54, 1, 0, 0, 0, 520, 521, 3, 395, 197, 0, 521, 522, 3, 405, 202, 0, - 522, 523, 3, 433, 216, 0, 523, 524, 3, 403, 201, 0, 524, 525, 3, 429, 214, - 0, 525, 56, 1, 0, 0, 0, 526, 527, 3, 395, 197, 0, 527, 528, 3, 417, 208, - 0, 528, 529, 3, 417, 208, 0, 529, 58, 1, 0, 0, 0, 530, 531, 3, 395, 197, - 0, 531, 532, 3, 417, 208, 0, 532, 533, 3, 433, 216, 0, 533, 534, 3, 403, - 201, 0, 534, 535, 3, 429, 214, 0, 535, 60, 1, 0, 0, 0, 536, 537, 3, 395, - 197, 0, 537, 538, 3, 421, 210, 0, 538, 539, 3, 395, 197, 0, 539, 540, 3, - 417, 208, 0, 540, 541, 3, 443, 221, 0, 541, 542, 3, 445, 222, 0, 542, 543, - 3, 403, 201, 0, 543, 62, 1, 0, 0, 0, 544, 545, 3, 395, 197, 0, 545, 546, - 3, 421, 210, 0, 546, 547, 3, 401, 200, 0, 547, 64, 1, 0, 0, 0, 548, 549, - 3, 395, 197, 0, 549, 550, 3, 431, 215, 0, 550, 66, 1, 0, 0, 0, 551, 552, - 3, 395, 197, 0, 552, 553, 3, 431, 215, 0, 553, 554, 3, 399, 199, 0, 554, - 68, 1, 0, 0, 0, 555, 556, 3, 395, 197, 0, 556, 557, 3, 433, 216, 0, 557, - 558, 3, 433, 216, 0, 558, 559, 3, 395, 197, 0, 559, 560, 3, 399, 199, 0, - 560, 561, 3, 409, 204, 0, 561, 70, 1, 0, 0, 0, 562, 563, 3, 395, 197, 0, - 563, 564, 3, 435, 217, 0, 564, 565, 3, 433, 216, 0, 565, 566, 3, 423, 211, - 0, 566, 567, 3, 411, 205, 0, 567, 568, 3, 421, 210, 0, 568, 569, 3, 399, - 199, 0, 569, 570, 3, 429, 214, 0, 570, 571, 3, 403, 201, 0, 571, 572, 3, - 419, 209, 0, 572, 573, 3, 403, 201, 0, 573, 574, 3, 421, 210, 0, 574, 575, - 3, 433, 216, 0, 575, 72, 1, 0, 0, 0, 576, 577, 3, 397, 198, 0, 577, 578, - 3, 403, 201, 0, 578, 579, 3, 405, 202, 0, 579, 580, 3, 423, 211, 0, 580, - 581, 3, 429, 214, 0, 581, 582, 3, 403, 201, 0, 582, 74, 1, 0, 0, 0, 583, - 584, 3, 397, 198, 0, 584, 585, 3, 403, 201, 0, 585, 586, 3, 407, 203, 0, - 586, 587, 3, 411, 205, 0, 587, 588, 3, 421, 210, 0, 588, 76, 1, 0, 0, 0, - 589, 590, 3, 397, 198, 0, 590, 591, 3, 403, 201, 0, 591, 592, 3, 433, 216, - 0, 592, 593, 3, 439, 219, 0, 593, 594, 3, 403, 201, 0, 594, 595, 3, 403, - 201, 0, 595, 596, 3, 421, 210, 0, 596, 78, 1, 0, 0, 0, 597, 598, 3, 397, - 198, 0, 598, 599, 3, 443, 221, 0, 599, 80, 1, 0, 0, 0, 600, 601, 3, 399, - 199, 0, 601, 602, 3, 395, 197, 0, 602, 603, 3, 431, 215, 0, 603, 604, 3, - 399, 199, 0, 604, 605, 3, 395, 197, 0, 605, 606, 3, 401, 200, 0, 606, 607, - 3, 403, 201, 0, 607, 82, 1, 0, 0, 0, 608, 609, 3, 399, 199, 0, 609, 610, - 3, 395, 197, 0, 610, 611, 3, 431, 215, 0, 611, 612, 3, 403, 201, 0, 612, - 84, 1, 0, 0, 0, 613, 614, 3, 399, 199, 0, 614, 615, 3, 395, 197, 0, 615, - 616, 3, 431, 215, 0, 616, 617, 3, 433, 216, 0, 617, 86, 1, 0, 0, 0, 618, - 619, 3, 399, 199, 0, 619, 620, 3, 409, 204, 0, 620, 621, 3, 403, 201, 0, - 621, 622, 3, 399, 199, 0, 622, 623, 3, 415, 207, 0, 623, 88, 1, 0, 0, 0, - 624, 625, 3, 399, 199, 0, 625, 626, 3, 423, 211, 0, 626, 627, 3, 417, 208, - 0, 627, 628, 3, 417, 208, 0, 628, 629, 3, 395, 197, 0, 629, 630, 3, 433, - 216, 0, 630, 631, 3, 403, 201, 0, 631, 90, 1, 0, 0, 0, 632, 633, 3, 399, - 199, 0, 633, 634, 3, 423, 211, 0, 634, 635, 3, 417, 208, 0, 635, 636, 3, - 435, 217, 0, 636, 637, 3, 419, 209, 0, 637, 638, 3, 421, 210, 0, 638, 92, - 1, 0, 0, 0, 639, 640, 3, 399, 199, 0, 640, 641, 3, 423, 211, 0, 641, 642, - 3, 419, 209, 0, 642, 643, 3, 419, 209, 0, 643, 644, 3, 411, 205, 0, 644, - 645, 3, 433, 216, 0, 645, 94, 1, 0, 0, 0, 646, 647, 3, 399, 199, 0, 647, - 648, 3, 423, 211, 0, 648, 649, 3, 421, 210, 0, 649, 650, 3, 405, 202, 0, - 650, 651, 3, 417, 208, 0, 651, 652, 3, 411, 205, 0, 652, 653, 3, 399, 199, - 0, 653, 654, 3, 433, 216, 0, 654, 96, 1, 0, 0, 0, 655, 656, 3, 399, 199, - 0, 656, 657, 3, 423, 211, 0, 657, 658, 3, 421, 210, 0, 658, 659, 3, 431, - 215, 0, 659, 660, 3, 433, 216, 0, 660, 661, 3, 429, 214, 0, 661, 662, 3, - 395, 197, 0, 662, 663, 3, 411, 205, 0, 663, 664, 3, 421, 210, 0, 664, 665, - 3, 433, 216, 0, 665, 98, 1, 0, 0, 0, 666, 667, 3, 399, 199, 0, 667, 668, - 3, 429, 214, 0, 668, 669, 3, 403, 201, 0, 669, 670, 3, 395, 197, 0, 670, - 671, 3, 433, 216, 0, 671, 672, 3, 403, 201, 0, 672, 100, 1, 0, 0, 0, 673, - 674, 3, 399, 199, 0, 674, 675, 3, 429, 214, 0, 675, 676, 3, 423, 211, 0, - 676, 677, 3, 431, 215, 0, 677, 678, 3, 431, 215, 0, 678, 102, 1, 0, 0, - 0, 679, 680, 3, 399, 199, 0, 680, 681, 3, 435, 217, 0, 681, 682, 3, 429, - 214, 0, 682, 683, 3, 429, 214, 0, 683, 684, 3, 403, 201, 0, 684, 685, 3, - 421, 210, 0, 685, 686, 3, 433, 216, 0, 686, 687, 5, 95, 0, 0, 687, 688, - 3, 401, 200, 0, 688, 689, 3, 395, 197, 0, 689, 690, 3, 433, 216, 0, 690, - 691, 3, 403, 201, 0, 691, 104, 1, 0, 0, 0, 692, 693, 3, 399, 199, 0, 693, - 694, 3, 435, 217, 0, 694, 695, 3, 429, 214, 0, 695, 696, 3, 429, 214, 0, - 696, 697, 3, 403, 201, 0, 697, 698, 3, 421, 210, 0, 698, 699, 3, 433, 216, - 0, 699, 700, 5, 95, 0, 0, 700, 701, 3, 433, 216, 0, 701, 702, 3, 411, 205, - 0, 702, 703, 3, 419, 209, 0, 703, 704, 3, 403, 201, 0, 704, 106, 1, 0, - 0, 0, 705, 706, 3, 399, 199, 0, 706, 707, 3, 435, 217, 0, 707, 708, 3, - 429, 214, 0, 708, 709, 3, 429, 214, 0, 709, 710, 3, 403, 201, 0, 710, 711, - 3, 421, 210, 0, 711, 712, 3, 433, 216, 0, 712, 713, 5, 95, 0, 0, 713, 714, - 3, 433, 216, 0, 714, 715, 3, 411, 205, 0, 715, 716, 3, 419, 209, 0, 716, - 717, 3, 403, 201, 0, 717, 718, 3, 431, 215, 0, 718, 719, 3, 433, 216, 0, - 719, 720, 3, 395, 197, 0, 720, 721, 3, 419, 209, 0, 721, 722, 3, 425, 212, - 0, 722, 108, 1, 0, 0, 0, 723, 724, 3, 401, 200, 0, 724, 725, 3, 395, 197, - 0, 725, 726, 3, 433, 216, 0, 726, 727, 3, 395, 197, 0, 727, 728, 3, 397, - 198, 0, 728, 729, 3, 395, 197, 0, 729, 730, 3, 431, 215, 0, 730, 731, 3, - 403, 201, 0, 731, 110, 1, 0, 0, 0, 732, 733, 3, 401, 200, 0, 733, 734, - 3, 403, 201, 0, 734, 735, 3, 405, 202, 0, 735, 736, 3, 395, 197, 0, 736, - 737, 3, 435, 217, 0, 737, 738, 3, 417, 208, 0, 738, 739, 3, 433, 216, 0, - 739, 112, 1, 0, 0, 0, 740, 741, 3, 401, 200, 0, 741, 742, 3, 403, 201, - 0, 742, 743, 3, 405, 202, 0, 743, 744, 3, 403, 201, 0, 744, 745, 3, 429, - 214, 0, 745, 746, 3, 429, 214, 0, 746, 747, 3, 395, 197, 0, 747, 748, 3, - 397, 198, 0, 748, 749, 3, 417, 208, 0, 749, 750, 3, 403, 201, 0, 750, 114, - 1, 0, 0, 0, 751, 752, 3, 401, 200, 0, 752, 753, 3, 403, 201, 0, 753, 754, - 3, 405, 202, 0, 754, 755, 3, 403, 201, 0, 755, 756, 3, 429, 214, 0, 756, - 757, 3, 429, 214, 0, 757, 758, 3, 403, 201, 0, 758, 759, 3, 401, 200, 0, - 759, 116, 1, 0, 0, 0, 760, 761, 3, 401, 200, 0, 761, 762, 3, 403, 201, - 0, 762, 763, 3, 417, 208, 0, 763, 764, 3, 403, 201, 0, 764, 765, 3, 433, - 216, 0, 765, 766, 3, 403, 201, 0, 766, 118, 1, 0, 0, 0, 767, 768, 3, 401, - 200, 0, 768, 769, 3, 403, 201, 0, 769, 770, 3, 431, 215, 0, 770, 771, 3, - 399, 199, 0, 771, 120, 1, 0, 0, 0, 772, 773, 3, 401, 200, 0, 773, 774, - 3, 403, 201, 0, 774, 775, 3, 433, 216, 0, 775, 776, 3, 395, 197, 0, 776, - 777, 3, 399, 199, 0, 777, 778, 3, 409, 204, 0, 778, 122, 1, 0, 0, 0, 779, - 780, 3, 401, 200, 0, 780, 781, 3, 411, 205, 0, 781, 782, 3, 431, 215, 0, - 782, 783, 3, 433, 216, 0, 783, 784, 3, 411, 205, 0, 784, 785, 3, 421, 210, - 0, 785, 786, 3, 399, 199, 0, 786, 787, 3, 433, 216, 0, 787, 124, 1, 0, - 0, 0, 788, 789, 3, 401, 200, 0, 789, 790, 3, 429, 214, 0, 790, 791, 3, - 423, 211, 0, 791, 792, 3, 425, 212, 0, 792, 126, 1, 0, 0, 0, 793, 794, - 3, 403, 201, 0, 794, 795, 3, 395, 197, 0, 795, 796, 3, 399, 199, 0, 796, - 797, 3, 409, 204, 0, 797, 128, 1, 0, 0, 0, 798, 799, 3, 403, 201, 0, 799, - 800, 3, 417, 208, 0, 800, 801, 3, 431, 215, 0, 801, 802, 3, 403, 201, 0, - 802, 130, 1, 0, 0, 0, 803, 804, 3, 403, 201, 0, 804, 805, 3, 421, 210, - 0, 805, 806, 3, 401, 200, 0, 806, 132, 1, 0, 0, 0, 807, 808, 3, 403, 201, - 0, 808, 809, 3, 431, 215, 0, 809, 810, 3, 399, 199, 0, 810, 811, 3, 395, - 197, 0, 811, 812, 3, 425, 212, 0, 812, 813, 3, 403, 201, 0, 813, 134, 1, - 0, 0, 0, 814, 815, 3, 403, 201, 0, 815, 816, 3, 441, 220, 0, 816, 817, - 3, 399, 199, 0, 817, 818, 3, 403, 201, 0, 818, 819, 3, 425, 212, 0, 819, - 820, 3, 433, 216, 0, 820, 136, 1, 0, 0, 0, 821, 822, 3, 403, 201, 0, 822, - 823, 3, 441, 220, 0, 823, 824, 3, 399, 199, 0, 824, 825, 3, 417, 208, 0, - 825, 826, 3, 435, 217, 0, 826, 827, 3, 431, 215, 0, 827, 828, 3, 411, 205, - 0, 828, 829, 3, 437, 218, 0, 829, 830, 3, 403, 201, 0, 830, 138, 1, 0, - 0, 0, 831, 832, 3, 403, 201, 0, 832, 833, 3, 441, 220, 0, 833, 834, 3, - 411, 205, 0, 834, 835, 3, 431, 215, 0, 835, 836, 3, 433, 216, 0, 836, 837, - 3, 431, 215, 0, 837, 140, 1, 0, 0, 0, 838, 839, 3, 403, 201, 0, 839, 840, - 3, 441, 220, 0, 840, 841, 3, 425, 212, 0, 841, 842, 3, 417, 208, 0, 842, - 843, 3, 395, 197, 0, 843, 844, 3, 411, 205, 0, 844, 845, 3, 421, 210, 0, - 845, 142, 1, 0, 0, 0, 846, 847, 3, 405, 202, 0, 847, 848, 3, 395, 197, - 0, 848, 849, 3, 411, 205, 0, 849, 850, 3, 417, 208, 0, 850, 144, 1, 0, - 0, 0, 851, 852, 3, 405, 202, 0, 852, 853, 3, 423, 211, 0, 853, 854, 3, - 429, 214, 0, 854, 146, 1, 0, 0, 0, 855, 856, 3, 405, 202, 0, 856, 857, - 3, 423, 211, 0, 857, 858, 3, 429, 214, 0, 858, 859, 3, 403, 201, 0, 859, - 860, 3, 411, 205, 0, 860, 861, 3, 407, 203, 0, 861, 862, 3, 421, 210, 0, - 862, 148, 1, 0, 0, 0, 863, 864, 3, 405, 202, 0, 864, 865, 3, 429, 214, - 0, 865, 866, 3, 423, 211, 0, 866, 867, 3, 419, 209, 0, 867, 150, 1, 0, - 0, 0, 868, 869, 3, 405, 202, 0, 869, 870, 3, 435, 217, 0, 870, 871, 3, - 417, 208, 0, 871, 872, 3, 417, 208, 0, 872, 152, 1, 0, 0, 0, 873, 874, - 3, 407, 203, 0, 874, 875, 3, 417, 208, 0, 875, 876, 3, 423, 211, 0, 876, - 877, 3, 397, 198, 0, 877, 154, 1, 0, 0, 0, 878, 879, 3, 407, 203, 0, 879, - 880, 3, 429, 214, 0, 880, 881, 3, 423, 211, 0, 881, 882, 3, 435, 217, 0, - 882, 883, 3, 425, 212, 0, 883, 156, 1, 0, 0, 0, 884, 885, 3, 409, 204, - 0, 885, 886, 3, 395, 197, 0, 886, 887, 3, 437, 218, 0, 887, 888, 3, 411, - 205, 0, 888, 889, 3, 421, 210, 0, 889, 890, 3, 407, 203, 0, 890, 158, 1, - 0, 0, 0, 891, 892, 3, 411, 205, 0, 892, 893, 3, 405, 202, 0, 893, 160, - 1, 0, 0, 0, 894, 895, 3, 411, 205, 0, 895, 896, 3, 407, 203, 0, 896, 897, - 3, 421, 210, 0, 897, 898, 3, 423, 211, 0, 898, 899, 3, 429, 214, 0, 899, - 900, 3, 403, 201, 0, 900, 162, 1, 0, 0, 0, 901, 902, 3, 411, 205, 0, 902, - 903, 3, 419, 209, 0, 903, 904, 3, 419, 209, 0, 904, 905, 3, 403, 201, 0, - 905, 906, 3, 401, 200, 0, 906, 907, 3, 411, 205, 0, 907, 908, 3, 395, 197, - 0, 908, 909, 3, 433, 216, 0, 909, 910, 3, 403, 201, 0, 910, 164, 1, 0, - 0, 0, 911, 912, 3, 411, 205, 0, 912, 913, 3, 421, 210, 0, 913, 166, 1, - 0, 0, 0, 914, 915, 3, 411, 205, 0, 915, 916, 3, 421, 210, 0, 916, 917, - 3, 401, 200, 0, 917, 918, 3, 403, 201, 0, 918, 919, 3, 441, 220, 0, 919, - 168, 1, 0, 0, 0, 920, 921, 3, 411, 205, 0, 921, 922, 3, 421, 210, 0, 922, - 923, 3, 401, 200, 0, 923, 924, 3, 403, 201, 0, 924, 925, 3, 441, 220, 0, - 925, 926, 3, 403, 201, 0, 926, 927, 3, 401, 200, 0, 927, 170, 1, 0, 0, - 0, 928, 929, 3, 411, 205, 0, 929, 930, 3, 421, 210, 0, 930, 931, 3, 411, - 205, 0, 931, 932, 3, 433, 216, 0, 932, 933, 3, 411, 205, 0, 933, 934, 3, - 395, 197, 0, 934, 935, 3, 417, 208, 0, 935, 936, 3, 417, 208, 0, 936, 937, - 3, 443, 221, 0, 937, 172, 1, 0, 0, 0, 938, 939, 3, 411, 205, 0, 939, 940, - 3, 421, 210, 0, 940, 941, 3, 421, 210, 0, 941, 942, 3, 403, 201, 0, 942, - 943, 3, 429, 214, 0, 943, 174, 1, 0, 0, 0, 944, 945, 3, 411, 205, 0, 945, - 946, 3, 421, 210, 0, 946, 947, 3, 431, 215, 0, 947, 948, 3, 403, 201, 0, - 948, 949, 3, 429, 214, 0, 949, 950, 3, 433, 216, 0, 950, 176, 1, 0, 0, - 0, 951, 952, 3, 411, 205, 0, 952, 953, 3, 421, 210, 0, 953, 954, 3, 431, - 215, 0, 954, 955, 3, 433, 216, 0, 955, 956, 3, 403, 201, 0, 956, 957, 3, - 395, 197, 0, 957, 958, 3, 401, 200, 0, 958, 178, 1, 0, 0, 0, 959, 960, - 3, 411, 205, 0, 960, 961, 3, 421, 210, 0, 961, 962, 3, 433, 216, 0, 962, - 963, 3, 403, 201, 0, 963, 964, 3, 429, 214, 0, 964, 965, 3, 431, 215, 0, - 965, 966, 3, 403, 201, 0, 966, 967, 3, 399, 199, 0, 967, 968, 3, 433, 216, - 0, 968, 180, 1, 0, 0, 0, 969, 970, 3, 411, 205, 0, 970, 971, 3, 421, 210, - 0, 971, 972, 3, 433, 216, 0, 972, 973, 3, 423, 211, 0, 973, 182, 1, 0, - 0, 0, 974, 975, 3, 411, 205, 0, 975, 976, 3, 431, 215, 0, 976, 184, 1, - 0, 0, 0, 977, 978, 3, 411, 205, 0, 978, 979, 3, 431, 215, 0, 979, 980, - 3, 421, 210, 0, 980, 981, 3, 435, 217, 0, 981, 982, 3, 417, 208, 0, 982, - 983, 3, 417, 208, 0, 983, 186, 1, 0, 0, 0, 984, 985, 3, 413, 206, 0, 985, - 986, 3, 423, 211, 0, 986, 987, 3, 411, 205, 0, 987, 988, 3, 421, 210, 0, - 988, 188, 1, 0, 0, 0, 989, 990, 3, 415, 207, 0, 990, 991, 3, 403, 201, - 0, 991, 992, 3, 443, 221, 0, 992, 190, 1, 0, 0, 0, 993, 994, 3, 417, 208, - 0, 994, 995, 3, 403, 201, 0, 995, 996, 3, 405, 202, 0, 996, 997, 3, 433, - 216, 0, 997, 192, 1, 0, 0, 0, 998, 999, 3, 417, 208, 0, 999, 1000, 3, 411, - 205, 0, 1000, 1001, 3, 415, 207, 0, 1001, 1002, 3, 403, 201, 0, 1002, 194, - 1, 0, 0, 0, 1003, 1004, 3, 417, 208, 0, 1004, 1005, 3, 411, 205, 0, 1005, - 1006, 3, 419, 209, 0, 1006, 1007, 3, 411, 205, 0, 1007, 1008, 3, 433, 216, - 0, 1008, 196, 1, 0, 0, 0, 1009, 1010, 3, 419, 209, 0, 1010, 1011, 3, 395, - 197, 0, 1011, 1012, 3, 433, 216, 0, 1012, 1013, 3, 399, 199, 0, 1013, 1014, - 3, 409, 204, 0, 1014, 198, 1, 0, 0, 0, 1015, 1016, 3, 421, 210, 0, 1016, - 1017, 3, 395, 197, 0, 1017, 1018, 3, 433, 216, 0, 1018, 1019, 3, 435, 217, - 0, 1019, 1020, 3, 429, 214, 0, 1020, 1021, 3, 395, 197, 0, 1021, 1022, - 3, 417, 208, 0, 1022, 200, 1, 0, 0, 0, 1023, 1024, 3, 421, 210, 0, 1024, - 1025, 3, 423, 211, 0, 1025, 202, 1, 0, 0, 0, 1026, 1027, 3, 421, 210, 0, - 1027, 1028, 3, 423, 211, 0, 1028, 1029, 3, 433, 216, 0, 1029, 204, 1, 0, - 0, 0, 1030, 1031, 3, 421, 210, 0, 1031, 1032, 3, 423, 211, 0, 1032, 1033, - 3, 433, 216, 0, 1033, 1034, 3, 421, 210, 0, 1034, 1035, 3, 435, 217, 0, - 1035, 1036, 3, 417, 208, 0, 1036, 1037, 3, 417, 208, 0, 1037, 206, 1, 0, - 0, 0, 1038, 1039, 3, 421, 210, 0, 1039, 1040, 3, 435, 217, 0, 1040, 1041, - 3, 417, 208, 0, 1041, 1042, 3, 417, 208, 0, 1042, 208, 1, 0, 0, 0, 1043, - 1044, 3, 423, 211, 0, 1044, 1045, 3, 405, 202, 0, 1045, 210, 1, 0, 0, 0, - 1046, 1047, 3, 423, 211, 0, 1047, 1048, 3, 405, 202, 0, 1048, 1049, 3, - 405, 202, 0, 1049, 1050, 3, 431, 215, 0, 1050, 1051, 3, 403, 201, 0, 1051, - 1052, 3, 433, 216, 0, 1052, 212, 1, 0, 0, 0, 1053, 1054, 3, 423, 211, 0, - 1054, 1055, 3, 421, 210, 0, 1055, 214, 1, 0, 0, 0, 1056, 1057, 3, 423, - 211, 0, 1057, 1058, 3, 429, 214, 0, 1058, 216, 1, 0, 0, 0, 1059, 1060, - 3, 423, 211, 0, 1060, 1061, 3, 429, 214, 0, 1061, 1062, 3, 401, 200, 0, - 1062, 1063, 3, 403, 201, 0, 1063, 1064, 3, 429, 214, 0, 1064, 218, 1, 0, - 0, 0, 1065, 1066, 3, 423, 211, 0, 1066, 1067, 3, 435, 217, 0, 1067, 1068, - 3, 433, 216, 0, 1068, 1069, 3, 403, 201, 0, 1069, 1070, 3, 429, 214, 0, - 1070, 220, 1, 0, 0, 0, 1071, 1072, 3, 425, 212, 0, 1072, 1073, 3, 417, - 208, 0, 1073, 1074, 3, 395, 197, 0, 1074, 1075, 3, 421, 210, 0, 1075, 222, - 1, 0, 0, 0, 1076, 1077, 3, 425, 212, 0, 1077, 1078, 3, 429, 214, 0, 1078, - 1079, 3, 395, 197, 0, 1079, 1080, 3, 407, 203, 0, 1080, 1081, 3, 419, 209, - 0, 1081, 1082, 3, 395, 197, 0, 1082, 224, 1, 0, 0, 0, 1083, 1084, 3, 425, - 212, 0, 1084, 1085, 3, 429, 214, 0, 1085, 1086, 3, 411, 205, 0, 1086, 1087, - 3, 419, 209, 0, 1087, 1088, 3, 395, 197, 0, 1088, 1089, 3, 429, 214, 0, - 1089, 1090, 3, 443, 221, 0, 1090, 226, 1, 0, 0, 0, 1091, 1092, 3, 427, - 213, 0, 1092, 1093, 3, 435, 217, 0, 1093, 1094, 3, 403, 201, 0, 1094, 1095, - 3, 429, 214, 0, 1095, 1096, 3, 443, 221, 0, 1096, 228, 1, 0, 0, 0, 1097, - 1098, 3, 429, 214, 0, 1098, 1099, 3, 395, 197, 0, 1099, 1100, 3, 411, 205, - 0, 1100, 1101, 3, 431, 215, 0, 1101, 1102, 3, 403, 201, 0, 1102, 230, 1, - 0, 0, 0, 1103, 1104, 3, 429, 214, 0, 1104, 1105, 3, 403, 201, 0, 1105, - 1106, 3, 399, 199, 0, 1106, 1107, 3, 435, 217, 0, 1107, 1108, 3, 429, 214, - 0, 1108, 1109, 3, 431, 215, 0, 1109, 1110, 3, 411, 205, 0, 1110, 1111, - 3, 437, 218, 0, 1111, 1112, 3, 403, 201, 0, 1112, 232, 1, 0, 0, 0, 1113, - 1114, 3, 429, 214, 0, 1114, 1115, 3, 403, 201, 0, 1115, 1116, 3, 405, 202, - 0, 1116, 1117, 3, 403, 201, 0, 1117, 1118, 3, 429, 214, 0, 1118, 1119, - 3, 403, 201, 0, 1119, 1120, 3, 421, 210, 0, 1120, 1121, 3, 399, 199, 0, - 1121, 1122, 3, 403, 201, 0, 1122, 1123, 3, 431, 215, 0, 1123, 234, 1, 0, - 0, 0, 1124, 1125, 3, 429, 214, 0, 1125, 1126, 3, 403, 201, 0, 1126, 1127, - 3, 407, 203, 0, 1127, 1128, 3, 403, 201, 0, 1128, 1129, 3, 441, 220, 0, - 1129, 1130, 3, 425, 212, 0, 1130, 236, 1, 0, 0, 0, 1131, 1132, 3, 429, - 214, 0, 1132, 1133, 3, 403, 201, 0, 1133, 1134, 3, 411, 205, 0, 1134, 1135, - 3, 421, 210, 0, 1135, 1136, 3, 401, 200, 0, 1136, 1137, 3, 403, 201, 0, - 1137, 1138, 3, 441, 220, 0, 1138, 238, 1, 0, 0, 0, 1139, 1140, 3, 429, - 214, 0, 1140, 1141, 3, 403, 201, 0, 1141, 1142, 3, 417, 208, 0, 1142, 1143, - 3, 403, 201, 0, 1143, 1144, 3, 395, 197, 0, 1144, 1145, 3, 431, 215, 0, - 1145, 1146, 3, 403, 201, 0, 1146, 240, 1, 0, 0, 0, 1147, 1148, 3, 429, - 214, 0, 1148, 1149, 3, 403, 201, 0, 1149, 1150, 3, 421, 210, 0, 1150, 1151, - 3, 395, 197, 0, 1151, 1152, 3, 419, 209, 0, 1152, 1153, 3, 403, 201, 0, - 1153, 242, 1, 0, 0, 0, 1154, 1155, 3, 429, 214, 0, 1155, 1156, 3, 403, - 201, 0, 1156, 1157, 3, 425, 212, 0, 1157, 1158, 3, 417, 208, 0, 1158, 1159, - 3, 395, 197, 0, 1159, 1160, 3, 399, 199, 0, 1160, 1161, 3, 403, 201, 0, - 1161, 244, 1, 0, 0, 0, 1162, 1163, 3, 429, 214, 0, 1163, 1164, 3, 403, - 201, 0, 1164, 1165, 3, 431, 215, 0, 1165, 1166, 3, 433, 216, 0, 1166, 1167, - 3, 429, 214, 0, 1167, 1168, 3, 411, 205, 0, 1168, 1169, 3, 399, 199, 0, - 1169, 1170, 3, 433, 216, 0, 1170, 246, 1, 0, 0, 0, 1171, 1172, 3, 429, - 214, 0, 1172, 1173, 3, 403, 201, 0, 1173, 1174, 3, 433, 216, 0, 1174, 1175, - 3, 435, 217, 0, 1175, 1176, 3, 429, 214, 0, 1176, 1177, 3, 421, 210, 0, - 1177, 1178, 3, 411, 205, 0, 1178, 1179, 3, 421, 210, 0, 1179, 1180, 3, - 407, 203, 0, 1180, 248, 1, 0, 0, 0, 1181, 1182, 3, 429, 214, 0, 1182, 1183, - 3, 411, 205, 0, 1183, 1184, 3, 407, 203, 0, 1184, 1185, 3, 409, 204, 0, - 1185, 1186, 3, 433, 216, 0, 1186, 250, 1, 0, 0, 0, 1187, 1188, 3, 429, - 214, 0, 1188, 1189, 3, 423, 211, 0, 1189, 1190, 3, 417, 208, 0, 1190, 1191, - 3, 417, 208, 0, 1191, 1192, 3, 397, 198, 0, 1192, 1193, 3, 395, 197, 0, - 1193, 1194, 3, 399, 199, 0, 1194, 1195, 3, 415, 207, 0, 1195, 252, 1, 0, - 0, 0, 1196, 1197, 3, 429, 214, 0, 1197, 1198, 3, 423, 211, 0, 1198, 1199, - 3, 439, 219, 0, 1199, 254, 1, 0, 0, 0, 1200, 1201, 3, 429, 214, 0, 1201, - 1202, 3, 423, 211, 0, 1202, 1203, 3, 439, 219, 0, 1203, 1204, 3, 431, 215, - 0, 1204, 256, 1, 0, 0, 0, 1205, 1206, 3, 431, 215, 0, 1206, 1207, 3, 395, - 197, 0, 1207, 1208, 3, 437, 218, 0, 1208, 1209, 3, 403, 201, 0, 1209, 1210, - 3, 425, 212, 0, 1210, 1211, 3, 423, 211, 0, 1211, 1212, 3, 411, 205, 0, - 1212, 1213, 3, 421, 210, 0, 1213, 1214, 3, 433, 216, 0, 1214, 258, 1, 0, - 0, 0, 1215, 1216, 3, 431, 215, 0, 1216, 1217, 3, 403, 201, 0, 1217, 1218, - 3, 417, 208, 0, 1218, 1219, 3, 403, 201, 0, 1219, 1220, 3, 399, 199, 0, - 1220, 1221, 3, 433, 216, 0, 1221, 260, 1, 0, 0, 0, 1222, 1223, 3, 431, - 215, 0, 1223, 1224, 3, 403, 201, 0, 1224, 1225, 3, 433, 216, 0, 1225, 262, - 1, 0, 0, 0, 1226, 1227, 3, 431, 215, 0, 1227, 1228, 3, 433, 216, 0, 1228, - 1229, 3, 429, 214, 0, 1229, 1230, 3, 411, 205, 0, 1230, 1231, 3, 399, 199, - 0, 1231, 1232, 3, 433, 216, 0, 1232, 264, 1, 0, 0, 0, 1233, 1234, 3, 433, - 216, 0, 1234, 1235, 3, 395, 197, 0, 1235, 1236, 3, 397, 198, 0, 1236, 1237, - 3, 417, 208, 0, 1237, 1238, 3, 403, 201, 0, 1238, 266, 1, 0, 0, 0, 1239, - 1240, 3, 433, 216, 0, 1240, 1241, 3, 403, 201, 0, 1241, 1242, 3, 419, 209, - 0, 1242, 1243, 3, 425, 212, 0, 1243, 268, 1, 0, 0, 0, 1244, 1245, 3, 433, - 216, 0, 1245, 1246, 3, 403, 201, 0, 1246, 1247, 3, 419, 209, 0, 1247, 1248, - 3, 425, 212, 0, 1248, 1249, 3, 423, 211, 0, 1249, 1250, 3, 429, 214, 0, - 1250, 1251, 3, 395, 197, 0, 1251, 1252, 3, 429, 214, 0, 1252, 1253, 3, - 443, 221, 0, 1253, 270, 1, 0, 0, 0, 1254, 1255, 3, 433, 216, 0, 1255, 1256, - 3, 409, 204, 0, 1256, 1257, 3, 403, 201, 0, 1257, 1258, 3, 421, 210, 0, - 1258, 272, 1, 0, 0, 0, 1259, 1260, 3, 433, 216, 0, 1260, 1261, 3, 423, - 211, 0, 1261, 274, 1, 0, 0, 0, 1262, 1263, 3, 433, 216, 0, 1263, 1264, - 3, 429, 214, 0, 1264, 1265, 3, 395, 197, 0, 1265, 1266, 3, 421, 210, 0, - 1266, 1267, 3, 431, 215, 0, 1267, 1268, 3, 395, 197, 0, 1268, 1269, 3, - 399, 199, 0, 1269, 1270, 3, 433, 216, 0, 1270, 1271, 3, 411, 205, 0, 1271, - 1272, 3, 423, 211, 0, 1272, 1273, 3, 421, 210, 0, 1273, 276, 1, 0, 0, 0, - 1274, 1275, 3, 433, 216, 0, 1275, 1276, 3, 429, 214, 0, 1276, 1277, 3, - 411, 205, 0, 1277, 1278, 3, 407, 203, 0, 1278, 1279, 3, 407, 203, 0, 1279, - 1280, 3, 403, 201, 0, 1280, 1281, 3, 429, 214, 0, 1281, 278, 1, 0, 0, 0, - 1282, 1283, 3, 435, 217, 0, 1283, 1284, 3, 421, 210, 0, 1284, 1285, 3, - 411, 205, 0, 1285, 1286, 3, 423, 211, 0, 1286, 1287, 3, 421, 210, 0, 1287, - 280, 1, 0, 0, 0, 1288, 1289, 3, 435, 217, 0, 1289, 1290, 3, 421, 210, 0, - 1290, 1291, 3, 411, 205, 0, 1291, 1292, 3, 427, 213, 0, 1292, 1293, 3, - 435, 217, 0, 1293, 1294, 3, 403, 201, 0, 1294, 282, 1, 0, 0, 0, 1295, 1296, - 3, 435, 217, 0, 1296, 1297, 3, 425, 212, 0, 1297, 1298, 3, 401, 200, 0, - 1298, 1299, 3, 395, 197, 0, 1299, 1300, 3, 433, 216, 0, 1300, 1301, 3, - 403, 201, 0, 1301, 284, 1, 0, 0, 0, 1302, 1303, 3, 435, 217, 0, 1303, 1304, - 3, 431, 215, 0, 1304, 1305, 3, 411, 205, 0, 1305, 1306, 3, 421, 210, 0, - 1306, 1307, 3, 407, 203, 0, 1307, 286, 1, 0, 0, 0, 1308, 1309, 3, 437, - 218, 0, 1309, 1310, 3, 395, 197, 0, 1310, 1311, 3, 399, 199, 0, 1311, 1312, - 3, 435, 217, 0, 1312, 1313, 3, 435, 217, 0, 1313, 1314, 3, 419, 209, 0, - 1314, 288, 1, 0, 0, 0, 1315, 1316, 3, 437, 218, 0, 1316, 1317, 3, 395, - 197, 0, 1317, 1318, 3, 417, 208, 0, 1318, 1319, 3, 435, 217, 0, 1319, 1320, - 3, 403, 201, 0, 1320, 1321, 3, 431, 215, 0, 1321, 290, 1, 0, 0, 0, 1322, - 1323, 3, 437, 218, 0, 1323, 1324, 3, 411, 205, 0, 1324, 1325, 3, 403, 201, - 0, 1325, 1326, 3, 439, 219, 0, 1326, 292, 1, 0, 0, 0, 1327, 1328, 3, 437, - 218, 0, 1328, 1329, 3, 411, 205, 0, 1329, 1330, 3, 429, 214, 0, 1330, 1331, - 3, 433, 216, 0, 1331, 1332, 3, 435, 217, 0, 1332, 1333, 3, 395, 197, 0, - 1333, 1334, 3, 417, 208, 0, 1334, 294, 1, 0, 0, 0, 1335, 1336, 3, 439, - 219, 0, 1336, 1337, 3, 409, 204, 0, 1337, 1338, 3, 403, 201, 0, 1338, 1339, - 3, 421, 210, 0, 1339, 296, 1, 0, 0, 0, 1340, 1341, 3, 439, 219, 0, 1341, - 1342, 3, 409, 204, 0, 1342, 1343, 3, 403, 201, 0, 1343, 1344, 3, 429, 214, - 0, 1344, 1345, 3, 403, 201, 0, 1345, 298, 1, 0, 0, 0, 1346, 1347, 3, 439, - 219, 0, 1347, 1348, 3, 411, 205, 0, 1348, 1349, 3, 433, 216, 0, 1349, 1350, - 3, 409, 204, 0, 1350, 300, 1, 0, 0, 0, 1351, 1352, 3, 439, 219, 0, 1352, - 1353, 3, 411, 205, 0, 1353, 1354, 3, 433, 216, 0, 1354, 1355, 3, 409, 204, - 0, 1355, 1356, 3, 423, 211, 0, 1356, 1357, 3, 435, 217, 0, 1357, 1358, - 3, 433, 216, 0, 1358, 302, 1, 0, 0, 0, 1359, 1360, 3, 405, 202, 0, 1360, - 1361, 3, 411, 205, 0, 1361, 1362, 3, 429, 214, 0, 1362, 1363, 3, 431, 215, - 0, 1363, 1364, 3, 433, 216, 0, 1364, 1365, 5, 95, 0, 0, 1365, 1366, 3, - 437, 218, 0, 1366, 1367, 3, 395, 197, 0, 1367, 1368, 3, 417, 208, 0, 1368, - 1369, 3, 435, 217, 0, 1369, 1370, 3, 403, 201, 0, 1370, 304, 1, 0, 0, 0, - 1371, 1372, 3, 423, 211, 0, 1372, 1373, 3, 437, 218, 0, 1373, 1374, 3, - 403, 201, 0, 1374, 1375, 3, 429, 214, 0, 1375, 306, 1, 0, 0, 0, 1376, 1377, - 3, 425, 212, 0, 1377, 1378, 3, 395, 197, 0, 1378, 1379, 3, 429, 214, 0, - 1379, 1380, 3, 433, 216, 0, 1380, 1381, 3, 411, 205, 0, 1381, 1382, 3, - 433, 216, 0, 1382, 1383, 3, 411, 205, 0, 1383, 1384, 3, 423, 211, 0, 1384, - 1385, 3, 421, 210, 0, 1385, 308, 1, 0, 0, 0, 1386, 1387, 3, 429, 214, 0, - 1387, 1388, 3, 395, 197, 0, 1388, 1389, 3, 421, 210, 0, 1389, 1390, 3, - 407, 203, 0, 1390, 1391, 3, 403, 201, 0, 1391, 310, 1, 0, 0, 0, 1392, 1393, - 3, 425, 212, 0, 1393, 1394, 3, 429, 214, 0, 1394, 1395, 3, 403, 201, 0, - 1395, 1396, 3, 399, 199, 0, 1396, 1397, 3, 403, 201, 0, 1397, 1398, 3, - 401, 200, 0, 1398, 1399, 3, 411, 205, 0, 1399, 1400, 3, 421, 210, 0, 1400, - 1401, 3, 407, 203, 0, 1401, 312, 1, 0, 0, 0, 1402, 1403, 3, 435, 217, 0, - 1403, 1404, 3, 421, 210, 0, 1404, 1405, 3, 397, 198, 0, 1405, 1406, 3, - 423, 211, 0, 1406, 1407, 3, 435, 217, 0, 1407, 1408, 3, 421, 210, 0, 1408, - 1409, 3, 401, 200, 0, 1409, 1410, 3, 403, 201, 0, 1410, 1411, 3, 401, 200, - 0, 1411, 314, 1, 0, 0, 0, 1412, 1413, 3, 399, 199, 0, 1413, 1414, 3, 435, - 217, 0, 1414, 1415, 3, 429, 214, 0, 1415, 1416, 3, 429, 214, 0, 1416, 1417, - 3, 403, 201, 0, 1417, 1418, 3, 421, 210, 0, 1418, 1419, 3, 433, 216, 0, - 1419, 316, 1, 0, 0, 0, 1420, 1421, 3, 405, 202, 0, 1421, 1422, 3, 423, - 211, 0, 1422, 1423, 3, 417, 208, 0, 1423, 1424, 3, 417, 208, 0, 1424, 1425, - 3, 423, 211, 0, 1425, 1426, 3, 439, 219, 0, 1426, 1427, 3, 411, 205, 0, - 1427, 1428, 3, 421, 210, 0, 1428, 1429, 3, 407, 203, 0, 1429, 318, 1, 0, - 0, 0, 1430, 1431, 3, 399, 199, 0, 1431, 1432, 3, 435, 217, 0, 1432, 1433, - 3, 419, 209, 0, 1433, 1434, 3, 403, 201, 0, 1434, 1435, 5, 95, 0, 0, 1435, - 1436, 3, 401, 200, 0, 1436, 1437, 3, 411, 205, 0, 1437, 1438, 3, 431, 215, - 0, 1438, 1439, 3, 433, 216, 0, 1439, 320, 1, 0, 0, 0, 1440, 1441, 3, 401, - 200, 0, 1441, 1442, 3, 403, 201, 0, 1442, 1443, 3, 421, 210, 0, 1443, 1444, - 3, 431, 215, 0, 1444, 1445, 3, 403, 201, 0, 1445, 1446, 5, 95, 0, 0, 1446, - 1447, 3, 429, 214, 0, 1447, 1448, 3, 395, 197, 0, 1448, 1449, 3, 421, 210, - 0, 1449, 1450, 3, 415, 207, 0, 1450, 322, 1, 0, 0, 0, 1451, 1452, 3, 417, - 208, 0, 1452, 1453, 3, 395, 197, 0, 1453, 1454, 3, 407, 203, 0, 1454, 324, - 1, 0, 0, 0, 1455, 1456, 3, 417, 208, 0, 1456, 1457, 3, 395, 197, 0, 1457, - 1458, 3, 431, 215, 0, 1458, 1459, 3, 433, 216, 0, 1459, 1460, 5, 95, 0, - 0, 1460, 1461, 3, 437, 218, 0, 1461, 1462, 3, 395, 197, 0, 1462, 1463, - 3, 417, 208, 0, 1463, 1464, 3, 435, 217, 0, 1464, 1465, 3, 403, 201, 0, - 1465, 326, 1, 0, 0, 0, 1466, 1467, 3, 417, 208, 0, 1467, 1468, 3, 403, - 201, 0, 1468, 1469, 3, 395, 197, 0, 1469, 1470, 3, 401, 200, 0, 1470, 328, - 1, 0, 0, 0, 1471, 1472, 3, 421, 210, 0, 1472, 1473, 3, 433, 216, 0, 1473, - 1474, 3, 409, 204, 0, 1474, 1475, 5, 95, 0, 0, 1475, 1476, 3, 437, 218, - 0, 1476, 1477, 3, 395, 197, 0, 1477, 1478, 3, 417, 208, 0, 1478, 1479, - 3, 435, 217, 0, 1479, 1480, 3, 403, 201, 0, 1480, 330, 1, 0, 0, 0, 1481, - 1482, 3, 421, 210, 0, 1482, 1483, 3, 433, 216, 0, 1483, 1484, 3, 411, 205, - 0, 1484, 1485, 3, 417, 208, 0, 1485, 1486, 3, 403, 201, 0, 1486, 332, 1, - 0, 0, 0, 1487, 1488, 3, 425, 212, 0, 1488, 1489, 3, 403, 201, 0, 1489, - 1490, 3, 429, 214, 0, 1490, 1491, 3, 399, 199, 0, 1491, 1492, 3, 403, 201, - 0, 1492, 1493, 3, 421, 210, 0, 1493, 1494, 3, 433, 216, 0, 1494, 1495, - 5, 95, 0, 0, 1495, 1496, 3, 429, 214, 0, 1496, 1497, 3, 395, 197, 0, 1497, - 1498, 3, 421, 210, 0, 1498, 1499, 3, 415, 207, 0, 1499, 334, 1, 0, 0, 0, - 1500, 1501, 3, 429, 214, 0, 1501, 1502, 3, 395, 197, 0, 1502, 1503, 3, - 421, 210, 0, 1503, 1504, 3, 415, 207, 0, 1504, 336, 1, 0, 0, 0, 1505, 1506, - 3, 429, 214, 0, 1506, 1507, 3, 423, 211, 0, 1507, 1508, 3, 439, 219, 0, - 1508, 1509, 5, 95, 0, 0, 1509, 1510, 3, 421, 210, 0, 1510, 1511, 3, 435, - 217, 0, 1511, 1512, 3, 419, 209, 0, 1512, 1513, 3, 397, 198, 0, 1513, 1514, - 3, 403, 201, 0, 1514, 1515, 3, 429, 214, 0, 1515, 338, 1, 0, 0, 0, 1516, - 1517, 3, 407, 203, 0, 1517, 1518, 3, 403, 201, 0, 1518, 1519, 3, 421, 210, - 0, 1519, 1520, 3, 403, 201, 0, 1520, 1521, 3, 429, 214, 0, 1521, 1522, - 3, 395, 197, 0, 1522, 1523, 3, 433, 216, 0, 1523, 1524, 3, 403, 201, 0, - 1524, 1525, 3, 401, 200, 0, 1525, 340, 1, 0, 0, 0, 1526, 1527, 3, 395, - 197, 0, 1527, 1528, 3, 417, 208, 0, 1528, 1529, 3, 439, 219, 0, 1529, 1530, - 3, 395, 197, 0, 1530, 1531, 3, 443, 221, 0, 1531, 1532, 3, 431, 215, 0, - 1532, 342, 1, 0, 0, 0, 1533, 1534, 3, 431, 215, 0, 1534, 1535, 3, 433, - 216, 0, 1535, 1536, 3, 423, 211, 0, 1536, 1537, 3, 429, 214, 0, 1537, 1538, - 3, 403, 201, 0, 1538, 1539, 3, 401, 200, 0, 1539, 344, 1, 0, 0, 0, 1540, - 1541, 3, 433, 216, 0, 1541, 1542, 3, 429, 214, 0, 1542, 1543, 3, 435, 217, - 0, 1543, 1544, 3, 403, 201, 0, 1544, 346, 1, 0, 0, 0, 1545, 1546, 3, 405, - 202, 0, 1546, 1547, 3, 395, 197, 0, 1547, 1548, 3, 417, 208, 0, 1548, 1549, - 3, 431, 215, 0, 1549, 1550, 3, 403, 201, 0, 1550, 348, 1, 0, 0, 0, 1551, - 1552, 3, 439, 219, 0, 1552, 1553, 3, 411, 205, 0, 1553, 1554, 3, 421, 210, - 0, 1554, 1555, 3, 401, 200, 0, 1555, 1556, 3, 423, 211, 0, 1556, 1557, - 3, 439, 219, 0, 1557, 350, 1, 0, 0, 0, 1558, 1559, 3, 421, 210, 0, 1559, - 1560, 3, 435, 217, 0, 1560, 1561, 3, 417, 208, 0, 1561, 1562, 3, 417, 208, - 0, 1562, 1563, 3, 431, 215, 0, 1563, 352, 1, 0, 0, 0, 1564, 1565, 3, 405, - 202, 0, 1565, 1566, 3, 411, 205, 0, 1566, 1567, 3, 429, 214, 0, 1567, 1568, - 3, 431, 215, 0, 1568, 1569, 3, 433, 216, 0, 1569, 354, 1, 0, 0, 0, 1570, - 1571, 3, 417, 208, 0, 1571, 1572, 3, 395, 197, 0, 1572, 1573, 3, 431, 215, - 0, 1573, 1574, 3, 433, 216, 0, 1574, 356, 1, 0, 0, 0, 1575, 1576, 3, 405, - 202, 0, 1576, 1577, 3, 411, 205, 0, 1577, 1578, 3, 417, 208, 0, 1578, 1579, - 3, 433, 216, 0, 1579, 1580, 3, 403, 201, 0, 1580, 1581, 3, 429, 214, 0, - 1581, 358, 1, 0, 0, 0, 1582, 1583, 3, 407, 203, 0, 1583, 1584, 3, 429, - 214, 0, 1584, 1585, 3, 423, 211, 0, 1585, 1586, 3, 435, 217, 0, 1586, 1587, - 3, 425, 212, 0, 1587, 1588, 3, 431, 215, 0, 1588, 360, 1, 0, 0, 0, 1589, - 1590, 3, 403, 201, 0, 1590, 1591, 3, 441, 220, 0, 1591, 1592, 3, 399, 199, - 0, 1592, 1593, 3, 417, 208, 0, 1593, 1594, 3, 435, 217, 0, 1594, 1595, - 3, 401, 200, 0, 1595, 1596, 3, 403, 201, 0, 1596, 362, 1, 0, 0, 0, 1597, - 1598, 3, 433, 216, 0, 1598, 1599, 3, 411, 205, 0, 1599, 1600, 3, 403, 201, - 0, 1600, 1601, 3, 431, 215, 0, 1601, 364, 1, 0, 0, 0, 1602, 1603, 3, 423, - 211, 0, 1603, 1604, 3, 433, 216, 0, 1604, 1605, 3, 409, 204, 0, 1605, 1606, - 3, 403, 201, 0, 1606, 1607, 3, 429, 214, 0, 1607, 1608, 3, 431, 215, 0, - 1608, 366, 1, 0, 0, 0, 1609, 1610, 3, 401, 200, 0, 1610, 1611, 3, 423, - 211, 0, 1611, 368, 1, 0, 0, 0, 1612, 1613, 3, 421, 210, 0, 1613, 1614, - 3, 423, 211, 0, 1614, 1615, 3, 433, 216, 0, 1615, 1616, 3, 409, 204, 0, - 1616, 1617, 3, 411, 205, 0, 1617, 1618, 3, 421, 210, 0, 1618, 1619, 3, - 407, 203, 0, 1619, 370, 1, 0, 0, 0, 1620, 1626, 5, 34, 0, 0, 1621, 1625, - 8, 0, 0, 0, 1622, 1623, 5, 34, 0, 0, 1623, 1625, 5, 34, 0, 0, 1624, 1621, - 1, 0, 0, 0, 1624, 1622, 1, 0, 0, 0, 1625, 1628, 1, 0, 0, 0, 1626, 1624, - 1, 0, 0, 0, 1626, 1627, 1, 0, 0, 0, 1627, 1629, 1, 0, 0, 0, 1628, 1626, - 1, 0, 0, 0, 1629, 1656, 5, 34, 0, 0, 1630, 1636, 5, 96, 0, 0, 1631, 1635, - 8, 1, 0, 0, 1632, 1633, 5, 96, 0, 0, 1633, 1635, 5, 96, 0, 0, 1634, 1631, - 1, 0, 0, 0, 1634, 1632, 1, 0, 0, 0, 1635, 1638, 1, 0, 0, 0, 1636, 1634, - 1, 0, 0, 0, 1636, 1637, 1, 0, 0, 0, 1637, 1639, 1, 0, 0, 0, 1638, 1636, - 1, 0, 0, 0, 1639, 1656, 5, 96, 0, 0, 1640, 1644, 5, 91, 0, 0, 1641, 1643, - 8, 2, 0, 0, 1642, 1641, 1, 0, 0, 0, 1643, 1646, 1, 0, 0, 0, 1644, 1642, - 1, 0, 0, 0, 1644, 1645, 1, 0, 0, 0, 1645, 1647, 1, 0, 0, 0, 1646, 1644, - 1, 0, 0, 0, 1647, 1656, 5, 93, 0, 0, 1648, 1652, 7, 3, 0, 0, 1649, 1651, - 7, 4, 0, 0, 1650, 1649, 1, 0, 0, 0, 1651, 1654, 1, 0, 0, 0, 1652, 1650, - 1, 0, 0, 0, 1652, 1653, 1, 0, 0, 0, 1653, 1656, 1, 0, 0, 0, 1654, 1652, - 1, 0, 0, 0, 1655, 1620, 1, 0, 0, 0, 1655, 1630, 1, 0, 0, 0, 1655, 1640, - 1, 0, 0, 0, 1655, 1648, 1, 0, 0, 0, 1656, 372, 1, 0, 0, 0, 1657, 1659, - 3, 393, 196, 0, 1658, 1657, 1, 0, 0, 0, 1659, 1660, 1, 0, 0, 0, 1660, 1658, - 1, 0, 0, 0, 1660, 1661, 1, 0, 0, 0, 1661, 1669, 1, 0, 0, 0, 1662, 1666, - 5, 46, 0, 0, 1663, 1665, 3, 393, 196, 0, 1664, 1663, 1, 0, 0, 0, 1665, - 1668, 1, 0, 0, 0, 1666, 1664, 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, - 1670, 1, 0, 0, 0, 1668, 1666, 1, 0, 0, 0, 1669, 1662, 1, 0, 0, 0, 1669, - 1670, 1, 0, 0, 0, 1670, 1678, 1, 0, 0, 0, 1671, 1673, 5, 46, 0, 0, 1672, - 1674, 3, 393, 196, 0, 1673, 1672, 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, - 1673, 1, 0, 0, 0, 1675, 1676, 1, 0, 0, 0, 1676, 1678, 1, 0, 0, 0, 1677, - 1658, 1, 0, 0, 0, 1677, 1671, 1, 0, 0, 0, 1678, 1688, 1, 0, 0, 0, 1679, - 1681, 3, 403, 201, 0, 1680, 1682, 7, 5, 0, 0, 1681, 1680, 1, 0, 0, 0, 1681, - 1682, 1, 0, 0, 0, 1682, 1684, 1, 0, 0, 0, 1683, 1685, 3, 393, 196, 0, 1684, - 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1684, 1, 0, 0, 0, 1686, - 1687, 1, 0, 0, 0, 1687, 1689, 1, 0, 0, 0, 1688, 1679, 1, 0, 0, 0, 1688, - 1689, 1, 0, 0, 0, 1689, 1699, 1, 0, 0, 0, 1690, 1691, 5, 48, 0, 0, 1691, - 1692, 5, 120, 0, 0, 1692, 1694, 1, 0, 0, 0, 1693, 1695, 3, 391, 195, 0, - 1694, 1693, 1, 0, 0, 0, 1695, 1696, 1, 0, 0, 0, 1696, 1694, 1, 0, 0, 0, - 1696, 1697, 1, 0, 0, 0, 1697, 1699, 1, 0, 0, 0, 1698, 1677, 1, 0, 0, 0, - 1698, 1690, 1, 0, 0, 0, 1699, 374, 1, 0, 0, 0, 1700, 1704, 5, 63, 0, 0, - 1701, 1703, 3, 393, 196, 0, 1702, 1701, 1, 0, 0, 0, 1703, 1706, 1, 0, 0, - 0, 1704, 1702, 1, 0, 0, 0, 1704, 1705, 1, 0, 0, 0, 1705, 376, 1, 0, 0, - 0, 1706, 1704, 1, 0, 0, 0, 1707, 1708, 7, 6, 0, 0, 1708, 1709, 3, 371, - 185, 0, 1709, 378, 1, 0, 0, 0, 1710, 1716, 5, 39, 0, 0, 1711, 1715, 8, - 7, 0, 0, 1712, 1713, 5, 39, 0, 0, 1713, 1715, 5, 39, 0, 0, 1714, 1711, - 1, 0, 0, 0, 1714, 1712, 1, 0, 0, 0, 1715, 1718, 1, 0, 0, 0, 1716, 1714, - 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 1719, 1, 0, 0, 0, 1718, 1716, - 1, 0, 0, 0, 1719, 1720, 5, 39, 0, 0, 1720, 380, 1, 0, 0, 0, 1721, 1722, - 3, 441, 220, 0, 1722, 1723, 3, 379, 189, 0, 1723, 382, 1, 0, 0, 0, 1724, - 1725, 5, 45, 0, 0, 1725, 1726, 5, 45, 0, 0, 1726, 1730, 1, 0, 0, 0, 1727, - 1729, 8, 8, 0, 0, 1728, 1727, 1, 0, 0, 0, 1729, 1732, 1, 0, 0, 0, 1730, - 1728, 1, 0, 0, 0, 1730, 1731, 1, 0, 0, 0, 1731, 1738, 1, 0, 0, 0, 1732, - 1730, 1, 0, 0, 0, 1733, 1735, 5, 13, 0, 0, 1734, 1733, 1, 0, 0, 0, 1734, - 1735, 1, 0, 0, 0, 1735, 1736, 1, 0, 0, 0, 1736, 1739, 5, 10, 0, 0, 1737, - 1739, 5, 0, 0, 1, 1738, 1734, 1, 0, 0, 0, 1738, 1737, 1, 0, 0, 0, 1739, - 1740, 1, 0, 0, 0, 1740, 1741, 6, 191, 0, 0, 1741, 384, 1, 0, 0, 0, 1742, - 1743, 5, 47, 0, 0, 1743, 1744, 5, 42, 0, 0, 1744, 1748, 1, 0, 0, 0, 1745, - 1747, 9, 0, 0, 0, 1746, 1745, 1, 0, 0, 0, 1747, 1750, 1, 0, 0, 0, 1748, - 1749, 1, 0, 0, 0, 1748, 1746, 1, 0, 0, 0, 1749, 1751, 1, 0, 0, 0, 1750, - 1748, 1, 0, 0, 0, 1751, 1752, 5, 42, 0, 0, 1752, 1753, 5, 47, 0, 0, 1753, - 1754, 1, 0, 0, 0, 1754, 1755, 6, 192, 0, 0, 1755, 386, 1, 0, 0, 0, 1756, - 1757, 7, 9, 0, 0, 1757, 1758, 1, 0, 0, 0, 1758, 1759, 6, 193, 0, 0, 1759, - 388, 1, 0, 0, 0, 1760, 1761, 9, 0, 0, 0, 1761, 390, 1, 0, 0, 0, 1762, 1763, - 7, 10, 0, 0, 1763, 392, 1, 0, 0, 0, 1764, 1765, 7, 11, 0, 0, 1765, 394, - 1, 0, 0, 0, 1766, 1767, 7, 12, 0, 0, 1767, 396, 1, 0, 0, 0, 1768, 1769, - 7, 13, 0, 0, 1769, 398, 1, 0, 0, 0, 1770, 1771, 7, 14, 0, 0, 1771, 400, - 1, 0, 0, 0, 1772, 1773, 7, 15, 0, 0, 1773, 402, 1, 0, 0, 0, 1774, 1775, - 7, 16, 0, 0, 1775, 404, 1, 0, 0, 0, 1776, 1777, 7, 17, 0, 0, 1777, 406, - 1, 0, 0, 0, 1778, 1779, 7, 18, 0, 0, 1779, 408, 1, 0, 0, 0, 1780, 1781, - 7, 19, 0, 0, 1781, 410, 1, 0, 0, 0, 1782, 1783, 7, 20, 0, 0, 1783, 412, - 1, 0, 0, 0, 1784, 1785, 7, 21, 0, 0, 1785, 414, 1, 0, 0, 0, 1786, 1787, - 7, 22, 0, 0, 1787, 416, 1, 0, 0, 0, 1788, 1789, 7, 23, 0, 0, 1789, 418, - 1, 0, 0, 0, 1790, 1791, 7, 24, 0, 0, 1791, 420, 1, 0, 0, 0, 1792, 1793, - 7, 25, 0, 0, 1793, 422, 1, 0, 0, 0, 1794, 1795, 7, 26, 0, 0, 1795, 424, - 1, 0, 0, 0, 1796, 1797, 7, 27, 0, 0, 1797, 426, 1, 0, 0, 0, 1798, 1799, - 7, 28, 0, 0, 1799, 428, 1, 0, 0, 0, 1800, 1801, 7, 29, 0, 0, 1801, 430, - 1, 0, 0, 0, 1802, 1803, 7, 30, 0, 0, 1803, 432, 1, 0, 0, 0, 1804, 1805, - 7, 31, 0, 0, 1805, 434, 1, 0, 0, 0, 1806, 1807, 7, 32, 0, 0, 1807, 436, - 1, 0, 0, 0, 1808, 1809, 7, 33, 0, 0, 1809, 438, 1, 0, 0, 0, 1810, 1811, - 7, 34, 0, 0, 1811, 440, 1, 0, 0, 0, 1812, 1813, 7, 35, 0, 0, 1813, 442, - 1, 0, 0, 0, 1814, 1815, 7, 36, 0, 0, 1815, 444, 1, 0, 0, 0, 1816, 1817, - 7, 37, 0, 0, 1817, 446, 1, 0, 0, 0, 25, 0, 1624, 1626, 1634, 1636, 1644, - 1652, 1655, 1660, 1666, 1669, 1675, 1677, 1681, 1686, 1688, 1696, 1698, - 1704, 1714, 1716, 1730, 1734, 1738, 1748, 1, 0, 1, 0, - } - deserializer := antlr.NewATNDeserializer(nil) - staticData.atn = deserializer.Deserialize(staticData.serializedATN) - atn := staticData.atn - staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) - decisionToDFA := staticData.decisionToDFA - for index, state := range atn.DecisionToState { - decisionToDFA[index] = antlr.NewDFA(state, index) - } -} - -// SQLiteLexerInit initializes any static state used to implement SQLiteLexer. By default the -// static state used to implement the lexer is lazily initialized during the first call to -// NewSQLiteLexer(). You can call this function if you wish to initialize the static state ahead -// of time. -func SQLiteLexerInit() { - staticData := &sqlitelexerLexerStaticData - staticData.once.Do(sqlitelexerLexerInit) -} - -// NewSQLiteLexer produces a new lexer instance for the optional input antlr.CharStream. -func NewSQLiteLexer(input antlr.CharStream) *SQLiteLexer { - SQLiteLexerInit() - l := new(SQLiteLexer) - l.BaseLexer = antlr.NewBaseLexer(input) - staticData := &sqlitelexerLexerStaticData - l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache) - l.channelNames = staticData.channelNames - l.modeNames = staticData.modeNames - l.RuleNames = staticData.ruleNames - l.LiteralNames = staticData.literalNames - l.SymbolicNames = staticData.symbolicNames - l.GrammarFileName = "SQLiteLexer.g4" - // TODO: l.EOF = antlr.TokenEOF - - return l -} - -// SQLiteLexer tokens. -const ( - SQLiteLexerSCOL = 1 - SQLiteLexerDOT = 2 - SQLiteLexerOPEN_PAR = 3 - SQLiteLexerCLOSE_PAR = 4 - SQLiteLexerCOMMA = 5 - SQLiteLexerASSIGN = 6 - SQLiteLexerSTAR = 7 - SQLiteLexerPLUS = 8 - SQLiteLexerMINUS = 9 - SQLiteLexerTILDE = 10 - SQLiteLexerPIPE2 = 11 - SQLiteLexerDIV = 12 - SQLiteLexerMOD = 13 - SQLiteLexerLT2 = 14 - SQLiteLexerGT2 = 15 - SQLiteLexerAMP = 16 - SQLiteLexerPIPE = 17 - SQLiteLexerLT = 18 - SQLiteLexerLT_EQ = 19 - SQLiteLexerGT = 20 - SQLiteLexerGT_EQ = 21 - SQLiteLexerEQ = 22 - SQLiteLexerNOT_EQ1 = 23 - SQLiteLexerNOT_EQ2 = 24 - SQLiteLexerABORT_ = 25 - SQLiteLexerACTION_ = 26 - SQLiteLexerADD_ = 27 - SQLiteLexerAFTER_ = 28 - SQLiteLexerALL_ = 29 - SQLiteLexerALTER_ = 30 - SQLiteLexerANALYZE_ = 31 - SQLiteLexerAND_ = 32 - SQLiteLexerAS_ = 33 - SQLiteLexerASC_ = 34 - SQLiteLexerATTACH_ = 35 - SQLiteLexerAUTOINCREMENT_ = 36 - SQLiteLexerBEFORE_ = 37 - SQLiteLexerBEGIN_ = 38 - SQLiteLexerBETWEEN_ = 39 - SQLiteLexerBY_ = 40 - SQLiteLexerCASCADE_ = 41 - SQLiteLexerCASE_ = 42 - SQLiteLexerCAST_ = 43 - SQLiteLexerCHECK_ = 44 - SQLiteLexerCOLLATE_ = 45 - SQLiteLexerCOLUMN_ = 46 - SQLiteLexerCOMMIT_ = 47 - SQLiteLexerCONFLICT_ = 48 - SQLiteLexerCONSTRAINT_ = 49 - SQLiteLexerCREATE_ = 50 - SQLiteLexerCROSS_ = 51 - SQLiteLexerCURRENT_DATE_ = 52 - SQLiteLexerCURRENT_TIME_ = 53 - SQLiteLexerCURRENT_TIMESTAMP_ = 54 - SQLiteLexerDATABASE_ = 55 - SQLiteLexerDEFAULT_ = 56 - SQLiteLexerDEFERRABLE_ = 57 - SQLiteLexerDEFERRED_ = 58 - SQLiteLexerDELETE_ = 59 - SQLiteLexerDESC_ = 60 - SQLiteLexerDETACH_ = 61 - SQLiteLexerDISTINCT_ = 62 - SQLiteLexerDROP_ = 63 - SQLiteLexerEACH_ = 64 - SQLiteLexerELSE_ = 65 - SQLiteLexerEND_ = 66 - SQLiteLexerESCAPE_ = 67 - SQLiteLexerEXCEPT_ = 68 - SQLiteLexerEXCLUSIVE_ = 69 - SQLiteLexerEXISTS_ = 70 - SQLiteLexerEXPLAIN_ = 71 - SQLiteLexerFAIL_ = 72 - SQLiteLexerFOR_ = 73 - SQLiteLexerFOREIGN_ = 74 - SQLiteLexerFROM_ = 75 - SQLiteLexerFULL_ = 76 - SQLiteLexerGLOB_ = 77 - SQLiteLexerGROUP_ = 78 - SQLiteLexerHAVING_ = 79 - SQLiteLexerIF_ = 80 - SQLiteLexerIGNORE_ = 81 - SQLiteLexerIMMEDIATE_ = 82 - SQLiteLexerIN_ = 83 - SQLiteLexerINDEX_ = 84 - SQLiteLexerINDEXED_ = 85 - SQLiteLexerINITIALLY_ = 86 - SQLiteLexerINNER_ = 87 - SQLiteLexerINSERT_ = 88 - SQLiteLexerINSTEAD_ = 89 - SQLiteLexerINTERSECT_ = 90 - SQLiteLexerINTO_ = 91 - SQLiteLexerIS_ = 92 - SQLiteLexerISNULL_ = 93 - SQLiteLexerJOIN_ = 94 - SQLiteLexerKEY_ = 95 - SQLiteLexerLEFT_ = 96 - SQLiteLexerLIKE_ = 97 - SQLiteLexerLIMIT_ = 98 - SQLiteLexerMATCH_ = 99 - SQLiteLexerNATURAL_ = 100 - SQLiteLexerNO_ = 101 - SQLiteLexerNOT_ = 102 - SQLiteLexerNOTNULL_ = 103 - SQLiteLexerNULL_ = 104 - SQLiteLexerOF_ = 105 - SQLiteLexerOFFSET_ = 106 - SQLiteLexerON_ = 107 - SQLiteLexerOR_ = 108 - SQLiteLexerORDER_ = 109 - SQLiteLexerOUTER_ = 110 - SQLiteLexerPLAN_ = 111 - SQLiteLexerPRAGMA_ = 112 - SQLiteLexerPRIMARY_ = 113 - SQLiteLexerQUERY_ = 114 - SQLiteLexerRAISE_ = 115 - SQLiteLexerRECURSIVE_ = 116 - SQLiteLexerREFERENCES_ = 117 - SQLiteLexerREGEXP_ = 118 - SQLiteLexerREINDEX_ = 119 - SQLiteLexerRELEASE_ = 120 - SQLiteLexerRENAME_ = 121 - SQLiteLexerREPLACE_ = 122 - SQLiteLexerRESTRICT_ = 123 - SQLiteLexerRETURNING_ = 124 - SQLiteLexerRIGHT_ = 125 - SQLiteLexerROLLBACK_ = 126 - SQLiteLexerROW_ = 127 - SQLiteLexerROWS_ = 128 - SQLiteLexerSAVEPOINT_ = 129 - SQLiteLexerSELECT_ = 130 - SQLiteLexerSET_ = 131 - SQLiteLexerSTRICT_ = 132 - SQLiteLexerTABLE_ = 133 - SQLiteLexerTEMP_ = 134 - SQLiteLexerTEMPORARY_ = 135 - SQLiteLexerTHEN_ = 136 - SQLiteLexerTO_ = 137 - SQLiteLexerTRANSACTION_ = 138 - SQLiteLexerTRIGGER_ = 139 - SQLiteLexerUNION_ = 140 - SQLiteLexerUNIQUE_ = 141 - SQLiteLexerUPDATE_ = 142 - SQLiteLexerUSING_ = 143 - SQLiteLexerVACUUM_ = 144 - SQLiteLexerVALUES_ = 145 - SQLiteLexerVIEW_ = 146 - SQLiteLexerVIRTUAL_ = 147 - SQLiteLexerWHEN_ = 148 - SQLiteLexerWHERE_ = 149 - SQLiteLexerWITH_ = 150 - SQLiteLexerWITHOUT_ = 151 - SQLiteLexerFIRST_VALUE_ = 152 - SQLiteLexerOVER_ = 153 - SQLiteLexerPARTITION_ = 154 - SQLiteLexerRANGE_ = 155 - SQLiteLexerPRECEDING_ = 156 - SQLiteLexerUNBOUNDED_ = 157 - SQLiteLexerCURRENT_ = 158 - SQLiteLexerFOLLOWING_ = 159 - SQLiteLexerCUME_DIST_ = 160 - SQLiteLexerDENSE_RANK_ = 161 - SQLiteLexerLAG_ = 162 - SQLiteLexerLAST_VALUE_ = 163 - SQLiteLexerLEAD_ = 164 - SQLiteLexerNTH_VALUE_ = 165 - SQLiteLexerNTILE_ = 166 - SQLiteLexerPERCENT_RANK_ = 167 - SQLiteLexerRANK_ = 168 - SQLiteLexerROW_NUMBER_ = 169 - SQLiteLexerGENERATED_ = 170 - SQLiteLexerALWAYS_ = 171 - SQLiteLexerSTORED_ = 172 - SQLiteLexerTRUE_ = 173 - SQLiteLexerFALSE_ = 174 - SQLiteLexerWINDOW_ = 175 - SQLiteLexerNULLS_ = 176 - SQLiteLexerFIRST_ = 177 - SQLiteLexerLAST_ = 178 - SQLiteLexerFILTER_ = 179 - SQLiteLexerGROUPS_ = 180 - SQLiteLexerEXCLUDE_ = 181 - SQLiteLexerTIES_ = 182 - SQLiteLexerOTHERS_ = 183 - SQLiteLexerDO_ = 184 - SQLiteLexerNOTHING_ = 185 - SQLiteLexerIDENTIFIER = 186 - SQLiteLexerNUMERIC_LITERAL = 187 - SQLiteLexerNUMBERED_BIND_PARAMETER = 188 - SQLiteLexerNAMED_BIND_PARAMETER = 189 - SQLiteLexerSTRING_LITERAL = 190 - SQLiteLexerBLOB_LITERAL = 191 - SQLiteLexerSINGLE_LINE_COMMENT = 192 - SQLiteLexerMULTILINE_COMMENT = 193 - SQLiteLexerSPACES = 194 - SQLiteLexerUNEXPECTED_CHAR = 195 -) diff --git a/internal/engine/sqlite/parser/sqlite_parser.go b/internal/engine/sqlite/parser/sqlite_parser.go deleted file mode 100644 index 2ee498f565..0000000000 --- a/internal/engine/sqlite/parser/sqlite_parser.go +++ /dev/null @@ -1,30217 +0,0 @@ -// Code generated from SQLiteParser.g4 by ANTLR 4.12.0. DO NOT EDIT. - -package parser // SQLiteParser - -import ( - "fmt" - "strconv" - "sync" - - "github.com/antlr/antlr4/runtime/Go/antlr/v4" -) - -// Suppress unused import errors -var _ = fmt.Printf -var _ = strconv.Itoa -var _ = sync.Once{} - -type SQLiteParser struct { - *antlr.BaseParser -} - -var sqliteparserParserStaticData struct { - once sync.Once - serializedATN []int32 - literalNames []string - symbolicNames []string - ruleNames []string - predictionContextCache *antlr.PredictionContextCache - atn *antlr.ATN - decisionToDFA []*antlr.DFA -} - -func sqliteparserParserInit() { - staticData := &sqliteparserParserStaticData - staticData.literalNames = []string{ - "", "';'", "'.'", "'('", "')'", "','", "'='", "'*'", "'+'", "'-'", "'~'", - "'||'", "'/'", "'%'", "'<<'", "'>>'", "'&'", "'|'", "'<'", "'<='", "'>'", - "'>='", "'=='", "'!='", "'<>'", - } - staticData.symbolicNames = []string{ - "", "SCOL", "DOT", "OPEN_PAR", "CLOSE_PAR", "COMMA", "ASSIGN", "STAR", - "PLUS", "MINUS", "TILDE", "PIPE2", "DIV", "MOD", "LT2", "GT2", "AMP", - "PIPE", "LT", "LT_EQ", "GT", "GT_EQ", "EQ", "NOT_EQ1", "NOT_EQ2", "ABORT_", - "ACTION_", "ADD_", "AFTER_", "ALL_", "ALTER_", "ANALYZE_", "AND_", "AS_", - "ASC_", "ATTACH_", "AUTOINCREMENT_", "BEFORE_", "BEGIN_", "BETWEEN_", - "BY_", "CASCADE_", "CASE_", "CAST_", "CHECK_", "COLLATE_", "COLUMN_", - "COMMIT_", "CONFLICT_", "CONSTRAINT_", "CREATE_", "CROSS_", "CURRENT_DATE_", - "CURRENT_TIME_", "CURRENT_TIMESTAMP_", "DATABASE_", "DEFAULT_", "DEFERRABLE_", - "DEFERRED_", "DELETE_", "DESC_", "DETACH_", "DISTINCT_", "DROP_", "EACH_", - "ELSE_", "END_", "ESCAPE_", "EXCEPT_", "EXCLUSIVE_", "EXISTS_", "EXPLAIN_", - "FAIL_", "FOR_", "FOREIGN_", "FROM_", "FULL_", "GLOB_", "GROUP_", "HAVING_", - "IF_", "IGNORE_", "IMMEDIATE_", "IN_", "INDEX_", "INDEXED_", "INITIALLY_", - "INNER_", "INSERT_", "INSTEAD_", "INTERSECT_", "INTO_", "IS_", "ISNULL_", - "JOIN_", "KEY_", "LEFT_", "LIKE_", "LIMIT_", "MATCH_", "NATURAL_", "NO_", - "NOT_", "NOTNULL_", "NULL_", "OF_", "OFFSET_", "ON_", "OR_", "ORDER_", - "OUTER_", "PLAN_", "PRAGMA_", "PRIMARY_", "QUERY_", "RAISE_", "RECURSIVE_", - "REFERENCES_", "REGEXP_", "REINDEX_", "RELEASE_", "RENAME_", "REPLACE_", - "RESTRICT_", "RETURNING_", "RIGHT_", "ROLLBACK_", "ROW_", "ROWS_", "SAVEPOINT_", - "SELECT_", "SET_", "STRICT_", "TABLE_", "TEMP_", "TEMPORARY_", "THEN_", - "TO_", "TRANSACTION_", "TRIGGER_", "UNION_", "UNIQUE_", "UPDATE_", "USING_", - "VACUUM_", "VALUES_", "VIEW_", "VIRTUAL_", "WHEN_", "WHERE_", "WITH_", - "WITHOUT_", "FIRST_VALUE_", "OVER_", "PARTITION_", "RANGE_", "PRECEDING_", - "UNBOUNDED_", "CURRENT_", "FOLLOWING_", "CUME_DIST_", "DENSE_RANK_", - "LAG_", "LAST_VALUE_", "LEAD_", "NTH_VALUE_", "NTILE_", "PERCENT_RANK_", - "RANK_", "ROW_NUMBER_", "GENERATED_", "ALWAYS_", "STORED_", "TRUE_", - "FALSE_", "WINDOW_", "NULLS_", "FIRST_", "LAST_", "FILTER_", "GROUPS_", - "EXCLUDE_", "TIES_", "OTHERS_", "DO_", "NOTHING_", "IDENTIFIER", "NUMERIC_LITERAL", - "NUMBERED_BIND_PARAMETER", "NAMED_BIND_PARAMETER", "STRING_LITERAL", - "BLOB_LITERAL", "SINGLE_LINE_COMMENT", "MULTILINE_COMMENT", "SPACES", - "UNEXPECTED_CHAR", - } - staticData.ruleNames = []string{ - "parse", "sql_stmt_list", "sql_stmt", "alter_table_stmt", "analyze_stmt", - "attach_stmt", "begin_stmt", "commit_stmt", "rollback_stmt", "savepoint_stmt", - "release_stmt", "create_index_stmt", "indexed_column", "table_option", - "create_table_stmt", "column_def", "type_name", "column_constraint", - "signed_number", "table_constraint", "foreign_key_clause", "conflict_clause", - "create_trigger_stmt", "create_view_stmt", "create_virtual_table_stmt", - "with_clause", "cte_table_name", "recursive_cte", "common_table_expression", - "returning_clause", "delete_stmt", "delete_stmt_limited", "detach_stmt", - "drop_stmt", "expr", "raise_function", "literal_value", "insert_stmt", - "upsert_clause", "pragma_stmt", "pragma_value", "reindex_stmt", "select_stmt", - "join_clause", "select_core", "factored_select_stmt", "simple_select_stmt", - "compound_select_stmt", "table_or_subquery", "result_column", "join_operator", - "join_constraint", "compound_operator", "update_stmt", "column_name_list", - "update_stmt_limited", "qualified_table_name", "vacuum_stmt", "filter_clause", - "window_defn", "over_clause", "frame_spec", "frame_clause", "simple_function_invocation", - "aggregate_function_invocation", "window_function_invocation", "common_table_stmt", - "order_by_stmt", "limit_stmt", "ordering_term", "asc_desc", "frame_left", - "frame_right", "frame_single", "window_function", "of_OF_fset", "default_DEFAULT__value", - "partition_by", "order_by_expr", "order_by_expr_asc_desc", "expr_asc_desc", - "initial_select", "recursive__select", "unary_operator", "error_message", - "module_argument", "column_alias", "keyword", "name", "function_name", - "qualified_function_name", "schema_name", "table_name", "table_or_index_name", - "new_table_name", "column_name", "collation_name", "foreign_table", - "index_name", "trigger_name", "view_name", "module_name", "pragma_name", - "savepoint_name", "table_alias", "table_alias_fallback", "transaction_name", - "window_name", "alias", "filename", "base_window_name", "simple_func", - "aggregate_func", "table_function_name", "any_name", - } - staticData.predictionContextCache = antlr.NewPredictionContextCache() - staticData.serializedATN = []int32{ - 4, 1, 195, 2175, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, - 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, - 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, - 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, - 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, - 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, - 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, - 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, - 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, - 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, - 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, - 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, - 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, - 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, - 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, - 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, - 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, - 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, - 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, - 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, - 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, - 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, - 113, 7, 113, 2, 114, 7, 114, 1, 0, 5, 0, 232, 8, 0, 10, 0, 12, 0, 235, - 9, 0, 1, 0, 1, 0, 1, 1, 5, 1, 240, 8, 1, 10, 1, 12, 1, 243, 9, 1, 1, 1, - 1, 1, 4, 1, 247, 8, 1, 11, 1, 12, 1, 248, 1, 1, 5, 1, 252, 8, 1, 10, 1, - 12, 1, 255, 9, 1, 1, 1, 5, 1, 258, 8, 1, 10, 1, 12, 1, 261, 9, 1, 1, 2, - 1, 2, 1, 2, 3, 2, 266, 8, 2, 3, 2, 268, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 294, 8, 2, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 3, 3, 301, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, - 3, 308, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 314, 8, 3, 1, 3, 1, 3, 3, 3, - 318, 8, 3, 1, 3, 1, 3, 1, 3, 3, 3, 323, 8, 3, 1, 3, 3, 3, 326, 8, 3, 1, - 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 333, 8, 4, 1, 4, 3, 4, 336, 8, 4, 1, 5, - 1, 5, 3, 5, 340, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 3, 6, 348, 8, - 6, 1, 6, 1, 6, 3, 6, 352, 8, 6, 3, 6, 354, 8, 6, 1, 7, 1, 7, 3, 7, 358, - 8, 7, 1, 8, 1, 8, 3, 8, 362, 8, 8, 1, 8, 1, 8, 3, 8, 366, 8, 8, 1, 8, 3, - 8, 369, 8, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 3, 10, 376, 8, 10, 1, 10, - 1, 10, 1, 11, 1, 11, 3, 11, 382, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, - 11, 388, 8, 11, 1, 11, 1, 11, 1, 11, 3, 11, 393, 8, 11, 1, 11, 1, 11, 1, - 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 402, 8, 11, 10, 11, 12, 11, 405, - 9, 11, 1, 11, 1, 11, 1, 11, 3, 11, 410, 8, 11, 1, 12, 1, 12, 3, 12, 414, - 8, 12, 1, 12, 1, 12, 3, 12, 418, 8, 12, 1, 12, 3, 12, 421, 8, 12, 1, 13, - 1, 13, 1, 13, 3, 13, 426, 8, 13, 1, 14, 1, 14, 3, 14, 430, 8, 14, 1, 14, - 1, 14, 1, 14, 1, 14, 3, 14, 436, 8, 14, 1, 14, 1, 14, 1, 14, 3, 14, 441, - 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 448, 8, 14, 10, 14, 12, - 14, 451, 9, 14, 1, 14, 1, 14, 5, 14, 455, 8, 14, 10, 14, 12, 14, 458, 9, - 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 464, 8, 14, 10, 14, 12, 14, 467, - 9, 14, 3, 14, 469, 8, 14, 1, 14, 1, 14, 3, 14, 473, 8, 14, 1, 15, 1, 15, - 3, 15, 477, 8, 15, 1, 15, 5, 15, 480, 8, 15, 10, 15, 12, 15, 483, 9, 15, - 1, 16, 4, 16, 486, 8, 16, 11, 16, 12, 16, 487, 1, 16, 1, 16, 1, 16, 1, - 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 500, 8, 16, 1, 17, - 1, 17, 3, 17, 504, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, 509, 8, 17, 1, 17, - 3, 17, 512, 8, 17, 1, 17, 3, 17, 515, 8, 17, 1, 17, 1, 17, 1, 17, 3, 17, - 520, 8, 17, 1, 17, 3, 17, 523, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, - 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 537, 8, 17, 1, - 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 544, 8, 17, 1, 17, 1, 17, 1, 17, - 1, 17, 1, 17, 3, 17, 551, 8, 17, 3, 17, 553, 8, 17, 1, 18, 3, 18, 556, - 8, 18, 1, 18, 1, 18, 1, 19, 1, 19, 3, 19, 562, 8, 19, 1, 19, 1, 19, 1, - 19, 3, 19, 567, 8, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 573, 8, 19, 10, - 19, 12, 19, 576, 9, 19, 1, 19, 1, 19, 3, 19, 580, 8, 19, 1, 19, 1, 19, - 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 593, - 8, 19, 10, 19, 12, 19, 596, 9, 19, 1, 19, 1, 19, 1, 19, 3, 19, 601, 8, - 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 5, 20, 609, 8, 20, 10, 20, - 12, 20, 612, 9, 20, 1, 20, 1, 20, 3, 20, 616, 8, 20, 1, 20, 1, 20, 1, 20, - 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 626, 8, 20, 1, 20, 1, 20, 5, - 20, 630, 8, 20, 10, 20, 12, 20, 633, 9, 20, 1, 20, 3, 20, 636, 8, 20, 1, - 20, 1, 20, 1, 20, 3, 20, 641, 8, 20, 3, 20, 643, 8, 20, 1, 21, 1, 21, 1, - 21, 1, 21, 1, 22, 1, 22, 3, 22, 651, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, - 3, 22, 657, 8, 22, 1, 22, 1, 22, 1, 22, 3, 22, 662, 8, 22, 1, 22, 1, 22, - 1, 22, 1, 22, 1, 22, 3, 22, 669, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, - 22, 1, 22, 1, 22, 5, 22, 678, 8, 22, 10, 22, 12, 22, 681, 9, 22, 3, 22, - 683, 8, 22, 3, 22, 685, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, - 692, 8, 22, 1, 22, 1, 22, 3, 22, 696, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, - 1, 22, 3, 22, 703, 8, 22, 1, 22, 1, 22, 4, 22, 707, 8, 22, 11, 22, 12, - 22, 708, 1, 22, 1, 22, 1, 23, 1, 23, 3, 23, 715, 8, 23, 1, 23, 1, 23, 1, - 23, 1, 23, 3, 23, 721, 8, 23, 1, 23, 1, 23, 1, 23, 3, 23, 726, 8, 23, 1, - 23, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 733, 8, 23, 10, 23, 12, 23, 736, - 9, 23, 1, 23, 1, 23, 3, 23, 740, 8, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, - 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 751, 8, 24, 1, 24, 1, 24, 1, 24, - 3, 24, 756, 8, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 5, - 24, 765, 8, 24, 10, 24, 12, 24, 768, 9, 24, 1, 24, 1, 24, 3, 24, 772, 8, - 24, 1, 25, 1, 25, 3, 25, 776, 8, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, - 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 790, 8, 25, 10, - 25, 12, 25, 793, 9, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 800, - 8, 26, 10, 26, 12, 26, 803, 9, 26, 1, 26, 1, 26, 3, 26, 807, 8, 26, 1, - 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 815, 8, 27, 1, 27, 1, 27, - 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 825, 8, 28, 10, 28, 12, - 28, 828, 9, 28, 1, 28, 1, 28, 3, 28, 832, 8, 28, 1, 28, 1, 28, 1, 28, 1, - 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 843, 8, 29, 1, 29, 3, 29, - 846, 8, 29, 3, 29, 848, 8, 29, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 854, - 8, 29, 1, 29, 3, 29, 857, 8, 29, 3, 29, 859, 8, 29, 5, 29, 861, 8, 29, - 10, 29, 12, 29, 864, 9, 29, 1, 30, 3, 30, 867, 8, 30, 1, 30, 1, 30, 1, - 30, 1, 30, 1, 30, 3, 30, 874, 8, 30, 1, 30, 3, 30, 877, 8, 30, 1, 31, 3, - 31, 880, 8, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 887, 8, 31, 1, - 31, 3, 31, 890, 8, 31, 1, 31, 3, 31, 893, 8, 31, 1, 31, 3, 31, 896, 8, - 31, 1, 32, 1, 32, 3, 32, 900, 8, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, - 1, 33, 3, 33, 908, 8, 33, 1, 33, 1, 33, 1, 33, 3, 33, 913, 8, 33, 1, 33, - 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 924, 8, - 34, 1, 34, 1, 34, 1, 34, 3, 34, 929, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 34, 3, 34, 938, 8, 34, 1, 34, 1, 34, 1, 34, 5, 34, 943, - 8, 34, 10, 34, 12, 34, 946, 9, 34, 1, 34, 3, 34, 949, 8, 34, 1, 34, 1, - 34, 3, 34, 953, 8, 34, 1, 34, 3, 34, 956, 8, 34, 1, 34, 1, 34, 1, 34, 1, - 34, 5, 34, 962, 8, 34, 10, 34, 12, 34, 965, 9, 34, 1, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 977, 8, 34, 1, - 34, 3, 34, 980, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, - 988, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 4, 34, 995, 8, 34, 11, 34, - 12, 34, 996, 1, 34, 1, 34, 3, 34, 1001, 8, 34, 1, 34, 1, 34, 1, 34, 3, - 34, 1006, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1032, 8, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 34, 3, 34, 1039, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1050, 8, 34, 1, 34, 1, 34, 1, 34, - 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1059, 8, 34, 1, 34, 1, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 5, 34, 1067, 8, 34, 10, 34, 12, 34, 1070, 9, 34, 3, 34, - 1072, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1078, 8, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 3, 34, 1084, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, - 5, 34, 1091, 8, 34, 10, 34, 12, 34, 1094, 9, 34, 3, 34, 1096, 8, 34, 1, - 34, 1, 34, 3, 34, 1100, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, - 1107, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1113, 8, 34, 1, 34, 1, - 34, 1, 34, 1, 34, 1, 34, 3, 34, 1120, 8, 34, 5, 34, 1122, 8, 34, 10, 34, - 12, 34, 1125, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 1133, - 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, 37, 1140, 8, 37, 1, 37, 1, - 37, 1, 37, 1, 37, 1, 37, 3, 37, 1147, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, - 3, 37, 1153, 8, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1158, 8, 37, 1, 37, 1, - 37, 1, 37, 1, 37, 5, 37, 1164, 8, 37, 10, 37, 12, 37, 1167, 9, 37, 1, 37, - 1, 37, 3, 37, 1171, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1178, - 8, 37, 10, 37, 12, 37, 1181, 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, - 1, 37, 5, 37, 1189, 8, 37, 10, 37, 12, 37, 1192, 9, 37, 1, 37, 1, 37, 5, - 37, 1196, 8, 37, 10, 37, 12, 37, 1199, 9, 37, 1, 37, 3, 37, 1202, 8, 37, - 1, 37, 3, 37, 1205, 8, 37, 1, 37, 3, 37, 1208, 8, 37, 1, 37, 1, 37, 3, - 37, 1212, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1220, - 8, 38, 10, 38, 12, 38, 1223, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1228, 8, - 38, 3, 38, 1230, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, - 1238, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1245, 8, 38, 1, - 38, 1, 38, 1, 38, 5, 38, 1250, 8, 38, 10, 38, 12, 38, 1253, 9, 38, 1, 38, - 1, 38, 3, 38, 1257, 8, 38, 3, 38, 1259, 8, 38, 1, 39, 1, 39, 1, 39, 1, - 39, 3, 39, 1265, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, - 3, 39, 1274, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1279, 8, 40, 1, 41, 1, - 41, 1, 41, 1, 41, 1, 41, 3, 41, 1286, 8, 41, 1, 41, 1, 41, 3, 41, 1290, - 8, 41, 3, 41, 1292, 8, 41, 1, 42, 3, 42, 1295, 8, 42, 1, 42, 1, 42, 1, - 42, 1, 42, 5, 42, 1301, 8, 42, 10, 42, 12, 42, 1304, 9, 42, 1, 42, 3, 42, - 1307, 8, 42, 1, 42, 3, 42, 1310, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, - 43, 5, 43, 1317, 8, 43, 10, 43, 12, 43, 1320, 9, 43, 1, 44, 1, 44, 3, 44, - 1324, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1329, 8, 44, 10, 44, 12, 44, 1332, - 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1338, 8, 44, 10, 44, 12, 44, - 1341, 9, 44, 1, 44, 3, 44, 1344, 8, 44, 3, 44, 1346, 8, 44, 1, 44, 1, 44, - 3, 44, 1350, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1357, 8, - 44, 10, 44, 12, 44, 1360, 9, 44, 1, 44, 1, 44, 3, 44, 1364, 8, 44, 3, 44, - 1366, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, - 44, 5, 44, 1377, 8, 44, 10, 44, 12, 44, 1380, 9, 44, 3, 44, 1382, 8, 44, - 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1389, 8, 44, 10, 44, 12, 44, - 1392, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1400, 8, - 44, 10, 44, 12, 44, 1403, 9, 44, 1, 44, 1, 44, 5, 44, 1407, 8, 44, 10, - 44, 12, 44, 1410, 9, 44, 3, 44, 1412, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, - 1417, 8, 46, 1, 46, 1, 46, 3, 46, 1421, 8, 46, 1, 46, 3, 46, 1424, 8, 46, - 1, 47, 3, 47, 1427, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1432, 8, 47, 1, - 47, 1, 47, 3, 47, 1436, 8, 47, 1, 47, 4, 47, 1439, 8, 47, 11, 47, 12, 47, - 1440, 1, 47, 3, 47, 1444, 8, 47, 1, 47, 3, 47, 1447, 8, 47, 1, 48, 1, 48, - 1, 48, 3, 48, 1452, 8, 48, 1, 48, 1, 48, 3, 48, 1456, 8, 48, 1, 48, 3, - 48, 1459, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1466, 8, 48, - 1, 48, 1, 48, 1, 48, 3, 48, 1471, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, - 48, 5, 48, 1478, 8, 48, 10, 48, 12, 48, 1481, 9, 48, 1, 48, 1, 48, 3, 48, - 1485, 8, 48, 1, 48, 3, 48, 1488, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, - 48, 1494, 8, 48, 10, 48, 12, 48, 1497, 9, 48, 1, 48, 3, 48, 1500, 8, 48, - 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1508, 8, 48, 1, 48, 3, - 48, 1511, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1516, 8, 48, 1, 48, 1, 48, - 3, 48, 1520, 8, 48, 1, 48, 3, 48, 1523, 8, 48, 1, 48, 1, 48, 1, 48, 1, - 48, 1, 48, 3, 48, 1530, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1535, 8, 48, - 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1542, 8, 48, 10, 48, 12, 48, - 1545, 9, 48, 1, 48, 1, 48, 3, 48, 1549, 8, 48, 1, 48, 3, 48, 1552, 8, 48, - 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1558, 8, 48, 10, 48, 12, 48, 1561, 9, - 48, 1, 48, 3, 48, 1564, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, - 3, 48, 1572, 8, 48, 1, 48, 3, 48, 1575, 8, 48, 3, 48, 1577, 8, 48, 1, 49, - 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1586, 8, 49, 1, 49, 3, - 49, 1589, 8, 49, 3, 49, 1591, 8, 49, 1, 50, 1, 50, 3, 50, 1595, 8, 50, - 1, 50, 1, 50, 3, 50, 1599, 8, 50, 1, 50, 3, 50, 1602, 8, 50, 1, 50, 1, - 50, 1, 50, 3, 50, 1607, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, - 1, 51, 5, 51, 1616, 8, 51, 10, 51, 12, 51, 1619, 9, 51, 1, 51, 1, 51, 3, - 51, 1623, 8, 51, 1, 52, 1, 52, 3, 52, 1627, 8, 52, 1, 52, 1, 52, 3, 52, - 1631, 8, 52, 1, 53, 3, 53, 1634, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1639, - 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1645, 8, 53, 1, 53, 1, 53, 1, - 53, 1, 53, 1, 53, 3, 53, 1652, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1657, - 8, 53, 10, 53, 12, 53, 1660, 9, 53, 1, 53, 1, 53, 3, 53, 1664, 8, 53, 1, - 53, 3, 53, 1667, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1673, 8, 54, - 10, 54, 12, 54, 1676, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1681, 8, 55, 1, - 55, 1, 55, 1, 55, 3, 55, 1686, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, - 1692, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1699, 8, 55, 1, - 55, 1, 55, 1, 55, 5, 55, 1704, 8, 55, 10, 55, 12, 55, 1707, 9, 55, 1, 55, - 1, 55, 3, 55, 1711, 8, 55, 1, 55, 3, 55, 1714, 8, 55, 1, 55, 3, 55, 1717, - 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1722, 8, 56, 1, 56, 1, 56, 1, 56, 3, - 56, 1727, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1734, 8, 56, - 1, 57, 1, 57, 3, 57, 1738, 8, 57, 1, 57, 1, 57, 3, 57, 1742, 8, 57, 1, - 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1752, 8, 59, - 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1759, 8, 59, 10, 59, 12, 59, - 1762, 9, 59, 3, 59, 1764, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, - 59, 1771, 8, 59, 10, 59, 12, 59, 1774, 9, 59, 1, 59, 3, 59, 1777, 8, 59, - 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1785, 8, 60, 1, 60, 1, - 60, 1, 60, 1, 60, 1, 60, 5, 60, 1792, 8, 60, 10, 60, 12, 60, 1795, 9, 60, - 3, 60, 1797, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1804, 8, - 60, 10, 60, 12, 60, 1807, 9, 60, 3, 60, 1809, 8, 60, 1, 60, 3, 60, 1812, - 8, 60, 1, 60, 3, 60, 1815, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, - 61, 1, 61, 1, 61, 3, 61, 1825, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, - 1, 62, 1, 62, 3, 62, 1834, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, - 63, 1841, 8, 63, 10, 63, 12, 63, 1844, 9, 63, 1, 63, 3, 63, 1847, 8, 63, - 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1854, 8, 64, 1, 64, 1, 64, 1, - 64, 5, 64, 1859, 8, 64, 10, 64, 12, 64, 1862, 9, 64, 1, 64, 3, 64, 1865, - 8, 64, 1, 64, 1, 64, 3, 64, 1869, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, - 65, 5, 65, 1876, 8, 65, 10, 65, 12, 65, 1879, 9, 65, 1, 65, 3, 65, 1882, - 8, 65, 1, 65, 1, 65, 3, 65, 1886, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1891, - 8, 65, 1, 66, 1, 66, 3, 66, 1895, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1900, - 8, 66, 10, 66, 12, 66, 1903, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, - 5, 67, 1910, 8, 67, 10, 67, 12, 67, 1913, 9, 67, 1, 68, 1, 68, 1, 68, 1, - 68, 3, 68, 1919, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1924, 8, 69, 1, 69, - 3, 69, 1927, 8, 69, 1, 69, 1, 69, 3, 69, 1931, 8, 69, 1, 70, 1, 70, 1, - 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, - 1945, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, - 72, 1, 72, 3, 72, 1957, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, - 1, 73, 3, 73, 1966, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, - 74, 3, 74, 1975, 8, 74, 1, 74, 1, 74, 3, 74, 1979, 8, 74, 1, 74, 1, 74, - 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1989, 8, 74, 1, 74, 3, - 74, 1992, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, - 2001, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2010, - 8, 74, 1, 74, 3, 74, 2013, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2019, - 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, - 74, 1, 74, 1, 74, 3, 74, 2033, 8, 74, 1, 74, 1, 74, 3, 74, 2037, 8, 74, - 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2048, - 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2053, 8, 74, 1, 75, 1, 75, 1, 75, 1, - 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2064, 8, 77, 11, 77, 12, - 77, 2065, 1, 78, 1, 78, 1, 78, 4, 78, 2071, 8, 78, 11, 78, 12, 78, 2072, - 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2081, 8, 80, 1, 80, 1, - 80, 1, 80, 3, 80, 2086, 8, 80, 5, 80, 2088, 8, 80, 10, 80, 12, 80, 2091, - 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, - 85, 3, 85, 2103, 8, 85, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 89, - 1, 89, 1, 90, 1, 90, 1, 90, 3, 90, 2116, 8, 90, 1, 90, 1, 90, 1, 91, 1, - 91, 1, 92, 1, 92, 1, 93, 1, 93, 1, 94, 1, 94, 1, 95, 1, 95, 1, 96, 1, 96, - 1, 97, 1, 97, 1, 98, 1, 98, 1, 99, 1, 99, 1, 100, 1, 100, 1, 101, 1, 101, - 1, 102, 1, 102, 1, 103, 1, 103, 1, 104, 1, 104, 1, 105, 1, 105, 1, 106, - 1, 106, 1, 107, 1, 107, 1, 108, 1, 108, 1, 109, 1, 109, 1, 110, 1, 110, - 1, 111, 1, 111, 1, 112, 1, 112, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, - 1, 114, 1, 114, 1, 114, 1, 114, 3, 114, 2173, 8, 114, 1, 114, 2, 449, 487, - 1, 68, 115, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, - 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, - 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, - 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, - 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, - 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, - 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, - 224, 226, 228, 0, 29, 3, 0, 58, 58, 69, 69, 82, 82, 2, 0, 47, 47, 66, 66, - 1, 0, 134, 135, 2, 0, 147, 147, 172, 172, 1, 0, 8, 9, 2, 0, 59, 59, 142, - 142, 2, 0, 56, 56, 104, 104, 2, 0, 58, 58, 82, 82, 5, 0, 25, 25, 72, 72, - 81, 81, 122, 122, 126, 126, 4, 0, 84, 84, 133, 133, 139, 139, 146, 146, - 2, 0, 7, 7, 12, 13, 1, 0, 14, 17, 1, 0, 18, 21, 4, 0, 77, 77, 97, 97, 99, - 99, 118, 118, 3, 0, 25, 25, 72, 72, 126, 126, 5, 0, 52, 54, 104, 104, 173, - 174, 187, 187, 190, 191, 2, 0, 29, 29, 62, 62, 3, 0, 76, 76, 96, 96, 125, - 125, 3, 0, 128, 128, 155, 155, 180, 180, 2, 0, 5, 5, 106, 106, 1, 0, 177, - 178, 2, 0, 34, 34, 60, 60, 2, 0, 152, 152, 163, 163, 2, 0, 160, 160, 167, - 167, 2, 0, 161, 161, 168, 169, 2, 0, 162, 162, 164, 164, 2, 0, 8, 10, 102, - 102, 2, 0, 186, 186, 190, 190, 1, 0, 25, 181, 2480, 0, 233, 1, 0, 0, 0, - 2, 241, 1, 0, 0, 0, 4, 267, 1, 0, 0, 0, 6, 295, 1, 0, 0, 0, 8, 327, 1, - 0, 0, 0, 10, 337, 1, 0, 0, 0, 12, 345, 1, 0, 0, 0, 14, 355, 1, 0, 0, 0, - 16, 359, 1, 0, 0, 0, 18, 370, 1, 0, 0, 0, 20, 373, 1, 0, 0, 0, 22, 379, - 1, 0, 0, 0, 24, 413, 1, 0, 0, 0, 26, 425, 1, 0, 0, 0, 28, 427, 1, 0, 0, - 0, 30, 474, 1, 0, 0, 0, 32, 485, 1, 0, 0, 0, 34, 503, 1, 0, 0, 0, 36, 555, - 1, 0, 0, 0, 38, 561, 1, 0, 0, 0, 40, 602, 1, 0, 0, 0, 42, 644, 1, 0, 0, - 0, 44, 648, 1, 0, 0, 0, 46, 712, 1, 0, 0, 0, 48, 744, 1, 0, 0, 0, 50, 773, - 1, 0, 0, 0, 52, 794, 1, 0, 0, 0, 54, 808, 1, 0, 0, 0, 56, 819, 1, 0, 0, - 0, 58, 838, 1, 0, 0, 0, 60, 866, 1, 0, 0, 0, 62, 879, 1, 0, 0, 0, 64, 897, - 1, 0, 0, 0, 66, 903, 1, 0, 0, 0, 68, 1005, 1, 0, 0, 0, 70, 1126, 1, 0, - 0, 0, 72, 1136, 1, 0, 0, 0, 74, 1211, 1, 0, 0, 0, 76, 1213, 1, 0, 0, 0, - 78, 1260, 1, 0, 0, 0, 80, 1278, 1, 0, 0, 0, 82, 1280, 1, 0, 0, 0, 84, 1294, - 1, 0, 0, 0, 86, 1311, 1, 0, 0, 0, 88, 1411, 1, 0, 0, 0, 90, 1413, 1, 0, - 0, 0, 92, 1416, 1, 0, 0, 0, 94, 1426, 1, 0, 0, 0, 96, 1576, 1, 0, 0, 0, - 98, 1590, 1, 0, 0, 0, 100, 1606, 1, 0, 0, 0, 102, 1622, 1, 0, 0, 0, 104, - 1630, 1, 0, 0, 0, 106, 1633, 1, 0, 0, 0, 108, 1668, 1, 0, 0, 0, 110, 1680, - 1, 0, 0, 0, 112, 1721, 1, 0, 0, 0, 114, 1735, 1, 0, 0, 0, 116, 1743, 1, - 0, 0, 0, 118, 1749, 1, 0, 0, 0, 120, 1780, 1, 0, 0, 0, 122, 1816, 1, 0, - 0, 0, 124, 1826, 1, 0, 0, 0, 126, 1835, 1, 0, 0, 0, 128, 1850, 1, 0, 0, - 0, 130, 1870, 1, 0, 0, 0, 132, 1892, 1, 0, 0, 0, 134, 1904, 1, 0, 0, 0, - 136, 1914, 1, 0, 0, 0, 138, 1920, 1, 0, 0, 0, 140, 1932, 1, 0, 0, 0, 142, - 1944, 1, 0, 0, 0, 144, 1956, 1, 0, 0, 0, 146, 1965, 1, 0, 0, 0, 148, 2052, - 1, 0, 0, 0, 150, 2054, 1, 0, 0, 0, 152, 2057, 1, 0, 0, 0, 154, 2060, 1, - 0, 0, 0, 156, 2067, 1, 0, 0, 0, 158, 2074, 1, 0, 0, 0, 160, 2078, 1, 0, - 0, 0, 162, 2092, 1, 0, 0, 0, 164, 2094, 1, 0, 0, 0, 166, 2096, 1, 0, 0, - 0, 168, 2098, 1, 0, 0, 0, 170, 2102, 1, 0, 0, 0, 172, 2104, 1, 0, 0, 0, - 174, 2106, 1, 0, 0, 0, 176, 2108, 1, 0, 0, 0, 178, 2110, 1, 0, 0, 0, 180, - 2115, 1, 0, 0, 0, 182, 2119, 1, 0, 0, 0, 184, 2121, 1, 0, 0, 0, 186, 2123, - 1, 0, 0, 0, 188, 2125, 1, 0, 0, 0, 190, 2127, 1, 0, 0, 0, 192, 2129, 1, - 0, 0, 0, 194, 2131, 1, 0, 0, 0, 196, 2133, 1, 0, 0, 0, 198, 2135, 1, 0, - 0, 0, 200, 2137, 1, 0, 0, 0, 202, 2139, 1, 0, 0, 0, 204, 2141, 1, 0, 0, - 0, 206, 2143, 1, 0, 0, 0, 208, 2145, 1, 0, 0, 0, 210, 2147, 1, 0, 0, 0, - 212, 2149, 1, 0, 0, 0, 214, 2151, 1, 0, 0, 0, 216, 2153, 1, 0, 0, 0, 218, - 2155, 1, 0, 0, 0, 220, 2157, 1, 0, 0, 0, 222, 2159, 1, 0, 0, 0, 224, 2161, - 1, 0, 0, 0, 226, 2163, 1, 0, 0, 0, 228, 2172, 1, 0, 0, 0, 230, 232, 3, - 2, 1, 0, 231, 230, 1, 0, 0, 0, 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, - 0, 233, 234, 1, 0, 0, 0, 234, 236, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, - 237, 5, 0, 0, 1, 237, 1, 1, 0, 0, 0, 238, 240, 5, 1, 0, 0, 239, 238, 1, - 0, 0, 0, 240, 243, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 241, 242, 1, 0, 0, - 0, 242, 244, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 244, 253, 3, 4, 2, 0, 245, - 247, 5, 1, 0, 0, 246, 245, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 246, - 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 250, 1, 0, 0, 0, 250, 252, 3, 4, - 2, 0, 251, 246, 1, 0, 0, 0, 252, 255, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, - 253, 254, 1, 0, 0, 0, 254, 259, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 256, - 258, 5, 1, 0, 0, 257, 256, 1, 0, 0, 0, 258, 261, 1, 0, 0, 0, 259, 257, - 1, 0, 0, 0, 259, 260, 1, 0, 0, 0, 260, 3, 1, 0, 0, 0, 261, 259, 1, 0, 0, - 0, 262, 265, 5, 71, 0, 0, 263, 264, 5, 114, 0, 0, 264, 266, 5, 111, 0, - 0, 265, 263, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 268, 1, 0, 0, 0, 267, - 262, 1, 0, 0, 0, 267, 268, 1, 0, 0, 0, 268, 293, 1, 0, 0, 0, 269, 294, - 3, 6, 3, 0, 270, 294, 3, 8, 4, 0, 271, 294, 3, 10, 5, 0, 272, 294, 3, 12, - 6, 0, 273, 294, 3, 14, 7, 0, 274, 294, 3, 22, 11, 0, 275, 294, 3, 28, 14, - 0, 276, 294, 3, 44, 22, 0, 277, 294, 3, 46, 23, 0, 278, 294, 3, 48, 24, - 0, 279, 294, 3, 60, 30, 0, 280, 294, 3, 62, 31, 0, 281, 294, 3, 64, 32, - 0, 282, 294, 3, 66, 33, 0, 283, 294, 3, 74, 37, 0, 284, 294, 3, 78, 39, - 0, 285, 294, 3, 82, 41, 0, 286, 294, 3, 20, 10, 0, 287, 294, 3, 16, 8, - 0, 288, 294, 3, 18, 9, 0, 289, 294, 3, 84, 42, 0, 290, 294, 3, 106, 53, - 0, 291, 294, 3, 110, 55, 0, 292, 294, 3, 114, 57, 0, 293, 269, 1, 0, 0, - 0, 293, 270, 1, 0, 0, 0, 293, 271, 1, 0, 0, 0, 293, 272, 1, 0, 0, 0, 293, - 273, 1, 0, 0, 0, 293, 274, 1, 0, 0, 0, 293, 275, 1, 0, 0, 0, 293, 276, - 1, 0, 0, 0, 293, 277, 1, 0, 0, 0, 293, 278, 1, 0, 0, 0, 293, 279, 1, 0, - 0, 0, 293, 280, 1, 0, 0, 0, 293, 281, 1, 0, 0, 0, 293, 282, 1, 0, 0, 0, - 293, 283, 1, 0, 0, 0, 293, 284, 1, 0, 0, 0, 293, 285, 1, 0, 0, 0, 293, - 286, 1, 0, 0, 0, 293, 287, 1, 0, 0, 0, 293, 288, 1, 0, 0, 0, 293, 289, - 1, 0, 0, 0, 293, 290, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 293, 292, 1, 0, - 0, 0, 294, 5, 1, 0, 0, 0, 295, 296, 5, 30, 0, 0, 296, 300, 5, 133, 0, 0, - 297, 298, 3, 182, 91, 0, 298, 299, 5, 2, 0, 0, 299, 301, 1, 0, 0, 0, 300, - 297, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 325, - 3, 184, 92, 0, 303, 313, 5, 121, 0, 0, 304, 305, 5, 137, 0, 0, 305, 314, - 3, 188, 94, 0, 306, 308, 5, 46, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, - 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 310, 3, 190, 95, 0, 310, 311, 5, 137, - 0, 0, 311, 312, 3, 190, 95, 0, 312, 314, 1, 0, 0, 0, 313, 304, 1, 0, 0, - 0, 313, 307, 1, 0, 0, 0, 314, 326, 1, 0, 0, 0, 315, 317, 5, 27, 0, 0, 316, - 318, 5, 46, 0, 0, 317, 316, 1, 0, 0, 0, 317, 318, 1, 0, 0, 0, 318, 319, - 1, 0, 0, 0, 319, 326, 3, 30, 15, 0, 320, 322, 5, 63, 0, 0, 321, 323, 5, - 46, 0, 0, 322, 321, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, - 0, 324, 326, 3, 190, 95, 0, 325, 303, 1, 0, 0, 0, 325, 315, 1, 0, 0, 0, - 325, 320, 1, 0, 0, 0, 326, 7, 1, 0, 0, 0, 327, 335, 5, 31, 0, 0, 328, 336, - 3, 182, 91, 0, 329, 330, 3, 182, 91, 0, 330, 331, 5, 2, 0, 0, 331, 333, - 1, 0, 0, 0, 332, 329, 1, 0, 0, 0, 332, 333, 1, 0, 0, 0, 333, 334, 1, 0, - 0, 0, 334, 336, 3, 186, 93, 0, 335, 328, 1, 0, 0, 0, 335, 332, 1, 0, 0, - 0, 335, 336, 1, 0, 0, 0, 336, 9, 1, 0, 0, 0, 337, 339, 5, 35, 0, 0, 338, - 340, 5, 55, 0, 0, 339, 338, 1, 0, 0, 0, 339, 340, 1, 0, 0, 0, 340, 341, - 1, 0, 0, 0, 341, 342, 3, 68, 34, 0, 342, 343, 5, 33, 0, 0, 343, 344, 3, - 182, 91, 0, 344, 11, 1, 0, 0, 0, 345, 347, 5, 38, 0, 0, 346, 348, 7, 0, - 0, 0, 347, 346, 1, 0, 0, 0, 347, 348, 1, 0, 0, 0, 348, 353, 1, 0, 0, 0, - 349, 351, 5, 138, 0, 0, 350, 352, 3, 212, 106, 0, 351, 350, 1, 0, 0, 0, - 351, 352, 1, 0, 0, 0, 352, 354, 1, 0, 0, 0, 353, 349, 1, 0, 0, 0, 353, - 354, 1, 0, 0, 0, 354, 13, 1, 0, 0, 0, 355, 357, 7, 1, 0, 0, 356, 358, 5, - 138, 0, 0, 357, 356, 1, 0, 0, 0, 357, 358, 1, 0, 0, 0, 358, 15, 1, 0, 0, - 0, 359, 361, 5, 126, 0, 0, 360, 362, 5, 138, 0, 0, 361, 360, 1, 0, 0, 0, - 361, 362, 1, 0, 0, 0, 362, 368, 1, 0, 0, 0, 363, 365, 5, 137, 0, 0, 364, - 366, 5, 129, 0, 0, 365, 364, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 367, - 1, 0, 0, 0, 367, 369, 3, 206, 103, 0, 368, 363, 1, 0, 0, 0, 368, 369, 1, - 0, 0, 0, 369, 17, 1, 0, 0, 0, 370, 371, 5, 129, 0, 0, 371, 372, 3, 206, - 103, 0, 372, 19, 1, 0, 0, 0, 373, 375, 5, 120, 0, 0, 374, 376, 5, 129, - 0, 0, 375, 374, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 377, 1, 0, 0, 0, - 377, 378, 3, 206, 103, 0, 378, 21, 1, 0, 0, 0, 379, 381, 5, 50, 0, 0, 380, - 382, 5, 141, 0, 0, 381, 380, 1, 0, 0, 0, 381, 382, 1, 0, 0, 0, 382, 383, - 1, 0, 0, 0, 383, 387, 5, 84, 0, 0, 384, 385, 5, 80, 0, 0, 385, 386, 5, - 102, 0, 0, 386, 388, 5, 70, 0, 0, 387, 384, 1, 0, 0, 0, 387, 388, 1, 0, - 0, 0, 388, 392, 1, 0, 0, 0, 389, 390, 3, 182, 91, 0, 390, 391, 5, 2, 0, - 0, 391, 393, 1, 0, 0, 0, 392, 389, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, - 394, 1, 0, 0, 0, 394, 395, 3, 196, 98, 0, 395, 396, 5, 107, 0, 0, 396, - 397, 3, 184, 92, 0, 397, 398, 5, 3, 0, 0, 398, 403, 3, 24, 12, 0, 399, - 400, 5, 5, 0, 0, 400, 402, 3, 24, 12, 0, 401, 399, 1, 0, 0, 0, 402, 405, - 1, 0, 0, 0, 403, 401, 1, 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 406, 1, 0, - 0, 0, 405, 403, 1, 0, 0, 0, 406, 409, 5, 4, 0, 0, 407, 408, 5, 149, 0, - 0, 408, 410, 3, 68, 34, 0, 409, 407, 1, 0, 0, 0, 409, 410, 1, 0, 0, 0, - 410, 23, 1, 0, 0, 0, 411, 414, 3, 190, 95, 0, 412, 414, 3, 68, 34, 0, 413, - 411, 1, 0, 0, 0, 413, 412, 1, 0, 0, 0, 414, 417, 1, 0, 0, 0, 415, 416, - 5, 45, 0, 0, 416, 418, 3, 192, 96, 0, 417, 415, 1, 0, 0, 0, 417, 418, 1, - 0, 0, 0, 418, 420, 1, 0, 0, 0, 419, 421, 3, 140, 70, 0, 420, 419, 1, 0, - 0, 0, 420, 421, 1, 0, 0, 0, 421, 25, 1, 0, 0, 0, 422, 423, 5, 151, 0, 0, - 423, 426, 5, 186, 0, 0, 424, 426, 5, 132, 0, 0, 425, 422, 1, 0, 0, 0, 425, - 424, 1, 0, 0, 0, 426, 27, 1, 0, 0, 0, 427, 429, 5, 50, 0, 0, 428, 430, - 7, 2, 0, 0, 429, 428, 1, 0, 0, 0, 429, 430, 1, 0, 0, 0, 430, 431, 1, 0, - 0, 0, 431, 435, 5, 133, 0, 0, 432, 433, 5, 80, 0, 0, 433, 434, 5, 102, - 0, 0, 434, 436, 5, 70, 0, 0, 435, 432, 1, 0, 0, 0, 435, 436, 1, 0, 0, 0, - 436, 440, 1, 0, 0, 0, 437, 438, 3, 182, 91, 0, 438, 439, 5, 2, 0, 0, 439, - 441, 1, 0, 0, 0, 440, 437, 1, 0, 0, 0, 440, 441, 1, 0, 0, 0, 441, 442, - 1, 0, 0, 0, 442, 472, 3, 184, 92, 0, 443, 444, 5, 3, 0, 0, 444, 449, 3, - 30, 15, 0, 445, 446, 5, 5, 0, 0, 446, 448, 3, 30, 15, 0, 447, 445, 1, 0, - 0, 0, 448, 451, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, - 450, 456, 1, 0, 0, 0, 451, 449, 1, 0, 0, 0, 452, 453, 5, 5, 0, 0, 453, - 455, 3, 38, 19, 0, 454, 452, 1, 0, 0, 0, 455, 458, 1, 0, 0, 0, 456, 454, - 1, 0, 0, 0, 456, 457, 1, 0, 0, 0, 457, 459, 1, 0, 0, 0, 458, 456, 1, 0, - 0, 0, 459, 468, 5, 4, 0, 0, 460, 465, 3, 26, 13, 0, 461, 462, 5, 5, 0, - 0, 462, 464, 3, 26, 13, 0, 463, 461, 1, 0, 0, 0, 464, 467, 1, 0, 0, 0, - 465, 463, 1, 0, 0, 0, 465, 466, 1, 0, 0, 0, 466, 469, 1, 0, 0, 0, 467, - 465, 1, 0, 0, 0, 468, 460, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 473, - 1, 0, 0, 0, 470, 471, 5, 33, 0, 0, 471, 473, 3, 84, 42, 0, 472, 443, 1, - 0, 0, 0, 472, 470, 1, 0, 0, 0, 473, 29, 1, 0, 0, 0, 474, 476, 3, 190, 95, - 0, 475, 477, 3, 32, 16, 0, 476, 475, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, - 477, 481, 1, 0, 0, 0, 478, 480, 3, 34, 17, 0, 479, 478, 1, 0, 0, 0, 480, - 483, 1, 0, 0, 0, 481, 479, 1, 0, 0, 0, 481, 482, 1, 0, 0, 0, 482, 31, 1, - 0, 0, 0, 483, 481, 1, 0, 0, 0, 484, 486, 3, 176, 88, 0, 485, 484, 1, 0, - 0, 0, 486, 487, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 487, 485, 1, 0, 0, 0, - 488, 499, 1, 0, 0, 0, 489, 490, 5, 3, 0, 0, 490, 491, 3, 36, 18, 0, 491, - 492, 5, 4, 0, 0, 492, 500, 1, 0, 0, 0, 493, 494, 5, 3, 0, 0, 494, 495, - 3, 36, 18, 0, 495, 496, 5, 5, 0, 0, 496, 497, 3, 36, 18, 0, 497, 498, 5, - 4, 0, 0, 498, 500, 1, 0, 0, 0, 499, 489, 1, 0, 0, 0, 499, 493, 1, 0, 0, - 0, 499, 500, 1, 0, 0, 0, 500, 33, 1, 0, 0, 0, 501, 502, 5, 49, 0, 0, 502, - 504, 3, 176, 88, 0, 503, 501, 1, 0, 0, 0, 503, 504, 1, 0, 0, 0, 504, 552, - 1, 0, 0, 0, 505, 506, 5, 113, 0, 0, 506, 508, 5, 95, 0, 0, 507, 509, 3, - 140, 70, 0, 508, 507, 1, 0, 0, 0, 508, 509, 1, 0, 0, 0, 509, 511, 1, 0, - 0, 0, 510, 512, 3, 42, 21, 0, 511, 510, 1, 0, 0, 0, 511, 512, 1, 0, 0, - 0, 512, 514, 1, 0, 0, 0, 513, 515, 5, 36, 0, 0, 514, 513, 1, 0, 0, 0, 514, - 515, 1, 0, 0, 0, 515, 553, 1, 0, 0, 0, 516, 517, 5, 102, 0, 0, 517, 520, - 5, 104, 0, 0, 518, 520, 5, 141, 0, 0, 519, 516, 1, 0, 0, 0, 519, 518, 1, - 0, 0, 0, 520, 522, 1, 0, 0, 0, 521, 523, 3, 42, 21, 0, 522, 521, 1, 0, - 0, 0, 522, 523, 1, 0, 0, 0, 523, 553, 1, 0, 0, 0, 524, 525, 5, 44, 0, 0, - 525, 526, 5, 3, 0, 0, 526, 527, 3, 68, 34, 0, 527, 528, 5, 4, 0, 0, 528, - 553, 1, 0, 0, 0, 529, 536, 5, 56, 0, 0, 530, 537, 3, 36, 18, 0, 531, 537, - 3, 72, 36, 0, 532, 533, 5, 3, 0, 0, 533, 534, 3, 68, 34, 0, 534, 535, 5, - 4, 0, 0, 535, 537, 1, 0, 0, 0, 536, 530, 1, 0, 0, 0, 536, 531, 1, 0, 0, - 0, 536, 532, 1, 0, 0, 0, 537, 553, 1, 0, 0, 0, 538, 539, 5, 45, 0, 0, 539, - 553, 3, 192, 96, 0, 540, 553, 3, 40, 20, 0, 541, 542, 5, 170, 0, 0, 542, - 544, 5, 171, 0, 0, 543, 541, 1, 0, 0, 0, 543, 544, 1, 0, 0, 0, 544, 545, - 1, 0, 0, 0, 545, 546, 5, 33, 0, 0, 546, 547, 5, 3, 0, 0, 547, 548, 3, 68, - 34, 0, 548, 550, 5, 4, 0, 0, 549, 551, 7, 3, 0, 0, 550, 549, 1, 0, 0, 0, - 550, 551, 1, 0, 0, 0, 551, 553, 1, 0, 0, 0, 552, 505, 1, 0, 0, 0, 552, - 519, 1, 0, 0, 0, 552, 524, 1, 0, 0, 0, 552, 529, 1, 0, 0, 0, 552, 538, - 1, 0, 0, 0, 552, 540, 1, 0, 0, 0, 552, 543, 1, 0, 0, 0, 553, 35, 1, 0, - 0, 0, 554, 556, 7, 4, 0, 0, 555, 554, 1, 0, 0, 0, 555, 556, 1, 0, 0, 0, - 556, 557, 1, 0, 0, 0, 557, 558, 5, 187, 0, 0, 558, 37, 1, 0, 0, 0, 559, - 560, 5, 49, 0, 0, 560, 562, 3, 176, 88, 0, 561, 559, 1, 0, 0, 0, 561, 562, - 1, 0, 0, 0, 562, 600, 1, 0, 0, 0, 563, 564, 5, 113, 0, 0, 564, 567, 5, - 95, 0, 0, 565, 567, 5, 141, 0, 0, 566, 563, 1, 0, 0, 0, 566, 565, 1, 0, - 0, 0, 567, 568, 1, 0, 0, 0, 568, 569, 5, 3, 0, 0, 569, 574, 3, 24, 12, - 0, 570, 571, 5, 5, 0, 0, 571, 573, 3, 24, 12, 0, 572, 570, 1, 0, 0, 0, - 573, 576, 1, 0, 0, 0, 574, 572, 1, 0, 0, 0, 574, 575, 1, 0, 0, 0, 575, - 577, 1, 0, 0, 0, 576, 574, 1, 0, 0, 0, 577, 579, 5, 4, 0, 0, 578, 580, - 3, 42, 21, 0, 579, 578, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 601, 1, - 0, 0, 0, 581, 582, 5, 44, 0, 0, 582, 583, 5, 3, 0, 0, 583, 584, 3, 68, - 34, 0, 584, 585, 5, 4, 0, 0, 585, 601, 1, 0, 0, 0, 586, 587, 5, 74, 0, - 0, 587, 588, 5, 95, 0, 0, 588, 589, 5, 3, 0, 0, 589, 594, 3, 190, 95, 0, - 590, 591, 5, 5, 0, 0, 591, 593, 3, 190, 95, 0, 592, 590, 1, 0, 0, 0, 593, - 596, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, 594, 595, 1, 0, 0, 0, 595, 597, - 1, 0, 0, 0, 596, 594, 1, 0, 0, 0, 597, 598, 5, 4, 0, 0, 598, 599, 3, 40, - 20, 0, 599, 601, 1, 0, 0, 0, 600, 566, 1, 0, 0, 0, 600, 581, 1, 0, 0, 0, - 600, 586, 1, 0, 0, 0, 601, 39, 1, 0, 0, 0, 602, 603, 5, 117, 0, 0, 603, - 615, 3, 194, 97, 0, 604, 605, 5, 3, 0, 0, 605, 610, 3, 190, 95, 0, 606, - 607, 5, 5, 0, 0, 607, 609, 3, 190, 95, 0, 608, 606, 1, 0, 0, 0, 609, 612, - 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, 610, 611, 1, 0, 0, 0, 611, 613, 1, 0, - 0, 0, 612, 610, 1, 0, 0, 0, 613, 614, 5, 4, 0, 0, 614, 616, 1, 0, 0, 0, - 615, 604, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 631, 1, 0, 0, 0, 617, - 618, 5, 107, 0, 0, 618, 625, 7, 5, 0, 0, 619, 620, 5, 131, 0, 0, 620, 626, - 7, 6, 0, 0, 621, 626, 5, 41, 0, 0, 622, 626, 5, 123, 0, 0, 623, 624, 5, - 101, 0, 0, 624, 626, 5, 26, 0, 0, 625, 619, 1, 0, 0, 0, 625, 621, 1, 0, - 0, 0, 625, 622, 1, 0, 0, 0, 625, 623, 1, 0, 0, 0, 626, 630, 1, 0, 0, 0, - 627, 628, 5, 99, 0, 0, 628, 630, 3, 176, 88, 0, 629, 617, 1, 0, 0, 0, 629, - 627, 1, 0, 0, 0, 630, 633, 1, 0, 0, 0, 631, 629, 1, 0, 0, 0, 631, 632, - 1, 0, 0, 0, 632, 642, 1, 0, 0, 0, 633, 631, 1, 0, 0, 0, 634, 636, 5, 102, - 0, 0, 635, 634, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, - 637, 640, 5, 57, 0, 0, 638, 639, 5, 86, 0, 0, 639, 641, 7, 7, 0, 0, 640, - 638, 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 643, 1, 0, 0, 0, 642, 635, - 1, 0, 0, 0, 642, 643, 1, 0, 0, 0, 643, 41, 1, 0, 0, 0, 644, 645, 5, 107, - 0, 0, 645, 646, 5, 48, 0, 0, 646, 647, 7, 8, 0, 0, 647, 43, 1, 0, 0, 0, - 648, 650, 5, 50, 0, 0, 649, 651, 7, 2, 0, 0, 650, 649, 1, 0, 0, 0, 650, - 651, 1, 0, 0, 0, 651, 652, 1, 0, 0, 0, 652, 656, 5, 139, 0, 0, 653, 654, - 5, 80, 0, 0, 654, 655, 5, 102, 0, 0, 655, 657, 5, 70, 0, 0, 656, 653, 1, - 0, 0, 0, 656, 657, 1, 0, 0, 0, 657, 661, 1, 0, 0, 0, 658, 659, 3, 182, - 91, 0, 659, 660, 5, 2, 0, 0, 660, 662, 1, 0, 0, 0, 661, 658, 1, 0, 0, 0, - 661, 662, 1, 0, 0, 0, 662, 663, 1, 0, 0, 0, 663, 668, 3, 198, 99, 0, 664, - 669, 5, 37, 0, 0, 665, 669, 5, 28, 0, 0, 666, 667, 5, 89, 0, 0, 667, 669, - 5, 105, 0, 0, 668, 664, 1, 0, 0, 0, 668, 665, 1, 0, 0, 0, 668, 666, 1, - 0, 0, 0, 668, 669, 1, 0, 0, 0, 669, 684, 1, 0, 0, 0, 670, 685, 5, 59, 0, - 0, 671, 685, 5, 88, 0, 0, 672, 682, 5, 142, 0, 0, 673, 674, 5, 105, 0, - 0, 674, 679, 3, 190, 95, 0, 675, 676, 5, 5, 0, 0, 676, 678, 3, 190, 95, - 0, 677, 675, 1, 0, 0, 0, 678, 681, 1, 0, 0, 0, 679, 677, 1, 0, 0, 0, 679, - 680, 1, 0, 0, 0, 680, 683, 1, 0, 0, 0, 681, 679, 1, 0, 0, 0, 682, 673, - 1, 0, 0, 0, 682, 683, 1, 0, 0, 0, 683, 685, 1, 0, 0, 0, 684, 670, 1, 0, - 0, 0, 684, 671, 1, 0, 0, 0, 684, 672, 1, 0, 0, 0, 685, 686, 1, 0, 0, 0, - 686, 687, 5, 107, 0, 0, 687, 691, 3, 184, 92, 0, 688, 689, 5, 73, 0, 0, - 689, 690, 5, 64, 0, 0, 690, 692, 5, 127, 0, 0, 691, 688, 1, 0, 0, 0, 691, - 692, 1, 0, 0, 0, 692, 695, 1, 0, 0, 0, 693, 694, 5, 148, 0, 0, 694, 696, - 3, 68, 34, 0, 695, 693, 1, 0, 0, 0, 695, 696, 1, 0, 0, 0, 696, 697, 1, - 0, 0, 0, 697, 706, 5, 38, 0, 0, 698, 703, 3, 106, 53, 0, 699, 703, 3, 74, - 37, 0, 700, 703, 3, 60, 30, 0, 701, 703, 3, 84, 42, 0, 702, 698, 1, 0, - 0, 0, 702, 699, 1, 0, 0, 0, 702, 700, 1, 0, 0, 0, 702, 701, 1, 0, 0, 0, - 703, 704, 1, 0, 0, 0, 704, 705, 5, 1, 0, 0, 705, 707, 1, 0, 0, 0, 706, - 702, 1, 0, 0, 0, 707, 708, 1, 0, 0, 0, 708, 706, 1, 0, 0, 0, 708, 709, - 1, 0, 0, 0, 709, 710, 1, 0, 0, 0, 710, 711, 5, 66, 0, 0, 711, 45, 1, 0, - 0, 0, 712, 714, 5, 50, 0, 0, 713, 715, 7, 2, 0, 0, 714, 713, 1, 0, 0, 0, - 714, 715, 1, 0, 0, 0, 715, 716, 1, 0, 0, 0, 716, 720, 5, 146, 0, 0, 717, - 718, 5, 80, 0, 0, 718, 719, 5, 102, 0, 0, 719, 721, 5, 70, 0, 0, 720, 717, - 1, 0, 0, 0, 720, 721, 1, 0, 0, 0, 721, 725, 1, 0, 0, 0, 722, 723, 3, 182, - 91, 0, 723, 724, 5, 2, 0, 0, 724, 726, 1, 0, 0, 0, 725, 722, 1, 0, 0, 0, - 725, 726, 1, 0, 0, 0, 726, 727, 1, 0, 0, 0, 727, 739, 3, 200, 100, 0, 728, - 729, 5, 3, 0, 0, 729, 734, 3, 190, 95, 0, 730, 731, 5, 5, 0, 0, 731, 733, - 3, 190, 95, 0, 732, 730, 1, 0, 0, 0, 733, 736, 1, 0, 0, 0, 734, 732, 1, - 0, 0, 0, 734, 735, 1, 0, 0, 0, 735, 737, 1, 0, 0, 0, 736, 734, 1, 0, 0, - 0, 737, 738, 5, 4, 0, 0, 738, 740, 1, 0, 0, 0, 739, 728, 1, 0, 0, 0, 739, - 740, 1, 0, 0, 0, 740, 741, 1, 0, 0, 0, 741, 742, 5, 33, 0, 0, 742, 743, - 3, 84, 42, 0, 743, 47, 1, 0, 0, 0, 744, 745, 5, 50, 0, 0, 745, 746, 5, - 147, 0, 0, 746, 750, 5, 133, 0, 0, 747, 748, 5, 80, 0, 0, 748, 749, 5, - 102, 0, 0, 749, 751, 5, 70, 0, 0, 750, 747, 1, 0, 0, 0, 750, 751, 1, 0, - 0, 0, 751, 755, 1, 0, 0, 0, 752, 753, 3, 182, 91, 0, 753, 754, 5, 2, 0, - 0, 754, 756, 1, 0, 0, 0, 755, 752, 1, 0, 0, 0, 755, 756, 1, 0, 0, 0, 756, - 757, 1, 0, 0, 0, 757, 758, 3, 184, 92, 0, 758, 759, 5, 143, 0, 0, 759, - 771, 3, 202, 101, 0, 760, 761, 5, 3, 0, 0, 761, 766, 3, 170, 85, 0, 762, - 763, 5, 5, 0, 0, 763, 765, 3, 170, 85, 0, 764, 762, 1, 0, 0, 0, 765, 768, - 1, 0, 0, 0, 766, 764, 1, 0, 0, 0, 766, 767, 1, 0, 0, 0, 767, 769, 1, 0, - 0, 0, 768, 766, 1, 0, 0, 0, 769, 770, 5, 4, 0, 0, 770, 772, 1, 0, 0, 0, - 771, 760, 1, 0, 0, 0, 771, 772, 1, 0, 0, 0, 772, 49, 1, 0, 0, 0, 773, 775, - 5, 150, 0, 0, 774, 776, 5, 116, 0, 0, 775, 774, 1, 0, 0, 0, 775, 776, 1, - 0, 0, 0, 776, 777, 1, 0, 0, 0, 777, 778, 3, 52, 26, 0, 778, 779, 5, 33, - 0, 0, 779, 780, 5, 3, 0, 0, 780, 781, 3, 84, 42, 0, 781, 791, 5, 4, 0, - 0, 782, 783, 5, 5, 0, 0, 783, 784, 3, 52, 26, 0, 784, 785, 5, 33, 0, 0, - 785, 786, 5, 3, 0, 0, 786, 787, 3, 84, 42, 0, 787, 788, 5, 4, 0, 0, 788, - 790, 1, 0, 0, 0, 789, 782, 1, 0, 0, 0, 790, 793, 1, 0, 0, 0, 791, 789, - 1, 0, 0, 0, 791, 792, 1, 0, 0, 0, 792, 51, 1, 0, 0, 0, 793, 791, 1, 0, - 0, 0, 794, 806, 3, 184, 92, 0, 795, 796, 5, 3, 0, 0, 796, 801, 3, 190, - 95, 0, 797, 798, 5, 5, 0, 0, 798, 800, 3, 190, 95, 0, 799, 797, 1, 0, 0, - 0, 800, 803, 1, 0, 0, 0, 801, 799, 1, 0, 0, 0, 801, 802, 1, 0, 0, 0, 802, - 804, 1, 0, 0, 0, 803, 801, 1, 0, 0, 0, 804, 805, 5, 4, 0, 0, 805, 807, - 1, 0, 0, 0, 806, 795, 1, 0, 0, 0, 806, 807, 1, 0, 0, 0, 807, 53, 1, 0, - 0, 0, 808, 809, 3, 52, 26, 0, 809, 810, 5, 33, 0, 0, 810, 811, 5, 3, 0, - 0, 811, 812, 3, 162, 81, 0, 812, 814, 5, 140, 0, 0, 813, 815, 5, 29, 0, - 0, 814, 813, 1, 0, 0, 0, 814, 815, 1, 0, 0, 0, 815, 816, 1, 0, 0, 0, 816, - 817, 3, 164, 82, 0, 817, 818, 5, 4, 0, 0, 818, 55, 1, 0, 0, 0, 819, 831, - 3, 184, 92, 0, 820, 821, 5, 3, 0, 0, 821, 826, 3, 190, 95, 0, 822, 823, - 5, 5, 0, 0, 823, 825, 3, 190, 95, 0, 824, 822, 1, 0, 0, 0, 825, 828, 1, - 0, 0, 0, 826, 824, 1, 0, 0, 0, 826, 827, 1, 0, 0, 0, 827, 829, 1, 0, 0, - 0, 828, 826, 1, 0, 0, 0, 829, 830, 5, 4, 0, 0, 830, 832, 1, 0, 0, 0, 831, - 820, 1, 0, 0, 0, 831, 832, 1, 0, 0, 0, 832, 833, 1, 0, 0, 0, 833, 834, - 5, 33, 0, 0, 834, 835, 5, 3, 0, 0, 835, 836, 3, 84, 42, 0, 836, 837, 5, - 4, 0, 0, 837, 57, 1, 0, 0, 0, 838, 847, 5, 124, 0, 0, 839, 848, 5, 7, 0, - 0, 840, 845, 3, 68, 34, 0, 841, 843, 5, 33, 0, 0, 842, 841, 1, 0, 0, 0, - 842, 843, 1, 0, 0, 0, 843, 844, 1, 0, 0, 0, 844, 846, 3, 172, 86, 0, 845, - 842, 1, 0, 0, 0, 845, 846, 1, 0, 0, 0, 846, 848, 1, 0, 0, 0, 847, 839, - 1, 0, 0, 0, 847, 840, 1, 0, 0, 0, 848, 862, 1, 0, 0, 0, 849, 858, 5, 5, - 0, 0, 850, 859, 5, 7, 0, 0, 851, 856, 3, 68, 34, 0, 852, 854, 5, 33, 0, - 0, 853, 852, 1, 0, 0, 0, 853, 854, 1, 0, 0, 0, 854, 855, 1, 0, 0, 0, 855, - 857, 3, 172, 86, 0, 856, 853, 1, 0, 0, 0, 856, 857, 1, 0, 0, 0, 857, 859, - 1, 0, 0, 0, 858, 850, 1, 0, 0, 0, 858, 851, 1, 0, 0, 0, 859, 861, 1, 0, - 0, 0, 860, 849, 1, 0, 0, 0, 861, 864, 1, 0, 0, 0, 862, 860, 1, 0, 0, 0, - 862, 863, 1, 0, 0, 0, 863, 59, 1, 0, 0, 0, 864, 862, 1, 0, 0, 0, 865, 867, - 3, 50, 25, 0, 866, 865, 1, 0, 0, 0, 866, 867, 1, 0, 0, 0, 867, 868, 1, - 0, 0, 0, 868, 869, 5, 59, 0, 0, 869, 870, 5, 75, 0, 0, 870, 873, 3, 112, - 56, 0, 871, 872, 5, 149, 0, 0, 872, 874, 3, 68, 34, 0, 873, 871, 1, 0, - 0, 0, 873, 874, 1, 0, 0, 0, 874, 876, 1, 0, 0, 0, 875, 877, 3, 58, 29, - 0, 876, 875, 1, 0, 0, 0, 876, 877, 1, 0, 0, 0, 877, 61, 1, 0, 0, 0, 878, - 880, 3, 50, 25, 0, 879, 878, 1, 0, 0, 0, 879, 880, 1, 0, 0, 0, 880, 881, - 1, 0, 0, 0, 881, 882, 5, 59, 0, 0, 882, 883, 5, 75, 0, 0, 883, 886, 3, - 112, 56, 0, 884, 885, 5, 149, 0, 0, 885, 887, 3, 68, 34, 0, 886, 884, 1, - 0, 0, 0, 886, 887, 1, 0, 0, 0, 887, 892, 1, 0, 0, 0, 888, 890, 3, 134, - 67, 0, 889, 888, 1, 0, 0, 0, 889, 890, 1, 0, 0, 0, 890, 891, 1, 0, 0, 0, - 891, 893, 3, 136, 68, 0, 892, 889, 1, 0, 0, 0, 892, 893, 1, 0, 0, 0, 893, - 895, 1, 0, 0, 0, 894, 896, 3, 58, 29, 0, 895, 894, 1, 0, 0, 0, 895, 896, - 1, 0, 0, 0, 896, 63, 1, 0, 0, 0, 897, 899, 5, 61, 0, 0, 898, 900, 5, 55, - 0, 0, 899, 898, 1, 0, 0, 0, 899, 900, 1, 0, 0, 0, 900, 901, 1, 0, 0, 0, - 901, 902, 3, 182, 91, 0, 902, 65, 1, 0, 0, 0, 903, 904, 5, 63, 0, 0, 904, - 907, 7, 9, 0, 0, 905, 906, 5, 80, 0, 0, 906, 908, 5, 70, 0, 0, 907, 905, - 1, 0, 0, 0, 907, 908, 1, 0, 0, 0, 908, 912, 1, 0, 0, 0, 909, 910, 3, 182, - 91, 0, 910, 911, 5, 2, 0, 0, 911, 913, 1, 0, 0, 0, 912, 909, 1, 0, 0, 0, - 912, 913, 1, 0, 0, 0, 913, 914, 1, 0, 0, 0, 914, 915, 3, 228, 114, 0, 915, - 67, 1, 0, 0, 0, 916, 917, 6, 34, -1, 0, 917, 1006, 3, 72, 36, 0, 918, 1006, - 5, 188, 0, 0, 919, 1006, 5, 189, 0, 0, 920, 921, 3, 182, 91, 0, 921, 922, - 5, 2, 0, 0, 922, 924, 1, 0, 0, 0, 923, 920, 1, 0, 0, 0, 923, 924, 1, 0, - 0, 0, 924, 925, 1, 0, 0, 0, 925, 926, 3, 184, 92, 0, 926, 927, 5, 2, 0, - 0, 927, 929, 1, 0, 0, 0, 928, 923, 1, 0, 0, 0, 928, 929, 1, 0, 0, 0, 929, - 930, 1, 0, 0, 0, 930, 1006, 3, 190, 95, 0, 931, 932, 3, 166, 83, 0, 932, - 933, 3, 68, 34, 20, 933, 1006, 1, 0, 0, 0, 934, 935, 3, 180, 90, 0, 935, - 948, 5, 3, 0, 0, 936, 938, 5, 62, 0, 0, 937, 936, 1, 0, 0, 0, 937, 938, - 1, 0, 0, 0, 938, 939, 1, 0, 0, 0, 939, 944, 3, 68, 34, 0, 940, 941, 5, - 5, 0, 0, 941, 943, 3, 68, 34, 0, 942, 940, 1, 0, 0, 0, 943, 946, 1, 0, - 0, 0, 944, 942, 1, 0, 0, 0, 944, 945, 1, 0, 0, 0, 945, 949, 1, 0, 0, 0, - 946, 944, 1, 0, 0, 0, 947, 949, 5, 7, 0, 0, 948, 937, 1, 0, 0, 0, 948, - 947, 1, 0, 0, 0, 948, 949, 1, 0, 0, 0, 949, 950, 1, 0, 0, 0, 950, 952, - 5, 4, 0, 0, 951, 953, 3, 116, 58, 0, 952, 951, 1, 0, 0, 0, 952, 953, 1, - 0, 0, 0, 953, 955, 1, 0, 0, 0, 954, 956, 3, 120, 60, 0, 955, 954, 1, 0, - 0, 0, 955, 956, 1, 0, 0, 0, 956, 1006, 1, 0, 0, 0, 957, 958, 5, 3, 0, 0, - 958, 963, 3, 68, 34, 0, 959, 960, 5, 5, 0, 0, 960, 962, 3, 68, 34, 0, 961, - 959, 1, 0, 0, 0, 962, 965, 1, 0, 0, 0, 963, 961, 1, 0, 0, 0, 963, 964, - 1, 0, 0, 0, 964, 966, 1, 0, 0, 0, 965, 963, 1, 0, 0, 0, 966, 967, 5, 4, - 0, 0, 967, 1006, 1, 0, 0, 0, 968, 969, 5, 43, 0, 0, 969, 970, 5, 3, 0, - 0, 970, 971, 3, 68, 34, 0, 971, 972, 5, 33, 0, 0, 972, 973, 3, 32, 16, - 0, 973, 974, 5, 4, 0, 0, 974, 1006, 1, 0, 0, 0, 975, 977, 5, 102, 0, 0, - 976, 975, 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, - 980, 5, 70, 0, 0, 979, 976, 1, 0, 0, 0, 979, 980, 1, 0, 0, 0, 980, 981, - 1, 0, 0, 0, 981, 982, 5, 3, 0, 0, 982, 983, 3, 84, 42, 0, 983, 984, 5, - 4, 0, 0, 984, 1006, 1, 0, 0, 0, 985, 987, 5, 42, 0, 0, 986, 988, 3, 68, - 34, 0, 987, 986, 1, 0, 0, 0, 987, 988, 1, 0, 0, 0, 988, 994, 1, 0, 0, 0, - 989, 990, 5, 148, 0, 0, 990, 991, 3, 68, 34, 0, 991, 992, 5, 136, 0, 0, - 992, 993, 3, 68, 34, 0, 993, 995, 1, 0, 0, 0, 994, 989, 1, 0, 0, 0, 995, - 996, 1, 0, 0, 0, 996, 994, 1, 0, 0, 0, 996, 997, 1, 0, 0, 0, 997, 1000, - 1, 0, 0, 0, 998, 999, 5, 65, 0, 0, 999, 1001, 3, 68, 34, 0, 1000, 998, - 1, 0, 0, 0, 1000, 1001, 1, 0, 0, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1003, - 5, 66, 0, 0, 1003, 1006, 1, 0, 0, 0, 1004, 1006, 3, 70, 35, 0, 1005, 916, - 1, 0, 0, 0, 1005, 918, 1, 0, 0, 0, 1005, 919, 1, 0, 0, 0, 1005, 928, 1, - 0, 0, 0, 1005, 931, 1, 0, 0, 0, 1005, 934, 1, 0, 0, 0, 1005, 957, 1, 0, - 0, 0, 1005, 968, 1, 0, 0, 0, 1005, 979, 1, 0, 0, 0, 1005, 985, 1, 0, 0, - 0, 1005, 1004, 1, 0, 0, 0, 1006, 1123, 1, 0, 0, 0, 1007, 1008, 10, 19, - 0, 0, 1008, 1009, 5, 11, 0, 0, 1009, 1122, 3, 68, 34, 20, 1010, 1011, 10, - 18, 0, 0, 1011, 1012, 7, 10, 0, 0, 1012, 1122, 3, 68, 34, 19, 1013, 1014, - 10, 17, 0, 0, 1014, 1015, 7, 4, 0, 0, 1015, 1122, 3, 68, 34, 18, 1016, - 1017, 10, 16, 0, 0, 1017, 1018, 7, 11, 0, 0, 1018, 1122, 3, 68, 34, 17, - 1019, 1020, 10, 15, 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1122, 3, 68, 34, - 16, 1022, 1038, 10, 14, 0, 0, 1023, 1039, 5, 6, 0, 0, 1024, 1039, 5, 22, - 0, 0, 1025, 1039, 5, 23, 0, 0, 1026, 1039, 5, 24, 0, 0, 1027, 1039, 5, - 92, 0, 0, 1028, 1029, 5, 92, 0, 0, 1029, 1039, 5, 102, 0, 0, 1030, 1032, - 5, 102, 0, 0, 1031, 1030, 1, 0, 0, 0, 1031, 1032, 1, 0, 0, 0, 1032, 1033, - 1, 0, 0, 0, 1033, 1039, 5, 83, 0, 0, 1034, 1039, 5, 97, 0, 0, 1035, 1039, - 5, 77, 0, 0, 1036, 1039, 5, 99, 0, 0, 1037, 1039, 5, 118, 0, 0, 1038, 1023, - 1, 0, 0, 0, 1038, 1024, 1, 0, 0, 0, 1038, 1025, 1, 0, 0, 0, 1038, 1026, - 1, 0, 0, 0, 1038, 1027, 1, 0, 0, 0, 1038, 1028, 1, 0, 0, 0, 1038, 1031, - 1, 0, 0, 0, 1038, 1034, 1, 0, 0, 0, 1038, 1035, 1, 0, 0, 0, 1038, 1036, - 1, 0, 0, 0, 1038, 1037, 1, 0, 0, 0, 1039, 1040, 1, 0, 0, 0, 1040, 1122, - 3, 68, 34, 15, 1041, 1042, 10, 12, 0, 0, 1042, 1043, 5, 32, 0, 0, 1043, - 1122, 3, 68, 34, 13, 1044, 1045, 10, 11, 0, 0, 1045, 1046, 5, 108, 0, 0, - 1046, 1122, 3, 68, 34, 12, 1047, 1049, 10, 4, 0, 0, 1048, 1050, 5, 102, - 0, 0, 1049, 1048, 1, 0, 0, 0, 1049, 1050, 1, 0, 0, 0, 1050, 1051, 1, 0, - 0, 0, 1051, 1052, 5, 39, 0, 0, 1052, 1053, 3, 68, 34, 0, 1053, 1054, 5, - 32, 0, 0, 1054, 1055, 3, 68, 34, 5, 1055, 1122, 1, 0, 0, 0, 1056, 1058, - 10, 13, 0, 0, 1057, 1059, 5, 102, 0, 0, 1058, 1057, 1, 0, 0, 0, 1058, 1059, - 1, 0, 0, 0, 1059, 1060, 1, 0, 0, 0, 1060, 1099, 5, 83, 0, 0, 1061, 1071, - 5, 3, 0, 0, 1062, 1072, 3, 84, 42, 0, 1063, 1068, 3, 68, 34, 0, 1064, 1065, - 5, 5, 0, 0, 1065, 1067, 3, 68, 34, 0, 1066, 1064, 1, 0, 0, 0, 1067, 1070, - 1, 0, 0, 0, 1068, 1066, 1, 0, 0, 0, 1068, 1069, 1, 0, 0, 0, 1069, 1072, - 1, 0, 0, 0, 1070, 1068, 1, 0, 0, 0, 1071, 1062, 1, 0, 0, 0, 1071, 1063, - 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1073, 1, 0, 0, 0, 1073, 1100, - 5, 4, 0, 0, 1074, 1075, 3, 182, 91, 0, 1075, 1076, 5, 2, 0, 0, 1076, 1078, - 1, 0, 0, 0, 1077, 1074, 1, 0, 0, 0, 1077, 1078, 1, 0, 0, 0, 1078, 1079, - 1, 0, 0, 0, 1079, 1100, 3, 184, 92, 0, 1080, 1081, 3, 182, 91, 0, 1081, - 1082, 5, 2, 0, 0, 1082, 1084, 1, 0, 0, 0, 1083, 1080, 1, 0, 0, 0, 1083, - 1084, 1, 0, 0, 0, 1084, 1085, 1, 0, 0, 0, 1085, 1086, 3, 226, 113, 0, 1086, - 1095, 5, 3, 0, 0, 1087, 1092, 3, 68, 34, 0, 1088, 1089, 5, 5, 0, 0, 1089, - 1091, 3, 68, 34, 0, 1090, 1088, 1, 0, 0, 0, 1091, 1094, 1, 0, 0, 0, 1092, - 1090, 1, 0, 0, 0, 1092, 1093, 1, 0, 0, 0, 1093, 1096, 1, 0, 0, 0, 1094, - 1092, 1, 0, 0, 0, 1095, 1087, 1, 0, 0, 0, 1095, 1096, 1, 0, 0, 0, 1096, - 1097, 1, 0, 0, 0, 1097, 1098, 5, 4, 0, 0, 1098, 1100, 1, 0, 0, 0, 1099, - 1061, 1, 0, 0, 0, 1099, 1077, 1, 0, 0, 0, 1099, 1083, 1, 0, 0, 0, 1100, - 1122, 1, 0, 0, 0, 1101, 1102, 10, 7, 0, 0, 1102, 1103, 5, 45, 0, 0, 1103, - 1122, 3, 192, 96, 0, 1104, 1106, 10, 6, 0, 0, 1105, 1107, 5, 102, 0, 0, - 1106, 1105, 1, 0, 0, 0, 1106, 1107, 1, 0, 0, 0, 1107, 1108, 1, 0, 0, 0, - 1108, 1109, 7, 13, 0, 0, 1109, 1112, 3, 68, 34, 0, 1110, 1111, 5, 67, 0, - 0, 1111, 1113, 3, 68, 34, 0, 1112, 1110, 1, 0, 0, 0, 1112, 1113, 1, 0, - 0, 0, 1113, 1122, 1, 0, 0, 0, 1114, 1119, 10, 5, 0, 0, 1115, 1120, 5, 93, - 0, 0, 1116, 1120, 5, 103, 0, 0, 1117, 1118, 5, 102, 0, 0, 1118, 1120, 5, - 104, 0, 0, 1119, 1115, 1, 0, 0, 0, 1119, 1116, 1, 0, 0, 0, 1119, 1117, - 1, 0, 0, 0, 1120, 1122, 1, 0, 0, 0, 1121, 1007, 1, 0, 0, 0, 1121, 1010, - 1, 0, 0, 0, 1121, 1013, 1, 0, 0, 0, 1121, 1016, 1, 0, 0, 0, 1121, 1019, - 1, 0, 0, 0, 1121, 1022, 1, 0, 0, 0, 1121, 1041, 1, 0, 0, 0, 1121, 1044, - 1, 0, 0, 0, 1121, 1047, 1, 0, 0, 0, 1121, 1056, 1, 0, 0, 0, 1121, 1101, - 1, 0, 0, 0, 1121, 1104, 1, 0, 0, 0, 1121, 1114, 1, 0, 0, 0, 1122, 1125, - 1, 0, 0, 0, 1123, 1121, 1, 0, 0, 0, 1123, 1124, 1, 0, 0, 0, 1124, 69, 1, - 0, 0, 0, 1125, 1123, 1, 0, 0, 0, 1126, 1127, 5, 115, 0, 0, 1127, 1132, - 5, 3, 0, 0, 1128, 1133, 5, 81, 0, 0, 1129, 1130, 7, 14, 0, 0, 1130, 1131, - 5, 5, 0, 0, 1131, 1133, 3, 168, 84, 0, 1132, 1128, 1, 0, 0, 0, 1132, 1129, - 1, 0, 0, 0, 1133, 1134, 1, 0, 0, 0, 1134, 1135, 5, 4, 0, 0, 1135, 71, 1, - 0, 0, 0, 1136, 1137, 7, 15, 0, 0, 1137, 73, 1, 0, 0, 0, 1138, 1140, 3, - 50, 25, 0, 1139, 1138, 1, 0, 0, 0, 1139, 1140, 1, 0, 0, 0, 1140, 1146, - 1, 0, 0, 0, 1141, 1147, 5, 88, 0, 0, 1142, 1147, 5, 122, 0, 0, 1143, 1144, - 5, 88, 0, 0, 1144, 1145, 5, 108, 0, 0, 1145, 1147, 7, 8, 0, 0, 1146, 1141, - 1, 0, 0, 0, 1146, 1142, 1, 0, 0, 0, 1146, 1143, 1, 0, 0, 0, 1147, 1148, - 1, 0, 0, 0, 1148, 1152, 5, 91, 0, 0, 1149, 1150, 3, 182, 91, 0, 1150, 1151, - 5, 2, 0, 0, 1151, 1153, 1, 0, 0, 0, 1152, 1149, 1, 0, 0, 0, 1152, 1153, - 1, 0, 0, 0, 1153, 1154, 1, 0, 0, 0, 1154, 1157, 3, 184, 92, 0, 1155, 1156, - 5, 33, 0, 0, 1156, 1158, 3, 208, 104, 0, 1157, 1155, 1, 0, 0, 0, 1157, - 1158, 1, 0, 0, 0, 1158, 1170, 1, 0, 0, 0, 1159, 1160, 5, 3, 0, 0, 1160, - 1165, 3, 190, 95, 0, 1161, 1162, 5, 5, 0, 0, 1162, 1164, 3, 190, 95, 0, - 1163, 1161, 1, 0, 0, 0, 1164, 1167, 1, 0, 0, 0, 1165, 1163, 1, 0, 0, 0, - 1165, 1166, 1, 0, 0, 0, 1166, 1168, 1, 0, 0, 0, 1167, 1165, 1, 0, 0, 0, - 1168, 1169, 5, 4, 0, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1159, 1, 0, 0, 0, - 1170, 1171, 1, 0, 0, 0, 1171, 1201, 1, 0, 0, 0, 1172, 1173, 5, 145, 0, - 0, 1173, 1174, 5, 3, 0, 0, 1174, 1179, 3, 68, 34, 0, 1175, 1176, 5, 5, - 0, 0, 1176, 1178, 3, 68, 34, 0, 1177, 1175, 1, 0, 0, 0, 1178, 1181, 1, - 0, 0, 0, 1179, 1177, 1, 0, 0, 0, 1179, 1180, 1, 0, 0, 0, 1180, 1182, 1, - 0, 0, 0, 1181, 1179, 1, 0, 0, 0, 1182, 1197, 5, 4, 0, 0, 1183, 1184, 5, - 5, 0, 0, 1184, 1185, 5, 3, 0, 0, 1185, 1190, 3, 68, 34, 0, 1186, 1187, - 5, 5, 0, 0, 1187, 1189, 3, 68, 34, 0, 1188, 1186, 1, 0, 0, 0, 1189, 1192, - 1, 0, 0, 0, 1190, 1188, 1, 0, 0, 0, 1190, 1191, 1, 0, 0, 0, 1191, 1193, - 1, 0, 0, 0, 1192, 1190, 1, 0, 0, 0, 1193, 1194, 5, 4, 0, 0, 1194, 1196, - 1, 0, 0, 0, 1195, 1183, 1, 0, 0, 0, 1196, 1199, 1, 0, 0, 0, 1197, 1195, - 1, 0, 0, 0, 1197, 1198, 1, 0, 0, 0, 1198, 1202, 1, 0, 0, 0, 1199, 1197, - 1, 0, 0, 0, 1200, 1202, 3, 84, 42, 0, 1201, 1172, 1, 0, 0, 0, 1201, 1200, - 1, 0, 0, 0, 1202, 1204, 1, 0, 0, 0, 1203, 1205, 3, 76, 38, 0, 1204, 1203, - 1, 0, 0, 0, 1204, 1205, 1, 0, 0, 0, 1205, 1207, 1, 0, 0, 0, 1206, 1208, - 3, 58, 29, 0, 1207, 1206, 1, 0, 0, 0, 1207, 1208, 1, 0, 0, 0, 1208, 1212, - 1, 0, 0, 0, 1209, 1210, 5, 56, 0, 0, 1210, 1212, 5, 145, 0, 0, 1211, 1139, - 1, 0, 0, 0, 1211, 1209, 1, 0, 0, 0, 1212, 75, 1, 0, 0, 0, 1213, 1214, 5, - 107, 0, 0, 1214, 1229, 5, 48, 0, 0, 1215, 1216, 5, 3, 0, 0, 1216, 1221, - 3, 24, 12, 0, 1217, 1218, 5, 5, 0, 0, 1218, 1220, 3, 24, 12, 0, 1219, 1217, - 1, 0, 0, 0, 1220, 1223, 1, 0, 0, 0, 1221, 1219, 1, 0, 0, 0, 1221, 1222, - 1, 0, 0, 0, 1222, 1224, 1, 0, 0, 0, 1223, 1221, 1, 0, 0, 0, 1224, 1227, - 5, 4, 0, 0, 1225, 1226, 5, 149, 0, 0, 1226, 1228, 3, 68, 34, 0, 1227, 1225, - 1, 0, 0, 0, 1227, 1228, 1, 0, 0, 0, 1228, 1230, 1, 0, 0, 0, 1229, 1215, - 1, 0, 0, 0, 1229, 1230, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1258, - 5, 184, 0, 0, 1232, 1259, 5, 185, 0, 0, 1233, 1234, 5, 142, 0, 0, 1234, - 1237, 5, 131, 0, 0, 1235, 1238, 3, 190, 95, 0, 1236, 1238, 3, 108, 54, - 0, 1237, 1235, 1, 0, 0, 0, 1237, 1236, 1, 0, 0, 0, 1238, 1239, 1, 0, 0, - 0, 1239, 1240, 5, 6, 0, 0, 1240, 1251, 3, 68, 34, 0, 1241, 1244, 5, 5, - 0, 0, 1242, 1245, 3, 190, 95, 0, 1243, 1245, 3, 108, 54, 0, 1244, 1242, - 1, 0, 0, 0, 1244, 1243, 1, 0, 0, 0, 1245, 1246, 1, 0, 0, 0, 1246, 1247, - 5, 6, 0, 0, 1247, 1248, 3, 68, 34, 0, 1248, 1250, 1, 0, 0, 0, 1249, 1241, - 1, 0, 0, 0, 1250, 1253, 1, 0, 0, 0, 1251, 1249, 1, 0, 0, 0, 1251, 1252, - 1, 0, 0, 0, 1252, 1256, 1, 0, 0, 0, 1253, 1251, 1, 0, 0, 0, 1254, 1255, - 5, 149, 0, 0, 1255, 1257, 3, 68, 34, 0, 1256, 1254, 1, 0, 0, 0, 1256, 1257, - 1, 0, 0, 0, 1257, 1259, 1, 0, 0, 0, 1258, 1232, 1, 0, 0, 0, 1258, 1233, - 1, 0, 0, 0, 1259, 77, 1, 0, 0, 0, 1260, 1264, 5, 112, 0, 0, 1261, 1262, - 3, 182, 91, 0, 1262, 1263, 5, 2, 0, 0, 1263, 1265, 1, 0, 0, 0, 1264, 1261, - 1, 0, 0, 0, 1264, 1265, 1, 0, 0, 0, 1265, 1266, 1, 0, 0, 0, 1266, 1273, - 3, 204, 102, 0, 1267, 1268, 5, 6, 0, 0, 1268, 1274, 3, 80, 40, 0, 1269, - 1270, 5, 3, 0, 0, 1270, 1271, 3, 80, 40, 0, 1271, 1272, 5, 4, 0, 0, 1272, - 1274, 1, 0, 0, 0, 1273, 1267, 1, 0, 0, 0, 1273, 1269, 1, 0, 0, 0, 1273, - 1274, 1, 0, 0, 0, 1274, 79, 1, 0, 0, 0, 1275, 1279, 3, 36, 18, 0, 1276, - 1279, 3, 176, 88, 0, 1277, 1279, 5, 190, 0, 0, 1278, 1275, 1, 0, 0, 0, - 1278, 1276, 1, 0, 0, 0, 1278, 1277, 1, 0, 0, 0, 1279, 81, 1, 0, 0, 0, 1280, - 1291, 5, 119, 0, 0, 1281, 1292, 3, 192, 96, 0, 1282, 1283, 3, 182, 91, - 0, 1283, 1284, 5, 2, 0, 0, 1284, 1286, 1, 0, 0, 0, 1285, 1282, 1, 0, 0, - 0, 1285, 1286, 1, 0, 0, 0, 1286, 1289, 1, 0, 0, 0, 1287, 1290, 3, 184, - 92, 0, 1288, 1290, 3, 196, 98, 0, 1289, 1287, 1, 0, 0, 0, 1289, 1288, 1, - 0, 0, 0, 1290, 1292, 1, 0, 0, 0, 1291, 1281, 1, 0, 0, 0, 1291, 1285, 1, - 0, 0, 0, 1291, 1292, 1, 0, 0, 0, 1292, 83, 1, 0, 0, 0, 1293, 1295, 3, 132, - 66, 0, 1294, 1293, 1, 0, 0, 0, 1294, 1295, 1, 0, 0, 0, 1295, 1296, 1, 0, - 0, 0, 1296, 1302, 3, 88, 44, 0, 1297, 1298, 3, 104, 52, 0, 1298, 1299, - 3, 88, 44, 0, 1299, 1301, 1, 0, 0, 0, 1300, 1297, 1, 0, 0, 0, 1301, 1304, - 1, 0, 0, 0, 1302, 1300, 1, 0, 0, 0, 1302, 1303, 1, 0, 0, 0, 1303, 1306, - 1, 0, 0, 0, 1304, 1302, 1, 0, 0, 0, 1305, 1307, 3, 134, 67, 0, 1306, 1305, - 1, 0, 0, 0, 1306, 1307, 1, 0, 0, 0, 1307, 1309, 1, 0, 0, 0, 1308, 1310, - 3, 136, 68, 0, 1309, 1308, 1, 0, 0, 0, 1309, 1310, 1, 0, 0, 0, 1310, 85, - 1, 0, 0, 0, 1311, 1318, 3, 96, 48, 0, 1312, 1313, 3, 100, 50, 0, 1313, - 1314, 3, 96, 48, 0, 1314, 1315, 3, 102, 51, 0, 1315, 1317, 1, 0, 0, 0, - 1316, 1312, 1, 0, 0, 0, 1317, 1320, 1, 0, 0, 0, 1318, 1316, 1, 0, 0, 0, - 1318, 1319, 1, 0, 0, 0, 1319, 87, 1, 0, 0, 0, 1320, 1318, 1, 0, 0, 0, 1321, - 1323, 5, 130, 0, 0, 1322, 1324, 7, 16, 0, 0, 1323, 1322, 1, 0, 0, 0, 1323, - 1324, 1, 0, 0, 0, 1324, 1325, 1, 0, 0, 0, 1325, 1330, 3, 98, 49, 0, 1326, - 1327, 5, 5, 0, 0, 1327, 1329, 3, 98, 49, 0, 1328, 1326, 1, 0, 0, 0, 1329, - 1332, 1, 0, 0, 0, 1330, 1328, 1, 0, 0, 0, 1330, 1331, 1, 0, 0, 0, 1331, - 1345, 1, 0, 0, 0, 1332, 1330, 1, 0, 0, 0, 1333, 1343, 5, 75, 0, 0, 1334, - 1339, 3, 96, 48, 0, 1335, 1336, 5, 5, 0, 0, 1336, 1338, 3, 96, 48, 0, 1337, - 1335, 1, 0, 0, 0, 1338, 1341, 1, 0, 0, 0, 1339, 1337, 1, 0, 0, 0, 1339, - 1340, 1, 0, 0, 0, 1340, 1344, 1, 0, 0, 0, 1341, 1339, 1, 0, 0, 0, 1342, - 1344, 3, 86, 43, 0, 1343, 1334, 1, 0, 0, 0, 1343, 1342, 1, 0, 0, 0, 1344, - 1346, 1, 0, 0, 0, 1345, 1333, 1, 0, 0, 0, 1345, 1346, 1, 0, 0, 0, 1346, - 1349, 1, 0, 0, 0, 1347, 1348, 5, 149, 0, 0, 1348, 1350, 3, 68, 34, 0, 1349, - 1347, 1, 0, 0, 0, 1349, 1350, 1, 0, 0, 0, 1350, 1365, 1, 0, 0, 0, 1351, - 1352, 5, 78, 0, 0, 1352, 1353, 5, 40, 0, 0, 1353, 1358, 3, 68, 34, 0, 1354, - 1355, 5, 5, 0, 0, 1355, 1357, 3, 68, 34, 0, 1356, 1354, 1, 0, 0, 0, 1357, - 1360, 1, 0, 0, 0, 1358, 1356, 1, 0, 0, 0, 1358, 1359, 1, 0, 0, 0, 1359, - 1363, 1, 0, 0, 0, 1360, 1358, 1, 0, 0, 0, 1361, 1362, 5, 79, 0, 0, 1362, - 1364, 3, 68, 34, 0, 1363, 1361, 1, 0, 0, 0, 1363, 1364, 1, 0, 0, 0, 1364, - 1366, 1, 0, 0, 0, 1365, 1351, 1, 0, 0, 0, 1365, 1366, 1, 0, 0, 0, 1366, - 1381, 1, 0, 0, 0, 1367, 1368, 5, 175, 0, 0, 1368, 1369, 3, 214, 107, 0, - 1369, 1370, 5, 33, 0, 0, 1370, 1378, 3, 118, 59, 0, 1371, 1372, 5, 5, 0, - 0, 1372, 1373, 3, 214, 107, 0, 1373, 1374, 5, 33, 0, 0, 1374, 1375, 3, - 118, 59, 0, 1375, 1377, 1, 0, 0, 0, 1376, 1371, 1, 0, 0, 0, 1377, 1380, - 1, 0, 0, 0, 1378, 1376, 1, 0, 0, 0, 1378, 1379, 1, 0, 0, 0, 1379, 1382, - 1, 0, 0, 0, 1380, 1378, 1, 0, 0, 0, 1381, 1367, 1, 0, 0, 0, 1381, 1382, - 1, 0, 0, 0, 1382, 1412, 1, 0, 0, 0, 1383, 1384, 5, 145, 0, 0, 1384, 1385, - 5, 3, 0, 0, 1385, 1390, 3, 68, 34, 0, 1386, 1387, 5, 5, 0, 0, 1387, 1389, - 3, 68, 34, 0, 1388, 1386, 1, 0, 0, 0, 1389, 1392, 1, 0, 0, 0, 1390, 1388, - 1, 0, 0, 0, 1390, 1391, 1, 0, 0, 0, 1391, 1393, 1, 0, 0, 0, 1392, 1390, - 1, 0, 0, 0, 1393, 1408, 5, 4, 0, 0, 1394, 1395, 5, 5, 0, 0, 1395, 1396, - 5, 3, 0, 0, 1396, 1401, 3, 68, 34, 0, 1397, 1398, 5, 5, 0, 0, 1398, 1400, - 3, 68, 34, 0, 1399, 1397, 1, 0, 0, 0, 1400, 1403, 1, 0, 0, 0, 1401, 1399, - 1, 0, 0, 0, 1401, 1402, 1, 0, 0, 0, 1402, 1404, 1, 0, 0, 0, 1403, 1401, - 1, 0, 0, 0, 1404, 1405, 5, 4, 0, 0, 1405, 1407, 1, 0, 0, 0, 1406, 1394, - 1, 0, 0, 0, 1407, 1410, 1, 0, 0, 0, 1408, 1406, 1, 0, 0, 0, 1408, 1409, - 1, 0, 0, 0, 1409, 1412, 1, 0, 0, 0, 1410, 1408, 1, 0, 0, 0, 1411, 1321, - 1, 0, 0, 0, 1411, 1383, 1, 0, 0, 0, 1412, 89, 1, 0, 0, 0, 1413, 1414, 3, - 84, 42, 0, 1414, 91, 1, 0, 0, 0, 1415, 1417, 3, 132, 66, 0, 1416, 1415, - 1, 0, 0, 0, 1416, 1417, 1, 0, 0, 0, 1417, 1418, 1, 0, 0, 0, 1418, 1420, - 3, 88, 44, 0, 1419, 1421, 3, 134, 67, 0, 1420, 1419, 1, 0, 0, 0, 1420, - 1421, 1, 0, 0, 0, 1421, 1423, 1, 0, 0, 0, 1422, 1424, 3, 136, 68, 0, 1423, - 1422, 1, 0, 0, 0, 1423, 1424, 1, 0, 0, 0, 1424, 93, 1, 0, 0, 0, 1425, 1427, - 3, 132, 66, 0, 1426, 1425, 1, 0, 0, 0, 1426, 1427, 1, 0, 0, 0, 1427, 1428, - 1, 0, 0, 0, 1428, 1438, 3, 88, 44, 0, 1429, 1431, 5, 140, 0, 0, 1430, 1432, - 5, 29, 0, 0, 1431, 1430, 1, 0, 0, 0, 1431, 1432, 1, 0, 0, 0, 1432, 1436, - 1, 0, 0, 0, 1433, 1436, 5, 90, 0, 0, 1434, 1436, 5, 68, 0, 0, 1435, 1429, - 1, 0, 0, 0, 1435, 1433, 1, 0, 0, 0, 1435, 1434, 1, 0, 0, 0, 1436, 1437, - 1, 0, 0, 0, 1437, 1439, 3, 88, 44, 0, 1438, 1435, 1, 0, 0, 0, 1439, 1440, - 1, 0, 0, 0, 1440, 1438, 1, 0, 0, 0, 1440, 1441, 1, 0, 0, 0, 1441, 1443, - 1, 0, 0, 0, 1442, 1444, 3, 134, 67, 0, 1443, 1442, 1, 0, 0, 0, 1443, 1444, - 1, 0, 0, 0, 1444, 1446, 1, 0, 0, 0, 1445, 1447, 3, 136, 68, 0, 1446, 1445, - 1, 0, 0, 0, 1446, 1447, 1, 0, 0, 0, 1447, 95, 1, 0, 0, 0, 1448, 1449, 3, - 182, 91, 0, 1449, 1450, 5, 2, 0, 0, 1450, 1452, 1, 0, 0, 0, 1451, 1448, - 1, 0, 0, 0, 1451, 1452, 1, 0, 0, 0, 1452, 1453, 1, 0, 0, 0, 1453, 1458, - 3, 184, 92, 0, 1454, 1456, 5, 33, 0, 0, 1455, 1454, 1, 0, 0, 0, 1455, 1456, - 1, 0, 0, 0, 1456, 1457, 1, 0, 0, 0, 1457, 1459, 3, 208, 104, 0, 1458, 1455, - 1, 0, 0, 0, 1458, 1459, 1, 0, 0, 0, 1459, 1465, 1, 0, 0, 0, 1460, 1461, - 5, 85, 0, 0, 1461, 1462, 5, 40, 0, 0, 1462, 1466, 3, 196, 98, 0, 1463, - 1464, 5, 102, 0, 0, 1464, 1466, 5, 85, 0, 0, 1465, 1460, 1, 0, 0, 0, 1465, - 1463, 1, 0, 0, 0, 1465, 1466, 1, 0, 0, 0, 1466, 1577, 1, 0, 0, 0, 1467, - 1468, 3, 182, 91, 0, 1468, 1469, 5, 2, 0, 0, 1469, 1471, 1, 0, 0, 0, 1470, - 1467, 1, 0, 0, 0, 1470, 1471, 1, 0, 0, 0, 1471, 1472, 1, 0, 0, 0, 1472, - 1473, 3, 226, 113, 0, 1473, 1474, 5, 3, 0, 0, 1474, 1479, 3, 68, 34, 0, - 1475, 1476, 5, 5, 0, 0, 1476, 1478, 3, 68, 34, 0, 1477, 1475, 1, 0, 0, - 0, 1478, 1481, 1, 0, 0, 0, 1479, 1477, 1, 0, 0, 0, 1479, 1480, 1, 0, 0, - 0, 1480, 1482, 1, 0, 0, 0, 1481, 1479, 1, 0, 0, 0, 1482, 1487, 5, 4, 0, - 0, 1483, 1485, 5, 33, 0, 0, 1484, 1483, 1, 0, 0, 0, 1484, 1485, 1, 0, 0, - 0, 1485, 1486, 1, 0, 0, 0, 1486, 1488, 3, 208, 104, 0, 1487, 1484, 1, 0, - 0, 0, 1487, 1488, 1, 0, 0, 0, 1488, 1577, 1, 0, 0, 0, 1489, 1499, 5, 3, - 0, 0, 1490, 1495, 3, 96, 48, 0, 1491, 1492, 5, 5, 0, 0, 1492, 1494, 3, - 96, 48, 0, 1493, 1491, 1, 0, 0, 0, 1494, 1497, 1, 0, 0, 0, 1495, 1493, - 1, 0, 0, 0, 1495, 1496, 1, 0, 0, 0, 1496, 1500, 1, 0, 0, 0, 1497, 1495, - 1, 0, 0, 0, 1498, 1500, 3, 86, 43, 0, 1499, 1490, 1, 0, 0, 0, 1499, 1498, - 1, 0, 0, 0, 1500, 1501, 1, 0, 0, 0, 1501, 1502, 5, 4, 0, 0, 1502, 1577, - 1, 0, 0, 0, 1503, 1504, 5, 3, 0, 0, 1504, 1505, 3, 84, 42, 0, 1505, 1510, - 5, 4, 0, 0, 1506, 1508, 5, 33, 0, 0, 1507, 1506, 1, 0, 0, 0, 1507, 1508, - 1, 0, 0, 0, 1508, 1509, 1, 0, 0, 0, 1509, 1511, 3, 208, 104, 0, 1510, 1507, - 1, 0, 0, 0, 1510, 1511, 1, 0, 0, 0, 1511, 1577, 1, 0, 0, 0, 1512, 1513, - 3, 182, 91, 0, 1513, 1514, 5, 2, 0, 0, 1514, 1516, 1, 0, 0, 0, 1515, 1512, - 1, 0, 0, 0, 1515, 1516, 1, 0, 0, 0, 1516, 1517, 1, 0, 0, 0, 1517, 1522, - 3, 184, 92, 0, 1518, 1520, 5, 33, 0, 0, 1519, 1518, 1, 0, 0, 0, 1519, 1520, - 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1523, 3, 210, 105, 0, 1522, 1519, - 1, 0, 0, 0, 1522, 1523, 1, 0, 0, 0, 1523, 1529, 1, 0, 0, 0, 1524, 1525, - 5, 85, 0, 0, 1525, 1526, 5, 40, 0, 0, 1526, 1530, 3, 196, 98, 0, 1527, - 1528, 5, 102, 0, 0, 1528, 1530, 5, 85, 0, 0, 1529, 1524, 1, 0, 0, 0, 1529, - 1527, 1, 0, 0, 0, 1529, 1530, 1, 0, 0, 0, 1530, 1577, 1, 0, 0, 0, 1531, - 1532, 3, 182, 91, 0, 1532, 1533, 5, 2, 0, 0, 1533, 1535, 1, 0, 0, 0, 1534, - 1531, 1, 0, 0, 0, 1534, 1535, 1, 0, 0, 0, 1535, 1536, 1, 0, 0, 0, 1536, - 1537, 3, 226, 113, 0, 1537, 1538, 5, 3, 0, 0, 1538, 1543, 3, 68, 34, 0, - 1539, 1540, 5, 5, 0, 0, 1540, 1542, 3, 68, 34, 0, 1541, 1539, 1, 0, 0, - 0, 1542, 1545, 1, 0, 0, 0, 1543, 1541, 1, 0, 0, 0, 1543, 1544, 1, 0, 0, - 0, 1544, 1546, 1, 0, 0, 0, 1545, 1543, 1, 0, 0, 0, 1546, 1551, 5, 4, 0, - 0, 1547, 1549, 5, 33, 0, 0, 1548, 1547, 1, 0, 0, 0, 1548, 1549, 1, 0, 0, - 0, 1549, 1550, 1, 0, 0, 0, 1550, 1552, 3, 210, 105, 0, 1551, 1548, 1, 0, - 0, 0, 1551, 1552, 1, 0, 0, 0, 1552, 1577, 1, 0, 0, 0, 1553, 1563, 5, 3, - 0, 0, 1554, 1559, 3, 96, 48, 0, 1555, 1556, 5, 5, 0, 0, 1556, 1558, 3, - 96, 48, 0, 1557, 1555, 1, 0, 0, 0, 1558, 1561, 1, 0, 0, 0, 1559, 1557, - 1, 0, 0, 0, 1559, 1560, 1, 0, 0, 0, 1560, 1564, 1, 0, 0, 0, 1561, 1559, - 1, 0, 0, 0, 1562, 1564, 3, 86, 43, 0, 1563, 1554, 1, 0, 0, 0, 1563, 1562, - 1, 0, 0, 0, 1564, 1565, 1, 0, 0, 0, 1565, 1566, 5, 4, 0, 0, 1566, 1577, - 1, 0, 0, 0, 1567, 1568, 5, 3, 0, 0, 1568, 1569, 3, 84, 42, 0, 1569, 1574, - 5, 4, 0, 0, 1570, 1572, 5, 33, 0, 0, 1571, 1570, 1, 0, 0, 0, 1571, 1572, - 1, 0, 0, 0, 1572, 1573, 1, 0, 0, 0, 1573, 1575, 3, 210, 105, 0, 1574, 1571, - 1, 0, 0, 0, 1574, 1575, 1, 0, 0, 0, 1575, 1577, 1, 0, 0, 0, 1576, 1451, - 1, 0, 0, 0, 1576, 1470, 1, 0, 0, 0, 1576, 1489, 1, 0, 0, 0, 1576, 1503, - 1, 0, 0, 0, 1576, 1515, 1, 0, 0, 0, 1576, 1534, 1, 0, 0, 0, 1576, 1553, - 1, 0, 0, 0, 1576, 1567, 1, 0, 0, 0, 1577, 97, 1, 0, 0, 0, 1578, 1591, 5, - 7, 0, 0, 1579, 1580, 3, 184, 92, 0, 1580, 1581, 5, 2, 0, 0, 1581, 1582, - 5, 7, 0, 0, 1582, 1591, 1, 0, 0, 0, 1583, 1588, 3, 68, 34, 0, 1584, 1586, - 5, 33, 0, 0, 1585, 1584, 1, 0, 0, 0, 1585, 1586, 1, 0, 0, 0, 1586, 1587, - 1, 0, 0, 0, 1587, 1589, 3, 172, 86, 0, 1588, 1585, 1, 0, 0, 0, 1588, 1589, - 1, 0, 0, 0, 1589, 1591, 1, 0, 0, 0, 1590, 1578, 1, 0, 0, 0, 1590, 1579, - 1, 0, 0, 0, 1590, 1583, 1, 0, 0, 0, 1591, 99, 1, 0, 0, 0, 1592, 1607, 5, - 5, 0, 0, 1593, 1595, 5, 100, 0, 0, 1594, 1593, 1, 0, 0, 0, 1594, 1595, - 1, 0, 0, 0, 1595, 1601, 1, 0, 0, 0, 1596, 1598, 7, 17, 0, 0, 1597, 1599, - 5, 110, 0, 0, 1598, 1597, 1, 0, 0, 0, 1598, 1599, 1, 0, 0, 0, 1599, 1602, - 1, 0, 0, 0, 1600, 1602, 5, 87, 0, 0, 1601, 1596, 1, 0, 0, 0, 1601, 1600, - 1, 0, 0, 0, 1601, 1602, 1, 0, 0, 0, 1602, 1603, 1, 0, 0, 0, 1603, 1607, - 5, 94, 0, 0, 1604, 1605, 5, 51, 0, 0, 1605, 1607, 5, 94, 0, 0, 1606, 1592, - 1, 0, 0, 0, 1606, 1594, 1, 0, 0, 0, 1606, 1604, 1, 0, 0, 0, 1607, 101, - 1, 0, 0, 0, 1608, 1609, 5, 107, 0, 0, 1609, 1623, 3, 68, 34, 0, 1610, 1611, - 5, 143, 0, 0, 1611, 1612, 5, 3, 0, 0, 1612, 1617, 3, 190, 95, 0, 1613, - 1614, 5, 5, 0, 0, 1614, 1616, 3, 190, 95, 0, 1615, 1613, 1, 0, 0, 0, 1616, - 1619, 1, 0, 0, 0, 1617, 1615, 1, 0, 0, 0, 1617, 1618, 1, 0, 0, 0, 1618, - 1620, 1, 0, 0, 0, 1619, 1617, 1, 0, 0, 0, 1620, 1621, 5, 4, 0, 0, 1621, - 1623, 1, 0, 0, 0, 1622, 1608, 1, 0, 0, 0, 1622, 1610, 1, 0, 0, 0, 1622, - 1623, 1, 0, 0, 0, 1623, 103, 1, 0, 0, 0, 1624, 1626, 5, 140, 0, 0, 1625, - 1627, 5, 29, 0, 0, 1626, 1625, 1, 0, 0, 0, 1626, 1627, 1, 0, 0, 0, 1627, - 1631, 1, 0, 0, 0, 1628, 1631, 5, 90, 0, 0, 1629, 1631, 5, 68, 0, 0, 1630, - 1624, 1, 0, 0, 0, 1630, 1628, 1, 0, 0, 0, 1630, 1629, 1, 0, 0, 0, 1631, - 105, 1, 0, 0, 0, 1632, 1634, 3, 50, 25, 0, 1633, 1632, 1, 0, 0, 0, 1633, - 1634, 1, 0, 0, 0, 1634, 1635, 1, 0, 0, 0, 1635, 1638, 5, 142, 0, 0, 1636, - 1637, 5, 108, 0, 0, 1637, 1639, 7, 8, 0, 0, 1638, 1636, 1, 0, 0, 0, 1638, - 1639, 1, 0, 0, 0, 1639, 1640, 1, 0, 0, 0, 1640, 1641, 3, 112, 56, 0, 1641, - 1644, 5, 131, 0, 0, 1642, 1645, 3, 190, 95, 0, 1643, 1645, 3, 108, 54, - 0, 1644, 1642, 1, 0, 0, 0, 1644, 1643, 1, 0, 0, 0, 1645, 1646, 1, 0, 0, - 0, 1646, 1647, 5, 6, 0, 0, 1647, 1658, 3, 68, 34, 0, 1648, 1651, 5, 5, - 0, 0, 1649, 1652, 3, 190, 95, 0, 1650, 1652, 3, 108, 54, 0, 1651, 1649, - 1, 0, 0, 0, 1651, 1650, 1, 0, 0, 0, 1652, 1653, 1, 0, 0, 0, 1653, 1654, - 5, 6, 0, 0, 1654, 1655, 3, 68, 34, 0, 1655, 1657, 1, 0, 0, 0, 1656, 1648, - 1, 0, 0, 0, 1657, 1660, 1, 0, 0, 0, 1658, 1656, 1, 0, 0, 0, 1658, 1659, - 1, 0, 0, 0, 1659, 1663, 1, 0, 0, 0, 1660, 1658, 1, 0, 0, 0, 1661, 1662, - 5, 149, 0, 0, 1662, 1664, 3, 68, 34, 0, 1663, 1661, 1, 0, 0, 0, 1663, 1664, - 1, 0, 0, 0, 1664, 1666, 1, 0, 0, 0, 1665, 1667, 3, 58, 29, 0, 1666, 1665, - 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, 107, 1, 0, 0, 0, 1668, 1669, - 5, 3, 0, 0, 1669, 1674, 3, 190, 95, 0, 1670, 1671, 5, 5, 0, 0, 1671, 1673, - 3, 190, 95, 0, 1672, 1670, 1, 0, 0, 0, 1673, 1676, 1, 0, 0, 0, 1674, 1672, - 1, 0, 0, 0, 1674, 1675, 1, 0, 0, 0, 1675, 1677, 1, 0, 0, 0, 1676, 1674, - 1, 0, 0, 0, 1677, 1678, 5, 4, 0, 0, 1678, 109, 1, 0, 0, 0, 1679, 1681, - 3, 50, 25, 0, 1680, 1679, 1, 0, 0, 0, 1680, 1681, 1, 0, 0, 0, 1681, 1682, - 1, 0, 0, 0, 1682, 1685, 5, 142, 0, 0, 1683, 1684, 5, 108, 0, 0, 1684, 1686, - 7, 8, 0, 0, 1685, 1683, 1, 0, 0, 0, 1685, 1686, 1, 0, 0, 0, 1686, 1687, - 1, 0, 0, 0, 1687, 1688, 3, 112, 56, 0, 1688, 1691, 5, 131, 0, 0, 1689, - 1692, 3, 190, 95, 0, 1690, 1692, 3, 108, 54, 0, 1691, 1689, 1, 0, 0, 0, - 1691, 1690, 1, 0, 0, 0, 1692, 1693, 1, 0, 0, 0, 1693, 1694, 5, 6, 0, 0, - 1694, 1705, 3, 68, 34, 0, 1695, 1698, 5, 5, 0, 0, 1696, 1699, 3, 190, 95, - 0, 1697, 1699, 3, 108, 54, 0, 1698, 1696, 1, 0, 0, 0, 1698, 1697, 1, 0, - 0, 0, 1699, 1700, 1, 0, 0, 0, 1700, 1701, 5, 6, 0, 0, 1701, 1702, 3, 68, - 34, 0, 1702, 1704, 1, 0, 0, 0, 1703, 1695, 1, 0, 0, 0, 1704, 1707, 1, 0, - 0, 0, 1705, 1703, 1, 0, 0, 0, 1705, 1706, 1, 0, 0, 0, 1706, 1710, 1, 0, - 0, 0, 1707, 1705, 1, 0, 0, 0, 1708, 1709, 5, 149, 0, 0, 1709, 1711, 3, - 68, 34, 0, 1710, 1708, 1, 0, 0, 0, 1710, 1711, 1, 0, 0, 0, 1711, 1716, - 1, 0, 0, 0, 1712, 1714, 3, 134, 67, 0, 1713, 1712, 1, 0, 0, 0, 1713, 1714, - 1, 0, 0, 0, 1714, 1715, 1, 0, 0, 0, 1715, 1717, 3, 136, 68, 0, 1716, 1713, - 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 111, 1, 0, 0, 0, 1718, 1719, - 3, 182, 91, 0, 1719, 1720, 5, 2, 0, 0, 1720, 1722, 1, 0, 0, 0, 1721, 1718, - 1, 0, 0, 0, 1721, 1722, 1, 0, 0, 0, 1722, 1723, 1, 0, 0, 0, 1723, 1726, - 3, 184, 92, 0, 1724, 1725, 5, 33, 0, 0, 1725, 1727, 3, 216, 108, 0, 1726, - 1724, 1, 0, 0, 0, 1726, 1727, 1, 0, 0, 0, 1727, 1733, 1, 0, 0, 0, 1728, - 1729, 5, 85, 0, 0, 1729, 1730, 5, 40, 0, 0, 1730, 1734, 3, 196, 98, 0, - 1731, 1732, 5, 102, 0, 0, 1732, 1734, 5, 85, 0, 0, 1733, 1728, 1, 0, 0, - 0, 1733, 1731, 1, 0, 0, 0, 1733, 1734, 1, 0, 0, 0, 1734, 113, 1, 0, 0, - 0, 1735, 1737, 5, 144, 0, 0, 1736, 1738, 3, 182, 91, 0, 1737, 1736, 1, - 0, 0, 0, 1737, 1738, 1, 0, 0, 0, 1738, 1741, 1, 0, 0, 0, 1739, 1740, 5, - 91, 0, 0, 1740, 1742, 3, 218, 109, 0, 1741, 1739, 1, 0, 0, 0, 1741, 1742, - 1, 0, 0, 0, 1742, 115, 1, 0, 0, 0, 1743, 1744, 5, 179, 0, 0, 1744, 1745, - 5, 3, 0, 0, 1745, 1746, 5, 149, 0, 0, 1746, 1747, 3, 68, 34, 0, 1747, 1748, - 5, 4, 0, 0, 1748, 117, 1, 0, 0, 0, 1749, 1751, 5, 3, 0, 0, 1750, 1752, - 3, 220, 110, 0, 1751, 1750, 1, 0, 0, 0, 1751, 1752, 1, 0, 0, 0, 1752, 1763, - 1, 0, 0, 0, 1753, 1754, 5, 154, 0, 0, 1754, 1755, 5, 40, 0, 0, 1755, 1760, - 3, 68, 34, 0, 1756, 1757, 5, 5, 0, 0, 1757, 1759, 3, 68, 34, 0, 1758, 1756, - 1, 0, 0, 0, 1759, 1762, 1, 0, 0, 0, 1760, 1758, 1, 0, 0, 0, 1760, 1761, - 1, 0, 0, 0, 1761, 1764, 1, 0, 0, 0, 1762, 1760, 1, 0, 0, 0, 1763, 1753, - 1, 0, 0, 0, 1763, 1764, 1, 0, 0, 0, 1764, 1765, 1, 0, 0, 0, 1765, 1766, - 5, 109, 0, 0, 1766, 1767, 5, 40, 0, 0, 1767, 1772, 3, 138, 69, 0, 1768, - 1769, 5, 5, 0, 0, 1769, 1771, 3, 138, 69, 0, 1770, 1768, 1, 0, 0, 0, 1771, - 1774, 1, 0, 0, 0, 1772, 1770, 1, 0, 0, 0, 1772, 1773, 1, 0, 0, 0, 1773, - 1776, 1, 0, 0, 0, 1774, 1772, 1, 0, 0, 0, 1775, 1777, 3, 122, 61, 0, 1776, - 1775, 1, 0, 0, 0, 1776, 1777, 1, 0, 0, 0, 1777, 1778, 1, 0, 0, 0, 1778, - 1779, 5, 4, 0, 0, 1779, 119, 1, 0, 0, 0, 1780, 1814, 5, 153, 0, 0, 1781, - 1815, 3, 214, 107, 0, 1782, 1784, 5, 3, 0, 0, 1783, 1785, 3, 220, 110, - 0, 1784, 1783, 1, 0, 0, 0, 1784, 1785, 1, 0, 0, 0, 1785, 1796, 1, 0, 0, - 0, 1786, 1787, 5, 154, 0, 0, 1787, 1788, 5, 40, 0, 0, 1788, 1793, 3, 68, - 34, 0, 1789, 1790, 5, 5, 0, 0, 1790, 1792, 3, 68, 34, 0, 1791, 1789, 1, - 0, 0, 0, 1792, 1795, 1, 0, 0, 0, 1793, 1791, 1, 0, 0, 0, 1793, 1794, 1, - 0, 0, 0, 1794, 1797, 1, 0, 0, 0, 1795, 1793, 1, 0, 0, 0, 1796, 1786, 1, - 0, 0, 0, 1796, 1797, 1, 0, 0, 0, 1797, 1808, 1, 0, 0, 0, 1798, 1799, 5, - 109, 0, 0, 1799, 1800, 5, 40, 0, 0, 1800, 1805, 3, 138, 69, 0, 1801, 1802, - 5, 5, 0, 0, 1802, 1804, 3, 138, 69, 0, 1803, 1801, 1, 0, 0, 0, 1804, 1807, - 1, 0, 0, 0, 1805, 1803, 1, 0, 0, 0, 1805, 1806, 1, 0, 0, 0, 1806, 1809, - 1, 0, 0, 0, 1807, 1805, 1, 0, 0, 0, 1808, 1798, 1, 0, 0, 0, 1808, 1809, - 1, 0, 0, 0, 1809, 1811, 1, 0, 0, 0, 1810, 1812, 3, 122, 61, 0, 1811, 1810, - 1, 0, 0, 0, 1811, 1812, 1, 0, 0, 0, 1812, 1813, 1, 0, 0, 0, 1813, 1815, - 5, 4, 0, 0, 1814, 1781, 1, 0, 0, 0, 1814, 1782, 1, 0, 0, 0, 1815, 121, - 1, 0, 0, 0, 1816, 1824, 3, 124, 62, 0, 1817, 1818, 5, 181, 0, 0, 1818, - 1819, 5, 101, 0, 0, 1819, 1825, 5, 183, 0, 0, 1820, 1821, 5, 158, 0, 0, - 1821, 1825, 5, 127, 0, 0, 1822, 1825, 5, 78, 0, 0, 1823, 1825, 5, 182, - 0, 0, 1824, 1817, 1, 0, 0, 0, 1824, 1820, 1, 0, 0, 0, 1824, 1822, 1, 0, - 0, 0, 1824, 1823, 1, 0, 0, 0, 1824, 1825, 1, 0, 0, 0, 1825, 123, 1, 0, - 0, 0, 1826, 1833, 7, 18, 0, 0, 1827, 1834, 3, 146, 73, 0, 1828, 1829, 5, - 39, 0, 0, 1829, 1830, 3, 142, 71, 0, 1830, 1831, 5, 32, 0, 0, 1831, 1832, - 3, 144, 72, 0, 1832, 1834, 1, 0, 0, 0, 1833, 1827, 1, 0, 0, 0, 1833, 1828, - 1, 0, 0, 0, 1834, 125, 1, 0, 0, 0, 1835, 1836, 3, 222, 111, 0, 1836, 1846, - 5, 3, 0, 0, 1837, 1842, 3, 68, 34, 0, 1838, 1839, 5, 5, 0, 0, 1839, 1841, - 3, 68, 34, 0, 1840, 1838, 1, 0, 0, 0, 1841, 1844, 1, 0, 0, 0, 1842, 1840, - 1, 0, 0, 0, 1842, 1843, 1, 0, 0, 0, 1843, 1847, 1, 0, 0, 0, 1844, 1842, - 1, 0, 0, 0, 1845, 1847, 5, 7, 0, 0, 1846, 1837, 1, 0, 0, 0, 1846, 1845, - 1, 0, 0, 0, 1847, 1848, 1, 0, 0, 0, 1848, 1849, 5, 4, 0, 0, 1849, 127, - 1, 0, 0, 0, 1850, 1851, 3, 224, 112, 0, 1851, 1864, 5, 3, 0, 0, 1852, 1854, - 5, 62, 0, 0, 1853, 1852, 1, 0, 0, 0, 1853, 1854, 1, 0, 0, 0, 1854, 1855, - 1, 0, 0, 0, 1855, 1860, 3, 68, 34, 0, 1856, 1857, 5, 5, 0, 0, 1857, 1859, - 3, 68, 34, 0, 1858, 1856, 1, 0, 0, 0, 1859, 1862, 1, 0, 0, 0, 1860, 1858, - 1, 0, 0, 0, 1860, 1861, 1, 0, 0, 0, 1861, 1865, 1, 0, 0, 0, 1862, 1860, - 1, 0, 0, 0, 1863, 1865, 5, 7, 0, 0, 1864, 1853, 1, 0, 0, 0, 1864, 1863, - 1, 0, 0, 0, 1864, 1865, 1, 0, 0, 0, 1865, 1866, 1, 0, 0, 0, 1866, 1868, - 5, 4, 0, 0, 1867, 1869, 3, 116, 58, 0, 1868, 1867, 1, 0, 0, 0, 1868, 1869, - 1, 0, 0, 0, 1869, 129, 1, 0, 0, 0, 1870, 1871, 3, 148, 74, 0, 1871, 1881, - 5, 3, 0, 0, 1872, 1877, 3, 68, 34, 0, 1873, 1874, 5, 5, 0, 0, 1874, 1876, - 3, 68, 34, 0, 1875, 1873, 1, 0, 0, 0, 1876, 1879, 1, 0, 0, 0, 1877, 1875, - 1, 0, 0, 0, 1877, 1878, 1, 0, 0, 0, 1878, 1882, 1, 0, 0, 0, 1879, 1877, - 1, 0, 0, 0, 1880, 1882, 5, 7, 0, 0, 1881, 1872, 1, 0, 0, 0, 1881, 1880, - 1, 0, 0, 0, 1881, 1882, 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1885, - 5, 4, 0, 0, 1884, 1886, 3, 116, 58, 0, 1885, 1884, 1, 0, 0, 0, 1885, 1886, - 1, 0, 0, 0, 1886, 1887, 1, 0, 0, 0, 1887, 1890, 5, 153, 0, 0, 1888, 1891, - 3, 118, 59, 0, 1889, 1891, 3, 214, 107, 0, 1890, 1888, 1, 0, 0, 0, 1890, - 1889, 1, 0, 0, 0, 1891, 131, 1, 0, 0, 0, 1892, 1894, 5, 150, 0, 0, 1893, - 1895, 5, 116, 0, 0, 1894, 1893, 1, 0, 0, 0, 1894, 1895, 1, 0, 0, 0, 1895, - 1896, 1, 0, 0, 0, 1896, 1901, 3, 56, 28, 0, 1897, 1898, 5, 5, 0, 0, 1898, - 1900, 3, 56, 28, 0, 1899, 1897, 1, 0, 0, 0, 1900, 1903, 1, 0, 0, 0, 1901, - 1899, 1, 0, 0, 0, 1901, 1902, 1, 0, 0, 0, 1902, 133, 1, 0, 0, 0, 1903, - 1901, 1, 0, 0, 0, 1904, 1905, 5, 109, 0, 0, 1905, 1906, 5, 40, 0, 0, 1906, - 1911, 3, 138, 69, 0, 1907, 1908, 5, 5, 0, 0, 1908, 1910, 3, 138, 69, 0, - 1909, 1907, 1, 0, 0, 0, 1910, 1913, 1, 0, 0, 0, 1911, 1909, 1, 0, 0, 0, - 1911, 1912, 1, 0, 0, 0, 1912, 135, 1, 0, 0, 0, 1913, 1911, 1, 0, 0, 0, - 1914, 1915, 5, 98, 0, 0, 1915, 1918, 3, 68, 34, 0, 1916, 1917, 7, 19, 0, - 0, 1917, 1919, 3, 68, 34, 0, 1918, 1916, 1, 0, 0, 0, 1918, 1919, 1, 0, - 0, 0, 1919, 137, 1, 0, 0, 0, 1920, 1923, 3, 68, 34, 0, 1921, 1922, 5, 45, - 0, 0, 1922, 1924, 3, 192, 96, 0, 1923, 1921, 1, 0, 0, 0, 1923, 1924, 1, - 0, 0, 0, 1924, 1926, 1, 0, 0, 0, 1925, 1927, 3, 140, 70, 0, 1926, 1925, - 1, 0, 0, 0, 1926, 1927, 1, 0, 0, 0, 1927, 1930, 1, 0, 0, 0, 1928, 1929, - 5, 176, 0, 0, 1929, 1931, 7, 20, 0, 0, 1930, 1928, 1, 0, 0, 0, 1930, 1931, - 1, 0, 0, 0, 1931, 139, 1, 0, 0, 0, 1932, 1933, 7, 21, 0, 0, 1933, 141, - 1, 0, 0, 0, 1934, 1935, 3, 68, 34, 0, 1935, 1936, 5, 156, 0, 0, 1936, 1945, - 1, 0, 0, 0, 1937, 1938, 3, 68, 34, 0, 1938, 1939, 5, 159, 0, 0, 1939, 1945, - 1, 0, 0, 0, 1940, 1941, 5, 158, 0, 0, 1941, 1945, 5, 127, 0, 0, 1942, 1943, - 5, 157, 0, 0, 1943, 1945, 5, 156, 0, 0, 1944, 1934, 1, 0, 0, 0, 1944, 1937, - 1, 0, 0, 0, 1944, 1940, 1, 0, 0, 0, 1944, 1942, 1, 0, 0, 0, 1945, 143, - 1, 0, 0, 0, 1946, 1947, 3, 68, 34, 0, 1947, 1948, 5, 156, 0, 0, 1948, 1957, - 1, 0, 0, 0, 1949, 1950, 3, 68, 34, 0, 1950, 1951, 5, 159, 0, 0, 1951, 1957, - 1, 0, 0, 0, 1952, 1953, 5, 158, 0, 0, 1953, 1957, 5, 127, 0, 0, 1954, 1955, - 5, 157, 0, 0, 1955, 1957, 5, 159, 0, 0, 1956, 1946, 1, 0, 0, 0, 1956, 1949, - 1, 0, 0, 0, 1956, 1952, 1, 0, 0, 0, 1956, 1954, 1, 0, 0, 0, 1957, 145, - 1, 0, 0, 0, 1958, 1959, 3, 68, 34, 0, 1959, 1960, 5, 156, 0, 0, 1960, 1966, - 1, 0, 0, 0, 1961, 1962, 5, 157, 0, 0, 1962, 1966, 5, 156, 0, 0, 1963, 1964, - 5, 158, 0, 0, 1964, 1966, 5, 127, 0, 0, 1965, 1958, 1, 0, 0, 0, 1965, 1961, - 1, 0, 0, 0, 1965, 1963, 1, 0, 0, 0, 1966, 147, 1, 0, 0, 0, 1967, 1968, - 7, 22, 0, 0, 1968, 1969, 5, 3, 0, 0, 1969, 1970, 3, 68, 34, 0, 1970, 1971, - 5, 4, 0, 0, 1971, 1972, 5, 153, 0, 0, 1972, 1974, 5, 3, 0, 0, 1973, 1975, - 3, 154, 77, 0, 1974, 1973, 1, 0, 0, 0, 1974, 1975, 1, 0, 0, 0, 1975, 1976, - 1, 0, 0, 0, 1976, 1978, 3, 158, 79, 0, 1977, 1979, 3, 124, 62, 0, 1978, - 1977, 1, 0, 0, 0, 1978, 1979, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, - 1981, 5, 4, 0, 0, 1981, 2053, 1, 0, 0, 0, 1982, 1983, 7, 23, 0, 0, 1983, - 1984, 5, 3, 0, 0, 1984, 1985, 5, 4, 0, 0, 1985, 1986, 5, 153, 0, 0, 1986, - 1988, 5, 3, 0, 0, 1987, 1989, 3, 154, 77, 0, 1988, 1987, 1, 0, 0, 0, 1988, - 1989, 1, 0, 0, 0, 1989, 1991, 1, 0, 0, 0, 1990, 1992, 3, 156, 78, 0, 1991, - 1990, 1, 0, 0, 0, 1991, 1992, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, - 2053, 5, 4, 0, 0, 1994, 1995, 7, 24, 0, 0, 1995, 1996, 5, 3, 0, 0, 1996, - 1997, 5, 4, 0, 0, 1997, 1998, 5, 153, 0, 0, 1998, 2000, 5, 3, 0, 0, 1999, - 2001, 3, 154, 77, 0, 2000, 1999, 1, 0, 0, 0, 2000, 2001, 1, 0, 0, 0, 2001, - 2002, 1, 0, 0, 0, 2002, 2003, 3, 158, 79, 0, 2003, 2004, 5, 4, 0, 0, 2004, - 2053, 1, 0, 0, 0, 2005, 2006, 7, 25, 0, 0, 2006, 2007, 5, 3, 0, 0, 2007, - 2009, 3, 68, 34, 0, 2008, 2010, 3, 150, 75, 0, 2009, 2008, 1, 0, 0, 0, - 2009, 2010, 1, 0, 0, 0, 2010, 2012, 1, 0, 0, 0, 2011, 2013, 3, 152, 76, - 0, 2012, 2011, 1, 0, 0, 0, 2012, 2013, 1, 0, 0, 0, 2013, 2014, 1, 0, 0, - 0, 2014, 2015, 5, 4, 0, 0, 2015, 2016, 5, 153, 0, 0, 2016, 2018, 5, 3, - 0, 0, 2017, 2019, 3, 154, 77, 0, 2018, 2017, 1, 0, 0, 0, 2018, 2019, 1, - 0, 0, 0, 2019, 2020, 1, 0, 0, 0, 2020, 2021, 3, 158, 79, 0, 2021, 2022, - 5, 4, 0, 0, 2022, 2053, 1, 0, 0, 0, 2023, 2024, 5, 165, 0, 0, 2024, 2025, - 5, 3, 0, 0, 2025, 2026, 3, 68, 34, 0, 2026, 2027, 5, 5, 0, 0, 2027, 2028, - 3, 36, 18, 0, 2028, 2029, 5, 4, 0, 0, 2029, 2030, 5, 153, 0, 0, 2030, 2032, - 5, 3, 0, 0, 2031, 2033, 3, 154, 77, 0, 2032, 2031, 1, 0, 0, 0, 2032, 2033, - 1, 0, 0, 0, 2033, 2034, 1, 0, 0, 0, 2034, 2036, 3, 158, 79, 0, 2035, 2037, - 3, 124, 62, 0, 2036, 2035, 1, 0, 0, 0, 2036, 2037, 1, 0, 0, 0, 2037, 2038, - 1, 0, 0, 0, 2038, 2039, 5, 4, 0, 0, 2039, 2053, 1, 0, 0, 0, 2040, 2041, - 5, 166, 0, 0, 2041, 2042, 5, 3, 0, 0, 2042, 2043, 3, 68, 34, 0, 2043, 2044, - 5, 4, 0, 0, 2044, 2045, 5, 153, 0, 0, 2045, 2047, 5, 3, 0, 0, 2046, 2048, - 3, 154, 77, 0, 2047, 2046, 1, 0, 0, 0, 2047, 2048, 1, 0, 0, 0, 2048, 2049, - 1, 0, 0, 0, 2049, 2050, 3, 158, 79, 0, 2050, 2051, 5, 4, 0, 0, 2051, 2053, - 1, 0, 0, 0, 2052, 1967, 1, 0, 0, 0, 2052, 1982, 1, 0, 0, 0, 2052, 1994, - 1, 0, 0, 0, 2052, 2005, 1, 0, 0, 0, 2052, 2023, 1, 0, 0, 0, 2052, 2040, - 1, 0, 0, 0, 2053, 149, 1, 0, 0, 0, 2054, 2055, 5, 5, 0, 0, 2055, 2056, - 3, 36, 18, 0, 2056, 151, 1, 0, 0, 0, 2057, 2058, 5, 5, 0, 0, 2058, 2059, - 3, 36, 18, 0, 2059, 153, 1, 0, 0, 0, 2060, 2061, 5, 154, 0, 0, 2061, 2063, - 5, 40, 0, 0, 2062, 2064, 3, 68, 34, 0, 2063, 2062, 1, 0, 0, 0, 2064, 2065, - 1, 0, 0, 0, 2065, 2063, 1, 0, 0, 0, 2065, 2066, 1, 0, 0, 0, 2066, 155, - 1, 0, 0, 0, 2067, 2068, 5, 109, 0, 0, 2068, 2070, 5, 40, 0, 0, 2069, 2071, - 3, 68, 34, 0, 2070, 2069, 1, 0, 0, 0, 2071, 2072, 1, 0, 0, 0, 2072, 2070, - 1, 0, 0, 0, 2072, 2073, 1, 0, 0, 0, 2073, 157, 1, 0, 0, 0, 2074, 2075, - 5, 109, 0, 0, 2075, 2076, 5, 40, 0, 0, 2076, 2077, 3, 158, 79, 0, 2077, - 159, 1, 0, 0, 0, 2078, 2080, 3, 68, 34, 0, 2079, 2081, 3, 140, 70, 0, 2080, - 2079, 1, 0, 0, 0, 2080, 2081, 1, 0, 0, 0, 2081, 2089, 1, 0, 0, 0, 2082, - 2083, 5, 5, 0, 0, 2083, 2085, 3, 68, 34, 0, 2084, 2086, 3, 140, 70, 0, - 2085, 2084, 1, 0, 0, 0, 2085, 2086, 1, 0, 0, 0, 2086, 2088, 1, 0, 0, 0, - 2087, 2082, 1, 0, 0, 0, 2088, 2091, 1, 0, 0, 0, 2089, 2087, 1, 0, 0, 0, - 2089, 2090, 1, 0, 0, 0, 2090, 161, 1, 0, 0, 0, 2091, 2089, 1, 0, 0, 0, - 2092, 2093, 3, 84, 42, 0, 2093, 163, 1, 0, 0, 0, 2094, 2095, 3, 84, 42, - 0, 2095, 165, 1, 0, 0, 0, 2096, 2097, 7, 26, 0, 0, 2097, 167, 1, 0, 0, - 0, 2098, 2099, 5, 190, 0, 0, 2099, 169, 1, 0, 0, 0, 2100, 2103, 3, 68, - 34, 0, 2101, 2103, 3, 30, 15, 0, 2102, 2100, 1, 0, 0, 0, 2102, 2101, 1, - 0, 0, 0, 2103, 171, 1, 0, 0, 0, 2104, 2105, 7, 27, 0, 0, 2105, 173, 1, - 0, 0, 0, 2106, 2107, 7, 28, 0, 0, 2107, 175, 1, 0, 0, 0, 2108, 2109, 3, - 228, 114, 0, 2109, 177, 1, 0, 0, 0, 2110, 2111, 3, 228, 114, 0, 2111, 179, - 1, 0, 0, 0, 2112, 2113, 3, 182, 91, 0, 2113, 2114, 5, 2, 0, 0, 2114, 2116, - 1, 0, 0, 0, 2115, 2112, 1, 0, 0, 0, 2115, 2116, 1, 0, 0, 0, 2116, 2117, - 1, 0, 0, 0, 2117, 2118, 3, 178, 89, 0, 2118, 181, 1, 0, 0, 0, 2119, 2120, - 3, 228, 114, 0, 2120, 183, 1, 0, 0, 0, 2121, 2122, 3, 228, 114, 0, 2122, - 185, 1, 0, 0, 0, 2123, 2124, 3, 228, 114, 0, 2124, 187, 1, 0, 0, 0, 2125, - 2126, 3, 228, 114, 0, 2126, 189, 1, 0, 0, 0, 2127, 2128, 3, 228, 114, 0, - 2128, 191, 1, 0, 0, 0, 2129, 2130, 3, 228, 114, 0, 2130, 193, 1, 0, 0, - 0, 2131, 2132, 3, 228, 114, 0, 2132, 195, 1, 0, 0, 0, 2133, 2134, 3, 228, - 114, 0, 2134, 197, 1, 0, 0, 0, 2135, 2136, 3, 228, 114, 0, 2136, 199, 1, - 0, 0, 0, 2137, 2138, 3, 228, 114, 0, 2138, 201, 1, 0, 0, 0, 2139, 2140, - 3, 228, 114, 0, 2140, 203, 1, 0, 0, 0, 2141, 2142, 3, 228, 114, 0, 2142, - 205, 1, 0, 0, 0, 2143, 2144, 3, 228, 114, 0, 2144, 207, 1, 0, 0, 0, 2145, - 2146, 7, 27, 0, 0, 2146, 209, 1, 0, 0, 0, 2147, 2148, 3, 228, 114, 0, 2148, - 211, 1, 0, 0, 0, 2149, 2150, 3, 228, 114, 0, 2150, 213, 1, 0, 0, 0, 2151, - 2152, 3, 228, 114, 0, 2152, 215, 1, 0, 0, 0, 2153, 2154, 3, 228, 114, 0, - 2154, 217, 1, 0, 0, 0, 2155, 2156, 3, 228, 114, 0, 2156, 219, 1, 0, 0, - 0, 2157, 2158, 3, 228, 114, 0, 2158, 221, 1, 0, 0, 0, 2159, 2160, 3, 228, - 114, 0, 2160, 223, 1, 0, 0, 0, 2161, 2162, 3, 228, 114, 0, 2162, 225, 1, - 0, 0, 0, 2163, 2164, 3, 228, 114, 0, 2164, 227, 1, 0, 0, 0, 2165, 2173, - 5, 186, 0, 0, 2166, 2173, 3, 174, 87, 0, 2167, 2173, 5, 190, 0, 0, 2168, - 2169, 5, 3, 0, 0, 2169, 2170, 3, 228, 114, 0, 2170, 2171, 5, 4, 0, 0, 2171, - 2173, 1, 0, 0, 0, 2172, 2165, 1, 0, 0, 0, 2172, 2166, 1, 0, 0, 0, 2172, - 2167, 1, 0, 0, 0, 2172, 2168, 1, 0, 0, 0, 2173, 229, 1, 0, 0, 0, 314, 233, - 241, 248, 253, 259, 265, 267, 293, 300, 307, 313, 317, 322, 325, 332, 335, - 339, 347, 351, 353, 357, 361, 365, 368, 375, 381, 387, 392, 403, 409, 413, - 417, 420, 425, 429, 435, 440, 449, 456, 465, 468, 472, 476, 481, 487, 499, - 503, 508, 511, 514, 519, 522, 536, 543, 550, 552, 555, 561, 566, 574, 579, - 594, 600, 610, 615, 625, 629, 631, 635, 640, 642, 650, 656, 661, 668, 679, - 682, 684, 691, 695, 702, 708, 714, 720, 725, 734, 739, 750, 755, 766, 771, - 775, 791, 801, 806, 814, 826, 831, 842, 845, 847, 853, 856, 858, 862, 866, - 873, 876, 879, 886, 889, 892, 895, 899, 907, 912, 923, 928, 937, 944, 948, - 952, 955, 963, 976, 979, 987, 996, 1000, 1005, 1031, 1038, 1049, 1058, - 1068, 1071, 1077, 1083, 1092, 1095, 1099, 1106, 1112, 1119, 1121, 1123, - 1132, 1139, 1146, 1152, 1157, 1165, 1170, 1179, 1190, 1197, 1201, 1204, - 1207, 1211, 1221, 1227, 1229, 1237, 1244, 1251, 1256, 1258, 1264, 1273, - 1278, 1285, 1289, 1291, 1294, 1302, 1306, 1309, 1318, 1323, 1330, 1339, - 1343, 1345, 1349, 1358, 1363, 1365, 1378, 1381, 1390, 1401, 1408, 1411, - 1416, 1420, 1423, 1426, 1431, 1435, 1440, 1443, 1446, 1451, 1455, 1458, - 1465, 1470, 1479, 1484, 1487, 1495, 1499, 1507, 1510, 1515, 1519, 1522, - 1529, 1534, 1543, 1548, 1551, 1559, 1563, 1571, 1574, 1576, 1585, 1588, - 1590, 1594, 1598, 1601, 1606, 1617, 1622, 1626, 1630, 1633, 1638, 1644, - 1651, 1658, 1663, 1666, 1674, 1680, 1685, 1691, 1698, 1705, 1710, 1713, - 1716, 1721, 1726, 1733, 1737, 1741, 1751, 1760, 1763, 1772, 1776, 1784, - 1793, 1796, 1805, 1808, 1811, 1814, 1824, 1833, 1842, 1846, 1853, 1860, - 1864, 1868, 1877, 1881, 1885, 1890, 1894, 1901, 1911, 1918, 1923, 1926, - 1930, 1944, 1956, 1965, 1974, 1978, 1988, 1991, 2000, 2009, 2012, 2018, - 2032, 2036, 2047, 2052, 2065, 2072, 2080, 2085, 2089, 2102, 2115, 2172, - } - deserializer := antlr.NewATNDeserializer(nil) - staticData.atn = deserializer.Deserialize(staticData.serializedATN) - atn := staticData.atn - staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) - decisionToDFA := staticData.decisionToDFA - for index, state := range atn.DecisionToState { - decisionToDFA[index] = antlr.NewDFA(state, index) - } -} - -// SQLiteParserInit initializes any static state used to implement SQLiteParser. By default the -// static state used to implement the parser is lazily initialized during the first call to -// NewSQLiteParser(). You can call this function if you wish to initialize the static state ahead -// of time. -func SQLiteParserInit() { - staticData := &sqliteparserParserStaticData - staticData.once.Do(sqliteparserParserInit) -} - -// NewSQLiteParser produces a new parser instance for the optional input antlr.TokenStream. -func NewSQLiteParser(input antlr.TokenStream) *SQLiteParser { - SQLiteParserInit() - this := new(SQLiteParser) - this.BaseParser = antlr.NewBaseParser(input) - staticData := &sqliteparserParserStaticData - this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache) - this.RuleNames = staticData.ruleNames - this.LiteralNames = staticData.literalNames - this.SymbolicNames = staticData.symbolicNames - this.GrammarFileName = "SQLiteParser.g4" - - return this -} - -// SQLiteParser tokens. -const ( - SQLiteParserEOF = antlr.TokenEOF - SQLiteParserSCOL = 1 - SQLiteParserDOT = 2 - SQLiteParserOPEN_PAR = 3 - SQLiteParserCLOSE_PAR = 4 - SQLiteParserCOMMA = 5 - SQLiteParserASSIGN = 6 - SQLiteParserSTAR = 7 - SQLiteParserPLUS = 8 - SQLiteParserMINUS = 9 - SQLiteParserTILDE = 10 - SQLiteParserPIPE2 = 11 - SQLiteParserDIV = 12 - SQLiteParserMOD = 13 - SQLiteParserLT2 = 14 - SQLiteParserGT2 = 15 - SQLiteParserAMP = 16 - SQLiteParserPIPE = 17 - SQLiteParserLT = 18 - SQLiteParserLT_EQ = 19 - SQLiteParserGT = 20 - SQLiteParserGT_EQ = 21 - SQLiteParserEQ = 22 - SQLiteParserNOT_EQ1 = 23 - SQLiteParserNOT_EQ2 = 24 - SQLiteParserABORT_ = 25 - SQLiteParserACTION_ = 26 - SQLiteParserADD_ = 27 - SQLiteParserAFTER_ = 28 - SQLiteParserALL_ = 29 - SQLiteParserALTER_ = 30 - SQLiteParserANALYZE_ = 31 - SQLiteParserAND_ = 32 - SQLiteParserAS_ = 33 - SQLiteParserASC_ = 34 - SQLiteParserATTACH_ = 35 - SQLiteParserAUTOINCREMENT_ = 36 - SQLiteParserBEFORE_ = 37 - SQLiteParserBEGIN_ = 38 - SQLiteParserBETWEEN_ = 39 - SQLiteParserBY_ = 40 - SQLiteParserCASCADE_ = 41 - SQLiteParserCASE_ = 42 - SQLiteParserCAST_ = 43 - SQLiteParserCHECK_ = 44 - SQLiteParserCOLLATE_ = 45 - SQLiteParserCOLUMN_ = 46 - SQLiteParserCOMMIT_ = 47 - SQLiteParserCONFLICT_ = 48 - SQLiteParserCONSTRAINT_ = 49 - SQLiteParserCREATE_ = 50 - SQLiteParserCROSS_ = 51 - SQLiteParserCURRENT_DATE_ = 52 - SQLiteParserCURRENT_TIME_ = 53 - SQLiteParserCURRENT_TIMESTAMP_ = 54 - SQLiteParserDATABASE_ = 55 - SQLiteParserDEFAULT_ = 56 - SQLiteParserDEFERRABLE_ = 57 - SQLiteParserDEFERRED_ = 58 - SQLiteParserDELETE_ = 59 - SQLiteParserDESC_ = 60 - SQLiteParserDETACH_ = 61 - SQLiteParserDISTINCT_ = 62 - SQLiteParserDROP_ = 63 - SQLiteParserEACH_ = 64 - SQLiteParserELSE_ = 65 - SQLiteParserEND_ = 66 - SQLiteParserESCAPE_ = 67 - SQLiteParserEXCEPT_ = 68 - SQLiteParserEXCLUSIVE_ = 69 - SQLiteParserEXISTS_ = 70 - SQLiteParserEXPLAIN_ = 71 - SQLiteParserFAIL_ = 72 - SQLiteParserFOR_ = 73 - SQLiteParserFOREIGN_ = 74 - SQLiteParserFROM_ = 75 - SQLiteParserFULL_ = 76 - SQLiteParserGLOB_ = 77 - SQLiteParserGROUP_ = 78 - SQLiteParserHAVING_ = 79 - SQLiteParserIF_ = 80 - SQLiteParserIGNORE_ = 81 - SQLiteParserIMMEDIATE_ = 82 - SQLiteParserIN_ = 83 - SQLiteParserINDEX_ = 84 - SQLiteParserINDEXED_ = 85 - SQLiteParserINITIALLY_ = 86 - SQLiteParserINNER_ = 87 - SQLiteParserINSERT_ = 88 - SQLiteParserINSTEAD_ = 89 - SQLiteParserINTERSECT_ = 90 - SQLiteParserINTO_ = 91 - SQLiteParserIS_ = 92 - SQLiteParserISNULL_ = 93 - SQLiteParserJOIN_ = 94 - SQLiteParserKEY_ = 95 - SQLiteParserLEFT_ = 96 - SQLiteParserLIKE_ = 97 - SQLiteParserLIMIT_ = 98 - SQLiteParserMATCH_ = 99 - SQLiteParserNATURAL_ = 100 - SQLiteParserNO_ = 101 - SQLiteParserNOT_ = 102 - SQLiteParserNOTNULL_ = 103 - SQLiteParserNULL_ = 104 - SQLiteParserOF_ = 105 - SQLiteParserOFFSET_ = 106 - SQLiteParserON_ = 107 - SQLiteParserOR_ = 108 - SQLiteParserORDER_ = 109 - SQLiteParserOUTER_ = 110 - SQLiteParserPLAN_ = 111 - SQLiteParserPRAGMA_ = 112 - SQLiteParserPRIMARY_ = 113 - SQLiteParserQUERY_ = 114 - SQLiteParserRAISE_ = 115 - SQLiteParserRECURSIVE_ = 116 - SQLiteParserREFERENCES_ = 117 - SQLiteParserREGEXP_ = 118 - SQLiteParserREINDEX_ = 119 - SQLiteParserRELEASE_ = 120 - SQLiteParserRENAME_ = 121 - SQLiteParserREPLACE_ = 122 - SQLiteParserRESTRICT_ = 123 - SQLiteParserRETURNING_ = 124 - SQLiteParserRIGHT_ = 125 - SQLiteParserROLLBACK_ = 126 - SQLiteParserROW_ = 127 - SQLiteParserROWS_ = 128 - SQLiteParserSAVEPOINT_ = 129 - SQLiteParserSELECT_ = 130 - SQLiteParserSET_ = 131 - SQLiteParserSTRICT_ = 132 - SQLiteParserTABLE_ = 133 - SQLiteParserTEMP_ = 134 - SQLiteParserTEMPORARY_ = 135 - SQLiteParserTHEN_ = 136 - SQLiteParserTO_ = 137 - SQLiteParserTRANSACTION_ = 138 - SQLiteParserTRIGGER_ = 139 - SQLiteParserUNION_ = 140 - SQLiteParserUNIQUE_ = 141 - SQLiteParserUPDATE_ = 142 - SQLiteParserUSING_ = 143 - SQLiteParserVACUUM_ = 144 - SQLiteParserVALUES_ = 145 - SQLiteParserVIEW_ = 146 - SQLiteParserVIRTUAL_ = 147 - SQLiteParserWHEN_ = 148 - SQLiteParserWHERE_ = 149 - SQLiteParserWITH_ = 150 - SQLiteParserWITHOUT_ = 151 - SQLiteParserFIRST_VALUE_ = 152 - SQLiteParserOVER_ = 153 - SQLiteParserPARTITION_ = 154 - SQLiteParserRANGE_ = 155 - SQLiteParserPRECEDING_ = 156 - SQLiteParserUNBOUNDED_ = 157 - SQLiteParserCURRENT_ = 158 - SQLiteParserFOLLOWING_ = 159 - SQLiteParserCUME_DIST_ = 160 - SQLiteParserDENSE_RANK_ = 161 - SQLiteParserLAG_ = 162 - SQLiteParserLAST_VALUE_ = 163 - SQLiteParserLEAD_ = 164 - SQLiteParserNTH_VALUE_ = 165 - SQLiteParserNTILE_ = 166 - SQLiteParserPERCENT_RANK_ = 167 - SQLiteParserRANK_ = 168 - SQLiteParserROW_NUMBER_ = 169 - SQLiteParserGENERATED_ = 170 - SQLiteParserALWAYS_ = 171 - SQLiteParserSTORED_ = 172 - SQLiteParserTRUE_ = 173 - SQLiteParserFALSE_ = 174 - SQLiteParserWINDOW_ = 175 - SQLiteParserNULLS_ = 176 - SQLiteParserFIRST_ = 177 - SQLiteParserLAST_ = 178 - SQLiteParserFILTER_ = 179 - SQLiteParserGROUPS_ = 180 - SQLiteParserEXCLUDE_ = 181 - SQLiteParserTIES_ = 182 - SQLiteParserOTHERS_ = 183 - SQLiteParserDO_ = 184 - SQLiteParserNOTHING_ = 185 - SQLiteParserIDENTIFIER = 186 - SQLiteParserNUMERIC_LITERAL = 187 - SQLiteParserNUMBERED_BIND_PARAMETER = 188 - SQLiteParserNAMED_BIND_PARAMETER = 189 - SQLiteParserSTRING_LITERAL = 190 - SQLiteParserBLOB_LITERAL = 191 - SQLiteParserSINGLE_LINE_COMMENT = 192 - SQLiteParserMULTILINE_COMMENT = 193 - SQLiteParserSPACES = 194 - SQLiteParserUNEXPECTED_CHAR = 195 -) - -// SQLiteParser rules. -const ( - SQLiteParserRULE_parse = 0 - SQLiteParserRULE_sql_stmt_list = 1 - SQLiteParserRULE_sql_stmt = 2 - SQLiteParserRULE_alter_table_stmt = 3 - SQLiteParserRULE_analyze_stmt = 4 - SQLiteParserRULE_attach_stmt = 5 - SQLiteParserRULE_begin_stmt = 6 - SQLiteParserRULE_commit_stmt = 7 - SQLiteParserRULE_rollback_stmt = 8 - SQLiteParserRULE_savepoint_stmt = 9 - SQLiteParserRULE_release_stmt = 10 - SQLiteParserRULE_create_index_stmt = 11 - SQLiteParserRULE_indexed_column = 12 - SQLiteParserRULE_table_option = 13 - SQLiteParserRULE_create_table_stmt = 14 - SQLiteParserRULE_column_def = 15 - SQLiteParserRULE_type_name = 16 - SQLiteParserRULE_column_constraint = 17 - SQLiteParserRULE_signed_number = 18 - SQLiteParserRULE_table_constraint = 19 - SQLiteParserRULE_foreign_key_clause = 20 - SQLiteParserRULE_conflict_clause = 21 - SQLiteParserRULE_create_trigger_stmt = 22 - SQLiteParserRULE_create_view_stmt = 23 - SQLiteParserRULE_create_virtual_table_stmt = 24 - SQLiteParserRULE_with_clause = 25 - SQLiteParserRULE_cte_table_name = 26 - SQLiteParserRULE_recursive_cte = 27 - SQLiteParserRULE_common_table_expression = 28 - SQLiteParserRULE_returning_clause = 29 - SQLiteParserRULE_delete_stmt = 30 - SQLiteParserRULE_delete_stmt_limited = 31 - SQLiteParserRULE_detach_stmt = 32 - SQLiteParserRULE_drop_stmt = 33 - SQLiteParserRULE_expr = 34 - SQLiteParserRULE_raise_function = 35 - SQLiteParserRULE_literal_value = 36 - SQLiteParserRULE_insert_stmt = 37 - SQLiteParserRULE_upsert_clause = 38 - SQLiteParserRULE_pragma_stmt = 39 - SQLiteParserRULE_pragma_value = 40 - SQLiteParserRULE_reindex_stmt = 41 - SQLiteParserRULE_select_stmt = 42 - SQLiteParserRULE_join_clause = 43 - SQLiteParserRULE_select_core = 44 - SQLiteParserRULE_factored_select_stmt = 45 - SQLiteParserRULE_simple_select_stmt = 46 - SQLiteParserRULE_compound_select_stmt = 47 - SQLiteParserRULE_table_or_subquery = 48 - SQLiteParserRULE_result_column = 49 - SQLiteParserRULE_join_operator = 50 - SQLiteParserRULE_join_constraint = 51 - SQLiteParserRULE_compound_operator = 52 - SQLiteParserRULE_update_stmt = 53 - SQLiteParserRULE_column_name_list = 54 - SQLiteParserRULE_update_stmt_limited = 55 - SQLiteParserRULE_qualified_table_name = 56 - SQLiteParserRULE_vacuum_stmt = 57 - SQLiteParserRULE_filter_clause = 58 - SQLiteParserRULE_window_defn = 59 - SQLiteParserRULE_over_clause = 60 - SQLiteParserRULE_frame_spec = 61 - SQLiteParserRULE_frame_clause = 62 - SQLiteParserRULE_simple_function_invocation = 63 - SQLiteParserRULE_aggregate_function_invocation = 64 - SQLiteParserRULE_window_function_invocation = 65 - SQLiteParserRULE_common_table_stmt = 66 - SQLiteParserRULE_order_by_stmt = 67 - SQLiteParserRULE_limit_stmt = 68 - SQLiteParserRULE_ordering_term = 69 - SQLiteParserRULE_asc_desc = 70 - SQLiteParserRULE_frame_left = 71 - SQLiteParserRULE_frame_right = 72 - SQLiteParserRULE_frame_single = 73 - SQLiteParserRULE_window_function = 74 - SQLiteParserRULE_of_OF_fset = 75 - SQLiteParserRULE_default_DEFAULT__value = 76 - SQLiteParserRULE_partition_by = 77 - SQLiteParserRULE_order_by_expr = 78 - SQLiteParserRULE_order_by_expr_asc_desc = 79 - SQLiteParserRULE_expr_asc_desc = 80 - SQLiteParserRULE_initial_select = 81 - SQLiteParserRULE_recursive__select = 82 - SQLiteParserRULE_unary_operator = 83 - SQLiteParserRULE_error_message = 84 - SQLiteParserRULE_module_argument = 85 - SQLiteParserRULE_column_alias = 86 - SQLiteParserRULE_keyword = 87 - SQLiteParserRULE_name = 88 - SQLiteParserRULE_function_name = 89 - SQLiteParserRULE_qualified_function_name = 90 - SQLiteParserRULE_schema_name = 91 - SQLiteParserRULE_table_name = 92 - SQLiteParserRULE_table_or_index_name = 93 - SQLiteParserRULE_new_table_name = 94 - SQLiteParserRULE_column_name = 95 - SQLiteParserRULE_collation_name = 96 - SQLiteParserRULE_foreign_table = 97 - SQLiteParserRULE_index_name = 98 - SQLiteParserRULE_trigger_name = 99 - SQLiteParserRULE_view_name = 100 - SQLiteParserRULE_module_name = 101 - SQLiteParserRULE_pragma_name = 102 - SQLiteParserRULE_savepoint_name = 103 - SQLiteParserRULE_table_alias = 104 - SQLiteParserRULE_table_alias_fallback = 105 - SQLiteParserRULE_transaction_name = 106 - SQLiteParserRULE_window_name = 107 - SQLiteParserRULE_alias = 108 - SQLiteParserRULE_filename = 109 - SQLiteParserRULE_base_window_name = 110 - SQLiteParserRULE_simple_func = 111 - SQLiteParserRULE_aggregate_func = 112 - SQLiteParserRULE_table_function_name = 113 - SQLiteParserRULE_any_name = 114 -) - -// IParseContext is an interface to support dynamic dispatch. -type IParseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - EOF() antlr.TerminalNode - AllSql_stmt_list() []ISql_stmt_listContext - Sql_stmt_list(i int) ISql_stmt_listContext - - // IsParseContext differentiates from other interfaces. - IsParseContext() -} - -type ParseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyParseContext() *ParseContext { - var p = new(ParseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_parse - return p -} - -func (*ParseContext) IsParseContext() {} - -func NewParseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ParseContext { - var p = new(ParseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_parse - - return p -} - -func (s *ParseContext) GetParser() antlr.Parser { return s.parser } - -func (s *ParseContext) EOF() antlr.TerminalNode { - return s.GetToken(SQLiteParserEOF, 0) -} - -func (s *ParseContext) AllSql_stmt_list() []ISql_stmt_listContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ISql_stmt_listContext); ok { - len++ - } - } - - tst := make([]ISql_stmt_listContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ISql_stmt_listContext); ok { - tst[i] = t.(ISql_stmt_listContext) - i++ - } - } - - return tst -} - -func (s *ParseContext) Sql_stmt_list(i int) ISql_stmt_listContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISql_stmt_listContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ISql_stmt_listContext) -} - -func (s *ParseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *ParseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *ParseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterParse(s) - } -} - -func (s *ParseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitParse(s) - } -} - -func (p *SQLiteParser) Parse() (localctx IParseContext) { - this := p - _ = this - - localctx = NewParseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 0, SQLiteParserRULE_parse) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(233) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-6267743731445661694) != 0) || ((int64((_la-66)) & ^0x3f) == 0 && ((int64(1)<<(_la-66))&-7971300971697405919) != 0) || ((int64((_la-130)) & ^0x3f) == 0 && ((int64(1)<<(_la-130))&1101825) != 0) { - { - p.SetState(230) - p.Sql_stmt_list() - } - - p.SetState(235) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(236) - p.Match(SQLiteParserEOF) - } - - return localctx -} - -// ISql_stmt_listContext is an interface to support dynamic dispatch. -type ISql_stmt_listContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - AllSql_stmt() []ISql_stmtContext - Sql_stmt(i int) ISql_stmtContext - AllSCOL() []antlr.TerminalNode - SCOL(i int) antlr.TerminalNode - - // IsSql_stmt_listContext differentiates from other interfaces. - IsSql_stmt_listContext() -} - -type Sql_stmt_listContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySql_stmt_listContext() *Sql_stmt_listContext { - var p = new(Sql_stmt_listContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_sql_stmt_list - return p -} - -func (*Sql_stmt_listContext) IsSql_stmt_listContext() {} - -func NewSql_stmt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Sql_stmt_listContext { - var p = new(Sql_stmt_listContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_sql_stmt_list - - return p -} - -func (s *Sql_stmt_listContext) GetParser() antlr.Parser { return s.parser } - -func (s *Sql_stmt_listContext) AllSql_stmt() []ISql_stmtContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ISql_stmtContext); ok { - len++ - } - } - - tst := make([]ISql_stmtContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ISql_stmtContext); ok { - tst[i] = t.(ISql_stmtContext) - i++ - } - } - - return tst -} - -func (s *Sql_stmt_listContext) Sql_stmt(i int) ISql_stmtContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISql_stmtContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ISql_stmtContext) -} - -func (s *Sql_stmt_listContext) AllSCOL() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserSCOL) -} - -func (s *Sql_stmt_listContext) SCOL(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserSCOL, i) -} - -func (s *Sql_stmt_listContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Sql_stmt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Sql_stmt_listContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSql_stmt_list(s) - } -} - -func (s *Sql_stmt_listContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSql_stmt_list(s) - } -} - -func (p *SQLiteParser) Sql_stmt_list() (localctx ISql_stmt_listContext) { - this := p - _ = this - - localctx = NewSql_stmt_listContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 2, SQLiteParserRULE_sql_stmt_list) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - p.SetState(241) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserSCOL { - { - p.SetState(238) - p.Match(SQLiteParserSCOL) - } - - p.SetState(243) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(244) - p.Sql_stmt() - } - p.SetState(253) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - p.SetState(246) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for ok := true; ok; ok = _la == SQLiteParserSCOL { - { - p.SetState(245) - p.Match(SQLiteParserSCOL) - } - - p.SetState(248) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(250) - p.Sql_stmt() - } - - } - p.SetState(255) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) - } - p.SetState(259) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - { - p.SetState(256) - p.Match(SQLiteParserSCOL) - } - - } - p.SetState(261) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext()) - } - - return localctx -} - -// ISql_stmtContext is an interface to support dynamic dispatch. -type ISql_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Alter_table_stmt() IAlter_table_stmtContext - Analyze_stmt() IAnalyze_stmtContext - Attach_stmt() IAttach_stmtContext - Begin_stmt() IBegin_stmtContext - Commit_stmt() ICommit_stmtContext - Create_index_stmt() ICreate_index_stmtContext - Create_table_stmt() ICreate_table_stmtContext - Create_trigger_stmt() ICreate_trigger_stmtContext - Create_view_stmt() ICreate_view_stmtContext - Create_virtual_table_stmt() ICreate_virtual_table_stmtContext - Delete_stmt() IDelete_stmtContext - Delete_stmt_limited() IDelete_stmt_limitedContext - Detach_stmt() IDetach_stmtContext - Drop_stmt() IDrop_stmtContext - Insert_stmt() IInsert_stmtContext - Pragma_stmt() IPragma_stmtContext - Reindex_stmt() IReindex_stmtContext - Release_stmt() IRelease_stmtContext - Rollback_stmt() IRollback_stmtContext - Savepoint_stmt() ISavepoint_stmtContext - Select_stmt() ISelect_stmtContext - Update_stmt() IUpdate_stmtContext - Update_stmt_limited() IUpdate_stmt_limitedContext - Vacuum_stmt() IVacuum_stmtContext - EXPLAIN_() antlr.TerminalNode - QUERY_() antlr.TerminalNode - PLAN_() antlr.TerminalNode - - // IsSql_stmtContext differentiates from other interfaces. - IsSql_stmtContext() -} - -type Sql_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySql_stmtContext() *Sql_stmtContext { - var p = new(Sql_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_sql_stmt - return p -} - -func (*Sql_stmtContext) IsSql_stmtContext() {} - -func NewSql_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Sql_stmtContext { - var p = new(Sql_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_sql_stmt - - return p -} - -func (s *Sql_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Sql_stmtContext) Alter_table_stmt() IAlter_table_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAlter_table_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAlter_table_stmtContext) -} - -func (s *Sql_stmtContext) Analyze_stmt() IAnalyze_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAnalyze_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAnalyze_stmtContext) -} - -func (s *Sql_stmtContext) Attach_stmt() IAttach_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAttach_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAttach_stmtContext) -} - -func (s *Sql_stmtContext) Begin_stmt() IBegin_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IBegin_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IBegin_stmtContext) -} - -func (s *Sql_stmtContext) Commit_stmt() ICommit_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICommit_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICommit_stmtContext) -} - -func (s *Sql_stmtContext) Create_index_stmt() ICreate_index_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICreate_index_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICreate_index_stmtContext) -} - -func (s *Sql_stmtContext) Create_table_stmt() ICreate_table_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICreate_table_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICreate_table_stmtContext) -} - -func (s *Sql_stmtContext) Create_trigger_stmt() ICreate_trigger_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICreate_trigger_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICreate_trigger_stmtContext) -} - -func (s *Sql_stmtContext) Create_view_stmt() ICreate_view_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICreate_view_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICreate_view_stmtContext) -} - -func (s *Sql_stmtContext) Create_virtual_table_stmt() ICreate_virtual_table_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICreate_virtual_table_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICreate_virtual_table_stmtContext) -} - -func (s *Sql_stmtContext) Delete_stmt() IDelete_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IDelete_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IDelete_stmtContext) -} - -func (s *Sql_stmtContext) Delete_stmt_limited() IDelete_stmt_limitedContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IDelete_stmt_limitedContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IDelete_stmt_limitedContext) -} - -func (s *Sql_stmtContext) Detach_stmt() IDetach_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IDetach_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IDetach_stmtContext) -} - -func (s *Sql_stmtContext) Drop_stmt() IDrop_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IDrop_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IDrop_stmtContext) -} - -func (s *Sql_stmtContext) Insert_stmt() IInsert_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IInsert_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IInsert_stmtContext) -} - -func (s *Sql_stmtContext) Pragma_stmt() IPragma_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IPragma_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IPragma_stmtContext) -} - -func (s *Sql_stmtContext) Reindex_stmt() IReindex_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IReindex_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IReindex_stmtContext) -} - -func (s *Sql_stmtContext) Release_stmt() IRelease_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IRelease_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IRelease_stmtContext) -} - -func (s *Sql_stmtContext) Rollback_stmt() IRollback_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IRollback_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IRollback_stmtContext) -} - -func (s *Sql_stmtContext) Savepoint_stmt() ISavepoint_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISavepoint_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISavepoint_stmtContext) -} - -func (s *Sql_stmtContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Sql_stmtContext) Update_stmt() IUpdate_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IUpdate_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IUpdate_stmtContext) -} - -func (s *Sql_stmtContext) Update_stmt_limited() IUpdate_stmt_limitedContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IUpdate_stmt_limitedContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IUpdate_stmt_limitedContext) -} - -func (s *Sql_stmtContext) Vacuum_stmt() IVacuum_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IVacuum_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IVacuum_stmtContext) -} - -func (s *Sql_stmtContext) EXPLAIN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXPLAIN_, 0) -} - -func (s *Sql_stmtContext) QUERY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserQUERY_, 0) -} - -func (s *Sql_stmtContext) PLAN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPLAN_, 0) -} - -func (s *Sql_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Sql_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Sql_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSql_stmt(s) - } -} - -func (s *Sql_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSql_stmt(s) - } -} - -func (p *SQLiteParser) Sql_stmt() (localctx ISql_stmtContext) { - this := p - _ = this - - localctx = NewSql_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 4, SQLiteParserRULE_sql_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(267) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserEXPLAIN_ { - { - p.SetState(262) - p.Match(SQLiteParserEXPLAIN_) - } - p.SetState(265) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserQUERY_ { - { - p.SetState(263) - p.Match(SQLiteParserQUERY_) - } - { - p.SetState(264) - p.Match(SQLiteParserPLAN_) - } - - } - - } - p.SetState(293) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 7, p.GetParserRuleContext()) { - case 1: - { - p.SetState(269) - p.Alter_table_stmt() - } - - case 2: - { - p.SetState(270) - p.Analyze_stmt() - } - - case 3: - { - p.SetState(271) - p.Attach_stmt() - } - - case 4: - { - p.SetState(272) - p.Begin_stmt() - } - - case 5: - { - p.SetState(273) - p.Commit_stmt() - } - - case 6: - { - p.SetState(274) - p.Create_index_stmt() - } - - case 7: - { - p.SetState(275) - p.Create_table_stmt() - } - - case 8: - { - p.SetState(276) - p.Create_trigger_stmt() - } - - case 9: - { - p.SetState(277) - p.Create_view_stmt() - } - - case 10: - { - p.SetState(278) - p.Create_virtual_table_stmt() - } - - case 11: - { - p.SetState(279) - p.Delete_stmt() - } - - case 12: - { - p.SetState(280) - p.Delete_stmt_limited() - } - - case 13: - { - p.SetState(281) - p.Detach_stmt() - } - - case 14: - { - p.SetState(282) - p.Drop_stmt() - } - - case 15: - { - p.SetState(283) - p.Insert_stmt() - } - - case 16: - { - p.SetState(284) - p.Pragma_stmt() - } - - case 17: - { - p.SetState(285) - p.Reindex_stmt() - } - - case 18: - { - p.SetState(286) - p.Release_stmt() - } - - case 19: - { - p.SetState(287) - p.Rollback_stmt() - } - - case 20: - { - p.SetState(288) - p.Savepoint_stmt() - } - - case 21: - { - p.SetState(289) - p.Select_stmt() - } - - case 22: - { - p.SetState(290) - p.Update_stmt() - } - - case 23: - { - p.SetState(291) - p.Update_stmt_limited() - } - - case 24: - { - p.SetState(292) - p.Vacuum_stmt() - } - - } - - return localctx -} - -// IAlter_table_stmtContext is an interface to support dynamic dispatch. -type IAlter_table_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // GetOld_column_name returns the old_column_name rule contexts. - GetOld_column_name() IColumn_nameContext - - // GetNew_column_name returns the new_column_name rule contexts. - GetNew_column_name() IColumn_nameContext - - // SetOld_column_name sets the old_column_name rule contexts. - SetOld_column_name(IColumn_nameContext) - - // SetNew_column_name sets the new_column_name rule contexts. - SetNew_column_name(IColumn_nameContext) - - // Getter signatures - ALTER_() antlr.TerminalNode - TABLE_() antlr.TerminalNode - Table_name() ITable_nameContext - RENAME_() antlr.TerminalNode - ADD_() antlr.TerminalNode - Column_def() IColumn_defContext - DROP_() antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - TO_() antlr.TerminalNode - New_table_name() INew_table_nameContext - COLUMN_() antlr.TerminalNode - - // IsAlter_table_stmtContext differentiates from other interfaces. - IsAlter_table_stmtContext() -} - -type Alter_table_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser - old_column_name IColumn_nameContext - new_column_name IColumn_nameContext -} - -func NewEmptyAlter_table_stmtContext() *Alter_table_stmtContext { - var p = new(Alter_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_alter_table_stmt - return p -} - -func (*Alter_table_stmtContext) IsAlter_table_stmtContext() {} - -func NewAlter_table_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_table_stmtContext { - var p = new(Alter_table_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_alter_table_stmt - - return p -} - -func (s *Alter_table_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Alter_table_stmtContext) GetOld_column_name() IColumn_nameContext { return s.old_column_name } - -func (s *Alter_table_stmtContext) GetNew_column_name() IColumn_nameContext { return s.new_column_name } - -func (s *Alter_table_stmtContext) SetOld_column_name(v IColumn_nameContext) { s.old_column_name = v } - -func (s *Alter_table_stmtContext) SetNew_column_name(v IColumn_nameContext) { s.new_column_name = v } - -func (s *Alter_table_stmtContext) ALTER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserALTER_, 0) -} - -func (s *Alter_table_stmtContext) TABLE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTABLE_, 0) -} - -func (s *Alter_table_stmtContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Alter_table_stmtContext) RENAME_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRENAME_, 0) -} - -func (s *Alter_table_stmtContext) ADD_() antlr.TerminalNode { - return s.GetToken(SQLiteParserADD_, 0) -} - -func (s *Alter_table_stmtContext) Column_def() IColumn_defContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_defContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IColumn_defContext) -} - -func (s *Alter_table_stmtContext) DROP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDROP_, 0) -} - -func (s *Alter_table_stmtContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Alter_table_stmtContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Alter_table_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Alter_table_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Alter_table_stmtContext) TO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTO_, 0) -} - -func (s *Alter_table_stmtContext) New_table_name() INew_table_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(INew_table_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(INew_table_nameContext) -} - -func (s *Alter_table_stmtContext) COLUMN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOLUMN_, 0) -} - -func (s *Alter_table_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Alter_table_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Alter_table_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterAlter_table_stmt(s) - } -} - -func (s *Alter_table_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitAlter_table_stmt(s) - } -} - -func (p *SQLiteParser) Alter_table_stmt() (localctx IAlter_table_stmtContext) { - this := p - _ = this - - localctx = NewAlter_table_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 6, SQLiteParserRULE_alter_table_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(295) - p.Match(SQLiteParserALTER_) - } - { - p.SetState(296) - p.Match(SQLiteParserTABLE_) - } - p.SetState(300) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 8, p.GetParserRuleContext()) == 1 { - { - p.SetState(297) - p.Schema_name() - } - { - p.SetState(298) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(302) - p.Table_name() - } - p.SetState(325) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserRENAME_: - { - p.SetState(303) - p.Match(SQLiteParserRENAME_) - } - p.SetState(313) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 10, p.GetParserRuleContext()) { - case 1: - { - p.SetState(304) - p.Match(SQLiteParserTO_) - } - { - p.SetState(305) - p.New_table_name() - } - - case 2: - p.SetState(307) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 9, p.GetParserRuleContext()) == 1 { - { - p.SetState(306) - p.Match(SQLiteParserCOLUMN_) - } - - } - { - p.SetState(309) - - var _x = p.Column_name() - - localctx.(*Alter_table_stmtContext).old_column_name = _x - } - { - p.SetState(310) - p.Match(SQLiteParserTO_) - } - { - p.SetState(311) - - var _x = p.Column_name() - - localctx.(*Alter_table_stmtContext).new_column_name = _x - } - - } - - case SQLiteParserADD_: - { - p.SetState(315) - p.Match(SQLiteParserADD_) - } - p.SetState(317) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 11, p.GetParserRuleContext()) == 1 { - { - p.SetState(316) - p.Match(SQLiteParserCOLUMN_) - } - - } - { - p.SetState(319) - p.Column_def() - } - - case SQLiteParserDROP_: - { - p.SetState(320) - p.Match(SQLiteParserDROP_) - } - p.SetState(322) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 12, p.GetParserRuleContext()) == 1 { - { - p.SetState(321) - p.Match(SQLiteParserCOLUMN_) - } - - } - { - p.SetState(324) - p.Column_name() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IAnalyze_stmtContext is an interface to support dynamic dispatch. -type IAnalyze_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ANALYZE_() antlr.TerminalNode - Schema_name() ISchema_nameContext - Table_or_index_name() ITable_or_index_nameContext - DOT() antlr.TerminalNode - - // IsAnalyze_stmtContext differentiates from other interfaces. - IsAnalyze_stmtContext() -} - -type Analyze_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyAnalyze_stmtContext() *Analyze_stmtContext { - var p = new(Analyze_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_analyze_stmt - return p -} - -func (*Analyze_stmtContext) IsAnalyze_stmtContext() {} - -func NewAnalyze_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Analyze_stmtContext { - var p = new(Analyze_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_analyze_stmt - - return p -} - -func (s *Analyze_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Analyze_stmtContext) ANALYZE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserANALYZE_, 0) -} - -func (s *Analyze_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Analyze_stmtContext) Table_or_index_name() ITable_or_index_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_or_index_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_or_index_nameContext) -} - -func (s *Analyze_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Analyze_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Analyze_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Analyze_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterAnalyze_stmt(s) - } -} - -func (s *Analyze_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitAnalyze_stmt(s) - } -} - -func (p *SQLiteParser) Analyze_stmt() (localctx IAnalyze_stmtContext) { - this := p - _ = this - - localctx = NewAnalyze_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 8, SQLiteParserRULE_analyze_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(327) - p.Match(SQLiteParserANALYZE_) - } - p.SetState(335) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext()) == 1 { - { - p.SetState(328) - p.Schema_name() - } - - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 15, p.GetParserRuleContext()) == 2 { - p.SetState(332) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 14, p.GetParserRuleContext()) == 1 { - { - p.SetState(329) - p.Schema_name() - } - { - p.SetState(330) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(334) - p.Table_or_index_name() - } - - } - - return localctx -} - -// IAttach_stmtContext is an interface to support dynamic dispatch. -type IAttach_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ATTACH_() antlr.TerminalNode - Expr() IExprContext - AS_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DATABASE_() antlr.TerminalNode - - // IsAttach_stmtContext differentiates from other interfaces. - IsAttach_stmtContext() -} - -type Attach_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyAttach_stmtContext() *Attach_stmtContext { - var p = new(Attach_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_attach_stmt - return p -} - -func (*Attach_stmtContext) IsAttach_stmtContext() {} - -func NewAttach_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Attach_stmtContext { - var p = new(Attach_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_attach_stmt - - return p -} - -func (s *Attach_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Attach_stmtContext) ATTACH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserATTACH_, 0) -} - -func (s *Attach_stmtContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Attach_stmtContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Attach_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Attach_stmtContext) DATABASE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDATABASE_, 0) -} - -func (s *Attach_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Attach_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Attach_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterAttach_stmt(s) - } -} - -func (s *Attach_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitAttach_stmt(s) - } -} - -func (p *SQLiteParser) Attach_stmt() (localctx IAttach_stmtContext) { - this := p - _ = this - - localctx = NewAttach_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 10, SQLiteParserRULE_attach_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(337) - p.Match(SQLiteParserATTACH_) - } - p.SetState(339) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 { - { - p.SetState(338) - p.Match(SQLiteParserDATABASE_) - } - - } - { - p.SetState(341) - p.expr(0) - } - { - p.SetState(342) - p.Match(SQLiteParserAS_) - } - { - p.SetState(343) - p.Schema_name() - } - - return localctx -} - -// IBegin_stmtContext is an interface to support dynamic dispatch. -type IBegin_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - BEGIN_() antlr.TerminalNode - TRANSACTION_() antlr.TerminalNode - DEFERRED_() antlr.TerminalNode - IMMEDIATE_() antlr.TerminalNode - EXCLUSIVE_() antlr.TerminalNode - Transaction_name() ITransaction_nameContext - - // IsBegin_stmtContext differentiates from other interfaces. - IsBegin_stmtContext() -} - -type Begin_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyBegin_stmtContext() *Begin_stmtContext { - var p = new(Begin_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_begin_stmt - return p -} - -func (*Begin_stmtContext) IsBegin_stmtContext() {} - -func NewBegin_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Begin_stmtContext { - var p = new(Begin_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_begin_stmt - - return p -} - -func (s *Begin_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Begin_stmtContext) BEGIN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBEGIN_, 0) -} - -func (s *Begin_stmtContext) TRANSACTION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRANSACTION_, 0) -} - -func (s *Begin_stmtContext) DEFERRED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFERRED_, 0) -} - -func (s *Begin_stmtContext) IMMEDIATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIMMEDIATE_, 0) -} - -func (s *Begin_stmtContext) EXCLUSIVE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXCLUSIVE_, 0) -} - -func (s *Begin_stmtContext) Transaction_name() ITransaction_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITransaction_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITransaction_nameContext) -} - -func (s *Begin_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Begin_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Begin_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterBegin_stmt(s) - } -} - -func (s *Begin_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitBegin_stmt(s) - } -} - -func (p *SQLiteParser) Begin_stmt() (localctx IBegin_stmtContext) { - this := p - _ = this - - localctx = NewBegin_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 12, SQLiteParserRULE_begin_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(345) - p.Match(SQLiteParserBEGIN_) - } - p.SetState(347) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if (int64((_la-58)) & ^0x3f) == 0 && ((int64(1)<<(_la-58))&16779265) != 0 { - { - p.SetState(346) - _la = p.GetTokenStream().LA(1) - - if !((int64((_la-58)) & ^0x3f) == 0 && ((int64(1)<<(_la-58))&16779265) != 0) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - p.SetState(353) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserTRANSACTION_ { - { - p.SetState(349) - p.Match(SQLiteParserTRANSACTION_) - } - p.SetState(351) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 18, p.GetParserRuleContext()) == 1 { - { - p.SetState(350) - p.Transaction_name() - } - - } - - } - - return localctx -} - -// ICommit_stmtContext is an interface to support dynamic dispatch. -type ICommit_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - COMMIT_() antlr.TerminalNode - END_() antlr.TerminalNode - TRANSACTION_() antlr.TerminalNode - - // IsCommit_stmtContext differentiates from other interfaces. - IsCommit_stmtContext() -} - -type Commit_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCommit_stmtContext() *Commit_stmtContext { - var p = new(Commit_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_commit_stmt - return p -} - -func (*Commit_stmtContext) IsCommit_stmtContext() {} - -func NewCommit_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Commit_stmtContext { - var p = new(Commit_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_commit_stmt - - return p -} - -func (s *Commit_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Commit_stmtContext) COMMIT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMIT_, 0) -} - -func (s *Commit_stmtContext) END_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEND_, 0) -} - -func (s *Commit_stmtContext) TRANSACTION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRANSACTION_, 0) -} - -func (s *Commit_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Commit_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Commit_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCommit_stmt(s) - } -} - -func (s *Commit_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCommit_stmt(s) - } -} - -func (p *SQLiteParser) Commit_stmt() (localctx ICommit_stmtContext) { - this := p - _ = this - - localctx = NewCommit_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 14, SQLiteParserRULE_commit_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(355) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserCOMMIT_ || _la == SQLiteParserEND_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - p.SetState(357) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserTRANSACTION_ { - { - p.SetState(356) - p.Match(SQLiteParserTRANSACTION_) - } - - } - - return localctx -} - -// IRollback_stmtContext is an interface to support dynamic dispatch. -type IRollback_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ROLLBACK_() antlr.TerminalNode - TRANSACTION_() antlr.TerminalNode - TO_() antlr.TerminalNode - Savepoint_name() ISavepoint_nameContext - SAVEPOINT_() antlr.TerminalNode - - // IsRollback_stmtContext differentiates from other interfaces. - IsRollback_stmtContext() -} - -type Rollback_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyRollback_stmtContext() *Rollback_stmtContext { - var p = new(Rollback_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_rollback_stmt - return p -} - -func (*Rollback_stmtContext) IsRollback_stmtContext() {} - -func NewRollback_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rollback_stmtContext { - var p = new(Rollback_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_rollback_stmt - - return p -} - -func (s *Rollback_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Rollback_stmtContext) ROLLBACK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROLLBACK_, 0) -} - -func (s *Rollback_stmtContext) TRANSACTION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRANSACTION_, 0) -} - -func (s *Rollback_stmtContext) TO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTO_, 0) -} - -func (s *Rollback_stmtContext) Savepoint_name() ISavepoint_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISavepoint_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISavepoint_nameContext) -} - -func (s *Rollback_stmtContext) SAVEPOINT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSAVEPOINT_, 0) -} - -func (s *Rollback_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Rollback_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Rollback_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterRollback_stmt(s) - } -} - -func (s *Rollback_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitRollback_stmt(s) - } -} - -func (p *SQLiteParser) Rollback_stmt() (localctx IRollback_stmtContext) { - this := p - _ = this - - localctx = NewRollback_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 16, SQLiteParserRULE_rollback_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(359) - p.Match(SQLiteParserROLLBACK_) - } - p.SetState(361) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserTRANSACTION_ { - { - p.SetState(360) - p.Match(SQLiteParserTRANSACTION_) - } - - } - p.SetState(368) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserTO_ { - { - p.SetState(363) - p.Match(SQLiteParserTO_) - } - p.SetState(365) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 22, p.GetParserRuleContext()) == 1 { - { - p.SetState(364) - p.Match(SQLiteParserSAVEPOINT_) - } - - } - { - p.SetState(367) - p.Savepoint_name() - } - - } - - return localctx -} - -// ISavepoint_stmtContext is an interface to support dynamic dispatch. -type ISavepoint_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - SAVEPOINT_() antlr.TerminalNode - Savepoint_name() ISavepoint_nameContext - - // IsSavepoint_stmtContext differentiates from other interfaces. - IsSavepoint_stmtContext() -} - -type Savepoint_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySavepoint_stmtContext() *Savepoint_stmtContext { - var p = new(Savepoint_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_savepoint_stmt - return p -} - -func (*Savepoint_stmtContext) IsSavepoint_stmtContext() {} - -func NewSavepoint_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Savepoint_stmtContext { - var p = new(Savepoint_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_savepoint_stmt - - return p -} - -func (s *Savepoint_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Savepoint_stmtContext) SAVEPOINT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSAVEPOINT_, 0) -} - -func (s *Savepoint_stmtContext) Savepoint_name() ISavepoint_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISavepoint_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISavepoint_nameContext) -} - -func (s *Savepoint_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Savepoint_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Savepoint_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSavepoint_stmt(s) - } -} - -func (s *Savepoint_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSavepoint_stmt(s) - } -} - -func (p *SQLiteParser) Savepoint_stmt() (localctx ISavepoint_stmtContext) { - this := p - _ = this - - localctx = NewSavepoint_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 18, SQLiteParserRULE_savepoint_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(370) - p.Match(SQLiteParserSAVEPOINT_) - } - { - p.SetState(371) - p.Savepoint_name() - } - - return localctx -} - -// IRelease_stmtContext is an interface to support dynamic dispatch. -type IRelease_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - RELEASE_() antlr.TerminalNode - Savepoint_name() ISavepoint_nameContext - SAVEPOINT_() antlr.TerminalNode - - // IsRelease_stmtContext differentiates from other interfaces. - IsRelease_stmtContext() -} - -type Release_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyRelease_stmtContext() *Release_stmtContext { - var p = new(Release_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_release_stmt - return p -} - -func (*Release_stmtContext) IsRelease_stmtContext() {} - -func NewRelease_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Release_stmtContext { - var p = new(Release_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_release_stmt - - return p -} - -func (s *Release_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Release_stmtContext) RELEASE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRELEASE_, 0) -} - -func (s *Release_stmtContext) Savepoint_name() ISavepoint_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISavepoint_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISavepoint_nameContext) -} - -func (s *Release_stmtContext) SAVEPOINT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSAVEPOINT_, 0) -} - -func (s *Release_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Release_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Release_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterRelease_stmt(s) - } -} - -func (s *Release_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitRelease_stmt(s) - } -} - -func (p *SQLiteParser) Release_stmt() (localctx IRelease_stmtContext) { - this := p - _ = this - - localctx = NewRelease_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 20, SQLiteParserRULE_release_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(373) - p.Match(SQLiteParserRELEASE_) - } - p.SetState(375) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 24, p.GetParserRuleContext()) == 1 { - { - p.SetState(374) - p.Match(SQLiteParserSAVEPOINT_) - } - - } - { - p.SetState(377) - p.Savepoint_name() - } - - return localctx -} - -// ICreate_index_stmtContext is an interface to support dynamic dispatch. -type ICreate_index_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - CREATE_() antlr.TerminalNode - INDEX_() antlr.TerminalNode - Index_name() IIndex_nameContext - ON_() antlr.TerminalNode - Table_name() ITable_nameContext - OPEN_PAR() antlr.TerminalNode - AllIndexed_column() []IIndexed_columnContext - Indexed_column(i int) IIndexed_columnContext - CLOSE_PAR() antlr.TerminalNode - UNIQUE_() antlr.TerminalNode - IF_() antlr.TerminalNode - NOT_() antlr.TerminalNode - EXISTS_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - WHERE_() antlr.TerminalNode - Expr() IExprContext - - // IsCreate_index_stmtContext differentiates from other interfaces. - IsCreate_index_stmtContext() -} - -type Create_index_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCreate_index_stmtContext() *Create_index_stmtContext { - var p = new(Create_index_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_create_index_stmt - return p -} - -func (*Create_index_stmtContext) IsCreate_index_stmtContext() {} - -func NewCreate_index_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_index_stmtContext { - var p = new(Create_index_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_create_index_stmt - - return p -} - -func (s *Create_index_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Create_index_stmtContext) CREATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCREATE_, 0) -} - -func (s *Create_index_stmtContext) INDEX_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINDEX_, 0) -} - -func (s *Create_index_stmtContext) Index_name() IIndex_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IIndex_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IIndex_nameContext) -} - -func (s *Create_index_stmtContext) ON_() antlr.TerminalNode { - return s.GetToken(SQLiteParserON_, 0) -} - -func (s *Create_index_stmtContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Create_index_stmtContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Create_index_stmtContext) AllIndexed_column() []IIndexed_columnContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IIndexed_columnContext); ok { - len++ - } - } - - tst := make([]IIndexed_columnContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IIndexed_columnContext); ok { - tst[i] = t.(IIndexed_columnContext) - i++ - } - } - - return tst -} - -func (s *Create_index_stmtContext) Indexed_column(i int) IIndexed_columnContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IIndexed_columnContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IIndexed_columnContext) -} - -func (s *Create_index_stmtContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Create_index_stmtContext) UNIQUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNIQUE_, 0) -} - -func (s *Create_index_stmtContext) IF_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIF_, 0) -} - -func (s *Create_index_stmtContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Create_index_stmtContext) EXISTS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXISTS_, 0) -} - -func (s *Create_index_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Create_index_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Create_index_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Create_index_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Create_index_stmtContext) WHERE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, 0) -} - -func (s *Create_index_stmtContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Create_index_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Create_index_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Create_index_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCreate_index_stmt(s) - } -} - -func (s *Create_index_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCreate_index_stmt(s) - } -} - -func (p *SQLiteParser) Create_index_stmt() (localctx ICreate_index_stmtContext) { - this := p - _ = this - - localctx = NewCreate_index_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 22, SQLiteParserRULE_create_index_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(379) - p.Match(SQLiteParserCREATE_) - } - p.SetState(381) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserUNIQUE_ { - { - p.SetState(380) - p.Match(SQLiteParserUNIQUE_) - } - - } - { - p.SetState(383) - p.Match(SQLiteParserINDEX_) - } - p.SetState(387) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 26, p.GetParserRuleContext()) == 1 { - { - p.SetState(384) - p.Match(SQLiteParserIF_) - } - { - p.SetState(385) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(386) - p.Match(SQLiteParserEXISTS_) - } - - } - p.SetState(392) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 27, p.GetParserRuleContext()) == 1 { - { - p.SetState(389) - p.Schema_name() - } - { - p.SetState(390) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(394) - p.Index_name() - } - { - p.SetState(395) - p.Match(SQLiteParserON_) - } - { - p.SetState(396) - p.Table_name() - } - { - p.SetState(397) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(398) - p.Indexed_column() - } - p.SetState(403) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(399) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(400) - p.Indexed_column() - } - - p.SetState(405) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(406) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(409) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHERE_ { - { - p.SetState(407) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(408) - p.expr(0) - } - - } - - return localctx -} - -// IIndexed_columnContext is an interface to support dynamic dispatch. -type IIndexed_columnContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Column_name() IColumn_nameContext - Expr() IExprContext - COLLATE_() antlr.TerminalNode - Collation_name() ICollation_nameContext - Asc_desc() IAsc_descContext - - // IsIndexed_columnContext differentiates from other interfaces. - IsIndexed_columnContext() -} - -type Indexed_columnContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyIndexed_columnContext() *Indexed_columnContext { - var p = new(Indexed_columnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_indexed_column - return p -} - -func (*Indexed_columnContext) IsIndexed_columnContext() {} - -func NewIndexed_columnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Indexed_columnContext { - var p = new(Indexed_columnContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_indexed_column - - return p -} - -func (s *Indexed_columnContext) GetParser() antlr.Parser { return s.parser } - -func (s *Indexed_columnContext) Column_name() IColumn_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Indexed_columnContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Indexed_columnContext) COLLATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOLLATE_, 0) -} - -func (s *Indexed_columnContext) Collation_name() ICollation_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICollation_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICollation_nameContext) -} - -func (s *Indexed_columnContext) Asc_desc() IAsc_descContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAsc_descContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAsc_descContext) -} - -func (s *Indexed_columnContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Indexed_columnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Indexed_columnContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterIndexed_column(s) - } -} - -func (s *Indexed_columnContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitIndexed_column(s) - } -} - -func (p *SQLiteParser) Indexed_column() (localctx IIndexed_columnContext) { - this := p - _ = this - - localctx = NewIndexed_columnContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 24, SQLiteParserRULE_indexed_column) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(413) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 30, p.GetParserRuleContext()) { - case 1: - { - p.SetState(411) - p.Column_name() - } - - case 2: - { - p.SetState(412) - p.expr(0) - } - - } - p.SetState(417) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserCOLLATE_ { - { - p.SetState(415) - p.Match(SQLiteParserCOLLATE_) - } - { - p.SetState(416) - p.Collation_name() - } - - } - p.SetState(420) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { - { - p.SetState(419) - p.Asc_desc() - } - - } - - return localctx -} - -// ITable_optionContext is an interface to support dynamic dispatch. -type ITable_optionContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // GetRow_ROW_ID returns the row_ROW_ID token. - GetRow_ROW_ID() antlr.Token - - // SetRow_ROW_ID sets the row_ROW_ID token. - SetRow_ROW_ID(antlr.Token) - - // Getter signatures - WITHOUT_() antlr.TerminalNode - IDENTIFIER() antlr.TerminalNode - STRICT_() antlr.TerminalNode - - // IsTable_optionContext differentiates from other interfaces. - IsTable_optionContext() -} - -type Table_optionContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser - row_ROW_ID antlr.Token -} - -func NewEmptyTable_optionContext() *Table_optionContext { - var p = new(Table_optionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_table_option - return p -} - -func (*Table_optionContext) IsTable_optionContext() {} - -func NewTable_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_optionContext { - var p = new(Table_optionContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_table_option - - return p -} - -func (s *Table_optionContext) GetParser() antlr.Parser { return s.parser } - -func (s *Table_optionContext) GetRow_ROW_ID() antlr.Token { return s.row_ROW_ID } - -func (s *Table_optionContext) SetRow_ROW_ID(v antlr.Token) { s.row_ROW_ID = v } - -func (s *Table_optionContext) WITHOUT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWITHOUT_, 0) -} - -func (s *Table_optionContext) IDENTIFIER() antlr.TerminalNode { - return s.GetToken(SQLiteParserIDENTIFIER, 0) -} - -func (s *Table_optionContext) STRICT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTRICT_, 0) -} - -func (s *Table_optionContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Table_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Table_optionContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTable_option(s) - } -} - -func (s *Table_optionContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTable_option(s) - } -} - -func (p *SQLiteParser) Table_option() (localctx ITable_optionContext) { - this := p - _ = this - - localctx = NewTable_optionContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 26, SQLiteParserRULE_table_option) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(425) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserWITHOUT_: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(422) - p.Match(SQLiteParserWITHOUT_) - } - { - p.SetState(423) - - var _m = p.Match(SQLiteParserIDENTIFIER) - - localctx.(*Table_optionContext).row_ROW_ID = _m - } - - case SQLiteParserSTRICT_: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(424) - p.Match(SQLiteParserSTRICT_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// ICreate_table_stmtContext is an interface to support dynamic dispatch. -type ICreate_table_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - CREATE_() antlr.TerminalNode - TABLE_() antlr.TerminalNode - Table_name() ITable_nameContext - OPEN_PAR() antlr.TerminalNode - AllColumn_def() []IColumn_defContext - Column_def(i int) IColumn_defContext - CLOSE_PAR() antlr.TerminalNode - AS_() antlr.TerminalNode - Select_stmt() ISelect_stmtContext - IF_() antlr.TerminalNode - NOT_() antlr.TerminalNode - EXISTS_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - TEMP_() antlr.TerminalNode - TEMPORARY_() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - AllTable_constraint() []ITable_constraintContext - Table_constraint(i int) ITable_constraintContext - AllTable_option() []ITable_optionContext - Table_option(i int) ITable_optionContext - - // IsCreate_table_stmtContext differentiates from other interfaces. - IsCreate_table_stmtContext() -} - -type Create_table_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCreate_table_stmtContext() *Create_table_stmtContext { - var p = new(Create_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_create_table_stmt - return p -} - -func (*Create_table_stmtContext) IsCreate_table_stmtContext() {} - -func NewCreate_table_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_table_stmtContext { - var p = new(Create_table_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_create_table_stmt - - return p -} - -func (s *Create_table_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Create_table_stmtContext) CREATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCREATE_, 0) -} - -func (s *Create_table_stmtContext) TABLE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTABLE_, 0) -} - -func (s *Create_table_stmtContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Create_table_stmtContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Create_table_stmtContext) AllColumn_def() []IColumn_defContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_defContext); ok { - len++ - } - } - - tst := make([]IColumn_defContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_defContext); ok { - tst[i] = t.(IColumn_defContext) - i++ - } - } - - return tst -} - -func (s *Create_table_stmtContext) Column_def(i int) IColumn_defContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_defContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_defContext) -} - -func (s *Create_table_stmtContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Create_table_stmtContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Create_table_stmtContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Create_table_stmtContext) IF_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIF_, 0) -} - -func (s *Create_table_stmtContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Create_table_stmtContext) EXISTS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXISTS_, 0) -} - -func (s *Create_table_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Create_table_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Create_table_stmtContext) TEMP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTEMP_, 0) -} - -func (s *Create_table_stmtContext) TEMPORARY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTEMPORARY_, 0) -} - -func (s *Create_table_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Create_table_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Create_table_stmtContext) AllTable_constraint() []ITable_constraintContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ITable_constraintContext); ok { - len++ - } - } - - tst := make([]ITable_constraintContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ITable_constraintContext); ok { - tst[i] = t.(ITable_constraintContext) - i++ - } - } - - return tst -} - -func (s *Create_table_stmtContext) Table_constraint(i int) ITable_constraintContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_constraintContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ITable_constraintContext) -} - -func (s *Create_table_stmtContext) AllTable_option() []ITable_optionContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ITable_optionContext); ok { - len++ - } - } - - tst := make([]ITable_optionContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ITable_optionContext); ok { - tst[i] = t.(ITable_optionContext) - i++ - } - } - - return tst -} - -func (s *Create_table_stmtContext) Table_option(i int) ITable_optionContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_optionContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ITable_optionContext) -} - -func (s *Create_table_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Create_table_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Create_table_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCreate_table_stmt(s) - } -} - -func (s *Create_table_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCreate_table_stmt(s) - } -} - -func (p *SQLiteParser) Create_table_stmt() (localctx ICreate_table_stmtContext) { - this := p - _ = this - - localctx = NewCreate_table_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 28, SQLiteParserRULE_create_table_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(427) - p.Match(SQLiteParserCREATE_) - } - p.SetState(429) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_ { - { - p.SetState(428) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - { - p.SetState(431) - p.Match(SQLiteParserTABLE_) - } - p.SetState(435) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 35, p.GetParserRuleContext()) == 1 { - { - p.SetState(432) - p.Match(SQLiteParserIF_) - } - { - p.SetState(433) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(434) - p.Match(SQLiteParserEXISTS_) - } - - } - p.SetState(440) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 36, p.GetParserRuleContext()) == 1 { - { - p.SetState(437) - p.Schema_name() - } - { - p.SetState(438) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(442) - p.Table_name() - } - p.SetState(472) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserOPEN_PAR: - { - p.SetState(443) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(444) - p.Column_def() - } - p.SetState(449) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 37, p.GetParserRuleContext()) - - for _alt != 1 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1+1 { - { - p.SetState(445) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(446) - p.Column_def() - } - - } - p.SetState(451) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 37, p.GetParserRuleContext()) - } - p.SetState(456) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(452) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(453) - p.Table_constraint() - } - - p.SetState(458) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(459) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(468) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserSTRICT_ || _la == SQLiteParserWITHOUT_ { - { - p.SetState(460) - p.Table_option() - } - p.SetState(465) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(461) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(462) - p.Table_option() - } - - p.SetState(467) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - } - - case SQLiteParserAS_: - { - p.SetState(470) - p.Match(SQLiteParserAS_) - } - { - p.SetState(471) - p.Select_stmt() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IColumn_defContext is an interface to support dynamic dispatch. -type IColumn_defContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Column_name() IColumn_nameContext - Type_name() IType_nameContext - AllColumn_constraint() []IColumn_constraintContext - Column_constraint(i int) IColumn_constraintContext - - // IsColumn_defContext differentiates from other interfaces. - IsColumn_defContext() -} - -type Column_defContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyColumn_defContext() *Column_defContext { - var p = new(Column_defContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_column_def - return p -} - -func (*Column_defContext) IsColumn_defContext() {} - -func NewColumn_defContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_defContext { - var p = new(Column_defContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_column_def - - return p -} - -func (s *Column_defContext) GetParser() antlr.Parser { return s.parser } - -func (s *Column_defContext) Column_name() IColumn_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Column_defContext) Type_name() IType_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IType_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IType_nameContext) -} - -func (s *Column_defContext) AllColumn_constraint() []IColumn_constraintContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_constraintContext); ok { - len++ - } - } - - tst := make([]IColumn_constraintContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_constraintContext); ok { - tst[i] = t.(IColumn_constraintContext) - i++ - } - } - - return tst -} - -func (s *Column_defContext) Column_constraint(i int) IColumn_constraintContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_constraintContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_constraintContext) -} - -func (s *Column_defContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Column_defContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Column_defContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterColumn_def(s) - } -} - -func (s *Column_defContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitColumn_def(s) - } -} - -func (p *SQLiteParser) Column_def() (localctx IColumn_defContext) { - this := p - _ = this - - localctx = NewColumn_defContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 30, SQLiteParserRULE_column_def) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(474) - p.Column_name() - } - p.SetState(476) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 42, p.GetParserRuleContext()) == 1 { - { - p.SetState(475) - p.Type_name() - } - - } - p.SetState(481) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 43, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - { - p.SetState(478) - p.Column_constraint() - } - - } - p.SetState(483) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 43, p.GetParserRuleContext()) - } - - return localctx -} - -// IType_nameContext is an interface to support dynamic dispatch. -type IType_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - AllName() []INameContext - Name(i int) INameContext - OPEN_PAR() antlr.TerminalNode - AllSigned_number() []ISigned_numberContext - Signed_number(i int) ISigned_numberContext - CLOSE_PAR() antlr.TerminalNode - COMMA() antlr.TerminalNode - - // IsType_nameContext differentiates from other interfaces. - IsType_nameContext() -} - -type Type_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyType_nameContext() *Type_nameContext { - var p = new(Type_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_type_name - return p -} - -func (*Type_nameContext) IsType_nameContext() {} - -func NewType_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_nameContext { - var p = new(Type_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_type_name - - return p -} - -func (s *Type_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Type_nameContext) AllName() []INameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(INameContext); ok { - len++ - } - } - - tst := make([]INameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(INameContext); ok { - tst[i] = t.(INameContext) - i++ - } - } - - return tst -} - -func (s *Type_nameContext) Name(i int) INameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(INameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(INameContext) -} - -func (s *Type_nameContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Type_nameContext) AllSigned_number() []ISigned_numberContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ISigned_numberContext); ok { - len++ - } - } - - tst := make([]ISigned_numberContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ISigned_numberContext); ok { - tst[i] = t.(ISigned_numberContext) - i++ - } - } - - return tst -} - -func (s *Type_nameContext) Signed_number(i int) ISigned_numberContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISigned_numberContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ISigned_numberContext) -} - -func (s *Type_nameContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Type_nameContext) COMMA() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, 0) -} - -func (s *Type_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Type_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Type_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterType_name(s) - } -} - -func (s *Type_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitType_name(s) - } -} - -func (p *SQLiteParser) Type_name() (localctx IType_nameContext) { - this := p - _ = this - - localctx = NewType_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 32, SQLiteParserRULE_type_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - p.SetState(485) - p.GetErrorHandler().Sync(p) - _alt = 1 + 1 - for ok := true; ok; ok = _alt != 1 && _alt != antlr.ATNInvalidAltNumber { - switch _alt { - case 1 + 1: - { - p.SetState(484) - p.Name() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - p.SetState(487) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 44, p.GetParserRuleContext()) - } - p.SetState(499) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 45, p.GetParserRuleContext()) == 1 { - { - p.SetState(489) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(490) - p.Signed_number() - } - { - p.SetState(491) - p.Match(SQLiteParserCLOSE_PAR) - } - - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 45, p.GetParserRuleContext()) == 2 { - { - p.SetState(493) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(494) - p.Signed_number() - } - { - p.SetState(495) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(496) - p.Signed_number() - } - { - p.SetState(497) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - - return localctx -} - -// IColumn_constraintContext is an interface to support dynamic dispatch. -type IColumn_constraintContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - CHECK_() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - Expr() IExprContext - CLOSE_PAR() antlr.TerminalNode - DEFAULT_() antlr.TerminalNode - COLLATE_() antlr.TerminalNode - Collation_name() ICollation_nameContext - Foreign_key_clause() IForeign_key_clauseContext - AS_() antlr.TerminalNode - CONSTRAINT_() antlr.TerminalNode - Name() INameContext - PRIMARY_() antlr.TerminalNode - KEY_() antlr.TerminalNode - NOT_() antlr.TerminalNode - NULL_() antlr.TerminalNode - UNIQUE_() antlr.TerminalNode - Signed_number() ISigned_numberContext - Literal_value() ILiteral_valueContext - Conflict_clause() IConflict_clauseContext - GENERATED_() antlr.TerminalNode - ALWAYS_() antlr.TerminalNode - STORED_() antlr.TerminalNode - VIRTUAL_() antlr.TerminalNode - Asc_desc() IAsc_descContext - AUTOINCREMENT_() antlr.TerminalNode - - // IsColumn_constraintContext differentiates from other interfaces. - IsColumn_constraintContext() -} - -type Column_constraintContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyColumn_constraintContext() *Column_constraintContext { - var p = new(Column_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_column_constraint - return p -} - -func (*Column_constraintContext) IsColumn_constraintContext() {} - -func NewColumn_constraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_constraintContext { - var p = new(Column_constraintContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_column_constraint - - return p -} - -func (s *Column_constraintContext) GetParser() antlr.Parser { return s.parser } - -func (s *Column_constraintContext) CHECK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCHECK_, 0) -} - -func (s *Column_constraintContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Column_constraintContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Column_constraintContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Column_constraintContext) DEFAULT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFAULT_, 0) -} - -func (s *Column_constraintContext) COLLATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOLLATE_, 0) -} - -func (s *Column_constraintContext) Collation_name() ICollation_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICollation_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICollation_nameContext) -} - -func (s *Column_constraintContext) Foreign_key_clause() IForeign_key_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IForeign_key_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IForeign_key_clauseContext) -} - -func (s *Column_constraintContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Column_constraintContext) CONSTRAINT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCONSTRAINT_, 0) -} - -func (s *Column_constraintContext) Name() INameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(INameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(INameContext) -} - -func (s *Column_constraintContext) PRIMARY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRIMARY_, 0) -} - -func (s *Column_constraintContext) KEY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserKEY_, 0) -} - -func (s *Column_constraintContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Column_constraintContext) NULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNULL_, 0) -} - -func (s *Column_constraintContext) UNIQUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNIQUE_, 0) -} - -func (s *Column_constraintContext) Signed_number() ISigned_numberContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISigned_numberContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISigned_numberContext) -} - -func (s *Column_constraintContext) Literal_value() ILiteral_valueContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ILiteral_valueContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ILiteral_valueContext) -} - -func (s *Column_constraintContext) Conflict_clause() IConflict_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IConflict_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IConflict_clauseContext) -} - -func (s *Column_constraintContext) GENERATED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGENERATED_, 0) -} - -func (s *Column_constraintContext) ALWAYS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserALWAYS_, 0) -} - -func (s *Column_constraintContext) STORED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTORED_, 0) -} - -func (s *Column_constraintContext) VIRTUAL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVIRTUAL_, 0) -} - -func (s *Column_constraintContext) Asc_desc() IAsc_descContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAsc_descContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAsc_descContext) -} - -func (s *Column_constraintContext) AUTOINCREMENT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAUTOINCREMENT_, 0) -} - -func (s *Column_constraintContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Column_constraintContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Column_constraintContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterColumn_constraint(s) - } -} - -func (s *Column_constraintContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitColumn_constraint(s) - } -} - -func (p *SQLiteParser) Column_constraint() (localctx IColumn_constraintContext) { - this := p - _ = this - - localctx = NewColumn_constraintContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 34, SQLiteParserRULE_column_constraint) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(503) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserCONSTRAINT_ { - { - p.SetState(501) - p.Match(SQLiteParserCONSTRAINT_) - } - { - p.SetState(502) - p.Name() - } - - } - p.SetState(552) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserPRIMARY_: - { - p.SetState(505) - p.Match(SQLiteParserPRIMARY_) - } - { - p.SetState(506) - p.Match(SQLiteParserKEY_) - } - p.SetState(508) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { - { - p.SetState(507) - p.Asc_desc() - } - - } - p.SetState(511) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserON_ { - { - p.SetState(510) - p.Conflict_clause() - } - - } - p.SetState(514) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAUTOINCREMENT_ { - { - p.SetState(513) - p.Match(SQLiteParserAUTOINCREMENT_) - } - - } - - case SQLiteParserNOT_, SQLiteParserUNIQUE_: - p.SetState(519) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserNOT_: - { - p.SetState(516) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(517) - p.Match(SQLiteParserNULL_) - } - - case SQLiteParserUNIQUE_: - { - p.SetState(518) - p.Match(SQLiteParserUNIQUE_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - p.SetState(522) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserON_ { - { - p.SetState(521) - p.Conflict_clause() - } - - } - - case SQLiteParserCHECK_: - { - p.SetState(524) - p.Match(SQLiteParserCHECK_) - } - { - p.SetState(525) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(526) - p.expr(0) - } - { - p.SetState(527) - p.Match(SQLiteParserCLOSE_PAR) - } - - case SQLiteParserDEFAULT_: - { - p.SetState(529) - p.Match(SQLiteParserDEFAULT_) - } - p.SetState(536) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 52, p.GetParserRuleContext()) { - case 1: - { - p.SetState(530) - p.Signed_number() - } - - case 2: - { - p.SetState(531) - p.Literal_value() - } - - case 3: - { - p.SetState(532) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(533) - p.expr(0) - } - { - p.SetState(534) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - - case SQLiteParserCOLLATE_: - { - p.SetState(538) - p.Match(SQLiteParserCOLLATE_) - } - { - p.SetState(539) - p.Collation_name() - } - - case SQLiteParserREFERENCES_: - { - p.SetState(540) - p.Foreign_key_clause() - } - - case SQLiteParserAS_, SQLiteParserGENERATED_: - p.SetState(543) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserGENERATED_ { - { - p.SetState(541) - p.Match(SQLiteParserGENERATED_) - } - { - p.SetState(542) - p.Match(SQLiteParserALWAYS_) - } - - } - { - p.SetState(545) - p.Match(SQLiteParserAS_) - } - { - p.SetState(546) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(547) - p.expr(0) - } - { - p.SetState(548) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(550) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserVIRTUAL_ || _la == SQLiteParserSTORED_ { - { - p.SetState(549) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserVIRTUAL_ || _la == SQLiteParserSTORED_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// ISigned_numberContext is an interface to support dynamic dispatch. -type ISigned_numberContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - NUMERIC_LITERAL() antlr.TerminalNode - PLUS() antlr.TerminalNode - MINUS() antlr.TerminalNode - - // IsSigned_numberContext differentiates from other interfaces. - IsSigned_numberContext() -} - -type Signed_numberContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySigned_numberContext() *Signed_numberContext { - var p = new(Signed_numberContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_signed_number - return p -} - -func (*Signed_numberContext) IsSigned_numberContext() {} - -func NewSigned_numberContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Signed_numberContext { - var p = new(Signed_numberContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_signed_number - - return p -} - -func (s *Signed_numberContext) GetParser() antlr.Parser { return s.parser } - -func (s *Signed_numberContext) NUMERIC_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserNUMERIC_LITERAL, 0) -} - -func (s *Signed_numberContext) PLUS() antlr.TerminalNode { - return s.GetToken(SQLiteParserPLUS, 0) -} - -func (s *Signed_numberContext) MINUS() antlr.TerminalNode { - return s.GetToken(SQLiteParserMINUS, 0) -} - -func (s *Signed_numberContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Signed_numberContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Signed_numberContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSigned_number(s) - } -} - -func (s *Signed_numberContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSigned_number(s) - } -} - -func (p *SQLiteParser) Signed_number() (localctx ISigned_numberContext) { - this := p - _ = this - - localctx = NewSigned_numberContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 36, SQLiteParserRULE_signed_number) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(555) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPLUS || _la == SQLiteParserMINUS { - { - p.SetState(554) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserPLUS || _la == SQLiteParserMINUS) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - { - p.SetState(557) - p.Match(SQLiteParserNUMERIC_LITERAL) - } - - return localctx -} - -// ITable_constraintContext is an interface to support dynamic dispatch. -type ITable_constraintContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - OPEN_PAR() antlr.TerminalNode - AllIndexed_column() []IIndexed_columnContext - Indexed_column(i int) IIndexed_columnContext - CLOSE_PAR() antlr.TerminalNode - CHECK_() antlr.TerminalNode - Expr() IExprContext - FOREIGN_() antlr.TerminalNode - KEY_() antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - Foreign_key_clause() IForeign_key_clauseContext - CONSTRAINT_() antlr.TerminalNode - Name() INameContext - PRIMARY_() antlr.TerminalNode - UNIQUE_() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - Conflict_clause() IConflict_clauseContext - - // IsTable_constraintContext differentiates from other interfaces. - IsTable_constraintContext() -} - -type Table_constraintContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTable_constraintContext() *Table_constraintContext { - var p = new(Table_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_table_constraint - return p -} - -func (*Table_constraintContext) IsTable_constraintContext() {} - -func NewTable_constraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_constraintContext { - var p = new(Table_constraintContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_table_constraint - - return p -} - -func (s *Table_constraintContext) GetParser() antlr.Parser { return s.parser } - -func (s *Table_constraintContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Table_constraintContext) AllIndexed_column() []IIndexed_columnContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IIndexed_columnContext); ok { - len++ - } - } - - tst := make([]IIndexed_columnContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IIndexed_columnContext); ok { - tst[i] = t.(IIndexed_columnContext) - i++ - } - } - - return tst -} - -func (s *Table_constraintContext) Indexed_column(i int) IIndexed_columnContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IIndexed_columnContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IIndexed_columnContext) -} - -func (s *Table_constraintContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Table_constraintContext) CHECK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCHECK_, 0) -} - -func (s *Table_constraintContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Table_constraintContext) FOREIGN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFOREIGN_, 0) -} - -func (s *Table_constraintContext) KEY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserKEY_, 0) -} - -func (s *Table_constraintContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Table_constraintContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Table_constraintContext) Foreign_key_clause() IForeign_key_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IForeign_key_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IForeign_key_clauseContext) -} - -func (s *Table_constraintContext) CONSTRAINT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCONSTRAINT_, 0) -} - -func (s *Table_constraintContext) Name() INameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(INameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(INameContext) -} - -func (s *Table_constraintContext) PRIMARY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRIMARY_, 0) -} - -func (s *Table_constraintContext) UNIQUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNIQUE_, 0) -} - -func (s *Table_constraintContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Table_constraintContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Table_constraintContext) Conflict_clause() IConflict_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IConflict_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IConflict_clauseContext) -} - -func (s *Table_constraintContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Table_constraintContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Table_constraintContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTable_constraint(s) - } -} - -func (s *Table_constraintContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTable_constraint(s) - } -} - -func (p *SQLiteParser) Table_constraint() (localctx ITable_constraintContext) { - this := p - _ = this - - localctx = NewTable_constraintContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 38, SQLiteParserRULE_table_constraint) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(561) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserCONSTRAINT_ { - { - p.SetState(559) - p.Match(SQLiteParserCONSTRAINT_) - } - { - p.SetState(560) - p.Name() - } - - } - p.SetState(600) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserPRIMARY_, SQLiteParserUNIQUE_: - p.SetState(566) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserPRIMARY_: - { - p.SetState(563) - p.Match(SQLiteParserPRIMARY_) - } - { - p.SetState(564) - p.Match(SQLiteParserKEY_) - } - - case SQLiteParserUNIQUE_: - { - p.SetState(565) - p.Match(SQLiteParserUNIQUE_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - { - p.SetState(568) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(569) - p.Indexed_column() - } - p.SetState(574) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(570) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(571) - p.Indexed_column() - } - - p.SetState(576) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(577) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(579) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserON_ { - { - p.SetState(578) - p.Conflict_clause() - } - - } - - case SQLiteParserCHECK_: - { - p.SetState(581) - p.Match(SQLiteParserCHECK_) - } - { - p.SetState(582) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(583) - p.expr(0) - } - { - p.SetState(584) - p.Match(SQLiteParserCLOSE_PAR) - } - - case SQLiteParserFOREIGN_: - { - p.SetState(586) - p.Match(SQLiteParserFOREIGN_) - } - { - p.SetState(587) - p.Match(SQLiteParserKEY_) - } - { - p.SetState(588) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(589) - p.Column_name() - } - p.SetState(594) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(590) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(591) - p.Column_name() - } - - p.SetState(596) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(597) - p.Match(SQLiteParserCLOSE_PAR) - } - { - p.SetState(598) - p.Foreign_key_clause() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IForeign_key_clauseContext is an interface to support dynamic dispatch. -type IForeign_key_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - REFERENCES_() antlr.TerminalNode - Foreign_table() IForeign_tableContext - OPEN_PAR() antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - CLOSE_PAR() antlr.TerminalNode - AllON_() []antlr.TerminalNode - ON_(i int) antlr.TerminalNode - AllMATCH_() []antlr.TerminalNode - MATCH_(i int) antlr.TerminalNode - AllName() []INameContext - Name(i int) INameContext - DEFERRABLE_() antlr.TerminalNode - AllDELETE_() []antlr.TerminalNode - DELETE_(i int) antlr.TerminalNode - AllUPDATE_() []antlr.TerminalNode - UPDATE_(i int) antlr.TerminalNode - AllSET_() []antlr.TerminalNode - SET_(i int) antlr.TerminalNode - AllCASCADE_() []antlr.TerminalNode - CASCADE_(i int) antlr.TerminalNode - AllRESTRICT_() []antlr.TerminalNode - RESTRICT_(i int) antlr.TerminalNode - AllNO_() []antlr.TerminalNode - NO_(i int) antlr.TerminalNode - AllACTION_() []antlr.TerminalNode - ACTION_(i int) antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - AllNULL_() []antlr.TerminalNode - NULL_(i int) antlr.TerminalNode - AllDEFAULT_() []antlr.TerminalNode - DEFAULT_(i int) antlr.TerminalNode - NOT_() antlr.TerminalNode - INITIALLY_() antlr.TerminalNode - DEFERRED_() antlr.TerminalNode - IMMEDIATE_() antlr.TerminalNode - - // IsForeign_key_clauseContext differentiates from other interfaces. - IsForeign_key_clauseContext() -} - -type Foreign_key_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyForeign_key_clauseContext() *Foreign_key_clauseContext { - var p = new(Foreign_key_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_foreign_key_clause - return p -} - -func (*Foreign_key_clauseContext) IsForeign_key_clauseContext() {} - -func NewForeign_key_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Foreign_key_clauseContext { - var p = new(Foreign_key_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_foreign_key_clause - - return p -} - -func (s *Foreign_key_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *Foreign_key_clauseContext) REFERENCES_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREFERENCES_, 0) -} - -func (s *Foreign_key_clauseContext) Foreign_table() IForeign_tableContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IForeign_tableContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IForeign_tableContext) -} - -func (s *Foreign_key_clauseContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Foreign_key_clauseContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Foreign_key_clauseContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Foreign_key_clauseContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Foreign_key_clauseContext) AllON_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserON_) -} - -func (s *Foreign_key_clauseContext) ON_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserON_, i) -} - -func (s *Foreign_key_clauseContext) AllMATCH_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserMATCH_) -} - -func (s *Foreign_key_clauseContext) MATCH_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserMATCH_, i) -} - -func (s *Foreign_key_clauseContext) AllName() []INameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(INameContext); ok { - len++ - } - } - - tst := make([]INameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(INameContext); ok { - tst[i] = t.(INameContext) - i++ - } - } - - return tst -} - -func (s *Foreign_key_clauseContext) Name(i int) INameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(INameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(INameContext) -} - -func (s *Foreign_key_clauseContext) DEFERRABLE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFERRABLE_, 0) -} - -func (s *Foreign_key_clauseContext) AllDELETE_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserDELETE_) -} - -func (s *Foreign_key_clauseContext) DELETE_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserDELETE_, i) -} - -func (s *Foreign_key_clauseContext) AllUPDATE_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserUPDATE_) -} - -func (s *Foreign_key_clauseContext) UPDATE_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserUPDATE_, i) -} - -func (s *Foreign_key_clauseContext) AllSET_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserSET_) -} - -func (s *Foreign_key_clauseContext) SET_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserSET_, i) -} - -func (s *Foreign_key_clauseContext) AllCASCADE_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCASCADE_) -} - -func (s *Foreign_key_clauseContext) CASCADE_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCASCADE_, i) -} - -func (s *Foreign_key_clauseContext) AllRESTRICT_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserRESTRICT_) -} - -func (s *Foreign_key_clauseContext) RESTRICT_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserRESTRICT_, i) -} - -func (s *Foreign_key_clauseContext) AllNO_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserNO_) -} - -func (s *Foreign_key_clauseContext) NO_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserNO_, i) -} - -func (s *Foreign_key_clauseContext) AllACTION_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserACTION_) -} - -func (s *Foreign_key_clauseContext) ACTION_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserACTION_, i) -} - -func (s *Foreign_key_clauseContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Foreign_key_clauseContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Foreign_key_clauseContext) AllNULL_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserNULL_) -} - -func (s *Foreign_key_clauseContext) NULL_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserNULL_, i) -} - -func (s *Foreign_key_clauseContext) AllDEFAULT_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserDEFAULT_) -} - -func (s *Foreign_key_clauseContext) DEFAULT_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFAULT_, i) -} - -func (s *Foreign_key_clauseContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Foreign_key_clauseContext) INITIALLY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINITIALLY_, 0) -} - -func (s *Foreign_key_clauseContext) DEFERRED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFERRED_, 0) -} - -func (s *Foreign_key_clauseContext) IMMEDIATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIMMEDIATE_, 0) -} - -func (s *Foreign_key_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Foreign_key_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Foreign_key_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterForeign_key_clause(s) - } -} - -func (s *Foreign_key_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitForeign_key_clause(s) - } -} - -func (p *SQLiteParser) Foreign_key_clause() (localctx IForeign_key_clauseContext) { - this := p - _ = this - - localctx = NewForeign_key_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 40, SQLiteParserRULE_foreign_key_clause) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(602) - p.Match(SQLiteParserREFERENCES_) - } - { - p.SetState(603) - p.Foreign_table() - } - p.SetState(615) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOPEN_PAR { - { - p.SetState(604) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(605) - p.Column_name() - } - p.SetState(610) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(606) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(607) - p.Column_name() - } - - p.SetState(612) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(613) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - p.SetState(631) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserMATCH_ || _la == SQLiteParserON_ { - p.SetState(629) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserON_: - { - p.SetState(617) - p.Match(SQLiteParserON_) - } - { - p.SetState(618) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserDELETE_ || _la == SQLiteParserUPDATE_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - p.SetState(625) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserSET_: - { - p.SetState(619) - p.Match(SQLiteParserSET_) - } - { - p.SetState(620) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserDEFAULT_ || _la == SQLiteParserNULL_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - case SQLiteParserCASCADE_: - { - p.SetState(621) - p.Match(SQLiteParserCASCADE_) - } - - case SQLiteParserRESTRICT_: - { - p.SetState(622) - p.Match(SQLiteParserRESTRICT_) - } - - case SQLiteParserNO_: - { - p.SetState(623) - p.Match(SQLiteParserNO_) - } - { - p.SetState(624) - p.Match(SQLiteParserACTION_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - case SQLiteParserMATCH_: - { - p.SetState(627) - p.Match(SQLiteParserMATCH_) - } - { - p.SetState(628) - p.Name() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - p.SetState(633) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - p.SetState(642) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 70, p.GetParserRuleContext()) == 1 { - p.SetState(635) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserNOT_ { - { - p.SetState(634) - p.Match(SQLiteParserNOT_) - } - - } - { - p.SetState(637) - p.Match(SQLiteParserDEFERRABLE_) - } - p.SetState(640) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserINITIALLY_ { - { - p.SetState(638) - p.Match(SQLiteParserINITIALLY_) - } - { - p.SetState(639) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserDEFERRED_ || _la == SQLiteParserIMMEDIATE_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - - } - - return localctx -} - -// IConflict_clauseContext is an interface to support dynamic dispatch. -type IConflict_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ON_() antlr.TerminalNode - CONFLICT_() antlr.TerminalNode - ROLLBACK_() antlr.TerminalNode - ABORT_() antlr.TerminalNode - FAIL_() antlr.TerminalNode - IGNORE_() antlr.TerminalNode - REPLACE_() antlr.TerminalNode - - // IsConflict_clauseContext differentiates from other interfaces. - IsConflict_clauseContext() -} - -type Conflict_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyConflict_clauseContext() *Conflict_clauseContext { - var p = new(Conflict_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_conflict_clause - return p -} - -func (*Conflict_clauseContext) IsConflict_clauseContext() {} - -func NewConflict_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Conflict_clauseContext { - var p = new(Conflict_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_conflict_clause - - return p -} - -func (s *Conflict_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *Conflict_clauseContext) ON_() antlr.TerminalNode { - return s.GetToken(SQLiteParserON_, 0) -} - -func (s *Conflict_clauseContext) CONFLICT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCONFLICT_, 0) -} - -func (s *Conflict_clauseContext) ROLLBACK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROLLBACK_, 0) -} - -func (s *Conflict_clauseContext) ABORT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserABORT_, 0) -} - -func (s *Conflict_clauseContext) FAIL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFAIL_, 0) -} - -func (s *Conflict_clauseContext) IGNORE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIGNORE_, 0) -} - -func (s *Conflict_clauseContext) REPLACE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREPLACE_, 0) -} - -func (s *Conflict_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Conflict_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Conflict_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterConflict_clause(s) - } -} - -func (s *Conflict_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitConflict_clause(s) - } -} - -func (p *SQLiteParser) Conflict_clause() (localctx IConflict_clauseContext) { - this := p - _ = this - - localctx = NewConflict_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 42, SQLiteParserRULE_conflict_clause) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(644) - p.Match(SQLiteParserON_) - } - { - p.SetState(645) - p.Match(SQLiteParserCONFLICT_) - } - { - p.SetState(646) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserABORT_ || ((int64((_la-72)) & ^0x3f) == 0 && ((int64(1)<<(_la-72))&19140298416325121) != 0)) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - return localctx -} - -// ICreate_trigger_stmtContext is an interface to support dynamic dispatch. -type ICreate_trigger_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - CREATE_() antlr.TerminalNode - TRIGGER_() antlr.TerminalNode - Trigger_name() ITrigger_nameContext - ON_() antlr.TerminalNode - Table_name() ITable_nameContext - BEGIN_() antlr.TerminalNode - END_() antlr.TerminalNode - DELETE_() antlr.TerminalNode - INSERT_() antlr.TerminalNode - UPDATE_() antlr.TerminalNode - IF_() antlr.TerminalNode - NOT_() antlr.TerminalNode - EXISTS_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - BEFORE_() antlr.TerminalNode - AFTER_() antlr.TerminalNode - INSTEAD_() antlr.TerminalNode - AllOF_() []antlr.TerminalNode - OF_(i int) antlr.TerminalNode - FOR_() antlr.TerminalNode - EACH_() antlr.TerminalNode - ROW_() antlr.TerminalNode - WHEN_() antlr.TerminalNode - Expr() IExprContext - AllSCOL() []antlr.TerminalNode - SCOL(i int) antlr.TerminalNode - TEMP_() antlr.TerminalNode - TEMPORARY_() antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - AllUpdate_stmt() []IUpdate_stmtContext - Update_stmt(i int) IUpdate_stmtContext - AllInsert_stmt() []IInsert_stmtContext - Insert_stmt(i int) IInsert_stmtContext - AllDelete_stmt() []IDelete_stmtContext - Delete_stmt(i int) IDelete_stmtContext - AllSelect_stmt() []ISelect_stmtContext - Select_stmt(i int) ISelect_stmtContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsCreate_trigger_stmtContext differentiates from other interfaces. - IsCreate_trigger_stmtContext() -} - -type Create_trigger_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCreate_trigger_stmtContext() *Create_trigger_stmtContext { - var p = new(Create_trigger_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_create_trigger_stmt - return p -} - -func (*Create_trigger_stmtContext) IsCreate_trigger_stmtContext() {} - -func NewCreate_trigger_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_trigger_stmtContext { - var p = new(Create_trigger_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_create_trigger_stmt - - return p -} - -func (s *Create_trigger_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Create_trigger_stmtContext) CREATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCREATE_, 0) -} - -func (s *Create_trigger_stmtContext) TRIGGER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRIGGER_, 0) -} - -func (s *Create_trigger_stmtContext) Trigger_name() ITrigger_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITrigger_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITrigger_nameContext) -} - -func (s *Create_trigger_stmtContext) ON_() antlr.TerminalNode { - return s.GetToken(SQLiteParserON_, 0) -} - -func (s *Create_trigger_stmtContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Create_trigger_stmtContext) BEGIN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBEGIN_, 0) -} - -func (s *Create_trigger_stmtContext) END_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEND_, 0) -} - -func (s *Create_trigger_stmtContext) DELETE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDELETE_, 0) -} - -func (s *Create_trigger_stmtContext) INSERT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINSERT_, 0) -} - -func (s *Create_trigger_stmtContext) UPDATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUPDATE_, 0) -} - -func (s *Create_trigger_stmtContext) IF_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIF_, 0) -} - -func (s *Create_trigger_stmtContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Create_trigger_stmtContext) EXISTS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXISTS_, 0) -} - -func (s *Create_trigger_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Create_trigger_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Create_trigger_stmtContext) BEFORE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBEFORE_, 0) -} - -func (s *Create_trigger_stmtContext) AFTER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAFTER_, 0) -} - -func (s *Create_trigger_stmtContext) INSTEAD_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINSTEAD_, 0) -} - -func (s *Create_trigger_stmtContext) AllOF_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserOF_) -} - -func (s *Create_trigger_stmtContext) OF_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserOF_, i) -} - -func (s *Create_trigger_stmtContext) FOR_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFOR_, 0) -} - -func (s *Create_trigger_stmtContext) EACH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEACH_, 0) -} - -func (s *Create_trigger_stmtContext) ROW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROW_, 0) -} - -func (s *Create_trigger_stmtContext) WHEN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHEN_, 0) -} - -func (s *Create_trigger_stmtContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Create_trigger_stmtContext) AllSCOL() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserSCOL) -} - -func (s *Create_trigger_stmtContext) SCOL(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserSCOL, i) -} - -func (s *Create_trigger_stmtContext) TEMP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTEMP_, 0) -} - -func (s *Create_trigger_stmtContext) TEMPORARY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTEMPORARY_, 0) -} - -func (s *Create_trigger_stmtContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Create_trigger_stmtContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Create_trigger_stmtContext) AllUpdate_stmt() []IUpdate_stmtContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IUpdate_stmtContext); ok { - len++ - } - } - - tst := make([]IUpdate_stmtContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IUpdate_stmtContext); ok { - tst[i] = t.(IUpdate_stmtContext) - i++ - } - } - - return tst -} - -func (s *Create_trigger_stmtContext) Update_stmt(i int) IUpdate_stmtContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IUpdate_stmtContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IUpdate_stmtContext) -} - -func (s *Create_trigger_stmtContext) AllInsert_stmt() []IInsert_stmtContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IInsert_stmtContext); ok { - len++ - } - } - - tst := make([]IInsert_stmtContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IInsert_stmtContext); ok { - tst[i] = t.(IInsert_stmtContext) - i++ - } - } - - return tst -} - -func (s *Create_trigger_stmtContext) Insert_stmt(i int) IInsert_stmtContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IInsert_stmtContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IInsert_stmtContext) -} - -func (s *Create_trigger_stmtContext) AllDelete_stmt() []IDelete_stmtContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IDelete_stmtContext); ok { - len++ - } - } - - tst := make([]IDelete_stmtContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IDelete_stmtContext); ok { - tst[i] = t.(IDelete_stmtContext) - i++ - } - } - - return tst -} - -func (s *Create_trigger_stmtContext) Delete_stmt(i int) IDelete_stmtContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IDelete_stmtContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IDelete_stmtContext) -} - -func (s *Create_trigger_stmtContext) AllSelect_stmt() []ISelect_stmtContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ISelect_stmtContext); ok { - len++ - } - } - - tst := make([]ISelect_stmtContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ISelect_stmtContext); ok { - tst[i] = t.(ISelect_stmtContext) - i++ - } - } - - return tst -} - -func (s *Create_trigger_stmtContext) Select_stmt(i int) ISelect_stmtContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Create_trigger_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Create_trigger_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Create_trigger_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Create_trigger_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Create_trigger_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCreate_trigger_stmt(s) - } -} - -func (s *Create_trigger_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCreate_trigger_stmt(s) - } -} - -func (p *SQLiteParser) Create_trigger_stmt() (localctx ICreate_trigger_stmtContext) { - this := p - _ = this - - localctx = NewCreate_trigger_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 44, SQLiteParserRULE_create_trigger_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(648) - p.Match(SQLiteParserCREATE_) - } - p.SetState(650) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_ { - { - p.SetState(649) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - { - p.SetState(652) - p.Match(SQLiteParserTRIGGER_) - } - p.SetState(656) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 72, p.GetParserRuleContext()) == 1 { - { - p.SetState(653) - p.Match(SQLiteParserIF_) - } - { - p.SetState(654) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(655) - p.Match(SQLiteParserEXISTS_) - } - - } - p.SetState(661) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 73, p.GetParserRuleContext()) == 1 { - { - p.SetState(658) - p.Schema_name() - } - { - p.SetState(659) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(663) - p.Trigger_name() - } - p.SetState(668) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserBEFORE_: - { - p.SetState(664) - p.Match(SQLiteParserBEFORE_) - } - - case SQLiteParserAFTER_: - { - p.SetState(665) - p.Match(SQLiteParserAFTER_) - } - - case SQLiteParserINSTEAD_: - { - p.SetState(666) - p.Match(SQLiteParserINSTEAD_) - } - { - p.SetState(667) - p.Match(SQLiteParserOF_) - } - - case SQLiteParserDELETE_, SQLiteParserINSERT_, SQLiteParserUPDATE_: - - default: - } - p.SetState(684) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserDELETE_: - { - p.SetState(670) - p.Match(SQLiteParserDELETE_) - } - - case SQLiteParserINSERT_: - { - p.SetState(671) - p.Match(SQLiteParserINSERT_) - } - - case SQLiteParserUPDATE_: - { - p.SetState(672) - p.Match(SQLiteParserUPDATE_) - } - p.SetState(682) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOF_ { - { - p.SetState(673) - p.Match(SQLiteParserOF_) - } - { - p.SetState(674) - p.Column_name() - } - p.SetState(679) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(675) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(676) - p.Column_name() - } - - p.SetState(681) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - { - p.SetState(686) - p.Match(SQLiteParserON_) - } - { - p.SetState(687) - p.Table_name() - } - p.SetState(691) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserFOR_ { - { - p.SetState(688) - p.Match(SQLiteParserFOR_) - } - { - p.SetState(689) - p.Match(SQLiteParserEACH_) - } - { - p.SetState(690) - p.Match(SQLiteParserROW_) - } - - } - p.SetState(695) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHEN_ { - { - p.SetState(693) - p.Match(SQLiteParserWHEN_) - } - { - p.SetState(694) - p.expr(0) - } - - } - { - p.SetState(697) - p.Match(SQLiteParserBEGIN_) - } - p.SetState(706) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for ok := true; ok; ok = _la == SQLiteParserDEFAULT_ || _la == SQLiteParserDELETE_ || ((int64((_la-88)) & ^0x3f) == 0 && ((int64(1)<<(_la-88))&4773820020239106049) != 0) { - p.SetState(702) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 80, p.GetParserRuleContext()) { - case 1: - { - p.SetState(698) - p.Update_stmt() - } - - case 2: - { - p.SetState(699) - p.Insert_stmt() - } - - case 3: - { - p.SetState(700) - p.Delete_stmt() - } - - case 4: - { - p.SetState(701) - p.Select_stmt() - } - - } - { - p.SetState(704) - p.Match(SQLiteParserSCOL) - } - - p.SetState(708) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(710) - p.Match(SQLiteParserEND_) - } - - return localctx -} - -// ICreate_view_stmtContext is an interface to support dynamic dispatch. -type ICreate_view_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - CREATE_() antlr.TerminalNode - VIEW_() antlr.TerminalNode - View_name() IView_nameContext - AS_() antlr.TerminalNode - Select_stmt() ISelect_stmtContext - IF_() antlr.TerminalNode - NOT_() antlr.TerminalNode - EXISTS_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - CLOSE_PAR() antlr.TerminalNode - TEMP_() antlr.TerminalNode - TEMPORARY_() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsCreate_view_stmtContext differentiates from other interfaces. - IsCreate_view_stmtContext() -} - -type Create_view_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCreate_view_stmtContext() *Create_view_stmtContext { - var p = new(Create_view_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_create_view_stmt - return p -} - -func (*Create_view_stmtContext) IsCreate_view_stmtContext() {} - -func NewCreate_view_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_view_stmtContext { - var p = new(Create_view_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_create_view_stmt - - return p -} - -func (s *Create_view_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Create_view_stmtContext) CREATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCREATE_, 0) -} - -func (s *Create_view_stmtContext) VIEW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVIEW_, 0) -} - -func (s *Create_view_stmtContext) View_name() IView_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IView_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IView_nameContext) -} - -func (s *Create_view_stmtContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Create_view_stmtContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Create_view_stmtContext) IF_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIF_, 0) -} - -func (s *Create_view_stmtContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Create_view_stmtContext) EXISTS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXISTS_, 0) -} - -func (s *Create_view_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Create_view_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Create_view_stmtContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Create_view_stmtContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Create_view_stmtContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Create_view_stmtContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Create_view_stmtContext) TEMP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTEMP_, 0) -} - -func (s *Create_view_stmtContext) TEMPORARY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTEMPORARY_, 0) -} - -func (s *Create_view_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Create_view_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Create_view_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Create_view_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Create_view_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCreate_view_stmt(s) - } -} - -func (s *Create_view_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCreate_view_stmt(s) - } -} - -func (p *SQLiteParser) Create_view_stmt() (localctx ICreate_view_stmtContext) { - this := p - _ = this - - localctx = NewCreate_view_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 46, SQLiteParserRULE_create_view_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(712) - p.Match(SQLiteParserCREATE_) - } - p.SetState(714) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_ { - { - p.SetState(713) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserTEMP_ || _la == SQLiteParserTEMPORARY_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - { - p.SetState(716) - p.Match(SQLiteParserVIEW_) - } - p.SetState(720) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 83, p.GetParserRuleContext()) == 1 { - { - p.SetState(717) - p.Match(SQLiteParserIF_) - } - { - p.SetState(718) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(719) - p.Match(SQLiteParserEXISTS_) - } - - } - p.SetState(725) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 84, p.GetParserRuleContext()) == 1 { - { - p.SetState(722) - p.Schema_name() - } - { - p.SetState(723) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(727) - p.View_name() - } - p.SetState(739) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOPEN_PAR { - { - p.SetState(728) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(729) - p.Column_name() - } - p.SetState(734) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(730) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(731) - p.Column_name() - } - - p.SetState(736) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(737) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - { - p.SetState(741) - p.Match(SQLiteParserAS_) - } - { - p.SetState(742) - p.Select_stmt() - } - - return localctx -} - -// ICreate_virtual_table_stmtContext is an interface to support dynamic dispatch. -type ICreate_virtual_table_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - CREATE_() antlr.TerminalNode - VIRTUAL_() antlr.TerminalNode - TABLE_() antlr.TerminalNode - Table_name() ITable_nameContext - USING_() antlr.TerminalNode - Module_name() IModule_nameContext - IF_() antlr.TerminalNode - NOT_() antlr.TerminalNode - EXISTS_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - AllModule_argument() []IModule_argumentContext - Module_argument(i int) IModule_argumentContext - CLOSE_PAR() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsCreate_virtual_table_stmtContext differentiates from other interfaces. - IsCreate_virtual_table_stmtContext() -} - -type Create_virtual_table_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCreate_virtual_table_stmtContext() *Create_virtual_table_stmtContext { - var p = new(Create_virtual_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_create_virtual_table_stmt - return p -} - -func (*Create_virtual_table_stmtContext) IsCreate_virtual_table_stmtContext() {} - -func NewCreate_virtual_table_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_virtual_table_stmtContext { - var p = new(Create_virtual_table_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_create_virtual_table_stmt - - return p -} - -func (s *Create_virtual_table_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Create_virtual_table_stmtContext) CREATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCREATE_, 0) -} - -func (s *Create_virtual_table_stmtContext) VIRTUAL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVIRTUAL_, 0) -} - -func (s *Create_virtual_table_stmtContext) TABLE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTABLE_, 0) -} - -func (s *Create_virtual_table_stmtContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Create_virtual_table_stmtContext) USING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUSING_, 0) -} - -func (s *Create_virtual_table_stmtContext) Module_name() IModule_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IModule_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IModule_nameContext) -} - -func (s *Create_virtual_table_stmtContext) IF_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIF_, 0) -} - -func (s *Create_virtual_table_stmtContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Create_virtual_table_stmtContext) EXISTS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXISTS_, 0) -} - -func (s *Create_virtual_table_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Create_virtual_table_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Create_virtual_table_stmtContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Create_virtual_table_stmtContext) AllModule_argument() []IModule_argumentContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IModule_argumentContext); ok { - len++ - } - } - - tst := make([]IModule_argumentContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IModule_argumentContext); ok { - tst[i] = t.(IModule_argumentContext) - i++ - } - } - - return tst -} - -func (s *Create_virtual_table_stmtContext) Module_argument(i int) IModule_argumentContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IModule_argumentContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IModule_argumentContext) -} - -func (s *Create_virtual_table_stmtContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Create_virtual_table_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Create_virtual_table_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Create_virtual_table_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Create_virtual_table_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Create_virtual_table_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCreate_virtual_table_stmt(s) - } -} - -func (s *Create_virtual_table_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCreate_virtual_table_stmt(s) - } -} - -func (p *SQLiteParser) Create_virtual_table_stmt() (localctx ICreate_virtual_table_stmtContext) { - this := p - _ = this - - localctx = NewCreate_virtual_table_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 48, SQLiteParserRULE_create_virtual_table_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(744) - p.Match(SQLiteParserCREATE_) - } - { - p.SetState(745) - p.Match(SQLiteParserVIRTUAL_) - } - { - p.SetState(746) - p.Match(SQLiteParserTABLE_) - } - p.SetState(750) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 87, p.GetParserRuleContext()) == 1 { - { - p.SetState(747) - p.Match(SQLiteParserIF_) - } - { - p.SetState(748) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(749) - p.Match(SQLiteParserEXISTS_) - } - - } - p.SetState(755) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 88, p.GetParserRuleContext()) == 1 { - { - p.SetState(752) - p.Schema_name() - } - { - p.SetState(753) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(757) - p.Table_name() - } - { - p.SetState(758) - p.Match(SQLiteParserUSING_) - } - { - p.SetState(759) - p.Module_name() - } - p.SetState(771) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOPEN_PAR { - { - p.SetState(760) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(761) - p.Module_argument() - } - p.SetState(766) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(762) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(763) - p.Module_argument() - } - - p.SetState(768) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(769) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - - return localctx -} - -// IWith_clauseContext is an interface to support dynamic dispatch. -type IWith_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - WITH_() antlr.TerminalNode - AllCte_table_name() []ICte_table_nameContext - Cte_table_name(i int) ICte_table_nameContext - AllAS_() []antlr.TerminalNode - AS_(i int) antlr.TerminalNode - AllOPEN_PAR() []antlr.TerminalNode - OPEN_PAR(i int) antlr.TerminalNode - AllSelect_stmt() []ISelect_stmtContext - Select_stmt(i int) ISelect_stmtContext - AllCLOSE_PAR() []antlr.TerminalNode - CLOSE_PAR(i int) antlr.TerminalNode - RECURSIVE_() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsWith_clauseContext differentiates from other interfaces. - IsWith_clauseContext() -} - -type With_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyWith_clauseContext() *With_clauseContext { - var p = new(With_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_with_clause - return p -} - -func (*With_clauseContext) IsWith_clauseContext() {} - -func NewWith_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *With_clauseContext { - var p = new(With_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_with_clause - - return p -} - -func (s *With_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *With_clauseContext) WITH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWITH_, 0) -} - -func (s *With_clauseContext) AllCte_table_name() []ICte_table_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ICte_table_nameContext); ok { - len++ - } - } - - tst := make([]ICte_table_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ICte_table_nameContext); ok { - tst[i] = t.(ICte_table_nameContext) - i++ - } - } - - return tst -} - -func (s *With_clauseContext) Cte_table_name(i int) ICte_table_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICte_table_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ICte_table_nameContext) -} - -func (s *With_clauseContext) AllAS_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserAS_) -} - -func (s *With_clauseContext) AS_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, i) -} - -func (s *With_clauseContext) AllOPEN_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserOPEN_PAR) -} - -func (s *With_clauseContext) OPEN_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, i) -} - -func (s *With_clauseContext) AllSelect_stmt() []ISelect_stmtContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ISelect_stmtContext); ok { - len++ - } - } - - tst := make([]ISelect_stmtContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ISelect_stmtContext); ok { - tst[i] = t.(ISelect_stmtContext) - i++ - } - } - - return tst -} - -func (s *With_clauseContext) Select_stmt(i int) ISelect_stmtContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *With_clauseContext) AllCLOSE_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCLOSE_PAR) -} - -func (s *With_clauseContext) CLOSE_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, i) -} - -func (s *With_clauseContext) RECURSIVE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRECURSIVE_, 0) -} - -func (s *With_clauseContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *With_clauseContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *With_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *With_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *With_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterWith_clause(s) - } -} - -func (s *With_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitWith_clause(s) - } -} - -func (p *SQLiteParser) With_clause() (localctx IWith_clauseContext) { - this := p - _ = this - - localctx = NewWith_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 50, SQLiteParserRULE_with_clause) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(773) - p.Match(SQLiteParserWITH_) - } - p.SetState(775) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 91, p.GetParserRuleContext()) == 1 { - { - p.SetState(774) - p.Match(SQLiteParserRECURSIVE_) - } - - } - { - p.SetState(777) - p.Cte_table_name() - } - { - p.SetState(778) - p.Match(SQLiteParserAS_) - } - { - p.SetState(779) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(780) - p.Select_stmt() - } - { - p.SetState(781) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(791) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(782) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(783) - p.Cte_table_name() - } - { - p.SetState(784) - p.Match(SQLiteParserAS_) - } - { - p.SetState(785) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(786) - p.Select_stmt() - } - { - p.SetState(787) - p.Match(SQLiteParserCLOSE_PAR) - } - - p.SetState(793) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - return localctx -} - -// ICte_table_nameContext is an interface to support dynamic dispatch. -type ICte_table_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Table_name() ITable_nameContext - OPEN_PAR() antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - CLOSE_PAR() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsCte_table_nameContext differentiates from other interfaces. - IsCte_table_nameContext() -} - -type Cte_table_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCte_table_nameContext() *Cte_table_nameContext { - var p = new(Cte_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_cte_table_name - return p -} - -func (*Cte_table_nameContext) IsCte_table_nameContext() {} - -func NewCte_table_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cte_table_nameContext { - var p = new(Cte_table_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_cte_table_name - - return p -} - -func (s *Cte_table_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Cte_table_nameContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Cte_table_nameContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Cte_table_nameContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Cte_table_nameContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Cte_table_nameContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Cte_table_nameContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Cte_table_nameContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Cte_table_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Cte_table_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Cte_table_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCte_table_name(s) - } -} - -func (s *Cte_table_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCte_table_name(s) - } -} - -func (p *SQLiteParser) Cte_table_name() (localctx ICte_table_nameContext) { - this := p - _ = this - - localctx = NewCte_table_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 52, SQLiteParserRULE_cte_table_name) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(794) - p.Table_name() - } - p.SetState(806) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOPEN_PAR { - { - p.SetState(795) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(796) - p.Column_name() - } - p.SetState(801) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(797) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(798) - p.Column_name() - } - - p.SetState(803) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(804) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - - return localctx -} - -// IRecursive_cteContext is an interface to support dynamic dispatch. -type IRecursive_cteContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Cte_table_name() ICte_table_nameContext - AS_() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - Initial_select() IInitial_selectContext - UNION_() antlr.TerminalNode - Recursive__select() IRecursive__selectContext - CLOSE_PAR() antlr.TerminalNode - ALL_() antlr.TerminalNode - - // IsRecursive_cteContext differentiates from other interfaces. - IsRecursive_cteContext() -} - -type Recursive_cteContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyRecursive_cteContext() *Recursive_cteContext { - var p = new(Recursive_cteContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_recursive_cte - return p -} - -func (*Recursive_cteContext) IsRecursive_cteContext() {} - -func NewRecursive_cteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Recursive_cteContext { - var p = new(Recursive_cteContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_recursive_cte - - return p -} - -func (s *Recursive_cteContext) GetParser() antlr.Parser { return s.parser } - -func (s *Recursive_cteContext) Cte_table_name() ICte_table_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICte_table_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICte_table_nameContext) -} - -func (s *Recursive_cteContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Recursive_cteContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Recursive_cteContext) Initial_select() IInitial_selectContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IInitial_selectContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IInitial_selectContext) -} - -func (s *Recursive_cteContext) UNION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNION_, 0) -} - -func (s *Recursive_cteContext) Recursive__select() IRecursive__selectContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IRecursive__selectContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IRecursive__selectContext) -} - -func (s *Recursive_cteContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Recursive_cteContext) ALL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserALL_, 0) -} - -func (s *Recursive_cteContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Recursive_cteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Recursive_cteContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterRecursive_cte(s) - } -} - -func (s *Recursive_cteContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitRecursive_cte(s) - } -} - -func (p *SQLiteParser) Recursive_cte() (localctx IRecursive_cteContext) { - this := p - _ = this - - localctx = NewRecursive_cteContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 54, SQLiteParserRULE_recursive_cte) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(808) - p.Cte_table_name() - } - { - p.SetState(809) - p.Match(SQLiteParserAS_) - } - { - p.SetState(810) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(811) - p.Initial_select() - } - { - p.SetState(812) - p.Match(SQLiteParserUNION_) - } - p.SetState(814) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserALL_ { - { - p.SetState(813) - p.Match(SQLiteParserALL_) - } - - } - { - p.SetState(816) - p.Recursive__select() - } - { - p.SetState(817) - p.Match(SQLiteParserCLOSE_PAR) - } - - return localctx -} - -// ICommon_table_expressionContext is an interface to support dynamic dispatch. -type ICommon_table_expressionContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Table_name() ITable_nameContext - AS_() antlr.TerminalNode - AllOPEN_PAR() []antlr.TerminalNode - OPEN_PAR(i int) antlr.TerminalNode - Select_stmt() ISelect_stmtContext - AllCLOSE_PAR() []antlr.TerminalNode - CLOSE_PAR(i int) antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsCommon_table_expressionContext differentiates from other interfaces. - IsCommon_table_expressionContext() -} - -type Common_table_expressionContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCommon_table_expressionContext() *Common_table_expressionContext { - var p = new(Common_table_expressionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_common_table_expression - return p -} - -func (*Common_table_expressionContext) IsCommon_table_expressionContext() {} - -func NewCommon_table_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Common_table_expressionContext { - var p = new(Common_table_expressionContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_common_table_expression - - return p -} - -func (s *Common_table_expressionContext) GetParser() antlr.Parser { return s.parser } - -func (s *Common_table_expressionContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Common_table_expressionContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Common_table_expressionContext) AllOPEN_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserOPEN_PAR) -} - -func (s *Common_table_expressionContext) OPEN_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, i) -} - -func (s *Common_table_expressionContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Common_table_expressionContext) AllCLOSE_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCLOSE_PAR) -} - -func (s *Common_table_expressionContext) CLOSE_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, i) -} - -func (s *Common_table_expressionContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Common_table_expressionContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Common_table_expressionContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Common_table_expressionContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Common_table_expressionContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Common_table_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Common_table_expressionContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCommon_table_expression(s) - } -} - -func (s *Common_table_expressionContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCommon_table_expression(s) - } -} - -func (p *SQLiteParser) Common_table_expression() (localctx ICommon_table_expressionContext) { - this := p - _ = this - - localctx = NewCommon_table_expressionContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 56, SQLiteParserRULE_common_table_expression) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(819) - p.Table_name() - } - p.SetState(831) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOPEN_PAR { - { - p.SetState(820) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(821) - p.Column_name() - } - p.SetState(826) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(822) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(823) - p.Column_name() - } - - p.SetState(828) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(829) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - { - p.SetState(833) - p.Match(SQLiteParserAS_) - } - { - p.SetState(834) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(835) - p.Select_stmt() - } - { - p.SetState(836) - p.Match(SQLiteParserCLOSE_PAR) - } - - return localctx -} - -// IReturning_clauseContext is an interface to support dynamic dispatch. -type IReturning_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - RETURNING_() antlr.TerminalNode - AllSTAR() []antlr.TerminalNode - STAR(i int) antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - AllColumn_alias() []IColumn_aliasContext - Column_alias(i int) IColumn_aliasContext - AllAS_() []antlr.TerminalNode - AS_(i int) antlr.TerminalNode - - // IsReturning_clauseContext differentiates from other interfaces. - IsReturning_clauseContext() -} - -type Returning_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyReturning_clauseContext() *Returning_clauseContext { - var p = new(Returning_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_returning_clause - return p -} - -func (*Returning_clauseContext) IsReturning_clauseContext() {} - -func NewReturning_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Returning_clauseContext { - var p = new(Returning_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_returning_clause - - return p -} - -func (s *Returning_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *Returning_clauseContext) RETURNING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRETURNING_, 0) -} - -func (s *Returning_clauseContext) AllSTAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserSTAR) -} - -func (s *Returning_clauseContext) STAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserSTAR, i) -} - -func (s *Returning_clauseContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Returning_clauseContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Returning_clauseContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Returning_clauseContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Returning_clauseContext) AllColumn_alias() []IColumn_aliasContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_aliasContext); ok { - len++ - } - } - - tst := make([]IColumn_aliasContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_aliasContext); ok { - tst[i] = t.(IColumn_aliasContext) - i++ - } - } - - return tst -} - -func (s *Returning_clauseContext) Column_alias(i int) IColumn_aliasContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_aliasContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_aliasContext) -} - -func (s *Returning_clauseContext) AllAS_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserAS_) -} - -func (s *Returning_clauseContext) AS_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, i) -} - -func (s *Returning_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Returning_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Returning_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterReturning_clause(s) - } -} - -func (s *Returning_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitReturning_clause(s) - } -} - -func (p *SQLiteParser) Returning_clause() (localctx IReturning_clauseContext) { - this := p - _ = this - - localctx = NewReturning_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 58, SQLiteParserRULE_returning_clause) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(838) - p.Match(SQLiteParserRETURNING_) - } - - p.SetState(847) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserSTAR: - { - p.SetState(839) - p.Match(SQLiteParserSTAR) - } - - case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: - { - p.SetState(840) - p.expr(0) - } - p.SetState(845) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(842) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ { - { - p.SetState(841) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(844) - p.Column_alias() - } - - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - p.SetState(862) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(849) - p.Match(SQLiteParserCOMMA) - } - p.SetState(858) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserSTAR: - { - p.SetState(850) - p.Match(SQLiteParserSTAR) - } - - case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: - { - p.SetState(851) - p.expr(0) - } - p.SetState(856) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(853) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ { - { - p.SetState(852) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(855) - p.Column_alias() - } - - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - p.SetState(864) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - return localctx -} - -// IDelete_stmtContext is an interface to support dynamic dispatch. -type IDelete_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - DELETE_() antlr.TerminalNode - FROM_() antlr.TerminalNode - Qualified_table_name() IQualified_table_nameContext - With_clause() IWith_clauseContext - WHERE_() antlr.TerminalNode - Expr() IExprContext - Returning_clause() IReturning_clauseContext - - // IsDelete_stmtContext differentiates from other interfaces. - IsDelete_stmtContext() -} - -type Delete_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyDelete_stmtContext() *Delete_stmtContext { - var p = new(Delete_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_delete_stmt - return p -} - -func (*Delete_stmtContext) IsDelete_stmtContext() {} - -func NewDelete_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Delete_stmtContext { - var p = new(Delete_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_delete_stmt - - return p -} - -func (s *Delete_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Delete_stmtContext) DELETE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDELETE_, 0) -} - -func (s *Delete_stmtContext) FROM_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFROM_, 0) -} - -func (s *Delete_stmtContext) Qualified_table_name() IQualified_table_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IQualified_table_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IQualified_table_nameContext) -} - -func (s *Delete_stmtContext) With_clause() IWith_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWith_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWith_clauseContext) -} - -func (s *Delete_stmtContext) WHERE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, 0) -} - -func (s *Delete_stmtContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Delete_stmtContext) Returning_clause() IReturning_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IReturning_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IReturning_clauseContext) -} - -func (s *Delete_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Delete_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Delete_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterDelete_stmt(s) - } -} - -func (s *Delete_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitDelete_stmt(s) - } -} - -func (p *SQLiteParser) Delete_stmt() (localctx IDelete_stmtContext) { - this := p - _ = this - - localctx = NewDelete_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 60, SQLiteParserRULE_delete_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(866) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(865) - p.With_clause() - } - - } - { - p.SetState(868) - p.Match(SQLiteParserDELETE_) - } - { - p.SetState(869) - p.Match(SQLiteParserFROM_) - } - { - p.SetState(870) - p.Qualified_table_name() - } - p.SetState(873) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHERE_ { - { - p.SetState(871) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(872) - p.expr(0) - } - - } - p.SetState(876) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserRETURNING_ { - { - p.SetState(875) - p.Returning_clause() - } - - } - - return localctx -} - -// IDelete_stmt_limitedContext is an interface to support dynamic dispatch. -type IDelete_stmt_limitedContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - DELETE_() antlr.TerminalNode - FROM_() antlr.TerminalNode - Qualified_table_name() IQualified_table_nameContext - With_clause() IWith_clauseContext - WHERE_() antlr.TerminalNode - Expr() IExprContext - Limit_stmt() ILimit_stmtContext - Returning_clause() IReturning_clauseContext - Order_by_stmt() IOrder_by_stmtContext - - // IsDelete_stmt_limitedContext differentiates from other interfaces. - IsDelete_stmt_limitedContext() -} - -type Delete_stmt_limitedContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyDelete_stmt_limitedContext() *Delete_stmt_limitedContext { - var p = new(Delete_stmt_limitedContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_delete_stmt_limited - return p -} - -func (*Delete_stmt_limitedContext) IsDelete_stmt_limitedContext() {} - -func NewDelete_stmt_limitedContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Delete_stmt_limitedContext { - var p = new(Delete_stmt_limitedContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_delete_stmt_limited - - return p -} - -func (s *Delete_stmt_limitedContext) GetParser() antlr.Parser { return s.parser } - -func (s *Delete_stmt_limitedContext) DELETE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDELETE_, 0) -} - -func (s *Delete_stmt_limitedContext) FROM_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFROM_, 0) -} - -func (s *Delete_stmt_limitedContext) Qualified_table_name() IQualified_table_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IQualified_table_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IQualified_table_nameContext) -} - -func (s *Delete_stmt_limitedContext) With_clause() IWith_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWith_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWith_clauseContext) -} - -func (s *Delete_stmt_limitedContext) WHERE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, 0) -} - -func (s *Delete_stmt_limitedContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Delete_stmt_limitedContext) Limit_stmt() ILimit_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ILimit_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ILimit_stmtContext) -} - -func (s *Delete_stmt_limitedContext) Returning_clause() IReturning_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IReturning_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IReturning_clauseContext) -} - -func (s *Delete_stmt_limitedContext) Order_by_stmt() IOrder_by_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrder_by_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOrder_by_stmtContext) -} - -func (s *Delete_stmt_limitedContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Delete_stmt_limitedContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Delete_stmt_limitedContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterDelete_stmt_limited(s) - } -} - -func (s *Delete_stmt_limitedContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitDelete_stmt_limited(s) - } -} - -func (p *SQLiteParser) Delete_stmt_limited() (localctx IDelete_stmt_limitedContext) { - this := p - _ = this - - localctx = NewDelete_stmt_limitedContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 62, SQLiteParserRULE_delete_stmt_limited) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(879) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(878) - p.With_clause() - } - - } - { - p.SetState(881) - p.Match(SQLiteParserDELETE_) - } - { - p.SetState(882) - p.Match(SQLiteParserFROM_) - } - { - p.SetState(883) - p.Qualified_table_name() - } - p.SetState(886) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHERE_ { - { - p.SetState(884) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(885) - p.expr(0) - } - - } - p.SetState(892) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserLIMIT_ || _la == SQLiteParserORDER_ { - p.SetState(889) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserORDER_ { - { - p.SetState(888) - p.Order_by_stmt() - } - - } - { - p.SetState(891) - p.Limit_stmt() - } - - } - p.SetState(895) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserRETURNING_ { - { - p.SetState(894) - p.Returning_clause() - } - - } - - return localctx -} - -// IDetach_stmtContext is an interface to support dynamic dispatch. -type IDetach_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - DETACH_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DATABASE_() antlr.TerminalNode - - // IsDetach_stmtContext differentiates from other interfaces. - IsDetach_stmtContext() -} - -type Detach_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyDetach_stmtContext() *Detach_stmtContext { - var p = new(Detach_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_detach_stmt - return p -} - -func (*Detach_stmtContext) IsDetach_stmtContext() {} - -func NewDetach_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Detach_stmtContext { - var p = new(Detach_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_detach_stmt - - return p -} - -func (s *Detach_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Detach_stmtContext) DETACH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDETACH_, 0) -} - -func (s *Detach_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Detach_stmtContext) DATABASE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDATABASE_, 0) -} - -func (s *Detach_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Detach_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Detach_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterDetach_stmt(s) - } -} - -func (s *Detach_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitDetach_stmt(s) - } -} - -func (p *SQLiteParser) Detach_stmt() (localctx IDetach_stmtContext) { - this := p - _ = this - - localctx = NewDetach_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 64, SQLiteParserRULE_detach_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(897) - p.Match(SQLiteParserDETACH_) - } - p.SetState(899) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 113, p.GetParserRuleContext()) == 1 { - { - p.SetState(898) - p.Match(SQLiteParserDATABASE_) - } - - } - { - p.SetState(901) - p.Schema_name() - } - - return localctx -} - -// IDrop_stmtContext is an interface to support dynamic dispatch. -type IDrop_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // GetObject returns the object token. - GetObject() antlr.Token - - // SetObject sets the object token. - SetObject(antlr.Token) - - // Getter signatures - DROP_() antlr.TerminalNode - Any_name() IAny_nameContext - INDEX_() antlr.TerminalNode - TABLE_() antlr.TerminalNode - TRIGGER_() antlr.TerminalNode - VIEW_() antlr.TerminalNode - IF_() antlr.TerminalNode - EXISTS_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - - // IsDrop_stmtContext differentiates from other interfaces. - IsDrop_stmtContext() -} - -type Drop_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser - object antlr.Token -} - -func NewEmptyDrop_stmtContext() *Drop_stmtContext { - var p = new(Drop_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_drop_stmt - return p -} - -func (*Drop_stmtContext) IsDrop_stmtContext() {} - -func NewDrop_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Drop_stmtContext { - var p = new(Drop_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_drop_stmt - - return p -} - -func (s *Drop_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Drop_stmtContext) GetObject() antlr.Token { return s.object } - -func (s *Drop_stmtContext) SetObject(v antlr.Token) { s.object = v } - -func (s *Drop_stmtContext) DROP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDROP_, 0) -} - -func (s *Drop_stmtContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Drop_stmtContext) INDEX_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINDEX_, 0) -} - -func (s *Drop_stmtContext) TABLE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTABLE_, 0) -} - -func (s *Drop_stmtContext) TRIGGER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRIGGER_, 0) -} - -func (s *Drop_stmtContext) VIEW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVIEW_, 0) -} - -func (s *Drop_stmtContext) IF_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIF_, 0) -} - -func (s *Drop_stmtContext) EXISTS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXISTS_, 0) -} - -func (s *Drop_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Drop_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Drop_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Drop_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Drop_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterDrop_stmt(s) - } -} - -func (s *Drop_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitDrop_stmt(s) - } -} - -func (p *SQLiteParser) Drop_stmt() (localctx IDrop_stmtContext) { - this := p - _ = this - - localctx = NewDrop_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 66, SQLiteParserRULE_drop_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(903) - p.Match(SQLiteParserDROP_) - } - { - p.SetState(904) - - var _lt = p.GetTokenStream().LT(1) - - localctx.(*Drop_stmtContext).object = _lt - - _la = p.GetTokenStream().LA(1) - - if !((int64((_la-84)) & ^0x3f) == 0 && ((int64(1)<<(_la-84))&4648277765399773185) != 0) { - var _ri = p.GetErrorHandler().RecoverInline(p) - - localctx.(*Drop_stmtContext).object = _ri - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - p.SetState(907) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 114, p.GetParserRuleContext()) == 1 { - { - p.SetState(905) - p.Match(SQLiteParserIF_) - } - { - p.SetState(906) - p.Match(SQLiteParserEXISTS_) - } - - } - p.SetState(912) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 115, p.GetParserRuleContext()) == 1 { - { - p.SetState(909) - p.Schema_name() - } - { - p.SetState(910) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(914) - p.Any_name() - } - - return localctx -} - -// IExprContext is an interface to support dynamic dispatch. -type IExprContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - // IsExprContext differentiates from other interfaces. - IsExprContext() -} - -type ExprContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyExprContext() *ExprContext { - var p = new(ExprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_expr - return p -} - -func (*ExprContext) IsExprContext() {} - -func NewExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExprContext { - var p = new(ExprContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_expr - - return p -} - -func (s *ExprContext) GetParser() antlr.Parser { return s.parser } - -func (s *ExprContext) CopyFrom(ctx *ExprContext) { - s.BaseParserRuleContext.CopyFrom(ctx.BaseParserRuleContext) -} - -func (s *ExprContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *ExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -type Expr_caseContext struct { - *ExprContext -} - -func NewExpr_caseContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_caseContext { - var p = new(Expr_caseContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_caseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_caseContext) CASE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCASE_, 0) -} - -func (s *Expr_caseContext) END_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEND_, 0) -} - -func (s *Expr_caseContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_caseContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_caseContext) AllWHEN_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserWHEN_) -} - -func (s *Expr_caseContext) WHEN_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserWHEN_, i) -} - -func (s *Expr_caseContext) AllTHEN_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserTHEN_) -} - -func (s *Expr_caseContext) THEN_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserTHEN_, i) -} - -func (s *Expr_caseContext) ELSE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserELSE_, 0) -} - -func (s *Expr_caseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_case(s) - } -} - -func (s *Expr_caseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_case(s) - } -} - -type Expr_raiseContext struct { - *ExprContext -} - -func NewExpr_raiseContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_raiseContext { - var p = new(Expr_raiseContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_raiseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_raiseContext) Raise_function() IRaise_functionContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IRaise_functionContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IRaise_functionContext) -} - -func (s *Expr_raiseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_raise(s) - } -} - -func (s *Expr_raiseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_raise(s) - } -} - -type Expr_functionContext struct { - *ExprContext -} - -func NewExpr_functionContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_functionContext { - var p = new(Expr_functionContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_functionContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_functionContext) Qualified_function_name() IQualified_function_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IQualified_function_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IQualified_function_nameContext) -} - -func (s *Expr_functionContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Expr_functionContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Expr_functionContext) STAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTAR, 0) -} - -func (s *Expr_functionContext) Filter_clause() IFilter_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFilter_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFilter_clauseContext) -} - -func (s *Expr_functionContext) Over_clause() IOver_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOver_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOver_clauseContext) -} - -func (s *Expr_functionContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_functionContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_functionContext) DISTINCT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDISTINCT_, 0) -} - -func (s *Expr_functionContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Expr_functionContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Expr_functionContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_function(s) - } -} - -func (s *Expr_functionContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_function(s) - } -} - -type Expr_comparisonContext struct { - *ExprContext -} - -func NewExpr_comparisonContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_comparisonContext { - var p = new(Expr_comparisonContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_comparisonContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_comparisonContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_comparisonContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_comparisonContext) LT2() antlr.TerminalNode { - return s.GetToken(SQLiteParserLT2, 0) -} - -func (s *Expr_comparisonContext) GT2() antlr.TerminalNode { - return s.GetToken(SQLiteParserGT2, 0) -} - -func (s *Expr_comparisonContext) AMP() antlr.TerminalNode { - return s.GetToken(SQLiteParserAMP, 0) -} - -func (s *Expr_comparisonContext) PIPE() antlr.TerminalNode { - return s.GetToken(SQLiteParserPIPE, 0) -} - -func (s *Expr_comparisonContext) LT() antlr.TerminalNode { - return s.GetToken(SQLiteParserLT, 0) -} - -func (s *Expr_comparisonContext) LT_EQ() antlr.TerminalNode { - return s.GetToken(SQLiteParserLT_EQ, 0) -} - -func (s *Expr_comparisonContext) GT() antlr.TerminalNode { - return s.GetToken(SQLiteParserGT, 0) -} - -func (s *Expr_comparisonContext) GT_EQ() antlr.TerminalNode { - return s.GetToken(SQLiteParserGT_EQ, 0) -} - -func (s *Expr_comparisonContext) ASSIGN() antlr.TerminalNode { - return s.GetToken(SQLiteParserASSIGN, 0) -} - -func (s *Expr_comparisonContext) EQ() antlr.TerminalNode { - return s.GetToken(SQLiteParserEQ, 0) -} - -func (s *Expr_comparisonContext) NOT_EQ1() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_EQ1, 0) -} - -func (s *Expr_comparisonContext) NOT_EQ2() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_EQ2, 0) -} - -func (s *Expr_comparisonContext) IS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIS_, 0) -} - -func (s *Expr_comparisonContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Expr_comparisonContext) IN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIN_, 0) -} - -func (s *Expr_comparisonContext) LIKE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLIKE_, 0) -} - -func (s *Expr_comparisonContext) GLOB_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGLOB_, 0) -} - -func (s *Expr_comparisonContext) MATCH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserMATCH_, 0) -} - -func (s *Expr_comparisonContext) REGEXP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREGEXP_, 0) -} - -func (s *Expr_comparisonContext) ESCAPE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserESCAPE_, 0) -} - -func (s *Expr_comparisonContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_comparison(s) - } -} - -func (s *Expr_comparisonContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_comparison(s) - } -} - -type Expr_binaryContext struct { - *ExprContext -} - -func NewExpr_binaryContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_binaryContext { - var p = new(Expr_binaryContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_binaryContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_binaryContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_binaryContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_binaryContext) PIPE2() antlr.TerminalNode { - return s.GetToken(SQLiteParserPIPE2, 0) -} - -func (s *Expr_binaryContext) AND_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAND_, 0) -} - -func (s *Expr_binaryContext) OR_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOR_, 0) -} - -func (s *Expr_binaryContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_binary(s) - } -} - -func (s *Expr_binaryContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_binary(s) - } -} - -type Expr_literalContext struct { - *ExprContext -} - -func NewExpr_literalContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_literalContext { - var p = new(Expr_literalContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_literalContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_literalContext) Literal_value() ILiteral_valueContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ILiteral_valueContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ILiteral_valueContext) -} - -func (s *Expr_literalContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_literal(s) - } -} - -func (s *Expr_literalContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_literal(s) - } -} - -type Expr_castContext struct { - *ExprContext -} - -func NewExpr_castContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_castContext { - var p = new(Expr_castContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_castContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_castContext) CAST_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCAST_, 0) -} - -func (s *Expr_castContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Expr_castContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_castContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Expr_castContext) Type_name() IType_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IType_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IType_nameContext) -} - -func (s *Expr_castContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Expr_castContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_cast(s) - } -} - -func (s *Expr_castContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_cast(s) - } -} - -type Expr_in_selectContext struct { - *ExprContext -} - -func NewExpr_in_selectContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_in_selectContext { - var p = new(Expr_in_selectContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_in_selectContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_in_selectContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Expr_in_selectContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Expr_in_selectContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Expr_in_selectContext) EXISTS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXISTS_, 0) -} - -func (s *Expr_in_selectContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Expr_in_selectContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_in_selectContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_in_selectContext) IN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIN_, 0) -} - -func (s *Expr_in_selectContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Expr_in_selectContext) Table_function_name() ITable_function_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_function_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_function_nameContext) -} - -func (s *Expr_in_selectContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Expr_in_selectContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Expr_in_selectContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Expr_in_selectContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Expr_in_selectContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_in_select(s) - } -} - -func (s *Expr_in_selectContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_in_select(s) - } -} - -type Expr_listContext struct { - *ExprContext -} - -func NewExpr_listContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_listContext { - var p = new(Expr_listContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_listContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_listContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Expr_listContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_listContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_listContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Expr_listContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Expr_listContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Expr_listContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_list(s) - } -} - -func (s *Expr_listContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_list(s) - } -} - -type Expr_betweenContext struct { - *ExprContext -} - -func NewExpr_betweenContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_betweenContext { - var p = new(Expr_betweenContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_betweenContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_betweenContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_betweenContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_betweenContext) BETWEEN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBETWEEN_, 0) -} - -func (s *Expr_betweenContext) AND_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAND_, 0) -} - -func (s *Expr_betweenContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Expr_betweenContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_between(s) - } -} - -func (s *Expr_betweenContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_between(s) - } -} - -type Expr_collateContext struct { - *ExprContext -} - -func NewExpr_collateContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_collateContext { - var p = new(Expr_collateContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_collateContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_collateContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_collateContext) COLLATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOLLATE_, 0) -} - -func (s *Expr_collateContext) Collation_name() ICollation_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICollation_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICollation_nameContext) -} - -func (s *Expr_collateContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_collate(s) - } -} - -func (s *Expr_collateContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_collate(s) - } -} - -type Expr_qualified_column_nameContext struct { - *ExprContext -} - -func NewExpr_qualified_column_nameContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_qualified_column_nameContext { - var p = new(Expr_qualified_column_nameContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_qualified_column_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_qualified_column_nameContext) Column_name() IColumn_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Expr_qualified_column_nameContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Expr_qualified_column_nameContext) AllDOT() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserDOT) -} - -func (s *Expr_qualified_column_nameContext) DOT(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, i) -} - -func (s *Expr_qualified_column_nameContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Expr_qualified_column_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_qualified_column_name(s) - } -} - -func (s *Expr_qualified_column_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_qualified_column_name(s) - } -} - -type Expr_math_opContext struct { - *ExprContext -} - -func NewExpr_math_opContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_math_opContext { - var p = new(Expr_math_opContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_math_opContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_math_opContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_math_opContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_math_opContext) STAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTAR, 0) -} - -func (s *Expr_math_opContext) DIV() antlr.TerminalNode { - return s.GetToken(SQLiteParserDIV, 0) -} - -func (s *Expr_math_opContext) MOD() antlr.TerminalNode { - return s.GetToken(SQLiteParserMOD, 0) -} - -func (s *Expr_math_opContext) PLUS() antlr.TerminalNode { - return s.GetToken(SQLiteParserPLUS, 0) -} - -func (s *Expr_math_opContext) MINUS() antlr.TerminalNode { - return s.GetToken(SQLiteParserMINUS, 0) -} - -func (s *Expr_math_opContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_math_op(s) - } -} - -func (s *Expr_math_opContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_math_op(s) - } -} - -type Expr_unaryContext struct { - *ExprContext -} - -func NewExpr_unaryContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_unaryContext { - var p = new(Expr_unaryContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_unaryContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_unaryContext) Unary_operator() IUnary_operatorContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IUnary_operatorContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IUnary_operatorContext) -} - -func (s *Expr_unaryContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_unaryContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_unary(s) - } -} - -func (s *Expr_unaryContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_unary(s) - } -} - -type Expr_null_compContext struct { - *ExprContext -} - -func NewExpr_null_compContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_null_compContext { - var p = new(Expr_null_compContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_null_compContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_null_compContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_null_compContext) ISNULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserISNULL_, 0) -} - -func (s *Expr_null_compContext) NOTNULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOTNULL_, 0) -} - -func (s *Expr_null_compContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Expr_null_compContext) NULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNULL_, 0) -} - -func (s *Expr_null_compContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_null_comp(s) - } -} - -func (s *Expr_null_compContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_null_comp(s) - } -} - -type Expr_bindContext struct { - *ExprContext -} - -func NewExpr_bindContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_bindContext { - var p = new(Expr_bindContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *Expr_bindContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_bindContext) NUMBERED_BIND_PARAMETER() antlr.TerminalNode { - return s.GetToken(SQLiteParserNUMBERED_BIND_PARAMETER, 0) -} - -func (s *Expr_bindContext) NAMED_BIND_PARAMETER() antlr.TerminalNode { - return s.GetToken(SQLiteParserNAMED_BIND_PARAMETER, 0) -} - -func (s *Expr_bindContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_bind(s) - } -} - -func (s *Expr_bindContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_bind(s) - } -} - -func (p *SQLiteParser) Expr() (localctx IExprContext) { - return p.expr(0) -} - -func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { - this := p - _ = this - - var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() - _parentState := p.GetState() - localctx = NewExprContext(p, p.GetParserRuleContext(), _parentState) - var _prevctx IExprContext = localctx - var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. - _startState := 68 - p.EnterRecursionRule(localctx, 68, SQLiteParserRULE_expr, _p) - var _la int - - defer func() { - p.UnrollRecursionContexts(_parentctx) - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - p.SetState(1005) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 129, p.GetParserRuleContext()) { - case 1: - localctx = NewExpr_literalContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - - { - p.SetState(917) - p.Literal_value() - } - - case 2: - localctx = NewExpr_bindContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - { - p.SetState(918) - p.Match(SQLiteParserNUMBERED_BIND_PARAMETER) - } - - case 3: - localctx = NewExpr_bindContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - { - p.SetState(919) - p.Match(SQLiteParserNAMED_BIND_PARAMETER) - } - - case 4: - localctx = NewExpr_qualified_column_nameContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - p.SetState(928) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 117, p.GetParserRuleContext()) == 1 { - p.SetState(923) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 116, p.GetParserRuleContext()) == 1 { - { - p.SetState(920) - p.Schema_name() - } - { - p.SetState(921) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(925) - p.Table_name() - } - { - p.SetState(926) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(930) - p.Column_name() - } - - case 5: - localctx = NewExpr_unaryContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - { - p.SetState(931) - p.Unary_operator() - } - { - p.SetState(932) - p.expr(20) - } - - case 6: - localctx = NewExpr_functionContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - { - p.SetState(934) - p.Qualified_function_name() - } - { - p.SetState(935) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(948) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: - p.SetState(937) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 118, p.GetParserRuleContext()) == 1 { - { - p.SetState(936) - p.Match(SQLiteParserDISTINCT_) - } - - } - { - p.SetState(939) - p.expr(0) - } - p.SetState(944) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(940) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(941) - p.expr(0) - } - - p.SetState(946) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - case SQLiteParserSTAR: - { - p.SetState(947) - p.Match(SQLiteParserSTAR) - } - - case SQLiteParserCLOSE_PAR: - - default: - } - { - p.SetState(950) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(952) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 121, p.GetParserRuleContext()) == 1 { - { - p.SetState(951) - p.Filter_clause() - } - - } - p.SetState(955) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 122, p.GetParserRuleContext()) == 1 { - { - p.SetState(954) - p.Over_clause() - } - - } - - case 7: - localctx = NewExpr_listContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - { - p.SetState(957) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(958) - p.expr(0) - } - p.SetState(963) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(959) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(960) - p.expr(0) - } - - p.SetState(965) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(966) - p.Match(SQLiteParserCLOSE_PAR) - } - - case 8: - localctx = NewExpr_castContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - { - p.SetState(968) - p.Match(SQLiteParserCAST_) - } - { - p.SetState(969) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(970) - p.expr(0) - } - { - p.SetState(971) - p.Match(SQLiteParserAS_) - } - { - p.SetState(972) - p.Type_name() - } - { - p.SetState(973) - p.Match(SQLiteParserCLOSE_PAR) - } - - case 9: - localctx = NewExpr_in_selectContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - p.SetState(979) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserEXISTS_ || _la == SQLiteParserNOT_ { - p.SetState(976) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserNOT_ { - { - p.SetState(975) - p.Match(SQLiteParserNOT_) - } - - } - { - p.SetState(978) - p.Match(SQLiteParserEXISTS_) - } - - } - { - p.SetState(981) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(982) - p.Select_stmt() - } - { - p.SetState(983) - p.Match(SQLiteParserCLOSE_PAR) - } - - case 10: - localctx = NewExpr_caseContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - { - p.SetState(985) - p.Match(SQLiteParserCASE_) - } - p.SetState(987) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 126, p.GetParserRuleContext()) == 1 { - { - p.SetState(986) - p.expr(0) - } - - } - p.SetState(994) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for ok := true; ok; ok = _la == SQLiteParserWHEN_ { - { - p.SetState(989) - p.Match(SQLiteParserWHEN_) - } - { - p.SetState(990) - p.expr(0) - } - { - p.SetState(991) - p.Match(SQLiteParserTHEN_) - } - { - p.SetState(992) - p.expr(0) - } - - p.SetState(996) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - p.SetState(1000) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserELSE_ { - { - p.SetState(998) - p.Match(SQLiteParserELSE_) - } - { - p.SetState(999) - p.expr(0) - } - - } - { - p.SetState(1002) - p.Match(SQLiteParserEND_) - } - - case 11: - localctx = NewExpr_raiseContext(p, localctx) - p.SetParserRuleContext(localctx) - _prevctx = localctx - { - p.SetState(1004) - p.Raise_function() - } - - } - p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(1123) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 145, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - if p.GetParseListeners() != nil { - p.TriggerExitRuleEvent() - } - _prevctx = localctx - p.SetState(1121) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 144, p.GetParserRuleContext()) { - case 1: - localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1007) - - if !(p.Precpred(p.GetParserRuleContext(), 19)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 19)", "")) - } - { - p.SetState(1008) - p.Match(SQLiteParserPIPE2) - } - { - p.SetState(1009) - p.expr(20) - } - - case 2: - localctx = NewExpr_math_opContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1010) - - if !(p.Precpred(p.GetParserRuleContext(), 18)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 18)", "")) - } - { - p.SetState(1011) - _la = p.GetTokenStream().LA(1) - - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&12416) != 0) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1012) - p.expr(19) - } - - case 3: - localctx = NewExpr_math_opContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1013) - - if !(p.Precpred(p.GetParserRuleContext(), 17)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 17)", "")) - } - { - p.SetState(1014) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserPLUS || _la == SQLiteParserMINUS) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1015) - p.expr(18) - } - - case 4: - localctx = NewExpr_comparisonContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1016) - - if !(p.Precpred(p.GetParserRuleContext(), 16)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 16)", "")) - } - { - p.SetState(1017) - _la = p.GetTokenStream().LA(1) - - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&245760) != 0) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1018) - p.expr(17) - } - - case 5: - localctx = NewExpr_comparisonContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1019) - - if !(p.Precpred(p.GetParserRuleContext(), 15)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 15)", "")) - } - { - p.SetState(1020) - _la = p.GetTokenStream().LA(1) - - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3932160) != 0) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1021) - p.expr(16) - } - - case 6: - localctx = NewExpr_comparisonContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1022) - - if !(p.Precpred(p.GetParserRuleContext(), 14)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 14)", "")) - } - p.SetState(1038) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 131, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1023) - p.Match(SQLiteParserASSIGN) - } - - case 2: - { - p.SetState(1024) - p.Match(SQLiteParserEQ) - } - - case 3: - { - p.SetState(1025) - p.Match(SQLiteParserNOT_EQ1) - } - - case 4: - { - p.SetState(1026) - p.Match(SQLiteParserNOT_EQ2) - } - - case 5: - { - p.SetState(1027) - p.Match(SQLiteParserIS_) - } - - case 6: - { - p.SetState(1028) - p.Match(SQLiteParserIS_) - } - { - p.SetState(1029) - p.Match(SQLiteParserNOT_) - } - - case 7: - p.SetState(1031) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserNOT_ { - { - p.SetState(1030) - p.Match(SQLiteParserNOT_) - } - - } - { - p.SetState(1033) - p.Match(SQLiteParserIN_) - } - - case 8: - { - p.SetState(1034) - p.Match(SQLiteParserLIKE_) - } - - case 9: - { - p.SetState(1035) - p.Match(SQLiteParserGLOB_) - } - - case 10: - { - p.SetState(1036) - p.Match(SQLiteParserMATCH_) - } - - case 11: - { - p.SetState(1037) - p.Match(SQLiteParserREGEXP_) - } - - } - { - p.SetState(1040) - p.expr(15) - } - - case 7: - localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1041) - - if !(p.Precpred(p.GetParserRuleContext(), 12)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 12)", "")) - } - { - p.SetState(1042) - p.Match(SQLiteParserAND_) - } - { - p.SetState(1043) - p.expr(13) - } - - case 8: - localctx = NewExpr_binaryContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1044) - - if !(p.Precpred(p.GetParserRuleContext(), 11)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 11)", "")) - } - { - p.SetState(1045) - p.Match(SQLiteParserOR_) - } - { - p.SetState(1046) - p.expr(12) - } - - case 9: - localctx = NewExpr_betweenContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1047) - - if !(p.Precpred(p.GetParserRuleContext(), 4)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) - } - p.SetState(1049) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserNOT_ { - { - p.SetState(1048) - p.Match(SQLiteParserNOT_) - } - - } - { - p.SetState(1051) - p.Match(SQLiteParserBETWEEN_) - } - { - p.SetState(1052) - p.expr(0) - } - { - p.SetState(1053) - p.Match(SQLiteParserAND_) - } - { - p.SetState(1054) - p.expr(5) - } - - case 10: - localctx = NewExpr_in_selectContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1056) - - if !(p.Precpred(p.GetParserRuleContext(), 13)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 13)", "")) - } - p.SetState(1058) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserNOT_ { - { - p.SetState(1057) - p.Match(SQLiteParserNOT_) - } - - } - { - p.SetState(1060) - p.Match(SQLiteParserIN_) - } - p.SetState(1099) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 140, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1061) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1071) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 135, p.GetParserRuleContext()) == 1 { - { - p.SetState(1062) - p.Select_stmt() - } - - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 135, p.GetParserRuleContext()) == 2 { - { - p.SetState(1063) - p.expr(0) - } - p.SetState(1068) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1064) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1065) - p.expr(0) - } - - p.SetState(1070) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - } - { - p.SetState(1073) - p.Match(SQLiteParserCLOSE_PAR) - } - - case 2: - p.SetState(1077) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 136, p.GetParserRuleContext()) == 1 { - { - p.SetState(1074) - p.Schema_name() - } - { - p.SetState(1075) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1079) - p.Table_name() - } - - case 3: - p.SetState(1083) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 137, p.GetParserRuleContext()) == 1 { - { - p.SetState(1080) - p.Schema_name() - } - { - p.SetState(1081) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1085) - p.Table_function_name() - } - { - p.SetState(1086) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1095) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-33552632) != 0) || ((int64((_la-64)) & ^0x3f) == 0 && ((int64(1)<<(_la-64))&-1) != 0) || ((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&-270215977642229761) != 0) { - { - p.SetState(1087) - p.expr(0) - } - p.SetState(1092) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1088) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1089) - p.expr(0) - } - - p.SetState(1094) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - } - { - p.SetState(1097) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - - case 11: - localctx = NewExpr_collateContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1101) - - if !(p.Precpred(p.GetParserRuleContext(), 7)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", "")) - } - { - p.SetState(1102) - p.Match(SQLiteParserCOLLATE_) - } - { - p.SetState(1103) - p.Collation_name() - } - - case 12: - localctx = NewExpr_comparisonContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1104) - - if !(p.Precpred(p.GetParserRuleContext(), 6)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", "")) - } - p.SetState(1106) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserNOT_ { - { - p.SetState(1105) - p.Match(SQLiteParserNOT_) - } - - } - { - p.SetState(1108) - _la = p.GetTokenStream().LA(1) - - if !((int64((_la-77)) & ^0x3f) == 0 && ((int64(1)<<(_la-77))&2199028498433) != 0) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1109) - p.expr(0) - } - p.SetState(1112) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 142, p.GetParserRuleContext()) == 1 { - { - p.SetState(1110) - p.Match(SQLiteParserESCAPE_) - } - { - p.SetState(1111) - p.expr(0) - } - - } - - case 13: - localctx = NewExpr_null_compContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, SQLiteParserRULE_expr) - p.SetState(1114) - - if !(p.Precpred(p.GetParserRuleContext(), 5)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", "")) - } - p.SetState(1119) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserISNULL_: - { - p.SetState(1115) - p.Match(SQLiteParserISNULL_) - } - - case SQLiteParserNOTNULL_: - { - p.SetState(1116) - p.Match(SQLiteParserNOTNULL_) - } - - case SQLiteParserNOT_: - { - p.SetState(1117) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(1118) - p.Match(SQLiteParserNULL_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - } - - } - p.SetState(1125) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 145, p.GetParserRuleContext()) - } - - return localctx -} - -// IRaise_functionContext is an interface to support dynamic dispatch. -type IRaise_functionContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - RAISE_() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - CLOSE_PAR() antlr.TerminalNode - IGNORE_() antlr.TerminalNode - COMMA() antlr.TerminalNode - Error_message() IError_messageContext - ROLLBACK_() antlr.TerminalNode - ABORT_() antlr.TerminalNode - FAIL_() antlr.TerminalNode - - // IsRaise_functionContext differentiates from other interfaces. - IsRaise_functionContext() -} - -type Raise_functionContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyRaise_functionContext() *Raise_functionContext { - var p = new(Raise_functionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_raise_function - return p -} - -func (*Raise_functionContext) IsRaise_functionContext() {} - -func NewRaise_functionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Raise_functionContext { - var p = new(Raise_functionContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_raise_function - - return p -} - -func (s *Raise_functionContext) GetParser() antlr.Parser { return s.parser } - -func (s *Raise_functionContext) RAISE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRAISE_, 0) -} - -func (s *Raise_functionContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Raise_functionContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Raise_functionContext) IGNORE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIGNORE_, 0) -} - -func (s *Raise_functionContext) COMMA() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, 0) -} - -func (s *Raise_functionContext) Error_message() IError_messageContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IError_messageContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IError_messageContext) -} - -func (s *Raise_functionContext) ROLLBACK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROLLBACK_, 0) -} - -func (s *Raise_functionContext) ABORT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserABORT_, 0) -} - -func (s *Raise_functionContext) FAIL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFAIL_, 0) -} - -func (s *Raise_functionContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Raise_functionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Raise_functionContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterRaise_function(s) - } -} - -func (s *Raise_functionContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitRaise_function(s) - } -} - -func (p *SQLiteParser) Raise_function() (localctx IRaise_functionContext) { - this := p - _ = this - - localctx = NewRaise_functionContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 70, SQLiteParserRULE_raise_function) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1126) - p.Match(SQLiteParserRAISE_) - } - { - p.SetState(1127) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1132) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserIGNORE_: - { - p.SetState(1128) - p.Match(SQLiteParserIGNORE_) - } - - case SQLiteParserABORT_, SQLiteParserFAIL_, SQLiteParserROLLBACK_: - { - p.SetState(1129) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserABORT_ || _la == SQLiteParserFAIL_ || _la == SQLiteParserROLLBACK_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1130) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1131) - p.Error_message() - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - { - p.SetState(1134) - p.Match(SQLiteParserCLOSE_PAR) - } - - return localctx -} - -// ILiteral_valueContext is an interface to support dynamic dispatch. -type ILiteral_valueContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - NUMERIC_LITERAL() antlr.TerminalNode - STRING_LITERAL() antlr.TerminalNode - BLOB_LITERAL() antlr.TerminalNode - NULL_() antlr.TerminalNode - TRUE_() antlr.TerminalNode - FALSE_() antlr.TerminalNode - CURRENT_TIME_() antlr.TerminalNode - CURRENT_DATE_() antlr.TerminalNode - CURRENT_TIMESTAMP_() antlr.TerminalNode - - // IsLiteral_valueContext differentiates from other interfaces. - IsLiteral_valueContext() -} - -type Literal_valueContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyLiteral_valueContext() *Literal_valueContext { - var p = new(Literal_valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_literal_value - return p -} - -func (*Literal_valueContext) IsLiteral_valueContext() {} - -func NewLiteral_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Literal_valueContext { - var p = new(Literal_valueContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_literal_value - - return p -} - -func (s *Literal_valueContext) GetParser() antlr.Parser { return s.parser } - -func (s *Literal_valueContext) NUMERIC_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserNUMERIC_LITERAL, 0) -} - -func (s *Literal_valueContext) STRING_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTRING_LITERAL, 0) -} - -func (s *Literal_valueContext) BLOB_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserBLOB_LITERAL, 0) -} - -func (s *Literal_valueContext) NULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNULL_, 0) -} - -func (s *Literal_valueContext) TRUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRUE_, 0) -} - -func (s *Literal_valueContext) FALSE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFALSE_, 0) -} - -func (s *Literal_valueContext) CURRENT_TIME_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_TIME_, 0) -} - -func (s *Literal_valueContext) CURRENT_DATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_DATE_, 0) -} - -func (s *Literal_valueContext) CURRENT_TIMESTAMP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_TIMESTAMP_, 0) -} - -func (s *Literal_valueContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Literal_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Literal_valueContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterLiteral_value(s) - } -} - -func (s *Literal_valueContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitLiteral_value(s) - } -} - -func (p *SQLiteParser) Literal_value() (localctx ILiteral_valueContext) { - this := p - _ = this - - localctx = NewLiteral_valueContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 72, SQLiteParserRULE_literal_value) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1136) - _la = p.GetTokenStream().LA(1) - - if !(((int64((_la-52)) & ^0x3f) == 0 && ((int64(1)<<(_la-52))&4503599627370503) != 0) || ((int64((_la-173)) & ^0x3f) == 0 && ((int64(1)<<(_la-173))&409603) != 0)) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - return localctx -} - -// IInsert_stmtContext is an interface to support dynamic dispatch. -type IInsert_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - INTO_() antlr.TerminalNode - Table_name() ITable_nameContext - INSERT_() antlr.TerminalNode - REPLACE_() antlr.TerminalNode - OR_() antlr.TerminalNode - With_clause() IWith_clauseContext - ROLLBACK_() antlr.TerminalNode - ABORT_() antlr.TerminalNode - FAIL_() antlr.TerminalNode - IGNORE_() antlr.TerminalNode - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - AS_() antlr.TerminalNode - Table_alias() ITable_aliasContext - AllOPEN_PAR() []antlr.TerminalNode - OPEN_PAR(i int) antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - AllCLOSE_PAR() []antlr.TerminalNode - CLOSE_PAR(i int) antlr.TerminalNode - VALUES_() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - Select_stmt() ISelect_stmtContext - Upsert_clause() IUpsert_clauseContext - Returning_clause() IReturning_clauseContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - DEFAULT_() antlr.TerminalNode - - // IsInsert_stmtContext differentiates from other interfaces. - IsInsert_stmtContext() -} - -type Insert_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyInsert_stmtContext() *Insert_stmtContext { - var p = new(Insert_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_insert_stmt - return p -} - -func (*Insert_stmtContext) IsInsert_stmtContext() {} - -func NewInsert_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Insert_stmtContext { - var p = new(Insert_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_insert_stmt - - return p -} - -func (s *Insert_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Insert_stmtContext) INTO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINTO_, 0) -} - -func (s *Insert_stmtContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Insert_stmtContext) INSERT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINSERT_, 0) -} - -func (s *Insert_stmtContext) REPLACE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREPLACE_, 0) -} - -func (s *Insert_stmtContext) OR_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOR_, 0) -} - -func (s *Insert_stmtContext) With_clause() IWith_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWith_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWith_clauseContext) -} - -func (s *Insert_stmtContext) ROLLBACK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROLLBACK_, 0) -} - -func (s *Insert_stmtContext) ABORT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserABORT_, 0) -} - -func (s *Insert_stmtContext) FAIL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFAIL_, 0) -} - -func (s *Insert_stmtContext) IGNORE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIGNORE_, 0) -} - -func (s *Insert_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Insert_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Insert_stmtContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Insert_stmtContext) Table_alias() ITable_aliasContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_aliasContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_aliasContext) -} - -func (s *Insert_stmtContext) AllOPEN_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserOPEN_PAR) -} - -func (s *Insert_stmtContext) OPEN_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, i) -} - -func (s *Insert_stmtContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Insert_stmtContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Insert_stmtContext) AllCLOSE_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCLOSE_PAR) -} - -func (s *Insert_stmtContext) CLOSE_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, i) -} - -func (s *Insert_stmtContext) VALUES_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVALUES_, 0) -} - -func (s *Insert_stmtContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Insert_stmtContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Insert_stmtContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Insert_stmtContext) Upsert_clause() IUpsert_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IUpsert_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IUpsert_clauseContext) -} - -func (s *Insert_stmtContext) Returning_clause() IReturning_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IReturning_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IReturning_clauseContext) -} - -func (s *Insert_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Insert_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Insert_stmtContext) DEFAULT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFAULT_, 0) -} - -func (s *Insert_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Insert_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Insert_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterInsert_stmt(s) - } -} - -func (s *Insert_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitInsert_stmt(s) - } -} - -func (p *SQLiteParser) Insert_stmt() (localctx IInsert_stmtContext) { - this := p - _ = this - - localctx = NewInsert_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 74, SQLiteParserRULE_insert_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1211) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserINSERT_, SQLiteParserREPLACE_, SQLiteParserWITH_: - p.EnterOuterAlt(localctx, 1) - p.SetState(1139) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(1138) - p.With_clause() - } - - } - p.SetState(1146) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 148, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1141) - p.Match(SQLiteParserINSERT_) - } - - case 2: - { - p.SetState(1142) - p.Match(SQLiteParserREPLACE_) - } - - case 3: - { - p.SetState(1143) - p.Match(SQLiteParserINSERT_) - } - { - p.SetState(1144) - p.Match(SQLiteParserOR_) - } - { - p.SetState(1145) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserABORT_ || ((int64((_la-72)) & ^0x3f) == 0 && ((int64(1)<<(_la-72))&19140298416325121) != 0)) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - { - p.SetState(1148) - p.Match(SQLiteParserINTO_) - } - p.SetState(1152) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 149, p.GetParserRuleContext()) == 1 { - { - p.SetState(1149) - p.Schema_name() - } - { - p.SetState(1150) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1154) - p.Table_name() - } - p.SetState(1157) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ { - { - p.SetState(1155) - p.Match(SQLiteParserAS_) - } - { - p.SetState(1156) - p.Table_alias() - } - - } - p.SetState(1170) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOPEN_PAR { - { - p.SetState(1159) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1160) - p.Column_name() - } - p.SetState(1165) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1161) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1162) - p.Column_name() - } - - p.SetState(1167) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1168) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - - p.SetState(1201) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 156, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1172) - p.Match(SQLiteParserVALUES_) - } - { - p.SetState(1173) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1174) - p.expr(0) - } - p.SetState(1179) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1175) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1176) - p.expr(0) - } - - p.SetState(1181) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1182) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1197) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1183) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1184) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1185) - p.expr(0) - } - p.SetState(1190) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1186) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1187) - p.expr(0) - } - - p.SetState(1192) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1193) - p.Match(SQLiteParserCLOSE_PAR) - } - - p.SetState(1199) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - case 2: - { - p.SetState(1200) - p.Select_stmt() - } - - } - p.SetState(1204) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserON_ { - { - p.SetState(1203) - p.Upsert_clause() - } - - } - p.SetState(1207) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserRETURNING_ { - { - p.SetState(1206) - p.Returning_clause() - } - - } - - case SQLiteParserDEFAULT_: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1209) - p.Match(SQLiteParserDEFAULT_) - } - { - p.SetState(1210) - p.Match(SQLiteParserVALUES_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IUpsert_clauseContext is an interface to support dynamic dispatch. -type IUpsert_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ON_() antlr.TerminalNode - CONFLICT_() antlr.TerminalNode - DO_() antlr.TerminalNode - NOTHING_() antlr.TerminalNode - UPDATE_() antlr.TerminalNode - SET_() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - AllIndexed_column() []IIndexed_columnContext - Indexed_column(i int) IIndexed_columnContext - CLOSE_PAR() antlr.TerminalNode - AllASSIGN() []antlr.TerminalNode - ASSIGN(i int) antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - AllWHERE_() []antlr.TerminalNode - WHERE_(i int) antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - AllColumn_name_list() []IColumn_name_listContext - Column_name_list(i int) IColumn_name_listContext - - // IsUpsert_clauseContext differentiates from other interfaces. - IsUpsert_clauseContext() -} - -type Upsert_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyUpsert_clauseContext() *Upsert_clauseContext { - var p = new(Upsert_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_upsert_clause - return p -} - -func (*Upsert_clauseContext) IsUpsert_clauseContext() {} - -func NewUpsert_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Upsert_clauseContext { - var p = new(Upsert_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_upsert_clause - - return p -} - -func (s *Upsert_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *Upsert_clauseContext) ON_() antlr.TerminalNode { - return s.GetToken(SQLiteParserON_, 0) -} - -func (s *Upsert_clauseContext) CONFLICT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCONFLICT_, 0) -} - -func (s *Upsert_clauseContext) DO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDO_, 0) -} - -func (s *Upsert_clauseContext) NOTHING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOTHING_, 0) -} - -func (s *Upsert_clauseContext) UPDATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUPDATE_, 0) -} - -func (s *Upsert_clauseContext) SET_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSET_, 0) -} - -func (s *Upsert_clauseContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Upsert_clauseContext) AllIndexed_column() []IIndexed_columnContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IIndexed_columnContext); ok { - len++ - } - } - - tst := make([]IIndexed_columnContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IIndexed_columnContext); ok { - tst[i] = t.(IIndexed_columnContext) - i++ - } - } - - return tst -} - -func (s *Upsert_clauseContext) Indexed_column(i int) IIndexed_columnContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IIndexed_columnContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IIndexed_columnContext) -} - -func (s *Upsert_clauseContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Upsert_clauseContext) AllASSIGN() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserASSIGN) -} - -func (s *Upsert_clauseContext) ASSIGN(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserASSIGN, i) -} - -func (s *Upsert_clauseContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Upsert_clauseContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Upsert_clauseContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Upsert_clauseContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Upsert_clauseContext) AllWHERE_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserWHERE_) -} - -func (s *Upsert_clauseContext) WHERE_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, i) -} - -func (s *Upsert_clauseContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Upsert_clauseContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Upsert_clauseContext) AllColumn_name_list() []IColumn_name_listContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_name_listContext); ok { - len++ - } - } - - tst := make([]IColumn_name_listContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_name_listContext); ok { - tst[i] = t.(IColumn_name_listContext) - i++ - } - } - - return tst -} - -func (s *Upsert_clauseContext) Column_name_list(i int) IColumn_name_listContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_name_listContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_name_listContext) -} - -func (s *Upsert_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Upsert_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Upsert_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterUpsert_clause(s) - } -} - -func (s *Upsert_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitUpsert_clause(s) - } -} - -func (p *SQLiteParser) Upsert_clause() (localctx IUpsert_clauseContext) { - this := p - _ = this - - localctx = NewUpsert_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 76, SQLiteParserRULE_upsert_clause) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1213) - p.Match(SQLiteParserON_) - } - { - p.SetState(1214) - p.Match(SQLiteParserCONFLICT_) - } - p.SetState(1229) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOPEN_PAR { - { - p.SetState(1215) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1216) - p.Indexed_column() - } - p.SetState(1221) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1217) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1218) - p.Indexed_column() - } - - p.SetState(1223) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1224) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1227) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHERE_ { - { - p.SetState(1225) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(1226) - p.expr(0) - } - - } - - } - { - p.SetState(1231) - p.Match(SQLiteParserDO_) - } - p.SetState(1258) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserNOTHING_: - { - p.SetState(1232) - p.Match(SQLiteParserNOTHING_) - } - - case SQLiteParserUPDATE_: - { - p.SetState(1233) - p.Match(SQLiteParserUPDATE_) - } - { - p.SetState(1234) - p.Match(SQLiteParserSET_) - } - - p.SetState(1237) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 163, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1235) - p.Column_name() - } - - case 2: - { - p.SetState(1236) - p.Column_name_list() - } - - } - { - p.SetState(1239) - p.Match(SQLiteParserASSIGN) - } - { - p.SetState(1240) - p.expr(0) - } - p.SetState(1251) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1241) - p.Match(SQLiteParserCOMMA) - } - p.SetState(1244) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 164, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1242) - p.Column_name() - } - - case 2: - { - p.SetState(1243) - p.Column_name_list() - } - - } - { - p.SetState(1246) - p.Match(SQLiteParserASSIGN) - } - { - p.SetState(1247) - p.expr(0) - } - - p.SetState(1253) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - p.SetState(1256) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHERE_ { - { - p.SetState(1254) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(1255) - p.expr(0) - } - - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IPragma_stmtContext is an interface to support dynamic dispatch. -type IPragma_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - PRAGMA_() antlr.TerminalNode - Pragma_name() IPragma_nameContext - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - ASSIGN() antlr.TerminalNode - Pragma_value() IPragma_valueContext - OPEN_PAR() antlr.TerminalNode - CLOSE_PAR() antlr.TerminalNode - - // IsPragma_stmtContext differentiates from other interfaces. - IsPragma_stmtContext() -} - -type Pragma_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyPragma_stmtContext() *Pragma_stmtContext { - var p = new(Pragma_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_pragma_stmt - return p -} - -func (*Pragma_stmtContext) IsPragma_stmtContext() {} - -func NewPragma_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pragma_stmtContext { - var p = new(Pragma_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_pragma_stmt - - return p -} - -func (s *Pragma_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Pragma_stmtContext) PRAGMA_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRAGMA_, 0) -} - -func (s *Pragma_stmtContext) Pragma_name() IPragma_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IPragma_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IPragma_nameContext) -} - -func (s *Pragma_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Pragma_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Pragma_stmtContext) ASSIGN() antlr.TerminalNode { - return s.GetToken(SQLiteParserASSIGN, 0) -} - -func (s *Pragma_stmtContext) Pragma_value() IPragma_valueContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IPragma_valueContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IPragma_valueContext) -} - -func (s *Pragma_stmtContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Pragma_stmtContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Pragma_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Pragma_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Pragma_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterPragma_stmt(s) - } -} - -func (s *Pragma_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitPragma_stmt(s) - } -} - -func (p *SQLiteParser) Pragma_stmt() (localctx IPragma_stmtContext) { - this := p - _ = this - - localctx = NewPragma_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 78, SQLiteParserRULE_pragma_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1260) - p.Match(SQLiteParserPRAGMA_) - } - p.SetState(1264) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 168, p.GetParserRuleContext()) == 1 { - { - p.SetState(1261) - p.Schema_name() - } - { - p.SetState(1262) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1266) - p.Pragma_name() - } - p.SetState(1273) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserASSIGN: - { - p.SetState(1267) - p.Match(SQLiteParserASSIGN) - } - { - p.SetState(1268) - p.Pragma_value() - } - - case SQLiteParserOPEN_PAR: - { - p.SetState(1269) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1270) - p.Pragma_value() - } - { - p.SetState(1271) - p.Match(SQLiteParserCLOSE_PAR) - } - - case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserDEFAULT_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXPLAIN_, SQLiteParserINSERT_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUPDATE_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWITH_: - - default: - } - - return localctx -} - -// IPragma_valueContext is an interface to support dynamic dispatch. -type IPragma_valueContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Signed_number() ISigned_numberContext - Name() INameContext - STRING_LITERAL() antlr.TerminalNode - - // IsPragma_valueContext differentiates from other interfaces. - IsPragma_valueContext() -} - -type Pragma_valueContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyPragma_valueContext() *Pragma_valueContext { - var p = new(Pragma_valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_pragma_value - return p -} - -func (*Pragma_valueContext) IsPragma_valueContext() {} - -func NewPragma_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pragma_valueContext { - var p = new(Pragma_valueContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_pragma_value - - return p -} - -func (s *Pragma_valueContext) GetParser() antlr.Parser { return s.parser } - -func (s *Pragma_valueContext) Signed_number() ISigned_numberContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISigned_numberContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISigned_numberContext) -} - -func (s *Pragma_valueContext) Name() INameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(INameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(INameContext) -} - -func (s *Pragma_valueContext) STRING_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTRING_LITERAL, 0) -} - -func (s *Pragma_valueContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Pragma_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Pragma_valueContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterPragma_value(s) - } -} - -func (s *Pragma_valueContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitPragma_value(s) - } -} - -func (p *SQLiteParser) Pragma_value() (localctx IPragma_valueContext) { - this := p - _ = this - - localctx = NewPragma_valueContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 80, SQLiteParserRULE_pragma_value) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1278) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 170, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1275) - p.Signed_number() - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1276) - p.Name() - } - - case 3: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1277) - p.Match(SQLiteParserSTRING_LITERAL) - } - - } - - return localctx -} - -// IReindex_stmtContext is an interface to support dynamic dispatch. -type IReindex_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - REINDEX_() antlr.TerminalNode - Collation_name() ICollation_nameContext - Table_name() ITable_nameContext - Index_name() IIndex_nameContext - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - - // IsReindex_stmtContext differentiates from other interfaces. - IsReindex_stmtContext() -} - -type Reindex_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyReindex_stmtContext() *Reindex_stmtContext { - var p = new(Reindex_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_reindex_stmt - return p -} - -func (*Reindex_stmtContext) IsReindex_stmtContext() {} - -func NewReindex_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reindex_stmtContext { - var p = new(Reindex_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_reindex_stmt - - return p -} - -func (s *Reindex_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Reindex_stmtContext) REINDEX_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREINDEX_, 0) -} - -func (s *Reindex_stmtContext) Collation_name() ICollation_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICollation_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICollation_nameContext) -} - -func (s *Reindex_stmtContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Reindex_stmtContext) Index_name() IIndex_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IIndex_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IIndex_nameContext) -} - -func (s *Reindex_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Reindex_stmtContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Reindex_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Reindex_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Reindex_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterReindex_stmt(s) - } -} - -func (s *Reindex_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitReindex_stmt(s) - } -} - -func (p *SQLiteParser) Reindex_stmt() (localctx IReindex_stmtContext) { - this := p - _ = this - - localctx = NewReindex_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 82, SQLiteParserRULE_reindex_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1280) - p.Match(SQLiteParserREINDEX_) - } - p.SetState(1291) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 173, p.GetParserRuleContext()) == 1 { - { - p.SetState(1281) - p.Collation_name() - } - - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 173, p.GetParserRuleContext()) == 2 { - p.SetState(1285) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 171, p.GetParserRuleContext()) == 1 { - { - p.SetState(1282) - p.Schema_name() - } - { - p.SetState(1283) - p.Match(SQLiteParserDOT) - } - - } - p.SetState(1289) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 172, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1287) - p.Table_name() - } - - case 2: - { - p.SetState(1288) - p.Index_name() - } - - } - - } - - return localctx -} - -// ISelect_stmtContext is an interface to support dynamic dispatch. -type ISelect_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - AllSelect_core() []ISelect_coreContext - Select_core(i int) ISelect_coreContext - Common_table_stmt() ICommon_table_stmtContext - AllCompound_operator() []ICompound_operatorContext - Compound_operator(i int) ICompound_operatorContext - Order_by_stmt() IOrder_by_stmtContext - Limit_stmt() ILimit_stmtContext - - // IsSelect_stmtContext differentiates from other interfaces. - IsSelect_stmtContext() -} - -type Select_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySelect_stmtContext() *Select_stmtContext { - var p = new(Select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_select_stmt - return p -} - -func (*Select_stmtContext) IsSelect_stmtContext() {} - -func NewSelect_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_stmtContext { - var p = new(Select_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_select_stmt - - return p -} - -func (s *Select_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Select_stmtContext) AllSelect_core() []ISelect_coreContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ISelect_coreContext); ok { - len++ - } - } - - tst := make([]ISelect_coreContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ISelect_coreContext); ok { - tst[i] = t.(ISelect_coreContext) - i++ - } - } - - return tst -} - -func (s *Select_stmtContext) Select_core(i int) ISelect_coreContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_coreContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ISelect_coreContext) -} - -func (s *Select_stmtContext) Common_table_stmt() ICommon_table_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICommon_table_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICommon_table_stmtContext) -} - -func (s *Select_stmtContext) AllCompound_operator() []ICompound_operatorContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ICompound_operatorContext); ok { - len++ - } - } - - tst := make([]ICompound_operatorContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ICompound_operatorContext); ok { - tst[i] = t.(ICompound_operatorContext) - i++ - } - } - - return tst -} - -func (s *Select_stmtContext) Compound_operator(i int) ICompound_operatorContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICompound_operatorContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ICompound_operatorContext) -} - -func (s *Select_stmtContext) Order_by_stmt() IOrder_by_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrder_by_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOrder_by_stmtContext) -} - -func (s *Select_stmtContext) Limit_stmt() ILimit_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ILimit_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ILimit_stmtContext) -} - -func (s *Select_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Select_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Select_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSelect_stmt(s) - } -} - -func (s *Select_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSelect_stmt(s) - } -} - -func (p *SQLiteParser) Select_stmt() (localctx ISelect_stmtContext) { - this := p - _ = this - - localctx = NewSelect_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 84, SQLiteParserRULE_select_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - p.SetState(1294) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(1293) - p.Common_table_stmt() - } - - } - { - p.SetState(1296) - p.Select_core() - } - p.SetState(1302) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 175, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - { - p.SetState(1297) - p.Compound_operator() - } - { - p.SetState(1298) - p.Select_core() - } - - } - p.SetState(1304) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 175, p.GetParserRuleContext()) - } - p.SetState(1306) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserORDER_ { - { - p.SetState(1305) - p.Order_by_stmt() - } - - } - p.SetState(1309) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserLIMIT_ { - { - p.SetState(1308) - p.Limit_stmt() - } - - } - - return localctx -} - -// IJoin_clauseContext is an interface to support dynamic dispatch. -type IJoin_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - AllTable_or_subquery() []ITable_or_subqueryContext - Table_or_subquery(i int) ITable_or_subqueryContext - AllJoin_operator() []IJoin_operatorContext - Join_operator(i int) IJoin_operatorContext - AllJoin_constraint() []IJoin_constraintContext - Join_constraint(i int) IJoin_constraintContext - - // IsJoin_clauseContext differentiates from other interfaces. - IsJoin_clauseContext() -} - -type Join_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyJoin_clauseContext() *Join_clauseContext { - var p = new(Join_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_join_clause - return p -} - -func (*Join_clauseContext) IsJoin_clauseContext() {} - -func NewJoin_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Join_clauseContext { - var p = new(Join_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_join_clause - - return p -} - -func (s *Join_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *Join_clauseContext) AllTable_or_subquery() []ITable_or_subqueryContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ITable_or_subqueryContext); ok { - len++ - } - } - - tst := make([]ITable_or_subqueryContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ITable_or_subqueryContext); ok { - tst[i] = t.(ITable_or_subqueryContext) - i++ - } - } - - return tst -} - -func (s *Join_clauseContext) Table_or_subquery(i int) ITable_or_subqueryContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_or_subqueryContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ITable_or_subqueryContext) -} - -func (s *Join_clauseContext) AllJoin_operator() []IJoin_operatorContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IJoin_operatorContext); ok { - len++ - } - } - - tst := make([]IJoin_operatorContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IJoin_operatorContext); ok { - tst[i] = t.(IJoin_operatorContext) - i++ - } - } - - return tst -} - -func (s *Join_clauseContext) Join_operator(i int) IJoin_operatorContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IJoin_operatorContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IJoin_operatorContext) -} - -func (s *Join_clauseContext) AllJoin_constraint() []IJoin_constraintContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IJoin_constraintContext); ok { - len++ - } - } - - tst := make([]IJoin_constraintContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IJoin_constraintContext); ok { - tst[i] = t.(IJoin_constraintContext) - i++ - } - } - - return tst -} - -func (s *Join_clauseContext) Join_constraint(i int) IJoin_constraintContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IJoin_constraintContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IJoin_constraintContext) -} - -func (s *Join_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Join_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Join_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterJoin_clause(s) - } -} - -func (s *Join_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitJoin_clause(s) - } -} - -func (p *SQLiteParser) Join_clause() (localctx IJoin_clauseContext) { - this := p - _ = this - - localctx = NewJoin_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 86, SQLiteParserRULE_join_clause) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1311) - p.Table_or_subquery() - } - p.SetState(1318) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA || _la == SQLiteParserCROSS_ || ((int64((_la-76)) & ^0x3f) == 0 && ((int64(1)<<(_la-76))&562949971511297) != 0) { - { - p.SetState(1312) - p.Join_operator() - } - { - p.SetState(1313) - p.Table_or_subquery() - } - { - p.SetState(1314) - p.Join_constraint() - } - - p.SetState(1320) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - return localctx -} - -// ISelect_coreContext is an interface to support dynamic dispatch. -type ISelect_coreContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - SELECT_() antlr.TerminalNode - AllResult_column() []IResult_columnContext - Result_column(i int) IResult_columnContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - FROM_() antlr.TerminalNode - WHERE_() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - GROUP_() antlr.TerminalNode - BY_() antlr.TerminalNode - WINDOW_() antlr.TerminalNode - AllWindow_name() []IWindow_nameContext - Window_name(i int) IWindow_nameContext - AllAS_() []antlr.TerminalNode - AS_(i int) antlr.TerminalNode - AllWindow_defn() []IWindow_defnContext - Window_defn(i int) IWindow_defnContext - DISTINCT_() antlr.TerminalNode - ALL_() antlr.TerminalNode - AllTable_or_subquery() []ITable_or_subqueryContext - Table_or_subquery(i int) ITable_or_subqueryContext - Join_clause() IJoin_clauseContext - HAVING_() antlr.TerminalNode - VALUES_() antlr.TerminalNode - AllOPEN_PAR() []antlr.TerminalNode - OPEN_PAR(i int) antlr.TerminalNode - AllCLOSE_PAR() []antlr.TerminalNode - CLOSE_PAR(i int) antlr.TerminalNode - - // IsSelect_coreContext differentiates from other interfaces. - IsSelect_coreContext() -} - -type Select_coreContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySelect_coreContext() *Select_coreContext { - var p = new(Select_coreContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_select_core - return p -} - -func (*Select_coreContext) IsSelect_coreContext() {} - -func NewSelect_coreContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_coreContext { - var p = new(Select_coreContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_select_core - - return p -} - -func (s *Select_coreContext) GetParser() antlr.Parser { return s.parser } - -func (s *Select_coreContext) SELECT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSELECT_, 0) -} - -func (s *Select_coreContext) AllResult_column() []IResult_columnContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IResult_columnContext); ok { - len++ - } - } - - tst := make([]IResult_columnContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IResult_columnContext); ok { - tst[i] = t.(IResult_columnContext) - i++ - } - } - - return tst -} - -func (s *Select_coreContext) Result_column(i int) IResult_columnContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IResult_columnContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IResult_columnContext) -} - -func (s *Select_coreContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Select_coreContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Select_coreContext) FROM_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFROM_, 0) -} - -func (s *Select_coreContext) WHERE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, 0) -} - -func (s *Select_coreContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Select_coreContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Select_coreContext) GROUP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGROUP_, 0) -} - -func (s *Select_coreContext) BY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, 0) -} - -func (s *Select_coreContext) WINDOW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWINDOW_, 0) -} - -func (s *Select_coreContext) AllWindow_name() []IWindow_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IWindow_nameContext); ok { - len++ - } - } - - tst := make([]IWindow_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IWindow_nameContext); ok { - tst[i] = t.(IWindow_nameContext) - i++ - } - } - - return tst -} - -func (s *Select_coreContext) Window_name(i int) IWindow_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWindow_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IWindow_nameContext) -} - -func (s *Select_coreContext) AllAS_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserAS_) -} - -func (s *Select_coreContext) AS_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, i) -} - -func (s *Select_coreContext) AllWindow_defn() []IWindow_defnContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IWindow_defnContext); ok { - len++ - } - } - - tst := make([]IWindow_defnContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IWindow_defnContext); ok { - tst[i] = t.(IWindow_defnContext) - i++ - } - } - - return tst -} - -func (s *Select_coreContext) Window_defn(i int) IWindow_defnContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWindow_defnContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IWindow_defnContext) -} - -func (s *Select_coreContext) DISTINCT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDISTINCT_, 0) -} - -func (s *Select_coreContext) ALL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserALL_, 0) -} - -func (s *Select_coreContext) AllTable_or_subquery() []ITable_or_subqueryContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ITable_or_subqueryContext); ok { - len++ - } - } - - tst := make([]ITable_or_subqueryContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ITable_or_subqueryContext); ok { - tst[i] = t.(ITable_or_subqueryContext) - i++ - } - } - - return tst -} - -func (s *Select_coreContext) Table_or_subquery(i int) ITable_or_subqueryContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_or_subqueryContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ITable_or_subqueryContext) -} - -func (s *Select_coreContext) Join_clause() IJoin_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IJoin_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IJoin_clauseContext) -} - -func (s *Select_coreContext) HAVING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserHAVING_, 0) -} - -func (s *Select_coreContext) VALUES_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVALUES_, 0) -} - -func (s *Select_coreContext) AllOPEN_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserOPEN_PAR) -} - -func (s *Select_coreContext) OPEN_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, i) -} - -func (s *Select_coreContext) AllCLOSE_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCLOSE_PAR) -} - -func (s *Select_coreContext) CLOSE_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, i) -} - -func (s *Select_coreContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Select_coreContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Select_coreContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSelect_core(s) - } -} - -func (s *Select_coreContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSelect_core(s) - } -} - -func (p *SQLiteParser) Select_core() (localctx ISelect_coreContext) { - this := p - _ = this - - localctx = NewSelect_coreContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 88, SQLiteParserRULE_select_core) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1411) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserSELECT_: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1321) - p.Match(SQLiteParserSELECT_) - } - p.SetState(1323) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 179, p.GetParserRuleContext()) == 1 { - { - p.SetState(1322) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserALL_ || _la == SQLiteParserDISTINCT_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - { - p.SetState(1325) - p.Result_column() - } - p.SetState(1330) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1326) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1327) - p.Result_column() - } - - p.SetState(1332) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - p.SetState(1345) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserFROM_ { - { - p.SetState(1333) - p.Match(SQLiteParserFROM_) - } - p.SetState(1343) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 182, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1334) - p.Table_or_subquery() - } - p.SetState(1339) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1335) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1336) - p.Table_or_subquery() - } - - p.SetState(1341) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - case 2: - { - p.SetState(1342) - p.Join_clause() - } - - } - - } - p.SetState(1349) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHERE_ { - { - p.SetState(1347) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(1348) - p.expr(0) - } - - } - p.SetState(1365) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserGROUP_ { - { - p.SetState(1351) - p.Match(SQLiteParserGROUP_) - } - { - p.SetState(1352) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1353) - p.expr(0) - } - p.SetState(1358) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1354) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1355) - p.expr(0) - } - - p.SetState(1360) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - p.SetState(1363) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserHAVING_ { - { - p.SetState(1361) - p.Match(SQLiteParserHAVING_) - } - { - p.SetState(1362) - p.expr(0) - } - - } - - } - p.SetState(1381) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWINDOW_ { - { - p.SetState(1367) - p.Match(SQLiteParserWINDOW_) - } - { - p.SetState(1368) - p.Window_name() - } - { - p.SetState(1369) - p.Match(SQLiteParserAS_) - } - { - p.SetState(1370) - p.Window_defn() - } - p.SetState(1378) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1371) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1372) - p.Window_name() - } - { - p.SetState(1373) - p.Match(SQLiteParserAS_) - } - { - p.SetState(1374) - p.Window_defn() - } - - p.SetState(1380) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - } - - case SQLiteParserVALUES_: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1383) - p.Match(SQLiteParserVALUES_) - } - { - p.SetState(1384) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1385) - p.expr(0) - } - p.SetState(1390) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1386) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1387) - p.expr(0) - } - - p.SetState(1392) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1393) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1408) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1394) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1395) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1396) - p.expr(0) - } - p.SetState(1401) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1397) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1398) - p.expr(0) - } - - p.SetState(1403) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1404) - p.Match(SQLiteParserCLOSE_PAR) - } - - p.SetState(1410) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IFactored_select_stmtContext is an interface to support dynamic dispatch. -type IFactored_select_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Select_stmt() ISelect_stmtContext - - // IsFactored_select_stmtContext differentiates from other interfaces. - IsFactored_select_stmtContext() -} - -type Factored_select_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFactored_select_stmtContext() *Factored_select_stmtContext { - var p = new(Factored_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_factored_select_stmt - return p -} - -func (*Factored_select_stmtContext) IsFactored_select_stmtContext() {} - -func NewFactored_select_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Factored_select_stmtContext { - var p = new(Factored_select_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_factored_select_stmt - - return p -} - -func (s *Factored_select_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Factored_select_stmtContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Factored_select_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Factored_select_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Factored_select_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFactored_select_stmt(s) - } -} - -func (s *Factored_select_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFactored_select_stmt(s) - } -} - -func (p *SQLiteParser) Factored_select_stmt() (localctx IFactored_select_stmtContext) { - this := p - _ = this - - localctx = NewFactored_select_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 90, SQLiteParserRULE_factored_select_stmt) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1413) - p.Select_stmt() - } - - return localctx -} - -// ISimple_select_stmtContext is an interface to support dynamic dispatch. -type ISimple_select_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Select_core() ISelect_coreContext - Common_table_stmt() ICommon_table_stmtContext - Order_by_stmt() IOrder_by_stmtContext - Limit_stmt() ILimit_stmtContext - - // IsSimple_select_stmtContext differentiates from other interfaces. - IsSimple_select_stmtContext() -} - -type Simple_select_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySimple_select_stmtContext() *Simple_select_stmtContext { - var p = new(Simple_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_simple_select_stmt - return p -} - -func (*Simple_select_stmtContext) IsSimple_select_stmtContext() {} - -func NewSimple_select_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Simple_select_stmtContext { - var p = new(Simple_select_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_simple_select_stmt - - return p -} - -func (s *Simple_select_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Simple_select_stmtContext) Select_core() ISelect_coreContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_coreContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_coreContext) -} - -func (s *Simple_select_stmtContext) Common_table_stmt() ICommon_table_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICommon_table_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICommon_table_stmtContext) -} - -func (s *Simple_select_stmtContext) Order_by_stmt() IOrder_by_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrder_by_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOrder_by_stmtContext) -} - -func (s *Simple_select_stmtContext) Limit_stmt() ILimit_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ILimit_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ILimit_stmtContext) -} - -func (s *Simple_select_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Simple_select_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Simple_select_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSimple_select_stmt(s) - } -} - -func (s *Simple_select_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSimple_select_stmt(s) - } -} - -func (p *SQLiteParser) Simple_select_stmt() (localctx ISimple_select_stmtContext) { - this := p - _ = this - - localctx = NewSimple_select_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 92, SQLiteParserRULE_simple_select_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(1416) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(1415) - p.Common_table_stmt() - } - - } - { - p.SetState(1418) - p.Select_core() - } - p.SetState(1420) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserORDER_ { - { - p.SetState(1419) - p.Order_by_stmt() - } - - } - p.SetState(1423) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserLIMIT_ { - { - p.SetState(1422) - p.Limit_stmt() - } - - } - - return localctx -} - -// ICompound_select_stmtContext is an interface to support dynamic dispatch. -type ICompound_select_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - AllSelect_core() []ISelect_coreContext - Select_core(i int) ISelect_coreContext - Common_table_stmt() ICommon_table_stmtContext - Order_by_stmt() IOrder_by_stmtContext - Limit_stmt() ILimit_stmtContext - AllUNION_() []antlr.TerminalNode - UNION_(i int) antlr.TerminalNode - AllINTERSECT_() []antlr.TerminalNode - INTERSECT_(i int) antlr.TerminalNode - AllEXCEPT_() []antlr.TerminalNode - EXCEPT_(i int) antlr.TerminalNode - AllALL_() []antlr.TerminalNode - ALL_(i int) antlr.TerminalNode - - // IsCompound_select_stmtContext differentiates from other interfaces. - IsCompound_select_stmtContext() -} - -type Compound_select_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCompound_select_stmtContext() *Compound_select_stmtContext { - var p = new(Compound_select_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_compound_select_stmt - return p -} - -func (*Compound_select_stmtContext) IsCompound_select_stmtContext() {} - -func NewCompound_select_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Compound_select_stmtContext { - var p = new(Compound_select_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_compound_select_stmt - - return p -} - -func (s *Compound_select_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Compound_select_stmtContext) AllSelect_core() []ISelect_coreContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ISelect_coreContext); ok { - len++ - } - } - - tst := make([]ISelect_coreContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ISelect_coreContext); ok { - tst[i] = t.(ISelect_coreContext) - i++ - } - } - - return tst -} - -func (s *Compound_select_stmtContext) Select_core(i int) ISelect_coreContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_coreContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ISelect_coreContext) -} - -func (s *Compound_select_stmtContext) Common_table_stmt() ICommon_table_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICommon_table_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICommon_table_stmtContext) -} - -func (s *Compound_select_stmtContext) Order_by_stmt() IOrder_by_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrder_by_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOrder_by_stmtContext) -} - -func (s *Compound_select_stmtContext) Limit_stmt() ILimit_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ILimit_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ILimit_stmtContext) -} - -func (s *Compound_select_stmtContext) AllUNION_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserUNION_) -} - -func (s *Compound_select_stmtContext) UNION_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserUNION_, i) -} - -func (s *Compound_select_stmtContext) AllINTERSECT_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserINTERSECT_) -} - -func (s *Compound_select_stmtContext) INTERSECT_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserINTERSECT_, i) -} - -func (s *Compound_select_stmtContext) AllEXCEPT_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserEXCEPT_) -} - -func (s *Compound_select_stmtContext) EXCEPT_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserEXCEPT_, i) -} - -func (s *Compound_select_stmtContext) AllALL_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserALL_) -} - -func (s *Compound_select_stmtContext) ALL_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserALL_, i) -} - -func (s *Compound_select_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Compound_select_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Compound_select_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCompound_select_stmt(s) - } -} - -func (s *Compound_select_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCompound_select_stmt(s) - } -} - -func (p *SQLiteParser) Compound_select_stmt() (localctx ICompound_select_stmtContext) { - this := p - _ = this - - localctx = NewCompound_select_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 94, SQLiteParserRULE_compound_select_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(1426) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(1425) - p.Common_table_stmt() - } - - } - { - p.SetState(1428) - p.Select_core() - } - p.SetState(1438) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for ok := true; ok; ok = _la == SQLiteParserEXCEPT_ || _la == SQLiteParserINTERSECT_ || _la == SQLiteParserUNION_ { - p.SetState(1435) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserUNION_: - { - p.SetState(1429) - p.Match(SQLiteParserUNION_) - } - p.SetState(1431) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserALL_ { - { - p.SetState(1430) - p.Match(SQLiteParserALL_) - } - - } - - case SQLiteParserINTERSECT_: - { - p.SetState(1433) - p.Match(SQLiteParserINTERSECT_) - } - - case SQLiteParserEXCEPT_: - { - p.SetState(1434) - p.Match(SQLiteParserEXCEPT_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - { - p.SetState(1437) - p.Select_core() - } - - p.SetState(1440) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - p.SetState(1443) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserORDER_ { - { - p.SetState(1442) - p.Order_by_stmt() - } - - } - p.SetState(1446) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserLIMIT_ { - { - p.SetState(1445) - p.Limit_stmt() - } - - } - - return localctx -} - -// ITable_or_subqueryContext is an interface to support dynamic dispatch. -type ITable_or_subqueryContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Table_name() ITable_nameContext - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - Table_alias() ITable_aliasContext - INDEXED_() antlr.TerminalNode - BY_() antlr.TerminalNode - Index_name() IIndex_nameContext - NOT_() antlr.TerminalNode - AS_() antlr.TerminalNode - Table_function_name() ITable_function_nameContext - OPEN_PAR() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - CLOSE_PAR() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - AllTable_or_subquery() []ITable_or_subqueryContext - Table_or_subquery(i int) ITable_or_subqueryContext - Join_clause() IJoin_clauseContext - Select_stmt() ISelect_stmtContext - Table_alias_fallback() ITable_alias_fallbackContext - - // IsTable_or_subqueryContext differentiates from other interfaces. - IsTable_or_subqueryContext() -} - -type Table_or_subqueryContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTable_or_subqueryContext() *Table_or_subqueryContext { - var p = new(Table_or_subqueryContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_table_or_subquery - return p -} - -func (*Table_or_subqueryContext) IsTable_or_subqueryContext() {} - -func NewTable_or_subqueryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_or_subqueryContext { - var p = new(Table_or_subqueryContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_table_or_subquery - - return p -} - -func (s *Table_or_subqueryContext) GetParser() antlr.Parser { return s.parser } - -func (s *Table_or_subqueryContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Table_or_subqueryContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Table_or_subqueryContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Table_or_subqueryContext) Table_alias() ITable_aliasContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_aliasContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_aliasContext) -} - -func (s *Table_or_subqueryContext) INDEXED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINDEXED_, 0) -} - -func (s *Table_or_subqueryContext) BY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, 0) -} - -func (s *Table_or_subqueryContext) Index_name() IIndex_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IIndex_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IIndex_nameContext) -} - -func (s *Table_or_subqueryContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Table_or_subqueryContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Table_or_subqueryContext) Table_function_name() ITable_function_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_function_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_function_nameContext) -} - -func (s *Table_or_subqueryContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Table_or_subqueryContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Table_or_subqueryContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Table_or_subqueryContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Table_or_subqueryContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Table_or_subqueryContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Table_or_subqueryContext) AllTable_or_subquery() []ITable_or_subqueryContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ITable_or_subqueryContext); ok { - len++ - } - } - - tst := make([]ITable_or_subqueryContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ITable_or_subqueryContext); ok { - tst[i] = t.(ITable_or_subqueryContext) - i++ - } - } - - return tst -} - -func (s *Table_or_subqueryContext) Table_or_subquery(i int) ITable_or_subqueryContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_or_subqueryContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ITable_or_subqueryContext) -} - -func (s *Table_or_subqueryContext) Join_clause() IJoin_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IJoin_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IJoin_clauseContext) -} - -func (s *Table_or_subqueryContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Table_or_subqueryContext) Table_alias_fallback() ITable_alias_fallbackContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_alias_fallbackContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_alias_fallbackContext) -} - -func (s *Table_or_subqueryContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Table_or_subqueryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Table_or_subqueryContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTable_or_subquery(s) - } -} - -func (s *Table_or_subqueryContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTable_or_subquery(s) - } -} - -func (p *SQLiteParser) Table_or_subquery() (localctx ITable_or_subqueryContext) { - this := p - _ = this - - localctx = NewTable_or_subqueryContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 96, SQLiteParserRULE_table_or_subquery) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1576) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 227, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - p.SetState(1451) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 203, p.GetParserRuleContext()) == 1 { - { - p.SetState(1448) - p.Schema_name() - } - { - p.SetState(1449) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1453) - p.Table_name() - } - p.SetState(1458) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1455) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ { - { - p.SetState(1454) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(1457) - p.Table_alias() - } - - } - p.SetState(1465) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserINDEXED_: - { - p.SetState(1460) - p.Match(SQLiteParserINDEXED_) - } - { - p.SetState(1461) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1462) - p.Index_name() - } - - case SQLiteParserNOT_: - { - p.SetState(1463) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(1464) - p.Match(SQLiteParserINDEXED_) - } - - case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserCLOSE_PAR, SQLiteParserCOMMA, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserDEFAULT_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXCEPT_, SQLiteParserEXPLAIN_, SQLiteParserFULL_, SQLiteParserGROUP_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINTERSECT_, SQLiteParserJOIN_, SQLiteParserLEFT_, SQLiteParserLIMIT_, SQLiteParserNATURAL_, SQLiteParserON_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUNION_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWINDOW_: - - default: - } - - case 2: - p.EnterOuterAlt(localctx, 2) - p.SetState(1470) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 207, p.GetParserRuleContext()) == 1 { - { - p.SetState(1467) - p.Schema_name() - } - { - p.SetState(1468) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1472) - p.Table_function_name() - } - { - p.SetState(1473) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1474) - p.expr(0) - } - p.SetState(1479) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1475) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1476) - p.expr(0) - } - - p.SetState(1481) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1482) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1487) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1484) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ { - { - p.SetState(1483) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(1486) - p.Table_alias() - } - - } - - case 3: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1489) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1499) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 212, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1490) - p.Table_or_subquery() - } - p.SetState(1495) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1491) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1492) - p.Table_or_subquery() - } - - p.SetState(1497) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - case 2: - { - p.SetState(1498) - p.Join_clause() - } - - } - { - p.SetState(1501) - p.Match(SQLiteParserCLOSE_PAR) - } - - case 4: - p.EnterOuterAlt(localctx, 4) - { - p.SetState(1503) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1504) - p.Select_stmt() - } - { - p.SetState(1505) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1510) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1507) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ { - { - p.SetState(1506) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(1509) - p.Table_alias() - } - - } - - case 5: - p.EnterOuterAlt(localctx, 5) - p.SetState(1515) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 215, p.GetParserRuleContext()) == 1 { - { - p.SetState(1512) - p.Schema_name() - } - { - p.SetState(1513) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1517) - p.Table_name() - } - p.SetState(1522) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 217, p.GetParserRuleContext()) == 1 { - p.SetState(1519) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 216, p.GetParserRuleContext()) == 1 { - { - p.SetState(1518) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(1521) - p.Table_alias_fallback() - } - - } - p.SetState(1529) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserINDEXED_: - { - p.SetState(1524) - p.Match(SQLiteParserINDEXED_) - } - { - p.SetState(1525) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1526) - p.Index_name() - } - - case SQLiteParserNOT_: - { - p.SetState(1527) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(1528) - p.Match(SQLiteParserINDEXED_) - } - - case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserCLOSE_PAR, SQLiteParserCOMMA, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserDEFAULT_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXCEPT_, SQLiteParserEXPLAIN_, SQLiteParserFULL_, SQLiteParserGROUP_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINTERSECT_, SQLiteParserJOIN_, SQLiteParserLEFT_, SQLiteParserLIMIT_, SQLiteParserNATURAL_, SQLiteParserON_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserUNION_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWINDOW_: - - default: - } - - case 6: - p.EnterOuterAlt(localctx, 6) - p.SetState(1534) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 219, p.GetParserRuleContext()) == 1 { - { - p.SetState(1531) - p.Schema_name() - } - { - p.SetState(1532) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1536) - p.Table_function_name() - } - { - p.SetState(1537) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1538) - p.expr(0) - } - p.SetState(1543) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1539) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1540) - p.expr(0) - } - - p.SetState(1545) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1546) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1551) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 222, p.GetParserRuleContext()) == 1 { - p.SetState(1548) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 221, p.GetParserRuleContext()) == 1 { - { - p.SetState(1547) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(1550) - p.Table_alias_fallback() - } - - } - - case 7: - p.EnterOuterAlt(localctx, 7) - { - p.SetState(1553) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1563) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 224, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1554) - p.Table_or_subquery() - } - p.SetState(1559) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1555) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1556) - p.Table_or_subquery() - } - - p.SetState(1561) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - case 2: - { - p.SetState(1562) - p.Join_clause() - } - - } - { - p.SetState(1565) - p.Match(SQLiteParserCLOSE_PAR) - } - - case 8: - p.EnterOuterAlt(localctx, 8) - { - p.SetState(1567) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1568) - p.Select_stmt() - } - { - p.SetState(1569) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1574) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 226, p.GetParserRuleContext()) == 1 { - p.SetState(1571) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 225, p.GetParserRuleContext()) == 1 { - { - p.SetState(1570) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(1573) - p.Table_alias_fallback() - } - - } - - } - - return localctx -} - -// IResult_columnContext is an interface to support dynamic dispatch. -type IResult_columnContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - STAR() antlr.TerminalNode - Table_name() ITable_nameContext - DOT() antlr.TerminalNode - Expr() IExprContext - Column_alias() IColumn_aliasContext - AS_() antlr.TerminalNode - - // IsResult_columnContext differentiates from other interfaces. - IsResult_columnContext() -} - -type Result_columnContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyResult_columnContext() *Result_columnContext { - var p = new(Result_columnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_result_column - return p -} - -func (*Result_columnContext) IsResult_columnContext() {} - -func NewResult_columnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Result_columnContext { - var p = new(Result_columnContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_result_column - - return p -} - -func (s *Result_columnContext) GetParser() antlr.Parser { return s.parser } - -func (s *Result_columnContext) STAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTAR, 0) -} - -func (s *Result_columnContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Result_columnContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Result_columnContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Result_columnContext) Column_alias() IColumn_aliasContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_aliasContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IColumn_aliasContext) -} - -func (s *Result_columnContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Result_columnContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Result_columnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Result_columnContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterResult_column(s) - } -} - -func (s *Result_columnContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitResult_column(s) - } -} - -func (p *SQLiteParser) Result_column() (localctx IResult_columnContext) { - this := p - _ = this - - localctx = NewResult_columnContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 98, SQLiteParserRULE_result_column) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1590) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 230, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1578) - p.Match(SQLiteParserSTAR) - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1579) - p.Table_name() - } - { - p.SetState(1580) - p.Match(SQLiteParserDOT) - } - { - p.SetState(1581) - p.Match(SQLiteParserSTAR) - } - - case 3: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1583) - p.expr(0) - } - p.SetState(1588) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1585) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ { - { - p.SetState(1584) - p.Match(SQLiteParserAS_) - } - - } - { - p.SetState(1587) - p.Column_alias() - } - - } - - } - - return localctx -} - -// IJoin_operatorContext is an interface to support dynamic dispatch. -type IJoin_operatorContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - COMMA() antlr.TerminalNode - JOIN_() antlr.TerminalNode - NATURAL_() antlr.TerminalNode - INNER_() antlr.TerminalNode - LEFT_() antlr.TerminalNode - RIGHT_() antlr.TerminalNode - FULL_() antlr.TerminalNode - OUTER_() antlr.TerminalNode - CROSS_() antlr.TerminalNode - - // IsJoin_operatorContext differentiates from other interfaces. - IsJoin_operatorContext() -} - -type Join_operatorContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyJoin_operatorContext() *Join_operatorContext { - var p = new(Join_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_join_operator - return p -} - -func (*Join_operatorContext) IsJoin_operatorContext() {} - -func NewJoin_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Join_operatorContext { - var p = new(Join_operatorContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_join_operator - - return p -} - -func (s *Join_operatorContext) GetParser() antlr.Parser { return s.parser } - -func (s *Join_operatorContext) COMMA() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, 0) -} - -func (s *Join_operatorContext) JOIN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserJOIN_, 0) -} - -func (s *Join_operatorContext) NATURAL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNATURAL_, 0) -} - -func (s *Join_operatorContext) INNER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINNER_, 0) -} - -func (s *Join_operatorContext) LEFT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLEFT_, 0) -} - -func (s *Join_operatorContext) RIGHT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRIGHT_, 0) -} - -func (s *Join_operatorContext) FULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFULL_, 0) -} - -func (s *Join_operatorContext) OUTER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOUTER_, 0) -} - -func (s *Join_operatorContext) CROSS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCROSS_, 0) -} - -func (s *Join_operatorContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Join_operatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Join_operatorContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterJoin_operator(s) - } -} - -func (s *Join_operatorContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitJoin_operator(s) - } -} - -func (p *SQLiteParser) Join_operator() (localctx IJoin_operatorContext) { - this := p - _ = this - - localctx = NewJoin_operatorContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 100, SQLiteParserRULE_join_operator) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1606) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserCOMMA: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1592) - p.Match(SQLiteParserCOMMA) - } - - case SQLiteParserFULL_, SQLiteParserINNER_, SQLiteParserJOIN_, SQLiteParserLEFT_, SQLiteParserNATURAL_, SQLiteParserRIGHT_: - p.EnterOuterAlt(localctx, 2) - p.SetState(1594) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserNATURAL_ { - { - p.SetState(1593) - p.Match(SQLiteParserNATURAL_) - } - - } - p.SetState(1601) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserFULL_, SQLiteParserLEFT_, SQLiteParserRIGHT_: - { - p.SetState(1596) - _la = p.GetTokenStream().LA(1) - - if !((int64((_la-76)) & ^0x3f) == 0 && ((int64(1)<<(_la-76))&562949954469889) != 0) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - p.SetState(1598) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserOUTER_ { - { - p.SetState(1597) - p.Match(SQLiteParserOUTER_) - } - - } - - case SQLiteParserINNER_: - { - p.SetState(1600) - p.Match(SQLiteParserINNER_) - } - - case SQLiteParserJOIN_: - - default: - } - { - p.SetState(1603) - p.Match(SQLiteParserJOIN_) - } - - case SQLiteParserCROSS_: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1604) - p.Match(SQLiteParserCROSS_) - } - { - p.SetState(1605) - p.Match(SQLiteParserJOIN_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IJoin_constraintContext is an interface to support dynamic dispatch. -type IJoin_constraintContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ON_() antlr.TerminalNode - Expr() IExprContext - USING_() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - CLOSE_PAR() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsJoin_constraintContext differentiates from other interfaces. - IsJoin_constraintContext() -} - -type Join_constraintContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyJoin_constraintContext() *Join_constraintContext { - var p = new(Join_constraintContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_join_constraint - return p -} - -func (*Join_constraintContext) IsJoin_constraintContext() {} - -func NewJoin_constraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Join_constraintContext { - var p = new(Join_constraintContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_join_constraint - - return p -} - -func (s *Join_constraintContext) GetParser() antlr.Parser { return s.parser } - -func (s *Join_constraintContext) ON_() antlr.TerminalNode { - return s.GetToken(SQLiteParserON_, 0) -} - -func (s *Join_constraintContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Join_constraintContext) USING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUSING_, 0) -} - -func (s *Join_constraintContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Join_constraintContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Join_constraintContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Join_constraintContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Join_constraintContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Join_constraintContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Join_constraintContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Join_constraintContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Join_constraintContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterJoin_constraint(s) - } -} - -func (s *Join_constraintContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitJoin_constraint(s) - } -} - -func (p *SQLiteParser) Join_constraint() (localctx IJoin_constraintContext) { - this := p - _ = this - - localctx = NewJoin_constraintContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 102, SQLiteParserRULE_join_constraint) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(1622) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 236, p.GetParserRuleContext()) == 1 { - { - p.SetState(1608) - p.Match(SQLiteParserON_) - } - { - p.SetState(1609) - p.expr(0) - } - - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 236, p.GetParserRuleContext()) == 2 { - { - p.SetState(1610) - p.Match(SQLiteParserUSING_) - } - { - p.SetState(1611) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1612) - p.Column_name() - } - p.SetState(1617) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1613) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1614) - p.Column_name() - } - - p.SetState(1619) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1620) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - - return localctx -} - -// ICompound_operatorContext is an interface to support dynamic dispatch. -type ICompound_operatorContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - UNION_() antlr.TerminalNode - ALL_() antlr.TerminalNode - INTERSECT_() antlr.TerminalNode - EXCEPT_() antlr.TerminalNode - - // IsCompound_operatorContext differentiates from other interfaces. - IsCompound_operatorContext() -} - -type Compound_operatorContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCompound_operatorContext() *Compound_operatorContext { - var p = new(Compound_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_compound_operator - return p -} - -func (*Compound_operatorContext) IsCompound_operatorContext() {} - -func NewCompound_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Compound_operatorContext { - var p = new(Compound_operatorContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_compound_operator - - return p -} - -func (s *Compound_operatorContext) GetParser() antlr.Parser { return s.parser } - -func (s *Compound_operatorContext) UNION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNION_, 0) -} - -func (s *Compound_operatorContext) ALL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserALL_, 0) -} - -func (s *Compound_operatorContext) INTERSECT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINTERSECT_, 0) -} - -func (s *Compound_operatorContext) EXCEPT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXCEPT_, 0) -} - -func (s *Compound_operatorContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Compound_operatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Compound_operatorContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCompound_operator(s) - } -} - -func (s *Compound_operatorContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCompound_operator(s) - } -} - -func (p *SQLiteParser) Compound_operator() (localctx ICompound_operatorContext) { - this := p - _ = this - - localctx = NewCompound_operatorContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 104, SQLiteParserRULE_compound_operator) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1630) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserUNION_: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1624) - p.Match(SQLiteParserUNION_) - } - p.SetState(1626) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserALL_ { - { - p.SetState(1625) - p.Match(SQLiteParserALL_) - } - - } - - case SQLiteParserINTERSECT_: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1628) - p.Match(SQLiteParserINTERSECT_) - } - - case SQLiteParserEXCEPT_: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1629) - p.Match(SQLiteParserEXCEPT_) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IUpdate_stmtContext is an interface to support dynamic dispatch. -type IUpdate_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - UPDATE_() antlr.TerminalNode - Qualified_table_name() IQualified_table_nameContext - SET_() antlr.TerminalNode - AllASSIGN() []antlr.TerminalNode - ASSIGN(i int) antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - AllColumn_name_list() []IColumn_name_listContext - Column_name_list(i int) IColumn_name_listContext - With_clause() IWith_clauseContext - OR_() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - WHERE_() antlr.TerminalNode - Returning_clause() IReturning_clauseContext - ROLLBACK_() antlr.TerminalNode - ABORT_() antlr.TerminalNode - REPLACE_() antlr.TerminalNode - FAIL_() antlr.TerminalNode - IGNORE_() antlr.TerminalNode - - // IsUpdate_stmtContext differentiates from other interfaces. - IsUpdate_stmtContext() -} - -type Update_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyUpdate_stmtContext() *Update_stmtContext { - var p = new(Update_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_update_stmt - return p -} - -func (*Update_stmtContext) IsUpdate_stmtContext() {} - -func NewUpdate_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Update_stmtContext { - var p = new(Update_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_update_stmt - - return p -} - -func (s *Update_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Update_stmtContext) UPDATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUPDATE_, 0) -} - -func (s *Update_stmtContext) Qualified_table_name() IQualified_table_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IQualified_table_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IQualified_table_nameContext) -} - -func (s *Update_stmtContext) SET_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSET_, 0) -} - -func (s *Update_stmtContext) AllASSIGN() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserASSIGN) -} - -func (s *Update_stmtContext) ASSIGN(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserASSIGN, i) -} - -func (s *Update_stmtContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Update_stmtContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Update_stmtContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Update_stmtContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Update_stmtContext) AllColumn_name_list() []IColumn_name_listContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_name_listContext); ok { - len++ - } - } - - tst := make([]IColumn_name_listContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_name_listContext); ok { - tst[i] = t.(IColumn_name_listContext) - i++ - } - } - - return tst -} - -func (s *Update_stmtContext) Column_name_list(i int) IColumn_name_listContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_name_listContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_name_listContext) -} - -func (s *Update_stmtContext) With_clause() IWith_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWith_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWith_clauseContext) -} - -func (s *Update_stmtContext) OR_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOR_, 0) -} - -func (s *Update_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Update_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Update_stmtContext) WHERE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, 0) -} - -func (s *Update_stmtContext) Returning_clause() IReturning_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IReturning_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IReturning_clauseContext) -} - -func (s *Update_stmtContext) ROLLBACK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROLLBACK_, 0) -} - -func (s *Update_stmtContext) ABORT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserABORT_, 0) -} - -func (s *Update_stmtContext) REPLACE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREPLACE_, 0) -} - -func (s *Update_stmtContext) FAIL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFAIL_, 0) -} - -func (s *Update_stmtContext) IGNORE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIGNORE_, 0) -} - -func (s *Update_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Update_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Update_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterUpdate_stmt(s) - } -} - -func (s *Update_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitUpdate_stmt(s) - } -} - -func (p *SQLiteParser) Update_stmt() (localctx IUpdate_stmtContext) { - this := p - _ = this - - localctx = NewUpdate_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 106, SQLiteParserRULE_update_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(1633) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(1632) - p.With_clause() - } - - } - { - p.SetState(1635) - p.Match(SQLiteParserUPDATE_) - } - p.SetState(1638) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 240, p.GetParserRuleContext()) == 1 { - { - p.SetState(1636) - p.Match(SQLiteParserOR_) - } - { - p.SetState(1637) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserABORT_ || ((int64((_la-72)) & ^0x3f) == 0 && ((int64(1)<<(_la-72))&19140298416325121) != 0)) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - { - p.SetState(1640) - p.Qualified_table_name() - } - { - p.SetState(1641) - p.Match(SQLiteParserSET_) - } - p.SetState(1644) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 241, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1642) - p.Column_name() - } - - case 2: - { - p.SetState(1643) - p.Column_name_list() - } - - } - { - p.SetState(1646) - p.Match(SQLiteParserASSIGN) - } - { - p.SetState(1647) - p.expr(0) - } - p.SetState(1658) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1648) - p.Match(SQLiteParserCOMMA) - } - p.SetState(1651) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 242, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1649) - p.Column_name() - } - - case 2: - { - p.SetState(1650) - p.Column_name_list() - } - - } - { - p.SetState(1653) - p.Match(SQLiteParserASSIGN) - } - { - p.SetState(1654) - p.expr(0) - } - - p.SetState(1660) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - p.SetState(1663) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHERE_ { - { - p.SetState(1661) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(1662) - p.expr(0) - } - - } - p.SetState(1666) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserRETURNING_ { - { - p.SetState(1665) - p.Returning_clause() - } - - } - - return localctx -} - -// IColumn_name_listContext is an interface to support dynamic dispatch. -type IColumn_name_listContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - OPEN_PAR() antlr.TerminalNode - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - CLOSE_PAR() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsColumn_name_listContext differentiates from other interfaces. - IsColumn_name_listContext() -} - -type Column_name_listContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyColumn_name_listContext() *Column_name_listContext { - var p = new(Column_name_listContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_column_name_list - return p -} - -func (*Column_name_listContext) IsColumn_name_listContext() {} - -func NewColumn_name_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_name_listContext { - var p = new(Column_name_listContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_column_name_list - - return p -} - -func (s *Column_name_listContext) GetParser() antlr.Parser { return s.parser } - -func (s *Column_name_listContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Column_name_listContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Column_name_listContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Column_name_listContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Column_name_listContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Column_name_listContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Column_name_listContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Column_name_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Column_name_listContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterColumn_name_list(s) - } -} - -func (s *Column_name_listContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitColumn_name_list(s) - } -} - -func (p *SQLiteParser) Column_name_list() (localctx IColumn_name_listContext) { - this := p - _ = this - - localctx = NewColumn_name_listContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 108, SQLiteParserRULE_column_name_list) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1668) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1669) - p.Column_name() - } - p.SetState(1674) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1670) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1671) - p.Column_name() - } - - p.SetState(1676) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - { - p.SetState(1677) - p.Match(SQLiteParserCLOSE_PAR) - } - - return localctx -} - -// IUpdate_stmt_limitedContext is an interface to support dynamic dispatch. -type IUpdate_stmt_limitedContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - UPDATE_() antlr.TerminalNode - Qualified_table_name() IQualified_table_nameContext - SET_() antlr.TerminalNode - AllASSIGN() []antlr.TerminalNode - ASSIGN(i int) antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - AllColumn_name() []IColumn_nameContext - Column_name(i int) IColumn_nameContext - AllColumn_name_list() []IColumn_name_listContext - Column_name_list(i int) IColumn_name_listContext - With_clause() IWith_clauseContext - OR_() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - WHERE_() antlr.TerminalNode - Limit_stmt() ILimit_stmtContext - ROLLBACK_() antlr.TerminalNode - ABORT_() antlr.TerminalNode - REPLACE_() antlr.TerminalNode - FAIL_() antlr.TerminalNode - IGNORE_() antlr.TerminalNode - Order_by_stmt() IOrder_by_stmtContext - - // IsUpdate_stmt_limitedContext differentiates from other interfaces. - IsUpdate_stmt_limitedContext() -} - -type Update_stmt_limitedContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyUpdate_stmt_limitedContext() *Update_stmt_limitedContext { - var p = new(Update_stmt_limitedContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_update_stmt_limited - return p -} - -func (*Update_stmt_limitedContext) IsUpdate_stmt_limitedContext() {} - -func NewUpdate_stmt_limitedContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Update_stmt_limitedContext { - var p = new(Update_stmt_limitedContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_update_stmt_limited - - return p -} - -func (s *Update_stmt_limitedContext) GetParser() antlr.Parser { return s.parser } - -func (s *Update_stmt_limitedContext) UPDATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUPDATE_, 0) -} - -func (s *Update_stmt_limitedContext) Qualified_table_name() IQualified_table_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IQualified_table_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IQualified_table_nameContext) -} - -func (s *Update_stmt_limitedContext) SET_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSET_, 0) -} - -func (s *Update_stmt_limitedContext) AllASSIGN() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserASSIGN) -} - -func (s *Update_stmt_limitedContext) ASSIGN(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserASSIGN, i) -} - -func (s *Update_stmt_limitedContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Update_stmt_limitedContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Update_stmt_limitedContext) AllColumn_name() []IColumn_nameContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_nameContext); ok { - len++ - } - } - - tst := make([]IColumn_nameContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_nameContext); ok { - tst[i] = t.(IColumn_nameContext) - i++ - } - } - - return tst -} - -func (s *Update_stmt_limitedContext) Column_name(i int) IColumn_nameContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_nameContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_nameContext) -} - -func (s *Update_stmt_limitedContext) AllColumn_name_list() []IColumn_name_listContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IColumn_name_listContext); ok { - len++ - } - } - - tst := make([]IColumn_name_listContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IColumn_name_listContext); ok { - tst[i] = t.(IColumn_name_listContext) - i++ - } - } - - return tst -} - -func (s *Update_stmt_limitedContext) Column_name_list(i int) IColumn_name_listContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_name_listContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IColumn_name_listContext) -} - -func (s *Update_stmt_limitedContext) With_clause() IWith_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWith_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWith_clauseContext) -} - -func (s *Update_stmt_limitedContext) OR_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOR_, 0) -} - -func (s *Update_stmt_limitedContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Update_stmt_limitedContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Update_stmt_limitedContext) WHERE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, 0) -} - -func (s *Update_stmt_limitedContext) Limit_stmt() ILimit_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ILimit_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ILimit_stmtContext) -} - -func (s *Update_stmt_limitedContext) ROLLBACK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROLLBACK_, 0) -} - -func (s *Update_stmt_limitedContext) ABORT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserABORT_, 0) -} - -func (s *Update_stmt_limitedContext) REPLACE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREPLACE_, 0) -} - -func (s *Update_stmt_limitedContext) FAIL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFAIL_, 0) -} - -func (s *Update_stmt_limitedContext) IGNORE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIGNORE_, 0) -} - -func (s *Update_stmt_limitedContext) Order_by_stmt() IOrder_by_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrder_by_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOrder_by_stmtContext) -} - -func (s *Update_stmt_limitedContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Update_stmt_limitedContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Update_stmt_limitedContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterUpdate_stmt_limited(s) - } -} - -func (s *Update_stmt_limitedContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitUpdate_stmt_limited(s) - } -} - -func (p *SQLiteParser) Update_stmt_limited() (localctx IUpdate_stmt_limitedContext) { - this := p - _ = this - - localctx = NewUpdate_stmt_limitedContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 110, SQLiteParserRULE_update_stmt_limited) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(1680) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWITH_ { - { - p.SetState(1679) - p.With_clause() - } - - } - { - p.SetState(1682) - p.Match(SQLiteParserUPDATE_) - } - p.SetState(1685) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 248, p.GetParserRuleContext()) == 1 { - { - p.SetState(1683) - p.Match(SQLiteParserOR_) - } - { - p.SetState(1684) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserABORT_ || ((int64((_la-72)) & ^0x3f) == 0 && ((int64(1)<<(_la-72))&19140298416325121) != 0)) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - { - p.SetState(1687) - p.Qualified_table_name() - } - { - p.SetState(1688) - p.Match(SQLiteParserSET_) - } - p.SetState(1691) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 249, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1689) - p.Column_name() - } - - case 2: - { - p.SetState(1690) - p.Column_name_list() - } - - } - { - p.SetState(1693) - p.Match(SQLiteParserASSIGN) - } - { - p.SetState(1694) - p.expr(0) - } - p.SetState(1705) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1695) - p.Match(SQLiteParserCOMMA) - } - p.SetState(1698) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 250, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1696) - p.Column_name() - } - - case 2: - { - p.SetState(1697) - p.Column_name_list() - } - - } - { - p.SetState(1700) - p.Match(SQLiteParserASSIGN) - } - { - p.SetState(1701) - p.expr(0) - } - - p.SetState(1707) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - p.SetState(1710) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserWHERE_ { - { - p.SetState(1708) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(1709) - p.expr(0) - } - - } - p.SetState(1716) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserLIMIT_ || _la == SQLiteParserORDER_ { - p.SetState(1713) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserORDER_ { - { - p.SetState(1712) - p.Order_by_stmt() - } - - } - { - p.SetState(1715) - p.Limit_stmt() - } - - } - - return localctx -} - -// IQualified_table_nameContext is an interface to support dynamic dispatch. -type IQualified_table_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Table_name() ITable_nameContext - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - AS_() antlr.TerminalNode - Alias() IAliasContext - INDEXED_() antlr.TerminalNode - BY_() antlr.TerminalNode - Index_name() IIndex_nameContext - NOT_() antlr.TerminalNode - - // IsQualified_table_nameContext differentiates from other interfaces. - IsQualified_table_nameContext() -} - -type Qualified_table_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyQualified_table_nameContext() *Qualified_table_nameContext { - var p = new(Qualified_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_qualified_table_name - return p -} - -func (*Qualified_table_nameContext) IsQualified_table_nameContext() {} - -func NewQualified_table_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Qualified_table_nameContext { - var p = new(Qualified_table_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_qualified_table_name - - return p -} - -func (s *Qualified_table_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Qualified_table_nameContext) Table_name() ITable_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ITable_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ITable_nameContext) -} - -func (s *Qualified_table_nameContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Qualified_table_nameContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Qualified_table_nameContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *Qualified_table_nameContext) Alias() IAliasContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAliasContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAliasContext) -} - -func (s *Qualified_table_nameContext) INDEXED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINDEXED_, 0) -} - -func (s *Qualified_table_nameContext) BY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, 0) -} - -func (s *Qualified_table_nameContext) Index_name() IIndex_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IIndex_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IIndex_nameContext) -} - -func (s *Qualified_table_nameContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Qualified_table_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Qualified_table_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Qualified_table_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterQualified_table_name(s) - } -} - -func (s *Qualified_table_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitQualified_table_name(s) - } -} - -func (p *SQLiteParser) Qualified_table_name() (localctx IQualified_table_nameContext) { - this := p - _ = this - - localctx = NewQualified_table_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 112, SQLiteParserRULE_qualified_table_name) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(1721) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 255, p.GetParserRuleContext()) == 1 { - { - p.SetState(1718) - p.Schema_name() - } - { - p.SetState(1719) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(1723) - p.Table_name() - } - p.SetState(1726) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserAS_ { - { - p.SetState(1724) - p.Match(SQLiteParserAS_) - } - { - p.SetState(1725) - p.Alias() - } - - } - p.SetState(1733) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserINDEXED_: - { - p.SetState(1728) - p.Match(SQLiteParserINDEXED_) - } - { - p.SetState(1729) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1730) - p.Index_name() - } - - case SQLiteParserNOT_: - { - p.SetState(1731) - p.Match(SQLiteParserNOT_) - } - { - p.SetState(1732) - p.Match(SQLiteParserINDEXED_) - } - - case SQLiteParserEOF, SQLiteParserSCOL, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserATTACH_, SQLiteParserBEGIN_, SQLiteParserCOMMIT_, SQLiteParserCREATE_, SQLiteParserDEFAULT_, SQLiteParserDELETE_, SQLiteParserDETACH_, SQLiteParserDROP_, SQLiteParserEND_, SQLiteParserEXPLAIN_, SQLiteParserINSERT_, SQLiteParserLIMIT_, SQLiteParserORDER_, SQLiteParserPRAGMA_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserREPLACE_, SQLiteParserRETURNING_, SQLiteParserROLLBACK_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserUPDATE_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserWHERE_, SQLiteParserWITH_: - - default: - } - - return localctx -} - -// IVacuum_stmtContext is an interface to support dynamic dispatch. -type IVacuum_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - VACUUM_() antlr.TerminalNode - Schema_name() ISchema_nameContext - INTO_() antlr.TerminalNode - Filename() IFilenameContext - - // IsVacuum_stmtContext differentiates from other interfaces. - IsVacuum_stmtContext() -} - -type Vacuum_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyVacuum_stmtContext() *Vacuum_stmtContext { - var p = new(Vacuum_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_vacuum_stmt - return p -} - -func (*Vacuum_stmtContext) IsVacuum_stmtContext() {} - -func NewVacuum_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Vacuum_stmtContext { - var p = new(Vacuum_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_vacuum_stmt - - return p -} - -func (s *Vacuum_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Vacuum_stmtContext) VACUUM_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVACUUM_, 0) -} - -func (s *Vacuum_stmtContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Vacuum_stmtContext) INTO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINTO_, 0) -} - -func (s *Vacuum_stmtContext) Filename() IFilenameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFilenameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFilenameContext) -} - -func (s *Vacuum_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Vacuum_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Vacuum_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterVacuum_stmt(s) - } -} - -func (s *Vacuum_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitVacuum_stmt(s) - } -} - -func (p *SQLiteParser) Vacuum_stmt() (localctx IVacuum_stmtContext) { - this := p - _ = this - - localctx = NewVacuum_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 114, SQLiteParserRULE_vacuum_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1735) - p.Match(SQLiteParserVACUUM_) - } - p.SetState(1737) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 258, p.GetParserRuleContext()) == 1 { - { - p.SetState(1736) - p.Schema_name() - } - - } - p.SetState(1741) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserINTO_ { - { - p.SetState(1739) - p.Match(SQLiteParserINTO_) - } - { - p.SetState(1740) - p.Filename() - } - - } - - return localctx -} - -// IFilter_clauseContext is an interface to support dynamic dispatch. -type IFilter_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - FILTER_() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - WHERE_() antlr.TerminalNode - Expr() IExprContext - CLOSE_PAR() antlr.TerminalNode - - // IsFilter_clauseContext differentiates from other interfaces. - IsFilter_clauseContext() -} - -type Filter_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFilter_clauseContext() *Filter_clauseContext { - var p = new(Filter_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_filter_clause - return p -} - -func (*Filter_clauseContext) IsFilter_clauseContext() {} - -func NewFilter_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Filter_clauseContext { - var p = new(Filter_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_filter_clause - - return p -} - -func (s *Filter_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *Filter_clauseContext) FILTER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFILTER_, 0) -} - -func (s *Filter_clauseContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Filter_clauseContext) WHERE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, 0) -} - -func (s *Filter_clauseContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Filter_clauseContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Filter_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Filter_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Filter_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFilter_clause(s) - } -} - -func (s *Filter_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFilter_clause(s) - } -} - -func (p *SQLiteParser) Filter_clause() (localctx IFilter_clauseContext) { - this := p - _ = this - - localctx = NewFilter_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 116, SQLiteParserRULE_filter_clause) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1743) - p.Match(SQLiteParserFILTER_) - } - { - p.SetState(1744) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1745) - p.Match(SQLiteParserWHERE_) - } - { - p.SetState(1746) - p.expr(0) - } - { - p.SetState(1747) - p.Match(SQLiteParserCLOSE_PAR) - } - - return localctx -} - -// IWindow_defnContext is an interface to support dynamic dispatch. -type IWindow_defnContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - OPEN_PAR() antlr.TerminalNode - CLOSE_PAR() antlr.TerminalNode - ORDER_() antlr.TerminalNode - AllBY_() []antlr.TerminalNode - BY_(i int) antlr.TerminalNode - AllOrdering_term() []IOrdering_termContext - Ordering_term(i int) IOrdering_termContext - Base_window_name() IBase_window_nameContext - PARTITION_() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - Frame_spec() IFrame_specContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsWindow_defnContext differentiates from other interfaces. - IsWindow_defnContext() -} - -type Window_defnContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyWindow_defnContext() *Window_defnContext { - var p = new(Window_defnContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_window_defn - return p -} - -func (*Window_defnContext) IsWindow_defnContext() {} - -func NewWindow_defnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_defnContext { - var p = new(Window_defnContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_window_defn - - return p -} - -func (s *Window_defnContext) GetParser() antlr.Parser { return s.parser } - -func (s *Window_defnContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Window_defnContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Window_defnContext) ORDER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserORDER_, 0) -} - -func (s *Window_defnContext) AllBY_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserBY_) -} - -func (s *Window_defnContext) BY_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, i) -} - -func (s *Window_defnContext) AllOrdering_term() []IOrdering_termContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IOrdering_termContext); ok { - len++ - } - } - - tst := make([]IOrdering_termContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IOrdering_termContext); ok { - tst[i] = t.(IOrdering_termContext) - i++ - } - } - - return tst -} - -func (s *Window_defnContext) Ordering_term(i int) IOrdering_termContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrdering_termContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IOrdering_termContext) -} - -func (s *Window_defnContext) Base_window_name() IBase_window_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IBase_window_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IBase_window_nameContext) -} - -func (s *Window_defnContext) PARTITION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPARTITION_, 0) -} - -func (s *Window_defnContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Window_defnContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Window_defnContext) Frame_spec() IFrame_specContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFrame_specContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFrame_specContext) -} - -func (s *Window_defnContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Window_defnContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Window_defnContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Window_defnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Window_defnContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterWindow_defn(s) - } -} - -func (s *Window_defnContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitWindow_defn(s) - } -} - -func (p *SQLiteParser) Window_defn() (localctx IWindow_defnContext) { - this := p - _ = this - - localctx = NewWindow_defnContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 118, SQLiteParserRULE_window_defn) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1749) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1751) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 260, p.GetParserRuleContext()) == 1 { - { - p.SetState(1750) - p.Base_window_name() - } - - } - p.SetState(1763) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPARTITION_ { - { - p.SetState(1753) - p.Match(SQLiteParserPARTITION_) - } - { - p.SetState(1754) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1755) - p.expr(0) - } - p.SetState(1760) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1756) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1757) - p.expr(0) - } - - p.SetState(1762) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - } - - { - p.SetState(1765) - p.Match(SQLiteParserORDER_) - } - { - p.SetState(1766) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1767) - p.Ordering_term() - } - p.SetState(1772) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1768) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1769) - p.Ordering_term() - } - - p.SetState(1774) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - p.SetState(1776) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if (int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0 { - { - p.SetState(1775) - p.Frame_spec() - } - - } - { - p.SetState(1778) - p.Match(SQLiteParserCLOSE_PAR) - } - - return localctx -} - -// IOver_clauseContext is an interface to support dynamic dispatch. -type IOver_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - OVER_() antlr.TerminalNode - Window_name() IWindow_nameContext - OPEN_PAR() antlr.TerminalNode - CLOSE_PAR() antlr.TerminalNode - Base_window_name() IBase_window_nameContext - PARTITION_() antlr.TerminalNode - AllBY_() []antlr.TerminalNode - BY_(i int) antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - ORDER_() antlr.TerminalNode - AllOrdering_term() []IOrdering_termContext - Ordering_term(i int) IOrdering_termContext - Frame_spec() IFrame_specContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsOver_clauseContext differentiates from other interfaces. - IsOver_clauseContext() -} - -type Over_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyOver_clauseContext() *Over_clauseContext { - var p = new(Over_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_over_clause - return p -} - -func (*Over_clauseContext) IsOver_clauseContext() {} - -func NewOver_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Over_clauseContext { - var p = new(Over_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_over_clause - - return p -} - -func (s *Over_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *Over_clauseContext) OVER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOVER_, 0) -} - -func (s *Over_clauseContext) Window_name() IWindow_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWindow_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWindow_nameContext) -} - -func (s *Over_clauseContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Over_clauseContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Over_clauseContext) Base_window_name() IBase_window_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IBase_window_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IBase_window_nameContext) -} - -func (s *Over_clauseContext) PARTITION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPARTITION_, 0) -} - -func (s *Over_clauseContext) AllBY_() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserBY_) -} - -func (s *Over_clauseContext) BY_(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, i) -} - -func (s *Over_clauseContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Over_clauseContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Over_clauseContext) ORDER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserORDER_, 0) -} - -func (s *Over_clauseContext) AllOrdering_term() []IOrdering_termContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IOrdering_termContext); ok { - len++ - } - } - - tst := make([]IOrdering_termContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IOrdering_termContext); ok { - tst[i] = t.(IOrdering_termContext) - i++ - } - } - - return tst -} - -func (s *Over_clauseContext) Ordering_term(i int) IOrdering_termContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrdering_termContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IOrdering_termContext) -} - -func (s *Over_clauseContext) Frame_spec() IFrame_specContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFrame_specContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFrame_specContext) -} - -func (s *Over_clauseContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Over_clauseContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Over_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Over_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Over_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterOver_clause(s) - } -} - -func (s *Over_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitOver_clause(s) - } -} - -func (p *SQLiteParser) Over_clause() (localctx IOver_clauseContext) { - this := p - _ = this - - localctx = NewOver_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 120, SQLiteParserRULE_over_clause) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1780) - p.Match(SQLiteParserOVER_) - } - p.SetState(1814) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 271, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1781) - p.Window_name() - } - - case 2: - { - p.SetState(1782) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1784) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 265, p.GetParserRuleContext()) == 1 { - { - p.SetState(1783) - p.Base_window_name() - } - - } - p.SetState(1796) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPARTITION_ { - { - p.SetState(1786) - p.Match(SQLiteParserPARTITION_) - } - { - p.SetState(1787) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1788) - p.expr(0) - } - p.SetState(1793) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1789) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1790) - p.expr(0) - } - - p.SetState(1795) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - } - p.SetState(1808) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserORDER_ { - { - p.SetState(1798) - p.Match(SQLiteParserORDER_) - } - { - p.SetState(1799) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1800) - p.Ordering_term() - } - p.SetState(1805) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1801) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1802) - p.Ordering_term() - } - - p.SetState(1807) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - } - p.SetState(1811) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if (int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0 { - { - p.SetState(1810) - p.Frame_spec() - } - - } - { - p.SetState(1813) - p.Match(SQLiteParserCLOSE_PAR) - } - - } - - return localctx -} - -// IFrame_specContext is an interface to support dynamic dispatch. -type IFrame_specContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Frame_clause() IFrame_clauseContext - EXCLUDE_() antlr.TerminalNode - CURRENT_() antlr.TerminalNode - ROW_() antlr.TerminalNode - GROUP_() antlr.TerminalNode - TIES_() antlr.TerminalNode - NO_() antlr.TerminalNode - OTHERS_() antlr.TerminalNode - - // IsFrame_specContext differentiates from other interfaces. - IsFrame_specContext() -} - -type Frame_specContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFrame_specContext() *Frame_specContext { - var p = new(Frame_specContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_frame_spec - return p -} - -func (*Frame_specContext) IsFrame_specContext() {} - -func NewFrame_specContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_specContext { - var p = new(Frame_specContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_frame_spec - - return p -} - -func (s *Frame_specContext) GetParser() antlr.Parser { return s.parser } - -func (s *Frame_specContext) Frame_clause() IFrame_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFrame_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFrame_clauseContext) -} - -func (s *Frame_specContext) EXCLUDE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXCLUDE_, 0) -} - -func (s *Frame_specContext) CURRENT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_, 0) -} - -func (s *Frame_specContext) ROW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROW_, 0) -} - -func (s *Frame_specContext) GROUP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGROUP_, 0) -} - -func (s *Frame_specContext) TIES_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTIES_, 0) -} - -func (s *Frame_specContext) NO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNO_, 0) -} - -func (s *Frame_specContext) OTHERS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOTHERS_, 0) -} - -func (s *Frame_specContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Frame_specContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Frame_specContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFrame_spec(s) - } -} - -func (s *Frame_specContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFrame_spec(s) - } -} - -func (p *SQLiteParser) Frame_spec() (localctx IFrame_specContext) { - this := p - _ = this - - localctx = NewFrame_specContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 122, SQLiteParserRULE_frame_spec) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1816) - p.Frame_clause() - } - p.SetState(1824) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserEXCLUDE_: - { - p.SetState(1817) - p.Match(SQLiteParserEXCLUDE_) - } - - { - p.SetState(1818) - p.Match(SQLiteParserNO_) - } - { - p.SetState(1819) - p.Match(SQLiteParserOTHERS_) - } - - case SQLiteParserCURRENT_: - { - p.SetState(1820) - p.Match(SQLiteParserCURRENT_) - } - { - p.SetState(1821) - p.Match(SQLiteParserROW_) - } - - case SQLiteParserGROUP_: - { - p.SetState(1822) - p.Match(SQLiteParserGROUP_) - } - - case SQLiteParserTIES_: - { - p.SetState(1823) - p.Match(SQLiteParserTIES_) - } - - case SQLiteParserCLOSE_PAR: - - default: - } - - return localctx -} - -// IFrame_clauseContext is an interface to support dynamic dispatch. -type IFrame_clauseContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - RANGE_() antlr.TerminalNode - ROWS_() antlr.TerminalNode - GROUPS_() antlr.TerminalNode - Frame_single() IFrame_singleContext - BETWEEN_() antlr.TerminalNode - Frame_left() IFrame_leftContext - AND_() antlr.TerminalNode - Frame_right() IFrame_rightContext - - // IsFrame_clauseContext differentiates from other interfaces. - IsFrame_clauseContext() -} - -type Frame_clauseContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFrame_clauseContext() *Frame_clauseContext { - var p = new(Frame_clauseContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_frame_clause - return p -} - -func (*Frame_clauseContext) IsFrame_clauseContext() {} - -func NewFrame_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_clauseContext { - var p = new(Frame_clauseContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_frame_clause - - return p -} - -func (s *Frame_clauseContext) GetParser() antlr.Parser { return s.parser } - -func (s *Frame_clauseContext) RANGE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRANGE_, 0) -} - -func (s *Frame_clauseContext) ROWS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROWS_, 0) -} - -func (s *Frame_clauseContext) GROUPS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGROUPS_, 0) -} - -func (s *Frame_clauseContext) Frame_single() IFrame_singleContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFrame_singleContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFrame_singleContext) -} - -func (s *Frame_clauseContext) BETWEEN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBETWEEN_, 0) -} - -func (s *Frame_clauseContext) Frame_left() IFrame_leftContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFrame_leftContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFrame_leftContext) -} - -func (s *Frame_clauseContext) AND_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAND_, 0) -} - -func (s *Frame_clauseContext) Frame_right() IFrame_rightContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFrame_rightContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFrame_rightContext) -} - -func (s *Frame_clauseContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Frame_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Frame_clauseContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFrame_clause(s) - } -} - -func (s *Frame_clauseContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFrame_clause(s) - } -} - -func (p *SQLiteParser) Frame_clause() (localctx IFrame_clauseContext) { - this := p - _ = this - - localctx = NewFrame_clauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 124, SQLiteParserRULE_frame_clause) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1826) - _la = p.GetTokenStream().LA(1) - - if !((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - p.SetState(1833) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 273, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1827) - p.Frame_single() - } - - case 2: - { - p.SetState(1828) - p.Match(SQLiteParserBETWEEN_) - } - { - p.SetState(1829) - p.Frame_left() - } - { - p.SetState(1830) - p.Match(SQLiteParserAND_) - } - { - p.SetState(1831) - p.Frame_right() - } - - } - - return localctx -} - -// ISimple_function_invocationContext is an interface to support dynamic dispatch. -type ISimple_function_invocationContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Simple_func() ISimple_funcContext - OPEN_PAR() antlr.TerminalNode - CLOSE_PAR() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - STAR() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsSimple_function_invocationContext differentiates from other interfaces. - IsSimple_function_invocationContext() -} - -type Simple_function_invocationContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySimple_function_invocationContext() *Simple_function_invocationContext { - var p = new(Simple_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_simple_function_invocation - return p -} - -func (*Simple_function_invocationContext) IsSimple_function_invocationContext() {} - -func NewSimple_function_invocationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Simple_function_invocationContext { - var p = new(Simple_function_invocationContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_simple_function_invocation - - return p -} - -func (s *Simple_function_invocationContext) GetParser() antlr.Parser { return s.parser } - -func (s *Simple_function_invocationContext) Simple_func() ISimple_funcContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISimple_funcContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISimple_funcContext) -} - -func (s *Simple_function_invocationContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Simple_function_invocationContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Simple_function_invocationContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Simple_function_invocationContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Simple_function_invocationContext) STAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTAR, 0) -} - -func (s *Simple_function_invocationContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Simple_function_invocationContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Simple_function_invocationContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Simple_function_invocationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Simple_function_invocationContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSimple_function_invocation(s) - } -} - -func (s *Simple_function_invocationContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSimple_function_invocation(s) - } -} - -func (p *SQLiteParser) Simple_function_invocation() (localctx ISimple_function_invocationContext) { - this := p - _ = this - - localctx = NewSimple_function_invocationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 126, SQLiteParserRULE_simple_function_invocation) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1835) - p.Simple_func() - } - { - p.SetState(1836) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1846) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: - { - p.SetState(1837) - p.expr(0) - } - p.SetState(1842) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1838) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1839) - p.expr(0) - } - - p.SetState(1844) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - case SQLiteParserSTAR: - { - p.SetState(1845) - p.Match(SQLiteParserSTAR) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - { - p.SetState(1848) - p.Match(SQLiteParserCLOSE_PAR) - } - - return localctx -} - -// IAggregate_function_invocationContext is an interface to support dynamic dispatch. -type IAggregate_function_invocationContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Aggregate_func() IAggregate_funcContext - OPEN_PAR() antlr.TerminalNode - CLOSE_PAR() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - STAR() antlr.TerminalNode - Filter_clause() IFilter_clauseContext - DISTINCT_() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsAggregate_function_invocationContext differentiates from other interfaces. - IsAggregate_function_invocationContext() -} - -type Aggregate_function_invocationContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyAggregate_function_invocationContext() *Aggregate_function_invocationContext { - var p = new(Aggregate_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_aggregate_function_invocation - return p -} - -func (*Aggregate_function_invocationContext) IsAggregate_function_invocationContext() {} - -func NewAggregate_function_invocationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggregate_function_invocationContext { - var p = new(Aggregate_function_invocationContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_aggregate_function_invocation - - return p -} - -func (s *Aggregate_function_invocationContext) GetParser() antlr.Parser { return s.parser } - -func (s *Aggregate_function_invocationContext) Aggregate_func() IAggregate_funcContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAggregate_funcContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAggregate_funcContext) -} - -func (s *Aggregate_function_invocationContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Aggregate_function_invocationContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Aggregate_function_invocationContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Aggregate_function_invocationContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Aggregate_function_invocationContext) STAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTAR, 0) -} - -func (s *Aggregate_function_invocationContext) Filter_clause() IFilter_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFilter_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFilter_clauseContext) -} - -func (s *Aggregate_function_invocationContext) DISTINCT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDISTINCT_, 0) -} - -func (s *Aggregate_function_invocationContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Aggregate_function_invocationContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Aggregate_function_invocationContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Aggregate_function_invocationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Aggregate_function_invocationContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterAggregate_function_invocation(s) - } -} - -func (s *Aggregate_function_invocationContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitAggregate_function_invocation(s) - } -} - -func (p *SQLiteParser) Aggregate_function_invocation() (localctx IAggregate_function_invocationContext) { - this := p - _ = this - - localctx = NewAggregate_function_invocationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 128, SQLiteParserRULE_aggregate_function_invocation) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1850) - p.Aggregate_func() - } - { - p.SetState(1851) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1864) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: - p.SetState(1853) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 276, p.GetParserRuleContext()) == 1 { - { - p.SetState(1852) - p.Match(SQLiteParserDISTINCT_) - } - - } - { - p.SetState(1855) - p.expr(0) - } - p.SetState(1860) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1856) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1857) - p.expr(0) - } - - p.SetState(1862) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - case SQLiteParserSTAR: - { - p.SetState(1863) - p.Match(SQLiteParserSTAR) - } - - case SQLiteParserCLOSE_PAR: - - default: - } - { - p.SetState(1866) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1868) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserFILTER_ { - { - p.SetState(1867) - p.Filter_clause() - } - - } - - return localctx -} - -// IWindow_function_invocationContext is an interface to support dynamic dispatch. -type IWindow_function_invocationContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Window_function() IWindow_functionContext - OPEN_PAR() antlr.TerminalNode - CLOSE_PAR() antlr.TerminalNode - OVER_() antlr.TerminalNode - Window_defn() IWindow_defnContext - Window_name() IWindow_nameContext - AllExpr() []IExprContext - Expr(i int) IExprContext - STAR() antlr.TerminalNode - Filter_clause() IFilter_clauseContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsWindow_function_invocationContext differentiates from other interfaces. - IsWindow_function_invocationContext() -} - -type Window_function_invocationContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyWindow_function_invocationContext() *Window_function_invocationContext { - var p = new(Window_function_invocationContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_window_function_invocation - return p -} - -func (*Window_function_invocationContext) IsWindow_function_invocationContext() {} - -func NewWindow_function_invocationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_function_invocationContext { - var p = new(Window_function_invocationContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_window_function_invocation - - return p -} - -func (s *Window_function_invocationContext) GetParser() antlr.Parser { return s.parser } - -func (s *Window_function_invocationContext) Window_function() IWindow_functionContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWindow_functionContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWindow_functionContext) -} - -func (s *Window_function_invocationContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Window_function_invocationContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Window_function_invocationContext) OVER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOVER_, 0) -} - -func (s *Window_function_invocationContext) Window_defn() IWindow_defnContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWindow_defnContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWindow_defnContext) -} - -func (s *Window_function_invocationContext) Window_name() IWindow_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IWindow_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IWindow_nameContext) -} - -func (s *Window_function_invocationContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Window_function_invocationContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Window_function_invocationContext) STAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTAR, 0) -} - -func (s *Window_function_invocationContext) Filter_clause() IFilter_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFilter_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFilter_clauseContext) -} - -func (s *Window_function_invocationContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Window_function_invocationContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Window_function_invocationContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Window_function_invocationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Window_function_invocationContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterWindow_function_invocation(s) - } -} - -func (s *Window_function_invocationContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitWindow_function_invocation(s) - } -} - -func (p *SQLiteParser) Window_function_invocation() (localctx IWindow_function_invocationContext) { - this := p - _ = this - - localctx = NewWindow_function_invocationContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 130, SQLiteParserRULE_window_function_invocation) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1870) - p.Window_function() - } - { - p.SetState(1871) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1881) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserOPEN_PAR, SQLiteParserPLUS, SQLiteParserMINUS, SQLiteParserTILDE, SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_, SQLiteParserIDENTIFIER, SQLiteParserNUMERIC_LITERAL, SQLiteParserNUMBERED_BIND_PARAMETER, SQLiteParserNAMED_BIND_PARAMETER, SQLiteParserSTRING_LITERAL, SQLiteParserBLOB_LITERAL: - { - p.SetState(1872) - p.expr(0) - } - p.SetState(1877) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1873) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1874) - p.expr(0) - } - - p.SetState(1879) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - case SQLiteParserSTAR: - { - p.SetState(1880) - p.Match(SQLiteParserSTAR) - } - - case SQLiteParserCLOSE_PAR: - - default: - } - { - p.SetState(1883) - p.Match(SQLiteParserCLOSE_PAR) - } - p.SetState(1885) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserFILTER_ { - { - p.SetState(1884) - p.Filter_clause() - } - - } - { - p.SetState(1887) - p.Match(SQLiteParserOVER_) - } - p.SetState(1890) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 283, p.GetParserRuleContext()) { - case 1: - { - p.SetState(1888) - p.Window_defn() - } - - case 2: - { - p.SetState(1889) - p.Window_name() - } - - } - - return localctx -} - -// ICommon_table_stmtContext is an interface to support dynamic dispatch. -type ICommon_table_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - WITH_() antlr.TerminalNode - AllCommon_table_expression() []ICommon_table_expressionContext - Common_table_expression(i int) ICommon_table_expressionContext - RECURSIVE_() antlr.TerminalNode - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsCommon_table_stmtContext differentiates from other interfaces. - IsCommon_table_stmtContext() -} - -type Common_table_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCommon_table_stmtContext() *Common_table_stmtContext { - var p = new(Common_table_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_common_table_stmt - return p -} - -func (*Common_table_stmtContext) IsCommon_table_stmtContext() {} - -func NewCommon_table_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Common_table_stmtContext { - var p = new(Common_table_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_common_table_stmt - - return p -} - -func (s *Common_table_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Common_table_stmtContext) WITH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWITH_, 0) -} - -func (s *Common_table_stmtContext) AllCommon_table_expression() []ICommon_table_expressionContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(ICommon_table_expressionContext); ok { - len++ - } - } - - tst := make([]ICommon_table_expressionContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(ICommon_table_expressionContext); ok { - tst[i] = t.(ICommon_table_expressionContext) - i++ - } - } - - return tst -} - -func (s *Common_table_stmtContext) Common_table_expression(i int) ICommon_table_expressionContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICommon_table_expressionContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(ICommon_table_expressionContext) -} - -func (s *Common_table_stmtContext) RECURSIVE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRECURSIVE_, 0) -} - -func (s *Common_table_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Common_table_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Common_table_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Common_table_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Common_table_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCommon_table_stmt(s) - } -} - -func (s *Common_table_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCommon_table_stmt(s) - } -} - -func (p *SQLiteParser) Common_table_stmt() (localctx ICommon_table_stmtContext) { - this := p - _ = this - - localctx = NewCommon_table_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 132, SQLiteParserRULE_common_table_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1892) - p.Match(SQLiteParserWITH_) - } - p.SetState(1894) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 284, p.GetParserRuleContext()) == 1 { - { - p.SetState(1893) - p.Match(SQLiteParserRECURSIVE_) - } - - } - { - p.SetState(1896) - p.Common_table_expression() - } - p.SetState(1901) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1897) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1898) - p.Common_table_expression() - } - - p.SetState(1903) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - return localctx -} - -// IOrder_by_stmtContext is an interface to support dynamic dispatch. -type IOrder_by_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ORDER_() antlr.TerminalNode - BY_() antlr.TerminalNode - AllOrdering_term() []IOrdering_termContext - Ordering_term(i int) IOrdering_termContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsOrder_by_stmtContext differentiates from other interfaces. - IsOrder_by_stmtContext() -} - -type Order_by_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyOrder_by_stmtContext() *Order_by_stmtContext { - var p = new(Order_by_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_order_by_stmt - return p -} - -func (*Order_by_stmtContext) IsOrder_by_stmtContext() {} - -func NewOrder_by_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Order_by_stmtContext { - var p = new(Order_by_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_order_by_stmt - - return p -} - -func (s *Order_by_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Order_by_stmtContext) ORDER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserORDER_, 0) -} - -func (s *Order_by_stmtContext) BY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, 0) -} - -func (s *Order_by_stmtContext) AllOrdering_term() []IOrdering_termContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IOrdering_termContext); ok { - len++ - } - } - - tst := make([]IOrdering_termContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IOrdering_termContext); ok { - tst[i] = t.(IOrdering_termContext) - i++ - } - } - - return tst -} - -func (s *Order_by_stmtContext) Ordering_term(i int) IOrdering_termContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrdering_termContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IOrdering_termContext) -} - -func (s *Order_by_stmtContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Order_by_stmtContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Order_by_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Order_by_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Order_by_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterOrder_by_stmt(s) - } -} - -func (s *Order_by_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitOrder_by_stmt(s) - } -} - -func (p *SQLiteParser) Order_by_stmt() (localctx IOrder_by_stmtContext) { - this := p - _ = this - - localctx = NewOrder_by_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 134, SQLiteParserRULE_order_by_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1904) - p.Match(SQLiteParserORDER_) - } - { - p.SetState(1905) - p.Match(SQLiteParserBY_) - } - { - p.SetState(1906) - p.Ordering_term() - } - p.SetState(1911) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(1907) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(1908) - p.Ordering_term() - } - - p.SetState(1913) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - return localctx -} - -// ILimit_stmtContext is an interface to support dynamic dispatch. -type ILimit_stmtContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - LIMIT_() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - OFFSET_() antlr.TerminalNode - COMMA() antlr.TerminalNode - - // IsLimit_stmtContext differentiates from other interfaces. - IsLimit_stmtContext() -} - -type Limit_stmtContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyLimit_stmtContext() *Limit_stmtContext { - var p = new(Limit_stmtContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_limit_stmt - return p -} - -func (*Limit_stmtContext) IsLimit_stmtContext() {} - -func NewLimit_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Limit_stmtContext { - var p = new(Limit_stmtContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_limit_stmt - - return p -} - -func (s *Limit_stmtContext) GetParser() antlr.Parser { return s.parser } - -func (s *Limit_stmtContext) LIMIT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLIMIT_, 0) -} - -func (s *Limit_stmtContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Limit_stmtContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Limit_stmtContext) OFFSET_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOFFSET_, 0) -} - -func (s *Limit_stmtContext) COMMA() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, 0) -} - -func (s *Limit_stmtContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Limit_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Limit_stmtContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterLimit_stmt(s) - } -} - -func (s *Limit_stmtContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitLimit_stmt(s) - } -} - -func (p *SQLiteParser) Limit_stmt() (localctx ILimit_stmtContext) { - this := p - _ = this - - localctx = NewLimit_stmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 136, SQLiteParserRULE_limit_stmt) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1914) - p.Match(SQLiteParserLIMIT_) - } - { - p.SetState(1915) - p.expr(0) - } - p.SetState(1918) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserCOMMA || _la == SQLiteParserOFFSET_ { - { - p.SetState(1916) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserCOMMA || _la == SQLiteParserOFFSET_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1917) - p.expr(0) - } - - } - - return localctx -} - -// IOrdering_termContext is an interface to support dynamic dispatch. -type IOrdering_termContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Expr() IExprContext - COLLATE_() antlr.TerminalNode - Collation_name() ICollation_nameContext - Asc_desc() IAsc_descContext - NULLS_() antlr.TerminalNode - FIRST_() antlr.TerminalNode - LAST_() antlr.TerminalNode - - // IsOrdering_termContext differentiates from other interfaces. - IsOrdering_termContext() -} - -type Ordering_termContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyOrdering_termContext() *Ordering_termContext { - var p = new(Ordering_termContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_ordering_term - return p -} - -func (*Ordering_termContext) IsOrdering_termContext() {} - -func NewOrdering_termContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Ordering_termContext { - var p = new(Ordering_termContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_ordering_term - - return p -} - -func (s *Ordering_termContext) GetParser() antlr.Parser { return s.parser } - -func (s *Ordering_termContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Ordering_termContext) COLLATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOLLATE_, 0) -} - -func (s *Ordering_termContext) Collation_name() ICollation_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ICollation_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ICollation_nameContext) -} - -func (s *Ordering_termContext) Asc_desc() IAsc_descContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAsc_descContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAsc_descContext) -} - -func (s *Ordering_termContext) NULLS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNULLS_, 0) -} - -func (s *Ordering_termContext) FIRST_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFIRST_, 0) -} - -func (s *Ordering_termContext) LAST_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLAST_, 0) -} - -func (s *Ordering_termContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Ordering_termContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Ordering_termContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterOrdering_term(s) - } -} - -func (s *Ordering_termContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitOrdering_term(s) - } -} - -func (p *SQLiteParser) Ordering_term() (localctx IOrdering_termContext) { - this := p - _ = this - - localctx = NewOrdering_termContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 138, SQLiteParserRULE_ordering_term) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1920) - p.expr(0) - } - p.SetState(1923) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserCOLLATE_ { - { - p.SetState(1921) - p.Match(SQLiteParserCOLLATE_) - } - { - p.SetState(1922) - p.Collation_name() - } - - } - p.SetState(1926) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { - { - p.SetState(1925) - p.Asc_desc() - } - - } - p.SetState(1930) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserNULLS_ { - { - p.SetState(1928) - p.Match(SQLiteParserNULLS_) - } - { - p.SetState(1929) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserFIRST_ || _la == SQLiteParserLAST_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - } - - return localctx -} - -// IAsc_descContext is an interface to support dynamic dispatch. -type IAsc_descContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ASC_() antlr.TerminalNode - DESC_() antlr.TerminalNode - - // IsAsc_descContext differentiates from other interfaces. - IsAsc_descContext() -} - -type Asc_descContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyAsc_descContext() *Asc_descContext { - var p = new(Asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_asc_desc - return p -} - -func (*Asc_descContext) IsAsc_descContext() {} - -func NewAsc_descContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Asc_descContext { - var p = new(Asc_descContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_asc_desc - - return p -} - -func (s *Asc_descContext) GetParser() antlr.Parser { return s.parser } - -func (s *Asc_descContext) ASC_() antlr.TerminalNode { - return s.GetToken(SQLiteParserASC_, 0) -} - -func (s *Asc_descContext) DESC_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDESC_, 0) -} - -func (s *Asc_descContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Asc_descContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Asc_descContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterAsc_desc(s) - } -} - -func (s *Asc_descContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitAsc_desc(s) - } -} - -func (p *SQLiteParser) Asc_desc() (localctx IAsc_descContext) { - this := p - _ = this - - localctx = NewAsc_descContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 140, SQLiteParserRULE_asc_desc) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1932) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserASC_ || _la == SQLiteParserDESC_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - return localctx -} - -// IFrame_leftContext is an interface to support dynamic dispatch. -type IFrame_leftContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Expr() IExprContext - PRECEDING_() antlr.TerminalNode - FOLLOWING_() antlr.TerminalNode - CURRENT_() antlr.TerminalNode - ROW_() antlr.TerminalNode - UNBOUNDED_() antlr.TerminalNode - - // IsFrame_leftContext differentiates from other interfaces. - IsFrame_leftContext() -} - -type Frame_leftContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFrame_leftContext() *Frame_leftContext { - var p = new(Frame_leftContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_frame_left - return p -} - -func (*Frame_leftContext) IsFrame_leftContext() {} - -func NewFrame_leftContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_leftContext { - var p = new(Frame_leftContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_frame_left - - return p -} - -func (s *Frame_leftContext) GetParser() antlr.Parser { return s.parser } - -func (s *Frame_leftContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Frame_leftContext) PRECEDING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRECEDING_, 0) -} - -func (s *Frame_leftContext) FOLLOWING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFOLLOWING_, 0) -} - -func (s *Frame_leftContext) CURRENT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_, 0) -} - -func (s *Frame_leftContext) ROW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROW_, 0) -} - -func (s *Frame_leftContext) UNBOUNDED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNBOUNDED_, 0) -} - -func (s *Frame_leftContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Frame_leftContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Frame_leftContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFrame_left(s) - } -} - -func (s *Frame_leftContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFrame_left(s) - } -} - -func (p *SQLiteParser) Frame_left() (localctx IFrame_leftContext) { - this := p - _ = this - - localctx = NewFrame_leftContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 142, SQLiteParserRULE_frame_left) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1944) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 291, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1934) - p.expr(0) - } - { - p.SetState(1935) - p.Match(SQLiteParserPRECEDING_) - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1937) - p.expr(0) - } - { - p.SetState(1938) - p.Match(SQLiteParserFOLLOWING_) - } - - case 3: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1940) - p.Match(SQLiteParserCURRENT_) - } - { - p.SetState(1941) - p.Match(SQLiteParserROW_) - } - - case 4: - p.EnterOuterAlt(localctx, 4) - { - p.SetState(1942) - p.Match(SQLiteParserUNBOUNDED_) - } - { - p.SetState(1943) - p.Match(SQLiteParserPRECEDING_) - } - - } - - return localctx -} - -// IFrame_rightContext is an interface to support dynamic dispatch. -type IFrame_rightContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Expr() IExprContext - PRECEDING_() antlr.TerminalNode - FOLLOWING_() antlr.TerminalNode - CURRENT_() antlr.TerminalNode - ROW_() antlr.TerminalNode - UNBOUNDED_() antlr.TerminalNode - - // IsFrame_rightContext differentiates from other interfaces. - IsFrame_rightContext() -} - -type Frame_rightContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFrame_rightContext() *Frame_rightContext { - var p = new(Frame_rightContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_frame_right - return p -} - -func (*Frame_rightContext) IsFrame_rightContext() {} - -func NewFrame_rightContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_rightContext { - var p = new(Frame_rightContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_frame_right - - return p -} - -func (s *Frame_rightContext) GetParser() antlr.Parser { return s.parser } - -func (s *Frame_rightContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Frame_rightContext) PRECEDING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRECEDING_, 0) -} - -func (s *Frame_rightContext) FOLLOWING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFOLLOWING_, 0) -} - -func (s *Frame_rightContext) CURRENT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_, 0) -} - -func (s *Frame_rightContext) ROW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROW_, 0) -} - -func (s *Frame_rightContext) UNBOUNDED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNBOUNDED_, 0) -} - -func (s *Frame_rightContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Frame_rightContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Frame_rightContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFrame_right(s) - } -} - -func (s *Frame_rightContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFrame_right(s) - } -} - -func (p *SQLiteParser) Frame_right() (localctx IFrame_rightContext) { - this := p - _ = this - - localctx = NewFrame_rightContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 144, SQLiteParserRULE_frame_right) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1956) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 292, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1946) - p.expr(0) - } - { - p.SetState(1947) - p.Match(SQLiteParserPRECEDING_) - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1949) - p.expr(0) - } - { - p.SetState(1950) - p.Match(SQLiteParserFOLLOWING_) - } - - case 3: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1952) - p.Match(SQLiteParserCURRENT_) - } - { - p.SetState(1953) - p.Match(SQLiteParserROW_) - } - - case 4: - p.EnterOuterAlt(localctx, 4) - { - p.SetState(1954) - p.Match(SQLiteParserUNBOUNDED_) - } - { - p.SetState(1955) - p.Match(SQLiteParserFOLLOWING_) - } - - } - - return localctx -} - -// IFrame_singleContext is an interface to support dynamic dispatch. -type IFrame_singleContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Expr() IExprContext - PRECEDING_() antlr.TerminalNode - UNBOUNDED_() antlr.TerminalNode - CURRENT_() antlr.TerminalNode - ROW_() antlr.TerminalNode - - // IsFrame_singleContext differentiates from other interfaces. - IsFrame_singleContext() -} - -type Frame_singleContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFrame_singleContext() *Frame_singleContext { - var p = new(Frame_singleContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_frame_single - return p -} - -func (*Frame_singleContext) IsFrame_singleContext() {} - -func NewFrame_singleContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_singleContext { - var p = new(Frame_singleContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_frame_single - - return p -} - -func (s *Frame_singleContext) GetParser() antlr.Parser { return s.parser } - -func (s *Frame_singleContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Frame_singleContext) PRECEDING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRECEDING_, 0) -} - -func (s *Frame_singleContext) UNBOUNDED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNBOUNDED_, 0) -} - -func (s *Frame_singleContext) CURRENT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_, 0) -} - -func (s *Frame_singleContext) ROW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROW_, 0) -} - -func (s *Frame_singleContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Frame_singleContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Frame_singleContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFrame_single(s) - } -} - -func (s *Frame_singleContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFrame_single(s) - } -} - -func (p *SQLiteParser) Frame_single() (localctx IFrame_singleContext) { - this := p - _ = this - - localctx = NewFrame_singleContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 146, SQLiteParserRULE_frame_single) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(1965) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 293, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1958) - p.expr(0) - } - { - p.SetState(1959) - p.Match(SQLiteParserPRECEDING_) - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1961) - p.Match(SQLiteParserUNBOUNDED_) - } - { - p.SetState(1962) - p.Match(SQLiteParserPRECEDING_) - } - - case 3: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1963) - p.Match(SQLiteParserCURRENT_) - } - { - p.SetState(1964) - p.Match(SQLiteParserROW_) - } - - } - - return localctx -} - -// IWindow_functionContext is an interface to support dynamic dispatch. -type IWindow_functionContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - AllOPEN_PAR() []antlr.TerminalNode - OPEN_PAR(i int) antlr.TerminalNode - Expr() IExprContext - AllCLOSE_PAR() []antlr.TerminalNode - CLOSE_PAR(i int) antlr.TerminalNode - OVER_() antlr.TerminalNode - Order_by_expr_asc_desc() IOrder_by_expr_asc_descContext - FIRST_VALUE_() antlr.TerminalNode - LAST_VALUE_() antlr.TerminalNode - Partition_by() IPartition_byContext - Frame_clause() IFrame_clauseContext - CUME_DIST_() antlr.TerminalNode - PERCENT_RANK_() antlr.TerminalNode - Order_by_expr() IOrder_by_exprContext - DENSE_RANK_() antlr.TerminalNode - RANK_() antlr.TerminalNode - ROW_NUMBER_() antlr.TerminalNode - LAG_() antlr.TerminalNode - LEAD_() antlr.TerminalNode - Of_OF_fset() IOf_OF_fsetContext - Default_DEFAULT__value() IDefault_DEFAULT__valueContext - NTH_VALUE_() antlr.TerminalNode - COMMA() antlr.TerminalNode - Signed_number() ISigned_numberContext - NTILE_() antlr.TerminalNode - - // IsWindow_functionContext differentiates from other interfaces. - IsWindow_functionContext() -} - -type Window_functionContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyWindow_functionContext() *Window_functionContext { - var p = new(Window_functionContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_window_function - return p -} - -func (*Window_functionContext) IsWindow_functionContext() {} - -func NewWindow_functionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_functionContext { - var p = new(Window_functionContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_window_function - - return p -} - -func (s *Window_functionContext) GetParser() antlr.Parser { return s.parser } - -func (s *Window_functionContext) AllOPEN_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserOPEN_PAR) -} - -func (s *Window_functionContext) OPEN_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, i) -} - -func (s *Window_functionContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Window_functionContext) AllCLOSE_PAR() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCLOSE_PAR) -} - -func (s *Window_functionContext) CLOSE_PAR(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, i) -} - -func (s *Window_functionContext) OVER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOVER_, 0) -} - -func (s *Window_functionContext) Order_by_expr_asc_desc() IOrder_by_expr_asc_descContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrder_by_expr_asc_descContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOrder_by_expr_asc_descContext) -} - -func (s *Window_functionContext) FIRST_VALUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFIRST_VALUE_, 0) -} - -func (s *Window_functionContext) LAST_VALUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLAST_VALUE_, 0) -} - -func (s *Window_functionContext) Partition_by() IPartition_byContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IPartition_byContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IPartition_byContext) -} - -func (s *Window_functionContext) Frame_clause() IFrame_clauseContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFrame_clauseContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFrame_clauseContext) -} - -func (s *Window_functionContext) CUME_DIST_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCUME_DIST_, 0) -} - -func (s *Window_functionContext) PERCENT_RANK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPERCENT_RANK_, 0) -} - -func (s *Window_functionContext) Order_by_expr() IOrder_by_exprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrder_by_exprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOrder_by_exprContext) -} - -func (s *Window_functionContext) DENSE_RANK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDENSE_RANK_, 0) -} - -func (s *Window_functionContext) RANK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRANK_, 0) -} - -func (s *Window_functionContext) ROW_NUMBER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROW_NUMBER_, 0) -} - -func (s *Window_functionContext) LAG_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLAG_, 0) -} - -func (s *Window_functionContext) LEAD_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLEAD_, 0) -} - -func (s *Window_functionContext) Of_OF_fset() IOf_OF_fsetContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOf_OF_fsetContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOf_OF_fsetContext) -} - -func (s *Window_functionContext) Default_DEFAULT__value() IDefault_DEFAULT__valueContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IDefault_DEFAULT__valueContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IDefault_DEFAULT__valueContext) -} - -func (s *Window_functionContext) NTH_VALUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNTH_VALUE_, 0) -} - -func (s *Window_functionContext) COMMA() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, 0) -} - -func (s *Window_functionContext) Signed_number() ISigned_numberContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISigned_numberContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISigned_numberContext) -} - -func (s *Window_functionContext) NTILE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNTILE_, 0) -} - -func (s *Window_functionContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Window_functionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Window_functionContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterWindow_function(s) - } -} - -func (s *Window_functionContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitWindow_function(s) - } -} - -func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { - this := p - _ = this - - localctx = NewWindow_functionContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 148, SQLiteParserRULE_window_function) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(2052) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserFIRST_VALUE_, SQLiteParserLAST_VALUE_: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(1967) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserFIRST_VALUE_ || _la == SQLiteParserLAST_VALUE_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1968) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1969) - p.expr(0) - } - { - p.SetState(1970) - p.Match(SQLiteParserCLOSE_PAR) - } - { - p.SetState(1971) - p.Match(SQLiteParserOVER_) - } - { - p.SetState(1972) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1974) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPARTITION_ { - { - p.SetState(1973) - p.Partition_by() - } - - } - { - p.SetState(1976) - p.Order_by_expr_asc_desc() - } - p.SetState(1978) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if (int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0 { - { - p.SetState(1977) - p.Frame_clause() - } - - } - { - p.SetState(1980) - p.Match(SQLiteParserCLOSE_PAR) - } - - case SQLiteParserCUME_DIST_, SQLiteParserPERCENT_RANK_: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(1982) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserCUME_DIST_ || _la == SQLiteParserPERCENT_RANK_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1983) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1984) - p.Match(SQLiteParserCLOSE_PAR) - } - { - p.SetState(1985) - p.Match(SQLiteParserOVER_) - } - { - p.SetState(1986) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(1988) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPARTITION_ { - { - p.SetState(1987) - p.Partition_by() - } - - } - p.SetState(1991) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserORDER_ { - { - p.SetState(1990) - p.Order_by_expr() - } - - } - { - p.SetState(1993) - p.Match(SQLiteParserCLOSE_PAR) - } - - case SQLiteParserDENSE_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(1994) - _la = p.GetTokenStream().LA(1) - - if !((int64((_la-161)) & ^0x3f) == 0 && ((int64(1)<<(_la-161))&385) != 0) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(1995) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(1996) - p.Match(SQLiteParserCLOSE_PAR) - } - { - p.SetState(1997) - p.Match(SQLiteParserOVER_) - } - { - p.SetState(1998) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(2000) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPARTITION_ { - { - p.SetState(1999) - p.Partition_by() - } - - } - { - p.SetState(2002) - p.Order_by_expr_asc_desc() - } - { - p.SetState(2003) - p.Match(SQLiteParserCLOSE_PAR) - } - - case SQLiteParserLAG_, SQLiteParserLEAD_: - p.EnterOuterAlt(localctx, 4) - { - p.SetState(2005) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserLAG_ || _la == SQLiteParserLEAD_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(2006) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(2007) - p.expr(0) - } - p.SetState(2009) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 299, p.GetParserRuleContext()) == 1 { - { - p.SetState(2008) - p.Of_OF_fset() - } - - } - p.SetState(2012) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserCOMMA { - { - p.SetState(2011) - p.Default_DEFAULT__value() - } - - } - { - p.SetState(2014) - p.Match(SQLiteParserCLOSE_PAR) - } - { - p.SetState(2015) - p.Match(SQLiteParserOVER_) - } - { - p.SetState(2016) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(2018) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPARTITION_ { - { - p.SetState(2017) - p.Partition_by() - } - - } - { - p.SetState(2020) - p.Order_by_expr_asc_desc() - } - { - p.SetState(2021) - p.Match(SQLiteParserCLOSE_PAR) - } - - case SQLiteParserNTH_VALUE_: - p.EnterOuterAlt(localctx, 5) - { - p.SetState(2023) - p.Match(SQLiteParserNTH_VALUE_) - } - { - p.SetState(2024) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(2025) - p.expr(0) - } - { - p.SetState(2026) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(2027) - p.Signed_number() - } - { - p.SetState(2028) - p.Match(SQLiteParserCLOSE_PAR) - } - { - p.SetState(2029) - p.Match(SQLiteParserOVER_) - } - { - p.SetState(2030) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(2032) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPARTITION_ { - { - p.SetState(2031) - p.Partition_by() - } - - } - { - p.SetState(2034) - p.Order_by_expr_asc_desc() - } - p.SetState(2036) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if (int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&4503599761588225) != 0 { - { - p.SetState(2035) - p.Frame_clause() - } - - } - { - p.SetState(2038) - p.Match(SQLiteParserCLOSE_PAR) - } - - case SQLiteParserNTILE_: - p.EnterOuterAlt(localctx, 6) - { - p.SetState(2040) - p.Match(SQLiteParserNTILE_) - } - { - p.SetState(2041) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(2042) - p.expr(0) - } - { - p.SetState(2043) - p.Match(SQLiteParserCLOSE_PAR) - } - { - p.SetState(2044) - p.Match(SQLiteParserOVER_) - } - { - p.SetState(2045) - p.Match(SQLiteParserOPEN_PAR) - } - p.SetState(2047) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserPARTITION_ { - { - p.SetState(2046) - p.Partition_by() - } - - } - { - p.SetState(2049) - p.Order_by_expr_asc_desc() - } - { - p.SetState(2050) - p.Match(SQLiteParserCLOSE_PAR) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -// IOf_OF_fsetContext is an interface to support dynamic dispatch. -type IOf_OF_fsetContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - COMMA() antlr.TerminalNode - Signed_number() ISigned_numberContext - - // IsOf_OF_fsetContext differentiates from other interfaces. - IsOf_OF_fsetContext() -} - -type Of_OF_fsetContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyOf_OF_fsetContext() *Of_OF_fsetContext { - var p = new(Of_OF_fsetContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_of_OF_fset - return p -} - -func (*Of_OF_fsetContext) IsOf_OF_fsetContext() {} - -func NewOf_OF_fsetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Of_OF_fsetContext { - var p = new(Of_OF_fsetContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_of_OF_fset - - return p -} - -func (s *Of_OF_fsetContext) GetParser() antlr.Parser { return s.parser } - -func (s *Of_OF_fsetContext) COMMA() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, 0) -} - -func (s *Of_OF_fsetContext) Signed_number() ISigned_numberContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISigned_numberContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISigned_numberContext) -} - -func (s *Of_OF_fsetContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Of_OF_fsetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Of_OF_fsetContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterOf_OF_fset(s) - } -} - -func (s *Of_OF_fsetContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitOf_OF_fset(s) - } -} - -func (p *SQLiteParser) Of_OF_fset() (localctx IOf_OF_fsetContext) { - this := p - _ = this - - localctx = NewOf_OF_fsetContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 150, SQLiteParserRULE_of_OF_fset) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2054) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(2055) - p.Signed_number() - } - - return localctx -} - -// IDefault_DEFAULT__valueContext is an interface to support dynamic dispatch. -type IDefault_DEFAULT__valueContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - COMMA() antlr.TerminalNode - Signed_number() ISigned_numberContext - - // IsDefault_DEFAULT__valueContext differentiates from other interfaces. - IsDefault_DEFAULT__valueContext() -} - -type Default_DEFAULT__valueContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyDefault_DEFAULT__valueContext() *Default_DEFAULT__valueContext { - var p = new(Default_DEFAULT__valueContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_default_DEFAULT__value - return p -} - -func (*Default_DEFAULT__valueContext) IsDefault_DEFAULT__valueContext() {} - -func NewDefault_DEFAULT__valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Default_DEFAULT__valueContext { - var p = new(Default_DEFAULT__valueContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_default_DEFAULT__value - - return p -} - -func (s *Default_DEFAULT__valueContext) GetParser() antlr.Parser { return s.parser } - -func (s *Default_DEFAULT__valueContext) COMMA() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, 0) -} - -func (s *Default_DEFAULT__valueContext) Signed_number() ISigned_numberContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISigned_numberContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISigned_numberContext) -} - -func (s *Default_DEFAULT__valueContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Default_DEFAULT__valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Default_DEFAULT__valueContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterDefault_DEFAULT__value(s) - } -} - -func (s *Default_DEFAULT__valueContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitDefault_DEFAULT__value(s) - } -} - -func (p *SQLiteParser) Default_DEFAULT__value() (localctx IDefault_DEFAULT__valueContext) { - this := p - _ = this - - localctx = NewDefault_DEFAULT__valueContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 152, SQLiteParserRULE_default_DEFAULT__value) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2057) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(2058) - p.Signed_number() - } - - return localctx -} - -// IPartition_byContext is an interface to support dynamic dispatch. -type IPartition_byContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - PARTITION_() antlr.TerminalNode - BY_() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - - // IsPartition_byContext differentiates from other interfaces. - IsPartition_byContext() -} - -type Partition_byContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyPartition_byContext() *Partition_byContext { - var p = new(Partition_byContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_partition_by - return p -} - -func (*Partition_byContext) IsPartition_byContext() {} - -func NewPartition_byContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Partition_byContext { - var p = new(Partition_byContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_partition_by - - return p -} - -func (s *Partition_byContext) GetParser() antlr.Parser { return s.parser } - -func (s *Partition_byContext) PARTITION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPARTITION_, 0) -} - -func (s *Partition_byContext) BY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, 0) -} - -func (s *Partition_byContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Partition_byContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Partition_byContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Partition_byContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Partition_byContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterPartition_by(s) - } -} - -func (s *Partition_byContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitPartition_by(s) - } -} - -func (p *SQLiteParser) Partition_by() (localctx IPartition_byContext) { - this := p - _ = this - - localctx = NewPartition_byContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 154, SQLiteParserRULE_partition_by) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - var _alt int - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2060) - p.Match(SQLiteParserPARTITION_) - } - { - p.SetState(2061) - p.Match(SQLiteParserBY_) - } - p.SetState(2063) - p.GetErrorHandler().Sync(p) - _alt = 1 - for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - switch _alt { - case 1: - { - p.SetState(2062) - p.expr(0) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - p.SetState(2065) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 306, p.GetParserRuleContext()) - } - - return localctx -} - -// IOrder_by_exprContext is an interface to support dynamic dispatch. -type IOrder_by_exprContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ORDER_() antlr.TerminalNode - BY_() antlr.TerminalNode - AllExpr() []IExprContext - Expr(i int) IExprContext - - // IsOrder_by_exprContext differentiates from other interfaces. - IsOrder_by_exprContext() -} - -type Order_by_exprContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyOrder_by_exprContext() *Order_by_exprContext { - var p = new(Order_by_exprContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_order_by_expr - return p -} - -func (*Order_by_exprContext) IsOrder_by_exprContext() {} - -func NewOrder_by_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Order_by_exprContext { - var p = new(Order_by_exprContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_order_by_expr - - return p -} - -func (s *Order_by_exprContext) GetParser() antlr.Parser { return s.parser } - -func (s *Order_by_exprContext) ORDER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserORDER_, 0) -} - -func (s *Order_by_exprContext) BY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, 0) -} - -func (s *Order_by_exprContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Order_by_exprContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Order_by_exprContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Order_by_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Order_by_exprContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterOrder_by_expr(s) - } -} - -func (s *Order_by_exprContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitOrder_by_expr(s) - } -} - -func (p *SQLiteParser) Order_by_expr() (localctx IOrder_by_exprContext) { - this := p - _ = this - - localctx = NewOrder_by_exprContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 156, SQLiteParserRULE_order_by_expr) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2067) - p.Match(SQLiteParserORDER_) - } - { - p.SetState(2068) - p.Match(SQLiteParserBY_) - } - p.SetState(2070) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-33552632) != 0) || ((int64((_la-64)) & ^0x3f) == 0 && ((int64(1)<<(_la-64))&-1) != 0) || ((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&-270215977642229761) != 0) { - { - p.SetState(2069) - p.expr(0) - } - - p.SetState(2072) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - return localctx -} - -// IOrder_by_expr_asc_descContext is an interface to support dynamic dispatch. -type IOrder_by_expr_asc_descContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ORDER_() antlr.TerminalNode - BY_() antlr.TerminalNode - Order_by_expr_asc_desc() IOrder_by_expr_asc_descContext - - // IsOrder_by_expr_asc_descContext differentiates from other interfaces. - IsOrder_by_expr_asc_descContext() -} - -type Order_by_expr_asc_descContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyOrder_by_expr_asc_descContext() *Order_by_expr_asc_descContext { - var p = new(Order_by_expr_asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_order_by_expr_asc_desc - return p -} - -func (*Order_by_expr_asc_descContext) IsOrder_by_expr_asc_descContext() {} - -func NewOrder_by_expr_asc_descContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Order_by_expr_asc_descContext { - var p = new(Order_by_expr_asc_descContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_order_by_expr_asc_desc - - return p -} - -func (s *Order_by_expr_asc_descContext) GetParser() antlr.Parser { return s.parser } - -func (s *Order_by_expr_asc_descContext) ORDER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserORDER_, 0) -} - -func (s *Order_by_expr_asc_descContext) BY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, 0) -} - -func (s *Order_by_expr_asc_descContext) Order_by_expr_asc_desc() IOrder_by_expr_asc_descContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IOrder_by_expr_asc_descContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IOrder_by_expr_asc_descContext) -} - -func (s *Order_by_expr_asc_descContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Order_by_expr_asc_descContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Order_by_expr_asc_descContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterOrder_by_expr_asc_desc(s) - } -} - -func (s *Order_by_expr_asc_descContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitOrder_by_expr_asc_desc(s) - } -} - -func (p *SQLiteParser) Order_by_expr_asc_desc() (localctx IOrder_by_expr_asc_descContext) { - this := p - _ = this - - localctx = NewOrder_by_expr_asc_descContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 158, SQLiteParserRULE_order_by_expr_asc_desc) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2074) - p.Match(SQLiteParserORDER_) - } - { - p.SetState(2075) - p.Match(SQLiteParserBY_) - } - { - p.SetState(2076) - p.Order_by_expr_asc_desc() - } - - return localctx -} - -// IExpr_asc_descContext is an interface to support dynamic dispatch. -type IExpr_asc_descContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - AllExpr() []IExprContext - Expr(i int) IExprContext - AllAsc_desc() []IAsc_descContext - Asc_desc(i int) IAsc_descContext - AllCOMMA() []antlr.TerminalNode - COMMA(i int) antlr.TerminalNode - - // IsExpr_asc_descContext differentiates from other interfaces. - IsExpr_asc_descContext() -} - -type Expr_asc_descContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyExpr_asc_descContext() *Expr_asc_descContext { - var p = new(Expr_asc_descContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_expr_asc_desc - return p -} - -func (*Expr_asc_descContext) IsExpr_asc_descContext() {} - -func NewExpr_asc_descContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Expr_asc_descContext { - var p = new(Expr_asc_descContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_expr_asc_desc - - return p -} - -func (s *Expr_asc_descContext) GetParser() antlr.Parser { return s.parser } - -func (s *Expr_asc_descContext) AllExpr() []IExprContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IExprContext); ok { - len++ - } - } - - tst := make([]IExprContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IExprContext); ok { - tst[i] = t.(IExprContext) - i++ - } - } - - return tst -} - -func (s *Expr_asc_descContext) Expr(i int) IExprContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Expr_asc_descContext) AllAsc_desc() []IAsc_descContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IAsc_descContext); ok { - len++ - } - } - - tst := make([]IAsc_descContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IAsc_descContext); ok { - tst[i] = t.(IAsc_descContext) - i++ - } - } - - return tst -} - -func (s *Expr_asc_descContext) Asc_desc(i int) IAsc_descContext { - var t antlr.RuleContext - j := 0 - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAsc_descContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ - } - } - - if t == nil { - return nil - } - - return t.(IAsc_descContext) -} - -func (s *Expr_asc_descContext) AllCOMMA() []antlr.TerminalNode { - return s.GetTokens(SQLiteParserCOMMA) -} - -func (s *Expr_asc_descContext) COMMA(i int) antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMA, i) -} - -func (s *Expr_asc_descContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Expr_asc_descContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Expr_asc_descContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterExpr_asc_desc(s) - } -} - -func (s *Expr_asc_descContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitExpr_asc_desc(s) - } -} - -func (p *SQLiteParser) Expr_asc_desc() (localctx IExpr_asc_descContext) { - this := p - _ = this - - localctx = NewExpr_asc_descContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 160, SQLiteParserRULE_expr_asc_desc) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2078) - p.expr(0) - } - p.SetState(2080) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { - { - p.SetState(2079) - p.Asc_desc() - } - - } - p.SetState(2089) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - for _la == SQLiteParserCOMMA { - { - p.SetState(2082) - p.Match(SQLiteParserCOMMA) - } - { - p.SetState(2083) - p.expr(0) - } - p.SetState(2085) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { - { - p.SetState(2084) - p.Asc_desc() - } - - } - - p.SetState(2091) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - } - - return localctx -} - -// IInitial_selectContext is an interface to support dynamic dispatch. -type IInitial_selectContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Select_stmt() ISelect_stmtContext - - // IsInitial_selectContext differentiates from other interfaces. - IsInitial_selectContext() -} - -type Initial_selectContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyInitial_selectContext() *Initial_selectContext { - var p = new(Initial_selectContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_initial_select - return p -} - -func (*Initial_selectContext) IsInitial_selectContext() {} - -func NewInitial_selectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Initial_selectContext { - var p = new(Initial_selectContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_initial_select - - return p -} - -func (s *Initial_selectContext) GetParser() antlr.Parser { return s.parser } - -func (s *Initial_selectContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Initial_selectContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Initial_selectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Initial_selectContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterInitial_select(s) - } -} - -func (s *Initial_selectContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitInitial_select(s) - } -} - -func (p *SQLiteParser) Initial_select() (localctx IInitial_selectContext) { - this := p - _ = this - - localctx = NewInitial_selectContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 162, SQLiteParserRULE_initial_select) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2092) - p.Select_stmt() - } - - return localctx -} - -// IRecursive__selectContext is an interface to support dynamic dispatch. -type IRecursive__selectContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Select_stmt() ISelect_stmtContext - - // IsRecursive__selectContext differentiates from other interfaces. - IsRecursive__selectContext() -} - -type Recursive__selectContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyRecursive__selectContext() *Recursive__selectContext { - var p = new(Recursive__selectContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_recursive__select - return p -} - -func (*Recursive__selectContext) IsRecursive__selectContext() {} - -func NewRecursive__selectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Recursive__selectContext { - var p = new(Recursive__selectContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_recursive__select - - return p -} - -func (s *Recursive__selectContext) GetParser() antlr.Parser { return s.parser } - -func (s *Recursive__selectContext) Select_stmt() ISelect_stmtContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISelect_stmtContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISelect_stmtContext) -} - -func (s *Recursive__selectContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Recursive__selectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Recursive__selectContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterRecursive__select(s) - } -} - -func (s *Recursive__selectContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitRecursive__select(s) - } -} - -func (p *SQLiteParser) Recursive__select() (localctx IRecursive__selectContext) { - this := p - _ = this - - localctx = NewRecursive__selectContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 164, SQLiteParserRULE_recursive__select) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2094) - p.Select_stmt() - } - - return localctx -} - -// IUnary_operatorContext is an interface to support dynamic dispatch. -type IUnary_operatorContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - MINUS() antlr.TerminalNode - PLUS() antlr.TerminalNode - TILDE() antlr.TerminalNode - NOT_() antlr.TerminalNode - - // IsUnary_operatorContext differentiates from other interfaces. - IsUnary_operatorContext() -} - -type Unary_operatorContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyUnary_operatorContext() *Unary_operatorContext { - var p = new(Unary_operatorContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_unary_operator - return p -} - -func (*Unary_operatorContext) IsUnary_operatorContext() {} - -func NewUnary_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Unary_operatorContext { - var p = new(Unary_operatorContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_unary_operator - - return p -} - -func (s *Unary_operatorContext) GetParser() antlr.Parser { return s.parser } - -func (s *Unary_operatorContext) MINUS() antlr.TerminalNode { - return s.GetToken(SQLiteParserMINUS, 0) -} - -func (s *Unary_operatorContext) PLUS() antlr.TerminalNode { - return s.GetToken(SQLiteParserPLUS, 0) -} - -func (s *Unary_operatorContext) TILDE() antlr.TerminalNode { - return s.GetToken(SQLiteParserTILDE, 0) -} - -func (s *Unary_operatorContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *Unary_operatorContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Unary_operatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Unary_operatorContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterUnary_operator(s) - } -} - -func (s *Unary_operatorContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitUnary_operator(s) - } -} - -func (p *SQLiteParser) Unary_operator() (localctx IUnary_operatorContext) { - this := p - _ = this - - localctx = NewUnary_operatorContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 166, SQLiteParserRULE_unary_operator) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2096) - _la = p.GetTokenStream().LA(1) - - if !(((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1792) != 0) || _la == SQLiteParserNOT_) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - return localctx -} - -// IError_messageContext is an interface to support dynamic dispatch. -type IError_messageContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - STRING_LITERAL() antlr.TerminalNode - - // IsError_messageContext differentiates from other interfaces. - IsError_messageContext() -} - -type Error_messageContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyError_messageContext() *Error_messageContext { - var p = new(Error_messageContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_error_message - return p -} - -func (*Error_messageContext) IsError_messageContext() {} - -func NewError_messageContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Error_messageContext { - var p = new(Error_messageContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_error_message - - return p -} - -func (s *Error_messageContext) GetParser() antlr.Parser { return s.parser } - -func (s *Error_messageContext) STRING_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTRING_LITERAL, 0) -} - -func (s *Error_messageContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Error_messageContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Error_messageContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterError_message(s) - } -} - -func (s *Error_messageContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitError_message(s) - } -} - -func (p *SQLiteParser) Error_message() (localctx IError_messageContext) { - this := p - _ = this - - localctx = NewError_messageContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 168, SQLiteParserRULE_error_message) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2098) - p.Match(SQLiteParserSTRING_LITERAL) - } - - return localctx -} - -// IModule_argumentContext is an interface to support dynamic dispatch. -type IModule_argumentContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Expr() IExprContext - Column_def() IColumn_defContext - - // IsModule_argumentContext differentiates from other interfaces. - IsModule_argumentContext() -} - -type Module_argumentContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyModule_argumentContext() *Module_argumentContext { - var p = new(Module_argumentContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_module_argument - return p -} - -func (*Module_argumentContext) IsModule_argumentContext() {} - -func NewModule_argumentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Module_argumentContext { - var p = new(Module_argumentContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_module_argument - - return p -} - -func (s *Module_argumentContext) GetParser() antlr.Parser { return s.parser } - -func (s *Module_argumentContext) Expr() IExprContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IExprContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *Module_argumentContext) Column_def() IColumn_defContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IColumn_defContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IColumn_defContext) -} - -func (s *Module_argumentContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Module_argumentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Module_argumentContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterModule_argument(s) - } -} - -func (s *Module_argumentContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitModule_argument(s) - } -} - -func (p *SQLiteParser) Module_argument() (localctx IModule_argumentContext) { - this := p - _ = this - - localctx = NewModule_argumentContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 170, SQLiteParserRULE_module_argument) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(2102) - p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 311, p.GetParserRuleContext()) { - case 1: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2100) - p.expr(0) - } - - case 2: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(2101) - p.Column_def() - } - - } - - return localctx -} - -// IColumn_aliasContext is an interface to support dynamic dispatch. -type IColumn_aliasContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - IDENTIFIER() antlr.TerminalNode - STRING_LITERAL() antlr.TerminalNode - - // IsColumn_aliasContext differentiates from other interfaces. - IsColumn_aliasContext() -} - -type Column_aliasContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyColumn_aliasContext() *Column_aliasContext { - var p = new(Column_aliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_column_alias - return p -} - -func (*Column_aliasContext) IsColumn_aliasContext() {} - -func NewColumn_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_aliasContext { - var p = new(Column_aliasContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_column_alias - - return p -} - -func (s *Column_aliasContext) GetParser() antlr.Parser { return s.parser } - -func (s *Column_aliasContext) IDENTIFIER() antlr.TerminalNode { - return s.GetToken(SQLiteParserIDENTIFIER, 0) -} - -func (s *Column_aliasContext) STRING_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTRING_LITERAL, 0) -} - -func (s *Column_aliasContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Column_aliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Column_aliasContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterColumn_alias(s) - } -} - -func (s *Column_aliasContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitColumn_alias(s) - } -} - -func (p *SQLiteParser) Column_alias() (localctx IColumn_aliasContext) { - this := p - _ = this - - localctx = NewColumn_aliasContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 172, SQLiteParserRULE_column_alias) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2104) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - return localctx -} - -// IKeywordContext is an interface to support dynamic dispatch. -type IKeywordContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - ABORT_() antlr.TerminalNode - ACTION_() antlr.TerminalNode - ADD_() antlr.TerminalNode - AFTER_() antlr.TerminalNode - ALL_() antlr.TerminalNode - ALTER_() antlr.TerminalNode - ANALYZE_() antlr.TerminalNode - AND_() antlr.TerminalNode - AS_() antlr.TerminalNode - ASC_() antlr.TerminalNode - ATTACH_() antlr.TerminalNode - AUTOINCREMENT_() antlr.TerminalNode - BEFORE_() antlr.TerminalNode - BEGIN_() antlr.TerminalNode - BETWEEN_() antlr.TerminalNode - BY_() antlr.TerminalNode - CASCADE_() antlr.TerminalNode - CASE_() antlr.TerminalNode - CAST_() antlr.TerminalNode - CHECK_() antlr.TerminalNode - COLLATE_() antlr.TerminalNode - COLUMN_() antlr.TerminalNode - COMMIT_() antlr.TerminalNode - CONFLICT_() antlr.TerminalNode - CONSTRAINT_() antlr.TerminalNode - CREATE_() antlr.TerminalNode - CROSS_() antlr.TerminalNode - CURRENT_DATE_() antlr.TerminalNode - CURRENT_TIME_() antlr.TerminalNode - CURRENT_TIMESTAMP_() antlr.TerminalNode - DATABASE_() antlr.TerminalNode - DEFAULT_() antlr.TerminalNode - DEFERRABLE_() antlr.TerminalNode - DEFERRED_() antlr.TerminalNode - DELETE_() antlr.TerminalNode - DESC_() antlr.TerminalNode - DETACH_() antlr.TerminalNode - DISTINCT_() antlr.TerminalNode - DROP_() antlr.TerminalNode - EACH_() antlr.TerminalNode - ELSE_() antlr.TerminalNode - END_() antlr.TerminalNode - ESCAPE_() antlr.TerminalNode - EXCEPT_() antlr.TerminalNode - EXCLUSIVE_() antlr.TerminalNode - EXISTS_() antlr.TerminalNode - EXPLAIN_() antlr.TerminalNode - FAIL_() antlr.TerminalNode - FOR_() antlr.TerminalNode - FOREIGN_() antlr.TerminalNode - FROM_() antlr.TerminalNode - FULL_() antlr.TerminalNode - GLOB_() antlr.TerminalNode - GROUP_() antlr.TerminalNode - HAVING_() antlr.TerminalNode - IF_() antlr.TerminalNode - IGNORE_() antlr.TerminalNode - IMMEDIATE_() antlr.TerminalNode - IN_() antlr.TerminalNode - INDEX_() antlr.TerminalNode - INDEXED_() antlr.TerminalNode - INITIALLY_() antlr.TerminalNode - INNER_() antlr.TerminalNode - INSERT_() antlr.TerminalNode - INSTEAD_() antlr.TerminalNode - INTERSECT_() antlr.TerminalNode - INTO_() antlr.TerminalNode - IS_() antlr.TerminalNode - ISNULL_() antlr.TerminalNode - JOIN_() antlr.TerminalNode - KEY_() antlr.TerminalNode - LEFT_() antlr.TerminalNode - LIKE_() antlr.TerminalNode - LIMIT_() antlr.TerminalNode - MATCH_() antlr.TerminalNode - NATURAL_() antlr.TerminalNode - NO_() antlr.TerminalNode - NOT_() antlr.TerminalNode - NOTNULL_() antlr.TerminalNode - NULL_() antlr.TerminalNode - OF_() antlr.TerminalNode - OFFSET_() antlr.TerminalNode - ON_() antlr.TerminalNode - OR_() antlr.TerminalNode - ORDER_() antlr.TerminalNode - OUTER_() antlr.TerminalNode - PLAN_() antlr.TerminalNode - PRAGMA_() antlr.TerminalNode - PRIMARY_() antlr.TerminalNode - QUERY_() antlr.TerminalNode - RAISE_() antlr.TerminalNode - RECURSIVE_() antlr.TerminalNode - REFERENCES_() antlr.TerminalNode - REGEXP_() antlr.TerminalNode - REINDEX_() antlr.TerminalNode - RELEASE_() antlr.TerminalNode - RENAME_() antlr.TerminalNode - REPLACE_() antlr.TerminalNode - RESTRICT_() antlr.TerminalNode - RETURNING_() antlr.TerminalNode - RIGHT_() antlr.TerminalNode - ROLLBACK_() antlr.TerminalNode - ROW_() antlr.TerminalNode - ROWS_() antlr.TerminalNode - SAVEPOINT_() antlr.TerminalNode - SELECT_() antlr.TerminalNode - SET_() antlr.TerminalNode - STRICT_() antlr.TerminalNode - TABLE_() antlr.TerminalNode - TEMP_() antlr.TerminalNode - TEMPORARY_() antlr.TerminalNode - THEN_() antlr.TerminalNode - TO_() antlr.TerminalNode - TRANSACTION_() antlr.TerminalNode - TRIGGER_() antlr.TerminalNode - UNION_() antlr.TerminalNode - UNIQUE_() antlr.TerminalNode - UPDATE_() antlr.TerminalNode - USING_() antlr.TerminalNode - VACUUM_() antlr.TerminalNode - VALUES_() antlr.TerminalNode - VIEW_() antlr.TerminalNode - VIRTUAL_() antlr.TerminalNode - WHEN_() antlr.TerminalNode - WHERE_() antlr.TerminalNode - WITH_() antlr.TerminalNode - WITHOUT_() antlr.TerminalNode - FIRST_VALUE_() antlr.TerminalNode - OVER_() antlr.TerminalNode - PARTITION_() antlr.TerminalNode - RANGE_() antlr.TerminalNode - PRECEDING_() antlr.TerminalNode - UNBOUNDED_() antlr.TerminalNode - CURRENT_() antlr.TerminalNode - FOLLOWING_() antlr.TerminalNode - CUME_DIST_() antlr.TerminalNode - DENSE_RANK_() antlr.TerminalNode - LAG_() antlr.TerminalNode - LAST_VALUE_() antlr.TerminalNode - LEAD_() antlr.TerminalNode - NTH_VALUE_() antlr.TerminalNode - NTILE_() antlr.TerminalNode - PERCENT_RANK_() antlr.TerminalNode - RANK_() antlr.TerminalNode - ROW_NUMBER_() antlr.TerminalNode - GENERATED_() antlr.TerminalNode - ALWAYS_() antlr.TerminalNode - STORED_() antlr.TerminalNode - TRUE_() antlr.TerminalNode - FALSE_() antlr.TerminalNode - WINDOW_() antlr.TerminalNode - NULLS_() antlr.TerminalNode - FIRST_() antlr.TerminalNode - LAST_() antlr.TerminalNode - FILTER_() antlr.TerminalNode - GROUPS_() antlr.TerminalNode - EXCLUDE_() antlr.TerminalNode - - // IsKeywordContext differentiates from other interfaces. - IsKeywordContext() -} - -type KeywordContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyKeywordContext() *KeywordContext { - var p = new(KeywordContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_keyword - return p -} - -func (*KeywordContext) IsKeywordContext() {} - -func NewKeywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KeywordContext { - var p = new(KeywordContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_keyword - - return p -} - -func (s *KeywordContext) GetParser() antlr.Parser { return s.parser } - -func (s *KeywordContext) ABORT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserABORT_, 0) -} - -func (s *KeywordContext) ACTION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserACTION_, 0) -} - -func (s *KeywordContext) ADD_() antlr.TerminalNode { - return s.GetToken(SQLiteParserADD_, 0) -} - -func (s *KeywordContext) AFTER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAFTER_, 0) -} - -func (s *KeywordContext) ALL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserALL_, 0) -} - -func (s *KeywordContext) ALTER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserALTER_, 0) -} - -func (s *KeywordContext) ANALYZE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserANALYZE_, 0) -} - -func (s *KeywordContext) AND_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAND_, 0) -} - -func (s *KeywordContext) AS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAS_, 0) -} - -func (s *KeywordContext) ASC_() antlr.TerminalNode { - return s.GetToken(SQLiteParserASC_, 0) -} - -func (s *KeywordContext) ATTACH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserATTACH_, 0) -} - -func (s *KeywordContext) AUTOINCREMENT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAUTOINCREMENT_, 0) -} - -func (s *KeywordContext) BEFORE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBEFORE_, 0) -} - -func (s *KeywordContext) BEGIN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBEGIN_, 0) -} - -func (s *KeywordContext) BETWEEN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBETWEEN_, 0) -} - -func (s *KeywordContext) BY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserBY_, 0) -} - -func (s *KeywordContext) CASCADE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCASCADE_, 0) -} - -func (s *KeywordContext) CASE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCASE_, 0) -} - -func (s *KeywordContext) CAST_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCAST_, 0) -} - -func (s *KeywordContext) CHECK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCHECK_, 0) -} - -func (s *KeywordContext) COLLATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOLLATE_, 0) -} - -func (s *KeywordContext) COLUMN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOLUMN_, 0) -} - -func (s *KeywordContext) COMMIT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCOMMIT_, 0) -} - -func (s *KeywordContext) CONFLICT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCONFLICT_, 0) -} - -func (s *KeywordContext) CONSTRAINT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCONSTRAINT_, 0) -} - -func (s *KeywordContext) CREATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCREATE_, 0) -} - -func (s *KeywordContext) CROSS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCROSS_, 0) -} - -func (s *KeywordContext) CURRENT_DATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_DATE_, 0) -} - -func (s *KeywordContext) CURRENT_TIME_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_TIME_, 0) -} - -func (s *KeywordContext) CURRENT_TIMESTAMP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_TIMESTAMP_, 0) -} - -func (s *KeywordContext) DATABASE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDATABASE_, 0) -} - -func (s *KeywordContext) DEFAULT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFAULT_, 0) -} - -func (s *KeywordContext) DEFERRABLE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFERRABLE_, 0) -} - -func (s *KeywordContext) DEFERRED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDEFERRED_, 0) -} - -func (s *KeywordContext) DELETE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDELETE_, 0) -} - -func (s *KeywordContext) DESC_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDESC_, 0) -} - -func (s *KeywordContext) DETACH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDETACH_, 0) -} - -func (s *KeywordContext) DISTINCT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDISTINCT_, 0) -} - -func (s *KeywordContext) DROP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDROP_, 0) -} - -func (s *KeywordContext) EACH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEACH_, 0) -} - -func (s *KeywordContext) ELSE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserELSE_, 0) -} - -func (s *KeywordContext) END_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEND_, 0) -} - -func (s *KeywordContext) ESCAPE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserESCAPE_, 0) -} - -func (s *KeywordContext) EXCEPT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXCEPT_, 0) -} - -func (s *KeywordContext) EXCLUSIVE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXCLUSIVE_, 0) -} - -func (s *KeywordContext) EXISTS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXISTS_, 0) -} - -func (s *KeywordContext) EXPLAIN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXPLAIN_, 0) -} - -func (s *KeywordContext) FAIL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFAIL_, 0) -} - -func (s *KeywordContext) FOR_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFOR_, 0) -} - -func (s *KeywordContext) FOREIGN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFOREIGN_, 0) -} - -func (s *KeywordContext) FROM_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFROM_, 0) -} - -func (s *KeywordContext) FULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFULL_, 0) -} - -func (s *KeywordContext) GLOB_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGLOB_, 0) -} - -func (s *KeywordContext) GROUP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGROUP_, 0) -} - -func (s *KeywordContext) HAVING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserHAVING_, 0) -} - -func (s *KeywordContext) IF_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIF_, 0) -} - -func (s *KeywordContext) IGNORE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIGNORE_, 0) -} - -func (s *KeywordContext) IMMEDIATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIMMEDIATE_, 0) -} - -func (s *KeywordContext) IN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIN_, 0) -} - -func (s *KeywordContext) INDEX_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINDEX_, 0) -} - -func (s *KeywordContext) INDEXED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINDEXED_, 0) -} - -func (s *KeywordContext) INITIALLY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINITIALLY_, 0) -} - -func (s *KeywordContext) INNER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINNER_, 0) -} - -func (s *KeywordContext) INSERT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINSERT_, 0) -} - -func (s *KeywordContext) INSTEAD_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINSTEAD_, 0) -} - -func (s *KeywordContext) INTERSECT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINTERSECT_, 0) -} - -func (s *KeywordContext) INTO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserINTO_, 0) -} - -func (s *KeywordContext) IS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserIS_, 0) -} - -func (s *KeywordContext) ISNULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserISNULL_, 0) -} - -func (s *KeywordContext) JOIN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserJOIN_, 0) -} - -func (s *KeywordContext) KEY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserKEY_, 0) -} - -func (s *KeywordContext) LEFT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLEFT_, 0) -} - -func (s *KeywordContext) LIKE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLIKE_, 0) -} - -func (s *KeywordContext) LIMIT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLIMIT_, 0) -} - -func (s *KeywordContext) MATCH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserMATCH_, 0) -} - -func (s *KeywordContext) NATURAL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNATURAL_, 0) -} - -func (s *KeywordContext) NO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNO_, 0) -} - -func (s *KeywordContext) NOT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOT_, 0) -} - -func (s *KeywordContext) NOTNULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNOTNULL_, 0) -} - -func (s *KeywordContext) NULL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNULL_, 0) -} - -func (s *KeywordContext) OF_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOF_, 0) -} - -func (s *KeywordContext) OFFSET_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOFFSET_, 0) -} - -func (s *KeywordContext) ON_() antlr.TerminalNode { - return s.GetToken(SQLiteParserON_, 0) -} - -func (s *KeywordContext) OR_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOR_, 0) -} - -func (s *KeywordContext) ORDER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserORDER_, 0) -} - -func (s *KeywordContext) OUTER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOUTER_, 0) -} - -func (s *KeywordContext) PLAN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPLAN_, 0) -} - -func (s *KeywordContext) PRAGMA_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRAGMA_, 0) -} - -func (s *KeywordContext) PRIMARY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRIMARY_, 0) -} - -func (s *KeywordContext) QUERY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserQUERY_, 0) -} - -func (s *KeywordContext) RAISE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRAISE_, 0) -} - -func (s *KeywordContext) RECURSIVE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRECURSIVE_, 0) -} - -func (s *KeywordContext) REFERENCES_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREFERENCES_, 0) -} - -func (s *KeywordContext) REGEXP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREGEXP_, 0) -} - -func (s *KeywordContext) REINDEX_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREINDEX_, 0) -} - -func (s *KeywordContext) RELEASE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRELEASE_, 0) -} - -func (s *KeywordContext) RENAME_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRENAME_, 0) -} - -func (s *KeywordContext) REPLACE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserREPLACE_, 0) -} - -func (s *KeywordContext) RESTRICT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRESTRICT_, 0) -} - -func (s *KeywordContext) RETURNING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRETURNING_, 0) -} - -func (s *KeywordContext) RIGHT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRIGHT_, 0) -} - -func (s *KeywordContext) ROLLBACK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROLLBACK_, 0) -} - -func (s *KeywordContext) ROW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROW_, 0) -} - -func (s *KeywordContext) ROWS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROWS_, 0) -} - -func (s *KeywordContext) SAVEPOINT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSAVEPOINT_, 0) -} - -func (s *KeywordContext) SELECT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSELECT_, 0) -} - -func (s *KeywordContext) SET_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSET_, 0) -} - -func (s *KeywordContext) STRICT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTRICT_, 0) -} - -func (s *KeywordContext) TABLE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTABLE_, 0) -} - -func (s *KeywordContext) TEMP_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTEMP_, 0) -} - -func (s *KeywordContext) TEMPORARY_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTEMPORARY_, 0) -} - -func (s *KeywordContext) THEN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTHEN_, 0) -} - -func (s *KeywordContext) TO_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTO_, 0) -} - -func (s *KeywordContext) TRANSACTION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRANSACTION_, 0) -} - -func (s *KeywordContext) TRIGGER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRIGGER_, 0) -} - -func (s *KeywordContext) UNION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNION_, 0) -} - -func (s *KeywordContext) UNIQUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNIQUE_, 0) -} - -func (s *KeywordContext) UPDATE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUPDATE_, 0) -} - -func (s *KeywordContext) USING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUSING_, 0) -} - -func (s *KeywordContext) VACUUM_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVACUUM_, 0) -} - -func (s *KeywordContext) VALUES_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVALUES_, 0) -} - -func (s *KeywordContext) VIEW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVIEW_, 0) -} - -func (s *KeywordContext) VIRTUAL_() antlr.TerminalNode { - return s.GetToken(SQLiteParserVIRTUAL_, 0) -} - -func (s *KeywordContext) WHEN_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHEN_, 0) -} - -func (s *KeywordContext) WHERE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWHERE_, 0) -} - -func (s *KeywordContext) WITH_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWITH_, 0) -} - -func (s *KeywordContext) WITHOUT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWITHOUT_, 0) -} - -func (s *KeywordContext) FIRST_VALUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFIRST_VALUE_, 0) -} - -func (s *KeywordContext) OVER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOVER_, 0) -} - -func (s *KeywordContext) PARTITION_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPARTITION_, 0) -} - -func (s *KeywordContext) RANGE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRANGE_, 0) -} - -func (s *KeywordContext) PRECEDING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPRECEDING_, 0) -} - -func (s *KeywordContext) UNBOUNDED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserUNBOUNDED_, 0) -} - -func (s *KeywordContext) CURRENT_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCURRENT_, 0) -} - -func (s *KeywordContext) FOLLOWING_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFOLLOWING_, 0) -} - -func (s *KeywordContext) CUME_DIST_() antlr.TerminalNode { - return s.GetToken(SQLiteParserCUME_DIST_, 0) -} - -func (s *KeywordContext) DENSE_RANK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserDENSE_RANK_, 0) -} - -func (s *KeywordContext) LAG_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLAG_, 0) -} - -func (s *KeywordContext) LAST_VALUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLAST_VALUE_, 0) -} - -func (s *KeywordContext) LEAD_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLEAD_, 0) -} - -func (s *KeywordContext) NTH_VALUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNTH_VALUE_, 0) -} - -func (s *KeywordContext) NTILE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNTILE_, 0) -} - -func (s *KeywordContext) PERCENT_RANK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserPERCENT_RANK_, 0) -} - -func (s *KeywordContext) RANK_() antlr.TerminalNode { - return s.GetToken(SQLiteParserRANK_, 0) -} - -func (s *KeywordContext) ROW_NUMBER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserROW_NUMBER_, 0) -} - -func (s *KeywordContext) GENERATED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGENERATED_, 0) -} - -func (s *KeywordContext) ALWAYS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserALWAYS_, 0) -} - -func (s *KeywordContext) STORED_() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTORED_, 0) -} - -func (s *KeywordContext) TRUE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserTRUE_, 0) -} - -func (s *KeywordContext) FALSE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFALSE_, 0) -} - -func (s *KeywordContext) WINDOW_() antlr.TerminalNode { - return s.GetToken(SQLiteParserWINDOW_, 0) -} - -func (s *KeywordContext) NULLS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserNULLS_, 0) -} - -func (s *KeywordContext) FIRST_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFIRST_, 0) -} - -func (s *KeywordContext) LAST_() antlr.TerminalNode { - return s.GetToken(SQLiteParserLAST_, 0) -} - -func (s *KeywordContext) FILTER_() antlr.TerminalNode { - return s.GetToken(SQLiteParserFILTER_, 0) -} - -func (s *KeywordContext) GROUPS_() antlr.TerminalNode { - return s.GetToken(SQLiteParserGROUPS_, 0) -} - -func (s *KeywordContext) EXCLUDE_() antlr.TerminalNode { - return s.GetToken(SQLiteParserEXCLUDE_, 0) -} - -func (s *KeywordContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *KeywordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *KeywordContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterKeyword(s) - } -} - -func (s *KeywordContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitKeyword(s) - } -} - -func (p *SQLiteParser) Keyword() (localctx IKeywordContext) { - this := p - _ = this - - localctx = NewKeywordContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 174, SQLiteParserRULE_keyword) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2106) - _la = p.GetTokenStream().LA(1) - - if !(((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-33554432) != 0) || ((int64((_la-64)) & ^0x3f) == 0 && ((int64(1)<<(_la-64))&-1) != 0) || ((int64((_la-128)) & ^0x3f) == 0 && ((int64(1)<<(_la-128))&18014398509481983) != 0)) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - return localctx -} - -// INameContext is an interface to support dynamic dispatch. -type INameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsNameContext differentiates from other interfaces. - IsNameContext() -} - -type NameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyNameContext() *NameContext { - var p = new(NameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_name - return p -} - -func (*NameContext) IsNameContext() {} - -func NewNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NameContext { - var p = new(NameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_name - - return p -} - -func (s *NameContext) GetParser() antlr.Parser { return s.parser } - -func (s *NameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *NameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *NameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *NameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterName(s) - } -} - -func (s *NameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitName(s) - } -} - -func (p *SQLiteParser) Name() (localctx INameContext) { - this := p - _ = this - - localctx = NewNameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 176, SQLiteParserRULE_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2108) - p.Any_name() - } - - return localctx -} - -// IFunction_nameContext is an interface to support dynamic dispatch. -type IFunction_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsFunction_nameContext differentiates from other interfaces. - IsFunction_nameContext() -} - -type Function_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFunction_nameContext() *Function_nameContext { - var p = new(Function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_function_name - return p -} - -func (*Function_nameContext) IsFunction_nameContext() {} - -func NewFunction_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Function_nameContext { - var p = new(Function_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_function_name - - return p -} - -func (s *Function_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Function_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Function_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Function_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Function_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFunction_name(s) - } -} - -func (s *Function_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFunction_name(s) - } -} - -func (p *SQLiteParser) Function_name() (localctx IFunction_nameContext) { - this := p - _ = this - - localctx = NewFunction_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 178, SQLiteParserRULE_function_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2110) - p.Any_name() - } - - return localctx -} - -// IQualified_function_nameContext is an interface to support dynamic dispatch. -type IQualified_function_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Function_name() IFunction_nameContext - Schema_name() ISchema_nameContext - DOT() antlr.TerminalNode - - // IsQualified_function_nameContext differentiates from other interfaces. - IsQualified_function_nameContext() -} - -type Qualified_function_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyQualified_function_nameContext() *Qualified_function_nameContext { - var p = new(Qualified_function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_qualified_function_name - return p -} - -func (*Qualified_function_nameContext) IsQualified_function_nameContext() {} - -func NewQualified_function_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Qualified_function_nameContext { - var p = new(Qualified_function_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_qualified_function_name - - return p -} - -func (s *Qualified_function_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Qualified_function_nameContext) Function_name() IFunction_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IFunction_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IFunction_nameContext) -} - -func (s *Qualified_function_nameContext) Schema_name() ISchema_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(ISchema_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(ISchema_nameContext) -} - -func (s *Qualified_function_nameContext) DOT() antlr.TerminalNode { - return s.GetToken(SQLiteParserDOT, 0) -} - -func (s *Qualified_function_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Qualified_function_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Qualified_function_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterQualified_function_name(s) - } -} - -func (s *Qualified_function_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitQualified_function_name(s) - } -} - -func (p *SQLiteParser) Qualified_function_name() (localctx IQualified_function_nameContext) { - this := p - _ = this - - localctx = NewQualified_function_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 180, SQLiteParserRULE_qualified_function_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - p.SetState(2115) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 312, p.GetParserRuleContext()) == 1 { - { - p.SetState(2112) - p.Schema_name() - } - { - p.SetState(2113) - p.Match(SQLiteParserDOT) - } - - } - { - p.SetState(2117) - p.Function_name() - } - - return localctx -} - -// ISchema_nameContext is an interface to support dynamic dispatch. -type ISchema_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsSchema_nameContext differentiates from other interfaces. - IsSchema_nameContext() -} - -type Schema_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySchema_nameContext() *Schema_nameContext { - var p = new(Schema_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_schema_name - return p -} - -func (*Schema_nameContext) IsSchema_nameContext() {} - -func NewSchema_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Schema_nameContext { - var p = new(Schema_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_schema_name - - return p -} - -func (s *Schema_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Schema_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Schema_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Schema_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Schema_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSchema_name(s) - } -} - -func (s *Schema_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSchema_name(s) - } -} - -func (p *SQLiteParser) Schema_name() (localctx ISchema_nameContext) { - this := p - _ = this - - localctx = NewSchema_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 182, SQLiteParserRULE_schema_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2119) - p.Any_name() - } - - return localctx -} - -// ITable_nameContext is an interface to support dynamic dispatch. -type ITable_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsTable_nameContext differentiates from other interfaces. - IsTable_nameContext() -} - -type Table_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTable_nameContext() *Table_nameContext { - var p = new(Table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_table_name - return p -} - -func (*Table_nameContext) IsTable_nameContext() {} - -func NewTable_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_nameContext { - var p = new(Table_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_table_name - - return p -} - -func (s *Table_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Table_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Table_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Table_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Table_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTable_name(s) - } -} - -func (s *Table_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTable_name(s) - } -} - -func (p *SQLiteParser) Table_name() (localctx ITable_nameContext) { - this := p - _ = this - - localctx = NewTable_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 184, SQLiteParserRULE_table_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2121) - p.Any_name() - } - - return localctx -} - -// ITable_or_index_nameContext is an interface to support dynamic dispatch. -type ITable_or_index_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsTable_or_index_nameContext differentiates from other interfaces. - IsTable_or_index_nameContext() -} - -type Table_or_index_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTable_or_index_nameContext() *Table_or_index_nameContext { - var p = new(Table_or_index_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_table_or_index_name - return p -} - -func (*Table_or_index_nameContext) IsTable_or_index_nameContext() {} - -func NewTable_or_index_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_or_index_nameContext { - var p = new(Table_or_index_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_table_or_index_name - - return p -} - -func (s *Table_or_index_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Table_or_index_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Table_or_index_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Table_or_index_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Table_or_index_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTable_or_index_name(s) - } -} - -func (s *Table_or_index_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTable_or_index_name(s) - } -} - -func (p *SQLiteParser) Table_or_index_name() (localctx ITable_or_index_nameContext) { - this := p - _ = this - - localctx = NewTable_or_index_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 186, SQLiteParserRULE_table_or_index_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2123) - p.Any_name() - } - - return localctx -} - -// INew_table_nameContext is an interface to support dynamic dispatch. -type INew_table_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsNew_table_nameContext differentiates from other interfaces. - IsNew_table_nameContext() -} - -type New_table_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyNew_table_nameContext() *New_table_nameContext { - var p = new(New_table_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_new_table_name - return p -} - -func (*New_table_nameContext) IsNew_table_nameContext() {} - -func NewNew_table_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *New_table_nameContext { - var p = new(New_table_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_new_table_name - - return p -} - -func (s *New_table_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *New_table_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *New_table_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *New_table_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *New_table_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterNew_table_name(s) - } -} - -func (s *New_table_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitNew_table_name(s) - } -} - -func (p *SQLiteParser) New_table_name() (localctx INew_table_nameContext) { - this := p - _ = this - - localctx = NewNew_table_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 188, SQLiteParserRULE_new_table_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2125) - p.Any_name() - } - - return localctx -} - -// IColumn_nameContext is an interface to support dynamic dispatch. -type IColumn_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsColumn_nameContext differentiates from other interfaces. - IsColumn_nameContext() -} - -type Column_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyColumn_nameContext() *Column_nameContext { - var p = new(Column_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_column_name - return p -} - -func (*Column_nameContext) IsColumn_nameContext() {} - -func NewColumn_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Column_nameContext { - var p = new(Column_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_column_name - - return p -} - -func (s *Column_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Column_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Column_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Column_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Column_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterColumn_name(s) - } -} - -func (s *Column_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitColumn_name(s) - } -} - -func (p *SQLiteParser) Column_name() (localctx IColumn_nameContext) { - this := p - _ = this - - localctx = NewColumn_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 190, SQLiteParserRULE_column_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2127) - p.Any_name() - } - - return localctx -} - -// ICollation_nameContext is an interface to support dynamic dispatch. -type ICollation_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsCollation_nameContext differentiates from other interfaces. - IsCollation_nameContext() -} - -type Collation_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyCollation_nameContext() *Collation_nameContext { - var p = new(Collation_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_collation_name - return p -} - -func (*Collation_nameContext) IsCollation_nameContext() {} - -func NewCollation_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Collation_nameContext { - var p = new(Collation_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_collation_name - - return p -} - -func (s *Collation_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Collation_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Collation_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Collation_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Collation_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterCollation_name(s) - } -} - -func (s *Collation_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitCollation_name(s) - } -} - -func (p *SQLiteParser) Collation_name() (localctx ICollation_nameContext) { - this := p - _ = this - - localctx = NewCollation_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 192, SQLiteParserRULE_collation_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2129) - p.Any_name() - } - - return localctx -} - -// IForeign_tableContext is an interface to support dynamic dispatch. -type IForeign_tableContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsForeign_tableContext differentiates from other interfaces. - IsForeign_tableContext() -} - -type Foreign_tableContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyForeign_tableContext() *Foreign_tableContext { - var p = new(Foreign_tableContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_foreign_table - return p -} - -func (*Foreign_tableContext) IsForeign_tableContext() {} - -func NewForeign_tableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Foreign_tableContext { - var p = new(Foreign_tableContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_foreign_table - - return p -} - -func (s *Foreign_tableContext) GetParser() antlr.Parser { return s.parser } - -func (s *Foreign_tableContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Foreign_tableContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Foreign_tableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Foreign_tableContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterForeign_table(s) - } -} - -func (s *Foreign_tableContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitForeign_table(s) - } -} - -func (p *SQLiteParser) Foreign_table() (localctx IForeign_tableContext) { - this := p - _ = this - - localctx = NewForeign_tableContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 194, SQLiteParserRULE_foreign_table) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2131) - p.Any_name() - } - - return localctx -} - -// IIndex_nameContext is an interface to support dynamic dispatch. -type IIndex_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsIndex_nameContext differentiates from other interfaces. - IsIndex_nameContext() -} - -type Index_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyIndex_nameContext() *Index_nameContext { - var p = new(Index_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_index_name - return p -} - -func (*Index_nameContext) IsIndex_nameContext() {} - -func NewIndex_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Index_nameContext { - var p = new(Index_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_index_name - - return p -} - -func (s *Index_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Index_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Index_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Index_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Index_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterIndex_name(s) - } -} - -func (s *Index_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitIndex_name(s) - } -} - -func (p *SQLiteParser) Index_name() (localctx IIndex_nameContext) { - this := p - _ = this - - localctx = NewIndex_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 196, SQLiteParserRULE_index_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2133) - p.Any_name() - } - - return localctx -} - -// ITrigger_nameContext is an interface to support dynamic dispatch. -type ITrigger_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsTrigger_nameContext differentiates from other interfaces. - IsTrigger_nameContext() -} - -type Trigger_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTrigger_nameContext() *Trigger_nameContext { - var p = new(Trigger_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_trigger_name - return p -} - -func (*Trigger_nameContext) IsTrigger_nameContext() {} - -func NewTrigger_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Trigger_nameContext { - var p = new(Trigger_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_trigger_name - - return p -} - -func (s *Trigger_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Trigger_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Trigger_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Trigger_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Trigger_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTrigger_name(s) - } -} - -func (s *Trigger_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTrigger_name(s) - } -} - -func (p *SQLiteParser) Trigger_name() (localctx ITrigger_nameContext) { - this := p - _ = this - - localctx = NewTrigger_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 198, SQLiteParserRULE_trigger_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2135) - p.Any_name() - } - - return localctx -} - -// IView_nameContext is an interface to support dynamic dispatch. -type IView_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsView_nameContext differentiates from other interfaces. - IsView_nameContext() -} - -type View_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyView_nameContext() *View_nameContext { - var p = new(View_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_view_name - return p -} - -func (*View_nameContext) IsView_nameContext() {} - -func NewView_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *View_nameContext { - var p = new(View_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_view_name - - return p -} - -func (s *View_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *View_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *View_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *View_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *View_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterView_name(s) - } -} - -func (s *View_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitView_name(s) - } -} - -func (p *SQLiteParser) View_name() (localctx IView_nameContext) { - this := p - _ = this - - localctx = NewView_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 200, SQLiteParserRULE_view_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2137) - p.Any_name() - } - - return localctx -} - -// IModule_nameContext is an interface to support dynamic dispatch. -type IModule_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsModule_nameContext differentiates from other interfaces. - IsModule_nameContext() -} - -type Module_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyModule_nameContext() *Module_nameContext { - var p = new(Module_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_module_name - return p -} - -func (*Module_nameContext) IsModule_nameContext() {} - -func NewModule_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Module_nameContext { - var p = new(Module_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_module_name - - return p -} - -func (s *Module_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Module_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Module_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Module_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Module_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterModule_name(s) - } -} - -func (s *Module_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitModule_name(s) - } -} - -func (p *SQLiteParser) Module_name() (localctx IModule_nameContext) { - this := p - _ = this - - localctx = NewModule_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 202, SQLiteParserRULE_module_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2139) - p.Any_name() - } - - return localctx -} - -// IPragma_nameContext is an interface to support dynamic dispatch. -type IPragma_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsPragma_nameContext differentiates from other interfaces. - IsPragma_nameContext() -} - -type Pragma_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyPragma_nameContext() *Pragma_nameContext { - var p = new(Pragma_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_pragma_name - return p -} - -func (*Pragma_nameContext) IsPragma_nameContext() {} - -func NewPragma_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pragma_nameContext { - var p = new(Pragma_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_pragma_name - - return p -} - -func (s *Pragma_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Pragma_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Pragma_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Pragma_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Pragma_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterPragma_name(s) - } -} - -func (s *Pragma_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitPragma_name(s) - } -} - -func (p *SQLiteParser) Pragma_name() (localctx IPragma_nameContext) { - this := p - _ = this - - localctx = NewPragma_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 204, SQLiteParserRULE_pragma_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2141) - p.Any_name() - } - - return localctx -} - -// ISavepoint_nameContext is an interface to support dynamic dispatch. -type ISavepoint_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsSavepoint_nameContext differentiates from other interfaces. - IsSavepoint_nameContext() -} - -type Savepoint_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySavepoint_nameContext() *Savepoint_nameContext { - var p = new(Savepoint_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_savepoint_name - return p -} - -func (*Savepoint_nameContext) IsSavepoint_nameContext() {} - -func NewSavepoint_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Savepoint_nameContext { - var p = new(Savepoint_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_savepoint_name - - return p -} - -func (s *Savepoint_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Savepoint_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Savepoint_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Savepoint_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Savepoint_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSavepoint_name(s) - } -} - -func (s *Savepoint_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSavepoint_name(s) - } -} - -func (p *SQLiteParser) Savepoint_name() (localctx ISavepoint_nameContext) { - this := p - _ = this - - localctx = NewSavepoint_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 206, SQLiteParserRULE_savepoint_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2143) - p.Any_name() - } - - return localctx -} - -// ITable_aliasContext is an interface to support dynamic dispatch. -type ITable_aliasContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - IDENTIFIER() antlr.TerminalNode - STRING_LITERAL() antlr.TerminalNode - - // IsTable_aliasContext differentiates from other interfaces. - IsTable_aliasContext() -} - -type Table_aliasContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTable_aliasContext() *Table_aliasContext { - var p = new(Table_aliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_table_alias - return p -} - -func (*Table_aliasContext) IsTable_aliasContext() {} - -func NewTable_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_aliasContext { - var p = new(Table_aliasContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_table_alias - - return p -} - -func (s *Table_aliasContext) GetParser() antlr.Parser { return s.parser } - -func (s *Table_aliasContext) IDENTIFIER() antlr.TerminalNode { - return s.GetToken(SQLiteParserIDENTIFIER, 0) -} - -func (s *Table_aliasContext) STRING_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTRING_LITERAL, 0) -} - -func (s *Table_aliasContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Table_aliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Table_aliasContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTable_alias(s) - } -} - -func (s *Table_aliasContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTable_alias(s) - } -} - -func (p *SQLiteParser) Table_alias() (localctx ITable_aliasContext) { - this := p - _ = this - - localctx = NewTable_aliasContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 208, SQLiteParserRULE_table_alias) - var _la int - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2145) - _la = p.GetTokenStream().LA(1) - - if !(_la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL) { - p.GetErrorHandler().RecoverInline(p) - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - return localctx -} - -// ITable_alias_fallbackContext is an interface to support dynamic dispatch. -type ITable_alias_fallbackContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsTable_alias_fallbackContext differentiates from other interfaces. - IsTable_alias_fallbackContext() -} - -type Table_alias_fallbackContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTable_alias_fallbackContext() *Table_alias_fallbackContext { - var p = new(Table_alias_fallbackContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_table_alias_fallback - return p -} - -func (*Table_alias_fallbackContext) IsTable_alias_fallbackContext() {} - -func NewTable_alias_fallbackContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_alias_fallbackContext { - var p = new(Table_alias_fallbackContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_table_alias_fallback - - return p -} - -func (s *Table_alias_fallbackContext) GetParser() antlr.Parser { return s.parser } - -func (s *Table_alias_fallbackContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Table_alias_fallbackContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Table_alias_fallbackContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Table_alias_fallbackContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTable_alias_fallback(s) - } -} - -func (s *Table_alias_fallbackContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTable_alias_fallback(s) - } -} - -func (p *SQLiteParser) Table_alias_fallback() (localctx ITable_alias_fallbackContext) { - this := p - _ = this - - localctx = NewTable_alias_fallbackContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 210, SQLiteParserRULE_table_alias_fallback) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2147) - p.Any_name() - } - - return localctx -} - -// ITransaction_nameContext is an interface to support dynamic dispatch. -type ITransaction_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsTransaction_nameContext differentiates from other interfaces. - IsTransaction_nameContext() -} - -type Transaction_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTransaction_nameContext() *Transaction_nameContext { - var p = new(Transaction_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_transaction_name - return p -} - -func (*Transaction_nameContext) IsTransaction_nameContext() {} - -func NewTransaction_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Transaction_nameContext { - var p = new(Transaction_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_transaction_name - - return p -} - -func (s *Transaction_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Transaction_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Transaction_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Transaction_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Transaction_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTransaction_name(s) - } -} - -func (s *Transaction_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTransaction_name(s) - } -} - -func (p *SQLiteParser) Transaction_name() (localctx ITransaction_nameContext) { - this := p - _ = this - - localctx = NewTransaction_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 212, SQLiteParserRULE_transaction_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2149) - p.Any_name() - } - - return localctx -} - -// IWindow_nameContext is an interface to support dynamic dispatch. -type IWindow_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsWindow_nameContext differentiates from other interfaces. - IsWindow_nameContext() -} - -type Window_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyWindow_nameContext() *Window_nameContext { - var p = new(Window_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_window_name - return p -} - -func (*Window_nameContext) IsWindow_nameContext() {} - -func NewWindow_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_nameContext { - var p = new(Window_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_window_name - - return p -} - -func (s *Window_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Window_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Window_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Window_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Window_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterWindow_name(s) - } -} - -func (s *Window_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitWindow_name(s) - } -} - -func (p *SQLiteParser) Window_name() (localctx IWindow_nameContext) { - this := p - _ = this - - localctx = NewWindow_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 214, SQLiteParserRULE_window_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2151) - p.Any_name() - } - - return localctx -} - -// IAliasContext is an interface to support dynamic dispatch. -type IAliasContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsAliasContext differentiates from other interfaces. - IsAliasContext() -} - -type AliasContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyAliasContext() *AliasContext { - var p = new(AliasContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_alias - return p -} - -func (*AliasContext) IsAliasContext() {} - -func NewAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AliasContext { - var p = new(AliasContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_alias - - return p -} - -func (s *AliasContext) GetParser() antlr.Parser { return s.parser } - -func (s *AliasContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *AliasContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *AliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *AliasContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterAlias(s) - } -} - -func (s *AliasContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitAlias(s) - } -} - -func (p *SQLiteParser) Alias() (localctx IAliasContext) { - this := p - _ = this - - localctx = NewAliasContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 216, SQLiteParserRULE_alias) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2153) - p.Any_name() - } - - return localctx -} - -// IFilenameContext is an interface to support dynamic dispatch. -type IFilenameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsFilenameContext differentiates from other interfaces. - IsFilenameContext() -} - -type FilenameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyFilenameContext() *FilenameContext { - var p = new(FilenameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_filename - return p -} - -func (*FilenameContext) IsFilenameContext() {} - -func NewFilenameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FilenameContext { - var p = new(FilenameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_filename - - return p -} - -func (s *FilenameContext) GetParser() antlr.Parser { return s.parser } - -func (s *FilenameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *FilenameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *FilenameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *FilenameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterFilename(s) - } -} - -func (s *FilenameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitFilename(s) - } -} - -func (p *SQLiteParser) Filename() (localctx IFilenameContext) { - this := p - _ = this - - localctx = NewFilenameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 218, SQLiteParserRULE_filename) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2155) - p.Any_name() - } - - return localctx -} - -// IBase_window_nameContext is an interface to support dynamic dispatch. -type IBase_window_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsBase_window_nameContext differentiates from other interfaces. - IsBase_window_nameContext() -} - -type Base_window_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyBase_window_nameContext() *Base_window_nameContext { - var p = new(Base_window_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_base_window_name - return p -} - -func (*Base_window_nameContext) IsBase_window_nameContext() {} - -func NewBase_window_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Base_window_nameContext { - var p = new(Base_window_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_base_window_name - - return p -} - -func (s *Base_window_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Base_window_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Base_window_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Base_window_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Base_window_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterBase_window_name(s) - } -} - -func (s *Base_window_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitBase_window_name(s) - } -} - -func (p *SQLiteParser) Base_window_name() (localctx IBase_window_nameContext) { - this := p - _ = this - - localctx = NewBase_window_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 220, SQLiteParserRULE_base_window_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2157) - p.Any_name() - } - - return localctx -} - -// ISimple_funcContext is an interface to support dynamic dispatch. -type ISimple_funcContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsSimple_funcContext differentiates from other interfaces. - IsSimple_funcContext() -} - -type Simple_funcContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptySimple_funcContext() *Simple_funcContext { - var p = new(Simple_funcContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_simple_func - return p -} - -func (*Simple_funcContext) IsSimple_funcContext() {} - -func NewSimple_funcContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Simple_funcContext { - var p = new(Simple_funcContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_simple_func - - return p -} - -func (s *Simple_funcContext) GetParser() antlr.Parser { return s.parser } - -func (s *Simple_funcContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Simple_funcContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Simple_funcContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Simple_funcContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterSimple_func(s) - } -} - -func (s *Simple_funcContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitSimple_func(s) - } -} - -func (p *SQLiteParser) Simple_func() (localctx ISimple_funcContext) { - this := p - _ = this - - localctx = NewSimple_funcContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 222, SQLiteParserRULE_simple_func) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2159) - p.Any_name() - } - - return localctx -} - -// IAggregate_funcContext is an interface to support dynamic dispatch. -type IAggregate_funcContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsAggregate_funcContext differentiates from other interfaces. - IsAggregate_funcContext() -} - -type Aggregate_funcContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyAggregate_funcContext() *Aggregate_funcContext { - var p = new(Aggregate_funcContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_aggregate_func - return p -} - -func (*Aggregate_funcContext) IsAggregate_funcContext() {} - -func NewAggregate_funcContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggregate_funcContext { - var p = new(Aggregate_funcContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_aggregate_func - - return p -} - -func (s *Aggregate_funcContext) GetParser() antlr.Parser { return s.parser } - -func (s *Aggregate_funcContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Aggregate_funcContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Aggregate_funcContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Aggregate_funcContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterAggregate_func(s) - } -} - -func (s *Aggregate_funcContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitAggregate_func(s) - } -} - -func (p *SQLiteParser) Aggregate_func() (localctx IAggregate_funcContext) { - this := p - _ = this - - localctx = NewAggregate_funcContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 224, SQLiteParserRULE_aggregate_func) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2161) - p.Any_name() - } - - return localctx -} - -// ITable_function_nameContext is an interface to support dynamic dispatch. -type ITable_function_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - Any_name() IAny_nameContext - - // IsTable_function_nameContext differentiates from other interfaces. - IsTable_function_nameContext() -} - -type Table_function_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyTable_function_nameContext() *Table_function_nameContext { - var p = new(Table_function_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_table_function_name - return p -} - -func (*Table_function_nameContext) IsTable_function_nameContext() {} - -func NewTable_function_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_function_nameContext { - var p = new(Table_function_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_table_function_name - - return p -} - -func (s *Table_function_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Table_function_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Table_function_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Table_function_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Table_function_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterTable_function_name(s) - } -} - -func (s *Table_function_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitTable_function_name(s) - } -} - -func (p *SQLiteParser) Table_function_name() (localctx ITable_function_nameContext) { - this := p - _ = this - - localctx = NewTable_function_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 226, SQLiteParserRULE_table_function_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2163) - p.Any_name() - } - - return localctx -} - -// IAny_nameContext is an interface to support dynamic dispatch. -type IAny_nameContext interface { - antlr.ParserRuleContext - - // GetParser returns the parser. - GetParser() antlr.Parser - - // Getter signatures - IDENTIFIER() antlr.TerminalNode - Keyword() IKeywordContext - STRING_LITERAL() antlr.TerminalNode - OPEN_PAR() antlr.TerminalNode - Any_name() IAny_nameContext - CLOSE_PAR() antlr.TerminalNode - - // IsAny_nameContext differentiates from other interfaces. - IsAny_nameContext() -} - -type Any_nameContext struct { - *antlr.BaseParserRuleContext - parser antlr.Parser -} - -func NewEmptyAny_nameContext() *Any_nameContext { - var p = new(Any_nameContext) - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) - p.RuleIndex = SQLiteParserRULE_any_name - return p -} - -func (*Any_nameContext) IsAny_nameContext() {} - -func NewAny_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Any_nameContext { - var p = new(Any_nameContext) - - p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) - - p.parser = parser - p.RuleIndex = SQLiteParserRULE_any_name - - return p -} - -func (s *Any_nameContext) GetParser() antlr.Parser { return s.parser } - -func (s *Any_nameContext) IDENTIFIER() antlr.TerminalNode { - return s.GetToken(SQLiteParserIDENTIFIER, 0) -} - -func (s *Any_nameContext) Keyword() IKeywordContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IKeywordContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IKeywordContext) -} - -func (s *Any_nameContext) STRING_LITERAL() antlr.TerminalNode { - return s.GetToken(SQLiteParserSTRING_LITERAL, 0) -} - -func (s *Any_nameContext) OPEN_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserOPEN_PAR, 0) -} - -func (s *Any_nameContext) Any_name() IAny_nameContext { - var t antlr.RuleContext - for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IAny_nameContext); ok { - t = ctx.(antlr.RuleContext) - break - } - } - - if t == nil { - return nil - } - - return t.(IAny_nameContext) -} - -func (s *Any_nameContext) CLOSE_PAR() antlr.TerminalNode { - return s.GetToken(SQLiteParserCLOSE_PAR, 0) -} - -func (s *Any_nameContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *Any_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { - return antlr.TreesStringTree(s, ruleNames, recog) -} - -func (s *Any_nameContext) EnterRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.EnterAny_name(s) - } -} - -func (s *Any_nameContext) ExitRule(listener antlr.ParseTreeListener) { - if listenerT, ok := listener.(SQLiteParserListener); ok { - listenerT.ExitAny_name(s) - } -} - -func (p *SQLiteParser) Any_name() (localctx IAny_nameContext) { - this := p - _ = this - - localctx = NewAny_nameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 228, SQLiteParserRULE_any_name) - - defer func() { - p.ExitRule() - }() - - defer func() { - if err := recover(); err != nil { - if v, ok := err.(antlr.RecognitionException); ok { - localctx.SetException(v) - p.GetErrorHandler().ReportError(p, v) - p.GetErrorHandler().Recover(p, v) - } else { - panic(err) - } - } - }() - - p.SetState(2172) - p.GetErrorHandler().Sync(p) - - switch p.GetTokenStream().LA(1) { - case SQLiteParserIDENTIFIER: - p.EnterOuterAlt(localctx, 1) - { - p.SetState(2165) - p.Match(SQLiteParserIDENTIFIER) - } - - case SQLiteParserABORT_, SQLiteParserACTION_, SQLiteParserADD_, SQLiteParserAFTER_, SQLiteParserALL_, SQLiteParserALTER_, SQLiteParserANALYZE_, SQLiteParserAND_, SQLiteParserAS_, SQLiteParserASC_, SQLiteParserATTACH_, SQLiteParserAUTOINCREMENT_, SQLiteParserBEFORE_, SQLiteParserBEGIN_, SQLiteParserBETWEEN_, SQLiteParserBY_, SQLiteParserCASCADE_, SQLiteParserCASE_, SQLiteParserCAST_, SQLiteParserCHECK_, SQLiteParserCOLLATE_, SQLiteParserCOLUMN_, SQLiteParserCOMMIT_, SQLiteParserCONFLICT_, SQLiteParserCONSTRAINT_, SQLiteParserCREATE_, SQLiteParserCROSS_, SQLiteParserCURRENT_DATE_, SQLiteParserCURRENT_TIME_, SQLiteParserCURRENT_TIMESTAMP_, SQLiteParserDATABASE_, SQLiteParserDEFAULT_, SQLiteParserDEFERRABLE_, SQLiteParserDEFERRED_, SQLiteParserDELETE_, SQLiteParserDESC_, SQLiteParserDETACH_, SQLiteParserDISTINCT_, SQLiteParserDROP_, SQLiteParserEACH_, SQLiteParserELSE_, SQLiteParserEND_, SQLiteParserESCAPE_, SQLiteParserEXCEPT_, SQLiteParserEXCLUSIVE_, SQLiteParserEXISTS_, SQLiteParserEXPLAIN_, SQLiteParserFAIL_, SQLiteParserFOR_, SQLiteParserFOREIGN_, SQLiteParserFROM_, SQLiteParserFULL_, SQLiteParserGLOB_, SQLiteParserGROUP_, SQLiteParserHAVING_, SQLiteParserIF_, SQLiteParserIGNORE_, SQLiteParserIMMEDIATE_, SQLiteParserIN_, SQLiteParserINDEX_, SQLiteParserINDEXED_, SQLiteParserINITIALLY_, SQLiteParserINNER_, SQLiteParserINSERT_, SQLiteParserINSTEAD_, SQLiteParserINTERSECT_, SQLiteParserINTO_, SQLiteParserIS_, SQLiteParserISNULL_, SQLiteParserJOIN_, SQLiteParserKEY_, SQLiteParserLEFT_, SQLiteParserLIKE_, SQLiteParserLIMIT_, SQLiteParserMATCH_, SQLiteParserNATURAL_, SQLiteParserNO_, SQLiteParserNOT_, SQLiteParserNOTNULL_, SQLiteParserNULL_, SQLiteParserOF_, SQLiteParserOFFSET_, SQLiteParserON_, SQLiteParserOR_, SQLiteParserORDER_, SQLiteParserOUTER_, SQLiteParserPLAN_, SQLiteParserPRAGMA_, SQLiteParserPRIMARY_, SQLiteParserQUERY_, SQLiteParserRAISE_, SQLiteParserRECURSIVE_, SQLiteParserREFERENCES_, SQLiteParserREGEXP_, SQLiteParserREINDEX_, SQLiteParserRELEASE_, SQLiteParserRENAME_, SQLiteParserREPLACE_, SQLiteParserRESTRICT_, SQLiteParserRETURNING_, SQLiteParserRIGHT_, SQLiteParserROLLBACK_, SQLiteParserROW_, SQLiteParserROWS_, SQLiteParserSAVEPOINT_, SQLiteParserSELECT_, SQLiteParserSET_, SQLiteParserSTRICT_, SQLiteParserTABLE_, SQLiteParserTEMP_, SQLiteParserTEMPORARY_, SQLiteParserTHEN_, SQLiteParserTO_, SQLiteParserTRANSACTION_, SQLiteParserTRIGGER_, SQLiteParserUNION_, SQLiteParserUNIQUE_, SQLiteParserUPDATE_, SQLiteParserUSING_, SQLiteParserVACUUM_, SQLiteParserVALUES_, SQLiteParserVIEW_, SQLiteParserVIRTUAL_, SQLiteParserWHEN_, SQLiteParserWHERE_, SQLiteParserWITH_, SQLiteParserWITHOUT_, SQLiteParserFIRST_VALUE_, SQLiteParserOVER_, SQLiteParserPARTITION_, SQLiteParserRANGE_, SQLiteParserPRECEDING_, SQLiteParserUNBOUNDED_, SQLiteParserCURRENT_, SQLiteParserFOLLOWING_, SQLiteParserCUME_DIST_, SQLiteParserDENSE_RANK_, SQLiteParserLAG_, SQLiteParserLAST_VALUE_, SQLiteParserLEAD_, SQLiteParserNTH_VALUE_, SQLiteParserNTILE_, SQLiteParserPERCENT_RANK_, SQLiteParserRANK_, SQLiteParserROW_NUMBER_, SQLiteParserGENERATED_, SQLiteParserALWAYS_, SQLiteParserSTORED_, SQLiteParserTRUE_, SQLiteParserFALSE_, SQLiteParserWINDOW_, SQLiteParserNULLS_, SQLiteParserFIRST_, SQLiteParserLAST_, SQLiteParserFILTER_, SQLiteParserGROUPS_, SQLiteParserEXCLUDE_: - p.EnterOuterAlt(localctx, 2) - { - p.SetState(2166) - p.Keyword() - } - - case SQLiteParserSTRING_LITERAL: - p.EnterOuterAlt(localctx, 3) - { - p.SetState(2167) - p.Match(SQLiteParserSTRING_LITERAL) - } - - case SQLiteParserOPEN_PAR: - p.EnterOuterAlt(localctx, 4) - { - p.SetState(2168) - p.Match(SQLiteParserOPEN_PAR) - } - { - p.SetState(2169) - p.Any_name() - } - { - p.SetState(2170) - p.Match(SQLiteParserCLOSE_PAR) - } - - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) - } - - return localctx -} - -func (p *SQLiteParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { - switch ruleIndex { - case 34: - var t *ExprContext = nil - if localctx != nil { - t = localctx.(*ExprContext) - } - return p.Expr_Sempred(t, predIndex) - - default: - panic("No predicate with index: " + fmt.Sprint(ruleIndex)) - } -} - -func (p *SQLiteParser) Expr_Sempred(localctx antlr.RuleContext, predIndex int) bool { - this := p - _ = this - - switch predIndex { - case 0: - return p.Precpred(p.GetParserRuleContext(), 19) - - case 1: - return p.Precpred(p.GetParserRuleContext(), 18) - - case 2: - return p.Precpred(p.GetParserRuleContext(), 17) - - case 3: - return p.Precpred(p.GetParserRuleContext(), 16) - - case 4: - return p.Precpred(p.GetParserRuleContext(), 15) - - case 5: - return p.Precpred(p.GetParserRuleContext(), 14) - - case 6: - return p.Precpred(p.GetParserRuleContext(), 12) - - case 7: - return p.Precpred(p.GetParserRuleContext(), 11) - - case 8: - return p.Precpred(p.GetParserRuleContext(), 4) - - case 9: - return p.Precpred(p.GetParserRuleContext(), 13) - - case 10: - return p.Precpred(p.GetParserRuleContext(), 7) - - case 11: - return p.Precpred(p.GetParserRuleContext(), 6) - - case 12: - return p.Precpred(p.GetParserRuleContext(), 5) - - default: - panic("No predicate with index: " + fmt.Sprint(predIndex)) - } -} diff --git a/internal/engine/sqlite/parser/sqliteparser_base_listener.go b/internal/engine/sqlite/parser/sqliteparser_base_listener.go deleted file mode 100644 index 27a6bf8578..0000000000 --- a/internal/engine/sqlite/parser/sqliteparser_base_listener.go +++ /dev/null @@ -1,814 +0,0 @@ -// Code generated from SQLiteParser.g4 by ANTLR 4.12.0. DO NOT EDIT. - -package parser // SQLiteParser - -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" - -// BaseSQLiteParserListener is a complete listener for a parse tree produced by SQLiteParser. -type BaseSQLiteParserListener struct{} - -var _ SQLiteParserListener = &BaseSQLiteParserListener{} - -// VisitTerminal is called when a terminal node is visited. -func (s *BaseSQLiteParserListener) VisitTerminal(node antlr.TerminalNode) {} - -// VisitErrorNode is called when an error node is visited. -func (s *BaseSQLiteParserListener) VisitErrorNode(node antlr.ErrorNode) {} - -// EnterEveryRule is called when any rule is entered. -func (s *BaseSQLiteParserListener) EnterEveryRule(ctx antlr.ParserRuleContext) {} - -// ExitEveryRule is called when any rule is exited. -func (s *BaseSQLiteParserListener) ExitEveryRule(ctx antlr.ParserRuleContext) {} - -// EnterParse is called when production parse is entered. -func (s *BaseSQLiteParserListener) EnterParse(ctx *ParseContext) {} - -// ExitParse is called when production parse is exited. -func (s *BaseSQLiteParserListener) ExitParse(ctx *ParseContext) {} - -// EnterSql_stmt_list is called when production sql_stmt_list is entered. -func (s *BaseSQLiteParserListener) EnterSql_stmt_list(ctx *Sql_stmt_listContext) {} - -// ExitSql_stmt_list is called when production sql_stmt_list is exited. -func (s *BaseSQLiteParserListener) ExitSql_stmt_list(ctx *Sql_stmt_listContext) {} - -// EnterSql_stmt is called when production sql_stmt is entered. -func (s *BaseSQLiteParserListener) EnterSql_stmt(ctx *Sql_stmtContext) {} - -// ExitSql_stmt is called when production sql_stmt is exited. -func (s *BaseSQLiteParserListener) ExitSql_stmt(ctx *Sql_stmtContext) {} - -// EnterAlter_table_stmt is called when production alter_table_stmt is entered. -func (s *BaseSQLiteParserListener) EnterAlter_table_stmt(ctx *Alter_table_stmtContext) {} - -// ExitAlter_table_stmt is called when production alter_table_stmt is exited. -func (s *BaseSQLiteParserListener) ExitAlter_table_stmt(ctx *Alter_table_stmtContext) {} - -// EnterAnalyze_stmt is called when production analyze_stmt is entered. -func (s *BaseSQLiteParserListener) EnterAnalyze_stmt(ctx *Analyze_stmtContext) {} - -// ExitAnalyze_stmt is called when production analyze_stmt is exited. -func (s *BaseSQLiteParserListener) ExitAnalyze_stmt(ctx *Analyze_stmtContext) {} - -// EnterAttach_stmt is called when production attach_stmt is entered. -func (s *BaseSQLiteParserListener) EnterAttach_stmt(ctx *Attach_stmtContext) {} - -// ExitAttach_stmt is called when production attach_stmt is exited. -func (s *BaseSQLiteParserListener) ExitAttach_stmt(ctx *Attach_stmtContext) {} - -// EnterBegin_stmt is called when production begin_stmt is entered. -func (s *BaseSQLiteParserListener) EnterBegin_stmt(ctx *Begin_stmtContext) {} - -// ExitBegin_stmt is called when production begin_stmt is exited. -func (s *BaseSQLiteParserListener) ExitBegin_stmt(ctx *Begin_stmtContext) {} - -// EnterCommit_stmt is called when production commit_stmt is entered. -func (s *BaseSQLiteParserListener) EnterCommit_stmt(ctx *Commit_stmtContext) {} - -// ExitCommit_stmt is called when production commit_stmt is exited. -func (s *BaseSQLiteParserListener) ExitCommit_stmt(ctx *Commit_stmtContext) {} - -// EnterRollback_stmt is called when production rollback_stmt is entered. -func (s *BaseSQLiteParserListener) EnterRollback_stmt(ctx *Rollback_stmtContext) {} - -// ExitRollback_stmt is called when production rollback_stmt is exited. -func (s *BaseSQLiteParserListener) ExitRollback_stmt(ctx *Rollback_stmtContext) {} - -// EnterSavepoint_stmt is called when production savepoint_stmt is entered. -func (s *BaseSQLiteParserListener) EnterSavepoint_stmt(ctx *Savepoint_stmtContext) {} - -// ExitSavepoint_stmt is called when production savepoint_stmt is exited. -func (s *BaseSQLiteParserListener) ExitSavepoint_stmt(ctx *Savepoint_stmtContext) {} - -// EnterRelease_stmt is called when production release_stmt is entered. -func (s *BaseSQLiteParserListener) EnterRelease_stmt(ctx *Release_stmtContext) {} - -// ExitRelease_stmt is called when production release_stmt is exited. -func (s *BaseSQLiteParserListener) ExitRelease_stmt(ctx *Release_stmtContext) {} - -// EnterCreate_index_stmt is called when production create_index_stmt is entered. -func (s *BaseSQLiteParserListener) EnterCreate_index_stmt(ctx *Create_index_stmtContext) {} - -// ExitCreate_index_stmt is called when production create_index_stmt is exited. -func (s *BaseSQLiteParserListener) ExitCreate_index_stmt(ctx *Create_index_stmtContext) {} - -// EnterIndexed_column is called when production indexed_column is entered. -func (s *BaseSQLiteParserListener) EnterIndexed_column(ctx *Indexed_columnContext) {} - -// ExitIndexed_column is called when production indexed_column is exited. -func (s *BaseSQLiteParserListener) ExitIndexed_column(ctx *Indexed_columnContext) {} - -// EnterTable_option is called when production table_option is entered. -func (s *BaseSQLiteParserListener) EnterTable_option(ctx *Table_optionContext) {} - -// ExitTable_option is called when production table_option is exited. -func (s *BaseSQLiteParserListener) ExitTable_option(ctx *Table_optionContext) {} - -// EnterCreate_table_stmt is called when production create_table_stmt is entered. -func (s *BaseSQLiteParserListener) EnterCreate_table_stmt(ctx *Create_table_stmtContext) {} - -// ExitCreate_table_stmt is called when production create_table_stmt is exited. -func (s *BaseSQLiteParserListener) ExitCreate_table_stmt(ctx *Create_table_stmtContext) {} - -// EnterColumn_def is called when production column_def is entered. -func (s *BaseSQLiteParserListener) EnterColumn_def(ctx *Column_defContext) {} - -// ExitColumn_def is called when production column_def is exited. -func (s *BaseSQLiteParserListener) ExitColumn_def(ctx *Column_defContext) {} - -// EnterType_name is called when production type_name is entered. -func (s *BaseSQLiteParserListener) EnterType_name(ctx *Type_nameContext) {} - -// ExitType_name is called when production type_name is exited. -func (s *BaseSQLiteParserListener) ExitType_name(ctx *Type_nameContext) {} - -// EnterColumn_constraint is called when production column_constraint is entered. -func (s *BaseSQLiteParserListener) EnterColumn_constraint(ctx *Column_constraintContext) {} - -// ExitColumn_constraint is called when production column_constraint is exited. -func (s *BaseSQLiteParserListener) ExitColumn_constraint(ctx *Column_constraintContext) {} - -// EnterSigned_number is called when production signed_number is entered. -func (s *BaseSQLiteParserListener) EnterSigned_number(ctx *Signed_numberContext) {} - -// ExitSigned_number is called when production signed_number is exited. -func (s *BaseSQLiteParserListener) ExitSigned_number(ctx *Signed_numberContext) {} - -// EnterTable_constraint is called when production table_constraint is entered. -func (s *BaseSQLiteParserListener) EnterTable_constraint(ctx *Table_constraintContext) {} - -// ExitTable_constraint is called when production table_constraint is exited. -func (s *BaseSQLiteParserListener) ExitTable_constraint(ctx *Table_constraintContext) {} - -// EnterForeign_key_clause is called when production foreign_key_clause is entered. -func (s *BaseSQLiteParserListener) EnterForeign_key_clause(ctx *Foreign_key_clauseContext) {} - -// ExitForeign_key_clause is called when production foreign_key_clause is exited. -func (s *BaseSQLiteParserListener) ExitForeign_key_clause(ctx *Foreign_key_clauseContext) {} - -// EnterConflict_clause is called when production conflict_clause is entered. -func (s *BaseSQLiteParserListener) EnterConflict_clause(ctx *Conflict_clauseContext) {} - -// ExitConflict_clause is called when production conflict_clause is exited. -func (s *BaseSQLiteParserListener) ExitConflict_clause(ctx *Conflict_clauseContext) {} - -// EnterCreate_trigger_stmt is called when production create_trigger_stmt is entered. -func (s *BaseSQLiteParserListener) EnterCreate_trigger_stmt(ctx *Create_trigger_stmtContext) {} - -// ExitCreate_trigger_stmt is called when production create_trigger_stmt is exited. -func (s *BaseSQLiteParserListener) ExitCreate_trigger_stmt(ctx *Create_trigger_stmtContext) {} - -// EnterCreate_view_stmt is called when production create_view_stmt is entered. -func (s *BaseSQLiteParserListener) EnterCreate_view_stmt(ctx *Create_view_stmtContext) {} - -// ExitCreate_view_stmt is called when production create_view_stmt is exited. -func (s *BaseSQLiteParserListener) ExitCreate_view_stmt(ctx *Create_view_stmtContext) {} - -// EnterCreate_virtual_table_stmt is called when production create_virtual_table_stmt is entered. -func (s *BaseSQLiteParserListener) EnterCreate_virtual_table_stmt(ctx *Create_virtual_table_stmtContext) { -} - -// ExitCreate_virtual_table_stmt is called when production create_virtual_table_stmt is exited. -func (s *BaseSQLiteParserListener) ExitCreate_virtual_table_stmt(ctx *Create_virtual_table_stmtContext) { -} - -// EnterWith_clause is called when production with_clause is entered. -func (s *BaseSQLiteParserListener) EnterWith_clause(ctx *With_clauseContext) {} - -// ExitWith_clause is called when production with_clause is exited. -func (s *BaseSQLiteParserListener) ExitWith_clause(ctx *With_clauseContext) {} - -// EnterCte_table_name is called when production cte_table_name is entered. -func (s *BaseSQLiteParserListener) EnterCte_table_name(ctx *Cte_table_nameContext) {} - -// ExitCte_table_name is called when production cte_table_name is exited. -func (s *BaseSQLiteParserListener) ExitCte_table_name(ctx *Cte_table_nameContext) {} - -// EnterRecursive_cte is called when production recursive_cte is entered. -func (s *BaseSQLiteParserListener) EnterRecursive_cte(ctx *Recursive_cteContext) {} - -// ExitRecursive_cte is called when production recursive_cte is exited. -func (s *BaseSQLiteParserListener) ExitRecursive_cte(ctx *Recursive_cteContext) {} - -// EnterCommon_table_expression is called when production common_table_expression is entered. -func (s *BaseSQLiteParserListener) EnterCommon_table_expression(ctx *Common_table_expressionContext) { -} - -// ExitCommon_table_expression is called when production common_table_expression is exited. -func (s *BaseSQLiteParserListener) ExitCommon_table_expression(ctx *Common_table_expressionContext) {} - -// EnterReturning_clause is called when production returning_clause is entered. -func (s *BaseSQLiteParserListener) EnterReturning_clause(ctx *Returning_clauseContext) {} - -// ExitReturning_clause is called when production returning_clause is exited. -func (s *BaseSQLiteParserListener) ExitReturning_clause(ctx *Returning_clauseContext) {} - -// EnterDelete_stmt is called when production delete_stmt is entered. -func (s *BaseSQLiteParserListener) EnterDelete_stmt(ctx *Delete_stmtContext) {} - -// ExitDelete_stmt is called when production delete_stmt is exited. -func (s *BaseSQLiteParserListener) ExitDelete_stmt(ctx *Delete_stmtContext) {} - -// EnterDelete_stmt_limited is called when production delete_stmt_limited is entered. -func (s *BaseSQLiteParserListener) EnterDelete_stmt_limited(ctx *Delete_stmt_limitedContext) {} - -// ExitDelete_stmt_limited is called when production delete_stmt_limited is exited. -func (s *BaseSQLiteParserListener) ExitDelete_stmt_limited(ctx *Delete_stmt_limitedContext) {} - -// EnterDetach_stmt is called when production detach_stmt is entered. -func (s *BaseSQLiteParserListener) EnterDetach_stmt(ctx *Detach_stmtContext) {} - -// ExitDetach_stmt is called when production detach_stmt is exited. -func (s *BaseSQLiteParserListener) ExitDetach_stmt(ctx *Detach_stmtContext) {} - -// EnterDrop_stmt is called when production drop_stmt is entered. -func (s *BaseSQLiteParserListener) EnterDrop_stmt(ctx *Drop_stmtContext) {} - -// ExitDrop_stmt is called when production drop_stmt is exited. -func (s *BaseSQLiteParserListener) ExitDrop_stmt(ctx *Drop_stmtContext) {} - -// EnterExpr_case is called when production expr_case is entered. -func (s *BaseSQLiteParserListener) EnterExpr_case(ctx *Expr_caseContext) {} - -// ExitExpr_case is called when production expr_case is exited. -func (s *BaseSQLiteParserListener) ExitExpr_case(ctx *Expr_caseContext) {} - -// EnterExpr_raise is called when production expr_raise is entered. -func (s *BaseSQLiteParserListener) EnterExpr_raise(ctx *Expr_raiseContext) {} - -// ExitExpr_raise is called when production expr_raise is exited. -func (s *BaseSQLiteParserListener) ExitExpr_raise(ctx *Expr_raiseContext) {} - -// EnterExpr_function is called when production expr_function is entered. -func (s *BaseSQLiteParserListener) EnterExpr_function(ctx *Expr_functionContext) {} - -// ExitExpr_function is called when production expr_function is exited. -func (s *BaseSQLiteParserListener) ExitExpr_function(ctx *Expr_functionContext) {} - -// EnterExpr_comparison is called when production expr_comparison is entered. -func (s *BaseSQLiteParserListener) EnterExpr_comparison(ctx *Expr_comparisonContext) {} - -// ExitExpr_comparison is called when production expr_comparison is exited. -func (s *BaseSQLiteParserListener) ExitExpr_comparison(ctx *Expr_comparisonContext) {} - -// EnterExpr_binary is called when production expr_binary is entered. -func (s *BaseSQLiteParserListener) EnterExpr_binary(ctx *Expr_binaryContext) {} - -// ExitExpr_binary is called when production expr_binary is exited. -func (s *BaseSQLiteParserListener) ExitExpr_binary(ctx *Expr_binaryContext) {} - -// EnterExpr_literal is called when production expr_literal is entered. -func (s *BaseSQLiteParserListener) EnterExpr_literal(ctx *Expr_literalContext) {} - -// ExitExpr_literal is called when production expr_literal is exited. -func (s *BaseSQLiteParserListener) ExitExpr_literal(ctx *Expr_literalContext) {} - -// EnterExpr_cast is called when production expr_cast is entered. -func (s *BaseSQLiteParserListener) EnterExpr_cast(ctx *Expr_castContext) {} - -// ExitExpr_cast is called when production expr_cast is exited. -func (s *BaseSQLiteParserListener) ExitExpr_cast(ctx *Expr_castContext) {} - -// EnterExpr_in_select is called when production expr_in_select is entered. -func (s *BaseSQLiteParserListener) EnterExpr_in_select(ctx *Expr_in_selectContext) {} - -// ExitExpr_in_select is called when production expr_in_select is exited. -func (s *BaseSQLiteParserListener) ExitExpr_in_select(ctx *Expr_in_selectContext) {} - -// EnterExpr_list is called when production expr_list is entered. -func (s *BaseSQLiteParserListener) EnterExpr_list(ctx *Expr_listContext) {} - -// ExitExpr_list is called when production expr_list is exited. -func (s *BaseSQLiteParserListener) ExitExpr_list(ctx *Expr_listContext) {} - -// EnterExpr_between is called when production expr_between is entered. -func (s *BaseSQLiteParserListener) EnterExpr_between(ctx *Expr_betweenContext) {} - -// ExitExpr_between is called when production expr_between is exited. -func (s *BaseSQLiteParserListener) ExitExpr_between(ctx *Expr_betweenContext) {} - -// EnterExpr_collate is called when production expr_collate is entered. -func (s *BaseSQLiteParserListener) EnterExpr_collate(ctx *Expr_collateContext) {} - -// ExitExpr_collate is called when production expr_collate is exited. -func (s *BaseSQLiteParserListener) ExitExpr_collate(ctx *Expr_collateContext) {} - -// EnterExpr_qualified_column_name is called when production expr_qualified_column_name is entered. -func (s *BaseSQLiteParserListener) EnterExpr_qualified_column_name(ctx *Expr_qualified_column_nameContext) { -} - -// ExitExpr_qualified_column_name is called when production expr_qualified_column_name is exited. -func (s *BaseSQLiteParserListener) ExitExpr_qualified_column_name(ctx *Expr_qualified_column_nameContext) { -} - -// EnterExpr_math_op is called when production expr_math_op is entered. -func (s *BaseSQLiteParserListener) EnterExpr_math_op(ctx *Expr_math_opContext) {} - -// ExitExpr_math_op is called when production expr_math_op is exited. -func (s *BaseSQLiteParserListener) ExitExpr_math_op(ctx *Expr_math_opContext) {} - -// EnterExpr_unary is called when production expr_unary is entered. -func (s *BaseSQLiteParserListener) EnterExpr_unary(ctx *Expr_unaryContext) {} - -// ExitExpr_unary is called when production expr_unary is exited. -func (s *BaseSQLiteParserListener) ExitExpr_unary(ctx *Expr_unaryContext) {} - -// EnterExpr_null_comp is called when production expr_null_comp is entered. -func (s *BaseSQLiteParserListener) EnterExpr_null_comp(ctx *Expr_null_compContext) {} - -// ExitExpr_null_comp is called when production expr_null_comp is exited. -func (s *BaseSQLiteParserListener) ExitExpr_null_comp(ctx *Expr_null_compContext) {} - -// EnterExpr_bind is called when production expr_bind is entered. -func (s *BaseSQLiteParserListener) EnterExpr_bind(ctx *Expr_bindContext) {} - -// ExitExpr_bind is called when production expr_bind is exited. -func (s *BaseSQLiteParserListener) ExitExpr_bind(ctx *Expr_bindContext) {} - -// EnterRaise_function is called when production raise_function is entered. -func (s *BaseSQLiteParserListener) EnterRaise_function(ctx *Raise_functionContext) {} - -// ExitRaise_function is called when production raise_function is exited. -func (s *BaseSQLiteParserListener) ExitRaise_function(ctx *Raise_functionContext) {} - -// EnterLiteral_value is called when production literal_value is entered. -func (s *BaseSQLiteParserListener) EnterLiteral_value(ctx *Literal_valueContext) {} - -// ExitLiteral_value is called when production literal_value is exited. -func (s *BaseSQLiteParserListener) ExitLiteral_value(ctx *Literal_valueContext) {} - -// EnterInsert_stmt is called when production insert_stmt is entered. -func (s *BaseSQLiteParserListener) EnterInsert_stmt(ctx *Insert_stmtContext) {} - -// ExitInsert_stmt is called when production insert_stmt is exited. -func (s *BaseSQLiteParserListener) ExitInsert_stmt(ctx *Insert_stmtContext) {} - -// EnterUpsert_clause is called when production upsert_clause is entered. -func (s *BaseSQLiteParserListener) EnterUpsert_clause(ctx *Upsert_clauseContext) {} - -// ExitUpsert_clause is called when production upsert_clause is exited. -func (s *BaseSQLiteParserListener) ExitUpsert_clause(ctx *Upsert_clauseContext) {} - -// EnterPragma_stmt is called when production pragma_stmt is entered. -func (s *BaseSQLiteParserListener) EnterPragma_stmt(ctx *Pragma_stmtContext) {} - -// ExitPragma_stmt is called when production pragma_stmt is exited. -func (s *BaseSQLiteParserListener) ExitPragma_stmt(ctx *Pragma_stmtContext) {} - -// EnterPragma_value is called when production pragma_value is entered. -func (s *BaseSQLiteParserListener) EnterPragma_value(ctx *Pragma_valueContext) {} - -// ExitPragma_value is called when production pragma_value is exited. -func (s *BaseSQLiteParserListener) ExitPragma_value(ctx *Pragma_valueContext) {} - -// EnterReindex_stmt is called when production reindex_stmt is entered. -func (s *BaseSQLiteParserListener) EnterReindex_stmt(ctx *Reindex_stmtContext) {} - -// ExitReindex_stmt is called when production reindex_stmt is exited. -func (s *BaseSQLiteParserListener) ExitReindex_stmt(ctx *Reindex_stmtContext) {} - -// EnterSelect_stmt is called when production select_stmt is entered. -func (s *BaseSQLiteParserListener) EnterSelect_stmt(ctx *Select_stmtContext) {} - -// ExitSelect_stmt is called when production select_stmt is exited. -func (s *BaseSQLiteParserListener) ExitSelect_stmt(ctx *Select_stmtContext) {} - -// EnterJoin_clause is called when production join_clause is entered. -func (s *BaseSQLiteParserListener) EnterJoin_clause(ctx *Join_clauseContext) {} - -// ExitJoin_clause is called when production join_clause is exited. -func (s *BaseSQLiteParserListener) ExitJoin_clause(ctx *Join_clauseContext) {} - -// EnterSelect_core is called when production select_core is entered. -func (s *BaseSQLiteParserListener) EnterSelect_core(ctx *Select_coreContext) {} - -// ExitSelect_core is called when production select_core is exited. -func (s *BaseSQLiteParserListener) ExitSelect_core(ctx *Select_coreContext) {} - -// EnterFactored_select_stmt is called when production factored_select_stmt is entered. -func (s *BaseSQLiteParserListener) EnterFactored_select_stmt(ctx *Factored_select_stmtContext) {} - -// ExitFactored_select_stmt is called when production factored_select_stmt is exited. -func (s *BaseSQLiteParserListener) ExitFactored_select_stmt(ctx *Factored_select_stmtContext) {} - -// EnterSimple_select_stmt is called when production simple_select_stmt is entered. -func (s *BaseSQLiteParserListener) EnterSimple_select_stmt(ctx *Simple_select_stmtContext) {} - -// ExitSimple_select_stmt is called when production simple_select_stmt is exited. -func (s *BaseSQLiteParserListener) ExitSimple_select_stmt(ctx *Simple_select_stmtContext) {} - -// EnterCompound_select_stmt is called when production compound_select_stmt is entered. -func (s *BaseSQLiteParserListener) EnterCompound_select_stmt(ctx *Compound_select_stmtContext) {} - -// ExitCompound_select_stmt is called when production compound_select_stmt is exited. -func (s *BaseSQLiteParserListener) ExitCompound_select_stmt(ctx *Compound_select_stmtContext) {} - -// EnterTable_or_subquery is called when production table_or_subquery is entered. -func (s *BaseSQLiteParserListener) EnterTable_or_subquery(ctx *Table_or_subqueryContext) {} - -// ExitTable_or_subquery is called when production table_or_subquery is exited. -func (s *BaseSQLiteParserListener) ExitTable_or_subquery(ctx *Table_or_subqueryContext) {} - -// EnterResult_column is called when production result_column is entered. -func (s *BaseSQLiteParserListener) EnterResult_column(ctx *Result_columnContext) {} - -// ExitResult_column is called when production result_column is exited. -func (s *BaseSQLiteParserListener) ExitResult_column(ctx *Result_columnContext) {} - -// EnterJoin_operator is called when production join_operator is entered. -func (s *BaseSQLiteParserListener) EnterJoin_operator(ctx *Join_operatorContext) {} - -// ExitJoin_operator is called when production join_operator is exited. -func (s *BaseSQLiteParserListener) ExitJoin_operator(ctx *Join_operatorContext) {} - -// EnterJoin_constraint is called when production join_constraint is entered. -func (s *BaseSQLiteParserListener) EnterJoin_constraint(ctx *Join_constraintContext) {} - -// ExitJoin_constraint is called when production join_constraint is exited. -func (s *BaseSQLiteParserListener) ExitJoin_constraint(ctx *Join_constraintContext) {} - -// EnterCompound_operator is called when production compound_operator is entered. -func (s *BaseSQLiteParserListener) EnterCompound_operator(ctx *Compound_operatorContext) {} - -// ExitCompound_operator is called when production compound_operator is exited. -func (s *BaseSQLiteParserListener) ExitCompound_operator(ctx *Compound_operatorContext) {} - -// EnterUpdate_stmt is called when production update_stmt is entered. -func (s *BaseSQLiteParserListener) EnterUpdate_stmt(ctx *Update_stmtContext) {} - -// ExitUpdate_stmt is called when production update_stmt is exited. -func (s *BaseSQLiteParserListener) ExitUpdate_stmt(ctx *Update_stmtContext) {} - -// EnterColumn_name_list is called when production column_name_list is entered. -func (s *BaseSQLiteParserListener) EnterColumn_name_list(ctx *Column_name_listContext) {} - -// ExitColumn_name_list is called when production column_name_list is exited. -func (s *BaseSQLiteParserListener) ExitColumn_name_list(ctx *Column_name_listContext) {} - -// EnterUpdate_stmt_limited is called when production update_stmt_limited is entered. -func (s *BaseSQLiteParserListener) EnterUpdate_stmt_limited(ctx *Update_stmt_limitedContext) {} - -// ExitUpdate_stmt_limited is called when production update_stmt_limited is exited. -func (s *BaseSQLiteParserListener) ExitUpdate_stmt_limited(ctx *Update_stmt_limitedContext) {} - -// EnterQualified_table_name is called when production qualified_table_name is entered. -func (s *BaseSQLiteParserListener) EnterQualified_table_name(ctx *Qualified_table_nameContext) {} - -// ExitQualified_table_name is called when production qualified_table_name is exited. -func (s *BaseSQLiteParserListener) ExitQualified_table_name(ctx *Qualified_table_nameContext) {} - -// EnterVacuum_stmt is called when production vacuum_stmt is entered. -func (s *BaseSQLiteParserListener) EnterVacuum_stmt(ctx *Vacuum_stmtContext) {} - -// ExitVacuum_stmt is called when production vacuum_stmt is exited. -func (s *BaseSQLiteParserListener) ExitVacuum_stmt(ctx *Vacuum_stmtContext) {} - -// EnterFilter_clause is called when production filter_clause is entered. -func (s *BaseSQLiteParserListener) EnterFilter_clause(ctx *Filter_clauseContext) {} - -// ExitFilter_clause is called when production filter_clause is exited. -func (s *BaseSQLiteParserListener) ExitFilter_clause(ctx *Filter_clauseContext) {} - -// EnterWindow_defn is called when production window_defn is entered. -func (s *BaseSQLiteParserListener) EnterWindow_defn(ctx *Window_defnContext) {} - -// ExitWindow_defn is called when production window_defn is exited. -func (s *BaseSQLiteParserListener) ExitWindow_defn(ctx *Window_defnContext) {} - -// EnterOver_clause is called when production over_clause is entered. -func (s *BaseSQLiteParserListener) EnterOver_clause(ctx *Over_clauseContext) {} - -// ExitOver_clause is called when production over_clause is exited. -func (s *BaseSQLiteParserListener) ExitOver_clause(ctx *Over_clauseContext) {} - -// EnterFrame_spec is called when production frame_spec is entered. -func (s *BaseSQLiteParserListener) EnterFrame_spec(ctx *Frame_specContext) {} - -// ExitFrame_spec is called when production frame_spec is exited. -func (s *BaseSQLiteParserListener) ExitFrame_spec(ctx *Frame_specContext) {} - -// EnterFrame_clause is called when production frame_clause is entered. -func (s *BaseSQLiteParserListener) EnterFrame_clause(ctx *Frame_clauseContext) {} - -// ExitFrame_clause is called when production frame_clause is exited. -func (s *BaseSQLiteParserListener) ExitFrame_clause(ctx *Frame_clauseContext) {} - -// EnterSimple_function_invocation is called when production simple_function_invocation is entered. -func (s *BaseSQLiteParserListener) EnterSimple_function_invocation(ctx *Simple_function_invocationContext) { -} - -// ExitSimple_function_invocation is called when production simple_function_invocation is exited. -func (s *BaseSQLiteParserListener) ExitSimple_function_invocation(ctx *Simple_function_invocationContext) { -} - -// EnterAggregate_function_invocation is called when production aggregate_function_invocation is entered. -func (s *BaseSQLiteParserListener) EnterAggregate_function_invocation(ctx *Aggregate_function_invocationContext) { -} - -// ExitAggregate_function_invocation is called when production aggregate_function_invocation is exited. -func (s *BaseSQLiteParserListener) ExitAggregate_function_invocation(ctx *Aggregate_function_invocationContext) { -} - -// EnterWindow_function_invocation is called when production window_function_invocation is entered. -func (s *BaseSQLiteParserListener) EnterWindow_function_invocation(ctx *Window_function_invocationContext) { -} - -// ExitWindow_function_invocation is called when production window_function_invocation is exited. -func (s *BaseSQLiteParserListener) ExitWindow_function_invocation(ctx *Window_function_invocationContext) { -} - -// EnterCommon_table_stmt is called when production common_table_stmt is entered. -func (s *BaseSQLiteParserListener) EnterCommon_table_stmt(ctx *Common_table_stmtContext) {} - -// ExitCommon_table_stmt is called when production common_table_stmt is exited. -func (s *BaseSQLiteParserListener) ExitCommon_table_stmt(ctx *Common_table_stmtContext) {} - -// EnterOrder_by_stmt is called when production order_by_stmt is entered. -func (s *BaseSQLiteParserListener) EnterOrder_by_stmt(ctx *Order_by_stmtContext) {} - -// ExitOrder_by_stmt is called when production order_by_stmt is exited. -func (s *BaseSQLiteParserListener) ExitOrder_by_stmt(ctx *Order_by_stmtContext) {} - -// EnterLimit_stmt is called when production limit_stmt is entered. -func (s *BaseSQLiteParserListener) EnterLimit_stmt(ctx *Limit_stmtContext) {} - -// ExitLimit_stmt is called when production limit_stmt is exited. -func (s *BaseSQLiteParserListener) ExitLimit_stmt(ctx *Limit_stmtContext) {} - -// EnterOrdering_term is called when production ordering_term is entered. -func (s *BaseSQLiteParserListener) EnterOrdering_term(ctx *Ordering_termContext) {} - -// ExitOrdering_term is called when production ordering_term is exited. -func (s *BaseSQLiteParserListener) ExitOrdering_term(ctx *Ordering_termContext) {} - -// EnterAsc_desc is called when production asc_desc is entered. -func (s *BaseSQLiteParserListener) EnterAsc_desc(ctx *Asc_descContext) {} - -// ExitAsc_desc is called when production asc_desc is exited. -func (s *BaseSQLiteParserListener) ExitAsc_desc(ctx *Asc_descContext) {} - -// EnterFrame_left is called when production frame_left is entered. -func (s *BaseSQLiteParserListener) EnterFrame_left(ctx *Frame_leftContext) {} - -// ExitFrame_left is called when production frame_left is exited. -func (s *BaseSQLiteParserListener) ExitFrame_left(ctx *Frame_leftContext) {} - -// EnterFrame_right is called when production frame_right is entered. -func (s *BaseSQLiteParserListener) EnterFrame_right(ctx *Frame_rightContext) {} - -// ExitFrame_right is called when production frame_right is exited. -func (s *BaseSQLiteParserListener) ExitFrame_right(ctx *Frame_rightContext) {} - -// EnterFrame_single is called when production frame_single is entered. -func (s *BaseSQLiteParserListener) EnterFrame_single(ctx *Frame_singleContext) {} - -// ExitFrame_single is called when production frame_single is exited. -func (s *BaseSQLiteParserListener) ExitFrame_single(ctx *Frame_singleContext) {} - -// EnterWindow_function is called when production window_function is entered. -func (s *BaseSQLiteParserListener) EnterWindow_function(ctx *Window_functionContext) {} - -// ExitWindow_function is called when production window_function is exited. -func (s *BaseSQLiteParserListener) ExitWindow_function(ctx *Window_functionContext) {} - -// EnterOf_OF_fset is called when production of_OF_fset is entered. -func (s *BaseSQLiteParserListener) EnterOf_OF_fset(ctx *Of_OF_fsetContext) {} - -// ExitOf_OF_fset is called when production of_OF_fset is exited. -func (s *BaseSQLiteParserListener) ExitOf_OF_fset(ctx *Of_OF_fsetContext) {} - -// EnterDefault_DEFAULT__value is called when production default_DEFAULT__value is entered. -func (s *BaseSQLiteParserListener) EnterDefault_DEFAULT__value(ctx *Default_DEFAULT__valueContext) {} - -// ExitDefault_DEFAULT__value is called when production default_DEFAULT__value is exited. -func (s *BaseSQLiteParserListener) ExitDefault_DEFAULT__value(ctx *Default_DEFAULT__valueContext) {} - -// EnterPartition_by is called when production partition_by is entered. -func (s *BaseSQLiteParserListener) EnterPartition_by(ctx *Partition_byContext) {} - -// ExitPartition_by is called when production partition_by is exited. -func (s *BaseSQLiteParserListener) ExitPartition_by(ctx *Partition_byContext) {} - -// EnterOrder_by_expr is called when production order_by_expr is entered. -func (s *BaseSQLiteParserListener) EnterOrder_by_expr(ctx *Order_by_exprContext) {} - -// ExitOrder_by_expr is called when production order_by_expr is exited. -func (s *BaseSQLiteParserListener) ExitOrder_by_expr(ctx *Order_by_exprContext) {} - -// EnterOrder_by_expr_asc_desc is called when production order_by_expr_asc_desc is entered. -func (s *BaseSQLiteParserListener) EnterOrder_by_expr_asc_desc(ctx *Order_by_expr_asc_descContext) {} - -// ExitOrder_by_expr_asc_desc is called when production order_by_expr_asc_desc is exited. -func (s *BaseSQLiteParserListener) ExitOrder_by_expr_asc_desc(ctx *Order_by_expr_asc_descContext) {} - -// EnterExpr_asc_desc is called when production expr_asc_desc is entered. -func (s *BaseSQLiteParserListener) EnterExpr_asc_desc(ctx *Expr_asc_descContext) {} - -// ExitExpr_asc_desc is called when production expr_asc_desc is exited. -func (s *BaseSQLiteParserListener) ExitExpr_asc_desc(ctx *Expr_asc_descContext) {} - -// EnterInitial_select is called when production initial_select is entered. -func (s *BaseSQLiteParserListener) EnterInitial_select(ctx *Initial_selectContext) {} - -// ExitInitial_select is called when production initial_select is exited. -func (s *BaseSQLiteParserListener) ExitInitial_select(ctx *Initial_selectContext) {} - -// EnterRecursive__select is called when production recursive__select is entered. -func (s *BaseSQLiteParserListener) EnterRecursive__select(ctx *Recursive__selectContext) {} - -// ExitRecursive__select is called when production recursive__select is exited. -func (s *BaseSQLiteParserListener) ExitRecursive__select(ctx *Recursive__selectContext) {} - -// EnterUnary_operator is called when production unary_operator is entered. -func (s *BaseSQLiteParserListener) EnterUnary_operator(ctx *Unary_operatorContext) {} - -// ExitUnary_operator is called when production unary_operator is exited. -func (s *BaseSQLiteParserListener) ExitUnary_operator(ctx *Unary_operatorContext) {} - -// EnterError_message is called when production error_message is entered. -func (s *BaseSQLiteParserListener) EnterError_message(ctx *Error_messageContext) {} - -// ExitError_message is called when production error_message is exited. -func (s *BaseSQLiteParserListener) ExitError_message(ctx *Error_messageContext) {} - -// EnterModule_argument is called when production module_argument is entered. -func (s *BaseSQLiteParserListener) EnterModule_argument(ctx *Module_argumentContext) {} - -// ExitModule_argument is called when production module_argument is exited. -func (s *BaseSQLiteParserListener) ExitModule_argument(ctx *Module_argumentContext) {} - -// EnterColumn_alias is called when production column_alias is entered. -func (s *BaseSQLiteParserListener) EnterColumn_alias(ctx *Column_aliasContext) {} - -// ExitColumn_alias is called when production column_alias is exited. -func (s *BaseSQLiteParserListener) ExitColumn_alias(ctx *Column_aliasContext) {} - -// EnterKeyword is called when production keyword is entered. -func (s *BaseSQLiteParserListener) EnterKeyword(ctx *KeywordContext) {} - -// ExitKeyword is called when production keyword is exited. -func (s *BaseSQLiteParserListener) ExitKeyword(ctx *KeywordContext) {} - -// EnterName is called when production name is entered. -func (s *BaseSQLiteParserListener) EnterName(ctx *NameContext) {} - -// ExitName is called when production name is exited. -func (s *BaseSQLiteParserListener) ExitName(ctx *NameContext) {} - -// EnterFunction_name is called when production function_name is entered. -func (s *BaseSQLiteParserListener) EnterFunction_name(ctx *Function_nameContext) {} - -// ExitFunction_name is called when production function_name is exited. -func (s *BaseSQLiteParserListener) ExitFunction_name(ctx *Function_nameContext) {} - -// EnterQualified_function_name is called when production qualified_function_name is entered. -func (s *BaseSQLiteParserListener) EnterQualified_function_name(ctx *Qualified_function_nameContext) { -} - -// ExitQualified_function_name is called when production qualified_function_name is exited. -func (s *BaseSQLiteParserListener) ExitQualified_function_name(ctx *Qualified_function_nameContext) {} - -// EnterSchema_name is called when production schema_name is entered. -func (s *BaseSQLiteParserListener) EnterSchema_name(ctx *Schema_nameContext) {} - -// ExitSchema_name is called when production schema_name is exited. -func (s *BaseSQLiteParserListener) ExitSchema_name(ctx *Schema_nameContext) {} - -// EnterTable_name is called when production table_name is entered. -func (s *BaseSQLiteParserListener) EnterTable_name(ctx *Table_nameContext) {} - -// ExitTable_name is called when production table_name is exited. -func (s *BaseSQLiteParserListener) ExitTable_name(ctx *Table_nameContext) {} - -// EnterTable_or_index_name is called when production table_or_index_name is entered. -func (s *BaseSQLiteParserListener) EnterTable_or_index_name(ctx *Table_or_index_nameContext) {} - -// ExitTable_or_index_name is called when production table_or_index_name is exited. -func (s *BaseSQLiteParserListener) ExitTable_or_index_name(ctx *Table_or_index_nameContext) {} - -// EnterNew_table_name is called when production new_table_name is entered. -func (s *BaseSQLiteParserListener) EnterNew_table_name(ctx *New_table_nameContext) {} - -// ExitNew_table_name is called when production new_table_name is exited. -func (s *BaseSQLiteParserListener) ExitNew_table_name(ctx *New_table_nameContext) {} - -// EnterColumn_name is called when production column_name is entered. -func (s *BaseSQLiteParserListener) EnterColumn_name(ctx *Column_nameContext) {} - -// ExitColumn_name is called when production column_name is exited. -func (s *BaseSQLiteParserListener) ExitColumn_name(ctx *Column_nameContext) {} - -// EnterCollation_name is called when production collation_name is entered. -func (s *BaseSQLiteParserListener) EnterCollation_name(ctx *Collation_nameContext) {} - -// ExitCollation_name is called when production collation_name is exited. -func (s *BaseSQLiteParserListener) ExitCollation_name(ctx *Collation_nameContext) {} - -// EnterForeign_table is called when production foreign_table is entered. -func (s *BaseSQLiteParserListener) EnterForeign_table(ctx *Foreign_tableContext) {} - -// ExitForeign_table is called when production foreign_table is exited. -func (s *BaseSQLiteParserListener) ExitForeign_table(ctx *Foreign_tableContext) {} - -// EnterIndex_name is called when production index_name is entered. -func (s *BaseSQLiteParserListener) EnterIndex_name(ctx *Index_nameContext) {} - -// ExitIndex_name is called when production index_name is exited. -func (s *BaseSQLiteParserListener) ExitIndex_name(ctx *Index_nameContext) {} - -// EnterTrigger_name is called when production trigger_name is entered. -func (s *BaseSQLiteParserListener) EnterTrigger_name(ctx *Trigger_nameContext) {} - -// ExitTrigger_name is called when production trigger_name is exited. -func (s *BaseSQLiteParserListener) ExitTrigger_name(ctx *Trigger_nameContext) {} - -// EnterView_name is called when production view_name is entered. -func (s *BaseSQLiteParserListener) EnterView_name(ctx *View_nameContext) {} - -// ExitView_name is called when production view_name is exited. -func (s *BaseSQLiteParserListener) ExitView_name(ctx *View_nameContext) {} - -// EnterModule_name is called when production module_name is entered. -func (s *BaseSQLiteParserListener) EnterModule_name(ctx *Module_nameContext) {} - -// ExitModule_name is called when production module_name is exited. -func (s *BaseSQLiteParserListener) ExitModule_name(ctx *Module_nameContext) {} - -// EnterPragma_name is called when production pragma_name is entered. -func (s *BaseSQLiteParserListener) EnterPragma_name(ctx *Pragma_nameContext) {} - -// ExitPragma_name is called when production pragma_name is exited. -func (s *BaseSQLiteParserListener) ExitPragma_name(ctx *Pragma_nameContext) {} - -// EnterSavepoint_name is called when production savepoint_name is entered. -func (s *BaseSQLiteParserListener) EnterSavepoint_name(ctx *Savepoint_nameContext) {} - -// ExitSavepoint_name is called when production savepoint_name is exited. -func (s *BaseSQLiteParserListener) ExitSavepoint_name(ctx *Savepoint_nameContext) {} - -// EnterTable_alias is called when production table_alias is entered. -func (s *BaseSQLiteParserListener) EnterTable_alias(ctx *Table_aliasContext) {} - -// ExitTable_alias is called when production table_alias is exited. -func (s *BaseSQLiteParserListener) ExitTable_alias(ctx *Table_aliasContext) {} - -// EnterTable_alias_fallback is called when production table_alias_fallback is entered. -func (s *BaseSQLiteParserListener) EnterTable_alias_fallback(ctx *Table_alias_fallbackContext) {} - -// ExitTable_alias_fallback is called when production table_alias_fallback is exited. -func (s *BaseSQLiteParserListener) ExitTable_alias_fallback(ctx *Table_alias_fallbackContext) {} - -// EnterTransaction_name is called when production transaction_name is entered. -func (s *BaseSQLiteParserListener) EnterTransaction_name(ctx *Transaction_nameContext) {} - -// ExitTransaction_name is called when production transaction_name is exited. -func (s *BaseSQLiteParserListener) ExitTransaction_name(ctx *Transaction_nameContext) {} - -// EnterWindow_name is called when production window_name is entered. -func (s *BaseSQLiteParserListener) EnterWindow_name(ctx *Window_nameContext) {} - -// ExitWindow_name is called when production window_name is exited. -func (s *BaseSQLiteParserListener) ExitWindow_name(ctx *Window_nameContext) {} - -// EnterAlias is called when production alias is entered. -func (s *BaseSQLiteParserListener) EnterAlias(ctx *AliasContext) {} - -// ExitAlias is called when production alias is exited. -func (s *BaseSQLiteParserListener) ExitAlias(ctx *AliasContext) {} - -// EnterFilename is called when production filename is entered. -func (s *BaseSQLiteParserListener) EnterFilename(ctx *FilenameContext) {} - -// ExitFilename is called when production filename is exited. -func (s *BaseSQLiteParserListener) ExitFilename(ctx *FilenameContext) {} - -// EnterBase_window_name is called when production base_window_name is entered. -func (s *BaseSQLiteParserListener) EnterBase_window_name(ctx *Base_window_nameContext) {} - -// ExitBase_window_name is called when production base_window_name is exited. -func (s *BaseSQLiteParserListener) ExitBase_window_name(ctx *Base_window_nameContext) {} - -// EnterSimple_func is called when production simple_func is entered. -func (s *BaseSQLiteParserListener) EnterSimple_func(ctx *Simple_funcContext) {} - -// ExitSimple_func is called when production simple_func is exited. -func (s *BaseSQLiteParserListener) ExitSimple_func(ctx *Simple_funcContext) {} - -// EnterAggregate_func is called when production aggregate_func is entered. -func (s *BaseSQLiteParserListener) EnterAggregate_func(ctx *Aggregate_funcContext) {} - -// ExitAggregate_func is called when production aggregate_func is exited. -func (s *BaseSQLiteParserListener) ExitAggregate_func(ctx *Aggregate_funcContext) {} - -// EnterTable_function_name is called when production table_function_name is entered. -func (s *BaseSQLiteParserListener) EnterTable_function_name(ctx *Table_function_nameContext) {} - -// ExitTable_function_name is called when production table_function_name is exited. -func (s *BaseSQLiteParserListener) ExitTable_function_name(ctx *Table_function_nameContext) {} - -// EnterAny_name is called when production any_name is entered. -func (s *BaseSQLiteParserListener) EnterAny_name(ctx *Any_nameContext) {} - -// ExitAny_name is called when production any_name is exited. -func (s *BaseSQLiteParserListener) ExitAny_name(ctx *Any_nameContext) {} diff --git a/internal/engine/sqlite/parser/sqliteparser_listener.go b/internal/engine/sqlite/parser/sqliteparser_listener.go deleted file mode 100644 index f121faf872..0000000000 --- a/internal/engine/sqlite/parser/sqliteparser_listener.go +++ /dev/null @@ -1,790 +0,0 @@ -// Code generated from SQLiteParser.g4 by ANTLR 4.12.0. DO NOT EDIT. - -package parser // SQLiteParser - -import "github.com/antlr/antlr4/runtime/Go/antlr/v4" - -// SQLiteParserListener is a complete listener for a parse tree produced by SQLiteParser. -type SQLiteParserListener interface { - antlr.ParseTreeListener - - // EnterParse is called when entering the parse production. - EnterParse(c *ParseContext) - - // EnterSql_stmt_list is called when entering the sql_stmt_list production. - EnterSql_stmt_list(c *Sql_stmt_listContext) - - // EnterSql_stmt is called when entering the sql_stmt production. - EnterSql_stmt(c *Sql_stmtContext) - - // EnterAlter_table_stmt is called when entering the alter_table_stmt production. - EnterAlter_table_stmt(c *Alter_table_stmtContext) - - // EnterAnalyze_stmt is called when entering the analyze_stmt production. - EnterAnalyze_stmt(c *Analyze_stmtContext) - - // EnterAttach_stmt is called when entering the attach_stmt production. - EnterAttach_stmt(c *Attach_stmtContext) - - // EnterBegin_stmt is called when entering the begin_stmt production. - EnterBegin_stmt(c *Begin_stmtContext) - - // EnterCommit_stmt is called when entering the commit_stmt production. - EnterCommit_stmt(c *Commit_stmtContext) - - // EnterRollback_stmt is called when entering the rollback_stmt production. - EnterRollback_stmt(c *Rollback_stmtContext) - - // EnterSavepoint_stmt is called when entering the savepoint_stmt production. - EnterSavepoint_stmt(c *Savepoint_stmtContext) - - // EnterRelease_stmt is called when entering the release_stmt production. - EnterRelease_stmt(c *Release_stmtContext) - - // EnterCreate_index_stmt is called when entering the create_index_stmt production. - EnterCreate_index_stmt(c *Create_index_stmtContext) - - // EnterIndexed_column is called when entering the indexed_column production. - EnterIndexed_column(c *Indexed_columnContext) - - // EnterTable_option is called when entering the table_option production. - EnterTable_option(c *Table_optionContext) - - // EnterCreate_table_stmt is called when entering the create_table_stmt production. - EnterCreate_table_stmt(c *Create_table_stmtContext) - - // EnterColumn_def is called when entering the column_def production. - EnterColumn_def(c *Column_defContext) - - // EnterType_name is called when entering the type_name production. - EnterType_name(c *Type_nameContext) - - // EnterColumn_constraint is called when entering the column_constraint production. - EnterColumn_constraint(c *Column_constraintContext) - - // EnterSigned_number is called when entering the signed_number production. - EnterSigned_number(c *Signed_numberContext) - - // EnterTable_constraint is called when entering the table_constraint production. - EnterTable_constraint(c *Table_constraintContext) - - // EnterForeign_key_clause is called when entering the foreign_key_clause production. - EnterForeign_key_clause(c *Foreign_key_clauseContext) - - // EnterConflict_clause is called when entering the conflict_clause production. - EnterConflict_clause(c *Conflict_clauseContext) - - // EnterCreate_trigger_stmt is called when entering the create_trigger_stmt production. - EnterCreate_trigger_stmt(c *Create_trigger_stmtContext) - - // EnterCreate_view_stmt is called when entering the create_view_stmt production. - EnterCreate_view_stmt(c *Create_view_stmtContext) - - // EnterCreate_virtual_table_stmt is called when entering the create_virtual_table_stmt production. - EnterCreate_virtual_table_stmt(c *Create_virtual_table_stmtContext) - - // EnterWith_clause is called when entering the with_clause production. - EnterWith_clause(c *With_clauseContext) - - // EnterCte_table_name is called when entering the cte_table_name production. - EnterCte_table_name(c *Cte_table_nameContext) - - // EnterRecursive_cte is called when entering the recursive_cte production. - EnterRecursive_cte(c *Recursive_cteContext) - - // EnterCommon_table_expression is called when entering the common_table_expression production. - EnterCommon_table_expression(c *Common_table_expressionContext) - - // EnterReturning_clause is called when entering the returning_clause production. - EnterReturning_clause(c *Returning_clauseContext) - - // EnterDelete_stmt is called when entering the delete_stmt production. - EnterDelete_stmt(c *Delete_stmtContext) - - // EnterDelete_stmt_limited is called when entering the delete_stmt_limited production. - EnterDelete_stmt_limited(c *Delete_stmt_limitedContext) - - // EnterDetach_stmt is called when entering the detach_stmt production. - EnterDetach_stmt(c *Detach_stmtContext) - - // EnterDrop_stmt is called when entering the drop_stmt production. - EnterDrop_stmt(c *Drop_stmtContext) - - // EnterExpr_case is called when entering the expr_case production. - EnterExpr_case(c *Expr_caseContext) - - // EnterExpr_raise is called when entering the expr_raise production. - EnterExpr_raise(c *Expr_raiseContext) - - // EnterExpr_function is called when entering the expr_function production. - EnterExpr_function(c *Expr_functionContext) - - // EnterExpr_comparison is called when entering the expr_comparison production. - EnterExpr_comparison(c *Expr_comparisonContext) - - // EnterExpr_binary is called when entering the expr_binary production. - EnterExpr_binary(c *Expr_binaryContext) - - // EnterExpr_literal is called when entering the expr_literal production. - EnterExpr_literal(c *Expr_literalContext) - - // EnterExpr_cast is called when entering the expr_cast production. - EnterExpr_cast(c *Expr_castContext) - - // EnterExpr_in_select is called when entering the expr_in_select production. - EnterExpr_in_select(c *Expr_in_selectContext) - - // EnterExpr_list is called when entering the expr_list production. - EnterExpr_list(c *Expr_listContext) - - // EnterExpr_between is called when entering the expr_between production. - EnterExpr_between(c *Expr_betweenContext) - - // EnterExpr_collate is called when entering the expr_collate production. - EnterExpr_collate(c *Expr_collateContext) - - // EnterExpr_qualified_column_name is called when entering the expr_qualified_column_name production. - EnterExpr_qualified_column_name(c *Expr_qualified_column_nameContext) - - // EnterExpr_math_op is called when entering the expr_math_op production. - EnterExpr_math_op(c *Expr_math_opContext) - - // EnterExpr_unary is called when entering the expr_unary production. - EnterExpr_unary(c *Expr_unaryContext) - - // EnterExpr_null_comp is called when entering the expr_null_comp production. - EnterExpr_null_comp(c *Expr_null_compContext) - - // EnterExpr_bind is called when entering the expr_bind production. - EnterExpr_bind(c *Expr_bindContext) - - // EnterRaise_function is called when entering the raise_function production. - EnterRaise_function(c *Raise_functionContext) - - // EnterLiteral_value is called when entering the literal_value production. - EnterLiteral_value(c *Literal_valueContext) - - // EnterInsert_stmt is called when entering the insert_stmt production. - EnterInsert_stmt(c *Insert_stmtContext) - - // EnterUpsert_clause is called when entering the upsert_clause production. - EnterUpsert_clause(c *Upsert_clauseContext) - - // EnterPragma_stmt is called when entering the pragma_stmt production. - EnterPragma_stmt(c *Pragma_stmtContext) - - // EnterPragma_value is called when entering the pragma_value production. - EnterPragma_value(c *Pragma_valueContext) - - // EnterReindex_stmt is called when entering the reindex_stmt production. - EnterReindex_stmt(c *Reindex_stmtContext) - - // EnterSelect_stmt is called when entering the select_stmt production. - EnterSelect_stmt(c *Select_stmtContext) - - // EnterJoin_clause is called when entering the join_clause production. - EnterJoin_clause(c *Join_clauseContext) - - // EnterSelect_core is called when entering the select_core production. - EnterSelect_core(c *Select_coreContext) - - // EnterFactored_select_stmt is called when entering the factored_select_stmt production. - EnterFactored_select_stmt(c *Factored_select_stmtContext) - - // EnterSimple_select_stmt is called when entering the simple_select_stmt production. - EnterSimple_select_stmt(c *Simple_select_stmtContext) - - // EnterCompound_select_stmt is called when entering the compound_select_stmt production. - EnterCompound_select_stmt(c *Compound_select_stmtContext) - - // EnterTable_or_subquery is called when entering the table_or_subquery production. - EnterTable_or_subquery(c *Table_or_subqueryContext) - - // EnterResult_column is called when entering the result_column production. - EnterResult_column(c *Result_columnContext) - - // EnterJoin_operator is called when entering the join_operator production. - EnterJoin_operator(c *Join_operatorContext) - - // EnterJoin_constraint is called when entering the join_constraint production. - EnterJoin_constraint(c *Join_constraintContext) - - // EnterCompound_operator is called when entering the compound_operator production. - EnterCompound_operator(c *Compound_operatorContext) - - // EnterUpdate_stmt is called when entering the update_stmt production. - EnterUpdate_stmt(c *Update_stmtContext) - - // EnterColumn_name_list is called when entering the column_name_list production. - EnterColumn_name_list(c *Column_name_listContext) - - // EnterUpdate_stmt_limited is called when entering the update_stmt_limited production. - EnterUpdate_stmt_limited(c *Update_stmt_limitedContext) - - // EnterQualified_table_name is called when entering the qualified_table_name production. - EnterQualified_table_name(c *Qualified_table_nameContext) - - // EnterVacuum_stmt is called when entering the vacuum_stmt production. - EnterVacuum_stmt(c *Vacuum_stmtContext) - - // EnterFilter_clause is called when entering the filter_clause production. - EnterFilter_clause(c *Filter_clauseContext) - - // EnterWindow_defn is called when entering the window_defn production. - EnterWindow_defn(c *Window_defnContext) - - // EnterOver_clause is called when entering the over_clause production. - EnterOver_clause(c *Over_clauseContext) - - // EnterFrame_spec is called when entering the frame_spec production. - EnterFrame_spec(c *Frame_specContext) - - // EnterFrame_clause is called when entering the frame_clause production. - EnterFrame_clause(c *Frame_clauseContext) - - // EnterSimple_function_invocation is called when entering the simple_function_invocation production. - EnterSimple_function_invocation(c *Simple_function_invocationContext) - - // EnterAggregate_function_invocation is called when entering the aggregate_function_invocation production. - EnterAggregate_function_invocation(c *Aggregate_function_invocationContext) - - // EnterWindow_function_invocation is called when entering the window_function_invocation production. - EnterWindow_function_invocation(c *Window_function_invocationContext) - - // EnterCommon_table_stmt is called when entering the common_table_stmt production. - EnterCommon_table_stmt(c *Common_table_stmtContext) - - // EnterOrder_by_stmt is called when entering the order_by_stmt production. - EnterOrder_by_stmt(c *Order_by_stmtContext) - - // EnterLimit_stmt is called when entering the limit_stmt production. - EnterLimit_stmt(c *Limit_stmtContext) - - // EnterOrdering_term is called when entering the ordering_term production. - EnterOrdering_term(c *Ordering_termContext) - - // EnterAsc_desc is called when entering the asc_desc production. - EnterAsc_desc(c *Asc_descContext) - - // EnterFrame_left is called when entering the frame_left production. - EnterFrame_left(c *Frame_leftContext) - - // EnterFrame_right is called when entering the frame_right production. - EnterFrame_right(c *Frame_rightContext) - - // EnterFrame_single is called when entering the frame_single production. - EnterFrame_single(c *Frame_singleContext) - - // EnterWindow_function is called when entering the window_function production. - EnterWindow_function(c *Window_functionContext) - - // EnterOf_OF_fset is called when entering the of_OF_fset production. - EnterOf_OF_fset(c *Of_OF_fsetContext) - - // EnterDefault_DEFAULT__value is called when entering the default_DEFAULT__value production. - EnterDefault_DEFAULT__value(c *Default_DEFAULT__valueContext) - - // EnterPartition_by is called when entering the partition_by production. - EnterPartition_by(c *Partition_byContext) - - // EnterOrder_by_expr is called when entering the order_by_expr production. - EnterOrder_by_expr(c *Order_by_exprContext) - - // EnterOrder_by_expr_asc_desc is called when entering the order_by_expr_asc_desc production. - EnterOrder_by_expr_asc_desc(c *Order_by_expr_asc_descContext) - - // EnterExpr_asc_desc is called when entering the expr_asc_desc production. - EnterExpr_asc_desc(c *Expr_asc_descContext) - - // EnterInitial_select is called when entering the initial_select production. - EnterInitial_select(c *Initial_selectContext) - - // EnterRecursive__select is called when entering the recursive__select production. - EnterRecursive__select(c *Recursive__selectContext) - - // EnterUnary_operator is called when entering the unary_operator production. - EnterUnary_operator(c *Unary_operatorContext) - - // EnterError_message is called when entering the error_message production. - EnterError_message(c *Error_messageContext) - - // EnterModule_argument is called when entering the module_argument production. - EnterModule_argument(c *Module_argumentContext) - - // EnterColumn_alias is called when entering the column_alias production. - EnterColumn_alias(c *Column_aliasContext) - - // EnterKeyword is called when entering the keyword production. - EnterKeyword(c *KeywordContext) - - // EnterName is called when entering the name production. - EnterName(c *NameContext) - - // EnterFunction_name is called when entering the function_name production. - EnterFunction_name(c *Function_nameContext) - - // EnterQualified_function_name is called when entering the qualified_function_name production. - EnterQualified_function_name(c *Qualified_function_nameContext) - - // EnterSchema_name is called when entering the schema_name production. - EnterSchema_name(c *Schema_nameContext) - - // EnterTable_name is called when entering the table_name production. - EnterTable_name(c *Table_nameContext) - - // EnterTable_or_index_name is called when entering the table_or_index_name production. - EnterTable_or_index_name(c *Table_or_index_nameContext) - - // EnterNew_table_name is called when entering the new_table_name production. - EnterNew_table_name(c *New_table_nameContext) - - // EnterColumn_name is called when entering the column_name production. - EnterColumn_name(c *Column_nameContext) - - // EnterCollation_name is called when entering the collation_name production. - EnterCollation_name(c *Collation_nameContext) - - // EnterForeign_table is called when entering the foreign_table production. - EnterForeign_table(c *Foreign_tableContext) - - // EnterIndex_name is called when entering the index_name production. - EnterIndex_name(c *Index_nameContext) - - // EnterTrigger_name is called when entering the trigger_name production. - EnterTrigger_name(c *Trigger_nameContext) - - // EnterView_name is called when entering the view_name production. - EnterView_name(c *View_nameContext) - - // EnterModule_name is called when entering the module_name production. - EnterModule_name(c *Module_nameContext) - - // EnterPragma_name is called when entering the pragma_name production. - EnterPragma_name(c *Pragma_nameContext) - - // EnterSavepoint_name is called when entering the savepoint_name production. - EnterSavepoint_name(c *Savepoint_nameContext) - - // EnterTable_alias is called when entering the table_alias production. - EnterTable_alias(c *Table_aliasContext) - - // EnterTable_alias_fallback is called when entering the table_alias_fallback production. - EnterTable_alias_fallback(c *Table_alias_fallbackContext) - - // EnterTransaction_name is called when entering the transaction_name production. - EnterTransaction_name(c *Transaction_nameContext) - - // EnterWindow_name is called when entering the window_name production. - EnterWindow_name(c *Window_nameContext) - - // EnterAlias is called when entering the alias production. - EnterAlias(c *AliasContext) - - // EnterFilename is called when entering the filename production. - EnterFilename(c *FilenameContext) - - // EnterBase_window_name is called when entering the base_window_name production. - EnterBase_window_name(c *Base_window_nameContext) - - // EnterSimple_func is called when entering the simple_func production. - EnterSimple_func(c *Simple_funcContext) - - // EnterAggregate_func is called when entering the aggregate_func production. - EnterAggregate_func(c *Aggregate_funcContext) - - // EnterTable_function_name is called when entering the table_function_name production. - EnterTable_function_name(c *Table_function_nameContext) - - // EnterAny_name is called when entering the any_name production. - EnterAny_name(c *Any_nameContext) - - // ExitParse is called when exiting the parse production. - ExitParse(c *ParseContext) - - // ExitSql_stmt_list is called when exiting the sql_stmt_list production. - ExitSql_stmt_list(c *Sql_stmt_listContext) - - // ExitSql_stmt is called when exiting the sql_stmt production. - ExitSql_stmt(c *Sql_stmtContext) - - // ExitAlter_table_stmt is called when exiting the alter_table_stmt production. - ExitAlter_table_stmt(c *Alter_table_stmtContext) - - // ExitAnalyze_stmt is called when exiting the analyze_stmt production. - ExitAnalyze_stmt(c *Analyze_stmtContext) - - // ExitAttach_stmt is called when exiting the attach_stmt production. - ExitAttach_stmt(c *Attach_stmtContext) - - // ExitBegin_stmt is called when exiting the begin_stmt production. - ExitBegin_stmt(c *Begin_stmtContext) - - // ExitCommit_stmt is called when exiting the commit_stmt production. - ExitCommit_stmt(c *Commit_stmtContext) - - // ExitRollback_stmt is called when exiting the rollback_stmt production. - ExitRollback_stmt(c *Rollback_stmtContext) - - // ExitSavepoint_stmt is called when exiting the savepoint_stmt production. - ExitSavepoint_stmt(c *Savepoint_stmtContext) - - // ExitRelease_stmt is called when exiting the release_stmt production. - ExitRelease_stmt(c *Release_stmtContext) - - // ExitCreate_index_stmt is called when exiting the create_index_stmt production. - ExitCreate_index_stmt(c *Create_index_stmtContext) - - // ExitIndexed_column is called when exiting the indexed_column production. - ExitIndexed_column(c *Indexed_columnContext) - - // ExitTable_option is called when exiting the table_option production. - ExitTable_option(c *Table_optionContext) - - // ExitCreate_table_stmt is called when exiting the create_table_stmt production. - ExitCreate_table_stmt(c *Create_table_stmtContext) - - // ExitColumn_def is called when exiting the column_def production. - ExitColumn_def(c *Column_defContext) - - // ExitType_name is called when exiting the type_name production. - ExitType_name(c *Type_nameContext) - - // ExitColumn_constraint is called when exiting the column_constraint production. - ExitColumn_constraint(c *Column_constraintContext) - - // ExitSigned_number is called when exiting the signed_number production. - ExitSigned_number(c *Signed_numberContext) - - // ExitTable_constraint is called when exiting the table_constraint production. - ExitTable_constraint(c *Table_constraintContext) - - // ExitForeign_key_clause is called when exiting the foreign_key_clause production. - ExitForeign_key_clause(c *Foreign_key_clauseContext) - - // ExitConflict_clause is called when exiting the conflict_clause production. - ExitConflict_clause(c *Conflict_clauseContext) - - // ExitCreate_trigger_stmt is called when exiting the create_trigger_stmt production. - ExitCreate_trigger_stmt(c *Create_trigger_stmtContext) - - // ExitCreate_view_stmt is called when exiting the create_view_stmt production. - ExitCreate_view_stmt(c *Create_view_stmtContext) - - // ExitCreate_virtual_table_stmt is called when exiting the create_virtual_table_stmt production. - ExitCreate_virtual_table_stmt(c *Create_virtual_table_stmtContext) - - // ExitWith_clause is called when exiting the with_clause production. - ExitWith_clause(c *With_clauseContext) - - // ExitCte_table_name is called when exiting the cte_table_name production. - ExitCte_table_name(c *Cte_table_nameContext) - - // ExitRecursive_cte is called when exiting the recursive_cte production. - ExitRecursive_cte(c *Recursive_cteContext) - - // ExitCommon_table_expression is called when exiting the common_table_expression production. - ExitCommon_table_expression(c *Common_table_expressionContext) - - // ExitReturning_clause is called when exiting the returning_clause production. - ExitReturning_clause(c *Returning_clauseContext) - - // ExitDelete_stmt is called when exiting the delete_stmt production. - ExitDelete_stmt(c *Delete_stmtContext) - - // ExitDelete_stmt_limited is called when exiting the delete_stmt_limited production. - ExitDelete_stmt_limited(c *Delete_stmt_limitedContext) - - // ExitDetach_stmt is called when exiting the detach_stmt production. - ExitDetach_stmt(c *Detach_stmtContext) - - // ExitDrop_stmt is called when exiting the drop_stmt production. - ExitDrop_stmt(c *Drop_stmtContext) - - // ExitExpr_case is called when exiting the expr_case production. - ExitExpr_case(c *Expr_caseContext) - - // ExitExpr_raise is called when exiting the expr_raise production. - ExitExpr_raise(c *Expr_raiseContext) - - // ExitExpr_function is called when exiting the expr_function production. - ExitExpr_function(c *Expr_functionContext) - - // ExitExpr_comparison is called when exiting the expr_comparison production. - ExitExpr_comparison(c *Expr_comparisonContext) - - // ExitExpr_binary is called when exiting the expr_binary production. - ExitExpr_binary(c *Expr_binaryContext) - - // ExitExpr_literal is called when exiting the expr_literal production. - ExitExpr_literal(c *Expr_literalContext) - - // ExitExpr_cast is called when exiting the expr_cast production. - ExitExpr_cast(c *Expr_castContext) - - // ExitExpr_in_select is called when exiting the expr_in_select production. - ExitExpr_in_select(c *Expr_in_selectContext) - - // ExitExpr_list is called when exiting the expr_list production. - ExitExpr_list(c *Expr_listContext) - - // ExitExpr_between is called when exiting the expr_between production. - ExitExpr_between(c *Expr_betweenContext) - - // ExitExpr_collate is called when exiting the expr_collate production. - ExitExpr_collate(c *Expr_collateContext) - - // ExitExpr_qualified_column_name is called when exiting the expr_qualified_column_name production. - ExitExpr_qualified_column_name(c *Expr_qualified_column_nameContext) - - // ExitExpr_math_op is called when exiting the expr_math_op production. - ExitExpr_math_op(c *Expr_math_opContext) - - // ExitExpr_unary is called when exiting the expr_unary production. - ExitExpr_unary(c *Expr_unaryContext) - - // ExitExpr_null_comp is called when exiting the expr_null_comp production. - ExitExpr_null_comp(c *Expr_null_compContext) - - // ExitExpr_bind is called when exiting the expr_bind production. - ExitExpr_bind(c *Expr_bindContext) - - // ExitRaise_function is called when exiting the raise_function production. - ExitRaise_function(c *Raise_functionContext) - - // ExitLiteral_value is called when exiting the literal_value production. - ExitLiteral_value(c *Literal_valueContext) - - // ExitInsert_stmt is called when exiting the insert_stmt production. - ExitInsert_stmt(c *Insert_stmtContext) - - // ExitUpsert_clause is called when exiting the upsert_clause production. - ExitUpsert_clause(c *Upsert_clauseContext) - - // ExitPragma_stmt is called when exiting the pragma_stmt production. - ExitPragma_stmt(c *Pragma_stmtContext) - - // ExitPragma_value is called when exiting the pragma_value production. - ExitPragma_value(c *Pragma_valueContext) - - // ExitReindex_stmt is called when exiting the reindex_stmt production. - ExitReindex_stmt(c *Reindex_stmtContext) - - // ExitSelect_stmt is called when exiting the select_stmt production. - ExitSelect_stmt(c *Select_stmtContext) - - // ExitJoin_clause is called when exiting the join_clause production. - ExitJoin_clause(c *Join_clauseContext) - - // ExitSelect_core is called when exiting the select_core production. - ExitSelect_core(c *Select_coreContext) - - // ExitFactored_select_stmt is called when exiting the factored_select_stmt production. - ExitFactored_select_stmt(c *Factored_select_stmtContext) - - // ExitSimple_select_stmt is called when exiting the simple_select_stmt production. - ExitSimple_select_stmt(c *Simple_select_stmtContext) - - // ExitCompound_select_stmt is called when exiting the compound_select_stmt production. - ExitCompound_select_stmt(c *Compound_select_stmtContext) - - // ExitTable_or_subquery is called when exiting the table_or_subquery production. - ExitTable_or_subquery(c *Table_or_subqueryContext) - - // ExitResult_column is called when exiting the result_column production. - ExitResult_column(c *Result_columnContext) - - // ExitJoin_operator is called when exiting the join_operator production. - ExitJoin_operator(c *Join_operatorContext) - - // ExitJoin_constraint is called when exiting the join_constraint production. - ExitJoin_constraint(c *Join_constraintContext) - - // ExitCompound_operator is called when exiting the compound_operator production. - ExitCompound_operator(c *Compound_operatorContext) - - // ExitUpdate_stmt is called when exiting the update_stmt production. - ExitUpdate_stmt(c *Update_stmtContext) - - // ExitColumn_name_list is called when exiting the column_name_list production. - ExitColumn_name_list(c *Column_name_listContext) - - // ExitUpdate_stmt_limited is called when exiting the update_stmt_limited production. - ExitUpdate_stmt_limited(c *Update_stmt_limitedContext) - - // ExitQualified_table_name is called when exiting the qualified_table_name production. - ExitQualified_table_name(c *Qualified_table_nameContext) - - // ExitVacuum_stmt is called when exiting the vacuum_stmt production. - ExitVacuum_stmt(c *Vacuum_stmtContext) - - // ExitFilter_clause is called when exiting the filter_clause production. - ExitFilter_clause(c *Filter_clauseContext) - - // ExitWindow_defn is called when exiting the window_defn production. - ExitWindow_defn(c *Window_defnContext) - - // ExitOver_clause is called when exiting the over_clause production. - ExitOver_clause(c *Over_clauseContext) - - // ExitFrame_spec is called when exiting the frame_spec production. - ExitFrame_spec(c *Frame_specContext) - - // ExitFrame_clause is called when exiting the frame_clause production. - ExitFrame_clause(c *Frame_clauseContext) - - // ExitSimple_function_invocation is called when exiting the simple_function_invocation production. - ExitSimple_function_invocation(c *Simple_function_invocationContext) - - // ExitAggregate_function_invocation is called when exiting the aggregate_function_invocation production. - ExitAggregate_function_invocation(c *Aggregate_function_invocationContext) - - // ExitWindow_function_invocation is called when exiting the window_function_invocation production. - ExitWindow_function_invocation(c *Window_function_invocationContext) - - // ExitCommon_table_stmt is called when exiting the common_table_stmt production. - ExitCommon_table_stmt(c *Common_table_stmtContext) - - // ExitOrder_by_stmt is called when exiting the order_by_stmt production. - ExitOrder_by_stmt(c *Order_by_stmtContext) - - // ExitLimit_stmt is called when exiting the limit_stmt production. - ExitLimit_stmt(c *Limit_stmtContext) - - // ExitOrdering_term is called when exiting the ordering_term production. - ExitOrdering_term(c *Ordering_termContext) - - // ExitAsc_desc is called when exiting the asc_desc production. - ExitAsc_desc(c *Asc_descContext) - - // ExitFrame_left is called when exiting the frame_left production. - ExitFrame_left(c *Frame_leftContext) - - // ExitFrame_right is called when exiting the frame_right production. - ExitFrame_right(c *Frame_rightContext) - - // ExitFrame_single is called when exiting the frame_single production. - ExitFrame_single(c *Frame_singleContext) - - // ExitWindow_function is called when exiting the window_function production. - ExitWindow_function(c *Window_functionContext) - - // ExitOf_OF_fset is called when exiting the of_OF_fset production. - ExitOf_OF_fset(c *Of_OF_fsetContext) - - // ExitDefault_DEFAULT__value is called when exiting the default_DEFAULT__value production. - ExitDefault_DEFAULT__value(c *Default_DEFAULT__valueContext) - - // ExitPartition_by is called when exiting the partition_by production. - ExitPartition_by(c *Partition_byContext) - - // ExitOrder_by_expr is called when exiting the order_by_expr production. - ExitOrder_by_expr(c *Order_by_exprContext) - - // ExitOrder_by_expr_asc_desc is called when exiting the order_by_expr_asc_desc production. - ExitOrder_by_expr_asc_desc(c *Order_by_expr_asc_descContext) - - // ExitExpr_asc_desc is called when exiting the expr_asc_desc production. - ExitExpr_asc_desc(c *Expr_asc_descContext) - - // ExitInitial_select is called when exiting the initial_select production. - ExitInitial_select(c *Initial_selectContext) - - // ExitRecursive__select is called when exiting the recursive__select production. - ExitRecursive__select(c *Recursive__selectContext) - - // ExitUnary_operator is called when exiting the unary_operator production. - ExitUnary_operator(c *Unary_operatorContext) - - // ExitError_message is called when exiting the error_message production. - ExitError_message(c *Error_messageContext) - - // ExitModule_argument is called when exiting the module_argument production. - ExitModule_argument(c *Module_argumentContext) - - // ExitColumn_alias is called when exiting the column_alias production. - ExitColumn_alias(c *Column_aliasContext) - - // ExitKeyword is called when exiting the keyword production. - ExitKeyword(c *KeywordContext) - - // ExitName is called when exiting the name production. - ExitName(c *NameContext) - - // ExitFunction_name is called when exiting the function_name production. - ExitFunction_name(c *Function_nameContext) - - // ExitQualified_function_name is called when exiting the qualified_function_name production. - ExitQualified_function_name(c *Qualified_function_nameContext) - - // ExitSchema_name is called when exiting the schema_name production. - ExitSchema_name(c *Schema_nameContext) - - // ExitTable_name is called when exiting the table_name production. - ExitTable_name(c *Table_nameContext) - - // ExitTable_or_index_name is called when exiting the table_or_index_name production. - ExitTable_or_index_name(c *Table_or_index_nameContext) - - // ExitNew_table_name is called when exiting the new_table_name production. - ExitNew_table_name(c *New_table_nameContext) - - // ExitColumn_name is called when exiting the column_name production. - ExitColumn_name(c *Column_nameContext) - - // ExitCollation_name is called when exiting the collation_name production. - ExitCollation_name(c *Collation_nameContext) - - // ExitForeign_table is called when exiting the foreign_table production. - ExitForeign_table(c *Foreign_tableContext) - - // ExitIndex_name is called when exiting the index_name production. - ExitIndex_name(c *Index_nameContext) - - // ExitTrigger_name is called when exiting the trigger_name production. - ExitTrigger_name(c *Trigger_nameContext) - - // ExitView_name is called when exiting the view_name production. - ExitView_name(c *View_nameContext) - - // ExitModule_name is called when exiting the module_name production. - ExitModule_name(c *Module_nameContext) - - // ExitPragma_name is called when exiting the pragma_name production. - ExitPragma_name(c *Pragma_nameContext) - - // ExitSavepoint_name is called when exiting the savepoint_name production. - ExitSavepoint_name(c *Savepoint_nameContext) - - // ExitTable_alias is called when exiting the table_alias production. - ExitTable_alias(c *Table_aliasContext) - - // ExitTable_alias_fallback is called when exiting the table_alias_fallback production. - ExitTable_alias_fallback(c *Table_alias_fallbackContext) - - // ExitTransaction_name is called when exiting the transaction_name production. - ExitTransaction_name(c *Transaction_nameContext) - - // ExitWindow_name is called when exiting the window_name production. - ExitWindow_name(c *Window_nameContext) - - // ExitAlias is called when exiting the alias production. - ExitAlias(c *AliasContext) - - // ExitFilename is called when exiting the filename production. - ExitFilename(c *FilenameContext) - - // ExitBase_window_name is called when exiting the base_window_name production. - ExitBase_window_name(c *Base_window_nameContext) - - // ExitSimple_func is called when exiting the simple_func production. - ExitSimple_func(c *Simple_funcContext) - - // ExitAggregate_func is called when exiting the aggregate_func production. - ExitAggregate_func(c *Aggregate_funcContext) - - // ExitTable_function_name is called when exiting the table_function_name production. - ExitTable_function_name(c *Table_function_nameContext) - - // ExitAny_name is called when exiting the any_name production. - ExitAny_name(c *Any_nameContext) -} diff --git a/internal/engine/sqlite/reserved.go b/internal/engine/sqlite/reserved.go index d1d5105934..eb6ed2fd17 100644 --- a/internal/engine/sqlite/reserved.go +++ b/internal/engine/sqlite/reserved.go @@ -1,157 +1,10 @@ package sqlite -import "strings" +import "github.com/sqlc-dev/meyer/token" -// https://sqlite.org/lang_keywords.html +// IsReservedKeyword reports whether s is a keyword in SQLite; see +// https://sqlite.org/lang_keywords.html. The table lives in meyer, which +// transcribes it from SQLite's own aKeywordTable. func (p *Parser) IsReservedKeyword(s string) bool { - switch strings.ToLower(s) { - case "abort": - case "action": - case "add": - case "after": - case "all": - case "alter": - case "always": - case "analyze": - case "and": - case "as": - case "asc": - case "attach": - case "autoincrement": - case "before": - case "begin": - case "between": - case "by": - case "cascade": - case "case": - case "cast": - case "check": - case "collate": - case "column": - case "commit": - case "conflict": - case "constraint": - case "create": - case "cross": - case "current": - case "current_date": - case "current_time": - case "current_timestamp": - case "database": - case "default": - case "deferrable": - case "deferred": - case "delete": - case "desc": - case "detach": - case "distinct": - case "do": - case "drop": - case "each": - case "else": - case "end": - case "escape": - case "except": - case "exclude": - case "exclusive": - case "exists": - case "explain": - case "fail": - case "filter": - case "first": - case "following": - case "for": - case "foreign": - case "from": - case "full": - case "generated": - case "glob": - case "group": - case "groups": - case "having": - case "if": - case "ignore": - case "immediate": - case "in": - case "index": - case "indexed": - case "initially": - case "inner": - case "insert": - case "instead": - case "intersect": - case "into": - case "is": - case "isnull": - case "join": - case "key": - case "last": - case "left": - case "like": - case "limit": - case "match": - case "natural": - case "no": - case "not": - case "nothing": - case "notnull": - case "null": - case "nulls": - case "of": - case "offset": - case "on": - case "or": - case "order": - case "others": - case "outer": - case "over": - case "partition": - case "plan": - case "pragma": - case "preceding": - case "primary": - case "query": - case "raise": - case "range": - case "recursive": - case "references": - case "regexp": - case "reindex": - case "release": - case "rename": - case "replace": - case "restrict": - case "right": - case "rollback": - case "row": - case "rows": - case "savepoint": - case "select": - case "set": - case "table": - case "temp": - case "temporary": - case "then": - case "ties": - case "to": - case "transaction": - case "trigger": - case "unbounded": - case "union": - case "unique": - case "update": - case "using": - case "vacuum": - case "values": - case "view": - case "virtual": - case "when": - case "where": - case "window": - case "with": - case "without": - default: - return false - } - return true + return token.Lookup(s) != token.ID } diff --git a/internal/engine/sqlite/seed.go b/internal/engine/sqlite/seed.go new file mode 100644 index 0000000000..cc439b43b7 --- /dev/null +++ b/internal/engine/sqlite/seed.go @@ -0,0 +1,34 @@ +package sqlite + +import ( + "embed" + "sync" + + "github.com/sqlc-dev/sqlc/internal/core" + "github.com/sqlc-dev/sqlc/internal/core/seed" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" +) + +// The dialect directory describes SQLite's type system, and functions.jsonl is +// its standard library. Both the analysis core and the catalog the legacy +// compiler builds read them. +// +//go:embed dialect +var dialectFS embed.FS + +// Dialect returns the catalog option that seeds SQLite's type system. +func Dialect() core.Option { + return seed.Dialect(dialectFS, "dialect") +} + +// stdlib is SQLite's functions in the form the catalog uses. They are embedded +// in the binary and never change within a run, so they are read once. +var stdlib = sync.OnceValue(func() []*catalog.Function { + funcs, err := seed.Functions(dialectFS, "dialect") + if err != nil { + // A failure here means sqlc was built from a broken tree, which no + // caller can do anything about. + panic(err) + } + return funcs +}) diff --git a/internal/engine/sqlite/stdlib.go b/internal/engine/sqlite/stdlib.go index 89b7af2e92..210aa29961 100644 --- a/internal/engine/sqlite/stdlib.go +++ b/internal/engine/sqlite/stdlib.go @@ -1,985 +1,13 @@ package sqlite import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -// sqlite functions from: -// https://www.sqlite.org/lang_aggfunc.html -// https://www.sqlite.org/lang_mathfunc.html -// https://www.sqlite.org/lang_corefunc.html - +// defaultSchema is SQLite's standard library, read from the dialect +// directory's functions.jsonl, which internal/goldeneye generates from a +// default build of SQLite. The functions further compile options add live +// under the dialect's extensions/, one directory per option. func defaultSchema(name string) *catalog.Schema { - s := &catalog.Schema{Name: name} - s.Funcs = []*catalog.Function{ - // Aggregation Functions - { - Name: "AVG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - ReturnTypeNullable: true, - }, - { - Name: "COUNT", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "COUNT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "GROUP_CONCAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "GROUP_CONCAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "MAX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "MIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "SUM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - ReturnTypeNullable: true, - }, - { - Name: "TOTAL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - - // Math Functions - { - Name: "ACOS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ACOSH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ASIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ASINH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ATAN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ATAN2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ATANH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "CEIL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "CEILING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "COS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "COSH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "DEGREES", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "EXP", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "FLOOR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "LN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "LOG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "LOG10", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "LOG", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "LOG2", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "MOD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "PI", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "POW", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "POWER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "RADIANS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "SIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "SINH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "SQRT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "TAN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "TANH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "TRUNC", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - - // Scalar functions - { - Name: "ABS", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "CHANGES", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "CHAR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "int"}, - }, - { - Type: &ast.TypeName{Name: "int"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "COALESCE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "FORMAT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - ReturnTypeNullable: true, - }, - { - Name: "GLOB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "HEX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "IFNULL", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "IIF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "INSTR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - ReturnTypeNullable: true, - }, - { - Name: "LAST_INSERT_ROWID", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "LENGTH", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - ReturnTypeNullable: true, - }, - { - Name: "LIKE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "LIKE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "LIKELIHOOD", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "LIKELY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "LOWER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "LTRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "LTRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "MAX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "MIN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "NULLIF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "PRINTF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "any"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - ReturnTypeNullable: true, - }, - { - Name: "QUOTE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "RAMDOM", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "RAMDOMBLOB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "blob"}, - }, - { - Name: "REPLACE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ROUND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "ROUND", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "real"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - { - Name: "RTRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "RTRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SIGN", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - ReturnTypeNullable: true, - }, - { - Name: "SOUNDEX", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SQLITE_COMPILEOPTION_GET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - ReturnTypeNullable: true, - }, - { - Name: "SQLITE_COMPILEOPTION_USED", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "SQLITE_OFFSET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - ReturnTypeNullable: true, - }, - { - Name: "SQLITE_SOURCE_ID", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SQLITE_VERSION", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBSTR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBSTR", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBSTRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SUBSTRING", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "TOTAL_CHANGES", - Args: []*catalog.Argument{}, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "TRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "TRIM", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "TYPEOF", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "UNICODE", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "integer"}, - }, - { - Name: "UNLIKELY", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "any"}, - }, - }, - ReturnType: &ast.TypeName{Name: "any"}, - ReturnTypeNullable: true, - }, - { - Name: "UPPER", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "ZEROBLOB", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "blob"}, - }, - // fts5 funcs https://www.sqlite.org/fts5.html#_auxiliary_functions_ - { - Name: "HIGHLIGHT", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "SNIPPET", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "integer"}, - }, - }, - ReturnType: &ast.TypeName{Name: "text"}, - }, - { - Name: "bm25", - Args: []*catalog.Argument{ - { - Type: &ast.TypeName{Name: "text"}, - }, - { - Type: &ast.TypeName{Name: "real"}, - Mode: ast.FuncParamVariadic, - }, - }, - ReturnType: &ast.TypeName{Name: "real"}, - }, - } - return s + return &catalog.Schema{Name: name, Funcs: stdlib()} } diff --git a/internal/engine/sqlite/utils.go b/internal/engine/sqlite/utils.go index f3b5ee289d..3e4a03e64f 100644 --- a/internal/engine/sqlite/utils.go +++ b/internal/engine/sqlite/utils.go @@ -1,35 +1,142 @@ package sqlite import ( - "github.com/sqlc-dev/sqlc/internal/engine/sqlite/parser" + "strings" + + meyer "github.com/sqlc-dev/meyer/ast" + "github.com/sqlc-dev/sqlc/internal/sql/ast" ) -type tableNamer interface { - Table_name() parser.ITable_nameContext - Schema_name() parser.ISchema_nameContext +// identifier folds a name the way SQLite resolves one: an unquoted name is +// case-insensitive and normalizes to lower case, while a quoted name keeps +// the spelling that appeared between the quotes. +func identifier(n *meyer.Ident) string { + if n == nil { + return "" + } + if n.Quote == meyer.QuoteNone { + return strings.ToLower(n.Name) + } + return n.Name +} + +// NewIdentifier returns the folded name of id as an ast.String, the shape +// sqlc uses for the parts of a ColumnRef or a function name. +func NewIdentifier(id *meyer.Ident) *ast.String { + return &ast.String{Str: identifier(id)} +} + +func parseTableName(n *meyer.QualifiedName) *ast.TableName { + if n == nil { + return &ast.TableName{} + } + return &ast.TableName{ + Schema: identifier(n.Schema), + Name: identifier(n.Name), + } +} + +// parseRangeVar builds the relation reference sqlc expects for a table named +// in a FROM, INSERT, UPDATE or DELETE clause. +func parseRangeVar(n *meyer.QualifiedName, alias *meyer.Ident) *ast.RangeVar { + rv := &ast.RangeVar{} + if n == nil { + return rv + } + rv.Location = n.Pos() + name := identifier(n.Name) + rv.Relname = &name + if n.Schema != nil { + schema := identifier(n.Schema) + rv.Schemaname = &schema + } + if alias != nil { + aliasName := identifier(alias) + rv.Alias = &ast.Alias{Aliasname: &aliasName} + } + return rv +} + +// typeName renders a type the way sqlc's type resolution expects to see it: +// the tokens joined without separators, matching what the ANTLR parser's +// GetText produced. "UNSIGNED BIG INT" becomes "UNSIGNEDBIGINT" and +// "DECIMAL(10, 5)" becomes "DECIMAL(10,5)". +func typeName(n *meyer.TypeName) string { + if n == nil { + return "" + } + var sb strings.Builder + sb.WriteString(strings.ReplaceAll(n.Name, " ", "")) + if len(n.Args) > 0 { + sb.WriteString("(") + sb.WriteString(strings.Join(n.Args, ",")) + sb.WriteString(")") + } + return sb.String() } -func parseTableName(c tableNamer) *ast.TableName { - name := ast.TableName{ - Name: c.Table_name().GetText(), +// typeSpelling returns the type as the author wrote it — identifier tokens +// space-joined, arguments as written — for the formatter to print back. +// typeName folds the spaces out for catalog matching. +func typeSpelling(n *meyer.TypeName) string { + if n == nil { + return "" } - if c.Schema_name() != nil { - name.Schema = c.Schema_name().GetText() + var sb strings.Builder + sb.WriteString(n.Name) + if len(n.Args) > 0 { + sb.WriteString("(") + sb.WriteString(strings.Join(n.Args, ",")) + sb.WriteString(")") } - return &name + return sb.String() } -func hasNotNullConstraint(checks []parser.IColumn_constraintContext) bool { - for i := range checks { - constraint, ok := checks[i].(*parser.Column_constraintContext) - if !ok { - continue +// representableColumn reports whether a column definition round-trips +// through the fields ast.ColumnDef models: a plain NOT NULL, a plain +// PRIMARY KEY, or nothing. Anything else — a named constraint, a conflict +// clause, ASC/DESC or AUTOINCREMENT, DEFAULT, UNIQUE, CHECK, COLLATE, +// REFERENCES, GENERATED — is parsed away, so a statement printing such a +// column would lose it. NOT NULL next to PRIMARY KEY is also beyond the +// node: SQLite's PRIMARY KEY does not imply NOT NULL, and the printed form +// carries only one of the pair. +func representableColumn(def *meyer.ColumnDef) bool { + var notNull, primary bool + for _, con := range def.Constraints { + switch { + case con.Name != nil: + return false + case con.Kind == meyer.ColumnNotNull && con.OnConflict == meyer.ConflictDefault: + notNull = true + case con.Kind == meyer.ColumnPrimaryKey && con.OnConflict == meyer.ConflictDefault && + con.Order == meyer.SortDefault && !con.AutoIncrement: + primary = true + default: + return false } - if constraint.PRIMARY_() != nil && constraint.KEY_() != nil { + } + return !(notNull && primary) +} + +// hasPrimaryKeyConstraint reports whether a column definition carries a +// PRIMARY KEY constraint. +func hasPrimaryKeyConstraint(constraints []*meyer.ColumnConstraint) bool { + for _, constraint := range constraints { + if constraint.Kind == meyer.ColumnPrimaryKey { return true } - if constraint.NOT_() != nil && constraint.NULL_() != nil { + } + return false +} + +// hasNotNullConstraint reports whether a column definition guarantees a +// value. A PRIMARY KEY implies NOT NULL for the purposes of code +// generation, matching the behavior of the previous parser. +func hasNotNullConstraint(constraints []*meyer.ColumnConstraint) bool { + for _, constraint := range constraints { + switch constraint.Kind { + case meyer.ColumnNotNull, meyer.ColumnPrimaryKey: return true } } diff --git a/internal/ext/handler.go b/internal/ext/handler.go index adeacff695..2542dc1a82 100644 --- a/internal/ext/handler.go +++ b/internal/ext/handler.go @@ -2,22 +2,51 @@ package ext import ( "context" + "fmt" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/sqlc-dev/sqlc/internal/plugin" ) type Handler interface { - Generate(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) + Generate(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error) + + Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error + NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) } type wrapper struct { - fn func(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) + fn func(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error) } -func (w *wrapper) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func (w *wrapper) Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { return w.fn(ctx, req) } -func HandleFunc(fn func(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error)) Handler { +func (w *wrapper) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(*plugin.GenerateRequest) + if !ok { + return fmt.Errorf("args isn't a GenerateRequest") + } + resp, ok := reply.(*plugin.GenerateResponse) + if !ok { + return fmt.Errorf("reply isn't a GenerateResponse") + } + res, err := w.Generate(ctx, req) + if err != nil { + return err + } + resp.Files = res.Files + return nil +} + +func (w *wrapper) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") +} + +func HandleFunc(fn func(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error)) Handler { return &wrapper{fn} } diff --git a/internal/ext/process/gen.go b/internal/ext/process/gen.go index 7a48038444..b5720dbc33 100644 --- a/internal/ext/process/gen.go +++ b/internal/ext/process/gen.go @@ -8,35 +8,66 @@ import ( "os" "os/exec" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" - "github.com/sqlc-dev/sqlc/internal/plugin" + "github.com/sqlc-dev/sqlc/internal/info" ) type Runner struct { - Cmd string - Env []string + Cmd string + Format string + Env []string } -// TODO: Update the gen func signature to take a ctx -func (r Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - stdin, err := proto.Marshal(req) - if err != nil { - return nil, fmt.Errorf("failed to encode codegen request: %s", err) +func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("args isn't a protoreflect.ProtoMessage") + } + + var stdin []byte + var err error + switch r.Format { + case "json": + m := &protojson.MarshalOptions{ + EmitUnpopulated: true, + Indent: "", + UseProtoNames: true, + } + stdin, err = m.Marshal(req) + + if err != nil { + return fmt.Errorf("failed to encode codegen request: %w", err) + } + case "", "protobuf": + stdin, err = proto.Marshal(req) + if err != nil { + return fmt.Errorf("failed to encode codegen request: %w", err) + } + default: + return fmt.Errorf("unknown plugin format: %s", r.Format) } // Check if the output plugin exists path, err := exec.LookPath(r.Cmd) if err != nil { - return nil, fmt.Errorf("process: %s not found", r.Cmd) + return fmt.Errorf("process: %s not found", r.Cmd) } - cmd := exec.CommandContext(ctx, path) + cmd := exec.CommandContext(ctx, path, method) cmd.Stdin = bytes.NewReader(stdin) cmd.Env = []string{ - fmt.Sprintf("SQLC_VERSION=%s", req.SqlcVersion), + fmt.Sprintf("SQLC_VERSION=%s", info.Version), } for _, key := range r.Env { + if key == "SQLC_AUTH_TOKEN" { + continue + } cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", key, os.Getenv(key))) } @@ -47,13 +78,28 @@ func (r Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plug if errors.As(err, &exit) { stderr = string(exit.Stderr) } - return nil, fmt.Errorf("process: error running command %s", stderr) + return fmt.Errorf("process: error running command %s", stderr) } - var resp plugin.CodeGenResponse - if err := proto.Unmarshal(out, &resp); err != nil { - return nil, fmt.Errorf("process: failed to read codegen resp: %s", err) + resp, ok := reply.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("reply isn't a protoreflect.ProtoMessage") } - return &resp, nil + switch r.Format { + case "json": + if err := protojson.Unmarshal(out, resp); err != nil { + return fmt.Errorf("process: failed to read codegen resp: %w", err) + } + default: + if err := proto.Unmarshal(out, resp); err != nil { + return fmt.Errorf("process: failed to read codegen resp: %w", err) + } + } + + return nil +} + +func (r *Runner) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") } diff --git a/internal/ext/wasm/nowasm.go b/internal/ext/wasm/nowasm.go deleted file mode 100644 index c28db6fc73..0000000000 --- a/internal/ext/wasm/nowasm.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build nowasm || !(cgo && ((linux && amd64) || (linux && arm64) || (darwin && amd64) || (darwin && arm64) || (windows && amd64))) - -package wasm - -import ( - "context" - "fmt" - - "github.com/sqlc-dev/sqlc/internal/plugin" -) - -func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - return nil, fmt.Errorf("sqlc built without wasmtime support") -} diff --git a/internal/ext/wasm/wasm.go b/internal/ext/wasm/wasm.go index 1a23b9c4bf..e313ac29ff 100644 --- a/internal/ext/wasm/wasm.go +++ b/internal/ext/wasm/wasm.go @@ -1,198 +1,197 @@ -//go:build !nowasm && cgo && ((linux && amd64) || (linux && arm64) || (darwin && amd64) || (darwin && arm64) || (windows && amd64)) - -// The above build constraint is based of the cgo directives in this file: -// https://github.com/bytecodealliance/wasmtime-go/blob/main/ffi.go package wasm import ( + "bytes" "context" "crypto/sha256" "errors" "fmt" "io" + "log/slog" "net/http" "os" - "path/filepath" "runtime" - "runtime/trace" "strings" - wasmtime "github.com/bytecodealliance/wasmtime-go/v13" + "github.com/tetratelabs/wazero" + "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" + "github.com/tetratelabs/wazero/sys" "golang.org/x/sync/singleflight" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "github.com/sqlc-dev/sqlc/internal/cache" "github.com/sqlc-dev/sqlc/internal/info" "github.com/sqlc-dev/sqlc/internal/plugin" ) -// This version must be updated whenever the wasmtime-go dependency is updated -const wasmtimeVersion = `v13.0.0` - -func cacheDir() (string, error) { - cache := os.Getenv("SQLCCACHE") - if cache != "" { - return cache, nil - } - cacheHome := os.Getenv("XDG_CACHE_HOME") - if cacheHome == "" { - home, err := os.UserHomeDir() - if err != nil { - return "", err - } - cacheHome = filepath.Join(home, ".cache") - } - return filepath.Join(cacheHome, "sqlc"), nil -} - var flight singleflight.Group -// Verify the provided sha256 is valid. -func (r *Runner) parseChecksum() (string, error) { - if r.SHA256 == "" { - return "", fmt.Errorf("missing SHA-256 checksum") - } - return r.SHA256, nil +type runtimeAndCode struct { + rt wazero.Runtime + code wazero.CompiledModule } -func (r *Runner) loadModule(ctx context.Context, engine *wasmtime.Engine) (*wasmtime.Module, error) { - expected, err := r.parseChecksum() - if err != nil { - return nil, err +// Verify the provided sha256 is valid. +func (r *Runner) getChecksum(ctx context.Context) (string, error) { + if r.SHA256 != "" { + return r.SHA256, nil } - value, err, _ := flight.Do(expected, func() (interface{}, error) { - return r.loadSerializedModule(ctx, engine) - }) + // TODO: Add a log line here about something + _, sum, err := r.fetch(ctx, r.URL) if err != nil { - return nil, err + return "", err } - data, ok := value.([]byte) - if !ok { - return nil, fmt.Errorf("returned value was not a byte slice") - } - return wasmtime.NewModuleDeserialize(engine, data) + slog.Warn("fetching WASM binary to calculate sha256. Set this value in sqlc.yaml to prevent unneeded work", "sha256", sum) + return sum, nil } -func (r *Runner) loadSerializedModule(ctx context.Context, engine *wasmtime.Engine) ([]byte, error) { - expected, err := r.parseChecksum() +func (r *Runner) loadAndCompile(ctx context.Context) (*runtimeAndCode, error) { + expected, err := r.getChecksum(ctx) if err != nil { return nil, err } - cacheRoot, err := cacheDir() + store, err := cache.Open() if err != nil { return nil, err } - cache := filepath.Join(cacheRoot, "plugins") - if err := os.MkdirAll(cache, 0755); err != nil && !os.IsExist(err) { - return nil, fmt.Errorf("failed to create cache directory: %w", err) - } - - pluginDir := filepath.Join(cache, expected) - modName := fmt.Sprintf("plugin_%s_%s_%s.module", runtime.GOOS, runtime.GOARCH, wasmtimeVersion) - modPath := filepath.Join(pluginDir, modName) - _, staterr := os.Stat(modPath) - if staterr == nil { - data, err := os.ReadFile(modPath) - if err != nil { - return nil, err - } - return data, nil - } - - wmod, err := r.loadWASM(ctx, cache, expected) + defer store.Close() + value, err, _ := flight.Do(expected, func() (any, error) { + return r.loadAndCompileWASM(ctx, store, expected) + }) if err != nil { return nil, err } - - moduRegion := trace.StartRegion(ctx, "wasmtime.NewModule") - module, err := wasmtime.NewModule(engine, wmod) - moduRegion.End() - if err != nil { - return nil, fmt.Errorf("define wasi: %w", err) - } - - err = os.Mkdir(pluginDir, 0755) - if err != nil && !os.IsExist(err) { - return nil, fmt.Errorf("mkdirall: %w", err) - } - out, err := module.Serialize() - if err != nil { - return nil, fmt.Errorf("serialize: %w", err) - } - if err := os.WriteFile(modPath, out, 0444); err != nil { - return nil, fmt.Errorf("cache wasm: %w", err) + data, ok := value.(*runtimeAndCode) + if !ok { + return nil, fmt.Errorf("returned value was not a compiled module") } - - return out, nil + return data, nil } -func (r *Runner) loadWASM(ctx context.Context, cache string, expected string) ([]byte, error) { - pluginDir := filepath.Join(cache, expected) - pluginPath := filepath.Join(pluginDir, "plugin.wasm") - _, staterr := os.Stat(pluginPath) - +func (r *Runner) fetch(ctx context.Context, uri string) ([]byte, string, error) { var body io.ReadCloser + switch { - case staterr == nil: - file, err := os.Open(pluginPath) - if err != nil { - return nil, fmt.Errorf("os.Open: %s %w", pluginPath, err) - } - body = file - case strings.HasPrefix(r.URL, "file://"): - file, err := os.Open(strings.TrimPrefix(r.URL, "file://")) + case strings.HasPrefix(uri, "file://"): + file, err := os.Open(strings.TrimPrefix(uri, "file://")) if err != nil { - return nil, fmt.Errorf("os.Open: %s %w", r.URL, err) + return nil, "", fmt.Errorf("os.Open: %s %w", uri, err) } body = file - case strings.HasPrefix(r.URL, "https://"): - req, err := http.NewRequestWithContext(ctx, "GET", r.URL, nil) + case strings.HasPrefix(uri, "https://"): + req, err := http.NewRequestWithContext(ctx, "GET", uri, nil) if err != nil { - return nil, fmt.Errorf("http.Get: %s %w", r.URL, err) + return nil, "", fmt.Errorf("http.Get: %s %w", uri, err) } req.Header.Set("User-Agent", fmt.Sprintf("sqlc/%s Go/%s (%s %s)", info.Version, runtime.Version(), runtime.GOOS, runtime.GOARCH)) resp, err := http.DefaultClient.Do(req) if err != nil { - return nil, fmt.Errorf("http.Get: %s %w", r.URL, err) + return nil, "", fmt.Errorf("http.Get: %s %w", r.URL, err) } body = resp.Body default: - return nil, fmt.Errorf("unknown scheme: %s", r.URL) + return nil, "", fmt.Errorf("unknown scheme: %s", r.URL) } defer body.Close() wmod, err := io.ReadAll(body) if err != nil { - return nil, fmt.Errorf("readall: %w", err) + return nil, "", fmt.Errorf("readall: %w", err) } sum := sha256.Sum256(wmod) actual := fmt.Sprintf("%x", sum) - if expected != actual { - return nil, fmt.Errorf("invalid checksum: expected %s, got %s", expected, actual) - } + return wmod, actual, nil +} - if staterr != nil { - err := os.Mkdir(pluginDir, 0755) - if err != nil && !os.IsExist(err) { - return nil, fmt.Errorf("mkdirall: %w", err) +func (r *Runner) loadAndCompileWASM(ctx context.Context, store *cache.Cache, expected string) (*runtimeAndCode, error) { + // The sha256 declared in sqlc's configuration is a content address, so + // the plugin binary is looked up in the CAS directly by that checksum — + // no action cache entry is needed, and Get re-verifies the checksum on + // every hit. + wmod, err := store.CAS.Get(cache.SHA256Digest(expected)) + if errors.Is(err, cache.ErrNotFound) { + var actual string + wmod, actual, err = r.fetch(ctx, r.URL) + if err != nil { + return nil, err } - if err := os.WriteFile(pluginPath, wmod, 0444); err != nil { + if expected != actual { + return nil, fmt.Errorf("invalid checksum: expected %s, got %s", expected, actual) + } + if _, err := store.CAS.Put(wmod); err != nil { return nil, fmt.Errorf("cache wasm: %w", err) } + } else if err != nil { + return nil, err } - return wmod, nil + // Compiling the module to machine code is itself a cacheable action. + // Its only declared input is the module's checksum: the embedded wazero + // version and the target platform are determined by the sqlc binary, + // which is an implicit input of every action. Compiled artifacts are + // materialized into a private exec directory for wazero's compilation + // cache to find; the authoritative copies live in the CAS. Once wazero + // has loaded the module into memory the directory is no longer needed. + compileAction := store.NewAction("CompileModule"). + AddInput("wasm", []byte(expected)). + Digest() + + execDir, err := store.ExecDir(compileAction) + if err != nil { + return nil, err + } + defer os.RemoveAll(execDir) + compiled := true + if err := store.Actions.GetTree(compileAction, execDir); errors.Is(err, cache.ErrNotFound) { + compiled = false + } else if err != nil { + return nil, err + } + + wazeroCache, err := wazero.NewCompilationCacheWithDir(execDir) + if err != nil { + return nil, fmt.Errorf("wazero.NewCompilationCacheWithDir: %w", err) + } + + config := wazero.NewRuntimeConfig().WithCompilationCache(wazeroCache) + rt := wazero.NewRuntimeWithConfig(ctx, config) + + if _, err := wasi_snapshot_preview1.Instantiate(ctx, rt); err != nil { + return nil, fmt.Errorf("wasi_snapshot_preview1 instantiate: %w", err) + } + + // Compile the Wasm binary once so that we can skip the entire compilation + // time during instantiation. On an action cache hit this loads the + // materialized machine code instead of compiling. + code, err := rt.CompileModule(ctx, wmod) + if err != nil { + return nil, fmt.Errorf("compile module: %w", err) + } + + if !compiled { + if err := store.Actions.PutTree(compileAction, execDir); err != nil { + slog.Warn("caching compiled module failed", "err", err) + } + } + + return &runtimeAndCode{rt: rt, code: code}, nil } // removePGCatalog removes the pg_catalog schema from the request. There is a // mysterious (reason unknown) bug with wasm plugins when a large amount of // tables (like there are in the catalog) are sent. // @see https://github.com/sqlc-dev/sqlc/pull/1748 -func removePGCatalog(req *plugin.CodeGenRequest) { +func removePGCatalog(req *plugin.GenerateRequest) { if req.Catalog == nil || req.Catalog.Schemas == nil { return } @@ -209,105 +208,84 @@ func removePGCatalog(req *plugin.CodeGenRequest) { req.Catalog.Schemas = filtered } -func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - // Remove the pg_catalog schema. Its sheer size causes unknown issues with wasm plugins - removePGCatalog(req) - - stdinBlob, err := req.MarshalVT() - if err != nil { - return nil, err - } - - engine := wasmtime.NewEngine() - module, err := r.loadModule(ctx, engine) - if err != nil { - return nil, fmt.Errorf("loadModule: %w", err) +func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(protoreflect.ProtoMessage) + if !ok { + return status.Error(codes.InvalidArgument, "args isn't a protoreflect.ProtoMessage") } - linker := wasmtime.NewLinker(engine) - if err := linker.DefineWasi(); err != nil { - return nil, err + // Remove the pg_catalog schema. Its sheer size causes unknown issues with wasm plugins + genReq, ok := req.(*plugin.GenerateRequest) + if ok { + removePGCatalog(genReq) + req = genReq } - dir, err := os.MkdirTemp(os.Getenv("SQLCTMPDIR"), "out") + stdinBlob, err := proto.Marshal(req) if err != nil { - return nil, fmt.Errorf("temp dir: %w", err) + return fmt.Errorf("failed to encode codegen request: %w", err) } - defer os.RemoveAll(dir) - stdinPath := filepath.Join(dir, "stdin") - stderrPath := filepath.Join(dir, "stderr") - stdoutPath := filepath.Join(dir, "stdout") - - if err := os.WriteFile(stdinPath, stdinBlob, 0755); err != nil { - return nil, fmt.Errorf("write file: %w", err) + runtimeAndCode, err := r.loadAndCompile(ctx) + if err != nil { + return fmt.Errorf("loadBytes: %w", err) } - // Configure WASI imports to write stdout into a file. - wasiConfig := wasmtime.NewWasiConfig() - wasiConfig.SetStdinFile(stdinPath) - wasiConfig.SetStdoutFile(stdoutPath) - wasiConfig.SetStderrFile(stderrPath) + var stderr, stdout bytes.Buffer - keys := []string{"SQLC_VERSION"} - vals := []string{req.SqlcVersion} + conf := wazero.NewModuleConfig(). + WithName(""). + WithArgs("plugin.wasm", method). + WithStdin(bytes.NewReader(stdinBlob)). + WithStdout(&stdout). + WithStderr(&stderr). + WithEnv("SQLC_VERSION", info.Version) for _, key := range r.Env { - keys = append(keys, key) - vals = append(vals, os.Getenv(key)) + conf = conf.WithEnv(key, os.Getenv(key)) } - wasiConfig.SetEnv(keys, vals) - store := wasmtime.NewStore(engine) - store.SetWasi(wasiConfig) - - linkRegion := trace.StartRegion(ctx, "linker.DefineModule") - err = linker.DefineModule(store, "", module) - linkRegion.End() - if err != nil { - return nil, fmt.Errorf("define wasi: %w", err) + result, err := runtimeAndCode.rt.InstantiateModule(ctx, runtimeAndCode.code, conf) + if err == nil { + defer result.Close(ctx) } - - // Run the function - fn, err := linker.GetDefault(store, "") - if err != nil { - return nil, fmt.Errorf("wasi: get default: %w", err) + if cerr := checkError(err, stderr); cerr != nil { + return cerr } - callRegion := trace.StartRegion(ctx, "call _start") - _, err = fn.Call(store) - callRegion.End() + // Print WASM stdout + stdoutBlob := stdout.Bytes() - if cerr := checkError(err, stderrPath); cerr != nil { - return nil, cerr + resp, ok := reply.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("reply isn't a GenerateResponse") } - // Print WASM stdout - stdoutBlob, err := os.ReadFile(stdoutPath) - if err != nil { - return nil, fmt.Errorf("read file: %w", err) + if err := proto.Unmarshal(stdoutBlob, resp); err != nil { + return err } - var resp plugin.CodeGenResponse - return &resp, resp.UnmarshalVT(stdoutBlob) + return nil } -func checkError(err error, stderrPath string) error { +func (r *Runner) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") +} + +func checkError(err error, stderr bytes.Buffer) error { if err == nil { return err } - var wtError *wasmtime.Error - if errors.As(err, &wtError) { - if code, ok := wtError.ExitStatus(); ok { - if code == 0 { - return nil - } + if exitErr, ok := err.(*sys.ExitError); ok { + if exitErr.ExitCode() == 0 { + return nil } } + // Print WASM stdout - stderrBlob, rferr := os.ReadFile(stderrPath) - if rferr == nil && len(stderrBlob) > 0 { - return errors.New(string(stderrBlob)) + stderrBlob := stderr.String() + if len(stderrBlob) > 0 { + return errors.New(stderrBlob) } return fmt.Errorf("call: %w", err) } diff --git a/internal/goldeneye/README.md b/internal/goldeneye/README.md new file mode 100644 index 0000000000..ed2c67d040 --- /dev/null +++ b/internal/goldeneye/README.md @@ -0,0 +1,348 @@ +# goldeneye + +`goldeneye` generates the dialect seeds under `internal/engine//dialect` +from a live database, and verifies the committed ones against it. A dialect +is the JSONL that gives an engine its type system and standard library — +`types.jsonl`, `functions.jsonl`, `operators.jsonl`, `relations.jsonl` and +the `extensions/` bundles — read by `internal/core/seed`. Each engine package +here asks the database what it knows, writes the answer in that shape, and +the tests compare it with what is committed, byte for byte. A difference +means the committed dialect has drifted from the database. + +It is a nested Go module, so its only dependencies beyond the standard +library are the database clients — PostgreSQL's, MySQL's and SQL Server's +drivers, and Spanner's gRPC client with what it stands on — and it never +shares code with the analysis that reads the files: the files are the +contract. Run it from this directory: + +```bash +go run ./cmd/goldeneye install clickhouse # download the pinned clickhouse binary once +go run ./cmd/goldeneye install duckdb # download the current DuckDB 2.0 preview build once +go run ./cmd/goldeneye install sqlite # build the pinned sqlite3 shells once; needs a C compiler +go run ./cmd/goldeneye check # check every engine whose database is available +go run ./cmd/goldeneye check postgresql # check one engine +go run ./cmd/goldeneye check spanner # SPANNER_SERVER_URI=localhost:15000, a Spanner Omni container +go run ./cmd/goldeneye generate [engine] # rewrite the generated files from the database +go test ./... # the same checks as tests; engines without a database skip +``` + +`generate` and `check` say which engines they skipped for lack of a +database; naming an engine makes its database required. + +## What is generated, and what is not + +A generator owns only the files it produces; `dialect.json` is always written +by hand, and so are the lists an engine cannot describe. Both commands leave +the hand-written files alone, and the checks do not look at them. + +- **`postgresql`** reads a live server named by `POSTGRESQL_SERVER_URI`: + `functions.jsonl` is `pg_catalog`'s functions, `relations.jsonl` the tables + and views of `pg_catalog` and `information_schema`, and each contrib + extension gets a directory under `extensions/` holding the types and + functions `CREATE EXTENSION` adds, so the server needs contrib installed. + A function that one of those extensions puts in `pg_catalog`, as + `adminpack` does, belongs to the extension's directory rather than the + catalog's list. The server has to be the major release pinned in + `postgresql.Major`, since every release adds to the catalogs; the top-level + `types.jsonl` and `operators.jsonl` are hand-written. +- **`mysql`** reads a live server named by `MYSQL_SERVER_URI`, a go-sql-driver + DSN such as `root:mysecretpassword@tcp(127.0.0.1:3306)/mysql`, and writes + into `internal/engine/dolphin/dialect`, since sqlc's MySQL engine is named + after its parser. MySQL keeps no catalog of its types, functions or + operators — the help tables describe a built-in function no further than + its name — so `types.jsonl`, `functions.jsonl` and `operators.jsonl` are + hand-written. What it does describe is its data dictionary: + `relations.jsonl` is every view of `information_schema`, read from + `information_schema` itself, with their names in lower case, since MySQL + matches them in any case and sqlc's parser lowercases every identifier. A + column's type is spelled the way a declaration does, `bigint unsigned` + included, which `types.jsonl` lists as an alias of `bigint`. The other + schemas `mysqld --initialize` creates — `mysql`, `performance_schema`, `sys` + — are tables rather than views, and every table a dialect seeds is one the + analysis core hands codegen as a model, so they are left out until codegen + knows a system schema when it sees one. The server has to be the major + release pinned in `mysql.Major`, since every release adds to + `information_schema`. +- **`duckdb`** reads the DuckDB CLI named by `DUCKDB`, or the one `install` + put in the user cache directory, or `duckdb` on `PATH`: `types.jsonl`, + `functions.jsonl` and `operators.jsonl` come from `duckdb_types()` and + `duckdb_functions()`. The CLI has to be a DuckDB 2.0 build, the release + darkwing is pinned against, which has no release to download yet: until + 2.0 is out, `install` downloads the current build of DuckDB's v2.0 + preview channel, `duckdb.DefaultVersion`, a rolling tarball per platform + under `artifacts.duckdb.org` with no per-build download and no checksum + to pin, so what a run logs is the version the CLI reports, and + `duckdb.GeneratedFrom` records the build the committed dialect came + from. A check against a later build reports what the later build added; + regenerate, and update `GeneratedFrom`, to move the dialect along. Once + 2.0 is released, the installer should pin the release and its checksums + the way the clickhouse one does. +- **`clickhouse`** needs no server: `types.jsonl` comes from + `system.data_type_families` of an ephemeral `clickhouse local` process, + every family that is not an alias becoming a type carrying the spellings + that alias it, with a category decided by its name. The binary is + downloaded once per pinned release by `install` into the user cache + directory, or supplied through the `CLICKHOUSE` environment variable; the + pinned release and the SHA-512 of each platform's download live in + `clickhouse/install.go`, and a download that does not match is discarded. + ClickHouse describes its functions no further than their names, so + `functions.jsonl` is hand-written. +- **`mssql`** reads a live server named by `MSSQL_SERVER_URI`, in any form + the go-mssqldb driver accepts, such as + `sqlserver://sa:password@127.0.0.1:1433?encrypt=disable`. SQL Server keeps + no catalog of its intrinsic functions or its operators — GETDATE and LEN + are not objects — so `types.jsonl` and `functions.jsonl` are hand-written. + What it does describe is its catalog: `relations.jsonl` is every view of + the `sys` and `INFORMATION_SCHEMA` schemas, listed from a database of its + own, since the views a query sees are the ones a user database has and + `master` lists internal views no query can name; each view's columns are + what `sys.dm_exec_describe_first_result_set` says a `SELECT *` from it + returns, the type spelled the way a declaration spells it — + `nvarchar(128)`, `decimal(10,2)`, `varbinary(max)` — and the nullability + the server computes. Names are written in lower case, since SQL Server + matches them in any case under its default collations and sqlc's parser + lowercases every identifier. Both schemas hold nothing but views, so no + table is seeded that codegen would take for a model. The server has to + be the major release pinned in `mssql.Major`, since every release adds + to the catalog views. +- **`spanner`** reads a live Spanner Omni server — the downloadable + Spanner, run from its container image — named by `SPANNER_SERVER_URI`, + the gRPC endpoint such as `localhost:15000`, reached without TLS or + credentials as Omni is, and writes into `internal/engine/googlesql/dialect`, + since sqlc's engine is named after the language Spanner speaks. Spanner + keeps no catalog of its types, functions or operators, so they are read + by asking: `spanner/library.jsonl` lists the function signatures to try, + and each is compiled in PLAN mode against a probe database, the ones + Spanner accepts written to `functions.jsonl` with the type it reports; + `operators.jsonl` is every binary operator Spanner accepts over the + operands tried, and `types.jsonl` the types the dialect lists, each one + Spanner has checked by a cast. Whether a result can be NULL is what + Spanner does not say, so `library.jsonl` says it. Spanner also + describes its information schema: `relations.jsonl` is every view of + `INFORMATION_SCHEMA` and `SPANNER_SYS`, read from `INFORMATION_SCHEMA` + itself in a database created for the purpose in the instance Omni's + single server provides, `projects/default/instances/default`. Names are + kept as the catalog spells them, in upper case: Spanner matches a name + in any case, but sqlc's GoogleSQL engine matches one as it is spelled, + so a query reaches these views by their upper-case names until the + engine folds case; a column's type is spelled in lower case the way the seed + spells one, an `ARRAY` as `T` with the array flag, a `STRUCT` as + `struct(a: t)` and a `PROTO` as `proto('p.M')`, since a seed writes + a type's arguments in parentheses. The container image is pinned in the + gen workflow and `docker-compose.yml`. +- **`sqlite`** needs no server either: `functions.jsonl` comes from + `pragma_function_list` of a `sqlite3` shell run against an in-memory + database. Which functions a SQLite has is decided when it is compiled, so + `install` downloads the pinned release's amalgamation, checked against the + SHA3-256 the download page lists, and compiles the shell from it with the + compiler `CC` names, or `cc` — once with the options sqlite.org's own + configure turns on by default, which gives `functions.jsonl`, and once + more per option in `sqlite/install.go`'s extension list, each of which + gets a directory under `extensions/` holding the functions its build adds + over the default one, the way each PostgreSQL contrib extension holds what + `CREATE EXTENSION` adds; a schema that says `CREATE VIRTUAL TABLE ... USING + fts5` loads the option's directory, through the `modules` map in the + hand-written `dialect.json`. SQLite describes its functions as far as their + names, their kinds and the number of arguments each overload takes, and no + further — it types values, not functions — so what each returns and what + its arguments hold is read from the amalgamation: every function is + registered with the C functions that implement it, and those set their + result through `sqlite3_result_*` and read their arguments through + `sqlite3_value_*`. A function a shell reports that the source does not + register fails the run rather than being guessed at. Whether an aggregate + returns NULL over no rows is found by running it over none; the scalar + functions that return NULL for arguments that are not are a short list in + `sqlite/signatures.go`, since a SQLite function returns NULL as often by + setting no result as by saying so. The pinned release is the one the main module's + driver embeds. SQLite has no catalog of types or operators, so + `types.jsonl` and `operators.jsonl` are hand-written. A function that + returns an integer for an integer and a real for a real — `abs`, `ceil`, + `floor`, `trunc`, `sum` — is written once over `any`, returning the real + that a text or blob argument gets, and once more per spelling + `types.jsonl` gives integer and real, returning that type, the way + PostgreSQL's catalog has a `sum` per numeric type; the overload over `any` + comes first, since the legacy compiler resolves by arity alone and takes + it. `install` builds one more shell, for the analysis check below; + nothing is generated from it. + +## Layout + +- `dialect/` — the record types the files are made of, mirrored from + `internal/core/seed`, and the helpers that write a generated set of files + into an engine directory or diff it against what is committed. +- `endtoend/` — finds the analyze cases, splits their query files, and + compares an engine's answer with a case's committed output. +- `analysis/` — the shape of that answer: the JSON `sqlc analyze` prints. +- `postgresql/`, `mysql/`, `mssql/`, `spanner/`, `duckdb/`, `clickhouse/`, + `sqlite/` — one package per engine, each exposing `Locate`, `Version` and + `Generate`, `Analyze` where the engine has an analysis check, and tests + that run the checks. +- `cmd/goldeneye/` — the command. + +## Analysis checks + +`check` also verifies the `analyze_*` cases under `internal/endtoend/testdata` +against what the database itself reports. A case is an +`analyze_/` directory whose `exec.json` runs the analyze +command; `endtoend/` finds them. The engine package loads the case's +`schema.sql` and optional `fixture.sql` into the database, runs `query.sql` +there, prints what the database reports in the JSON shape `sqlc analyze` +prints, and compares it with the committed `stdout.json` byte for byte. A +difference means sqlc's analysis disagrees with the database. A case that +asks for `--ast` is skipped, since only sqlc can print that. + +- **`clickhouse`** runs each case in an ephemeral `clickhouse local` process. + Column types come from the executed query's result header, provenance from + `EXPLAIN QUERY TREE`, and parameters from sentinel constants substituted for + `?`, `sqlc.arg()` and `sqlc.narg()`, since ClickHouse itself never sees a + placeholder; `INSERT ... VALUES` parameters map onto `DESCRIBE TABLE`. +- **`sqlite`** runs each case through one more shell `install` builds, under + `analysis/`: every extension option at once, so that any case's schema + loads, and `SQLITE_ENABLE_COLUMN_METADATA`, which lets the shell's `.stats + stmt` say which table column each result column of a statement is read + from. That column's declared type is the result column's, and its NOT + NULL decides nullability, the rowid counting as NOT NULL. SQLite types + values rather than expressions, so a column the library has no origin for + — an aggregate, an arithmetic result — is typed by the storage class of + the value it returns, which is why a case wants a `fixture.sql`: the query + is run over the fixture, with each parameter bound to a value of the + column it stands in for, and again over no rows, and a column is nullable + when either run returns a NULL for it — an aggregate over nothing, the far + side of an outer join. The library reports nothing about a parameter but + its number, so parameters are found in the bytecode `EXPLAIN` prints, the + way ClickHouse's are found in its query tree: each is followed from the + register its `Variable` loads, through copies and the expressions it is an + argument of, to the first opcode that uses it against something the + catalog can name — the other operand of a comparison, the row a seek lands + on, the position in the record an `Insert` writes, the column of an IN + list's ephemeral table it comes back out of. One that reaches nothing + nameable is described by what the program requires of it, when it + requires anything: `MustBeInt` makes LIMIT's an integer. `sqlc.arg(name)` + becomes `?N`, numbered as sqlc numbers them, so a repeated name is one + parameter. Two things the check reports that sqlc does not: a bare column + selected alongside an aggregate is NULL over no rows, and so nullable, and + a comparison such as `x IS NULL` is an integer, since that is what SQLite + returns. + +- **`mysql`** runs each case in a database of its own on the server named by + `MYSQL_SERVER_URI`, and asks the server three things about a query. What a + driver sees: the query is run, with every parameter a user variable set to + NULL, and each result column's name, type and nullability are read from + the result set's metadata as go-sql-driver reports them. What the resolver + made of it: the optimizer trace prints each query block back after name + resolution and before optimisation, with every column qualified, every + alias kept and every `SELECT *` expanded, which says which table a result + column is read from and what a parameter is compared with or assigned to. + And for a statement the trace does not expand — an `INSERT ... VALUES`, a + single-table `UPDATE` or `DELETE` — the note `EXPLAIN` leaves, which prints + the statement the same way; a `SELECT` cannot be read from the note, since + it is printed after optimisation, and a lookup on a unique key against an + empty table has folded to `NULL = (@x)` there. Views and derived tables are + kept as the query wrote them rather than merged, so that a column read + through one is reported as its column and an `information_schema` view is + not resolved away into the dictionary tables behind it. MySQL itself + reports nothing about a parameter but its position, so a parameter is + described by its partner: a column's type and nullability come from + `information_schema`, a column of a derived table or CTE from what its + block projects, and an expression's from running it, over the tables it + reads, as a query of its own; a `LIMIT` or `OFFSET` count is a `bigint + unsigned`. Two things the driver keeps to itself: the table a result + column comes from, which is why the trace is read for it, and the length + beside the one wire type every size of `TEXT` and `BLOB` is sent as, which + is why a column read from a table, directly or through a derived table, + is spelled the way the table declares it. + +- **`duckdb`** runs each case through the CLI, which loads the schema and + fixture into an in-memory database of their own, one process per + question, and is asked four things about each query. What its + parameters are: the query is prepared and explained as JSON with a + string sentinel bound to each parameter, `EXECUTE q('goldeneye_1', + ...)`, and the unoptimized logical plan the CLI prints under + `explain_output = 'all'` shows each as `CAST('goldeneye_k' AS T)`, `T` + being the type the binder gave the parameter, or bare when that type is + `VARCHAR`; a sentinel the binder converts on the spot, as an `INSERT`'s + `VALUES` are, is bound to NULL instead. What its result columns are: `DESCRIBE`, with each parameter + replaced by a NULL of its type, names and types them; DuckDB describes + no DML, so a `RETURNING` column is the target table's column it names. + Which table a result column is read from and which column a parameter + stands in for: DuckDB prints a plan with every column by its bare name + and every aliased expression by its alias, so these are read from the + query text, the select list's items, a star expanded to its table's + columns, and the operand beside each parameter, resolved against the + `FROM` clause and the catalog, `duckdb_columns()`, from which a column + read from a table takes its declared type and nullability; a parameter + the query casts takes the cast's type as DuckDB spells it, and one + inside a subquery, whose tables the statement's scope does not name, + takes the binder's. And whether + an expression can be NULL, which DuckDB does not track: the query is + run, with each parameter bound to a value of its type, over the fixture + and over no rows, and a column is nullable when either run returns a + NULL for it. DuckDB spells an enum column by its labels whether the + schema named the type or not, so labels that are those of an enum the + schema created name that type, and a spelling `types.jsonl` lists as an + alias — `json`, which DuckDB's own catalog lists as a spelling of + `varchar` — is reported by the dialect's name for it. +- **`mssql`** describes each case in a database of its own on the server + named by `MSSQL_SERVER_URI`, without running anything: the schema is + loaded one statement at a time, since a `CREATE TYPE` has to be its own + batch before a table can use the type, and the server is asked three + things about each query. What a driver would see: + `sys.dm_exec_describe_first_result_set` describes each result column — + its name, its type spelled the way a declaration spells it, whether it + can be NULL, and which table column it is read from. What each parameter + would be: `sp_describe_undeclared_parameters` says what type the server + would give each parameter the query leaves undeclared, which is the type + of a `CAST(@p AS T)`; it describes a parameter only when it is used + once, so each appearance of a repeated one becomes a variable of its + own. And what each parameter stands in for: the estimated showplan, + compiled with `SET SHOWPLAN_XML ON` and the parameters declared as those + types, prints every column as a reference naming its table and every + variable as `@variable`, and a parameter's partner is the column on the + other side of the `Compare` it is an operand of, the column an `Assign` + sets to it, or the column of a seek whose range expression it is, with a + named expression such as `Expr1002` followed to its definition; a + parameter under a `CONVERT` the query wrote has no partner, since the + cast says what it is. A parameter with a partner is described as that + column, from the catalog of the case's database. Three things the + describing function keeps to itself: a `json` or `vector` column is + described by the `nvarchar(max)` it is sent to a driver as, so a column + read from a table is typed from `sys.columns` instead; a type the + schema created is reported beside the system type it stands on, and the + dialect reports it by its own name; and a spelling `types.jsonl` lists + as an alias — `numeric`, `timestamp` — is reported by the dialect's name + for it, `decimal`, `rowversion`. One thing it says that sqlc does not: a + computed column — a cast, an arithmetic — is nullable whatever its + arguments, since a conversion that fails under `ANSI_WARNINGS OFF` + yields NULL, where sqlc follows the arguments, and a computed column + names the column it is computed from, as the one an update through the + result set would write, where sqlc gives an expression no table. The + cases compute over nullable columns, and a computed column is reported + without a table. +- **`spanner`** creates a database of each case's own from its schema in + the instance named by `SPANNER_SERVER_URI`, writes its fixture there in a + read-write transaction, and compiles each query in `PLAN` mode, which + runs nothing: a DML statement is compiled in a read-write transaction + that is rolled back. The server reports the name and type of each + result column and the type of each parameter the query leaves + undeclared, the way the wire spells them — `STRING`, `ARRAY` — + without the length a declaration gives a `STRING(10)` or whether a + column can be NULL, and the query plan, which says where each comes + from: the children of `Serialize Result` after the relation it + serializes are the result columns, a `Scan` of a table defines a + variable per column it reads, and a comparison is a `Function` whose + description reads `($col = @param)`. A result column the plan reads + from a table column, directly or through the variables a join or a + batch passes it through, is described from the case's + `INFORMATION_SCHEMA`, with its declared length and nullability; one the + plan reads as a parameter is the column the parameter is compared with, + which is why the optimizer substituted it. A parameter compared with a + table column is described as that column. A DML plan lists the values + it writes before the columns it returns — the table's key columns, then + the columns an `UPDATE` sets or an `INSERT` inserts, read from the + statement — and a parameter written to a column is described as it, + while a `THEN RETURN` column is the table's column of that name. Two + things Spanner does not say: whether an expression can be NULL, which + is reported as it is not, and anything about a `STRUCT` returned as a + column, which Spanner rejects. + +The other engines have no analysis check yet. diff --git a/internal/goldeneye/analysis/analysis.go b/internal/goldeneye/analysis/analysis.go new file mode 100644 index 0000000000..1433f50904 --- /dev/null +++ b/internal/goldeneye/analysis/analysis.go @@ -0,0 +1,64 @@ +// Package analysis is the shape of an engine's answer about a query: the +// JSON `sqlc analyze` prints, so that a case's committed stdout.json can be +// compared with what the database itself reports, byte for byte. +package analysis + +import ( + "bytes" + "encoding/json" +) + +// Query is what was found out about one query. +type Query struct { + Name string `json:"name"` + Cmd string `json:"cmd"` + Columns []Column `json:"columns"` + Params []Param `json:"params"` +} + +// Column describes a result column, or the column a parameter stands in +// for. +type Column struct { + Name string `json:"name"` + Type *TypeExpr `json:"type,omitempty"` + Table string `json:"table,omitempty"` +} + +// Param is one parameter and what it is compared with or assigned to. +type Param struct { + Number int `json:"number"` + Column Column `json:"column"` +} + +// TypeExpr is a type as a call expression: a lowercased name applied to an +// ordered argument list, each argument another type, an integer, a boolean +// or a quoted string, optionally labelled. Nullability is an attribute of +// the type rather than a wrapper. +type TypeExpr struct { + Name string `json:"name"` + Nullable bool `json:"nullable,omitempty"` + Args []TypeArg `json:"args,omitempty"` +} + +// TypeArg is one argument of a TypeExpr: a type, an integer, a boolean, a +// quoted string, or an identifier — a bare word that is not a type, such as +// the function an AggregateFunction names. +type TypeArg struct { + Label string `json:"label,omitempty"` + Type *TypeExpr `json:"type,omitempty"` + Int *int64 `json:"int,omitempty"` + Bool *bool `json:"bool,omitempty"` + String *string `json:"string,omitempty"` + Ident *string `json:"ident,omitempty"` +} + +// Encode prints the answer the way sqlc analyze does. +func Encode(queries []Query) ([]byte, error) { + var buf bytes.Buffer + enc := json.NewEncoder(&buf) + enc.SetIndent("", " ") + if err := enc.Encode(queries); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/internal/goldeneye/clickhouse/analyze.go b/internal/goldeneye/clickhouse/analyze.go new file mode 100644 index 0000000000..ff2148fdf5 --- /dev/null +++ b/internal/goldeneye/clickhouse/analyze.go @@ -0,0 +1,272 @@ +package clickhouse + +import ( + "context" + "encoding/json" + "fmt" + "regexp" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// analyze runs every query against the schema and fixture and records what +// ClickHouse reports about each. +func analyze(ctx context.Context, l local, schema, fixture string, queries []endtoend.Query) ([]analysis.Query, error) { + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := analyzeQuery(ctx, l, schema, fixture, q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return out, nil +} + +func analyzeQuery(ctx context.Context, l local, schema, fixture string, q endtoend.Query) (analysis.Query, error) { + sql, phs := bindPlaceholders(q.SQL) + explain := returnsRows(sql) + + var script strings.Builder + for _, stmt := range []string{schema, fixture} { + if s := strings.TrimRight(strings.TrimSpace(stmt), ";"); s != "" { + script.WriteString(s) + script.WriteString(";\n") + } + } + if explain { + script.WriteString("EXPLAIN QUERY TREE " + sql + ";\n") + } + script.WriteString(sql + ";\n") + + results, err := l.run(ctx, script.String()) + if err != nil { + return analysis.Query{}, err + } + + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + if !explain { + return analyzeExec(ctx, l, script.String(), sql, phs, aq) + } + if len(results) != 2 { + return analysis.Query{}, fmt.Errorf("expected the query tree and one result set, got %d results", len(results)) + } + + var lines []string + for _, row := range results[0].Data { + var line string + if err := json.Unmarshal(row["explain"], &line); err != nil { + return analysis.Query{}, fmt.Errorf("reading query tree: %w", err) + } + lines = append(lines, line) + } + tree, err := parseQueryTree(lines) + if err != nil { + return analysis.Query{}, err + } + + // Names and types come from the block header of the executed query, the + // same header a driver sees. The tree only adds where each came from. + _, nodes := projection(firstNode(tree.root.children)) + for i, col := range results[1].Meta { + ac := column(col.Name, col.Type) + if i < len(nodes) && len(nodes) == len(results[1].Meta) { + ac.Table = tree.sourceTable(nodes[i]) + } + aq.Columns = append(aq.Columns, ac) + } + + sentinels := tree.sentinels() + for i, ph := range phs { + ac := analysis.Column{} + if sentinel := sentinels[i+1]; sentinel != nil { + ac = tree.paramColumn(sentinel) + } + if ph.Name != "" { + ac.Name = ph.Name + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} + +func column(name, typ string) analysis.Column { + if typ == "" { + return analysis.Column{Name: name} + } + return analysis.Column{Name: name, Type: parseType(typ)} +} + +// returnsRows reports whether a statement produces a result set and so can +// be explained as a query tree. +func returnsRows(sql string) bool { + head := strings.ToLower(strings.TrimSpace(sql)) + if strings.HasPrefix(head, "(") { + return true + } + for _, kw := range []string{"select", "with", "show", "describe", "desc", "exists"} { + if strings.HasPrefix(head, kw) && (len(head) == len(kw) || !isWordByte(head[len(kw)])) { + return true + } + } + return false +} + +// sentinels finds the constants the placeholders were substituted with, +// keyed by placeholder ordinal. +func (t *queryTree) sentinels() map[int]*treeNode { + found := map[int]*treeNode{} + var walk func(n *treeNode) + walk = func(n *treeNode) { + if n.kind == "CONSTANT" { + if k, ok := sentinelOrdinal(n); ok { + found[k] = n + return + } + } + for _, c := range n.children { + walk(c) + } + } + walk(t.root) + return found +} + +// sentinelOrdinal recognises a constant folded directly from `NULL + k` or +// `4294967295 + k`, the shapes sentinelFor produces, and returns k. A +// constant folded from a larger expression that merely contains a sentinel +// does not match; the sentinel is found nested inside it instead. +func sentinelOrdinal(c *treeNode) (int, bool) { + fn := firstNode(c.section("EXPRESSION").childrenOrNil()) + if fn == nil || fn.kind != "FUNCTION" || fn.attrs["function_name"] != "plus" { + return 0, false + } + args := fn.section("ARGUMENTS").list() + if len(args) != 2 || args[0].kind != "CONSTANT" || args[1].kind != "CONSTANT" { + return 0, false + } + base := args[0].attrs["constant_value"] + if base != "NULL" && base != "UInt64_"+limitBase { + return 0, false + } + k, err := strconv.Atoi(strings.TrimPrefix(args[1].attrs["constant_value"], "UInt64_")) + if err != nil { + return 0, false + } + return k, true +} + +// paramColumn describes what a placeholder is compared with or assigned to: +// the other operand of the function it is an argument of, preferring a +// column over an expression, or the projected column it stands for. +func (t *queryTree) paramColumn(sentinel *treeNode) analysis.Column { + list := sentinel.parent + if list != nil && list.kind == "LIST" && list.parent != nil { + switch owner := list.parent; { + case owner.kind == "" && owner.text == "ARGUMENTS": + // Prefer a column operand, then an expression, then a constant. + rank := map[string]int{"COLUMN": 0, "FUNCTION": 1, "CONSTANT": 2} + var best *treeNode + for _, sib := range list.children { + if sib == sentinel { + continue + } + if r, ok := rank[sib.kind]; ok && (best == nil || r < rank[best.kind]) { + best = sib + } + } + if best != nil { + return t.describe(best) + } + case owner.kind == "" && owner.text == "PROJECTION": + names, nodes := projection(owner.parent) + for i, n := range nodes { + if n == sentinel && i < len(names) { + ac := column(names[i], sentinel.attrs["constant_value_type"]) + return ac + } + } + } + } + return column("", sentinel.attrs["constant_value_type"]) +} + +// describe turns a tree expression into a column description. +func (t *queryTree) describe(n *treeNode) analysis.Column { + switch n.kind { + case "COLUMN": + ac := column(n.attrs["column_name"], n.attrs["result_type"]) + ac.Table = t.sourceTable(n) + return ac + case "FUNCTION": + return column(n.attrs["function_name"], n.attrs["result_type"]) + case "CONSTANT": + // A constant folded from a function call, such as toDate(now()), + // still names the function, which is what a placeholder compared + // with it is named after. + name := "" + if fn := firstNode(n.section("EXPRESSION").childrenOrNil()); fn != nil && fn.kind == "FUNCTION" { + name = fn.attrs["function_name"] + } + return column(name, n.attrs["constant_value_type"]) + } + return analysis.Column{} +} + +var insertValuesRe = regexp.MustCompile(`(?is)^insert\s+into\s+(?:table\s+)?([\w.` + "`" + `"]+)\s*(?:\(([^)]*)\))?\s*(?:format\s+)?values\b`) + +// analyzeExec runs a statement that returns no rows. The only parameters it +// can describe are those of an INSERT ... VALUES, which map positionally +// onto the target columns reported by DESCRIBE TABLE. +func analyzeExec(ctx context.Context, l local, script, sql string, phs []placeholder, aq analysis.Query) (analysis.Query, error) { + m := insertValuesRe.FindStringSubmatch(sql) + if m != nil { + script += "DESCRIBE TABLE " + m[1] + ";\n" + } + results, err := l.run(ctx, script) + if err != nil { + return analysis.Query{}, err + } + + var targets []analysis.Column + if m != nil && len(results) == 1 { + byName := map[string]analysis.Column{} + var all []analysis.Column + table := strings.Trim(m[1][strings.LastIndexByte(m[1], '.')+1:], "`\"") + for _, row := range results[0].Data { + var name, typ string + json.Unmarshal(row["name"], &name) + json.Unmarshal(row["type"], &typ) + ac := column(name, typ) + ac.Table = table + byName[name] = ac + all = append(all, ac) + } + if strings.TrimSpace(m[2]) == "" { + targets = all + } else { + for _, name := range strings.Split(m[2], ",") { + targets = append(targets, byName[strings.Trim(strings.TrimSpace(name), "`\"")]) + } + } + } + for i, ph := range phs { + ac := analysis.Column{} + if len(targets) > 0 { + ac = targets[i%len(targets)] + } + if ph.Name != "" { + ac.Name = ph.Name + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} diff --git a/internal/goldeneye/clickhouse/check.go b/internal/goldeneye/clickhouse/check.go new file mode 100644 index 0000000000..fab53b8a08 --- /dev/null +++ b/internal/goldeneye/clickhouse/check.go @@ -0,0 +1,43 @@ +package clickhouse + +import ( + "context" + "os" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// Analyze runs a case's queries through the clickhouse binary and returns +// the analysis in the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, binary string, c endtoend.Case) ([]byte, error) { + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + out, err := analyze(ctx, local{binary: binary}, string(schema), string(fixture), queries) + if err != nil { + return nil, err + } + return analysis.Encode(out) +} + +// Check compares what ClickHouse reports for a case with the output the +// case committed, returning a diff when they differ. +func Check(ctx context.Context, binary string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, binary, c) + if err != nil { + return "", err + } + return c.Compare(got) +} diff --git a/internal/goldeneye/clickhouse/clickhouse.go b/internal/goldeneye/clickhouse/clickhouse.go new file mode 100644 index 0000000000..35bfb7c17a --- /dev/null +++ b/internal/goldeneye/clickhouse/clickhouse.go @@ -0,0 +1,146 @@ +// Package clickhouse generates the ClickHouse dialect seed under +// internal/engine/clickhouse/dialect from a clickhouse binary, run as an +// ephemeral `clickhouse local` process that needs no server. +// +// types.jsonl comes from system.data_type_families: every family that is not +// an alias becomes a type, the families that alias it become its aliases, +// and its category is decided by its name, since ClickHouse records no such +// thing. ClickHouse describes its functions no further than their names — +// system.functions carries no signatures — so functions.jsonl is written by +// hand and is not this package's business. +// +// The package also verifies the ClickHouse analyze cases under +// internal/endtoend/testdata against the same binary: each case's schema and +// fixture are loaded into a `clickhouse local` process and its queries run +// there. Result column types come from the executed query's result header, +// provenance from EXPLAIN QUERY TREE, and parameters from sentinel constants +// substituted for the placeholders, since ClickHouse itself never sees a ?. +// The answer is printed in the JSON shape sqlc analyze prints and compared +// with the case's committed stdout.json byte for byte. +// +// The binary is downloaded once per pinned version by Install, or supplied +// through the CLICKHOUSE environment variable. +package clickhouse + +import ( + "context" + "encoding/json" + "fmt" + "os/exec" + "sort" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name of the engine directory the dialect lives under. +const Engine = "clickhouse" + +// typeFamilies lists every data type ClickHouse knows and, for a spelling +// such as INT or VARCHAR, the type it stands for. +const typeFamilies = ` +SELECT name, alias_to +FROM system.data_type_families +ORDER BY name` + +// Version reports the release a binary is. +func Version(ctx context.Context, binary string) (string, error) { + out, err := exec.CommandContext(ctx, binary, "local", "--version").Output() + if err != nil { + return "", fmt.Errorf("clickhouse local --version: %w", err) + } + return strings.TrimSpace(string(out)), nil +} + +// Generate reads the dialect from the binary. +func Generate(ctx context.Context, binary string) (dialect.Files, error) { + results, err := local{binary: binary}.run(ctx, typeFamilies) + if err != nil { + return nil, err + } + if len(results) != 1 { + return nil, fmt.Errorf("clickhouse: expected one result set, got %d", len(results)) + } + var families []family + for _, row := range results[0].Data { + var f family + if err := json.Unmarshal(row["name"], &f.Name); err != nil { + return nil, fmt.Errorf("clickhouse: system.data_type_families: %w", err) + } + if err := json.Unmarshal(row["alias_to"], &f.AliasTo); err != nil { + return nil, fmt.Errorf("clickhouse: system.data_type_families: %w", err) + } + families = append(families, f) + } + types, err := dialect.JSONL(readTypes(families)) + if err != nil { + return nil, err + } + return dialect.Files{dialect.TypesFile: types}, nil +} + +type family struct { + Name string + AliasTo string +} + +// readTypes turns the families into types: one per family that is not an +// alias, carrying the spellings that alias it. The seed reads names without +// regard to case, so an alias that only differs in case from its type — +// bool for Bool, ENUM for Enum — is dropped. +func readTypes(families []family) []dialect.Type { + byName := map[string]*dialect.Type{} + var names []string + for _, f := range families { + if f.AliasTo != "" { + continue + } + byName[f.Name] = &dialect.Type{Name: f.Name, Category: category(f.Name)} + names = append(names, f.Name) + } + for _, f := range families { + if f.AliasTo == "" || strings.EqualFold(f.Name, f.AliasTo) { + continue + } + if t, ok := byName[f.AliasTo]; ok { + t.Aliases = append(t.Aliases, f.Name) + } + } + sort.Strings(names) + types := make([]dialect.Type, 0, len(names)) + for _, name := range names { + types = append(types, *byName[name]) + } + return types +} + +// category assigns a type the PostgreSQL category letter the seed package +// uses, by the family's name: N for numbers, B for booleans, S for strings +// and the identifiers stored as them, D for dates and times, T for time +// spans, A for arrays and U for everything else. +func category(name string) string { + switch { + case name == "Bool": + return "B" + case name == "Array": + return "A" + case strings.HasPrefix(name, "Interval"): + return "T" + case hasPrefix(name, "UInt", "Int", "Float", "BFloat", "Decimal"): + return "N" + case name == "String", name == "FixedString", name == "UUID", name == "IPv4", name == "IPv6": + return "S" + case hasPrefix(name, "Date", "Time"): + return "D" + } + return "U" +} + +func hasPrefix(name string, prefixes ...string) bool { + for _, prefix := range prefixes { + if strings.HasPrefix(name, prefix) { + return true + } + } + return false +} diff --git a/internal/goldeneye/clickhouse/clickhouse_test.go b/internal/goldeneye/clickhouse/clickhouse_test.go new file mode 100644 index 0000000000..f4d58b8346 --- /dev/null +++ b/internal/goldeneye/clickhouse/clickhouse_test.go @@ -0,0 +1,66 @@ +package clickhouse + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// TestDialect verifies the committed ClickHouse dialect against what the +// pinned clickhouse binary reports. It skips unless the binary is installed. +func TestDialect(t *testing.T) { + binary, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, binary) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, binary) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Engine) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} + +// TestAnalyzeCases verifies every ClickHouse analyze case under +// internal/endtoend/testdata against what ClickHouse reports. It skips +// unless the binary is installed. +func TestAnalyzeCases(t *testing.T) { + binary, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Engine) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no clickhouse analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), binary, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what ClickHouse reports (-committed +clickhouse):\n%s", c.Output, diff) + } + }) + } +} diff --git a/internal/goldeneye/clickhouse/install.go b/internal/goldeneye/clickhouse/install.go new file mode 100644 index 0000000000..fb29df46a0 --- /dev/null +++ b/internal/goldeneye/clickhouse/install.go @@ -0,0 +1,221 @@ +package clickhouse + +import ( + "archive/tar" + "compress/gzip" + "context" + "crypto/sha512" + "encoding/hex" + "errors" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "strconv" + "strings" +) + +// DefaultVersion is the ClickHouse release the dialect is generated from. +// Bumping it is a deliberate change: the query tree format and type +// inference can shift between releases, so regenerate and review the dialect +// after changing it, and add the new release's assets to the table below. +const DefaultVersion = "25.8.2.29" + +// asset is one downloadable build of ClickHouse. Linux builds are published +// as clickhouse-common-static tarballs holding the binary at +// usr/bin/clickhouse; macOS builds are published as bare binaries. +type asset struct { + Version string + OS string + Arch string + Name string + SHA512 string +} + +// assets lists every build Install knows how to fetch, with the SHA-512 of +// the download. A version that is not in this table cannot be installed: +// verifying the download is the point of the table. +// +// The tarball checksums are the ones in the .sha512 files ClickHouse +// publishes next to them. ClickHouse publishes no checksum for the macOS +// binaries, so those were computed from the downloads. +var assets = []asset{ + {"25.8.2.29", "linux", "amd64", "clickhouse-common-static-25.8.2.29-amd64.tgz", "6ff0aa1ffac6e564970174422ecde0d645cdb96812247a6e544d39cad6d78a514265f90a2bc7b4bad49903cea96eddd16a415a45b2aeaf9164461be76331bdee"}, + {"25.8.2.29", "linux", "arm64", "clickhouse-common-static-25.8.2.29-arm64.tgz", "68204ca4d4e472790f808ee376251fae82e58066a31f35a40d15d442ce5988d697f18a1208d28b8bb8e2dfad4b20b7fcb5107e2178472abcd97251b8de7f058e"}, + {"25.8.2.29", "darwin", "amd64", "clickhouse-macos", "2805805ad2506e37a3e71b4ae9e797bdc010a9368dc28e99bcaaa2c70a72cfdd031c0fce8fc304248fad73211d28d645f75c6432cfae1e1e54d72d04e8626cd4"}, + {"25.8.2.29", "darwin", "arm64", "clickhouse-macos-aarch64", "4c9237e85c8d4e1aced2b339b32e086b4f23fa14f99754b056a7e33dda88c4fb5d52e09e29d20181ec5b580caadb00f36613802e71755ff34927535eb8babf79"}, +} + +// releaseTag returns the GitHub release tag for a version. ClickHouse tags +// its March and August releases as LTS and everything else as stable. +func releaseTag(version string) (string, error) { + parts := strings.Split(version, ".") + if len(parts) != 4 { + return "", fmt.Errorf("invalid ClickHouse version %q: want MAJOR.MINOR.PATCH.BUILD", version) + } + minor, err := strconv.Atoi(parts[1]) + if err != nil { + return "", fmt.Errorf("invalid ClickHouse version %q: %w", version, err) + } + suffix := "-stable" + if minor == 3 || minor == 8 { + suffix = "-lts" + } + return "v" + version + suffix, nil +} + +// releaseAsset finds the build for a platform in the table. +func releaseAsset(version, goos, goarch string) (asset, error) { + for _, a := range assets { + if a.Version == version && a.OS == goos && a.Arch == goarch { + return a, nil + } + } + for _, a := range assets { + if a.Version == version { + return asset{}, fmt.Errorf("no ClickHouse %s build is listed for %s/%s", version, goos, goarch) + } + } + return asset{}, fmt.Errorf("ClickHouse %s is not in the asset table; add its downloads and checksums to install.go", version) +} + +// url is the asset's download address on GitHub. +func (a asset) url() (string, error) { + tag, err := releaseTag(a.Version) + if err != nil { + return "", err + } + return "https://github.com/ClickHouse/ClickHouse/releases/download/" + tag + "/" + a.Name, nil +} + +// tarball reports whether the download is an archive rather than the binary. +func (a asset) tarball() bool { + return strings.HasSuffix(a.Name, ".tgz") +} + +// cachedBinary is where Install puts the binary for a version. +func cachedBinary(version string) (string, error) { + dir, err := os.UserCacheDir() + if err != nil { + return "", err + } + return filepath.Join(dir, "sqlc-clickhouse", version, "clickhouse"), nil +} + +// Locate finds a clickhouse binary: the CLICKHOUSE environment variable wins, +// then the cached copy of DefaultVersion. +func Locate() (string, error) { + if path := os.Getenv("CLICKHOUSE"); path != "" { + return path, nil + } + path, err := cachedBinary(DefaultVersion) + if err != nil { + return "", err + } + if _, err := os.Stat(path); err != nil { + return "", fmt.Errorf("clickhouse %s is not installed: run `go run ./cmd/goldeneye install clickhouse` in internal/goldeneye, or set CLICKHOUSE to a clickhouse binary", DefaultVersion) + } + return path, nil +} + +// Install downloads the clickhouse binary for a version into the cache and +// returns its path. It is a no-op when the version is already cached. The +// download is checked against the table's SHA-512 before it is installed. +func Install(ctx context.Context, version, goos, goarch string, progress io.Writer) (string, error) { + dest, err := cachedBinary(version) + if err != nil { + return "", err + } + if _, err := os.Stat(dest); err == nil { + return dest, nil + } + a, err := releaseAsset(version, goos, goarch) + if err != nil { + return "", err + } + url, err := a.url() + if err != nil { + return "", err + } + if err := os.MkdirAll(filepath.Dir(dest), 0o755); err != nil { + return "", err + } + + fmt.Fprintf(progress, "downloading %s\n", url) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) + if err != nil { + return "", err + } + resp, err := http.DefaultClient.Do(req) + if err != nil { + return "", err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("downloading %s: %s", url, resp.Status) + } + + // Write next to the destination and rename so a partial or corrupt + // download never masquerades as an installed binary. + tmp, err := os.CreateTemp(filepath.Dir(dest), "clickhouse-*.partial") + if err != nil { + return "", err + } + defer os.Remove(tmp.Name()) + + // Hash every byte that comes off the wire, including the parts of a + // tarball after the binary, which extraction would otherwise not read. + sum := sha512.New() + body := io.TeeReader(resp.Body, sum) + var src io.Reader = body + if a.tarball() { + src, err = binaryInTarball(body) + if err != nil { + return "", fmt.Errorf("downloading %s: %w", url, err) + } + } + if _, err := io.Copy(tmp, src); err != nil { + tmp.Close() + return "", err + } + if _, err := io.Copy(io.Discard, body); err != nil { + tmp.Close() + return "", err + } + if err := tmp.Close(); err != nil { + return "", err + } + if got := hex.EncodeToString(sum.Sum(nil)); got != a.SHA512 { + return "", fmt.Errorf("downloading %s: SHA-512 mismatch: got %s, want %s", url, got, a.SHA512) + } + if err := os.Chmod(tmp.Name(), 0o755); err != nil { + return "", err + } + if err := os.Rename(tmp.Name(), dest); err != nil { + return "", err + } + return dest, nil +} + +// binaryInTarball positions a reader at the clickhouse binary inside a +// clickhouse-common-static tarball. +func binaryInTarball(r io.Reader) (io.Reader, error) { + gz, err := gzip.NewReader(r) + if err != nil { + return nil, err + } + tr := tar.NewReader(gz) + for { + hdr, err := tr.Next() + if errors.Is(err, io.EOF) { + return nil, errors.New("tarball does not contain usr/bin/clickhouse") + } + if err != nil { + return nil, err + } + if hdr.Typeflag == tar.TypeReg && strings.HasSuffix(hdr.Name, "/usr/bin/clickhouse") { + return tr, nil + } + } +} diff --git a/internal/goldeneye/clickhouse/local.go b/internal/goldeneye/clickhouse/local.go new file mode 100644 index 0000000000..2a6d88247c --- /dev/null +++ b/internal/goldeneye/clickhouse/local.go @@ -0,0 +1,82 @@ +package clickhouse + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "strings" +) + +// local runs SQL through an ephemeral `clickhouse local` process. +type local struct { + binary string +} + +// resultSet is one JSON-format result printed by clickhouse local. Only +// statements that return rows print one; DDL and INSERT print nothing. +type resultSet struct { + Meta []resultColumn `json:"meta"` + Data []map[string]json.RawMessage `json:"data"` + Rows int `json:"rows"` +} + +type resultColumn struct { + Name string `json:"name"` + Type string `json:"type"` +} + +// run executes a multi-statement script in a fresh process with fresh +// storage and returns the result sets in statement order. Any statement +// failing fails the whole run with ClickHouse's own error message. +func (l local) run(ctx context.Context, script string) ([]resultSet, error) { + dir, err := os.MkdirTemp("", "sqlc-goldeneye-clickhouse-*") + if err != nil { + return nil, err + } + defer os.RemoveAll(dir) + + queries := filepath.Join(dir, "queries.sql") + if err := os.WriteFile(queries, []byte(script), 0o600); err != nil { + return nil, err + } + + // stdin must not be inherited: clickhouse local reads it as table data + // and blocks until it is closed. + cmd := exec.CommandContext(ctx, l.binary, "local", + "--multiquery", + "--queries-file", queries, + "--output-format", "JSON", + "--path", filepath.Join(dir, "data"), + ) + cmd.Stdin = nil + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + msg := strings.TrimSpace(stderr.String()) + if msg == "" { + msg = err.Error() + } + return nil, errors.New(msg) + } + + var results []resultSet + dec := json.NewDecoder(&stdout) + for { + var rs resultSet + err := dec.Decode(&rs) + if errors.Is(err, io.EOF) { + return results, nil + } + if err != nil { + return nil, fmt.Errorf("decoding clickhouse local output: %w", err) + } + results = append(results, rs) + } +} diff --git a/internal/goldeneye/clickhouse/queries.go b/internal/goldeneye/clickhouse/queries.go new file mode 100644 index 0000000000..a9f77877b7 --- /dev/null +++ b/internal/goldeneye/clickhouse/queries.go @@ -0,0 +1,68 @@ +package clickhouse + +import ( + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// placeholder is one parameter reference in a query, in order of appearance. +type placeholder struct { + Number int + Name string // sqlc.arg / sqlc.narg name, empty for ? +} + +// Placeholders are substituted with constant expressions that carry their +// ordinal, so they can be told apart from each other and from literal NULLs +// once ClickHouse has folded them: the query tree prints the expression a +// folded constant came from. NULL coerces to any type, so a comparison +// against it analyzes with the other operand's type. LIMIT and OFFSET +// reject NULL and only accept unsigned integers, so those get a value no +// query would plausibly contain. +const limitBase = "4294967295" + +func sentinelFor(lastWord string, ordinal int) string { + switch strings.ToLower(lastWord) { + case "limit", "offset": + return fmt.Sprintf("toUInt64(%s + %d)", limitBase, ordinal) + } + return fmt.Sprintf("(NULL + %d)", ordinal) +} + +// bindPlaceholders rewrites sqlc's parameter syntax (?, sqlc.arg(name), +// sqlc.narg(name)) into constants ClickHouse can analyze. ClickHouse binds +// every ? positionally, so each placeholder is its own parameter even when +// a name repeats, which is how sqlc numbers them too. +func bindPlaceholders(sql string) (string, []placeholder) { + var phs []placeholder + out := endtoend.Rewrite(sql, func(name, lastWord string) string { + phs = append(phs, placeholder{Number: len(phs) + 1, Name: name}) + return sentinelFor(lastWord, len(phs)) + }) + return out, phs +} + +func isWordByte(c byte) bool { + return c == '_' || c == '.' || c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' +} + +// skipQuoted returns the index just past the quoted token starting at i, +// honouring backslash escapes and doubled quotes. +func skipQuoted(s string, i int) int { + q := s[i] + j := i + 1 + for j < len(s) { + switch { + case s[j] == '\\' && j+1 < len(s): + j += 2 + case s[j] == q && j+1 < len(s) && s[j+1] == q: + j += 2 + case s[j] == q: + return j + 1 + default: + j++ + } + } + return len(s) +} diff --git a/internal/goldeneye/clickhouse/tree.go b/internal/goldeneye/clickhouse/tree.go new file mode 100644 index 0000000000..d0a8a38924 --- /dev/null +++ b/internal/goldeneye/clickhouse/tree.go @@ -0,0 +1,236 @@ +package clickhouse + +import ( + "fmt" + "regexp" + "strconv" + "strings" +) + +// treeNode is one line of EXPLAIN QUERY TREE output. Lines of the form +// `KIND id: N, key: value, ...` are nodes with a kind and attributes; every +// other line (section headers such as PROJECTION or ARGUMENTS, and the +// `name Type` lines under PROJECTION COLUMNS) keeps only its text. +type treeNode struct { + kind string + id int + attrs map[string]string + text string + parent *treeNode + children []*treeNode +} + +// queryTree is a parsed EXPLAIN QUERY TREE dump. +type queryTree struct { + root *treeNode + byID map[int]*treeNode +} + +var nodeLineRe = regexp.MustCompile(`^([A-Z_]+) id: (\d+)(?:, (.*))?$`) + +// parseQueryTree builds the tree from the dump's lines, using the two-space +// indentation to recover nesting. +func parseQueryTree(lines []string) (*queryTree, error) { + root := &treeNode{id: -1, text: ""} + t := &queryTree{root: root, byID: map[int]*treeNode{}} + stack := []*treeNode{root} + for _, line := range lines { + if strings.TrimSpace(line) == "" { + continue + } + indent := len(line) - len(strings.TrimLeft(line, " ")) + if indent%2 != 0 { + return nil, fmt.Errorf("query tree: unexpected indentation in %q", line) + } + depth := indent/2 + 1 + if depth > len(stack) { + return nil, fmt.Errorf("query tree: line %q is nested too deeply", line) + } + stack = stack[:depth] + parent := stack[len(stack)-1] + + n := &treeNode{id: -1, text: line[indent:], parent: parent} + if m := nodeLineRe.FindStringSubmatch(n.text); m != nil { + n.kind = m[1] + n.id, _ = strconv.Atoi(m[2]) + n.attrs = parseAttrs(m[3]) + t.byID[n.id] = n + } + parent.children = append(parent.children, n) + stack = append(stack, n) + } + return t, nil +} + +var attrKeyRe = regexp.MustCompile(`^, ([a-z_]+): `) + +// parseAttrs splits `key: value, key: value` where values may themselves +// contain commas inside parentheses or quotes, as types and constants do. +func parseAttrs(s string) map[string]string { + attrs := map[string]string{} + if s == "" { + return attrs + } + // Positions at which a new `, key: ` begins at top level. + var cuts []int + depth := 0 + inQuote := false + for i := 0; i < len(s); i++ { + switch c := s[i]; { + case c == '\'': + inQuote = !inQuote + case inQuote: + case c == '(': + depth++ + case c == ')': + depth-- + case c == ',' && depth == 0 && attrKeyRe.MatchString(s[i:]): + cuts = append(cuts, i) + } + } + cuts = append(cuts, len(s)) + start := 0 + for _, cut := range cuts { + pair := s[start:cut] + if key, value, ok := strings.Cut(pair, ": "); ok { + attrs[key] = value + } + start = cut + 2 + } + return attrs +} + +// section returns the child section header of a node, such as PROJECTION +// or JOIN TREE, or nil. +func (n *treeNode) section(name string) *treeNode { + for _, c := range n.children { + if c.kind == "" && c.text == name { + return c + } + } + return nil +} + +// list returns the nodes of the LIST under a section header. +func (n *treeNode) list() []*treeNode { + if n == nil { + return nil + } + for _, c := range n.children { + if c.kind == "LIST" { + return c.children + } + } + return nil +} + +// firstQuery returns the QUERY node describing a result set: the node itself +// or, for a UNION, its first branch, whose projection names the union's +// columns. +func firstQuery(n *treeNode) *treeNode { + for depth := 0; n != nil && depth < 32; depth++ { + switch n.kind { + case "QUERY": + return n + case "UNION": + n = firstNode(n.section("QUERIES").list()) + default: + return nil + } + } + return nil +} + +func firstNode(nodes []*treeNode) *treeNode { + if len(nodes) == 0 { + return nil + } + return nodes[0] +} + +// projection returns the output column names of a query and the expression +// node producing each, in order. +func projection(q *treeNode) (names []string, nodes []*treeNode) { + q = firstQuery(q) + if q == nil { + return nil, nil + } + if cols := q.section("PROJECTION COLUMNS"); cols != nil { + for _, c := range cols.children { + names = append(names, projectedName(c.text)) + } + } + return names, q.section("PROJECTION").list() +} + +// projectedName strips the trailing type from a `name Type` line. The type +// is a single token that may carry a parenthesised argument list; the name +// may contain spaces of its own, as `plus(id, 1)` does. +func projectedName(line string) string { + end := len(line) + if strings.HasSuffix(line, ")") { + depth := 0 + for end > 0 { + end-- + if line[end] == ')' { + depth++ + } else if line[end] == '(' { + depth-- + if depth == 0 { + break + } + } + } + } + for end > 0 && isWordByte(line[end-1]) { + end-- + } + return strings.TrimSpace(line[:end]) +} + +// sourceTable resolves a COLUMN node to the table it reads from, following +// column references through subqueries and CTEs. Columns computed by an +// expression have no source and yield "". +func (t *queryTree) sourceTable(col *treeNode) string { + for depth := 0; col != nil && col.kind == "COLUMN" && depth < 32; depth++ { + id, err := strconv.Atoi(col.attrs["source_id"]) + if err != nil { + return "" + } + src := t.byID[id] + if src == nil { + return "" + } + switch src.kind { + case "TABLE": + name := src.attrs["table_name"] + if i := strings.LastIndexByte(name, '.'); i >= 0 { + name = name[i+1:] + } + return name + case "QUERY", "UNION": + // The column is one of the subquery's output columns; keep + // following whatever expression produces it there. + want := col.attrs["column_name"] + names, nodes := projection(src) + col = nil + for i, name := range names { + if name == want && i < len(nodes) { + col = nodes[i] + break + } + } + default: + return "" + } + } + return "" +} + +// childrenOrNil returns a node's children, tolerating a nil node. +func (n *treeNode) childrenOrNil() []*treeNode { + if n == nil { + return nil + } + return n.children +} diff --git a/internal/goldeneye/clickhouse/types.go b/internal/goldeneye/clickhouse/types.go new file mode 100644 index 0000000000..96de5124f3 --- /dev/null +++ b/internal/goldeneye/clickhouse/types.go @@ -0,0 +1,160 @@ +package clickhouse + +import ( + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" +) + +// A type is a call expression, the way ClickHouse itself models one: a +// lowercased name applied to an ordered argument list. Each argument is +// another type, an integer, a boolean or a quoted string, optionally +// labelled, so Array, Map and LowCardinality are ordinary names and nothing +// about a nested type is lost. Nullability is an attribute of a type rather +// than a wrapper, since every engine has it and only ClickHouse spells it as +// a type: Nullable(T) becomes T with nullable set, at whatever depth it +// appears. The shape maps one to one onto a protobuf message with a oneof +// for the argument value: +// +// Map(String, Nullable(UInt32)) +// {"name": "map", "args": [ +// {"type": {"name": "string"}}, +// {"type": {"name": "uint32", "nullable": true}}]} +// +// Tuple(lat Float64, lon Float64) +// {"name": "tuple", "args": [ +// {"label": "lat", "type": {"name": "float64"}}, +// {"label": "lon", "type": {"name": "float64"}}]} +// +// Enum8('a' = 1, 'b' = 2) +// {"name": "enum8", "args": [{"label": "a", "int": 1}, {"label": "b", "int": 2}]} +// +// DateTime64(3, 'UTC') +// {"name": "datetime64", "args": [{"int": 3}, {"string": "UTC"}]} +// +// An identifier argument such as the function in AggregateFunction(uniq, +// String) is a word rather than a type. Resolving names against the +// catalog is the reader's job; the output only records what was said. + +// parseType turns a ClickHouse type string into its expression. +func parseType(t string) *analysis.TypeExpr { + name, args := splitType(t) + name = strings.ToLower(strings.TrimSpace(name)) + if name == "nullable" && len(args) == 1 { + expr := parseType(args[0]) + expr.Nullable = true + return expr + } + if name == "" { + name = "nothing" + } + expr := &analysis.TypeExpr{Name: name} + for _, a := range args { + expr.Args = append(expr.Args, parseArg(a)) + } + // LowCardinality(Nullable(T)) is the only order ClickHouse accepts for + // a nullable low-cardinality column, and the nullability is the + // column's: it reads as a nullable LowCardinality(T). + if name == "lowcardinality" && len(expr.Args) == 1 && expr.Args[0].Type != nil && expr.Args[0].Type.Nullable { + expr.Nullable = true + expr.Args[0].Type.Nullable = false + } + // The function an aggregate-function type names is a word, not a type. + if name == "aggregatefunction" || name == "simpleaggregatefunction" { + if len(expr.Args) > 0 && expr.Args[0].Type != nil && len(expr.Args[0].Type.Args) == 0 { + fn := expr.Args[0].Type.Name + expr.Args[0] = analysis.TypeArg{Ident: &fn} + } + } + return expr +} + +// parseArg parses one argument: a quoted string, an integer, a boolean, a +// labelled argument (`lat Float64` in a Tuple, `'a' = 1` in an Enum), or a +// type. +func parseArg(a string) analysis.TypeArg { + a = strings.TrimSpace(a) + if strings.HasPrefix(a, "'") { + end := skipQuoted(a, 0) + lit := unquote(a[1 : end-1]) + if rest := strings.TrimSpace(a[end:]); strings.HasPrefix(rest, "=") { + arg := parseArg(rest[1:]) + arg.Label = lit + return arg + } + return analysis.TypeArg{String: &lit} + } + if n, err := strconv.ParseInt(a, 10, 64); err == nil { + return analysis.TypeArg{Int: &n} + } + switch strings.ToLower(a) { + case "true", "false": + b := strings.EqualFold(a, "true") + return analysis.TypeArg{Bool: &b} + } + if i := labelEnd(a); i > 0 { + arg := parseArg(a[i+1:]) + arg.Label = a[:i] + return arg + } + return analysis.TypeArg{Type: parseType(a)} +} + +// labelEnd returns the index of the space separating a label from the type +// it labels, or -1 when the argument has no label: a space that comes before +// any parenthesis, as in `lat Float64` or `tags Array(String)`. +func labelEnd(a string) int { + head := a + if p := strings.IndexByte(a, '('); p >= 0 { + head = a[:p] + } + return strings.IndexByte(head, ' ') +} + +// unquote undoes the escaping inside a single-quoted ClickHouse literal. +func unquote(s string) string { + s = strings.ReplaceAll(s, `\'`, `'`) + s = strings.ReplaceAll(s, `''`, `'`) + return strings.ReplaceAll(s, `\\`, `\`) +} + +// splitType splits `Base(arg, arg)` into its base name and top-level +// arguments, leaving nested parentheses and quoted strings intact. +func splitType(t string) (string, []string) { + t = strings.TrimSpace(t) + open := strings.IndexByte(t, '(') + if open < 0 || !strings.HasSuffix(t, ")") { + return t, nil + } + base := strings.TrimSpace(t[:open]) + inner := t[open+1 : len(t)-1] + var ( + args []string + depth int + quote byte + start int + ) + for i := 0; i < len(inner); i++ { + c := inner[i] + switch { + case quote != 0: + if c == '\\' { + i++ + } else if c == quote { + quote = 0 + } + case c == '\'' || c == '"' || c == '`': + quote = c + case c == '(': + depth++ + case c == ')': + depth-- + case c == ',' && depth == 0: + args = append(args, strings.TrimSpace(inner[start:i])) + start = i + 1 + } + } + args = append(args, strings.TrimSpace(inner[start:])) + return base, args +} diff --git a/internal/goldeneye/cmd/goldeneye/main.go b/internal/goldeneye/cmd/goldeneye/main.go new file mode 100644 index 0000000000..2eb6f80309 --- /dev/null +++ b/internal/goldeneye/cmd/goldeneye/main.go @@ -0,0 +1,277 @@ +// Command goldeneye generates the dialect seeds under +// internal/engine//dialect from a live database, checks the +// committed ones against it, and checks the analyze cases under +// internal/endtoend/testdata against what the database itself reports. +// +// Usage, from internal/goldeneye: +// +// go run ./cmd/goldeneye install clickhouse # download the pinned clickhouse binary +// go run ./cmd/goldeneye install duckdb # download the current DuckDB 2.0 preview build +// go run ./cmd/goldeneye install sqlite # build the pinned sqlite3 shells from source +// go run ./cmd/goldeneye generate [engine] # rewrite the generated files from the database +// go run ./cmd/goldeneye check [engine] # compare the committed files and analyze cases with the database +// +// Without an engine, generate and check cover every engine whose database +// is available and say which ones they skipped. `go test ./...` runs the +// same checks as tests. +package main + +import ( + "context" + "errors" + "flag" + "fmt" + "io" + "os" + "runtime" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/clickhouse" + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/duckdb" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" + "github.com/sqlc-dev/sqlc/internal/goldeneye/mssql" + "github.com/sqlc-dev/sqlc/internal/goldeneye/mysql" + "github.com/sqlc-dev/sqlc/internal/goldeneye/postgresql" + "github.com/sqlc-dev/sqlc/internal/goldeneye/spanner" + "github.com/sqlc-dev/sqlc/internal/goldeneye/sqlite" +) + +func main() { + if err := run(context.Background(), os.Args[1:], os.Stdout, os.Stderr); err != nil { + fmt.Fprintln(os.Stderr, "goldeneye:", err) + os.Exit(1) + } +} + +const usage = `usage: + goldeneye install clickhouse|duckdb|sqlite [-version V] + put the pinned release of an engine into the user cache directory: clickhouse is + downloaded, duckdb is downloaded from its v2.0 preview channel, sqlite is built from + the downloaded amalgamation with cc or $CC + goldeneye generate [engine] + rewrite the generated dialect files from the database, for every available engine or one + goldeneye check [engine] + compare the committed dialect files and analyze cases with the database, for every available engine or one + postgresql, mysql, mssql and spanner read the server POSTGRESQL_SERVER_URI, MYSQL_SERVER_URI, + MSSQL_SERVER_URI and SPANNER_SERVER_URI name + +engines: clickhouse, duckdb, mssql, mysql, postgresql, spanner, sqlite` + +// engine is one database goldeneye knows how to read a dialect from. +type engine struct { + name string + // dir is the engine directory the dialect lives under, when it is not + // named after the engine: MySQL's is dolphin, after its parser, and + // Spanner's is googlesql, after the language. + dir string + // cases is the name of the analyze case directories under + // internal/endtoend/testdata, when it is not the engine's name: + // Spanner's are googlesql's. + cases string + // locate finds the database — a binary or a connection URL — or says + // why it is not available. + locate func() (string, error) + // version describes the release the database is, for the log. + version func(context.Context, string) (string, error) + // generate reads the dialect from the database. + generate func(context.Context, string) (dialect.Files, error) + // analyze asks the database what it reports for an analyze case, in + // the shape sqlc analyze prints. Nil for an engine without one yet. + analyze func(context.Context, string, endtoend.Case) ([]byte, error) +} + +var engines = []engine{ + {clickhouse.Engine, "", "", clickhouse.Locate, clickhouse.Version, clickhouse.Generate, clickhouse.Analyze}, + {duckdb.Engine, "", "", duckdb.Locate, duckdb.Version, duckdb.Generate, duckdb.Analyze}, + {mssql.Engine, "", "", mssql.Locate, mssql.Version, mssql.Generate, mssql.Analyze}, + {mysql.Engine, mysql.Dir, "", mysql.Locate, mysql.Version, mysql.Generate, mysql.Analyze}, + {postgresql.Engine, "", "", postgresql.Locate, postgresql.Version, postgresql.Generate, nil}, + {spanner.Engine, spanner.Dir, spanner.Cases, spanner.Locate, spanner.Version, spanner.Generate, spanner.Analyze}, + {sqlite.Engine, "", "", sqlite.Locate, sqlite.Version, sqlite.Generate, sqlite.Analyze}, +} + +// dialectDir returns the engine's dialect directory. +func (e engine) dialectDir() (string, error) { + if e.dir != "" { + return dialect.Dir(e.dir) + } + return dialect.Dir(e.name) +} + +// installer puts the binary an engine is read through in place, for the +// engines that need no server and whose release is pinned in their package. +type installer struct { + defaultVersion string + install func(ctx context.Context, version, goos, goarch string, progress io.Writer) (string, error) +} + +var installers = map[string]installer{ + clickhouse.Engine: {clickhouse.DefaultVersion, clickhouse.Install}, + duckdb.Engine: {duckdb.DefaultVersion, duckdb.Install}, + sqlite.Engine: {sqlite.DefaultVersion, sqlite.Install}, +} + +func run(ctx context.Context, args []string, stdout, stderr io.Writer) error { + if len(args) == 0 { + fmt.Fprintln(stderr, usage) + return errors.New("a command is required") + } + switch args[0] { + case "install": + return install(ctx, args[1:], stdout, stderr) + case "generate": + return forEach(ctx, args[1:], stderr, generate) + case "check": + return forEach(ctx, args[1:], stderr, check) + case "help", "-h", "--help": + fmt.Fprintln(stdout, usage) + return nil + } + fmt.Fprintln(stderr, usage) + return fmt.Errorf("unknown command %q", args[0]) +} + +func install(ctx context.Context, args []string, stdout, stderr io.Writer) error { + if len(args) == 0 { + return errors.New("install takes the engine to install: clickhouse, duckdb or sqlite") + } + inst, ok := installers[args[0]] + if !ok { + return fmt.Errorf("install takes the engine to install, clickhouse, duckdb or sqlite, not %q", args[0]) + } + fs := flag.NewFlagSet("install "+args[0], flag.ContinueOnError) + fs.SetOutput(stderr) + version := fs.String("version", inst.defaultVersion, args[0]+" release to install") + if err := fs.Parse(args[1:]); err != nil { + return err + } + path, err := inst.install(ctx, *version, runtime.GOOS, runtime.GOARCH, stderr) + if err != nil { + return err + } + fmt.Fprintln(stdout, path) + return nil +} + +// forEach runs a command over the named engine, or over every engine that +// is available when none is named. An engine that is named has to be +// available; one that is not named is skipped with a note when it is not. +func forEach(ctx context.Context, args []string, stderr io.Writer, cmd func(context.Context, engine, string, io.Writer) error) error { + if len(args) > 1 { + return errors.New("at most one engine may be named") + } + name := "" + if len(args) == 1 { + name = args[0] + } + found := false + var failed []string + for _, e := range engines { + if name != "" && e.name != name { + continue + } + found = true + handle, err := e.locate() + if err != nil { + if name != "" { + return err + } + fmt.Fprintf(stderr, "skipping %s: %v\n", e.name, err) + continue + } + if err := cmd(ctx, e, handle, stderr); err != nil { + fmt.Fprintf(stderr, "%s: %v\n", e.name, err) + failed = append(failed, e.name) + } + } + if !found { + return fmt.Errorf("unknown engine %q", name) + } + if len(failed) > 0 { + return fmt.Errorf("%d engine(s) failed: %v", len(failed), failed) + } + return nil +} + +func generate(ctx context.Context, e engine, handle string, stderr io.Writer) error { + version, err := e.version(ctx, handle) + if err != nil { + return err + } + fmt.Fprintf(stderr, "%s: generating from %s\n", e.name, version) + files, err := e.generate(ctx, handle) + if err != nil { + return err + } + dir, err := e.dialectDir() + if err != nil { + return err + } + if err := dialect.Write(dir, files); err != nil { + return err + } + fmt.Fprintf(stderr, "%s: wrote %d file(s) to %s\n", e.name, len(files), dir) + return nil +} + +func check(ctx context.Context, e engine, handle string, stderr io.Writer) error { + version, err := e.version(ctx, handle) + if err != nil { + return err + } + fmt.Fprintf(stderr, "%s: checking against %s\n", e.name, version) + files, err := e.generate(ctx, handle) + if err != nil { + return err + } + dir, err := e.dialectDir() + if err != nil { + return err + } + report, err := dialect.Check(dir, files) + if err != nil { + return err + } + if report != "" { + return fmt.Errorf("%s does not match the database\n%s", dir, report) + } + fmt.Fprintf(stderr, "%s: ok, %d file(s) match\n", e.name, len(files)) + return checkAnalyzeCases(ctx, e, handle, stderr) +} + +// checkAnalyzeCases compares what the database reports for each of the +// engine's analyze cases with the case's committed output. +func checkAnalyzeCases(ctx context.Context, e engine, handle string, stderr io.Writer) error { + if e.analyze == nil { + return nil + } + name := e.cases + if name == "" { + name = e.name + } + cases, err := endtoend.Cases(name) + if err != nil { + return err + } + var report strings.Builder + for _, c := range cases { + got, err := e.analyze(ctx, handle, c) + if err != nil { + fmt.Fprintf(&report, "%s: %v\n", c.Name, err) + continue + } + diff, err := c.Compare(got) + if err != nil { + return err + } + if diff != "" { + fmt.Fprintf(&report, "%s (-committed +database)\n%s", c.Name, diff) + } + } + if report.Len() > 0 { + return fmt.Errorf("analyze cases do not match the database\n%s", report.String()) + } + fmt.Fprintf(stderr, "%s: ok, %d analyze case(s) match\n", e.name, len(cases)) + return nil +} diff --git a/internal/goldeneye/dialect/dialect.go b/internal/goldeneye/dialect/dialect.go new file mode 100644 index 0000000000..59a530cd47 --- /dev/null +++ b/internal/goldeneye/dialect/dialect.go @@ -0,0 +1,308 @@ +// Package dialect describes the files a dialect seed is made of — the JSONL +// records under internal/engine//dialect that give an engine its +// type system and standard library — and provides what a generator needs to +// write them and a check needs to compare them with what is committed. +// +// The record types mirror the ones in internal/core/seed, which reads the +// files. They are repeated here rather than imported so that this module +// never shares code with the analysis it checks: the files are the contract, +// and a change to their shape has to be made on both sides. +package dialect + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "os" + "path/filepath" + "runtime" + "sort" + "strings" +) + +// The files a dialect directory is made of. +const ( + SettingsFile = "dialect.json" + TypesFile = "types.jsonl" + OperatorsFile = "operators.jsonl" + CastsFile = "casts.jsonl" + FunctionsFile = "functions.jsonl" + RelationsFile = "relations.jsonl" +) + +// ExtensionsDir is the directory under a dialect holding one directory per +// extension the dialect knows, each a smaller bundle of the same files. +const ExtensionsDir = "extensions" + +// Type is a type the dialect defines. Aliases are spellings of the same type +// that a schema may use in a column definition. Base names the type this +// one stands on, which is listed before it. +type Type struct { + Name string `json:"name"` + Category string `json:"category"` + Aliases []string `json:"aliases,omitempty"` + Base string `json:"base,omitempty"` +} + +// Operator is a single operator overload. +type Operator struct { + Name string `json:"name"` + Left string `json:"left"` + Right string `json:"right"` + Result string `json:"result"` +} + +// Cast is a single cast between two types. Context is 'i'mplicit, +// 'a'ssignment or 'e'xplicit. +type Cast struct { + Source string `json:"source"` + Target string `json:"target"` + Context string `json:"context,omitempty"` +} + +// Function is a function the dialect ships with. Kind is 'f'unction, +// 'a'ggregate, 'w'indow or 'p'rocedure. +type Function struct { + Name string `json:"name"` + Kind string `json:"kind,omitempty"` + Args []Arg `json:"args,omitempty"` + Returns string `json:"returns"` + Nullable bool `json:"nullable,omitempty"` + // NeverNull marks a result that is never NULL even when an argument + // is, in a dialect that propagates nullability. + NeverNull bool `json:"never_null,omitempty"` +} + +// Arg is one of a function's parameters. Mode is 'i'n, 'o'ut, 'b'oth, +// 't'able or 'v'ariadic, and defaults to in. +type Arg struct { + Name string `json:"name,omitempty"` + Type string `json:"type"` + Mode string `json:"mode,omitempty"` + HasDefault bool `json:"has_default,omitempty"` +} + +// Relation is a table or view the dialect ships with, such as one of +// PostgreSQL's system catalogs. Kind is 'r' for a table or 'v' for a view, +// and defaults to a table. +type Relation struct { + Catalog string `json:"catalog,omitempty"` + Schema string `json:"schema"` + Name string `json:"name"` + Kind string `json:"kind,omitempty"` + Columns []Column `json:"columns"` +} + +// Column is one of a relation's columns. +type Column struct { + Name string `json:"name"` + Type string `json:"type"` + NotNull bool `json:"not_null,omitempty"` + Array bool `json:"array,omitempty"` + Length int `json:"length,omitempty"` +} + +// Files is what a generator produces: the content of each file it writes, +// keyed by slash-separated path relative to the dialect directory, such as +// "functions.jsonl" or "extensions/hstore/types.jsonl". A generator owns +// only the files it produces; the rest of a dialect, dialect.json above all, +// is written by hand and is neither generated nor checked. +type Files map[string][]byte + +// JSONL encodes records one per line, the way the committed files are +// written: encoding/json's compact form, with a newline after each record. +func JSONL[T any](records []T) ([]byte, error) { + var buf bytes.Buffer + enc := json.NewEncoder(&buf) + for _, record := range records { + if err := enc.Encode(record); err != nil { + return nil, err + } + } + return buf.Bytes(), nil +} + +// ReadTypes reads the hand-written types.jsonl of a dialect directory, for +// a generator that writes a function once per spelling of a type. +func ReadTypes(dir string) ([]Type, error) { + blob, err := os.ReadFile(filepath.Join(dir, TypesFile)) + if err != nil { + return nil, err + } + var types []Type + dec := json.NewDecoder(bytes.NewReader(blob)) + for dec.More() { + var t Type + if err := dec.Decode(&t); err != nil { + return nil, fmt.Errorf("%s: %w", filepath.Join(dir, TypesFile), err) + } + types = append(types, t) + } + return types, nil +} + +// Dir returns the dialect directory of an engine, +// internal/engine//dialect, found relative to this source file so +// the working directory does not matter. +func Dir(engine string) (string, error) { + _, file, _, ok := runtime.Caller(0) + if !ok { + return "", errors.New("cannot locate the goldeneye source directory") + } + dir := filepath.Join(filepath.Dir(file), "..", "..", "engine", engine, "dialect") + if _, err := os.Stat(dir); err != nil { + return "", err + } + return filepath.Clean(dir), nil +} + +// Names lists the files in name order, so that a run is reported and +// written the same way every time. +func (f Files) Names() []string { + names := make([]string, 0, len(f)) + for name := range f { + names = append(names, name) + } + sort.Strings(names) + return names +} + +// Write writes the files into dir, creating extension directories as +// needed. Files the generator did not produce are left alone. +func Write(dir string, files Files) error { + for _, name := range files.Names() { + path := filepath.Join(dir, filepath.FromSlash(name)) + if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { + return err + } + if err := os.WriteFile(path, files[name], 0o644); err != nil { + return err + } + } + return nil +} + +// Check compares the files with the ones committed in dir and returns a +// report of every file that differs, or "" when each matches byte for byte. +func Check(dir string, files Files) (string, error) { + var report strings.Builder + for _, name := range files.Names() { + want, err := os.ReadFile(filepath.Join(dir, filepath.FromSlash(name))) + if errors.Is(err, os.ErrNotExist) { + fmt.Fprintf(&report, "%s: not committed\n", name) + continue + } + if err != nil { + return "", err + } + if bytes.Equal(want, files[name]) { + continue + } + fmt.Fprintf(&report, "%s (-committed +database)\n%s", name, Diff(string(want), string(files[name]))) + } + return report.String(), nil +} + +// Diff is a line diff of two texts, marking lines only in want with "-" and +// lines only in got with "+", showing two lines of context around each +// change and eliding the rest. The committed files run to thousands of +// lines and usually differ in a handful, so the common head and tail are +// stripped before the longest common subsequence of the middle is found. +func Diff(want, got string) string { + a := lines(want) + b := lines(got) + head := 0 + for head < len(a) && head < len(b) && a[head] == b[head] { + head++ + } + tail := 0 + for tail < len(a)-head && tail < len(b)-head && a[len(a)-1-tail] == b[len(b)-1-tail] { + tail++ + } + var edits []edit + for _, line := range a[:head] { + edits = append(edits, edit{' ', line}) + } + edits = append(edits, lcsEdits(a[head:len(a)-tail], b[head:len(b)-tail])...) + for _, line := range a[len(a)-tail:] { + edits = append(edits, edit{' ', line}) + } + + const context = 2 + show := make([]bool, len(edits)) + for i, e := range edits { + if e.kind == ' ' { + continue + } + for j := max(0, i-context); j <= min(len(edits)-1, i+context); j++ { + show[j] = true + } + } + var out strings.Builder + elided := false + for i, e := range edits { + if !show[i] { + elided = true + continue + } + if elided && out.Len() > 0 { + out.WriteString("...\n") + } + elided = false + fmt.Fprintf(&out, "%c %s\n", e.kind, e.line) + } + return out.String() +} + +type edit struct { + kind byte // ' ', '-' or '+' + line string +} + +func lines(s string) []string { + if s == "" { + return nil + } + return strings.Split(strings.TrimSuffix(s, "\n"), "\n") +} + +// lcsEdits is the edit script between a and b by longest common subsequence. +func lcsEdits(a, b []string) []edit { + lcs := make([][]int, len(a)+1) + for i := range lcs { + lcs[i] = make([]int, len(b)+1) + } + for i := len(a) - 1; i >= 0; i-- { + for j := len(b) - 1; j >= 0; j-- { + if a[i] == b[j] { + lcs[i][j] = lcs[i+1][j+1] + 1 + } else { + lcs[i][j] = max(lcs[i+1][j], lcs[i][j+1]) + } + } + } + var edits []edit + i, j := 0, 0 + for i < len(a) && j < len(b) { + switch { + case a[i] == b[j]: + edits = append(edits, edit{' ', a[i]}) + i++ + j++ + case lcs[i+1][j] >= lcs[i][j+1]: + edits = append(edits, edit{'-', a[i]}) + i++ + default: + edits = append(edits, edit{'+', b[j]}) + j++ + } + } + for ; i < len(a); i++ { + edits = append(edits, edit{'-', a[i]}) + } + for ; j < len(b); j++ { + edits = append(edits, edit{'+', b[j]}) + } + return edits +} diff --git a/internal/goldeneye/duckdb/analyze.go b/internal/goldeneye/duckdb/analyze.go new file mode 100644 index 0000000000..08283aebf5 --- /dev/null +++ b/internal/goldeneye/duckdb/analyze.go @@ -0,0 +1,846 @@ +package duckdb + +import ( + "bytes" + "context" + "encoding/csv" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "os/exec" + "regexp" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// The analyze cases are checked against the DuckDB CLI, which runs each +// case's schema and fixture into an in-memory database of their own, one +// process per question, and is asked four things about each query. What +// its parameters are: the query is prepared and explained, as JSON, with +// a string sentinel bound to each parameter, and the unoptimized logical +// plan the CLI prints first shows each as CAST('goldeneye_k' AS T), T +// being the type the binder gave the parameter, or bare when that type +// is VARCHAR. What its result columns are: +// DESCRIBE, with each parameter replaced by a NULL of that type, names and +// types them. Which column each is read from and which column a parameter +// stands in for: DuckDB prints a plan with every column by its bare name, +// so these are read from the query text, the select list's items and the +// operand beside each parameter resolved against the FROM clause and the +// catalog, from which a column read from a table takes its declared type +// and nullability. And whether an expression can be NULL, which DuckDB +// does not track: the query is run, with each parameter bound to a value +// of its type, over the fixture and over no rows, and a column is nullable +// when either run returns a NULL for it. + +// placeholder is one parameter of a query as sqlc numbers them: a $n by +// its number, and each $name, sqlc.arg name or ? in turn at its first +// appearance, taking the lowest number no $n took. +type placeholder struct { + Number int + Name string +} + +var ( + numberedRe = regexp.MustCompile(`^\$([0-9]+)`) + namedRe = regexp.MustCompile(`^\$([A-Za-z_][A-Za-z0-9_]*)`) + sqlcArgRe = regexp.MustCompile(`^sqlc\.(n?arg|slice)\(\s*'?([A-Za-z_][A-Za-z0-9_]*)'?\s*\)`) +) + +// bind rewrites the query so that every parameter is a $k numbered as +// sqlc numbers it, and lists the parameters in that order. +func bind(query string) (string, []placeholder) { + type occurrence struct { + start, end int + number int // for $n + name string // for $name or sqlc.arg, "" for ? + } + var occ []occurrence + i := 0 + for i < len(query) { + c := query[i] + switch { + case c == '\'' || c == '"': + i = quotedEnd(query, i) + case strings.HasPrefix(query[i:], "--"): + end := strings.IndexByte(query[i:], '\n') + if end < 0 { + i = len(query) + } else { + i += end + } + case strings.HasPrefix(query[i:], "/*"): + end := strings.Index(query[i:], "*/") + if end < 0 { + i = len(query) + } else { + i += end + 2 + } + case c == '?': + occ = append(occ, occurrence{start: i, end: i + 1}) + i++ + case c == '$' && numberedRe.MatchString(query[i:]): + m := numberedRe.FindStringSubmatch(query[i:]) + n, _ := strconv.Atoi(m[1]) + occ = append(occ, occurrence{start: i, end: i + len(m[0]), number: n}) + i += len(m[0]) + case c == '$' && namedRe.MatchString(query[i:]): + m := namedRe.FindStringSubmatch(query[i:]) + occ = append(occ, occurrence{start: i, end: i + len(m[0]), name: m[1]}) + i += len(m[0]) + case c == 's' && sqlcArgRe.MatchString(query[i:]): + m := sqlcArgRe.FindStringSubmatch(query[i:]) + occ = append(occ, occurrence{start: i, end: i + len(m[0]), name: m[2]}) + i += len(m[0]) + default: + i++ + } + } + taken := map[int]bool{} + for _, o := range occ { + if o.number > 0 { + taken[o.number] = true + } + } + byName := map[string]int{} + next := 1 + assign := func(o occurrence) int { + if o.number > 0 { + return o.number + } + if n, ok := byName[o.name]; ok && o.name != "" { + return n + } + for taken[next] { + next++ + } + n := next + taken[n] = true + if o.name != "" { + byName[o.name] = n + } + return n + } + var phs []placeholder + numbered := map[int]bool{} + var out strings.Builder + last := 0 + for _, o := range occ { + n := assign(o) + if !numbered[n] { + numbered[n] = true + phs = append(phs, placeholder{Number: n, Name: o.name}) + } + out.WriteString(query[last:o.start]) + out.WriteString("$" + strconv.Itoa(n)) + last = o.end + } + out.WriteString(query[last:]) + for i := 1; i < len(phs); i++ { + for j := i; j > 0 && phs[j-1].Number > phs[j].Number; j-- { + phs[j-1], phs[j] = phs[j], phs[j-1] + } + } + return out.String(), phs +} + +// nullMarker is what a NULL is printed as when the CLI prints CSV, unlike +// any value a case holds. +const nullMarker = "" + +// analyzer holds the CLI a case runs through, the case's schema and +// fixture, and the catalog of the schema. +type analyzer struct { + binary string + schema string // the schema's statements, each ending in ; + fixture string // the fixture's, or "" + tables map[string][]column + enums map[string][]string // the labels of each enum type the schema created + // canonical names the type the dialect reports a spelling as, for + // each alias types.jsonl lists: DuckDB spells a JSON column json, + // which its own catalog lists as a spelling of varchar. + canonical map[string]string +} + +// readAliases reads the aliases the generated types.jsonl gives each +// type, keyed by alias. +func readAliases() (map[string]string, error) { + dir, err := dialect.Dir(Engine) + if err != nil { + return nil, err + } + types, err := dialect.ReadTypes(dir) + if err != nil { + return nil, err + } + canonical := map[string]string{} + for _, t := range types { + for _, alias := range t.Aliases { + canonical[strings.ToLower(alias)] = strings.ToLower(t.Name) + } + } + return canonical, nil +} + +// run executes a script in a fresh in-memory database loaded with the +// schema and, unless told otherwise, the fixture, and returns what the +// CLI printed in the mode asked for: "json" prints one JSON array per +// statement that returns rows, "csv" prints rows with a header and NULL +// as nullMarker, and "" prints the CLI's own text, which is how EXPLAIN +// draws a plan. A statement that fails ends the script with DuckDB's own +// error message. +func (a *analyzer) run(ctx context.Context, script, mode string, withFixture bool) (string, error) { + args := []string{"-bail"} + switch mode { + case "json": + args = append(args, "-json") + case "csv": + args = append(args, "-csv", "-header", "-nullvalue", nullMarker) + } + args = append(args, ":memory:") + cmd := exec.CommandContext(ctx, a.binary, args...) + prelude := a.schema + if withFixture { + prelude += a.fixture + } + cmd.Stdin = strings.NewReader(prelude + script) + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + msg := strings.TrimSpace(stderr.String()) + if msg == "" { + msg = err.Error() + } + return "", errors.New(msg) + } + return stdout.String(), nil +} + +// query runs one statement and decodes the rows it printed. +func (a *analyzer) query(ctx context.Context, statement string) ([]map[string]json.RawMessage, error) { + out, err := a.run(ctx, statement+";\n", "json", true) + if err != nil { + return nil, err + } + var rows []map[string]json.RawMessage + dec := json.NewDecoder(strings.NewReader(out)) + for { + var rs []map[string]json.RawMessage + err := dec.Decode(&rs) + if errors.Is(err, io.EOF) { + break + } + if err != nil { + return nil, fmt.Errorf("decoding duckdb output: %w", err) + } + rows = append(rows, rs...) + } + return rows, nil +} + +func str(v json.RawMessage) string { + var s string + json.Unmarshal(v, &s) + return s +} + +// column is what the catalog says about a column of a table. +type column struct { + name string + spelling string // the type as DuckDB spells it + typ *analysis.TypeExpr + nullable bool +} + +// statements joins a script's statements, each ending in a semicolon. +func statements(src string) string { + s := strings.TrimRight(strings.TrimSpace(src), ";") + if s == "" { + return "" + } + return s + ";\n" +} + +// Analyze runs a case's queries through the CLI and returns what DuckDB +// reports in the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, binary string, c endtoend.Case) ([]byte, error) { + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + a := &analyzer{binary: binary, schema: statements(string(schema)), fixture: statements(string(fixture))} + if a.canonical, err = readAliases(); err != nil { + return nil, err + } + if err := a.readCatalog(ctx); err != nil { + return nil, err + } + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := a.analyzeQuery(ctx, q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return analysis.Encode(out) +} + +// Check compares what DuckDB reports for a case with the output the case +// committed, returning a diff when they differ. +func Check(ctx context.Context, binary string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, binary, c) + if err != nil { + return "", err + } + return c.Compare(got) +} + +// readCatalog reads the tables and enum types the schema created. +func (a *analyzer) readCatalog(ctx context.Context) error { + rows, err := a.query(ctx, `SELECT type_name, labels FROM duckdb_types() WHERE database_name = 'memory' AND NOT internal AND logical_type = 'ENUM' ORDER BY type_name`) + if err != nil { + return err + } + a.enums = map[string][]string{} + for _, row := range rows { + var labels []string + json.Unmarshal(row["labels"], &labels) + a.enums[strings.ToLower(str(row["type_name"]))] = labels + } + rows, err = a.query(ctx, `SELECT table_name, column_name, data_type, is_nullable FROM duckdb_columns() WHERE database_name = 'memory' ORDER BY table_oid, column_index`) + if err != nil { + return err + } + a.tables = map[string][]column{} + for _, row := range rows { + table := strings.ToLower(str(row["table_name"])) + var nullable bool + json.Unmarshal(row["is_nullable"], &nullable) + spelling := str(row["data_type"]) + a.tables[table] = append(a.tables[table], column{ + name: str(row["column_name"]), + spelling: spelling, + typ: a.parseType(spelling), + nullable: nullable, + }) + } + return nil +} + +// lookup finds a column of a table, which DuckDB matches in any case. +func (a *analyzer) lookup(table, name string) (column, bool) { + for _, col := range a.tables[strings.ToLower(table)] { + if strings.EqualFold(col.name, name) { + return col, true + } + } + return column{}, false +} + +// resolve finds the table a reference names in a scope: the table its +// qualifier aliases, or the one table of the scope that has the column. +func (a *analyzer) resolve(sc scope, r ref) (string, column, bool) { + tables := sc.tables + if sc.target.name != "" { + tables = append([]tableRef{sc.target}, tables...) + } + if r.qualifier != "" { + if sc.ctes[r.qualifier] { + return "", column{}, false + } + for _, t := range tables { + if t.alias == r.qualifier || (t.alias == "" && t.name == r.qualifier) { + col, ok := a.lookup(t.name, r.column) + return t.name, col, ok + } + } + return "", column{}, false + } + var found string + var fc column + for _, t := range tables { + if col, ok := a.lookup(t.name, r.column); ok { + if found != "" && found != t.name { + return "", column{}, false + } + found, fc = t.name, col + } + } + return found, fc, found != "" +} + +// describe reads what the catalog says about a column read from a table. +func describe(table string, col column) analysis.Column { + return analysis.Column{Name: col.name, Type: withNullable(col.typ, col.nullable), Table: table} +} + +func withNullable(t *analysis.TypeExpr, nullable bool) *analysis.TypeExpr { + if t == nil { + return nil + } + out := *t + out.Nullable = nullable + return &out +} + +// binding is what is known about one parameter: the type the binder gave +// it, spelled as DuckDB spells it, and the column it stands in for. +type binding struct { + spelling string + typ *analysis.TypeExpr + column *analysis.Column +} + +var ( + sentinelCastRe = regexp.MustCompile(`CAST\('goldeneye_([0-9]+)' AS `) + sentinelRe = regexp.MustCompile(`'goldeneye_([0-9]+)'`) + sentinelErrRe = regexp.MustCompile(`goldeneye_([0-9]+)`) +) + +// explain prepares the query, explains it with a sentinel bound to each +// parameter and returns the type the binder gave each, keyed by number. +// A parameter whose sentinel the binder converts on the spot, as an +// INSERT's VALUES are, is bound to NULL instead and reported by nothing: +// the error names the sentinel for most types, and for the rest the +// parameters not yet bound to NULL are tried in turn. +func (a *analyzer) explain(ctx context.Context, sql string, phs []placeholder) (map[int]string, error) { + null := map[int]bool{} + for attempt := 0; attempt <= len(phs); attempt++ { + args := make([]string, len(phs)) + for i, ph := range phs { + if null[ph.Number] { + args[i] = "NULL" + } else { + args[i] = fmt.Sprintf("'goldeneye_%d'", ph.Number) + } + } + script := "PREPARE goldeneye AS " + sql + ";\nSET explain_output = 'all';\nEXPLAIN (FORMAT json) EXECUTE goldeneye(" + strings.Join(args, ", ") + ");\n" + out, err := a.run(ctx, script, "", true) + if err != nil { + if !strings.Contains(err.Error(), "Conversion Error") && !strings.Contains(err.Error(), "can't be cast") { + return nil, err + } + retry := false + if m := sentinelErrRe.FindStringSubmatch(err.Error()); m != nil { + n, _ := strconv.Atoi(m[1]) + if !null[n] { + null[n] = true + retry = true + } + } + if !retry { + for _, ph := range phs { + if !null[ph.Number] { + null[ph.Number] = true + retry = true + break + } + } + } + if !retry { + return nil, err + } + continue + } + return sentinelTypes(out) + } + return nil, errors.New("could not bind the parameters") +} + +// planNode is one operator of a plan the CLI prints as JSON. Its +// extra_info holds the operator's expressions, each a string or a list +// of strings. +type planNode struct { + Name string `json:"name"` + Children []planNode `json:"children"` + ExtraInfo map[string]json.RawMessage `json:"extra_info"` +} + +// sentinelTypes reads the type each sentinel is cast to out of the plans +// the CLI printed, one JSON array per plan: the unoptimized logical plan +// comes first, and the first cast of a sentinel wins. A sentinel the +// plan prints bare is a VARCHAR, which the binder needs no cast for. +func sentinelTypes(out string) (map[int]string, error) { + var texts []string + var walk func(n planNode) + walk = func(n planNode) { + for _, raw := range n.ExtraInfo { + var one string + if json.Unmarshal(raw, &one) == nil { + texts = append(texts, one) + continue + } + var many []string + if json.Unmarshal(raw, &many) == nil { + texts = append(texts, many...) + } + } + for _, c := range n.Children { + walk(c) + } + } + dec := json.NewDecoder(strings.NewReader(out)) + for { + var plan []planNode + err := dec.Decode(&plan) + if errors.Is(err, io.EOF) { + break + } + if err != nil { + return nil, fmt.Errorf("decoding the plan: %w", err) + } + for _, n := range plan { + walk(n) + } + } + types := map[int]string{} + for _, text := range texts { + for _, m := range sentinelCastRe.FindAllStringSubmatchIndex(text, -1) { + n, _ := strconv.Atoi(text[m[2]:m[3]]) + if _, ok := types[n]; ok { + continue + } + // The type runs to the parenthesis closing the CAST. + depth := 1 + i := m[1] + for ; i < len(text); i++ { + if text[i] == '(' { + depth++ + } else if text[i] == ')' { + depth-- + if depth == 0 { + break + } + } + } + types[n] = strings.Join(strings.Fields(text[m[1]:i]), " ") + } + } + for _, text := range texts { + for _, m := range sentinelRe.FindAllStringSubmatchIndex(text, -1) { + n, _ := strconv.Atoi(text[m[2]:m[3]]) + if _, ok := types[n]; !ok && !strings.HasSuffix(text[:m[0]], "CAST(") { + types[n] = "VARCHAR" + } + } + } + return types, nil +} + +// analyzeQuery describes one query. +func (a *analyzer) analyzeQuery(ctx context.Context, q endtoend.Query) (analysis.Query, error) { + sql, phs := bind(q.SQL) + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + t := text(tokenize(sql)) + sc := t.readScope() + + // Parameters: a partner column first, then the cast the query wraps + // the parameter in, then the type the binder gave it. + bindings := map[int]*binding{} + var casts []string + var castNumbers []int + for _, ph := range phs { + k := strconv.Itoa(ph.Number) + b := &binding{} + bindings[ph.Number] = b + if t.inSubquery(k) { + // A parameter inside a subquery is compared with a column of + // the subquery's own tables, which the statement's scope does + // not name. + if typ, ok := t.castOf(k); ok { + casts = append(casts, typ) + castNumbers = append(castNumbers, ph.Number) + } + continue + } + if sc.kind == "insert" { + if pos, ok := t.valuesPosition(k); ok { + cols := t.insertColumns() + if cols == nil { + for _, col := range a.tables[sc.target.name] { + cols = append(cols, col.name) + } + } + if pos < len(cols) { + if col, ok := a.lookup(sc.target.name, cols[pos]); ok { + c := describe(sc.target.name, col) + b.column, b.spelling, b.typ = &c, col.spelling, col.typ + continue + } + } + } + } + if r, ok := t.partner(k); ok { + if table, col, ok := a.resolve(sc, r); ok { + c := describe(table, col) + b.column, b.spelling, b.typ = &c, col.spelling, col.typ + continue + } + } + if typ, ok := t.castOf(k); ok { + casts = append(casts, typ) + castNumbers = append(castNumbers, ph.Number) + } + } + if len(casts) > 0 { + // DuckDB spells the cast's type: VARCHAR(5) is VARCHAR, mood is + // ENUM('sad', 'ok'). + var items []string + for i, typ := range casts { + items = append(items, fmt.Sprintf("CAST(NULL AS %s) AS p%d", typ, i)) + } + rows, err := a.query(ctx, "DESCRIBE SELECT "+strings.Join(items, ", ")) + if err != nil { + return analysis.Query{}, err + } + for i, row := range rows { + if i < len(castNumbers) { + b := bindings[castNumbers[i]] + b.spelling = str(row["column_type"]) + b.typ = a.parseType(b.spelling) + } + } + } + if len(phs) > 0 { + types, err := a.explain(ctx, sql, phs) + if err != nil { + return analysis.Query{}, err + } + for n, spelling := range types { + if b := bindings[n]; b != nil && b.typ == nil { + b.spelling = spelling + b.typ = a.parseType(spelling) + } + } + } + + // Result columns. + var columns []analysis.Column + switch sc.kind { + case "select": + rows, err := a.query(ctx, "DESCRIBE "+a.substitute(sql, phs, bindings, false)) + if err != nil { + return analysis.Query{}, err + } + for _, row := range rows { + columns = append(columns, analysis.Column{Name: str(row["column_name"]), Type: a.parseType(str(row["column_type"]))}) + } + a.attribute(sc, t.selectItems(), columns) + default: + // A RETURNING column is the target table's column it names; + // DuckDB describes no DML, so an expression is typed by nothing. + for _, it := range t.returningItems() { + switch { + case it.star: + for _, col := range a.tables[sc.target.name] { + columns = append(columns, describe(sc.target.name, col)) + } + case it.ref != nil: + if table, col, ok := a.resolve(sc, *it.ref); ok { + c := describe(table, col) + c.Name = it.name + columns = append(columns, c) + continue + } + columns = append(columns, analysis.Column{Name: it.name}) + default: + columns = append(columns, analysis.Column{Name: it.name}) + } + } + } + if len(columns) > 0 { + nullable := a.observe(ctx, sql, phs, bindings, len(columns)) + for i := range columns { + if columns[i].Table == "" && columns[i].Type != nil && nullable[i] { + columns[i].Type = withNullable(columns[i].Type, true) + } + } + } + aq.Columns = append(aq.Columns, columns...) + + for _, ph := range phs { + b := bindings[ph.Number] + ac := analysis.Column{Type: b.typ} + if b.column != nil { + ac = *b.column + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} + +// attribute says which table each result column is read from, by +// matching the select list's items, a star expanded to its table's +// columns, against the columns DuckDB described. A list that expands to +// another number of columns than DuckDB describes attributes nothing. +func (a *analyzer) attribute(sc scope, items []item, columns []analysis.Column) { + var origins []*analysis.Column + for _, it := range items { + switch { + case it.star && it.ref == nil: + for _, t := range sc.tables { + for _, col := range a.tables[t.name] { + c := describe(t.name, col) + origins = append(origins, &c) + } + } + case it.star: + table, ok := a.aliased(sc, it.ref.qualifier) + if !ok { + return + } + for _, col := range a.tables[table] { + c := describe(table, col) + origins = append(origins, &c) + } + case it.ref != nil: + if table, col, ok := a.resolve(sc, *it.ref); ok { + c := describe(table, col) + origins = append(origins, &c) + } else { + origins = append(origins, nil) + } + default: + origins = append(origins, nil) + } + } + if len(origins) != len(columns) { + return + } + for i, o := range origins { + if o != nil { + columns[i].Type = o.Type + columns[i].Table = o.Table + } + } +} + +// aliased finds the table a qualifier names in a scope. +func (a *analyzer) aliased(sc scope, qualifier string) (string, bool) { + for _, t := range sc.tables { + if t.alias == qualifier || (t.alias == "" && t.name == qualifier) { + if _, ok := a.tables[t.name]; ok { + return t.name, true + } + } + } + return "", false +} + +// substitute replaces each parameter with a NULL of its type, or with a +// value of its type when values is set, for DuckDB to describe or run the +// query. A parameter of unknown type becomes a bare NULL. Strings, +// quoted identifiers and comments are left alone. +func (a *analyzer) substitute(sql string, phs []placeholder, bindings map[int]*binding, values bool) string { + repl := map[int]string{} + for _, ph := range phs { + r := "NULL" + if b := bindings[ph.Number]; b != nil && b.spelling != "" { + r = "CAST(NULL AS " + b.spelling + ")" + if values { + // The value is chosen by the type as spelled, since an + // alias such as JSON takes values its canonical type + // does not. + if v, ok := a.zero(a.parseTypeWith(b.spelling, false)); ok { + r = "CAST('" + strings.ReplaceAll(v, "'", "''") + "' AS " + b.spelling + ")" + } + } + } + repl[ph.Number] = r + } + var out strings.Builder + i := 0 + for i < len(sql) { + c := sql[i] + switch { + case c == '\'' || c == '"': + end := quotedEnd(sql, i) + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "--"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + end = len(sql) + } else { + end += i + } + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + end = len(sql) + } else { + end += i + 2 + } + out.WriteString(sql[i:end]) + i = end + case c == '$' && numberedRe.MatchString(sql[i:]): + m := numberedRe.FindStringSubmatch(sql[i:]) + n, _ := strconv.Atoi(m[1]) + if r, ok := repl[n]; ok { + out.WriteString(r) + } else { + out.WriteString(m[0]) + } + i += len(m[0]) + default: + out.WriteByte(c) + i++ + } + } + return out.String() +} + +// observe runs the query with a value bound to each parameter, over the +// fixture and over no rows, and reports which of the first n result +// columns came back NULL in either run. A run the CLI rejects observes +// nothing. +func (a *analyzer) observe(ctx context.Context, sql string, phs []placeholder, bindings map[int]*binding, n int) []bool { + nullable := make([]bool, n) + statement := a.substitute(sql, phs, bindings, true) + ";\n" + runs := []bool{true} + if a.fixture != "" { + runs = append(runs, false) + } + for _, withFixture := range runs { + out, err := a.run(ctx, statement, "csv", withFixture) + if err != nil { + continue + } + records, err := csv.NewReader(strings.NewReader(out)).ReadAll() + if err != nil { + continue + } + for _, rec := range records[min(1, len(records)):] { + for j, v := range rec { + if j < n && v == nullMarker { + nullable[j] = true + } + } + } + } + return nullable +} diff --git a/internal/goldeneye/duckdb/duckdb.go b/internal/goldeneye/duckdb/duckdb.go new file mode 100644 index 0000000000..1005a2d5ea --- /dev/null +++ b/internal/goldeneye/duckdb/duckdb.go @@ -0,0 +1,407 @@ +// Package duckdb generates the DuckDB dialect seed under +// internal/engine/duckdb/dialect — types.jsonl, functions.jsonl and +// operators.jsonl — from a live DuckDB CLI, the same way the postgresql +// package generates PostgreSQL's from a live server, and verifies the +// DuckDB analyze cases under internal/endtoend/testdata against the same +// CLI. +// +// The CLI is a DuckDB 2.0 build, the release darkwing is pinned against, +// which has no release to download yet: Install fetches the current build +// of DuckDB's v2.0 preview channel into the user cache directory. The CLI +// is located through the DUCKDB environment variable, then the cached +// build, then "duckdb" on PATH. +package duckdb + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "os" + "os/exec" + "sort" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name of the engine directory the dialect lives under. +const Engine = "duckdb" + +// Locate finds the DuckDB CLI: the DUCKDB environment variable wins, then +// the cached build of DefaultVersion, then "duckdb" on PATH. +func Locate() (string, error) { + if path := os.Getenv("DUCKDB"); path != "" { + return path, nil + } + if path, err := cachedBinary(DefaultVersion); err == nil { + if _, err := os.Stat(path); err == nil { + return path, nil + } + } + path, err := exec.LookPath("duckdb") + if err != nil { + return "", errors.New("no duckdb CLI found: run `go run ./cmd/goldeneye install duckdb` in internal/goldeneye, set DUCKDB to a DuckDB 2.0 binary, or put duckdb on PATH") + } + return path, nil +} + +// Version reports the release a CLI is. +func Version(ctx context.Context, binary string) (string, error) { + out, err := exec.CommandContext(ctx, binary, "--version").Output() + if err != nil { + return "", fmt.Errorf("duckdb --version: %w", err) + } + return "DuckDB " + strings.TrimSpace(string(out)), nil +} + +// query runs a SQL statement against an in-memory database and decodes the +// CLI's JSON output into rows. +func query(ctx context.Context, binary, sql string, rows any) error { + cmd := exec.CommandContext(ctx, binary, "-json", ":memory:", "-c", sql) + out, err := cmd.Output() + if err != nil { + if exit, ok := err.(*exec.ExitError); ok { + return fmt.Errorf("duckdb: %s: %s", err, exit.Stderr) + } + return fmt.Errorf("duckdb: %w", err) + } + // An empty result set prints nothing rather than []. + if len(out) == 0 { + return nil + } + return json.Unmarshal(out, rows) +} + +type typeRow struct { + TypeName string `json:"type_name"` + LogicalType string `json:"logical_type"` + Category *string `json:"type_category"` +} + +type functionRow struct { + Name string `json:"function_name"` + FunctionType string `json:"function_type"` + ParameterTypes []string `json:"parameter_types"` + Varargs *string `json:"varargs"` + ReturnType *string `json:"return_type"` +} + +// metaTypes are type ids that never describe a column's value: sentinels and +// binder-internal types the dump lists alongside the real ones. +var metaTypes = map[string]bool{ + "null": true, + "unknown": true, + "invalid": true, + "any": true, + "type": true, + "lambda": true, + "table": true, + "pointer": true, +} + +// categoryLetter maps duckdb_types() categories onto the PostgreSQL category +// letters the seed package uses. +func categoryLetter(category *string) string { + if category == nil { + return "U" + } + switch *category { + case "NUMERIC": + return "N" + case "STRING": + return "S" + case "DATETIME": + return "D" + case "BOOLEAN": + return "B" + case "COMPOSITE": + return "C" + default: + return "U" + } +} + +func readTypes(ctx context.Context, binary string) ([]dialect.Type, error) { + var rows []typeRow + err := query(ctx, binary, ` +SELECT type_name, logical_type, type_category +FROM duckdb_types() +WHERE database_name = 'system' +ORDER BY type_name`, &rows) + if err != nil { + return nil, err + } + + // Group the dump's one-row-per-spelling by logical type: the spelling + // matching the logical type id is the canonical name, the rest are + // aliases. A spelling is listed once per schema it is visible in, so + // an alias is kept once. + grouped := map[string]*dialect.Type{} + var order []string + seen := map[string]bool{} + for _, row := range rows { + logical := strings.ToLower(row.LogicalType) + if metaTypes[logical] { + continue + } + t, ok := grouped[logical] + if !ok { + t = &dialect.Type{Name: logical, Category: categoryLetter(row.Category)} + grouped[logical] = t + order = append(order, logical) + } + if t.Category == "U" { + t.Category = categoryLetter(row.Category) + } + if name := strings.ToLower(row.TypeName); name != logical && !seen[logical+"\x00"+name] { + seen[logical+"\x00"+name] = true + t.Aliases = append(t.Aliases, name) + } + } + + // Most spellings are the logical type under another name, but an + // extension can register one that DuckDB keeps apart: JSON is a + // VARCHAR whose values are reported, bound and decoded as JSON. Such a + // spelling is the one typeof() names a value cast to it by, and it + // becomes a type of its own standing on the logical type. + own, err := ownTypes(ctx, binary, grouped) + if err != nil { + return nil, err + } + + sort.Strings(order) + types := make([]dialect.Type, 0, len(order)+len(own)+1) + // "any" stands in for the generic parameters of DuckDB's polymorphic + // functions (ANY, T, K, V); the analyzer resolves a call returning it + // to the type of the call's first argument. + types = append(types, dialect.Type{Name: "any", Category: "U"}) + for _, name := range order { + types = append(types, *grouped[name]) + } + // Listed after every type they could stand on. + return append(types, own...), nil +} + +// ownTypes takes out of the grouped types' aliases the spellings DuckDB +// keeps as types of their own, and returns them as types standing on the +// type they were grouped under. +func ownTypes(ctx context.Context, binary string, grouped map[string]*dialect.Type) ([]dialect.Type, error) { + var spellings []string + var exprs []string + for _, t := range grouped { + for _, alias := range t.Aliases { + exprs = append(exprs, fmt.Sprintf("typeof(CAST(NULL AS %s)) AS c%d", alias, len(spellings))) + spellings = append(spellings, alias) + } + } + if len(spellings) == 0 { + return nil, nil + } + var rows []map[string]string + if err := query(ctx, binary, "SELECT "+strings.Join(exprs, ", "), &rows); err != nil { + return nil, err + } + if len(rows) != 1 { + return nil, fmt.Errorf("typeof of the type aliases: got %d rows, want 1", len(rows)) + } + own := map[string]bool{} + for i, alias := range spellings { + if strings.EqualFold(rows[0][fmt.Sprintf("c%d", i)], alias) { + own[alias] = true + } + } + + var types []dialect.Type + for _, t := range grouped { + kept := t.Aliases[:0] + for _, alias := range t.Aliases { + if own[alias] { + types = append(types, dialect.Type{Name: alias, Category: t.Category, Base: t.Name}) + continue + } + kept = append(kept, alias) + } + t.Aliases = kept + } + sort.Slice(types, func(i, j int) bool { return types[i].Name < types[j].Name }) + return types, nil +} + +// typeNames is the set of names the seed declares, for filtering out function +// overloads over generic or binder-internal types. +func typeNames(types []dialect.Type) map[string]bool { + names := map[string]bool{} + for _, t := range types { + names[t.Name] = true + for _, alias := range t.Aliases { + names[alias] = true + } + } + return names +} + +// seedTypeName maps a duckdb_functions() type spelling to a seeded type name: +// lowercased, with modifiers dropped (DECIMAL(18,3) is a decimal), array +// markers kept (fixed sizes and generic bounds included: DOUBLE[3] and +// ANY[] are arrays), and the generic parameters of polymorphic functions +// mapped to "any". It reports false for the internal types a seed cannot +// describe. +func seedTypeName(name string, known map[string]bool) (string, bool) { + name = strings.ToLower(strings.TrimSpace(name)) + if close := strings.LastIndexByte(name, ']'); close == len(name)-1 { + if open := strings.LastIndexByte(name, '['); open != -1 { + elementName, ok := seedTypeName(name[:open], known) + return elementName + "[]", ok + } + } + if open := strings.IndexByte(name, '('); open != -1 { + name = name[:open] + } + switch name { + case "any", "t", "k", "v": + return "any", true + } + if !known[name] { + return "", false + } + return name, true +} + +// isOperatorName reports a function named by symbols rather than an +// identifier — the spelling of a binary or prefix operator. +func isOperatorName(name string) bool { + return strings.IndexFunc(name, func(r rune) bool { + return (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '_' && r != '$' + }) != -1 +} + +func functionKind(functionType string) string { + switch functionType { + case "aggregate": + return "a" + case "window": + return "w" + default: + return "" + } +} + +func readFunctions(ctx context.Context, binary string, known map[string]bool) ([]dialect.Function, []dialect.Operator, error) { + var rows []functionRow + err := query(ctx, binary, ` +SELECT DISTINCT function_name, function_type, parameter_types, varargs, return_type +FROM duckdb_functions() +WHERE database_name = 'system' + AND schema_name = 'main' + AND function_type IN ('scalar', 'aggregate', 'window', 'macro') +ORDER BY function_name, parameter_types::VARCHAR, return_type`, &rows) + if err != nil { + return nil, nil, err + } + + var funcs []dialect.Function + var operators []dialect.Operator + seenFunc := map[string]bool{} + seenOp := map[string]bool{} + for _, row := range rows { + if row.ReturnType == nil { + continue + } + returns, ok := seedTypeName(*row.ReturnType, known) + if !ok { + continue + } + args := make([]string, 0, len(row.ParameterTypes)) + resolved := true + for _, param := range row.ParameterTypes { + arg, ok := seedTypeName(param, known) + if !ok { + resolved = false + break + } + args = append(args, arg) + } + if !resolved { + continue + } + + if isOperatorName(row.Name) { + // Operator-named functions become operator entries; sqlc's + // engine reports them as operator applications. Only the + // binary form over concrete scalar types is representable — + // the seed's operator table, unlike its function table, does + // not register generic or array types on demand. + if row.FunctionType != "scalar" || len(args) != 2 || row.Varargs != nil { + continue + } + if concrete := !strings.Contains(returns, "any") && !strings.Contains(returns, "[]") && + !strings.Contains(args[0], "any") && !strings.Contains(args[0], "[]") && + !strings.Contains(args[1], "any") && !strings.Contains(args[1], "[]"); !concrete { + continue + } + key := row.Name + "\x00" + strings.Join(args, "\x00") + if seenOp[key] { + continue + } + seenOp[key] = true + operators = append(operators, dialect.Operator{ + Name: row.Name, + Left: args[0], + Right: args[1], + Result: returns, + }) + continue + } + + fn := dialect.Function{ + Name: row.Name, + Kind: functionKind(row.FunctionType), + Returns: returns, + // An aggregate over no rows returns NULL — except count, + // which returns 0. + Nullable: row.FunctionType == "aggregate" && !strings.HasPrefix(row.Name, "count"), + } + for _, arg := range args { + fn.Args = append(fn.Args, dialect.Arg{Type: arg}) + } + if row.Varargs != nil { + vararg, ok := seedTypeName(*row.Varargs, known) + if !ok { + continue + } + fn.Args = append(fn.Args, dialect.Arg{Type: vararg, Mode: "v"}) + } + + key := fn.Name + "\x00" + fn.Kind + "\x00" + strings.Join(args, "\x00") + if seenFunc[key] { + continue + } + seenFunc[key] = true + funcs = append(funcs, fn) + } + return funcs, operators, nil +} + +// Generate reads the dialect from the CLI. +func Generate(ctx context.Context, binary string) (dialect.Files, error) { + types, err := readTypes(ctx, binary) + if err != nil { + return nil, err + } + funcs, operators, err := readFunctions(ctx, binary, typeNames(types)) + if err != nil { + return nil, err + } + files := dialect.Files{} + if files[dialect.TypesFile], err = dialect.JSONL(types); err != nil { + return nil, err + } + if files[dialect.FunctionsFile], err = dialect.JSONL(funcs); err != nil { + return nil, err + } + if files[dialect.OperatorsFile], err = dialect.JSONL(operators); err != nil { + return nil, err + } + return files, nil +} diff --git a/internal/goldeneye/duckdb/duckdb_test.go b/internal/goldeneye/duckdb/duckdb_test.go new file mode 100644 index 0000000000..5d600da7f4 --- /dev/null +++ b/internal/goldeneye/duckdb/duckdb_test.go @@ -0,0 +1,66 @@ +package duckdb + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// TestDialect verifies the committed DuckDB dialect against what the DuckDB +// CLI reports. It skips unless a CLI is found. +func TestDialect(t *testing.T) { + binary, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, binary) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, binary) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Engine) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} + +// TestAnalyzeCases verifies every DuckDB analyze case under +// internal/endtoend/testdata against what the CLI reports. It skips +// unless a CLI is found. +func TestAnalyzeCases(t *testing.T) { + binary, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Engine) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no duckdb analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), binary, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what DuckDB reports (-committed +duckdb):\n%s", c.Output, diff) + } + }) + } +} diff --git a/internal/goldeneye/duckdb/install.go b/internal/goldeneye/duckdb/install.go new file mode 100644 index 0000000000..e7ac08077e --- /dev/null +++ b/internal/goldeneye/duckdb/install.go @@ -0,0 +1,136 @@ +package duckdb + +import ( + "archive/tar" + "compress/gzip" + "context" + "errors" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "strings" +) + +// DefaultVersion is the DuckDB preview channel the CLI is downloaded from: +// the v2.0 development builds, which DuckDB publishes as a rolling tarball +// per platform under https://artifacts.duckdb.org// until 2.0 is +// released. A channel has no per-build download and no checksum to pin, +// so Install fetches whatever build the channel holds and the version the +// CLI reports is what a run logs; GeneratedFrom records the build the +// committed dialect came from, and a check against a later build reports +// what the later build added. Once 2.0 is released, pin the release and +// its checksums here the way the clickhouse package does. +const DefaultVersion = "v2.0-cyanoptera" + +// GeneratedFrom is the build the committed dialect was generated from, as +// `duckdb --version` reports it. Update it when regenerating. +const GeneratedFrom = "v2.0.0-alpha41396 (Cyanoptera) d41e527b18" + +// channelURL is the download address of a channel's CLI tarball for a +// platform. DuckDB publishes one macOS build for both architectures. +func channelURL(channel, goos, goarch string) (string, error) { + var name string + switch { + case goos == "linux" && (goarch == "amd64" || goarch == "arm64"): + name = "duckdb-cli-linux-" + goarch + ".tar.gz" + case goos == "darwin": + name = "duckdb-cli-osx-universal.tar.gz" + default: + return "", fmt.Errorf("no DuckDB %s build is published for %s/%s", channel, goos, goarch) + } + return "https://artifacts.duckdb.org/" + channel + "/" + name, nil +} + +// cachedBinary is where Install puts the binary for a channel. +func cachedBinary(channel string) (string, error) { + dir, err := os.UserCacheDir() + if err != nil { + return "", err + } + return filepath.Join(dir, "sqlc-duckdb", channel, "duckdb"), nil +} + +// Install downloads the channel's current CLI into the cache and returns +// its path. It is a no-op when the channel is already cached: remove the +// cached directory to fetch the channel's newer build. +func Install(ctx context.Context, channel, goos, goarch string, progress io.Writer) (string, error) { + dest, err := cachedBinary(channel) + if err != nil { + return "", err + } + if _, err := os.Stat(dest); err == nil { + return dest, nil + } + url, err := channelURL(channel, goos, goarch) + if err != nil { + return "", err + } + if err := os.MkdirAll(filepath.Dir(dest), 0o755); err != nil { + return "", err + } + + fmt.Fprintf(progress, "downloading %s\n", url) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) + if err != nil { + return "", err + } + resp, err := http.DefaultClient.Do(req) + if err != nil { + return "", err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("downloading %s: %s", url, resp.Status) + } + + // Write next to the destination and rename so a partial download never + // masquerades as an installed binary. + tmp, err := os.CreateTemp(filepath.Dir(dest), "duckdb-*.partial") + if err != nil { + return "", err + } + defer os.Remove(tmp.Name()) + src, err := binaryInTarball(resp.Body) + if err != nil { + tmp.Close() + return "", fmt.Errorf("downloading %s: %w", url, err) + } + if _, err := io.Copy(tmp, src); err != nil { + tmp.Close() + return "", err + } + if err := tmp.Close(); err != nil { + return "", err + } + if err := os.Chmod(tmp.Name(), 0o755); err != nil { + return "", err + } + if err := os.Rename(tmp.Name(), dest); err != nil { + return "", err + } + return dest, nil +} + +// binaryInTarball positions a reader at the duckdb binary inside a CLI +// tarball, which holds it at the top level. +func binaryInTarball(r io.Reader) (io.Reader, error) { + gz, err := gzip.NewReader(r) + if err != nil { + return nil, err + } + tr := tar.NewReader(gz) + for { + hdr, err := tr.Next() + if errors.Is(err, io.EOF) { + return nil, errors.New("tarball does not contain duckdb") + } + if err != nil { + return nil, err + } + if hdr.Typeflag == tar.TypeReg && strings.TrimPrefix(hdr.Name, "./") == "duckdb" { + return tr, nil + } + } +} diff --git a/internal/goldeneye/duckdb/text.go b/internal/goldeneye/duckdb/text.go new file mode 100644 index 0000000000..1c749a6a54 --- /dev/null +++ b/internal/goldeneye/duckdb/text.go @@ -0,0 +1,657 @@ +package duckdb + +import ( + "strings" +) + +// DuckDB prints a plan with every column by its bare name and every +// aliased expression by its alias, and describes a query no further than +// its result columns' names and types, so which table a result column is +// read from and which column a parameter is compared with are read from +// the query text: the select list's items, the FROM clause's tables and +// aliases, and the operand beside each parameter. The text is tokenized +// and read at the top level of the statement, outside the parentheses a +// subquery or a CTE body sits in. + +// token is one lexical element of a query. +type token struct { + kind byte // 'w' word, 'q' quoted identifier, 's' string, 'n' number, 'p' parameter, 'o' operator or punctuation + text string +} + +var operators = []string{"::", "<>", "!=", "<=", ">=", "!~~", "~~", "->>", "->", "||", "=", "<", ">", "(", ")", ",", ".", "*", "+", "-", "/", "%", "[", "]", ";", "^", "&", "|", "~", "!", ":"} + +// tokenize splits a query into tokens, dropping comments. A parameter is +// $ followed by digits, which is how bind spells every parameter. +func tokenize(src string) []token { + var out []token + i := 0 + for i < len(src) { + c := src[i] + switch { + case c == ' ' || c == '\t' || c == '\n' || c == '\r': + i++ + case strings.HasPrefix(src[i:], "--"): + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + i = len(src) + } else { + i += end + } + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + i = len(src) + } else { + i += end + 2 + } + case c == '\'': + end := quotedEnd(src, i) + out = append(out, token{'s', src[i:end]}) + i = end + case c == '"': + end := quotedEnd(src, i) + out = append(out, token{'q', strings.ReplaceAll(src[i+1:end-1], `""`, `"`)}) + i = end + case c == '$' && i+1 < len(src) && isDigit(src[i+1]): + end := i + 1 + for end < len(src) && isDigit(src[end]) { + end++ + } + out = append(out, token{'p', src[i+1 : end]}) + i = end + case isDigit(c) || (c == '.' && i+1 < len(src) && isDigit(src[i+1])): + end := i + for end < len(src) && (isDigit(src[end]) || src[end] == '.' || src[end] == 'e' || src[end] == 'E' || src[end] == '_') { + end++ + } + out = append(out, token{'n', src[i:end]}) + i = end + case isWordStart(c): + end := i + for end < len(src) && isWordByte(src[end]) { + end++ + } + out = append(out, token{'w', src[i:end]}) + i = end + default: + matched := false + for _, op := range operators { + if strings.HasPrefix(src[i:], op) { + out = append(out, token{'o', op}) + i += len(op) + matched = true + break + } + } + if !matched { + out = append(out, token{'o', string(c)}) + i++ + } + } + } + return out +} + +// quotedEnd returns the index just past the quoted token starting at i, +// whose delimiter is escaped by doubling it. +func quotedEnd(s string, i int) int { + q := s[i] + j := i + 1 + for j < len(s) { + switch { + case s[j] == q && j+1 < len(s) && s[j+1] == q: + j += 2 + case s[j] == q: + return j + 1 + default: + j++ + } + } + return len(s) +} + +func isDigit(c byte) bool { return c >= '0' && c <= '9' } +func isWordStart(c byte) bool { + return c == '_' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= 0x80 +} +func isWordByte(c byte) bool { return isWordStart(c) || isDigit(c) } + +// text is a tokenized query. +type text []token + +func (t text) at(i int) token { + if i < 0 || i >= len(t) { + return token{} + } + return t[i] +} + +// isWord reports whether token i is the keyword, in any case. +func (t text) isWord(i int, word string) bool { + tok := t.at(i) + return tok.kind == 'w' && strings.EqualFold(tok.text, word) +} + +// isOp reports whether token i is the operator. +func (t text) isOp(i int, op string) bool { + tok := t.at(i) + return tok.kind == 'o' && tok.text == op +} + +// isName reports whether token i can name something: a word or a quoted +// identifier. +func (t text) isName(i int) bool { + k := t.at(i).kind + return k == 'w' || k == 'q' +} + +// group returns the index of the parenthesis closing the one at i. +func (t text) group(i int) int { + depth := 0 + for j := i; j < len(t); j++ { + switch { + case t.isOp(j, "("): + depth++ + case t.isOp(j, ")"): + depth-- + if depth == 0 { + return j + } + } + } + return len(t) - 1 +} + +// ref is a column reference: a qualifier, empty for none, and a column, +// or "*" for every column of the qualifier. +type ref struct { + qualifier, column string +} + +// readRef reads a dotted name starting at i, returning the parts and the +// index after them. +func (t text) readRef(i int) ([]string, int) { + var parts []string + for t.isName(i) || t.isOp(i, "*") { + parts = append(parts, t.at(i).text) + if !t.isOp(i+1, ".") { + return parts, i + 1 + } + i += 2 + } + return parts, i +} + +// keywords that end a list of tables or select items at the top level. +var clauseKeywords = map[string]bool{ + "where": true, "group": true, "order": true, "limit": true, "offset": true, "having": true, + "qualify": true, "window": true, "returning": true, "set": true, "values": true, "select": true, + "union": true, "except": true, "intersect": true, "on": true, "from": true, "join": true, + "left": true, "right": true, "full": true, "inner": true, "cross": true, "outer": true, + "natural": true, "asof": true, "semi": true, "anti": true, "positional": true, "lateral": true, + "using": true, "with": true, "into": true, "default": true, "fetch": true, "for": true, + "tablesample": true, "sample": true, "by": true, "repeatable": true, +} + +// typeWords are the words a multi-word type name continues with: +// TIMESTAMP WITH TIME ZONE, DOUBLE PRECISION, CHARACTER VARYING. +var typeWords = map[string]bool{"with": true, "without": true, "time": true, "zone": true, "precision": true, "varying": true} + +// tableRef is one table of a statement's scope, by name and alias. +type tableRef struct { + name, alias string +} + +// scope is what the statement reads and writes: the tables of its FROM, +// JOIN and USING clauses and the table a DML statement targets, with the +// names of its CTEs, which are not tables. +type scope struct { + kind string // select, insert, update, delete + target tableRef + tables []tableRef + ctes map[string]bool +} + +// readScope reads a statement's scope from its top-level tokens. +func (t text) readScope() scope { + sc := scope{ctes: map[string]bool{}} + i := 0 + // WITH name [(cols)] AS (...), ... + if t.isWord(0, "with") { + i = 1 + if t.isWord(i, "recursive") { + i++ + } + for t.isName(i) { + sc.ctes[strings.ToLower(t.at(i).text)] = true + i++ + if t.isOp(i, "(") { + i = t.group(i) + 1 + } + if t.isWord(i, "as") { + i++ + } + if t.isWord(i, "not") || t.isWord(i, "materialized") { + for !t.isOp(i, "(") && i < len(t) { + i++ + } + } + if t.isOp(i, "(") { + i = t.group(i) + 1 + } + if t.isOp(i, ",") { + i++ + continue + } + break + } + } + sc.kind = "select" + switch { + case t.isWord(i, "insert"): + sc.kind = "insert" + for i < len(t) && !t.isWord(i, "into") { + i++ + } + sc.target, i = t.readTable(i + 1) + case t.isWord(i, "update"): + sc.kind = "update" + sc.target, i = t.readTable(i + 1) + case t.isWord(i, "delete"): + sc.kind = "delete" + if t.isWord(i+1, "from") { + i++ + } + sc.target, i = t.readTable(i + 1) + } + for ; i < len(t); i++ { + switch { + case t.isOp(i, "("): + i = t.group(i) + case t.isWord(i, "from") || t.isWord(i, "join"): + i = t.readTables(i+1, &sc.tables) - 1 + case t.isWord(i, "using") && !t.isOp(i+1, "("): + i = t.readTables(i+1, &sc.tables) - 1 + } + } + // A CTE is not a table, whatever table shares its name. + tables := sc.tables[:0] + for _, ref := range sc.tables { + if !sc.ctes[ref.name] { + tables = append(tables, ref) + } + } + sc.tables = tables + return sc +} + +// readTable reads a table name with an optional alias. +func (t text) readTable(i int) (tableRef, int) { + parts, j := t.readRef(i) + if len(parts) == 0 { + return tableRef{}, i + } + ref := tableRef{name: strings.ToLower(parts[len(parts)-1])} + if t.isWord(j, "as") { + j++ + } + if t.isName(j) && !clauseKeywords[strings.ToLower(t.at(j).text)] { + ref.alias = strings.ToLower(t.at(j).text) + j++ + } + return ref, j +} + +// readTables reads a comma-separated list of table references, skipping +// subqueries and table functions, and returns the index after it. +func (t text) readTables(i int, into *[]tableRef) int { + for i < len(t) { + if t.isOp(i, "(") { + // A derived table or a table function's arguments. + i = t.group(i) + 1 + if t.isWord(i, "as") { + i++ + } + if t.isName(i) && !clauseKeywords[strings.ToLower(t.at(i).text)] { + i++ + } + } else if t.isName(i) && !clauseKeywords[strings.ToLower(t.at(i).text)] { + ref, j := t.readTable(i) + if t.isOp(j, "(") { + // A table function: its result is not a table. + j = t.group(j) + 1 + } else { + *into = append(*into, ref) + } + i = j + } else { + return i + } + if t.isOp(i, ",") { + i++ + continue + } + return i + } + return i +} + +// item is one entry of a select list or a RETURNING list. +type item struct { + star bool // every column of qualifier, or of every table + ref *ref // a column reference, when the item is one + name string // the alias, or the column name of a reference +} + +// items splits a select or RETURNING list into its items, given the index +// of the first token after the keyword. +func (t text) items(start int) []item { + var out []item + i := start + for i < len(t) { + end := i + for end < len(t) && !t.isOp(end, ",") && !(t.at(end).kind == 'w' && clauseKeywords[strings.ToLower(t.at(end).text)] && !t.isWord(end, "on")) && !t.isOp(end, ";") { + if t.isOp(end, "(") { + end = t.group(end) + } + end++ + } + if end > i { + out = append(out, t.item(i, end)) + } + if !t.isOp(end, ",") { + break + } + i = end + 1 + } + return out +} + +// item classifies the tokens of one select item. +func (t text) item(start, end int) item { + parts, j := t.readRef(start) + if len(parts) > 0 && parts[len(parts)-1] == "*" { + it := item{star: true} + if len(parts) > 1 { + it.ref = &ref{qualifier: strings.ToLower(parts[len(parts)-2]), column: "*"} + } + return it + } + var it item + if len(parts) > 0 && j == end { + it.ref = &ref{column: parts[len(parts)-1]} + if len(parts) > 1 { + it.ref.qualifier = strings.ToLower(parts[len(parts)-2]) + } + it.name = parts[len(parts)-1] + return it + } + if len(parts) > 0 && j == end-1 && t.isName(end-1) { + // A reference followed by a bare alias. + it.ref = &ref{column: parts[len(parts)-1]} + if len(parts) > 1 { + it.ref.qualifier = strings.ToLower(parts[len(parts)-2]) + } + it.name = t.at(end - 1).text + return it + } + if len(parts) > 0 && j == end-2 && t.isWord(end-2, "as") && t.isName(end-1) { + it.ref = &ref{column: parts[len(parts)-1]} + if len(parts) > 1 { + it.ref.qualifier = strings.ToLower(parts[len(parts)-2]) + } + it.name = t.at(end - 1).text + return it + } + if t.isWord(end-2, "as") && t.isName(end-1) { + it.name = t.at(end - 1).text + } + return it +} + +// selectItems finds the statement's select list: the items after its +// top-level SELECT, or every column when a FROM-first query has none. +func (t text) selectItems() []item { + for i := 0; i < len(t); i++ { + switch { + case t.isOp(i, "("): + i = t.group(i) + case t.isWord(i, "select"): + j := i + 1 + if t.isWord(j, "distinct") || t.isWord(j, "all") { + j++ + if t.isWord(j, "on") && t.isOp(j+1, "(") { + j = t.group(j+1) + 1 + } + } + return t.items(j) + } + } + if t.isWord(0, "from") { + return []item{{star: true}} + } + return nil +} + +// returningItems finds the items of a top-level RETURNING clause. +func (t text) returningItems() []item { + for i := 0; i < len(t); i++ { + switch { + case t.isOp(i, "("): + i = t.group(i) + case t.isWord(i, "returning"): + return t.items(i + 1) + } + } + return nil +} + +// inSubquery reports whether parameter k sits inside a subquery: a +// parenthesis that a SELECT, WITH, FROM or VALUES opens. +func (t text) inSubquery(k string) bool { + i := t.find(k) + depth := 0 + for j := i - 1; j >= 0; j-- { + switch { + case t.isOp(j, ")"): + depth++ + case t.isOp(j, "("): + if depth > 0 { + depth-- + continue + } + if t.isWord(j+1, "select") || t.isWord(j+1, "with") || t.isWord(j+1, "from") || t.isWord(j+1, "values") { + return true + } + } + } + return false +} + +// find returns the index of parameter k. +func (t text) find(k string) int { + for i, tok := range t { + if tok.kind == 'p' && tok.text == k { + return i + } + } + return -1 +} + +var comparisons = map[string]bool{"=": true, "<>": true, "!=": true, "<": true, ">": true, "<=": true, ">=": true, "~~": true, "!~~": true} + +// partner finds the column a parameter is compared with or assigned to: +// the column reference on the other side of the comparison, LIKE or IN +// it is an operand of, or the column a SET assigns it to. +func (t text) partner(k string) (ref, bool) { + i := t.find(k) + if i < 0 { + return ref{}, false + } + // col op $k, col [NOT] LIKE $k, col IN ($k, ...) + j := i - 1 + if t.isOp(j, "(") || t.isOp(j, ",") { + for j >= 0 && (t.isOp(j, ",") || t.at(j).kind == 'p' || t.at(j).kind == 's' || t.at(j).kind == 'n') { + j-- + } + if t.isOp(j, "(") { + j-- + } + } + if t.at(j).kind == 'o' && comparisons[t.at(j).text] || t.isWord(j, "like") || t.isWord(j, "ilike") || t.isWord(j, "glob") || t.isWord(j, "in") { + if t.isWord(j-1, "not") { + j-- + } + if r, ok := t.refEnding(j - 1); ok { + return r, true + } + } + // $k op col + j = i + 1 + if t.at(j).kind == 'o' && comparisons[t.at(j).text] { + if r, ok := t.refStarting(j + 1); ok { + return r, true + } + } + return ref{}, false +} + +// refEnding reads the column reference whose last token is at i. +func (t text) refEnding(i int) (ref, bool) { + if !t.isName(i) { + return ref{}, false + } + r := ref{column: t.at(i).text} + if t.isOp(i-1, ".") && t.isName(i-2) { + r.qualifier = strings.ToLower(t.at(i - 2).text) + } + return r, true +} + +// refStarting reads the column reference starting at i, which must not be +// a function call. +func (t text) refStarting(i int) (ref, bool) { + parts, j := t.readRef(i) + if len(parts) == 0 || t.isOp(j, "(") { + return ref{}, false + } + r := ref{column: parts[len(parts)-1]} + if len(parts) > 1 { + r.qualifier = strings.ToLower(parts[len(parts)-2]) + } + return r, true +} + +// castOf returns the type a parameter is cast to, as $k::T or CAST($k AS +// T), spelled as the query spells it. +func (t text) castOf(k string) (string, bool) { + i := t.find(k) + if i < 0 { + return "", false + } + if t.isOp(i+1, "::") { + return t.typeText(i + 2), true + } + if t.isWord(i-2, "cast") && t.isOp(i-1, "(") && t.isWord(i+1, "as") { + return t.typeText(i + 2), true + } + return "", false +} + +// typeText reads a type starting at i: a dotted name, optional arguments +// in parentheses and any number of [] or [N] suffixes. +func (t text) typeText(i int) string { + start := i + _, i = t.readRef(i) + for t.at(i).kind == 'w' && typeWords[strings.ToLower(t.at(i).text)] { + // Multi-word names: TIMESTAMP WITH TIME ZONE. + i++ + } + if t.isOp(i, "(") { + i = t.group(i) + 1 + } + for t.isOp(i, "[") { + for i < len(t) && !t.isOp(i, "]") { + i++ + } + i++ + } + var b strings.Builder + for j := start; j < i && j < len(t); j++ { + tok := t.at(j) + if j > start && (tok.kind == 'w' || tok.kind == 'q' || tok.kind == 'n' || tok.kind == 's') && (t.at(j-1).kind == 'w' || t.at(j-1).kind == 'q' || t.isOp(j-1, ",")) { + b.WriteByte(' ') + } + b.WriteString(tok.text) + } + return b.String() +} + +// valuesPosition reports, for a parameter inside an INSERT's VALUES, the +// index of the column it is a value for, counting positions within its +// row. +func (t text) valuesPosition(k string) (int, bool) { + i := t.find(k) + if i < 0 { + return 0, false + } + for j := 0; j < len(t); j++ { + if t.isOp(j, "(") { + j = t.group(j) + continue + } + if !t.isWord(j, "values") { + continue + } + // Rows follow, each a parenthesised list. + for r := j + 1; t.isOp(r, "("); r = t.group(r) + 2 { + end := t.group(r) + if i < r || i > end { + if !t.isOp(end+1, ",") { + break + } + continue + } + pos, depth := 0, 0 + for q := r + 1; q < i; q++ { + switch { + case t.isOp(q, "("): + depth++ + case t.isOp(q, ")"): + depth-- + case t.isOp(q, ",") && depth == 0: + pos++ + } + } + return pos, true + } + return 0, false + } + return 0, false +} + +// insertColumns lists the columns an INSERT names, or nil for all. +func (t text) insertColumns() []string { + for i := 0; i < len(t); i++ { + if t.isWord(i, "into") { + _, j := t.readRef(i + 1) + if t.isWord(j, "as") { + j += 2 + } else if t.isName(j) && !clauseKeywords[strings.ToLower(t.at(j).text)] { + j++ + } + if !t.isOp(j, "(") { + return nil + } + var cols []string + for q := j + 1; q < t.group(j); q++ { + if t.isName(q) { + cols = append(cols, t.at(q).text) + } + } + return cols + } + } + return nil +} diff --git a/internal/goldeneye/duckdb/types.go b/internal/goldeneye/duckdb/types.go new file mode 100644 index 0000000000..f97cb7608c --- /dev/null +++ b/internal/goldeneye/duckdb/types.go @@ -0,0 +1,220 @@ +package duckdb + +import ( + "sort" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" +) + +// parseType reads a type the way DuckDB spells one — DECIMAL(10,2), +// INTEGER[], INTEGER[3], STRUCT(a INTEGER, b VARCHAR), MAP(VARCHAR, +// INTEGER), UNION(num INTEGER, str VARCHAR), ENUM('a', 'b'), TIMESTAMP +// WITH TIME ZONE — into an expression in lower case, named the way the +// dialect names it when the spelling is one of the aliases types.jsonl +// lists. DuckDB spells an enum column by its labels whether the schema +// named the type or not, so labels that are those of an enum the schema +// created name that type. +func (a *analyzer) parseType(s string) *analysis.TypeExpr { + return a.parseTypeWith(s, true) +} + +// parseTypeWith reads a type, naming an alias as the dialect does when +// canonical is set and as DuckDB spells it otherwise. +func (a *analyzer) parseTypeWith(s string, canonical bool) *analysis.TypeExpr { + s = strings.TrimSpace(s) + if strings.HasSuffix(s, "]") { + open := strings.LastIndexByte(s, '[') + if open > 0 { + t := &analysis.TypeExpr{Name: "array", Args: []analysis.TypeArg{{Type: a.parseTypeWith(s[:open], canonical)}}} + if n, err := strconv.ParseInt(strings.TrimSpace(s[open+1:len(s)-1]), 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } + return t + } + } + name, args := s, "" + if open := strings.IndexByte(s, '('); open >= 0 && strings.HasSuffix(s, ")") { + name, args = strings.TrimSpace(s[:open]), s[open+1:len(s)-1] + } + name = strings.ToLower(name) + if c, ok := a.canonical[name]; ok && canonical { + name = c + } + t := &analysis.TypeExpr{Name: name} + if args == "" { + return t + } + switch name { + case "struct", "union": + for _, f := range splitTop(args, ',') { + f = strings.TrimSpace(f) + label, typ := f, "" + if strings.HasPrefix(f, `"`) { + end := quotedEnd(f, 0) + label, typ = strings.ReplaceAll(f[1:end-1], `""`, `"`), f[end:] + } else if i := strings.IndexByte(f, ' '); i > 0 { + label, typ = f[:i], f[i+1:] + } + t.Args = append(t.Args, analysis.TypeArg{Label: label, Type: a.parseTypeWith(typ, canonical)}) + } + case "enum": + var labels []string + for _, l := range splitTop(args, ',') { + l = strings.TrimSpace(l) + if strings.HasPrefix(l, "'") && strings.HasSuffix(l, "'") && len(l) >= 2 { + l = strings.ReplaceAll(l[1:len(l)-1], "''", "'") + } + labels = append(labels, l) + } + if named, ok := a.enumNamed(labels); ok { + return &analysis.TypeExpr{Name: named} + } + for _, l := range labels { + l := l + t.Args = append(t.Args, analysis.TypeArg{String: &l}) + } + default: + for _, arg := range splitTop(args, ',') { + arg = strings.TrimSpace(arg) + if n, err := strconv.ParseInt(arg, 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } else { + t.Args = append(t.Args, analysis.TypeArg{Type: a.parseTypeWith(arg, canonical)}) + } + } + } + return t +} + +// enumNamed finds the enum type the schema created with these labels, +// the first by name when two share them. +func (a *analyzer) enumNamed(labels []string) (string, bool) { + names := make([]string, 0, len(a.enums)) + for name := range a.enums { + names = append(names, name) + } + sort.Strings(names) + for _, name := range names { + have := a.enums[name] + if len(have) != len(labels) { + continue + } + same := true + for i := range have { + if have[i] != labels[i] { + same = false + break + } + } + if same { + return name, true + } + } + return "", false +} + +// splitTop splits on a separator outside parentheses, brackets and +// quotes. +func splitTop(s string, sep byte) []string { + var out []string + depth, start := 0, 0 + var quote byte + for i := 0; i < len(s); i++ { + c := s[i] + switch { + case quote != 0: + if c == quote { + quote = 0 + } + case c == '\'' || c == '"': + quote = c + case c == '(' || c == '[': + depth++ + case c == ')' || c == ']': + depth-- + case c == sep && depth == 0: + out = append(out, s[start:i]) + start = i + 1 + } + } + return append(out, s[start:]) +} + +// zero is a value of a type, spelled as a string DuckDB casts to the type: +// what a parameter is bound to when the query is run to see which of its +// columns can be NULL. A type no value is known for reports false, and +// the parameter is bound to NULL. +func (a *analyzer) zero(t *analysis.TypeExpr) (string, bool) { + if t == nil { + return "", false + } + switch t.Name { + case "tinyint", "smallint", "integer", "bigint", "hugeint", "utinyint", "usmallint", "uinteger", "ubigint", "uhugeint", + "decimal", "float", "double", "bignum", "varint": + return "1", true + case "varchar", "text", "char", "bpchar": + return "x", true + case "json": + return "{}", true + case "blob": + return "", true + case "bit": + return "0", true + case "boolean": + return "true", true + case "uuid": + return "00000000-0000-0000-0000-000000000000", true + case "date": + return "2000-01-01", true + case "time", "time with time zone": + return "00:00:00", true + case "timestamp", "timestamp with time zone", "timestamp_s", "timestamp_ms", "timestamp_ns", "datetime": + return "2000-01-01 00:00:00", true + case "interval": + return "1 day", true + case "map": + return "{}", true + case "array": + if len(t.Args) == 0 || t.Args[0].Type == nil { + return "", false + } + elem, ok := a.zero(t.Args[0].Type) + if !ok { + return "", false + } + n := 1 + if len(t.Args) > 1 && t.Args[1].Int != nil { + n = int(*t.Args[1].Int) + } + elems := make([]string, n) + for i := range elems { + elems[i] = elem + } + return "[" + strings.Join(elems, ", ") + "]", true + case "struct": + var fields []string + for _, f := range t.Args { + v, ok := a.zero(f.Type) + if !ok { + return "", false + } + fields = append(fields, f.Label+": "+v) + } + return "{" + strings.Join(fields, ", ") + "}", true + case "union": + if len(t.Args) == 0 { + return "", false + } + return a.zero(t.Args[0].Type) + case "enum": + if len(t.Args) > 0 && t.Args[0].String != nil { + return *t.Args[0].String, true + } + } + if labels, ok := a.enums[t.Name]; ok && len(labels) > 0 { + return labels[0], true + } + return "", false +} diff --git a/internal/goldeneye/endtoend/endtoend.go b/internal/goldeneye/endtoend/endtoend.go new file mode 100644 index 0000000000..0beb494456 --- /dev/null +++ b/internal/goldeneye/endtoend/endtoend.go @@ -0,0 +1,140 @@ +// Package endtoend finds the analyze cases under internal/endtoend/testdata +// and compares an engine's own answer with the output a case committed, +// the way the dialect package compares a generated dialect with the +// committed one. +package endtoend + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "os" + "path/filepath" + "runtime" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Case is one analyze case: the files sqlc analyze ran with, the fixture +// loaded before the queries run against a real database, and the output +// sqlc committed. +type Case struct { + Name string // analyze_params/clickhouse + Dir string + Schema string + Query string + Fixture string // empty when the case has no fixture.sql + Output string +} + +// Testdata returns the end-to-end testdata directory, found relative to this +// source file so the working directory does not matter. +func Testdata() (string, error) { + _, file, _, ok := runtime.Caller(0) + if !ok { + return "", errors.New("cannot locate the testcheck source directory") + } + dir := filepath.Join(filepath.Dir(file), "..", "..", "endtoend", "testdata") + if _, err := os.Stat(dir); err != nil { + return "", err + } + return filepath.Clean(dir), nil +} + +// Cases lists the analyze cases for an engine: every analyze_*/ +// directory whose exec.json runs the analyze command. A case that asks for +// the AST is skipped, since only sqlc can print that. +func Cases(engine string) ([]Case, error) { + root, err := Testdata() + if err != nil { + return nil, err + } + dirs, err := filepath.Glob(filepath.Join(root, "analyze_*", engine)) + if err != nil { + return nil, err + } + var cases []Case + for _, dir := range dirs { + c, ok, err := load(dir) + if err != nil { + return nil, fmt.Errorf("%s: %w", dir, err) + } + if ok { + cases = append(cases, c) + } + } + return cases, nil +} + +func load(dir string) (Case, bool, error) { + blob, err := os.ReadFile(filepath.Join(dir, "exec.json")) + if errors.Is(err, os.ErrNotExist) { + return Case{}, false, nil + } + if err != nil { + return Case{}, false, err + } + var exec struct { + Command string `json:"command"` + Args []string `json:"args"` + } + if err := json.Unmarshal(blob, &exec); err != nil { + return Case{}, false, fmt.Errorf("exec.json: %w", err) + } + if exec.Command != "analyze" { + return Case{}, false, nil + } + var schema, query string + for i := 0; i < len(exec.Args); i++ { + switch arg := exec.Args[i]; arg { + case "--schema", "-s", "--dialect", "-d": + i++ + if arg == "--schema" || arg == "-s" { + if i < len(exec.Args) { + schema = exec.Args[i] + } + } + case "--ast": + return Case{}, false, nil + default: + if !strings.HasPrefix(arg, "-") { + query = arg + } + } + } + if schema == "" || query == "" { + return Case{}, false, errors.New("exec.json: analyze needs --schema and a query file") + } + c := Case{ + Name: filepath.Join(filepath.Base(filepath.Dir(dir)), filepath.Base(dir)), + Dir: dir, + Schema: filepath.Join(dir, schema), + Query: filepath.Join(dir, query), + Output: filepath.Join(dir, "stdout.json"), + } + if fixture := filepath.Join(dir, "fixture.sql"); fileExists(fixture) { + c.Fixture = fixture + } + return c, true, nil +} + +func fileExists(path string) bool { + _, err := os.Stat(path) + return err == nil +} + +// Compare checks an engine's answer against the case's committed output +// byte for byte and returns a line diff when they differ, or "" when they +// match. +func (c Case) Compare(got []byte) (string, error) { + want, err := os.ReadFile(c.Output) + if err != nil { + return "", err + } + if bytes.Equal(want, got) { + return "", nil + } + return dialect.Diff(string(want), string(got)), nil +} diff --git a/internal/goldeneye/endtoend/query.go b/internal/goldeneye/endtoend/query.go new file mode 100644 index 0000000000..70a8ae7658 --- /dev/null +++ b/internal/goldeneye/endtoend/query.go @@ -0,0 +1,183 @@ +package endtoend + +import ( + "fmt" + "os" + "regexp" + "strings" + "unicode" +) + +// Query is one entry of a sqlc query file. +type Query struct { + Name string + Cmd string + SQL string +} + +// Queries reads the case's query file and splits it into its queries. +func (c Case) Queries() ([]Query, error) { + src, err := os.ReadFile(c.Query) + if err != nil { + return nil, err + } + queries, err := ParseQueries(string(src)) + if err != nil { + return nil, fmt.Errorf("%s: %w", c.Query, err) + } + return queries, nil +} + +var headerRe = regexp.MustCompile(`^\s*--\s*name:\s*(\S+)\s+(:\S+)\s*$`) + +// ParseQueries splits a sqlc query file on its `-- name: X :cmd` headers. +func ParseQueries(src string) ([]Query, error) { + var queries []Query + var cur *Query + var body []string + flush := func() error { + if cur == nil { + return nil + } + sql := strings.TrimSpace(strings.Join(body, "\n")) + sql = strings.TrimRight(sql, "; \t\r\n") + if sql == "" { + return fmt.Errorf("query %s has no body", cur.Name) + } + cur.SQL = sql + queries = append(queries, *cur) + return nil + } + for _, line := range strings.Split(src, "\n") { + if m := headerRe.FindStringSubmatch(line); m != nil { + if err := flush(); err != nil { + return nil, err + } + cur = &Query{Name: m[1], Cmd: m[2]} + body = body[:0] + continue + } + if cur != nil { + body = append(body, line) + } + } + if err := flush(); err != nil { + return nil, err + } + if len(queries) == 0 { + return nil, fmt.Errorf("no queries found: expected `-- name: Name :cmd` headers") + } + return queries, nil +} + +var namedArgRe = regexp.MustCompile(`^sqlc\.(n?arg|slice)\(\s*'?([A-Za-z_][A-Za-z0-9_]*)'?\s*\)`) + +// typedParamRe matches ClickHouse's {name:Type} parameter, whose type is +// the query's own business: the engine binds it as it binds any other. +var typedParamRe = regexp.MustCompile(`^\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*:\s*[^}]+\}`) + +// Rewrite replaces every parameter reference in a query — ?, sqlc.arg(name), +// sqlc.narg(name), sqlc.slice(name) and ClickHouse's {name:Type} — with +// what bind returns for it, in order of appearance, skipping string +// literals, quoted identifiers and comments. bind is handed the name, empty for a ?, and the word before the +// reference, so that a LIMIT or OFFSET can be bound differently from a +// value; the second count of a LIMIT ?, ? is handed LIMIT as well. Each +// engine decides what a reference becomes and how the references are +// numbered. +func Rewrite(sql string, bind func(name, lastWord string) string) string { + var ( + out strings.Builder + lastWord string + i = 0 + ) + for i < len(sql) { + c := sql[i] + switch { + case c == '\'' || c == '"' || c == '`': + end := skipQuoted(sql, i) + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "--"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + end = len(sql) + } else { + end += i + } + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + end = len(sql) + } else { + end += i + 2 + } + out.WriteString(sql[i:end]) + i = end + case c == '?': + out.WriteString(bind("", lastWord)) + lastWord = afterReference(lastWord) + i++ + case c == 's' && namedArgRe.MatchString(sql[i:]): + m := namedArgRe.FindStringSubmatch(sql[i:]) + out.WriteString(bind(m[2], lastWord)) + lastWord = afterReference(lastWord) + i += len(m[0]) + case c == '{' && typedParamRe.MatchString(sql[i:]): + m := typedParamRe.FindStringSubmatch(sql[i:]) + out.WriteString(bind(m[1], lastWord)) + lastWord = afterReference(lastWord) + i += len(m[0]) + case isWordByte(c): + end := i + for end < len(sql) && isWordByte(sql[end]) { + end++ + } + lastWord = sql[i:end] + out.WriteString(lastWord) + i = end + default: + if !unicode.IsSpace(rune(c)) && c != ',' && c != '(' { + lastWord = "" + } + out.WriteByte(c) + i++ + } + } + return out.String() +} + +// afterReference is the word the reference after one is preceded by: a +// LIMIT's, so that both counts of LIMIT ?, ? are bound as counts, and +// otherwise none. +func afterReference(lastWord string) string { + if strings.EqualFold(lastWord, "limit") { + return lastWord + } + return "" +} + +func isWordByte(c byte) bool { + return c == '_' || c == '.' || c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' +} + +// skipQuoted returns the index just past the quoted token starting at i, +// honouring backslash escapes and doubled quotes. +func skipQuoted(s string, i int) int { + q := s[i] + j := i + 1 + for j < len(s) { + switch { + case s[j] == '\\' && j+1 < len(s): + j += 2 + case s[j] == q && j+1 < len(s) && s[j+1] == q: + j += 2 + case s[j] == q: + return j + 1 + default: + j++ + } + } + return len(s) +} diff --git a/internal/goldeneye/go.mod b/internal/goldeneye/go.mod new file mode 100644 index 0000000000..bbeb0a0da5 --- /dev/null +++ b/internal/goldeneye/go.mod @@ -0,0 +1,52 @@ +module github.com/sqlc-dev/sqlc/internal/goldeneye + +go 1.26.0 + +require ( + cloud.google.com/go/spanner v1.96.1 + github.com/go-sql-driver/mysql v1.10.1 + github.com/jackc/pgx/v5 v5.11.0 + github.com/microsoft/go-mssqldb v1.11.2 + google.golang.org/api v0.304.0 + google.golang.org/grpc v1.84.0 + google.golang.org/protobuf v1.36.12 +) + +require ( + cloud.google.com/go v0.123.0 // indirect + cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a // indirect + cloud.google.com/go/auth/oauth2adapt v0.3.0 // indirect + cloud.google.com/go/compute/metadata v0.10.0 // indirect + cloud.google.com/go/iam v1.12.0 // indirect + cloud.google.com/go/longrunning v1.2.0 // indirect + filippo.io/edwards25519 v1.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/felixge/httpsnoop v1.1.0 // indirect + github.com/go-logr/logr v1.4.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/google/s2a-go v0.1.11 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.23 // indirect + github.com/googleapis/gax-go/v2 v2.26.2 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/shopspring/decimal v1.6.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 // indirect + go.opentelemetry.io/otel v1.45.0 // indirect + go.opentelemetry.io/otel/metric v1.45.0 // indirect + go.opentelemetry.io/otel/trace v1.45.0 // indirect + golang.org/x/crypto v0.58.0 // indirect + golang.org/x/net v0.61.0 // indirect + golang.org/x/oauth2 v0.37.0 // indirect + golang.org/x/sync v0.24.0 // indirect + golang.org/x/sys v0.49.0 // indirect + golang.org/x/text v0.43.0 // indirect + golang.org/x/time v0.16.0 // indirect + google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8 // indirect +) diff --git a/internal/goldeneye/go.sum b/internal/goldeneye/go.sum new file mode 100644 index 0000000000..c64eb846a0 --- /dev/null +++ b/internal/goldeneye/go.sum @@ -0,0 +1,137 @@ +cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= +cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= +cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a h1:jW1ZLFy9oa5ai8LOI40z6s+DL1cO/L1KSm9hVGnibn8= +cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a/go.mod h1:1dmBXa9xfBvBr39ZnDUDkaaA91ccq9CcqENDgJA4d7c= +cloud.google.com/go/auth/oauth2adapt v0.3.0 h1:FY8oSZpCYoUNv6QxVODuMjQz4IlSOVeiQtZ08vLPz88= +cloud.google.com/go/auth/oauth2adapt v0.3.0/go.mod h1:7+2uCm7++XFO+/lN06c2HXpDXb/NMNn2/UwyBPbTnkk= +cloud.google.com/go/compute/metadata v0.10.0 h1:pyKMUQSwchgkIBBJGdILqQbs/BNJXqwSA7Ej6LAvvtY= +cloud.google.com/go/compute/metadata v0.10.0/go.mod h1:rGFHRrIif570kSibjFTMbt6/4/tzgJWFGI/HVol4GIk= +cloud.google.com/go/iam v1.12.0 h1:Aki3bX9aHUDKPHfnRJfDcTdVedvy6quGBQcTqx3DRXk= +cloud.google.com/go/iam v1.12.0/go.mod h1:FEZ4lXpADAC2AIpQY7LANNjjwyQ2jK439CI2VaD+sLY= +cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM= +cloud.google.com/go/longrunning v1.2.0/go.mod h1:5KMQALFGOCtFoi2xSOA1u3H7WKlhmckgiyFw7+LGQp0= +cloud.google.com/go/spanner v1.96.1 h1:pLmq5/Fj+Yu6YGRBz9oMPm3ZRQIeG14FYBWFwhZZaIA= +cloud.google.com/go/spanner v1.96.1/go.mod h1:VqMSp/YlTofUq1q6ekkXBAmhAs6X860YL0I8wo7i+k0= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1 h1:zvXfGJCWvywnCA814d8ZiVyt+fm9nnTE8xSb99zRyfo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.1/go.mod h1:iptorS+VYKFL2N6PnebpS91dubG35eAOEERnT4PJbQU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1 h1:u93s+zU2JD62im61Bm5CZIc1ZrOJaIAWEg0WOrMVkEo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1/go.mod h1:oXtinPO4OLj9d1DOTrqrL1oRwGhcqadvAmrl6wTeGlk= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 h1:MaKvxE6D0KkjOg6Wd9M00iqP5PR0kUxCfiezes4JweM= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0/go.mod h1:i2h9fsTFKZorh8RdV2IcSUf/Qj98GlTkrTvUbX/s8as= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 h1:Nljr4q1GRA/5vCrMONS+g4u4LRHNgOXVSh3O43J2CnI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0/go.mod h1:Y33QHnf0FfdVewFFISOGe20mkZbxX4H839o955/PoeI= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= +github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME= +github.com/go-sql-driver/mysql v1.10.1/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/s2a-go v0.1.11 h1:7v1V1TraNGP63WptsAkNqr2w8jgm4vM6A6qx6Lsw9iM= +github.com/google/s2a-go v0.1.11/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.23 h1:J+VGF1wjAM2dU2kKUXZxJdDppRLReWP7KWcclfngQhc= +github.com/googleapis/enterprise-certificate-proxy v0.3.23/go.mod h1:Y8NO/15GNLkrXI3OR5xOFmeU3XLX1sLSdtlXgJ0zmIw= +github.com/googleapis/gax-go/v2 v2.26.2 h1:ydkmNXxj7bEmmeK5AihkKnWxyOyBR9TDebvp5L5izk8= +github.com/googleapis/gax-go/v2 v2.26.2/go.mod h1:sMKqnMesnKH+3wiRJROcttA+cJoZoGbZl1vDQ8XYtGk= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.11.0 h1:IzBBtyK9AHqf98cctWFifYSci2hgQR/cd56wB4p+ogg= +github.com/jackc/pgx/v5 v5.11.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/microsoft/go-mssqldb v1.11.2 h1:FCgeBIK8um2+X4tbun6Q71N1KsfyCDPKY41e1yGVjSE= +github.com/microsoft/go-mssqldb v1.11.2/go.mod h1:CYgwG5AMXFojbjTg+GNP5G/y6uz1BhTyZaPqQWzkGnQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/shopspring/decimal v1.6.0 h1:DcTwjCj4tJPLuGZYsR9W0hyX9pQwMIkdo26Ig1T9xX4= +github.com/shopspring/decimal v1.6.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI= +go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= +go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= +go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= +go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= +go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o= +go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= +go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= +go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= +golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= +golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= +golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE= +golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/api v0.304.0 h1:2R1dYSiIVQRGcKN901u9yPFEdJu5h90oGY5X4TcgbmA= +google.golang.org/api v0.304.0/go.mod h1:dcjRWAy1QdjGb3Z67Qu0gdBWH2gL8Qoy/RI2ZVuvdeE= +google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d h1:C9v1o0/4quuhOAfmRXA2j+we0PqZIp8traLdeogF3Ms= +google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d/go.mod h1:Wz2wFJntZFmLGo7pLDXZ3wYk5hyc0Mb+SkHhDDXT+lU= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d h1:QwnJwPte4XXAkhPu26LTDIahnsMSUV0kK8HkxbC+Pc4= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d/go.mod h1:WRrQ7/7N19PypuT0fxLOL5Lq0waoiRri4FbtHDEKrGE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8 h1:0SXBqli5dnuCKMjI/X3FM226zEaEa0GUcSCJtN1vL2o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0= +google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/goldeneye/mssql/analyze.go b/internal/goldeneye/mssql/analyze.go new file mode 100644 index 0000000000..e4caaf640e --- /dev/null +++ b/internal/goldeneye/mssql/analyze.go @@ -0,0 +1,725 @@ +package mssql + +import ( + "context" + "database/sql" + "fmt" + "os" + "regexp" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// The analyze cases are checked against a live server, which is asked +// three things about each query, none of which runs it. What a driver +// would see: sys.dm_exec_describe_first_result_set describes each result +// column — its name, its type spelled the way a declaration spells it, +// whether it can be NULL, and which table column it is read from. What +// each parameter would be: sp_describe_undeclared_parameters says what +// type the server would give each parameter the query leaves undeclared. +// And what each parameter stands in for: the estimated showplan, compiled +// with the parameters declared as those types, says which column each is +// compared with or assigned to, and a parameter with such a partner is +// described as that column, from the catalog of the case's database. +// +// Two things the describing function keeps to itself: a json or vector +// column is described by the nvarchar(max) it is sent to a driver as, so +// a column read from a table is typed from the catalog instead, and a +// type SQL Server calls timestamp is written as the rowversion the +// dialect names it. + +// placeholder is one parameter of a query as sqlc numbers them: each ? +// in turn, and each @name or sqlc.arg name once, at its first appearance. +// Each appearance becomes a variable of its own, since the server +// describes an undeclared parameter only when it is used once. +type placeholder struct { + Number int + Name string + Vars []string // the variables its appearances became, without the @ +} + +var identRe = regexp.MustCompile(`^@([A-Za-z_][A-Za-z0-9_]*)`) + +// bind rewrites the query so that every parameter is a variable used once, +// and lists the parameters in sqlc's order. The query's own @name +// references are kept, since that is how sqlc's SQL Server queries name +// their parameters; a sqlc.arg becomes one, and each ? in turn becomes +// one named after its position. +func bind(query string) (string, []placeholder) { + positional := 0 + sql := endtoend.Rewrite(query, func(name, _ string) string { + if name == "" { + positional++ + name = "p" + strconv.Itoa(positional) + } + return "@" + name + }) + var ( + phs []placeholder + numbers = map[string]int{} + out strings.Builder + ) + i := 0 + for i < len(sql) { + c := sql[i] + switch { + case c == '\'' || c == '"' || c == '[': + end := skipQuoted(sql, i) + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "--"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + end = len(sql) + } else { + end += i + } + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + end = len(sql) + } else { + end += i + 2 + } + out.WriteString(sql[i:end]) + i = end + case c == '@' && (i == 0 || !isWordByte(sql[i-1])) && identRe.MatchString(sql[i:]): + m := identRe.FindStringSubmatch(sql[i:]) + name := m[1] + n, ok := numbers[name] + if !ok { + n = len(phs) + 1 + numbers[name] = n + phs = append(phs, placeholder{Number: n, Name: name}) + } + ph := &phs[n-1] + v := name + if k := len(ph.Vars); k > 0 { + v = fmt.Sprintf("%s__%d", name, k+1) + } + ph.Vars = append(ph.Vars, v) + out.WriteString("@" + v) + i += len(m[0]) + default: + out.WriteByte(c) + i++ + } + } + return out.String(), phs +} + +func isWordByte(c byte) bool { + return c == '_' || c == '@' || c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' +} + +// skipQuoted returns the index just past the quoted token starting at i: a +// string, a double-quoted identifier or a bracketed one, whose closing +// delimiter is escaped by doubling it. +func skipQuoted(s string, i int) int { + open := s[i] + close := open + if open == '[' { + close = ']' + } + j := i + 1 + for j < len(s) { + switch { + case s[j] == close && j+1 < len(s) && s[j+1] == close: + j += 2 + case s[j] == close: + return j + 1 + default: + j++ + } + } + return len(s) +} + +// splitStatements splits a script into the statements it is made of, on +// the semicolons outside strings, brackets, comments and BEGIN ... END +// blocks, and on the GO lines a T-SQL script separates batches with. A +// CREATE TYPE has to be its own batch before a table can use the type, so +// a schema is loaded one statement at a time; a trigger or procedure +// body keeps its semicolons, since a BEGIN, or a CASE, opens a block that +// its END closes. +func splitStatements(src string) []string { + var stmts []string + flush := func(s string) { + if s = strings.TrimSpace(s); s != "" && !strings.EqualFold(s, "go") { + stmts = append(stmts, s) + } + } + start := 0 + i := 0 + depth := 0 + if isGoLine(src, 0) { + for i < len(src) && src[i] != '\n' { + i++ + } + start = i + } + for i < len(src) { + c := src[i] + switch { + case c == '\'' || c == '"' || c == '[': + i = skipQuoted(src, i) + case strings.HasPrefix(src[i:], "--"): + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + i = len(src) + } else { + i += end + } + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + i = len(src) + } else { + i += end + 2 + } + case isWordByte(c): + end := i + for end < len(src) && isWordByte(src[end]) { + end++ + } + switch word := strings.ToLower(src[i:end]); word { + case "begin": + // BEGIN TRAN[SACTION] and BEGIN DISTRIBUTED are statements, + // not blocks. + if !nextWordIn(src, end, "tran", "transaction", "distributed") { + depth++ + } + case "case": + depth++ + case "end": + if depth > 0 { + depth-- + } + } + i = end + case c == ';' && depth == 0: + flush(src[start:i]) + start = i + 1 + i++ + case c == '\n' && isGoLine(src, i+1): + flush(src[start:i]) + i++ + for i < len(src) && src[i] != '\n' { + i++ + } + start = i + depth = 0 + default: + i++ + } + } + flush(src[start:]) + return stmts +} + +// nextWordIn reports whether the word after position i, past spaces and +// comments, is one of the words. +func nextWordIn(src string, i int, words ...string) bool { + for i < len(src) { + switch { + case src[i] == ' ' || src[i] == '\t' || src[i] == '\n' || src[i] == '\r': + i++ + case strings.HasPrefix(src[i:], "--"): + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + return false + } + i += end + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + return false + } + i += end + 2 + default: + end := i + for end < len(src) && isWordByte(src[end]) { + end++ + } + for _, w := range words { + if strings.EqualFold(src[i:end], w) { + return true + } + } + return false + } + } + return false +} + +// isGoLine reports whether the line starting at i is a GO batch separator. +func isGoLine(src string, i int) bool { + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + end = len(src) + } else { + end += i + } + return strings.EqualFold(strings.TrimSpace(src[i:end]), "go") +} + +// column is what the catalog says about a column of the case's database. +type column struct { + name string + typ *analysis.TypeExpr + nullable bool +} + +// relation is a table or view of the case's database, by schema and name, +// in lower case. +type relation struct { + schema, name string +} + +// analyzer holds the session a case is described in and the catalog of +// the case's database. +type analyzer struct { + conn *sql.Conn + catalog map[relation][]column + // userTypes are the alias types the schema created, by name in lower + // case, which the server reports beside the system type they stand on + // and the dialect reports by their own name. + userTypes map[string]bool + // canonical names the type the dialect reports a spelling as, for each + // alias types.jsonl lists: SQL Server spells numeric and timestamp in + // its catalog, which the dialect names decimal and rowversion. + canonical map[string]string +} + +var dbNameRe = regexp.MustCompile(`[^A-Za-z0-9_]+`) + +// Analyze loads a case's schema and fixture into a database of their own +// on the server, describes its queries there and returns what SQL Server +// reports in the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, dsn string, c endtoend.Case) ([]byte, error) { + conn, err := open(ctx, dsn) + if err != nil { + return nil, err + } + defer conn.Close() + if err := checkVersion(ctx, conn); err != nil { + return nil, err + } + + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + + db := quote("goldeneye_" + dbNameRe.ReplaceAllString(c.Name, "_")) + for _, stmt := range []string{ + "USE master", + "DROP DATABASE IF EXISTS " + db, + "CREATE DATABASE " + db, + "USE " + db, + } { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, err + } + } + defer conn.ExecContext(context.WithoutCancel(ctx), "USE master; DROP DATABASE IF EXISTS "+db) + for _, stmt := range splitStatements(string(schema)) { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Schema, err) + } + } + for _, stmt := range splitStatements(string(fixture)) { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Fixture, err) + } + } + + a := &analyzer{conn: conn} + if a.canonical, err = readAliases(); err != nil { + return nil, err + } + if err := a.readCatalog(ctx); err != nil { + return nil, err + } + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := a.analyzeQuery(ctx, q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return analysis.Encode(out) +} + +// readAliases reads the aliases the hand-written types.jsonl gives each +// type, keyed by alias. +func readAliases() (map[string]string, error) { + dir, err := dialect.Dir(Engine) + if err != nil { + return nil, err + } + types, err := dialect.ReadTypes(dir) + if err != nil { + return nil, err + } + canonical := map[string]string{} + for _, t := range types { + for _, alias := range t.Aliases { + canonical[strings.ToLower(alias)] = strings.ToLower(t.Name) + } + } + return canonical, nil +} + +// Check compares what SQL Server reports for a case with the output the +// case committed, returning a diff when they differ. +func Check(ctx context.Context, dsn string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, dsn, c) + if err != nil { + return "", err + } + return c.Compare(got) +} + +// tablesQuery lists the tables and views of the current database, and the +// columns of each: the type as the schema declared it, whether that is a +// type the schema created, and the dimensions of a vector, which is all +// the describing function does not say. +const tablesQuery = ` +SELECT s.name, o.name, c.name, t.name, t.is_user_defined, c.vector_dimensions +FROM sys.columns c +JOIN sys.objects o ON o.object_id = c.object_id +JOIN sys.schemas s ON s.schema_id = o.schema_id +JOIN sys.types t ON t.user_type_id = c.user_type_id +WHERE o.type IN ('U', 'V') +ORDER BY s.name, o.name, c.column_id` + +// readCatalog reads the tables the schema created. The server spells each +// column's type by describing a SELECT * from the table, and the catalog +// says which columns that spelling is not the declared type of. +func (a *analyzer) readCatalog(ctx context.Context) error { + a.catalog = map[relation][]column{} + a.userTypes = map[string]bool{} + rows, err := a.conn.QueryContext(ctx, tablesQuery) + if err != nil { + return err + } + type declared struct { + name string + typeName string + userDefined bool + dimensions sql.NullInt64 + } + decls := map[relation][]declared{} + var order []relation + for rows.Next() { + var ( + schema, table, col string + d declared + ) + if err := rows.Scan(&schema, &table, &col, &d.typeName, &d.userDefined, &d.dimensions); err != nil { + rows.Close() + return err + } + d.name = col + rel := relation{strings.ToLower(schema), strings.ToLower(table)} + if _, ok := decls[rel]; !ok { + order = append(order, rel) + } + decls[rel] = append(decls[rel], d) + if d.userDefined { + a.userTypes[strings.ToLower(d.typeName)] = true + } + } + rows.Close() + if err := rows.Err(); err != nil { + return err + } + for _, rel := range order { + described, err := a.describe(ctx, "SELECT * FROM "+quote(rel.schema)+"."+quote(rel.name)) + if err != nil { + return fmt.Errorf("%s.%s: %w", rel.schema, rel.name, err) + } + byName := map[string]declared{} + for _, d := range decls[rel] { + byName[strings.ToLower(d.name)] = d + } + var cols []column + for _, dc := range described { + d, ok := byName[strings.ToLower(dc.name)] + if !ok { + return fmt.Errorf("%s.%s: the server describes a column %q the catalog does not list", rel.schema, rel.name, dc.name) + } + t := dc.typ + switch { + case d.userDefined: + t = &analysis.TypeExpr{Name: strings.ToLower(d.typeName)} + case strings.EqualFold(d.typeName, "json"): + t = &analysis.TypeExpr{Name: "json"} + case strings.EqualFold(d.typeName, "vector") && d.dimensions.Valid: + n := d.dimensions.Int64 + t = &analysis.TypeExpr{Name: "vector", Args: []analysis.TypeArg{{Int: &n}}} + } + cols = append(cols, column{name: strings.ToLower(dc.name), typ: t, nullable: dc.nullable}) + } + a.catalog[rel] = cols + } + return nil +} + +// described is one result column as sys.dm_exec_describe_first_result_set +// reports it. +type described struct { + name string + typ *analysis.TypeExpr + nullable bool + source *columnRef // the table column it is read from, or nil +} + +const describeColumnsQuery = ` +SELECT column_ordinal, name, system_type_name, user_type_name, is_nullable, + source_schema, source_table, source_column, is_computed_column, error_message +FROM sys.dm_exec_describe_first_result_set(@p1, NULL, 1) +WHERE is_hidden = 0 +ORDER BY column_ordinal` + +// describe asks the server what the first result set of a statement +// looks like. A statement that returns no rows describes as no columns; one +// the server cannot compile describes as its error. +func (a *analyzer) describe(ctx context.Context, query string) ([]described, error) { + rows, err := a.conn.QueryContext(ctx, describeColumnsQuery, query) + if err != nil { + return nil, err + } + defer rows.Close() + var out []described + for rows.Next() { + var ( + ordinal int + name, sysType, userType sql.NullString + nullable sql.NullBool + srcSchema, srcTable, srcColumn sql.NullString + computed sql.NullBool + errMsg sql.NullString + ) + if err := rows.Scan(&ordinal, &name, &sysType, &userType, &nullable, &srcSchema, &srcTable, &srcColumn, &computed, &errMsg); err != nil { + return nil, err + } + if errMsg.Valid { + return nil, fmt.Errorf("cannot be described: %s", errMsg.String) + } + d := described{ + name: name.String, + typ: a.typeOf(sysType.String, userType), + nullable: nullable.Bool, + } + // A computed column names the column it is computed from, as the + // one an update through the result set would write; a column is + // read from a table only when it is that column. + if srcTable.Valid && !computed.Bool { + d.source = &columnRef{schema: srcSchema.String, table: srcTable.String, column: srcColumn.String} + } + out = append(out, d) + } + return out, rows.Err() +} + +// typeOf reads a type the server spelled, which is the system type unless +// the server also names a type the schema created, which the dialect +// reports by that name and no argument. +func (a *analyzer) typeOf(systemType string, userType sql.NullString) *analysis.TypeExpr { + if userType.Valid && a.userTypes[strings.ToLower(userType.String)] { + return &analysis.TypeExpr{Name: strings.ToLower(userType.String)} + } + return parseType(systemType, a.canonical) +} + +// parseType reads a type spelled the way a declaration spells it — +// nvarchar(max), decimal(10,2), datetime2(7) — into an expression, named +// the way the dialect names it when the spelling is one of the aliases +// the dialect lists: numeric is decimal, timestamp is rowversion. +func parseType(s string, canonical map[string]string) *analysis.TypeExpr { + s = strings.TrimSpace(strings.ToLower(s)) + name, args := s, "" + if open := strings.IndexByte(s, '('); open >= 0 && strings.HasSuffix(s, ")") { + name, args = strings.TrimSpace(s[:open]), s[open+1:len(s)-1] + } + if c, ok := canonical[name]; ok { + name = c + } + t := &analysis.TypeExpr{Name: name} + if args == "" { + return t + } + for _, arg := range strings.Split(args, ",") { + arg = strings.TrimSpace(arg) + if n, err := strconv.ParseInt(arg, 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } else { + ident := arg + t.Args = append(t.Args, analysis.TypeArg{Ident: &ident}) + } + } + return t +} + +// withNullable copies a type with its nullability set. +func withNullable(t *analysis.TypeExpr, nullable bool) *analysis.TypeExpr { + if t == nil { + return nil + } + out := *t + out.Nullable = nullable + return &out +} + +// lookup finds a column of the case's database in the catalog. +func (a *analyzer) lookup(ref columnRef) (column, bool) { + cols, ok := a.catalog[relation{strings.ToLower(ref.schema), strings.ToLower(ref.table)}] + if !ok { + return column{}, false + } + for _, col := range cols { + if strings.EqualFold(col.name, ref.column) { + return col, true + } + } + return column{}, false +} + +// parameter is what sp_describe_undeclared_parameters says about one +// variable the statement leaves undeclared. +type parameter struct { + systemType string + userType sql.NullString +} + +// undeclaredParameters asks the server what type it would give each +// parameter, keyed by the variable's name without the @. +func (a *analyzer) undeclaredParameters(ctx context.Context, query string) (map[string]parameter, error) { + rows, err := a.conn.QueryContext(ctx, "EXEC sp_describe_undeclared_parameters @p1", query) + if err != nil { + return nil, err + } + defer rows.Close() + cols, err := rows.Columns() + if err != nil { + return nil, err + } + index := map[string]int{} + for i, c := range cols { + index[c] = i + } + params := map[string]parameter{} + for rows.Next() { + vals := make([]any, len(cols)) + ptrs := make([]any, len(cols)) + for i := range vals { + ptrs[i] = &vals[i] + } + if err := rows.Scan(ptrs...); err != nil { + return nil, err + } + str := func(col string) sql.NullString { + i, ok := index[col] + if !ok || vals[i] == nil { + return sql.NullString{} + } + return sql.NullString{String: fmt.Sprint(vals[i]), Valid: true} + } + name := strings.TrimPrefix(str("name").String, "@") + params[name] = parameter{ + systemType: str("suggested_system_type_name").String, + userType: str("suggested_user_type_name"), + } + } + return params, rows.Err() +} + +// analyzeQuery describes one query. +func (a *analyzer) analyzeQuery(ctx context.Context, q endtoend.Query) (analysis.Query, error) { + sql, phs := bind(q.SQL) + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + + described, err := a.describe(ctx, sql) + if err != nil { + return analysis.Query{}, err + } + for _, d := range described { + ac := analysis.Column{Name: strings.ToLower(d.name), Type: withNullable(d.typ, d.nullable)} + if d.source != nil { + if col, ok := a.lookup(*d.source); ok { + ac.Type = withNullable(col.typ, d.nullable) + } + ac.Table = strings.ToLower(d.source.table) + } + aq.Columns = append(aq.Columns, ac) + } + + if len(phs) == 0 { + return aq, nil + } + params, err := a.undeclaredParameters(ctx, sql) + if err != nil { + return analysis.Query{}, err + } + var decl []string + for _, ph := range phs { + for _, v := range ph.Vars { + p, ok := params[v] + if !ok { + return analysis.Query{}, fmt.Errorf("the server did not describe parameter @%s", v) + } + decl = append(decl, "@"+v+" "+p.systemType) + } + } + partners, err := a.partners(ctx, "DECLARE "+strings.Join(decl, ", ")+";\n"+sql) + if err != nil { + return analysis.Query{}, err + } + for _, ph := range phs { + ac := analysis.Column{} + found := false + for _, v := range ph.Vars { + ref, ok := partners[v] + if !ok { + continue + } + col, ok := a.lookup(ref) + if !ok { + continue + } + ac = analysis.Column{Name: col.name, Type: withNullable(col.typ, col.nullable), Table: strings.ToLower(ref.table)} + found = true + break + } + if !found { + p := params[ph.Vars[0]] + ac.Type = a.typeOf(p.systemType, p.userType) + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} diff --git a/internal/goldeneye/mssql/mssql.go b/internal/goldeneye/mssql/mssql.go new file mode 100644 index 0000000000..23c338a986 --- /dev/null +++ b/internal/goldeneye/mssql/mssql.go @@ -0,0 +1,153 @@ +// Package mssql generates the SQL Server dialect seed under +// internal/engine/mssql/dialect from a live server, and verifies the SQL +// Server analyze cases under internal/endtoend/testdata against the same +// server. +// +// SQL Server keeps no catalog of its built-in functions or operators — the +// intrinsic functions such as GETDATE and LEN are not objects — so +// types.jsonl and functions.jsonl are written by hand and are not this +// package's business. What it does describe is its catalog: relations.jsonl +// is every view of the sys and INFORMATION_SCHEMA schemas, with each view's +// columns as the server itself describes a SELECT * from it. +// +// The package also verifies the SQL Server analyze cases under +// internal/endtoend/testdata against the same server: each case's schema +// and fixture are loaded into a database of their own and its queries +// described there, without being run. Result columns come from +// sys.dm_exec_describe_first_result_set, which says what each column is +// called, what type it has, whether it can be NULL and which table column +// it is read from; parameters from sp_describe_undeclared_parameters, which +// says what type the server would give each, and from the estimated +// showplan, which says which column each is compared with or assigned to. +// The answer is printed in the JSON shape sqlc analyze prints and compared +// with the case's committed stdout.json byte for byte. +// +// The server is named by MSSQL_SERVER_URI, in any form the go-mssqldb +// driver accepts, such as +// sqlserver://sa:password@127.0.0.1:1433?encrypt=disable, and has to be +// the major release in Major, since each release adds to the catalog views. +package mssql + +import ( + "context" + "database/sql" + "errors" + "fmt" + "os" + "strconv" + "strings" + + _ "github.com/microsoft/go-mssqldb" + "github.com/microsoft/go-mssqldb/msdsn" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name sqlc knows the dialect by, and the name of the analyze +// case directories under internal/endtoend/testdata. +const Engine = "mssql" + +// Major is the SQL Server major release the dialect is generated from, as +// SERVERPROPERTY('ProductMajorVersion') reports it: 17 is SQL Server 2025. +// Bumping it is a deliberate change: every release adds views and columns +// to the catalog, so regenerate and review the dialect after changing it. +const Major = 17 + +// Locate returns the server to generate from, named by MSSQL_SERVER_URI. +func Locate() (string, error) { + dsn := os.Getenv("MSSQL_SERVER_URI") + if dsn == "" { + return "", errors.New("MSSQL_SERVER_URI is not set") + } + if _, err := msdsn.Parse(dsn); err != nil { + return "", fmt.Errorf("MSSQL_SERVER_URI: %w", err) + } + return dsn, nil +} + +// open connects to the server and holds one session, since a case's +// database is the session's current database and the showplan is a +// session setting. +func open(ctx context.Context, dsn string) (*sql.Conn, error) { + db, err := sql.Open("sqlserver", dsn) + if err != nil { + return nil, err + } + conn, err := db.Conn(ctx) + if err != nil { + db.Close() + return nil, err + } + return conn, nil +} + +// Version reports the release a server is. +func Version(ctx context.Context, dsn string) (string, error) { + conn, err := open(ctx, dsn) + if err != nil { + return "", err + } + defer conn.Close() + var v string + if err := conn.QueryRowContext(ctx, "SELECT @@VERSION").Scan(&v); err != nil { + return "", err + } + // The first line names the product and build; the rest is the copyright + // and the platform. + v, _, _ = strings.Cut(v, "\n") + return strings.TrimSpace(v), nil +} + +// checkVersion refuses a server of another major release than the dialect +// is generated from, whose catalog would differ from the committed one +// without anything being wrong. +func checkVersion(ctx context.Context, conn *sql.Conn) error { + var v string + if err := conn.QueryRowContext(ctx, "SELECT CAST(SERVERPROPERTY('ProductMajorVersion') AS nvarchar(10))").Scan(&v); err != nil { + return err + } + major, err := strconv.Atoi(v) + if err != nil { + return fmt.Errorf("ProductMajorVersion %q: %w", v, err) + } + if major != Major { + return fmt.Errorf("the dialect is generated from SQL Server major release %d, but the server is release %d", Major, major) + } + return nil +} + +// Generate reads the dialect from the server: relations.jsonl, the views of +// sys and INFORMATION_SCHEMA. They are read from a database of their own, +// since the views a query sees are the ones a user database has, and +// master lists internal views of its own that no query can name. +func Generate(ctx context.Context, dsn string) (dialect.Files, error) { + conn, err := open(ctx, dsn) + if err != nil { + return nil, err + } + defer conn.Close() + if err := checkVersion(ctx, conn); err != nil { + return nil, err + } + db := quote("goldeneye_dialect") + for _, stmt := range []string{ + "USE master", + "DROP DATABASE IF EXISTS " + db, + "CREATE DATABASE " + db, + "USE " + db, + } { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, err + } + } + defer conn.ExecContext(context.WithoutCancel(ctx), "USE master; DROP DATABASE IF EXISTS "+db) + relations, err := readRelations(ctx, conn) + if err != nil { + return nil, err + } + blob, err := dialect.JSONL(relations) + if err != nil { + return nil, err + } + return dialect.Files{dialect.RelationsFile: blob}, nil +} diff --git a/internal/goldeneye/mssql/mssql_test.go b/internal/goldeneye/mssql/mssql_test.go new file mode 100644 index 0000000000..e83b324dfe --- /dev/null +++ b/internal/goldeneye/mssql/mssql_test.go @@ -0,0 +1,66 @@ +package mssql + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// TestDialect verifies the committed SQL Server dialect against what the +// server reports. It skips unless MSSQL_SERVER_URI names a server. +func TestDialect(t *testing.T) { + dsn, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, dsn) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, dsn) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Engine) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} + +// TestAnalyzeCases verifies every SQL Server analyze case under +// internal/endtoend/testdata against what the server reports. It skips +// unless MSSQL_SERVER_URI names a server. +func TestAnalyzeCases(t *testing.T) { + dsn, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Engine) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no mssql analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), dsn, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what SQL Server reports (-committed +mssql):\n%s", c.Output, diff) + } + }) + } +} diff --git a/internal/goldeneye/mssql/plan.go b/internal/goldeneye/mssql/plan.go new file mode 100644 index 0000000000..d11054b29e --- /dev/null +++ b/internal/goldeneye/mssql/plan.go @@ -0,0 +1,243 @@ +package mssql + +import ( + "context" + "encoding/xml" + "fmt" + "strings" +) + +// The estimated showplan is the one thing that says what a parameter is +// compared with or assigned to. It is compiled, not run, with SET +// SHOWPLAN_XML ON, and prints the plan as XML in which every column is a +// ColumnReference naming its schema, table and column, and every variable +// one naming only @variable. A parameter's partner is the column on the +// other side of the Compare it is an operand of, the column an Assign +// sets to it, or the column of a seek whose range expression it is. An +// expression the plan computes once and refers to by name, Expr1002, is +// followed to its DefinedValue. A parameter the query casts, CAST(@p AS +// T), has no partner: the cast says what it is, as it does to sqlc, and +// the plan shows it as a Convert the query asked for rather than one the +// server added. + +// columnRef names a table column the plan refers to. +type columnRef struct { + schema, table, column string +} + +// node is one element of the showplan XML. +type node struct { + XMLName xml.Name + Attrs []xml.Attr `xml:",any,attr"` + Children []node `xml:",any"` +} + +func (n *node) attr(name string) string { + for _, a := range n.Attrs { + if a.Name.Local == name { + return a.Value + } + } + return "" +} + +// unbracket strips the [brackets] the plan quotes names with. +func unbracket(s string) string { + if strings.HasPrefix(s, "[") && strings.HasSuffix(s, "]") { + return strings.ReplaceAll(s[1:len(s)-1], "]]", "]") + } + return s +} + +// plan is a parsed showplan with the expressions it defines by name. +type plan struct { + root node + defined map[string]*node // Expr1002 -> the ScalarOperator defining it +} + +// partners compiles a batch and returns the column each variable is +// compared with or assigned to, keyed by the variable's name without the +// @. A variable with no such column is absent. +func (a *analyzer) partners(ctx context.Context, batch string) (map[string]columnRef, error) { + if _, err := a.conn.ExecContext(ctx, "SET SHOWPLAN_XML ON"); err != nil { + return nil, err + } + defer a.conn.ExecContext(context.WithoutCancel(ctx), "SET SHOWPLAN_XML OFF") + rows, err := a.conn.QueryContext(ctx, batch) + if err != nil { + return nil, fmt.Errorf("showplan: %w", err) + } + defer rows.Close() + var blob string + for rows.Next() { + var s string + if err := rows.Scan(&s); err != nil { + return nil, err + } + blob += s + } + if err := rows.Err(); err != nil { + return nil, err + } + p := &plan{defined: map[string]*node{}} + if err := xml.Unmarshal([]byte(blob), &p.root); err != nil { + return nil, fmt.Errorf("showplan: %w", err) + } + p.collectDefined(&p.root) + partners := map[string]columnRef{} + p.walk(&p.root, partners) + return partners, nil +} + +// collectDefined records every DefinedValue that names an expression. +func (p *plan) collectDefined(n *node) { + if n.XMLName.Local == "DefinedValue" && len(n.Children) >= 2 { + ref := &n.Children[0] + if ref.XMLName.Local == "ColumnReference" && ref.attr("Table") == "" && !strings.HasPrefix(ref.attr("Column"), "@") { + p.defined[ref.attr("Column")] = &n.Children[1] + } + } + for i := range n.Children { + p.collectDefined(&n.Children[i]) + } +} + +// walk finds the partners in a subtree, keeping the first found for each +// variable. +func (p *plan) walk(n *node, partners map[string]columnRef) { + set := func(vars []string, ref columnRef) { + for _, v := range vars { + if _, ok := partners[v]; !ok { + partners[v] = ref + } + } + } + switch n.XMLName.Local { + case "Compare": + var sides []*node + for i := range n.Children { + if n.Children[i].XMLName.Local == "ScalarOperator" { + sides = append(sides, &n.Children[i]) + } + } + if len(sides) == 2 { + for i, side := range sides { + vars := p.variables(side, nil) + if len(vars) == 0 { + continue + } + if cols := p.columns(sides[1-i], nil); len(cols) > 0 { + set(vars, cols[0]) + } + } + } + case "Assign": + var target *columnRef + for i := range n.Children { + c := &n.Children[i] + switch c.XMLName.Local { + case "ColumnReference": + if ref, ok := refOf(c); ok && target == nil { + target = &ref + } + case "ScalarOperator": + if target != nil { + set(p.variables(c, nil), *target) + } + } + } + case "Prefix", "StartRange", "EndRange": + var cols []columnRef + var exprs []*node + for i := range n.Children { + c := &n.Children[i] + switch c.XMLName.Local { + case "RangeColumns": + for j := range c.Children { + if ref, ok := refOf(&c.Children[j]); ok { + cols = append(cols, ref) + } + } + case "RangeExpressions": + for j := range c.Children { + exprs = append(exprs, &c.Children[j]) + } + } + } + for i, e := range exprs { + if i < len(cols) { + set(p.variables(e, nil), cols[i]) + } + } + } + for i := range n.Children { + p.walk(&n.Children[i], partners) + } +} + +// refOf reads a ColumnReference that names a table column. +func refOf(n *node) (columnRef, bool) { + if n.XMLName.Local != "ColumnReference" || n.attr("Table") == "" { + return columnRef{}, false + } + return columnRef{ + schema: unbracket(n.attr("Schema")), + table: unbracket(n.attr("Table")), + column: n.attr("Column"), + }, true +} + +// variables lists the variables a subtree refers to, following named +// expressions and leaving out the ones under a cast the query wrote. +func (p *plan) variables(n *node, seen map[string]bool) []string { + var out []string + if n.XMLName.Local == "Convert" && n.attr("Implicit") == "0" { + return nil + } + if n.XMLName.Local == "ColumnReference" { + col := n.attr("Column") + switch { + case strings.HasPrefix(col, "@"): + return []string{col[1:]} + case n.attr("Table") == "": + if def, ok := p.defined[col]; ok && !seen[col] { + if seen == nil { + seen = map[string]bool{} + } + seen[col] = true + vars := p.variables(def, seen) + delete(seen, col) + return vars + } + } + } + for i := range n.Children { + out = append(out, p.variables(&n.Children[i], seen)...) + } + return out +} + +// columns lists the table columns a subtree refers to, following named +// expressions. +func (p *plan) columns(n *node, seen map[string]bool) []columnRef { + var out []columnRef + if n.XMLName.Local == "ColumnReference" { + if ref, ok := refOf(n); ok { + return []columnRef{ref} + } + col := n.attr("Column") + if def, ok := p.defined[col]; ok && !seen[col] { + if seen == nil { + seen = map[string]bool{} + } + seen[col] = true + cols := p.columns(def, seen) + delete(seen, col) + return cols + } + } + for i := range n.Children { + out = append(out, p.columns(&n.Children[i], seen)...) + } + return out +} diff --git a/internal/goldeneye/mssql/relations.go b/internal/goldeneye/mssql/relations.go new file mode 100644 index 0000000000..1b51c4cf65 --- /dev/null +++ b/internal/goldeneye/mssql/relations.go @@ -0,0 +1,123 @@ +package mssql + +import ( + "context" + "database/sql" + "fmt" + "sort" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// systemSchemas are the schemas whose relations are generated: the catalog +// views, which are what a query of the server's catalog reads. Both hold +// nothing but views, so every relation a dialect seeds from them is one +// the analysis core never hands codegen as a model. +var systemSchemas = []string{ + "sys", + "INFORMATION_SCHEMA", +} + +// viewQuery lists a schema's views. They are sorted in Go, by the bytes +// of their lower-cased names, so that the output does not depend on the +// server's collation. +const viewQuery = ` +SELECT o.name +FROM sys.all_objects o +JOIN sys.schemas s ON s.schema_id = o.schema_id +WHERE o.type = 'V' AND s.name = @p1` + +// describeQuery asks the server to describe a SELECT * from a view: each +// column's name, its type spelled the way a declaration spells it — +// nvarchar(128), decimal(10,2), varbinary(max) — and whether it can be +// NULL. A view the server cannot describe reports an error message on a +// row of its own rather than failing the query. +const describeQuery = ` +SELECT column_ordinal, name, system_type_name, is_nullable, error_message +FROM sys.dm_exec_describe_first_result_set(@p1, NULL, 0) +ORDER BY column_ordinal` + +// readRelations reads the views of the system schemas. Their names are +// written in lower case: SQL Server matches them in any case under its +// default collations, INFORMATION_SCHEMA spells its own in upper case, and +// sqlc's SQL Server parser lowercases every identifier, so lower case is +// how a query reaches them. The type of each column is spelled the way the +// server describes it to a driver, which is the way a declaration spells +// it, numeric and timestamp included, since the seed reads the aliases +// types.jsonl lists. +func readRelations(ctx context.Context, conn *sql.Conn) ([]dialect.Relation, error) { + var relations []dialect.Relation + for _, schema := range systemSchemas { + names, err := views(ctx, conn, schema) + if err != nil { + return nil, fmt.Errorf("%s: %w", schema, err) + } + for _, name := range names { + columns, err := describe(ctx, conn, schema, name) + if err != nil { + return nil, fmt.Errorf("%s.%s: %w", schema, name, err) + } + relations = append(relations, dialect.Relation{ + Schema: strings.ToLower(schema), + Name: strings.ToLower(name), + Kind: "v", + Columns: columns, + }) + } + } + return relations, nil +} + +func views(ctx context.Context, conn *sql.Conn, schema string) ([]string, error) { + rows, err := conn.QueryContext(ctx, viewQuery, schema) + if err != nil { + return nil, err + } + defer rows.Close() + var names []string + for rows.Next() { + var name string + if err := rows.Scan(&name); err != nil { + return nil, err + } + names = append(names, name) + } + sort.Slice(names, func(i, j int) bool { return strings.ToLower(names[i]) < strings.ToLower(names[j]) }) + return names, rows.Err() +} + +func describe(ctx context.Context, conn *sql.Conn, schema, name string) ([]dialect.Column, error) { + rows, err := conn.QueryContext(ctx, describeQuery, "SELECT * FROM "+quote(schema)+"."+quote(name)) + if err != nil { + return nil, err + } + defer rows.Close() + var columns []dialect.Column + for rows.Next() { + var ( + ordinal int + colName sql.NullString + typeName sql.NullString + nullable sql.NullBool + errMsg sql.NullString + ) + if err := rows.Scan(&ordinal, &colName, &typeName, &nullable, &errMsg); err != nil { + return nil, err + } + if errMsg.Valid { + return nil, fmt.Errorf("cannot be described: %s", errMsg.String) + } + columns = append(columns, dialect.Column{ + Name: strings.ToLower(colName.String), + Type: typeName.String, + NotNull: !nullable.Bool, + }) + } + return columns, rows.Err() +} + +// quote brackets an identifier the way T-SQL does. +func quote(name string) string { + return "[" + strings.ReplaceAll(name, "]", "]]") + "]" +} diff --git a/internal/goldeneye/mysql/analyze.go b/internal/goldeneye/mysql/analyze.go new file mode 100644 index 0000000000..a2c4240817 --- /dev/null +++ b/internal/goldeneye/mysql/analyze.go @@ -0,0 +1,787 @@ +package mysql + +import ( + "bytes" + "context" + "database/sql" + "encoding/json" + "fmt" + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "os" + "regexp" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// The analyze cases are checked against a live server, which is asked +// three things about each query. What a driver sees: the query is run, +// with every parameter a user variable set to NULL, and each result +// column's name, type and nullability are read from the result set's +// metadata, the way go-sql-driver reports them. What the resolver made of +// it: the optimizer trace prints each query block back after name +// resolution, with every column qualified, every alias kept and every +// SELECT * expanded, which says which table each result column is read +// from and what each parameter is compared with or assigned to. And for a +// statement the trace does not expand — an INSERT ... VALUES, a +// single-table UPDATE or DELETE — the note EXPLAIN leaves, which prints +// the statement the same way. Views and derived tables are kept as the +// query wrote them rather than merged, so that a column read through one +// is reported as its column. MySQL itself reports nothing about a +// parameter but its position, so a parameter is described by its partner: +// a column's type and nullability come from information_schema, a column +// of a derived table from what its block projects, and an expression's +// from running it, over the tables it reads, as a query of its own. + +// placeholder is one parameter of a query as sqlc numbers them: each ? in +// turn, and each sqlc.arg name once, at its first appearance. Each becomes +// a user variable, which MySQL prints back by name, except in a LIMIT or +// OFFSET, where MySQL allows nothing but a number. +type placeholder struct { + Number int + Name string + Limit bool + Sentinel string // the variable's name, or the number +} + +// limitBase is added to a LIMIT parameter's number, so that the count is +// unlike any a query would write. +const limitBase = 4000000000 + +func bind(sql string) (string, []placeholder) { + var phs []placeholder + numbers := map[string]int{} + out := endtoend.Rewrite(sql, func(name, lastWord string) string { + n, ok := numbers[name] + if name == "" || !ok { + n = len(phs) + 1 + ph := placeholder{Number: n, Name: name} + switch strings.ToLower(lastWord) { + case "limit", "offset": + ph.Limit = true + ph.Sentinel = strconv.Itoa(limitBase + n) + default: + ph.Sentinel = "goldeneye_" + strconv.Itoa(n) + } + phs = append(phs, ph) + if name != "" { + numbers[name] = n + } + } + ph := phs[n-1] + if ph.Limit { + return ph.Sentinel + } + return "@" + ph.Sentinel + }) + return out, phs +} + +// column is what information_schema says about a column: its type as +// COLUMN_TYPE spells it, read into an expression. +type column struct { + name string + typ *analysis.TypeExpr + nullable bool +} + +// typeOfColumn is a column's type as it was declared, from COLUMN_TYPE, which +// carries the arguments and the unsigned that DATA_TYPE does not: "decimal(10,2) +// unsigned" is the family "decimal unsigned" applied to 10 and 2, and +// "enum('a','b')" is enum applied to its members. A trailing word such as +// zerofill is part of the family too. +func typeOfColumn(columnType string) *analysis.TypeExpr { + s := strings.TrimSpace(columnType) + open := strings.IndexByte(s, '(') + if open < 0 { + return &analysis.TypeExpr{Name: strings.ToLower(s)} + } + close := strings.LastIndexByte(s, ')') + if close < open { + return &analysis.TypeExpr{Name: strings.ToLower(s)} + } + // The family is spelled in lower case; an enum's members keep theirs, + // since they are values. + name := strings.ToLower(strings.TrimSpace(s[:open])) + if rest := strings.ToLower(strings.TrimSpace(s[close+1:])); rest != "" { + name += " " + rest + } + t := &analysis.TypeExpr{Name: name} + for _, a := range splitArgs(s[open+1 : close]) { + a = strings.TrimSpace(a) + if strings.HasPrefix(a, "'") && strings.HasSuffix(a, "'") && len(a) >= 2 { + v := unquoteMember(a[1 : len(a)-1]) + t.Args = append(t.Args, analysis.TypeArg{String: &v}) + continue + } + if n, err := strconv.ParseInt(a, 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } + } + return t +} + +// splitArgs splits a type's argument list on the commas outside quotes. A +// backslash inside a quoted member escapes the character after it. +func splitArgs(s string) []string { + var out []string + start, quoted := 0, false + for i := 0; i < len(s); i++ { + switch { + case quoted && s[i] == '\\': + i++ + case s[i] == '\'': + quoted = !quoted + case s[i] == ',' && !quoted: + out = append(out, s[start:i]) + start = i + 1 + } + } + return append(out, s[start:]) +} + +// unquoteMember reads the body of a quoted enum or set member as +// information_schema spells it: a quote is doubled and a backslash escapes +// the character after it. +func unquoteMember(s string) string { + var out strings.Builder + for i := 0; i < len(s); i++ { + switch { + case s[i] == '\\' && i+1 < len(s): + i++ + out.WriteByte(s[i]) + case s[i] == '\'' && i+1 < len(s) && s[i+1] == '\'': + i++ + out.WriteByte('\'') + default: + out.WriteByte(s[i]) + } + } + return out.String() +} + +// withNullable copies a type with its nullability set. +func withNullable(t *analysis.TypeExpr, nullable bool) *analysis.TypeExpr { + out := *t + out.Nullable = nullable + return &out +} + +// relation is a table the catalog knows, by schema and name. +type relation struct { + schema, name string +} + +// analyzer holds the session a case runs in and the catalog: the case's +// own schema, and information_schema, whose names are matched and +// reported in lower case, since MySQL matches them in any case and the +// dialect spells them that way. +type analyzer struct { + conn *sql.Conn + db string // the case's schema + catalog map[relation][]column // columns in order +} + +// table returns the catalog's name for a table of a schema, or "" when +// the catalog has no such table. +func (a *analyzer) table(schema, name string) (relation, bool) { + if schema == "" { + schema = a.db + } + if strings.EqualFold(schema, "information_schema") { + schema, name = "information_schema", strings.ToLower(name) + } + rel := relation{schema, name} + _, ok := a.catalog[rel] + return rel, ok +} + +var dbNameRe = regexp.MustCompile(`[^A-Za-z0-9_]+`) + +// Analyze loads a case's schema and fixture into a database of their own +// on the server, runs its queries there and returns what MySQL reports in +// the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, dsn string, c endtoend.Case) ([]byte, error) { + conn, err := open(ctx, dsn) + if err != nil { + return nil, err + } + defer conn.Close() + + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + + name := "goldeneye_" + dbNameRe.ReplaceAllString(c.Name, "_") + db := quote(name) + for _, stmt := range []string{ + "DROP DATABASE IF EXISTS " + db, + "CREATE DATABASE " + db, + "USE " + db, + "SET SESSION optimizer_trace = 'enabled=on'", + "SET SESSION optimizer_trace_max_mem_size = 67108864", + // A view or derived table is kept as the query wrote it rather + // than merged into the block that reads it, so that a column read + // from one is reported as its column, and an information_schema + // view is not resolved away into the data dictionary tables + // behind it. + "SET SESSION optimizer_switch = 'derived_merge=off,derived_condition_pushdown=off'", + } { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, err + } + } + defer conn.ExecContext(context.WithoutCancel(ctx), "DROP DATABASE IF EXISTS "+db) + if _, err := conn.ExecContext(ctx, string(schema)); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Schema, err) + } + if strings.TrimSpace(string(fixture)) != "" { + if _, err := conn.ExecContext(ctx, string(fixture)); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Fixture, err) + } + } + + a := &analyzer{conn: conn, db: name} + if a.catalog, err = readCatalog(ctx, conn, name); err != nil { + return nil, err + } + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := a.analyzeQuery(ctx, q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return analysis.Encode(out) +} + +// Check compares what MySQL reports for a case with the output the case +// committed, returning a diff when they differ. +// Check compares a case's committed output with what MySQL reports. A +// column read from a table is compared in full, since information_schema +// spells its whole type; an expression's type comes from the wire, which +// carries the family and nothing of its arguments, so an expression, and +// a parameter typed by one, is compared by family alone. +func Check(ctx context.Context, dsn string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, dsn, c) + if err != nil { + return "", err + } + want, err := os.ReadFile(c.Output) + if err != nil { + return "", err + } + var queries []analysis.Query + if err := json.Unmarshal(want, &queries); err != nil { + return "", fmt.Errorf("%s: %w", c.Output, err) + } + for i := range queries { + for j := range queries[i].Columns { + familyOnly(&queries[i].Columns[j]) + } + for j := range queries[i].Params { + familyOnly(&queries[i].Params[j].Column) + } + } + want, err = analysis.Encode(queries) + if err != nil { + return "", err + } + if bytes.Equal(want, got) { + return "", nil + } + return dialect.Diff(string(want), string(got)), nil +} + +// familyOnly drops the arguments of a column's type when the column is not +// read from a table, which is as much as the wire says about it. +func familyOnly(col *analysis.Column) { + if col.Table == "" && col.Type != nil { + col.Type.Args = nil + } +} + +const catalogQuery = ` +SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, DATA_TYPE, COLUMN_TYPE, IS_NULLABLE +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA IN (?, 'information_schema') +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION` + +func readCatalog(ctx context.Context, conn *sql.Conn, db string) (map[relation][]column, error) { + rows, err := conn.QueryContext(ctx, catalogQuery, db) + if err != nil { + return nil, err + } + defer rows.Close() + catalog := map[relation][]column{} + for rows.Next() { + var schema, table, name, dataType, columnType, nullable string + if err := rows.Scan(&schema, &table, &name, &dataType, &columnType, &nullable); err != nil { + return nil, err + } + if schema == "information_schema" { + table, name = strings.ToLower(table), strings.ToLower(name) + } + rel := relation{schema, table} + catalog[rel] = append(catalog[rel], column{ + name: name, + typ: typeOfColumn(columnType), + nullable: nullable == "YES", + }) + } + return catalog, rows.Err() +} + +// statement is everything the server said about one query. +type statement struct { + a *analyzer + trace trace + note *text // the statement as EXPLAIN printed it, nil without one + aliases map[string]tableRef + results []*sql.ColumnType // of the executed query, nil for one returning no rows + target *relation // the table an INSERT ... VALUES writes + targets []string // its columns, in row order +} + +func (a *analyzer) analyzeQuery(ctx context.Context, q endtoend.Query) (analysis.Query, error) { + sql, phs := bind(q.SQL) + + var sets []string + for _, ph := range phs { + if !ph.Limit { + sets = append(sets, "@"+ph.Sentinel+" = NULL") + } + } + if len(sets) > 0 { + if _, err := a.conn.ExecContext(ctx, "SET "+strings.Join(sets, ", ")); err != nil { + return analysis.Query{}, err + } + } + + // EXPLAIN resolves and optimises the statement without running it, + // leaving its note and its trace behind. Only the traditional format + // leaves the note, and since MySQL 26 the default format is the tree. + if err := drain(a.conn.QueryContext(ctx, "EXPLAIN FORMAT=TRADITIONAL "+sql)); err != nil { + return analysis.Query{}, err + } + note, err := readNote(ctx, a.conn) + if err != nil { + return analysis.Query{}, err + } + tr, err := readTrace(ctx, a.conn) + if err != nil { + return analysis.Query{}, err + } + + s := &statement{a: a, trace: tr, aliases: map[string]tableRef{}} + if note != "" { + t := tokenize(note) + s.note = &t + t.aliases(s.aliases) + s.target, s.targets = s.insertTargets(t) + } + for _, t := range tr.blocks { + t.aliases(s.aliases) + } + + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + if returnsRows(sql) { + rows, err := a.conn.QueryContext(ctx, sql) + if err != nil { + return analysis.Query{}, err + } + s.results, err = rows.ColumnTypes() + rows.Close() + if err != nil { + return analysis.Query{}, err + } + // Names, types and nullability are the result set's. The top + // block's SELECT list adds which table each column is read from, + // when the two line up. MySQL sends every size of TEXT and BLOB + // as the one wire type and tells them apart by the length beside + // it, which the driver keeps to itself, so a column read from a + // table, directly or through a derived table, is spelled the way + // the table declares it. + var items []item + if top, ok := tr.blocks[1]; ok { + items = top.selectItems() + } + for i, ct := range s.results { + ac := analysis.Column{Name: ct.Name(), Type: typeOf(ct)} + if len(items) == len(s.results) { + top := tr.blocks[1] + if it := items[i]; it.end-it.start == 1 && top.at(it.start).kind == tkIdent { + tok := top.at(it.start) + if rel, ok := s.resolve(tok.parts); ok { + ac.Table = rel.name + } + if col, ok := s.origin(top, tok, 0); ok { + ac.Type = withNullable(col.typ, ac.Type.Nullable) + } + } + } + aq.Columns = append(aq.Columns, ac) + } + } + + for _, ph := range phs { + ac := analysis.Column{} + if t, i, ok := s.locate(ph); ok { + ac = s.describe(ctx, t, t.partner(i), 0) + } + if ph.Name != "" { + ac.Name = ph.Name + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} + +// drain reads a result set to the end and closes it. +func drain(rows *sql.Rows, err error) error { + if err != nil { + return err + } + defer rows.Close() + for rows.Next() { + } + return rows.Err() +} + +// readNote returns the statement EXPLAIN printed back, from the note it +// leaves among the warnings, or "" when it left none. +func readNote(ctx context.Context, conn *sql.Conn) (string, error) { + rows, err := conn.QueryContext(ctx, "SHOW WARNINGS") + if err != nil { + return "", err + } + defer rows.Close() + note := "" + for rows.Next() { + var level, message string + var code int + if err := rows.Scan(&level, &code, &message); err != nil { + return "", err + } + if code == 1003 { + note = message + } + } + return note, rows.Err() +} + +// readTrace returns the optimizer trace of the last statement. +func readTrace(ctx context.Context, conn *sql.Conn) (trace, error) { + rows, err := conn.QueryContext(ctx, "SELECT TRACE, MISSING_BYTES_BEYOND_MAX_MEM_SIZE FROM information_schema.OPTIMIZER_TRACE") + if err != nil { + return trace{}, err + } + defer rows.Close() + blob := "" + for rows.Next() { + var missing int64 + if err := rows.Scan(&blob, &missing); err != nil { + return trace{}, err + } + if missing > 0 { + return trace{}, fmt.Errorf("the optimizer trace was truncated by %d bytes", missing) + } + } + if err := rows.Err(); err != nil { + return trace{}, err + } + return parseTrace(blob) +} + +// returnsRows reports whether a statement produces a result set. +func returnsRows(sql string) bool { + head := strings.ToLower(strings.TrimSpace(sql)) + if strings.HasPrefix(head, "(") { + return true + } + for _, kw := range []string{"select", "with", "show", "describe", "desc", "explain", "table", "values"} { + if strings.HasPrefix(head, kw) && (len(head) == len(kw) || !isWordByte(head[len(kw)])) { + return true + } + } + return false +} + +// typeOf is a result column's type as the driver reports it, spelled the +// way a column declaration does: "bigint unsigned" rather than the +// driver's "UNSIGNED BIGINT". +func typeOf(ct *sql.ColumnType) *analysis.TypeExpr { + name := strings.ToLower(ct.DatabaseTypeName()) + if rest, ok := strings.CutPrefix(name, "unsigned "); ok { + name = rest + " unsigned" + } + nullable, _ := ct.Nullable() + return &analysis.TypeExpr{Name: name, Nullable: nullable} +} + +// resolve returns the catalog table a qualified column name is read from: +// the qualifier is an alias, or a table of the case's schema, or a table +// of the schema the name spells out. +func (s *statement) resolve(parts []string) (relation, bool) { + if len(parts) < 2 { + return relation{}, false + } + qualifier := parts[len(parts)-2] + if ref, ok := s.aliases[qualifier]; ok { + return s.a.table(ref.schema, ref.name) + } + schema := "" + if len(parts) >= 3 { + schema = parts[len(parts)-3] + } + return s.a.table(schema, qualifier) +} + +// locate finds the text a placeholder was printed in and where: the +// innermost query block whose expanded_query has it, or else the note. +func (s *statement) locate(ph placeholder) (text, int, bool) { + find := func(t text) int { + if ph.Limit { + return t.findNumber(ph.Sentinel) + } + return t.findVar(ph.Sentinel) + } + for _, sel := range s.trace.order() { + t := s.trace.blocks[sel] + if i := find(t); i >= 0 { + return t, i, true + } + } + if s.note != nil { + if i := find(*s.note); i >= 0 { + return *s.note, i, true + } + } + return text{}, -1, false +} + +// describe turns a parameter's partner into the column description sqlc +// prints for the parameter. +func (s *statement) describe(ctx context.Context, t text, p partner, depth int) analysis.Column { + switch p.kind { + case partnerOperand: + return s.operand(ctx, t, p.start, p.end, depth) + case partnerProjection: + if s.results != nil { + if top, ok := s.trace.blocks[1]; ok && top.src == t.src && p.index < len(s.results) { + ct := s.results[p.index] + return analysis.Column{Name: ct.Name(), Type: typeOf(ct)} + } + } + if items := t.selectItems(); p.index < len(items) { + return analysis.Column{Name: items[p.index].alias} + } + case partnerInsert: + if s.target != nil && len(s.targets) > 0 { + return s.column(*s.target, s.targets[p.index%len(s.targets)]) + } + case partnerLimit: + // A LIMIT or OFFSET count is an unsigned 64-bit integer to MySQL. + return analysis.Column{Type: &analysis.TypeExpr{Name: "bigint unsigned"}} + } + return analysis.Column{} +} + +// operand describes an operand: a column by what the schema says of it, a +// call by its name and what it returns, anything else by its type. +func (s *statement) operand(ctx context.Context, t text, start, end, depth int) analysis.Column { + tok := t.at(start) + if end-start == 1 && tok.kind == tkIdent { + return s.columnRef(ctx, t, tok, depth) + } + if tok.kind == tkVar { + return analysis.Column{} + } + ac := analysis.Column{} + if tok.kind == tkWord && t.at(start+1).kind == tkLParen && t.isCall(start) && !strings.HasPrefix(tok.text, "<") { + ac.Name = tok.text + } + ac.Type = s.eval(ctx, t, start, end) + return ac +} + +// columnRef describes a column reference: a column of the schema, a column +// of a derived table by the expression its block projects, or a SELECT list +// alias by the expression it names. +func (s *statement) columnRef(ctx context.Context, t text, tok token, depth int) analysis.Column { + parts := tok.parts + if depth > 8 { + return analysis.Column{Name: parts[len(parts)-1]} + } + if len(parts) == 1 { + for _, it := range t.selectItems() { + if it.alias == parts[0] { + ac := s.operand(ctx, t, it.start, it.end, depth+1) + ac.Name = parts[0] + return ac + } + } + return analysis.Column{Name: parts[0]} + } + qualifier, name := parts[len(parts)-2], parts[len(parts)-1] + if rel, ok := s.resolve(parts); ok { + return s.column(rel, name) + } + if sel, ok := s.trace.derived[qualifier]; ok { + if block, ok := s.trace.blocks[sel]; ok { + for _, it := range block.selectItems() { + if it.alias == name { + ac := s.operand(ctx, block, it.start, it.end, depth+1) + ac.Name = name + return ac + } + } + } + } + return analysis.Column{Name: name} +} + +// origin follows a column reference to the catalog column it reads, through +// any derived table or CTE whose block projects that column as it is. +func (s *statement) origin(t text, tok token, depth int) (column, bool) { + parts := tok.parts + if depth > 8 || len(parts) < 2 { + return column{}, false + } + qualifier, name := parts[len(parts)-2], parts[len(parts)-1] + if rel, ok := s.resolve(parts); ok { + if rel.schema == "information_schema" { + name = strings.ToLower(name) + } + for _, col := range s.a.catalog[rel] { + if col.name == name { + return col, true + } + } + return column{}, false + } + sel, ok := s.trace.derived[qualifier] + if !ok { + return column{}, false + } + block, ok := s.trace.blocks[sel] + if !ok { + return column{}, false + } + for _, it := range block.selectItems() { + if it.alias == name && it.end-it.start == 1 && block.at(it.start).kind == tkIdent { + return s.origin(block, block.at(it.start), depth+1) + } + } + return column{}, false +} + +// column describes a column of a catalog table. +func (s *statement) column(rel relation, name string) analysis.Column { + if rel.schema == "information_schema" { + name = strings.ToLower(name) + } + for _, col := range s.a.catalog[rel] { + if col.name == name { + return analysis.Column{ + Name: name, + Type: withNullable(col.typ, col.nullable), + Table: rel.name, + } + } + } + return analysis.Column{Name: name, Table: rel.name} +} + +// eval finds the type of an expression by running it as a query of its +// own, over the tables its columns are read from under the aliases the +// statement gave them. An expression that reads a derived table cannot be +// run that way and gets no type. +func (s *statement) eval(ctx context.Context, t text, start, end int) *analysis.TypeExpr { + var from []string + seen := map[string]bool{} + for _, id := range t.idents(start, end) { + qualifier := id.parts[len(id.parts)-2] + if seen[qualifier] { + continue + } + seen[qualifier] = true + rel, ok := s.resolve(id.parts) + if !ok { + return nil + } + item := quote(rel.schema) + "." + quote(rel.name) + if qualifier != rel.name { + item += " " + quote(qualifier) + } + from = append(from, item) + } + query := "SELECT " + t.slice(start, end) + if len(from) > 0 { + query += " FROM " + strings.Join(from, ", ") + } + rows, err := s.a.conn.QueryContext(ctx, query+" LIMIT 0") + if err != nil { + return nil + } + defer rows.Close() + cts, err := rows.ColumnTypes() + if err != nil || len(cts) != 1 { + return nil + } + return typeOf(cts[0]) +} + +// insertTargets reads the table and columns an INSERT ... VALUES writes, +// as the note prints them: the columns listed, or every column of the +// table in order when none are. +func (s *statement) insertTargets(t text) (*relation, []string) { + for i, tok := range t.toks { + if tok.kind != tkWord || tok.text != "into" || t.at(i+1).kind != tkIdent { + continue + } + parts := t.at(i + 1).parts + schema := "" + if len(parts) >= 2 { + schema = parts[len(parts)-2] + } + rel, ok := s.a.table(schema, parts[len(parts)-1]) + if !ok { + return nil, nil + } + var targets []string + if t.at(i+2).kind == tkLParen { + for _, m := range t.list(i + 2) { + if m[1]-m[0] == 1 && t.at(m[0]).kind == tkIdent { + parts := t.at(m[0]).parts + targets = append(targets, parts[len(parts)-1]) + } + } + } else { + for _, col := range s.a.catalog[rel] { + targets = append(targets, col.name) + } + } + return &rel, targets + } + return nil, nil +} diff --git a/internal/goldeneye/mysql/mysql.go b/internal/goldeneye/mysql/mysql.go new file mode 100644 index 0000000000..e9258917fb --- /dev/null +++ b/internal/goldeneye/mysql/mysql.go @@ -0,0 +1,150 @@ +// Package mysql generates the MySQL dialect seed under +// internal/engine/dolphin/dialect from a live server, and verifies the +// MySQL analyze cases under internal/endtoend/testdata against the same +// server. +// +// MySQL keeps no catalog of its types, functions or operators — the server +// describes a built-in function no further than its name, in the help +// tables — so types.jsonl, functions.jsonl and operators.jsonl are written +// by hand and are not this package's business. What it does describe is +// its data dictionary: relations.jsonl is every view of information_schema, +// read from information_schema itself. +// +// The package also verifies the MySQL analyze cases under +// internal/endtoend/testdata against the same server: each case's schema +// and fixture are loaded into a database of their own and its queries run +// there. Result columns come from the result set's metadata as the driver +// reports it, provenance and parameters from the optimizer trace's +// expanded_query and the note EXPLAIN leaves, since MySQL reports nothing +// about a parameter but its position. The answer is printed in the JSON +// shape sqlc analyze prints and compared with the case's committed +// stdout.json byte for byte. +// +// The server is named by MYSQL_SERVER_URI, in the form the go-sql-driver +// DSN takes, and has to be the major release in Major, since each release +// adds to information_schema. +package mysql + +import ( + "context" + "database/sql" + "errors" + "fmt" + "os" + "strconv" + "strings" + + driver "github.com/go-sql-driver/mysql" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name sqlc knows the dialect by, and the name of the analyze +// case directories under internal/endtoend/testdata. +const Engine = "mysql" + +// Dir is the name of the engine directory the dialect lives under, which +// is named after the parser sqlc reads MySQL with rather than the engine. +const Dir = "dolphin" + +// Major is the MySQL major release the dialect is generated from. Bumping +// it is a deliberate change: every release adds tables and columns to the +// system schemas, so regenerate and review the dialect after changing it. +const Major = 26 + +// Locate returns the server to generate from, named by MYSQL_SERVER_URI. +func Locate() (string, error) { + dsn := os.Getenv("MYSQL_SERVER_URI") + if dsn == "" { + return "", errors.New("MYSQL_SERVER_URI is not set") + } + if _, err := driver.ParseDSN(dsn); err != nil { + return "", fmt.Errorf("MYSQL_SERVER_URI: %w", err) + } + return dsn, nil +} + +// open connects to the server. The connection runs several statements at +// once, so that a case's schema loads as one script, and holds one +// session, since the optimizer trace and the warnings a statement leaves +// are both per session. +func open(ctx context.Context, dsn string) (*sql.Conn, error) { + cfg, err := driver.ParseDSN(dsn) + if err != nil { + return nil, err + } + cfg.MultiStatements = true + db, err := sql.Open("mysql", cfg.FormatDSN()) + if err != nil { + return nil, err + } + conn, err := db.Conn(ctx) + if err != nil { + db.Close() + return nil, err + } + return conn, nil +} + +// Version reports the release a server is. +func Version(ctx context.Context, dsn string) (string, error) { + conn, err := open(ctx, dsn) + if err != nil { + return "", err + } + defer conn.Close() + return version(ctx, conn) +} + +func version(ctx context.Context, conn *sql.Conn) (string, error) { + var v string + if err := conn.QueryRowContext(ctx, "SELECT version()").Scan(&v); err != nil { + return "", err + } + return "MySQL " + v, nil +} + +// checkVersion refuses a server of another major release than the dialect +// is generated from, whose system schemas would differ from the committed +// ones without anything being wrong. +func checkVersion(ctx context.Context, conn *sql.Conn) error { + var v string + if err := conn.QueryRowContext(ctx, "SELECT version()").Scan(&v); err != nil { + return err + } + head, _, _ := strings.Cut(v, ".") + major, err := strconv.Atoi(head) + if err != nil { + return fmt.Errorf("version %q: %w", v, err) + } + if major != Major { + return fmt.Errorf("the dialect is generated from MySQL %d, but the server is MySQL %d", Major, major) + } + return nil +} + +// Generate reads the dialect from the server: relations.jsonl, the views of +// information_schema. +func Generate(ctx context.Context, dsn string) (dialect.Files, error) { + conn, err := open(ctx, dsn) + if err != nil { + return nil, err + } + defer conn.Close() + if err := checkVersion(ctx, conn); err != nil { + return nil, err + } + var relations []dialect.Relation + for _, schema := range systemSchemas { + rels, err := readRelations(ctx, conn, schema) + if err != nil { + return nil, err + } + relations = append(relations, rels...) + } + blob, err := dialect.JSONL(relations) + if err != nil { + return nil, err + } + return dialect.Files{dialect.RelationsFile: blob}, nil +} diff --git a/internal/goldeneye/mysql/mysql_test.go b/internal/goldeneye/mysql/mysql_test.go new file mode 100644 index 0000000000..5347394595 --- /dev/null +++ b/internal/goldeneye/mysql/mysql_test.go @@ -0,0 +1,66 @@ +package mysql + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// TestDialect verifies the committed MySQL dialect against what the server +// reports. It skips unless MYSQL_SERVER_URI names a server. +func TestDialect(t *testing.T) { + dsn, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, dsn) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, dsn) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Dir) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} + +// TestAnalyzeCases verifies every MySQL analyze case under +// internal/endtoend/testdata against what the server reports. It skips +// unless MYSQL_SERVER_URI names a server. +func TestAnalyzeCases(t *testing.T) { + dsn, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Engine) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no mysql analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), dsn, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what MySQL reports (-committed +mysql):\n%s", c.Output, diff) + } + }) + } +} diff --git a/internal/goldeneye/mysql/relations.go b/internal/goldeneye/mysql/relations.go new file mode 100644 index 0000000000..63e422cd9d --- /dev/null +++ b/internal/goldeneye/mysql/relations.go @@ -0,0 +1,99 @@ +package mysql + +import ( + "context" + "database/sql" + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// systemSchemas are the schemas whose relations are generated: the data +// dictionary's views, which are what a query of the server's catalog +// reads. The other schemas mysqld --initialize creates — mysql, +// performance_schema and sys — are tables rather than views, and every +// table a dialect seeds is one the analysis core hands codegen as a model, +// so they wait until codegen knows a system schema when it sees one. +var systemSchemas = []string{ + "information_schema", +} + +// relationQuery lists a schema's relations and their columns, in the order +// the columns were declared, so that the output is stable. +const relationQuery = ` +SELECT t.TABLE_NAME, t.TABLE_TYPE, + c.COLUMN_NAME, c.DATA_TYPE, c.COLUMN_TYPE, c.IS_NULLABLE +FROM information_schema.TABLES t +JOIN information_schema.COLUMNS c + ON c.TABLE_SCHEMA = t.TABLE_SCHEMA AND c.TABLE_NAME = t.TABLE_NAME +WHERE t.TABLE_SCHEMA = ? +ORDER BY t.TABLE_NAME, c.ORDINAL_POSITION` + +// readRelations reads a schema's tables and views. Their names are written +// in lower case: information_schema names its views in upper case and +// matches them in any case, MySQL matches every column name in any case, +// and sqlc's MySQL parser lowercases every identifier, so lower case is +// how a query reaches them. A column's type is spelled the way a +// declaration does, as COLUMN_TYPE reports it, arguments and UNSIGNED +// included: varchar(64), bigint unsigned. +func readRelations(ctx context.Context, conn *sql.Conn, schema string) ([]dialect.Relation, error) { + rows, err := conn.QueryContext(ctx, relationQuery, schema) + if err != nil { + return nil, fmt.Errorf("%s: %w", schema, err) + } + defer rows.Close() + var relations []dialect.Relation + var cur *dialect.Relation + for rows.Next() { + var name, kind, colName, dataType, columnType, nullable string + if err := rows.Scan(&name, &kind, &colName, &dataType, &columnType, &nullable); err != nil { + return nil, err + } + name = strings.ToLower(name) + if cur == nil || cur.Name != name { + rel := dialect.Relation{Catalog: "def", Schema: schema, Name: name} + if kind != "BASE TABLE" { + rel.Kind = "v" + } + relations = append(relations, rel) + cur = &relations[len(relations)-1] + } + cur.Columns = append(cur.Columns, dialect.Column{ + Name: strings.ToLower(colName), + Type: typeName(dataType, columnType), + NotNull: nullable == "NO", + }) + } + return relations, rows.Err() +} + +// typeName spells a column's type the way a declaration does, which is +// COLUMN_TYPE as information_schema reports it: "varchar(64)", "bigint +// unsigned", "enum('a','b')". The family is spelled in lower case; the +// members of an enum or set are values and keep theirs. +func typeName(dataType, columnType string) string { + if columnType == "" { + return strings.ToLower(dataType) + } + var out strings.Builder + quoted := false + for i := 0; i < len(columnType); i++ { + c := columnType[i] + switch { + case quoted && c == '\\' && i+1 < len(columnType): + out.WriteByte(c) + i++ + out.WriteByte(columnType[i]) + continue + case c == '\'': + quoted = !quoted + } + if quoted { + out.WriteByte(c) + } else { + out.WriteString(strings.ToLower(string(c))) + } + } + return out.String() +} diff --git a/internal/goldeneye/mysql/text.go b/internal/goldeneye/mysql/text.go new file mode 100644 index 0000000000..98831b627a --- /dev/null +++ b/internal/goldeneye/mysql/text.go @@ -0,0 +1,678 @@ +package mysql + +import ( + "strings" +) + +// MySQL prints a statement back with every name resolved, every table +// alias kept, every SELECT * expanded and every binary operation +// parenthesised — in the optimizer trace's expanded_query, once per query +// block, and in the note EXPLAIN leaves. Such a text is tokenised here and +// read for three things: the tables it names and their aliases, the +// columns each query block projects, and the operand a parameter is +// compared with or assigned to. + +type tokKind int + +const ( + tkIdent tokKind = iota // `a`.`b`.`c` + tkVar // @`name` + tkNumber // 42, 1.5 + tkString // 'text' + tkWord // a keyword, a function name or a + tkOp // =, <=>, +, like is a word + tkLParen + tkRParen + tkComma +) + +type token struct { + kind tokKind + text string // the token as printed; a word is lower-cased + parts []string // an identifier's parts, unquoted; a variable's name + start int // offsets into the source + end int +} + +// text is a tokenised statement. +type text struct { + src string + toks []token + match []int // the index of each parenthesis's partner, or -1 +} + +func tokenize(src string) text { + var toks []token + i := 0 + emit := func(kind tokKind, start, end int, parts []string) { + toks = append(toks, token{kind: kind, text: src[start:end], parts: parts, start: start, end: end}) + } + for i < len(src) { + c := src[i] + switch { + case c == ' ' || c == '\t' || c == '\n' || c == '\r': + i++ + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + i = len(src) + } else { + i += end + 2 + } + case c == '`': + start := i + var parts []string + for { + part, end := readQuoted(src, i) + parts = append(parts, part) + i = end + if i+1 < len(src) && src[i] == '.' && src[i+1] == '`' { + i++ + continue + } + break + } + emit(tkIdent, start, i, parts) + case c == '@': + start := i + i++ + for i < len(src) && src[i] == '@' { + i++ + } + if i < len(src) && src[i] == '`' { + name, end := readQuoted(src, i) + i = end + emit(tkVar, start, i, []string{name}) + } else { + for i < len(src) && isWordByte(src[i]) { + i++ + } + emit(tkVar, start, i, []string{src[start+1 : i]}) + } + case c == '\'' || c == '"': + start := i + i = skipString(src, i) + emit(tkString, start, i, nil) + case c >= '0' && c <= '9' || c == '.' && i+1 < len(src) && src[i+1] >= '0' && src[i+1] <= '9': + start := i + for i < len(src) && (src[i] >= '0' && src[i] <= '9' || src[i] == '.') { + i++ + } + if i < len(src) && (src[i] == 'e' || src[i] == 'E') { + i++ + if i < len(src) && (src[i] == '+' || src[i] == '-') { + i++ + } + for i < len(src) && src[i] >= '0' && src[i] <= '9' { + i++ + } + } + emit(tkNumber, start, i, nil) + case c == '<' && i+1 < len(src) && isWordByte(src[i+1]) && strings.IndexByte(src[i:], '>') > 0 && isMarker(src[i:i+strings.IndexByte(src[i:], '>')+1]): + // , , : what the optimizer wrapped + // an expression in. says nothing about the expression + // and is dropped; the others are read as calls. + end := i + strings.IndexByte(src[i:], '>') + 1 + if src[i:end] != "" { + emit(tkWord, i, end, nil) + toks[len(toks)-1].text = src[i+1 : end-1] + } + i = end + case c == '(': + emit(tkLParen, i, i+1, nil) + i++ + case c == ')': + emit(tkRParen, i, i+1, nil) + i++ + case c == ',': + emit(tkComma, i, i+1, nil) + i++ + case isWordByte(c): + start := i + for i < len(src) && isWordByte(src[i]) { + i++ + } + emit(tkWord, start, i, nil) + toks[len(toks)-1].text = strings.ToLower(src[start:i]) + default: + n := 1 + for _, op := range operators { + if strings.HasPrefix(src[i:], op) { + n = len(op) + break + } + } + emit(tkOp, i, i+n, nil) + i += n + } + } + t := text{src: src, toks: toks, match: make([]int, len(toks))} + var open []int + for i, tok := range toks { + t.match[i] = -1 + switch tok.kind { + case tkLParen: + open = append(open, i) + case tkRParen: + if len(open) > 0 { + j := open[len(open)-1] + open = open[:len(open)-1] + t.match[i] = j + t.match[j] = i + } + } + } + return t +} + +// operators is every symbolic operator MySQL prints, longest first. +var operators = []string{ + "<=>", "->>", "<>", "!=", ">=", "<=", "->", "<<", ">>", "||", "&&", ":=", + "=", "<", ">", "+", "-", "*", "/", "%", "!", "^", "&", "|", "~", ".", +} + +func isMarker(s string) bool { + for _, c := range []byte(s[1 : len(s)-1]) { + if !isWordByte(c) { + return false + } + } + return true +} + +func isWordByte(c byte) bool { + return c == '_' || c == '$' || c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' +} + +// readQuoted reads the backticked identifier at i, unescaping a doubled +// backtick, and returns it with the index just past its closing quote. +func readQuoted(s string, i int) (string, int) { + var b strings.Builder + j := i + 1 + for j < len(s) { + if s[j] == '`' { + if j+1 < len(s) && s[j+1] == '`' { + b.WriteByte('`') + j += 2 + continue + } + return b.String(), j + 1 + } + b.WriteByte(s[j]) + j++ + } + return b.String(), j +} + +// skipString returns the index just past the string literal starting at i, +// honouring backslash escapes and doubled quotes. +func skipString(s string, i int) int { + q := s[i] + j := i + 1 + for j < len(s) { + switch { + case s[j] == '\\' && j+1 < len(s): + j += 2 + case s[j] == q && j+1 < len(s) && s[j+1] == q: + j += 2 + case s[j] == q: + return j + 1 + default: + j++ + } + } + return len(s) +} + +// wordOperators are the operators MySQL spells as words. and/or/not/is +// are left out: MySQL parenthesises each predicate, so a parameter that +// is a whole predicate has nothing to be compared with. +var wordOperators = map[string]bool{ + "like": true, "in": true, "regexp": true, "rlike": true, "div": true, "mod": true, + "xor": true, "sounds": true, "escape": true, "between": true, "collate": true, + "member": true, +} + +// keywords are the words that can precede a parenthesis without naming a +// function, so that "(a, b)" after one is a list rather than a call. +var keywords = map[string]bool{ + "in": true, "values": true, "value": true, "and": true, "or": true, "not": true, + "where": true, "on": true, "from": true, "select": true, "having": true, + "set": true, "when": true, "then": true, "else": true, "case": true, "end": true, + "like": true, "between": true, "by": true, "group": true, "order": true, + "limit": true, "offset": true, "using": true, "join": true, "as": true, "is": true, + "xor": true, "div": true, "mod": true, "interval": true, "distinct": true, + "all": true, "any": true, "some": true, "escape": true, "regexp": true, + "rlike": true, "sounds": true, "collate": true, "union": true, "except": true, + "intersect": true, "with": true, "insert": true, "into": true, "update": true, + "delete": true, "replace": true, "key": true, "duplicate": true, "do": true, + "partition": true, "over": true, "window": true, "rows": true, "range": true, + "straight_join": true, "cross": true, "inner": true, "left": true, "right": true, + "natural": true, "lateral": true, "of": true, "for": true, "lock": true, + "share": true, "null": true, "true": true, "false": true, "unknown": true, + "binary": true, "row": true, "asc": true, "desc": true, "sql_calc_found_rows": true, + "high_priority": true, "low_priority": true, "ignore": true, "table": true, + "member": true, "exists": true, +} + +// literalWords are the words that are operands on their own. +var literalWords = map[string]bool{ + "null": true, "true": true, "false": true, "unknown": true, + "current_timestamp": true, "current_date": true, "current_time": true, + "current_user": true, "localtime": true, "localtimestamp": true, "utc_timestamp": true, +} + +func (t text) at(i int) token { + if i < 0 || i >= len(t.toks) { + return token{kind: -1} + } + return t.toks[i] +} + +func (t text) isWord(i int, word string) bool { + tok := t.at(i) + return tok.kind == tkWord && tok.text == word +} + +// isCall reports whether the word at i names a function, given that a +// parenthesis follows it. +func (t text) isCall(i int) bool { + tok := t.at(i) + return tok.kind == tkWord && !keywords[tok.text] || tok.kind == tkWord && tok.text == "exists" +} + +// isOperator reports whether the token at i joins two operands. +func (t text) isOperator(i int) bool { + tok := t.at(i) + switch tok.kind { + case tkOp: + return tok.text != "." && tok.text != "~" && tok.text != "!" + case tkWord: + return wordOperators[tok.text] + } + return false +} + +// operandEnd returns the index just past the operand starting at i, or -1 +// when no operand starts there: a name, a literal, a call with its +// arguments, or a parenthesised group. +func (t text) operandEnd(i int) int { + tok := t.at(i) + switch tok.kind { + case tkIdent, tkVar, tkNumber, tkString: + return i + 1 + case tkLParen: + if t.match[i] < 0 { + return -1 + } + return t.match[i] + 1 + case tkWord: + if literalWords[tok.text] { + return i + 1 + } + if t.at(i+1).kind == tkLParen && t.isCall(i) { + return t.operandEnd(i + 1) + } + if tok.text == "not" || tok.text == "binary" || tok.text == "interval" { + return t.operandEnd(i + 1) + } + case tkOp: + if tok.text == "-" || tok.text == "+" || tok.text == "~" || tok.text == "!" { + return t.operandEnd(i + 1) + } + } + return -1 +} + +// operandStart returns the index of the operand ending just before j, or +// -1 when none ends there. +func (t text) operandStart(j int) int { + k := j - 1 + tok := t.at(k) + switch tok.kind { + case tkIdent, tkVar, tkNumber, tkString: + return k + case tkRParen: + open := t.match[k] + if open < 0 { + return -1 + } + if t.at(open-1).kind == tkWord && t.isCall(open-1) { + return open - 1 + } + return open + case tkWord: + if literalWords[tok.text] { + return k + } + } + return -1 +} + +// group returns the index of the parenthesis enclosing token i, or -1. +func (t text) group(i int) int { + depth := 0 + for k := i - 1; k >= 0; k-- { + switch t.toks[k].kind { + case tkRParen: + depth++ + case tkLParen: + if depth == 0 { + return k + } + depth-- + } + } + return -1 +} + +// list splits the tokens strictly inside the group opened at open into its +// comma-separated members, each a token range. +func (t text) list(open int) [][2]int { + close := t.match[open] + if close < 0 { + return nil + } + var members [][2]int + start := open + 1 + for i := open + 1; i < close; i++ { + switch t.toks[i].kind { + case tkLParen: + i = t.match[i] + case tkComma: + members = append(members, [2]int{start, i}) + start = i + 1 + } + } + if start < close { + members = append(members, [2]int{start, close}) + } + return members +} + +// item is one entry of a SELECT list: the expression and the name it is +// projected as. +type item struct { + start, end int + alias string +} + +// selectItems reads the list of the first SELECT at the top level of the +// text, which is the statement's own for a query block's expanded_query +// and for a statement whose CTEs come first. +func (t text) selectItems() []item { + depth := 0 + start := -1 + for i, tok := range t.toks { + switch tok.kind { + case tkLParen: + depth++ + case tkRParen: + depth-- + case tkWord: + if depth == 0 && tok.text == "select" { + start = i + 1 + } + } + if start >= 0 { + break + } + } + if start < 0 { + return nil + } + for t.at(start).kind == tkWord && (t.at(start).text == "distinct" || t.at(start).text == "all" || t.at(start).text == "sql_calc_found_rows" || t.at(start).text == "straight_join" || t.at(start).text == "high_priority") { + start++ + } + end := len(t.toks) + for i := start; i < len(t.toks); i++ { + switch tok := t.toks[i]; tok.kind { + case tkLParen: + i = t.match[i] + if i < 0 { + return nil + } + case tkWord: + switch tok.text { + case "from", "where", "group", "having", "order", "limit", "union", "into", "window", "for", "lock", "except", "intersect": + end = i + } + } + if end != len(t.toks) { + break + } + } + var items []item + itemStart := start + flush := func(itemEnd int) { + it := item{start: itemStart, end: itemEnd} + if itemEnd-itemStart >= 3 && t.isWord(itemEnd-2, "as") && t.at(itemEnd-1).kind == tkIdent { + it.alias = t.toks[itemEnd-1].parts[0] + it.end = itemEnd - 2 + } + items = append(items, it) + } + for i := start; i < end; i++ { + switch t.toks[i].kind { + case tkLParen: + i = t.match[i] + case tkComma: + flush(i) + itemStart = i + 1 + } + } + if itemStart < end { + flush(end) + } + return items +} + +// tableRef is a table as a FROM clause names it, with the schema when it +// spells one out. +type tableRef struct { + schema, name string +} + +// aliases reads the table aliases the text declares: a table name followed +// by a bare identifier, as `users` `u` in a FROM clause. A SELECT list +// alias is always introduced by AS, so the shape means nothing else. +func (t text) aliases(into map[string]tableRef) { + for i := 0; i+1 < len(t.toks); i++ { + tok, next := t.toks[i], t.toks[i+1] + if tok.kind != tkIdent || next.kind != tkIdent || len(next.parts) != 1 || len(tok.parts) > 2 { + continue + } + if t.at(i-1).kind == tkOp && t.at(i-1).text == "." { + continue + } + ref := tableRef{name: tok.parts[len(tok.parts)-1]} + if len(tok.parts) == 2 { + ref.schema = tok.parts[0] + } + into[next.parts[0]] = ref + } +} + +// find returns the index of the variable named name, or -1. +func (t text) findVar(name string) int { + for i, tok := range t.toks { + if tok.kind == tkVar && len(tok.parts) == 1 && tok.parts[0] == name { + return i + } + } + return -1 +} + +// findNumber returns the index of the number printed as lit, or -1. +func (t text) findNumber(lit string) int { + for i, tok := range t.toks { + if tok.kind == tkNumber && tok.text == lit { + return i + } + } + return -1 +} + +// A partner is what a parameter stands against in a statement. +type partnerKind int + +const ( + partnerNone partnerKind = iota + partnerOperand // the operand it is compared with, or the argument beside it + partnerProjection // the SELECT list item it is projected as + partnerInsert // the column of an INSERT ... VALUES row it is written to + partnerLimit // the count of a LIMIT or OFFSET +) + +type partner struct { + kind partnerKind + start, end int // partnerOperand: the operand's tokens + index int // partnerProjection: the item; partnerInsert: the position in the row +} + +// partner finds what the parameter at token index s stands against. +func (t text) partner(s int) partner { + lo, hi := s, s+1 + if t.at(lo-1).kind == tkLParen && t.at(hi).kind == tkRParen { + lo, hi = lo-1, hi+1 + } + if t.at(hi).kind == tkWord && t.at(hi).text == "as" { + for i, it := range t.selectItems() { + if it.start <= lo && hi <= it.end { + return partner{kind: partnerProjection, index: i} + } + } + } + // The count of a LIMIT or OFFSET, which is a number rather than a + // variable since MySQL allows nothing else there. + if t.at(lo-1).kind == tkWord && (t.at(lo-1).text == "limit" || t.at(lo-1).text == "offset") || + t.at(lo-1).kind == tkComma && t.at(lo-2).kind == tkNumber && t.isWord(lo-3, "limit") { + return partner{kind: partnerLimit} + } + // Compared: the operand on the other side of the operator. + if t.isOperator(lo - 1) { + q := lo - 2 + if t.isWord(q, "not") { + q-- + } + if st := t.operandStart(q + 1); st >= 0 { + // The second bound of BETWEEN ... AND: the operand before BETWEEN. + if t.isWord(lo-1, "and") { + if t.isWord(st-1, "between") || t.isWord(st-1, "not") && t.isWord(st-2, "between") { + q = st - 2 + if t.isWord(q, "not") { + q-- + } + if st2 := t.operandStart(q + 1); st2 >= 0 { + return partner{kind: partnerOperand, start: st2, end: q + 1} + } + } + } + return partner{kind: partnerOperand, start: st, end: q + 1} + } + } + if t.isWord(lo-1, "and") { + if st := t.operandStart(lo - 1); st >= 0 && (t.isWord(st-1, "between") || t.isWord(st-1, "not") && t.isWord(st-2, "between")) { + q := st - 2 + if t.isWord(q, "not") { + q-- + } + if st2 := t.operandStart(q + 1); st2 >= 0 { + return partner{kind: partnerOperand, start: st2, end: q + 1} + } + } + } + if t.isOperator(hi) { + n := hi + 1 + if t.isWord(n, "not") { + n++ + } + if end := t.operandEnd(n); end >= 0 { + return partner{kind: partnerOperand, start: n, end: end} + } + } + // A member of a list: the row of an INSERT ... VALUES, the values of an + // IN, or the arguments of a call, where the argument beside it says + // what it is, a column above an expression above a constant. + if t.at(lo-1).kind == tkComma || t.at(lo-1).kind == tkLParen { + open := t.group(lo) + if open < 0 { + return partner{} + } + members := t.list(open) + index := -1 + for i, m := range members { + if m[0] <= lo && hi <= m[1] { + index = i + } + } + head := open - 1 + for t.at(head).kind == tkComma && t.at(head-1).kind == tkRParen { + head = t.match[head-1] - 1 + } + switch { + case t.isWord(head, "values") || t.isWord(head, "value"): + return partner{kind: partnerInsert, index: index} + case t.isWord(head, "in"): + q := head - 1 + if t.isWord(q, "not") { + q-- + } + if st := t.operandStart(q + 1); st >= 0 { + return partner{kind: partnerOperand, start: st, end: q + 1} + } + case t.at(head).kind == tkWord && t.isCall(head): + best, bestRank := -1, 3 + for i, m := range members { + if i == index { + continue + } + if r := t.rank(m[0], m[1]); r < bestRank { + best, bestRank = i, r + } + } + if best >= 0 { + return partner{kind: partnerOperand, start: members[best][0], end: members[best][1]} + } + } + } + return partner{} +} + +// rank orders operands by how much they say about a parameter beside them. +func (t text) rank(start, end int) int { + switch tok := t.at(start); { + case end-start == 1 && tok.kind == tkIdent: + return 0 + case tok.kind == tkVar: + return 3 + case end-start == 1: + return 2 + } + return 1 +} + +// idents lists the qualified identifiers in a token range: the columns an +// expression reads. +func (t text) idents(start, end int) []token { + var out []token + for i := start; i < end; i++ { + if tok := t.toks[i]; tok.kind == tkIdent && len(tok.parts) >= 2 { + out = append(out, tok) + } + } + return out +} + +// slice is the source text of a token range. +func (t text) slice(start, end int) string { + if start >= end { + return "" + } + return t.src[t.toks[start].start:t.toks[end-1].end] +} + +// quote backticks an identifier. +func quote(name string) string { + return "`" + strings.ReplaceAll(name, "`", "``") + "`" +} diff --git a/internal/goldeneye/mysql/trace.go b/internal/goldeneye/mysql/trace.go new file mode 100644 index 0000000000..c7f040f584 --- /dev/null +++ b/internal/goldeneye/mysql/trace.go @@ -0,0 +1,87 @@ +package mysql + +import ( + "encoding/json" + "fmt" + "sort" + "strings" +) + +// trace is what the optimizer trace says about a statement: the text of +// each query block after name resolution and before optimisation, by the +// number MySQL gives the block, and the block each derived table or CTE is +// materialised from. +// +// The trace is the one place MySQL prints a query block as it was resolved +// rather than as it was optimised. The note EXPLAIN leaves is printed +// after optimisation, and a lookup on a unique key against an empty table +// folds to `NULL = (@x)` there, losing the column the parameter was +// compared with; the expanded_query of the block still has it. +type trace struct { + blocks map[int]text + derived map[string]int +} + +// parseTrace reads the JSON of the OPTIMIZER_TRACE table's TRACE column. +func parseTrace(blob string) (trace, error) { + tr := trace{blocks: map[int]text{}, derived: map[string]int{}} + if strings.TrimSpace(blob) == "" { + return tr, nil + } + var v any + if err := json.Unmarshal([]byte(blob), &v); err != nil { + return tr, fmt.Errorf("reading the optimizer trace: %w", err) + } + tr.walk(v, 0) + return tr, nil +} + +// walk collects the first expanded_query printed for each block — the one +// join_preparation prints, before join_optimization prints its rewrite — +// and the derived tables. Lists are walked in order and objects in key +// order, so the result does not depend on map iteration. +func (tr *trace) walk(v any, sel int) { + switch v := v.(type) { + case map[string]any: + if n, ok := v["select#"].(float64); ok { + sel = int(n) + } + if d, ok := v["derived"].(map[string]any); ok { + if table, ok := d["table"].(string); ok { + if n, ok := d["select#"].(float64); ok { + tr.derived[strings.Trim(table, "` ")] = int(n) + } + } + } + if q, ok := v["expanded_query"].(string); ok { + if _, seen := tr.blocks[sel]; !seen { + tr.blocks[sel] = tokenize(q) + } + } + keys := make([]string, 0, len(v)) + for k := range v { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + tr.walk(v[k], sel) + } + case []any: + for _, c := range v { + tr.walk(c, sel) + } + } +} + +// order lists the block numbers innermost first: a block's text includes +// its subqueries' text, and a subquery is numbered after the block it is +// in, so the block a parameter belongs to is the highest-numbered block +// whose text has it. +func (tr *trace) order() []int { + sels := make([]int, 0, len(tr.blocks)) + for sel := range tr.blocks { + sels = append(sels, sel) + } + sort.Sort(sort.Reverse(sort.IntSlice(sels))) + return sels +} diff --git a/internal/goldeneye/postgresql/postgresql.go b/internal/goldeneye/postgresql/postgresql.go new file mode 100644 index 0000000000..b94ff5e5ef --- /dev/null +++ b/internal/goldeneye/postgresql/postgresql.go @@ -0,0 +1,364 @@ +// Package postgresql generates the PostgreSQL dialect seed under +// internal/engine/postgresql/dialect from a live server: pg_catalog's +// functions, the relations of pg_catalog and information_schema, and one +// directory per contrib extension holding the types and functions CREATE +// EXTENSION adds. types.jsonl and operators.jsonl at the top of the dialect +// are written by hand and are not this package's business. +// +// The server is named by POSTGRESQL_SERVER_URI and has to be the major +// release in Major, since each release adds to its catalogs. +package postgresql + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "os" + "path" + "sort" + "strconv" + "strings" + + "github.com/jackc/pgx/v5" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name of the engine directory the dialect lives under. +const Engine = "postgresql" + +// Major is the PostgreSQL major release the dialect is generated from. +// Bumping it is a deliberate change: every release adds functions and +// catalog columns, so regenerate and review the dialect after changing it. +const Major = 16 + +// https://dba.stackexchange.com/questions/255412/how-to-select-functions-that-belong-in-a-given-extension-in-postgresql +// +// Extension functions are added to the public schema +const extensionFuncs = ` +WITH extension_funcs AS ( + SELECT p.oid + FROM pg_catalog.pg_extension AS e + INNER JOIN pg_catalog.pg_depend AS d ON (d.refobjid = e.oid) + INNER JOIN pg_catalog.pg_proc AS p ON (p.oid = d.objid) + INNER JOIN pg_catalog.pg_namespace AS ne ON (ne.oid = e.extnamespace) + INNER JOIN pg_catalog.pg_namespace AS np ON (np.oid = p.pronamespace) + WHERE d.deptype = 'e' AND e.extname = $1 +) +SELECT p.proname as name, + format_type(p.prorettype, NULL), + array(select format_type(unnest(p.proargtypes), NULL)), + p.proargnames, + p.proargnames[p.pronargs-p.pronargdefaults+1:p.pronargs], + p.proargmodes::text[] +FROM pg_catalog.pg_proc p +JOIN extension_funcs ef ON ef.oid = p.oid +WHERE pg_function_is_visible(p.oid) +-- simply order all columns to keep subsequent runs stable +ORDER BY 1, 2, 3, 4, 5; +` + +// The types an extension defines, in the order they were declared so that a +// type appears after the types it is built on. Array types are created +// implicitly rather than by the extension's script, so they carry an internal +// dependency and never show up here. +const extensionTypes = ` +SELECT t.typname, t.typcategory +FROM pg_catalog.pg_extension AS e + INNER JOIN pg_catalog.pg_depend AS d ON (d.refobjid = e.oid) + INNER JOIN pg_catalog.pg_type AS t ON (t.oid = d.objid) +WHERE d.deptype = 'e' + AND d.classid = 'pg_catalog.pg_type'::regclass + AND e.extname = $1 + AND t.typtype <> 'p' +ORDER BY t.oid; +` + +// Locate returns the server to generate from, named by POSTGRESQL_SERVER_URI. +func Locate() (string, error) { + if url := os.Getenv("POSTGRESQL_SERVER_URI"); url != "" { + return url, nil + } + return "", errors.New("POSTGRESQL_SERVER_URI is not set") +} + +// Version reports the release a server is. +func Version(ctx context.Context, url string) (string, error) { + conn, err := pgx.Connect(ctx, url) + if err != nil { + return "", err + } + defer conn.Close(ctx) + var version string + if err := conn.QueryRow(ctx, "SELECT version()").Scan(&version); err != nil { + return "", err + } + return version, nil +} + +// checkVersion refuses a server of another major release than the dialect +// is generated from, whose catalogs would differ from the committed ones +// without anything being wrong. +func checkVersion(ctx context.Context, conn *pgx.Conn) error { + var num string + if err := conn.QueryRow(ctx, "SELECT current_setting('server_version_num')").Scan(&num); err != nil { + return err + } + n, err := strconv.Atoi(num) + if err != nil { + return fmt.Errorf("server_version_num %q: %w", num, err) + } + if major := n / 10000; major != Major { + return fmt.Errorf("the dialect is generated from PostgreSQL %d, but the server is PostgreSQL %d", Major, major) + } + return nil +} + +func clean(arg string) string { + arg = strings.TrimSpace(arg) + arg = strings.Replace(arg, "\"any\"", "any", -1) + arg = strings.Replace(arg, "\"char\"", "char", -1) + arg = strings.Replace(arg, "\"timestamp\"", "char", -1) + return arg +} + +// encodeFunctions encodes procs as JSONL, one function per line, in the form +// the seed package reads. Both the analysis core and the catalog the legacy +// compiler builds load the result. +func encodeFunctions(procs []Proc) ([]byte, error) { + funcs := make([]dialect.Function, 0, len(procs)) + for _, proc := range procs { + fn := dialect.Function{Name: proc.Name, Returns: proc.ReturnTypeName()} + for _, arg := range proc.Args() { + a := dialect.Arg{Name: arg.Name, Type: arg.TypeName(), HasDefault: arg.HasDefault} + if arg.Mode != "" && arg.Mode != "i" { + a.Mode = arg.Mode + } + fn.Args = append(fn.Args, a) + } + funcs = append(funcs, fn) + } + return dialect.JSONL(funcs) +} + +// readExtensionTypes reads the types an extension defines. +func readExtensionTypes(ctx context.Context, conn *pgx.Conn, extension string) ([]dialect.Type, error) { + rows, err := conn.Query(ctx, extensionTypes, extension) + if err != nil { + return nil, err + } + defer rows.Close() + var types []dialect.Type + for rows.Next() { + var t dialect.Type + if err := rows.Scan(&t.Name, &t.Category); err != nil { + return nil, err + } + types = append(types, t) + } + return types, rows.Err() +} + +// writeRelations appends a schema's relations to out as JSONL, one relation +// per line, in the form the seed package reads. +func writeRelations(out *bytes.Buffer, schemaName string, relations []Relation) error { + enc := json.NewEncoder(out) + for _, relation := range relations { + rec := dialect.Relation{ + Catalog: relation.Catalog, + Schema: schemaName, + Name: relation.Name, + } + for _, col := range relation.Columns { + c := dialect.Column{ + Name: col.Name, + Type: col.Type, + NotNull: col.IsNotNull, + Array: col.IsArray, + } + if col.Length != nil { + c.Length = *col.Length + } + rec.Columns = append(rec.Columns, c) + } + if err := enc.Encode(rec); err != nil { + return err + } + } + return nil +} + +// preserveLegacyCatalogBehavior maintain previous ordering and filtering +// that was manually done to the generated file pg_catalog.go. +// Some of the test depend on this ordering - in particular, function lookups +// where there might be multiple matching functions (due to type overloads) +// Until sqlc supports "smarter" looking up of these functions, +// preserveLegacyCatalogBehavior ensures there are no accidental test breakages +func preserveLegacyCatalogBehavior(allProcs []Proc) []Proc { + // Preserve the legacy sort order of the end-to-end tests + sort.SliceStable(allProcs, func(i, j int) bool { + fnA := allProcs[i] + fnB := allProcs[j] + + if fnA.Name == "lower" && fnB.Name == "lower" && len(fnA.ArgTypes) == 1 && fnA.ArgTypes[0] == "text" { + return true + } + + if fnA.Name == "generate_series" && fnB.Name == "generate_series" && len(fnA.ArgTypes) == 2 && fnA.ArgTypes[0] == "numeric" { + return true + } + + return false + }) + + procs := make([]Proc, 0, len(allProcs)) + for _, p := range allProcs { + // Skip generating pg_catalog.concat to preserve legacy behavior + if p.Name == "concat" { + continue + } + + procs = append(procs, p) + } + + return procs +} + +// Generate reads the dialect from the server. It creates every contrib +// extension it describes, so the server's contrib package has to be +// installed. +func Generate(ctx context.Context, url string) (dialect.Files, error) { + conn, err := pgx.Connect(ctx, url) + if err != nil { + return nil, err + } + defer conn.Close(ctx) + if err := checkVersion(ctx, conn); err != nil { + return nil, err + } + + files := dialect.Files{} + + // The two schemas sqlc knows PostgreSQL by. pg_catalog's functions are + // the dialect's standard library; the relations of both share one file, + // keyed by schema. + procs, err := readProcs(ctx, conn, "pg_catalog", extensions) + if err != nil { + return nil, err + } + if files[dialect.FunctionsFile], err = encodeFunctions(preserveLegacyCatalogBehavior(procs)); err != nil { + return nil, err + } + var relations bytes.Buffer + for _, schema := range []string{"pg_catalog", "information_schema"} { + rels, err := readRelations(ctx, conn, schema) + if err != nil { + return nil, err + } + if err := writeRelations(&relations, schema, rels); err != nil { + return nil, err + } + } + files[dialect.RelationsFile] = relations.Bytes() + + // Each extension is a directory of its own under the dialect, holding the + // functions CREATE EXTENSION adds to the catalog. + for _, extension := range extensions { + if _, err := conn.Exec(ctx, fmt.Sprintf("CREATE EXTENSION IF NOT EXISTS %q", extension)); err != nil { + return nil, fmt.Errorf("error creating %s: %s", extension, err) + } + + rows, err := conn.Query(ctx, extensionFuncs, extension) + if err != nil { + return nil, err + } + procs, err := scanProcs(rows) + if err != nil { + return nil, err + } + types, err := readExtensionTypes(ctx, conn, extension) + if err != nil { + return nil, err + } + if len(procs) == 0 && len(types) == 0 { + continue + } + + // Preserve the legacy sort order of the end-to-end tests + sort.SliceStable(procs, func(i, j int) bool { + fnA := procs[i] + fnB := procs[j] + + if extension == "pgcrypto" { + if fnA.Name == "digest" && fnB.Name == "digest" && len(fnA.ArgTypes) == 2 && fnA.ArgTypes[0] == "text" { + return true + } + } + + return false + }) + + extensionDir := path.Join(dialect.ExtensionsDir, extension) + if len(types) > 0 { + if files[path.Join(extensionDir, dialect.TypesFile)], err = dialect.JSONL(types); err != nil { + return nil, fmt.Errorf("error generating extension %s: %w", extension, err) + } + } + if files[path.Join(extensionDir, dialect.FunctionsFile)], err = encodeFunctions(procs); err != nil { + return nil, fmt.Errorf("error generating extension %s: %w", extension, err) + } + } + + return files, nil +} + +// https://www.postgresql.org/docs/current/contrib.html +var extensions = []string{ + "adminpack", + "amcheck", + // "auth_delay", + // "auto_explain", + // "bloom", + "btree_gin", + "btree_gist", + "citext", + "cube", + "dblink", + // "dict_int", + // "dict_xsyn", + "earthdistance", + "file_fdw", + "fuzzystrmatch", + "hstore", + "intagg", + "intarray", + "isn", + "lo", + "ltree", + "pageinspect", + // "passwordcheck", + "pg_buffercache", + "pg_freespacemap", + "pg_prewarm", + "pg_stat_statements", + "pg_trgm", + "pg_visibility", + "pgcrypto", + "pgrowlocks", + "pgstattuple", + "postgres_fdw", + "seg", + // "sepgsql", + // "spi", + "sslinfo", + "tablefunc", + "tcn", + // "test_decoding", + // "tsm_system_rows", + // "tsm_system_time", + "unaccent", + "uuid-ossp", + "xml2", +} diff --git a/internal/goldeneye/postgresql/postgresql_test.go b/internal/goldeneye/postgresql/postgresql_test.go new file mode 100644 index 0000000000..e892b12a96 --- /dev/null +++ b/internal/goldeneye/postgresql/postgresql_test.go @@ -0,0 +1,37 @@ +package postgresql + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// TestDialect verifies the committed PostgreSQL dialect against what the +// server reports. It skips unless POSTGRESQL_SERVER_URI names a server. +func TestDialect(t *testing.T) { + url, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, url) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, url) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Engine) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} diff --git a/internal/goldeneye/postgresql/proc.go b/internal/goldeneye/postgresql/proc.go new file mode 100644 index 0000000000..31933c7f99 --- /dev/null +++ b/internal/goldeneye/postgresql/proc.go @@ -0,0 +1,163 @@ +package postgresql + +import ( + "context" + "strings" + + pgx "github.com/jackc/pgx/v5" +) + +// https://stackoverflow.com/questions/25308765/postgresql-how-can-i-inspect-which-arguments-to-a-procedure-have-a-default-valu +const catalogFuncs = ` +SELECT p.proname as name, + format_type(p.prorettype, NULL), + array(select format_type(unnest(p.proargtypes), NULL)), + p.proargnames, + p.proargnames[p.pronargs-p.pronargdefaults+1:p.pronargs], + p.proargmodes::text[] +FROM pg_catalog.pg_proc p +LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace +WHERE n.nspname::text = $1 + AND pg_function_is_visible(p.oid) + -- A function that one of the extensions the dialect describes separately + -- put in the schema, as adminpack puts its own in pg_catalog, belongs to + -- that extension's directory: leaving it out here keeps the output the + -- same whether or not the extension is installed. + AND NOT EXISTS ( + SELECT 1 + FROM pg_catalog.pg_depend d + INNER JOIN pg_catalog.pg_extension e ON e.oid = d.refobjid + WHERE d.classid = 'pg_catalog.pg_proc'::regclass + AND d.objid = p.oid + AND d.deptype = 'e' + AND e.extname = ANY($2)) +-- simply order all columns to keep subsequent runs stable +ORDER BY 1, 2, 3, 4, 5; +` + +type Proc struct { + Name string + ReturnType string + ArgTypes []string + ArgNames []string + HasDefault []string + ArgModes []string +} + +func (p *Proc) ReturnTypeName() string { + return clean(p.ReturnType) +} + +func (p *Proc) Args() []Arg { + var args []Arg + defaults := map[string]bool{} + for _, name := range p.HasDefault { + defaults[name] = true + } + + for i, argType := range p.ArgTypes { + mode := "i" + name := "" + if i < len(p.ArgModes) { + mode = p.ArgModes[i] + } + if i < len(p.ArgNames) { + name = p.ArgNames[i] + } + + args = append(args, Arg{ + Name: name, + Type: argType, + Mode: mode, + HasDefault: defaults[name], + }) + } + + // Some manual changes until https://github.com/sqlc-dev/sqlc/pull/1748 + // can be completely implmented + if p.Name == "mode" { + return nil + } + + if p.Name == "percentile_cont" && len(args) == 2 { + args = args[:1] + } + + if p.Name == "percentile_disc" && len(args) == 2 { + args = args[:1] + } + + return args +} + +type Arg struct { + Name string + Mode string + Type string + HasDefault bool +} + +func (a *Arg) TypeName() string { + return clean(a.Type) +} + +func scanProcs(rows pgx.Rows) ([]Proc, error) { + defer rows.Close() + // Iterate through the result set + var procs []Proc + for rows.Next() { + var p Proc + err := rows.Scan( + &p.Name, + &p.ReturnType, + &p.ArgTypes, + &p.ArgNames, + &p.HasDefault, + &p.ArgModes, + ) + if err != nil { + return nil, err + } + + // TODO: Filter these out in SQL + if strings.HasPrefix(p.ReturnType, "SETOF") { + continue + } + + // The internal pseudo-type is used to declare functions that are meant + // only to be called internally by the database system, and not by + // direct invocation in an SQL query. If a function has at least one + // internal-type argument then it cannot be called from SQL. To + // preserve the type safety of this restriction it is important to + // follow this coding rule: do not create any function that is declared + // to return internal unless it has at least one internal argument + // + // https://www.postgresql.org/docs/current/datatype-pseudo.html + var skip bool + for i := range p.ArgTypes { + if p.ArgTypes[i] == "internal" { + skip = true + } + } + if skip { + continue + } + if p.ReturnType == "internal" { + continue + } + + procs = append(procs, p) + } + return procs, rows.Err() +} + +// readProcs reads the functions of a schema, leaving out the ones that +// belong to any of the named extensions. +func readProcs(ctx context.Context, conn *pgx.Conn, schemaName string, extensions []string) ([]Proc, error) { + rows, err := conn.Query(ctx, catalogFuncs, schemaName, extensions) + if err != nil { + return nil, err + } + + return scanProcs(rows) +} diff --git a/internal/tools/sqlc-pg-gen/relation.go b/internal/goldeneye/postgresql/relation.go similarity index 77% rename from internal/tools/sqlc-pg-gen/relation.go rename to internal/goldeneye/postgresql/relation.go index 3b61489392..7e036a0ff2 100644 --- a/internal/tools/sqlc-pg-gen/relation.go +++ b/internal/goldeneye/postgresql/relation.go @@ -1,9 +1,9 @@ -package main +package postgresql import ( "context" - pgx "github.com/jackc/pgx/v4" + pgx "github.com/jackc/pgx/v5" ) // Relations are the relations available in pg_tables and pg_views @@ -19,13 +19,20 @@ select relations.name as tablename, pg_attribute.attname as column_name, attnotnull as column_notnull, - column_type.typname as column_type, - nullif(column_type.typlen, -1) as column_length, - column_type.typcategory = 'A' as column_isarray + -- An array column's type is its element's, with the array flag set, + -- rather than pg_type's own _text spelling of the array type. Only the + -- _-prefixed array types count: int2vector and oidvector are in the + -- array category and carry an element, but are types of their own. + coalesce(element_type.typname, column_type.typname) as column_type, + nullif(coalesce(element_type.typlen, column_type.typlen), -1) as column_length, + element_type.oid is not null as column_isarray from relations inner join pg_catalog.pg_class on pg_class.relname = relations.name left join pg_catalog.pg_attribute on pg_attribute.attrelid = pg_class.oid inner join pg_catalog.pg_type column_type on pg_attribute.atttypid = column_type.oid +left join pg_catalog.pg_type element_type + on column_type.typcategory = 'A' and column_type.typname like '\_%' + and element_type.oid = column_type.typelem where relations.schemaname = $1 -- Make sure these columns are always generated in the same order -- so that the output is stable diff --git a/internal/goldeneye/spanner/analyze.go b/internal/goldeneye/spanner/analyze.go new file mode 100644 index 0000000000..813ec3f7ff --- /dev/null +++ b/internal/goldeneye/spanner/analyze.go @@ -0,0 +1,673 @@ +package spanner + +import ( + "context" + "fmt" + "hash/crc32" + "os" + "regexp" + "strconv" + "strings" + + "cloud.google.com/go/spanner/apiv1/spannerpb" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// The analyze cases are checked against a live server, which compiles +// each query in PLAN mode: nothing runs, and the server reports the name +// and type of each result column, the type of each parameter the query +// leaves undeclared, and the query plan. The metadata types a value the +// way the wire does — STRING, ARRAY — without the length a +// declaration gives a STRING(10) or whether the column can be NULL, so a +// result column the plan reads from a table column is described from the +// case's INFORMATION_SCHEMA instead, and a parameter the plan compares +// with or assigns to a table column is described as that column. + +// placeholder is one parameter of a query as sqlc numbers them: each +// @name or sqlc.arg name once, at its first appearance, which is how +// Spanner numbers its named parameters too. +type placeholder struct { + Number int + Name string +} + +var identRe = regexp.MustCompile(`^@([A-Za-z_][A-Za-z0-9_]*)`) + +// bind rewrites the query so that every parameter is a Spanner @name, and +// lists the parameters in sqlc's order. The query's own @name references +// are kept, since that is how sqlc's GoogleSQL queries name their +// parameters; a sqlc.arg becomes one, and each ? in turn becomes one +// named after its position. A @@system_variable is not a parameter. +func bind(query string) (string, []placeholder) { + positional := 0 + sql := endtoend.Rewrite(query, func(name, _ string) string { + if name == "" { + positional++ + name = "p" + strconv.Itoa(positional) + } + return "@" + name + }) + var phs []placeholder + numbers := map[string]int{} + i := 0 + for i < len(sql) { + c := sql[i] + switch { + case c == '\'' || c == '"' || c == '`': + i = skipQuoted(sql, i) + case strings.HasPrefix(sql[i:], "--") || strings.HasPrefix(sql[i:], "#"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + i = len(sql) + } else { + i += end + } + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + i = len(sql) + } else { + i += end + 2 + } + case c == '@' && i+1 < len(sql) && sql[i+1] == '@': + i += 2 + for i < len(sql) && (isWordByte(sql[i])) { + i++ + } + case c == '@' && identRe.MatchString(sql[i:]): + m := identRe.FindStringSubmatch(sql[i:]) + if _, ok := numbers[m[1]]; !ok { + numbers[m[1]] = len(phs) + 1 + phs = append(phs, placeholder{Number: len(phs) + 1, Name: m[1]}) + } + i += len(m[0]) + default: + i++ + } + } + return sql, phs +} + +func isWordByte(c byte) bool { + return c == '_' || c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' +} + +// skipQuoted returns the index just past the quoted token starting at i, +// honouring backslash escapes. +func skipQuoted(s string, i int) int { + q := s[i] + j := i + 1 + for j < len(s) { + switch { + case s[j] == '\\' && j+1 < len(s): + j += 2 + case s[j] == q: + return j + 1 + default: + j++ + } + } + return len(s) +} + +// splitStatements splits a script on the semicolons outside strings and +// comments, which is how a schema's DDL is handed to CREATE DATABASE and a +// fixture's DML to a transaction. +func splitStatements(src string) []string { + var stmts []string + flush := func(s string) { + if s = strings.TrimSpace(s); s != "" { + stmts = append(stmts, s) + } + } + start, i := 0, 0 + for i < len(src) { + c := src[i] + switch { + case c == '\'' || c == '"' || c == '`': + i = skipQuoted(src, i) + case strings.HasPrefix(src[i:], "--") || strings.HasPrefix(src[i:], "#"): + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + i = len(src) + } else { + i += end + } + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + i = len(src) + } else { + i += end + 2 + } + case c == ';': + flush(src[start:i]) + start = i + 1 + i++ + default: + i++ + } + } + flush(src[start:]) + return stmts +} + +// column is what INFORMATION_SCHEMA says about a column of the case's +// database: its type as the schema declared it, and whether it can be +// NULL. +type column struct { + name string + typ *analysis.TypeExpr + nullable bool +} + +// analyzer holds the session a case is compiled in and the catalog of the +// case's database, keyed by table name in the database's own schema. +type analyzer struct { + s *server + session string + catalog map[string][]column + keys map[string][]string // the primary key columns of each table +} + +var dbNameRe = regexp.MustCompile(`[^a-z0-9_]+`) + +// Analyze creates a database of the case's own from its schema, writes its +// fixture there, compiles its queries and returns what Spanner reports in +// the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, endpoint string, c endtoend.Case) ([]byte, error) { + s, err := open(ctx, endpoint) + if err != nil { + return nil, err + } + defer s.Close() + + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + + // A database id is lower-case letters, digits and underscores, at + // most 30 characters: the case's name, cut to fit, and a hash of the + // whole of it, so that two cases with the same head stay apart. + hash := fmt.Sprintf("%08x", crc32.ChecksumIEEE([]byte(c.Name))) + name := "goldeneye_" + dbNameRe.ReplaceAllString(strings.ToLower(c.Name), "_") + if max := 30 - 1 - len(hash); len(name) > max { + name = name[:max] + } + name = strings.TrimRight(name, "_") + "_" + hash + db := Instance + "/databases/" + name + if err := s.dropDatabase(ctx, db); err != nil { + return nil, err + } + if _, err := s.createDatabase(ctx, name, splitStatements(string(schema))); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Schema, err) + } + defer s.dropDatabase(context.WithoutCancel(ctx), db) + session, err := s.session(ctx, db) + if err != nil { + return nil, err + } + if stmts := splitStatements(string(fixture)); len(stmts) > 0 { + if err := s.write(ctx, session, stmts); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Fixture, err) + } + } + + a := &analyzer{s: s, session: session} + if err := a.readCatalog(ctx); err != nil { + return nil, err + } + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := a.analyzeQuery(ctx, q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return analysis.Encode(out) +} + +// Check compares what Spanner reports for a case with the output the +// case committed, returning a diff when they differ. +func Check(ctx context.Context, endpoint string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, endpoint, c) + if err != nil { + return "", err + } + return c.Compare(got) +} + +// write runs DML statements in a read-write transaction and commits it. +func (s *server) write(ctx context.Context, session string, stmts []string) error { + tx, err := s.data.BeginTransaction(ctx, &spannerpb.BeginTransactionRequest{ + Session: session, + Options: &spannerpb.TransactionOptions{Mode: &spannerpb.TransactionOptions_ReadWrite_{ReadWrite: &spannerpb.TransactionOptions_ReadWrite{}}}, + }) + if err != nil { + return err + } + req := &spannerpb.ExecuteBatchDmlRequest{ + Session: session, + Transaction: &spannerpb.TransactionSelector{Selector: &spannerpb.TransactionSelector_Id{Id: tx.Id}}, + Seqno: 1, + } + for _, stmt := range stmts { + req.Statements = append(req.Statements, &spannerpb.ExecuteBatchDmlRequest_Statement{Sql: stmt}) + } + resp, err := s.data.ExecuteBatchDml(ctx, req) + if err == nil && resp.Status != nil && resp.Status.Code != 0 { + err = fmt.Errorf("%s", resp.Status.Message) + } + if err != nil { + s.data.Rollback(context.WithoutCancel(ctx), &spannerpb.RollbackRequest{Session: session, TransactionId: tx.Id}) + return err + } + _, err = s.data.Commit(ctx, &spannerpb.CommitRequest{ + Session: session, + Transaction: &spannerpb.CommitRequest_TransactionId{TransactionId: tx.Id}, + }) + return err +} + +const catalogQuery = ` +SELECT TABLE_NAME, COLUMN_NAME, SPANNER_TYPE, IS_NULLABLE +FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_SCHEMA = '' +ORDER BY TABLE_NAME, ORDINAL_POSITION` + +const keysQuery = ` +SELECT TABLE_NAME, COLUMN_NAME +FROM INFORMATION_SCHEMA.INDEX_COLUMNS +WHERE TABLE_SCHEMA = '' AND INDEX_TYPE = 'PRIMARY_KEY' +ORDER BY TABLE_NAME, ORDINAL_POSITION` + +// readCatalog reads the tables the schema created, and their keys. +func (a *analyzer) readCatalog(ctx context.Context) error { + rows, err := a.s.query(ctx, a.session, catalogQuery) + if err != nil { + return err + } + a.catalog = map[string][]column{} + for _, row := range rows { + table := row[0].GetStringValue() + a.catalog[table] = append(a.catalog[table], column{ + name: row[1].GetStringValue(), + typ: parseType(row[2].GetStringValue()), + nullable: row[3].GetStringValue() == "YES", + }) + } + rows, err = a.s.query(ctx, a.session, keysQuery) + if err != nil { + return err + } + a.keys = map[string][]string{} + for _, row := range rows { + table := row[0].GetStringValue() + a.keys[table] = append(a.keys[table], row[1].GetStringValue()) + } + return nil +} + +// tableName returns the catalog's spelling of a table's name, which +// Spanner matches in any case. +func (a *analyzer) tableName(table string) string { + for t := range a.catalog { + if strings.EqualFold(t, table) { + return t + } + } + return table +} + +// lookup finds a column of a table of the case's database. Spanner +// matches table and column names in any case. +func (a *analyzer) lookup(table, name string) (column, bool) { + for t, cols := range a.catalog { + if !strings.EqualFold(t, table) { + continue + } + for _, col := range cols { + if strings.EqualFold(col.name, name) { + return col, true + } + } + } + return column{}, false +} + +// parseType reads a type spelled the way SPANNER_TYPE and a declaration +// spell it — STRING(10), ARRAY, STRUCT — +// into an expression, in lower case, with MAX an identifier. +func parseType(s string) *analysis.TypeExpr { + s = strings.TrimSpace(s) + lower := strings.ToLower(s) + if element, ok := strings.CutPrefix(lower, "array<"); ok && strings.HasSuffix(element, ">") { + return &analysis.TypeExpr{Name: "array", Args: []analysis.TypeArg{{Type: parseType(s[6 : len(s)-1])}}} + } + for _, kind := range []string{"proto", "enum"} { + if message, ok := strings.CutPrefix(lower, kind+"<"); ok && strings.HasSuffix(message, ">") { + m := s[len(kind)+1 : len(s)-1] + return &analysis.TypeExpr{Name: kind, Args: []analysis.TypeArg{{String: &m}}} + } + } + if fields, ok := strings.CutPrefix(lower, "struct<"); ok && strings.HasSuffix(fields, ">") { + t := &analysis.TypeExpr{Name: "struct"} + for _, f := range splitTop(s[7:len(s)-1], ',') { + f = strings.TrimSpace(f) + label, typ := "", f + if i := strings.IndexAny(f, " \t"); i > 0 && !strings.ContainsAny(f[:i], "<(") { + label, typ = f[:i], strings.TrimSpace(f[i+1:]) + } + t.Args = append(t.Args, analysis.TypeArg{Label: label, Type: parseType(typ)}) + } + return t + } + name, args := lower, "" + if open := strings.IndexByte(lower, '('); open >= 0 && strings.HasSuffix(lower, ")") { + name, args = strings.TrimSpace(lower[:open]), lower[open+1:len(lower)-1] + } + t := &analysis.TypeExpr{Name: name} + if args == "" { + return t + } + for _, arg := range strings.Split(args, ",") { + arg = strings.TrimSpace(arg) + if n, err := strconv.ParseInt(arg, 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } else { + ident := arg + t.Args = append(t.Args, analysis.TypeArg{Ident: &ident}) + } + } + return t +} + +// splitTop splits on a separator outside angle brackets and parentheses. +func splitTop(s string, sep byte) []string { + var out []string + depth, start := 0, 0 + for i := 0; i < len(s); i++ { + switch s[i] { + case '<', '(': + depth++ + case '>', ')': + depth-- + case sep: + if depth == 0 { + out = append(out, s[start:i]) + start = i + 1 + } + } + } + return append(out, s[start:]) +} + +// typeOf reads a type the way the wire spells it, which names the family +// and, for an array or a struct, what it holds, and nothing of a length. +func typeOf(t *spannerpb.Type) *analysis.TypeExpr { + if t == nil { + return nil + } + switch t.Code { + case spannerpb.TypeCode_ARRAY: + return &analysis.TypeExpr{Name: "array", Args: []analysis.TypeArg{{Type: typeOf(t.ArrayElementType)}}} + case spannerpb.TypeCode_STRUCT: + out := &analysis.TypeExpr{Name: "struct"} + if t.StructType != nil { + for _, f := range t.StructType.Fields { + out.Args = append(out.Args, analysis.TypeArg{Label: f.Name, Type: typeOf(f.Type)}) + } + } + return out + case spannerpb.TypeCode_PROTO, spannerpb.TypeCode_ENUM: + // A proto or enum is named by its message, the way a declaration + // spells PROTO. + fqn := t.ProtoTypeFqn + return &analysis.TypeExpr{Name: strings.ToLower(t.Code.String()), Args: []analysis.TypeArg{{String: &fqn}}} + } + return &analysis.TypeExpr{Name: strings.ToLower(t.Code.String())} +} + +// withNullable copies a type with its nullability set. +func withNullable(t *analysis.TypeExpr, nullable bool) *analysis.TypeExpr { + if t == nil { + return nil + } + out := *t + out.Nullable = nullable + return &out +} + +// isDML reports whether a statement writes, and so has to be compiled in a +// read-write transaction, which is begun for it and never committed. The +// statement's first word decides, past any comment it opens with. +func isDML(sql string) bool { + i := 0 + for i < len(sql) { + switch { + case sql[i] == ' ' || sql[i] == '\t' || sql[i] == '\n' || sql[i] == '\r': + i++ + case strings.HasPrefix(sql[i:], "--") || strings.HasPrefix(sql[i:], "#"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + return false + } + i += end + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + return false + } + i += end + 2 + default: + head := strings.ToLower(sql[i:]) + for _, kw := range []string{"insert", "update", "delete"} { + if strings.HasPrefix(head, kw) { + return true + } + } + return false + } + } + return false +} + +// compile compiles a statement in PLAN mode and returns what the server +// reports about it. +func (a *analyzer) compile(ctx context.Context, sql string) (*spannerpb.ResultSet, error) { + req := &spannerpb.ExecuteSqlRequest{ + Session: a.session, + Sql: sql, + QueryMode: spannerpb.ExecuteSqlRequest_PLAN, + } + if isDML(sql) { + req.Transaction = &spannerpb.TransactionSelector{Selector: &spannerpb.TransactionSelector_Begin{ + Begin: &spannerpb.TransactionOptions{Mode: &spannerpb.TransactionOptions_ReadWrite_{ReadWrite: &spannerpb.TransactionOptions_ReadWrite{}}}, + }} + req.Seqno = 1 + } + rs, err := a.s.data.ExecuteSql(ctx, req) + if err != nil { + return nil, err + } + if rs.Metadata != nil && rs.Metadata.Transaction != nil && len(rs.Metadata.Transaction.Id) > 0 { + a.s.data.Rollback(context.WithoutCancel(ctx), &spannerpb.RollbackRequest{Session: a.session, TransactionId: rs.Metadata.Transaction.Id}) + } + return rs, nil +} + +// analyzeQuery compiles one query. +func (a *analyzer) analyzeQuery(ctx context.Context, q endtoend.Query) (analysis.Query, error) { + sql, phs := bind(q.SQL) + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + rs, err := a.compile(ctx, sql) + if err != nil { + return analysis.Query{}, err + } + p := newPlan(rs.Stats.GetQueryPlan()) + partners := p.partners() + describe := func(o origin) (analysis.Column, bool) { + if o.param != "" { + o = partners[o.param] + } + if o.table == "" { + return analysis.Column{}, false + } + col, ok := a.lookup(o.table, o.column) + if !ok { + return analysis.Column{}, false + } + return analysis.Column{Name: col.name, Type: withNullable(col.typ, col.nullable), Table: a.tableName(o.table)}, true + } + + var fields []*spannerpb.StructType_Field + if rs.Metadata != nil && rs.Metadata.RowType != nil { + fields = rs.Metadata.RowType.Fields + } + outputs := p.outputs() + table, operation := p.mutation() + if table != "" { + // A DML plan lists the columns it returns, then the values it + // writes: each of those is a parameter standing for the column + // it is written to. + written := a.written(sql, table, operation) + writes := outputs[min(len(fields), len(outputs)):] + for i, w := range written { + if i >= len(writes) { + break + } + if o := p.resolve(writes[i], map[int32]bool{}); o.param != "" { + if _, ok := partners[o.param]; !ok { + partners[o.param] = origin{table: table, column: w} + } + } + } + outputs = outputs[:min(len(fields), len(outputs))] + } + for i, f := range fields { + ac := analysis.Column{Name: f.Name, Type: typeOf(f.Type)} + var out *spannerpb.PlanNode + if i < len(outputs) { + out = outputs[i] + } + if col, ok := describe(p.resolve(out, map[int32]bool{})); ok { + ac.Type, ac.Table = col.Type, col.Table + } else if table != "" && (out == nil || out.DisplayName != "Function") { + // A THEN RETURN column the plan reads as a constant, such + // as the default a column not inserted takes, is the table's + // column of that name. + if col, ok := a.lookup(table, f.Name); ok { + ac.Type = withNullable(col.typ, col.nullable) + ac.Table = a.tableName(table) + } + } + aq.Columns = append(aq.Columns, ac) + } + + declared := map[string]*spannerpb.Type{} + if rs.Metadata != nil && rs.Metadata.UndeclaredParameters != nil { + for _, f := range rs.Metadata.UndeclaredParameters.Fields { + declared[f.Name] = f.Type + } + } + for _, ph := range phs { + ac, ok := describe(origin{param: ph.Name}) + if !ok { + ac = analysis.Column{Type: typeOf(declared[ph.Name])} + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} + +var ( + insertRe = regexp.MustCompile("(?is)^insert\\s+(?:or\\s+\\w+\\s+)?into\\s+[\\w.`]+\\s*(?:\\(([^)]*)\\))?") + setRe = regexp.MustCompile("(?is)^update\\s+[\\w.`]+(?:\\s+(?:as\\s+)?\\w+)?\\s+set\\s+") +) + +// written lists the columns a DML statement writes, in the order the plan +// lists their values: for an INSERT the columns it inserts, which are the +// statement's column list or every column of the table, and for an +// UPDATE or DELETE the table's key columns, then the columns an UPDATE +// sets. +func (a *analyzer) written(sql, table, operation string) []string { + switch operation { + case "INSERT": + m := insertRe.FindStringSubmatch(sql) + if m == nil { + return nil + } + if strings.TrimSpace(m[1]) == "" { + var cols []string + for _, col := range a.catalog[a.tableName(table)] { + cols = append(cols, col.name) + } + return cols + } + var cols []string + for _, c := range strings.Split(m[1], ",") { + cols = append(cols, strings.Trim(strings.TrimSpace(c), "`")) + } + return cols + case "UPDATE": + cols := append([]string(nil), a.keys[a.tableName(table)]...) + if m := setRe.FindStringIndex(sql); m != nil { + for _, assignment := range setList(sql[m[1]:]) { + target, _, _ := strings.Cut(assignment, "=") + target = strings.TrimSpace(target) + if i := strings.LastIndexByte(target, '.'); i >= 0 { + target = target[i+1:] + } + cols = append(cols, strings.Trim(target, "`")) + } + } + return cols + case "DELETE": + return a.keys[a.tableName(table)] + } + return nil +} + +// setList splits an UPDATE's SET list into its assignments: the text up +// to the WHERE outside strings and parentheses, split on the commas +// outside them. +func setList(s string) []string { + var out []string + depth, start := 0, 0 + for i := 0; i < len(s); i++ { + c := s[i] + switch { + case c == '\'' || c == '"' || c == '`': + i = skipQuoted(s, i) - 1 + case c == '(': + depth++ + case c == ')': + depth-- + case c == ',' && depth == 0: + out = append(out, s[start:i]) + start = i + 1 + case depth == 0 && (i == 0 || !isWordByte(s[i-1])) && len(s)-i >= 5 && strings.EqualFold(s[i:i+5], "where") && (len(s) == i+5 || !isWordByte(s[i+5])): + return append(out, s[start:i]) + } + } + return append(out, s[start:]) +} diff --git a/internal/goldeneye/spanner/library.go b/internal/goldeneye/spanner/library.go new file mode 100644 index 0000000000..6aaadc5d4a --- /dev/null +++ b/internal/goldeneye/spanner/library.go @@ -0,0 +1,428 @@ +package spanner + +import ( + "bufio" + "bytes" + "context" + _ "embed" + "encoding/json" + "fmt" + "sort" + "strconv" + "strings" + + "cloud.google.com/go/spanner/apiv1/spannerpb" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Spanner keeps no catalog of its types, functions or operators, so the +// library is read by asking: each candidate is compiled in PLAN mode, which +// runs nothing, against a probe database, and what Spanner accepts is kept +// with the type it reports. + +// libraryDatabase is the probe database the library is read from. +const libraryDatabase = "goldeneye_library" + +// librarySchema is the probe database: a table with a NOT NULL column of +// each type a candidate's argument can be, the search indexes SCORE and +// SEARCH need, the sequence GET_NEXT_SEQUENCE_VALUE draws from, and a +// commit timestamp column for PENDING_COMMIT_TIMESTAMP. +var librarySchema = []string{ + `CREATE TABLE probe ( + id INT64 NOT NULL, + i INT64 NOT NULL, + s STRING(MAX) NOT NULL, + f FLOAT64 NOT NULL, + f32 FLOAT32 NOT NULL, + n NUMERIC NOT NULL, + b BOOL NOT NULL, + byt BYTES(MAX) NOT NULL, + d DATE NOT NULL, + ts TIMESTAMP NOT NULL, + j JSON NOT NULL, + ai ARRAY NOT NULL, + ast ARRAY NOT NULL, + af ARRAY NOT NULL, + af32 ARRAY NOT NULL, + aj ARRAY NOT NULL, + ab ARRAY NOT NULL, + tl TOKENLIST AS (TOKENIZE_FULLTEXT(s)) HIDDEN, + tl_substring TOKENLIST AS (TOKENIZE_SUBSTRING(s)) HIDDEN, + tl_ngrams TOKENLIST AS (TOKENIZE_NGRAMS(s)) HIDDEN, +) PRIMARY KEY (id)`, + `CREATE SEARCH INDEX probe_search ON probe(tl, tl_substring, tl_ngrams)`, + `CREATE SEQUENCE probe_sequence OPTIONS (sequence_kind = 'bit_reversed_positive')`, + `CREATE TABLE probe_commits ( + id INT64 NOT NULL, + committed_at TIMESTAMP OPTIONS (allow_commit_timestamp = true), +) PRIMARY KEY (id)`, +} + +// probeValues is the expression a candidate's argument of each type is +// called with: the probe table's column of that type, so that the call is +// made the way a query makes it, on a value rather than a constant. +var probeValues = map[string]string{ + "int64": "i", + "string": "s", + "float64": "f", + "float32": "f32", + "numeric": "n", + "bool": "b", + "bytes": "byt", + "date": "d", + "timestamp": "ts", + "json": "j", + "interval": "INTERVAL 1 DAY", + "tokenlist": "tl", + "array(int64)": "ai", + "array(string)": "ast", + "array(float64)": "af", + "array(float32)": "af32", + "array(json)": "aj", + "array(bytes)": "ab", +} + +// libraryTypes are the types the dialect lists, in the order types.jsonl +// does, with the category sqlc groups each in and the spelling Spanner is +// asked to cast to. A type Spanner does not have, BigQuery's BIGNUMERIC or +// DATETIME, is GoogleSQL's all the same, and the engine is GoogleSQL's, +// shared with BigQuery; those have no probe and are listed as they are. +var libraryTypes = []struct { + dialect.Type + probe string +}{ + {dialect.Type{Name: "bool", Category: "B"}, "BOOL"}, + {dialect.Type{Name: "int64", Category: "N"}, "INT64"}, + {dialect.Type{Name: "float32", Category: "N"}, "FLOAT32"}, + {dialect.Type{Name: "float64", Category: "N"}, "FLOAT64"}, + {dialect.Type{Name: "numeric", Category: "N"}, "NUMERIC"}, + {dialect.Type{Name: "bignumeric", Category: "N"}, ""}, + {dialect.Type{Name: "string", Category: "S"}, "STRING"}, + {dialect.Type{Name: "bytes", Category: "S"}, "BYTES"}, + {dialect.Type{Name: "uuid", Category: "S"}, "UUID"}, + {dialect.Type{Name: "date", Category: "D"}, "DATE"}, + {dialect.Type{Name: "datetime", Category: "D"}, ""}, + {dialect.Type{Name: "time", Category: "D"}, ""}, + {dialect.Type{Name: "timestamp", Category: "D"}, "TIMESTAMP"}, + {dialect.Type{Name: "interval", Category: "T"}, "INTERVAL"}, + {dialect.Type{Name: "json", Category: "U"}, "JSON"}, + {dialect.Type{Name: "geography", Category: "U"}, ""}, + {dialect.Type{Name: "struct", Category: "U"}, "STRUCT"}, + {dialect.Type{Name: "enum", Category: "U"}, ""}, + {dialect.Type{Name: "proto", Category: "U"}, ""}, + {dialect.Type{Name: "tokenlist", Category: "U"}, ""}, + {dialect.Type{Name: "array", Category: "A"}, "ARRAY"}, + {dialect.Type{Name: "range", Category: "U"}, ""}, + {dialect.Type{Name: "map", Category: "U"}, ""}, +} + +//go:embed library.jsonl +var libraryCandidates []byte + +// candidate is one line of library.jsonl. +type candidate struct { + Name string `json:"name"` + Kind string `json:"kind,omitempty"` + Args []string `json:"args,omitempty"` + Returns string `json:"returns,omitempty"` + Nullable bool `json:"nullable,omitempty"` + NeverNull bool `json:"never_null,omitempty"` + // Expr is the expression to compile in place of name(args), and Query + // the whole statement, with $1, $2... standing for the arguments. + Expr string `json:"expr,omitempty"` + Query string `json:"query,omitempty"` +} + +// polymorphic reports whether a candidate takes a T or an AT. +func (c candidate) polymorphic() bool { + for _, a := range c.Args { + if a == "T" || a == "AT" { + return true + } + } + return false +} + +// sql is the statement that compiles a call of the candidate with the +// arguments given, as types. +func (c candidate) sql(args []string) (string, error) { + vals := make([]string, len(args)) + for i, a := range args { + if typ, lit, ok := strings.Cut(a, "="); ok { + _ = typ + vals[i] = lit + continue + } + v, ok := probeValues[a] + if !ok { + if c.Expr == "" && c.Query == "" { + return "", fmt.Errorf("%s: no probe value for %s", c.Name, a) + } + v = "NULL" + } + vals[i] = v + } + fill := func(tmpl string) string { + for i := len(vals); i >= 1; i-- { + tmpl = strings.ReplaceAll(tmpl, "$"+strconv.Itoa(i), vals[i-1]) + } + return tmpl + } + if c.Query != "" { + return fill(c.Query), nil + } + call := c.Name + "(" + strings.Join(vals, ", ") + ")" + if c.Expr != "" { + call = fill(c.Expr) + } + return "SELECT " + call + " AS r FROM probe", nil +} + +// seedType is the type an argument is written as in functions.jsonl. +func seedType(arg string) string { + switch arg { + case "T": + return "anyelement" + case "AT": + return "anyarray" + } + typ, _, _ := strings.Cut(arg, "=") + return typ +} + +// readLibrary reads types.jsonl, functions.jsonl and operators.jsonl from +// the probe database. +func readLibrary(ctx context.Context, s *server, session string) (dialect.Files, error) { + compile := func(sql string) (*spannerpb.Type, error) { + req := &spannerpb.ExecuteSqlRequest{Session: session, Sql: sql, QueryMode: spannerpb.ExecuteSqlRequest_PLAN} + if isDML(sql) { + req.Transaction = &spannerpb.TransactionSelector{Selector: &spannerpb.TransactionSelector_Begin{ + Begin: &spannerpb.TransactionOptions{Mode: &spannerpb.TransactionOptions_ReadWrite_{ReadWrite: &spannerpb.TransactionOptions_ReadWrite{}}}, + }} + req.Seqno = 1 + } + rs, err := s.data.ExecuteSql(ctx, req) + if err != nil { + return nil, err + } + if rs.Metadata != nil && rs.Metadata.Transaction != nil && len(rs.Metadata.Transaction.Id) > 0 { + s.data.Rollback(context.WithoutCancel(ctx), &spannerpb.RollbackRequest{Session: session, TransactionId: rs.Metadata.Transaction.Id}) + } + if rs.Metadata == nil || rs.Metadata.RowType == nil || len(rs.Metadata.RowType.Fields) == 0 { + return nil, nil + } + return rs.Metadata.RowType.Fields[0].Type, nil + } + + types, err := readLibraryTypes(compile) + if err != nil { + return nil, err + } + funcs, err := readLibraryFunctions(compile) + if err != nil { + return nil, err + } + operators, err := readLibraryOperators(compile) + if err != nil { + return nil, err + } + files := dialect.Files{} + for name, records := range map[string]any{ + dialect.TypesFile: types, + dialect.FunctionsFile: funcs, + dialect.OperatorsFile: operators, + } { + var blob []byte + var err error + switch r := records.(type) { + case []dialect.Type: + blob, err = dialect.JSONL(r) + case []dialect.Function: + blob, err = dialect.JSONL(r) + case []dialect.Operator: + blob, err = dialect.JSONL(r) + } + if err != nil { + return nil, err + } + files[name] = blob + } + return files, nil +} + +type compiler func(sql string) (*spannerpb.Type, error) + +// readLibraryTypes checks that Spanner has each type the dialect lists with +// a probe, failing when one is gone, since sqlc would then accept a schema +// Spanner rejects. +func readLibraryTypes(compile compiler) ([]dialect.Type, error) { + types := make([]dialect.Type, 0, len(libraryTypes)) + for _, t := range libraryTypes { + if t.probe != "" { + // IS NULL, since Spanner returns no STRUCT as a column. + if _, err := compile("SELECT CAST(NULL AS " + t.probe + ") IS NULL AS r"); err != nil { + return nil, fmt.Errorf("type %s: %w", t.Name, err) + } + } + types = append(types, t.Type) + } + return types, nil +} + +// readLibraryFunctions compiles every candidate in library.jsonl and lists +// the ones Spanner accepts, sorted by name and then by arity, the order the +// candidates give otherwise kept. +func readLibraryFunctions(compile compiler) ([]dialect.Function, error) { + var funcs []dialect.Function + scanner := bufio.NewScanner(bytes.NewReader(libraryCandidates)) + for line := 1; scanner.Scan(); line++ { + text := strings.TrimSpace(scanner.Text()) + if text == "" || strings.HasPrefix(text, "#") { + continue + } + var c candidate + if err := json.Unmarshal([]byte(text), &c); err != nil { + return nil, fmt.Errorf("library.jsonl:%d: %w", line, err) + } + returns, ok, err := probeCandidate(compile, c) + if err != nil { + return nil, fmt.Errorf("library.jsonl:%d: %w", line, err) + } + if !ok { + continue + } + fn := dialect.Function{Name: c.Name, Kind: c.Kind, Returns: returns, Nullable: c.Nullable, NeverNull: c.NeverNull} + for _, a := range c.Args { + fn.Args = append(fn.Args, dialect.Arg{Type: seedType(a)}) + } + funcs = append(funcs, fn) + } + if err := scanner.Err(); err != nil { + return nil, err + } + sort.SliceStable(funcs, func(i, j int) bool { + if funcs[i].Name != funcs[j].Name { + return funcs[i].Name < funcs[j].Name + } + return len(funcs[i].Args) < len(funcs[j].Args) + }) + return funcs, nil +} + +// probeCandidate compiles a candidate and returns the type it is seeded +// with, or false when Spanner rejects it. A candidate that is not there is +// left out rather than failing the run: a release of Spanner that drops a +// function shows in the diff of functions.jsonl. +func probeCandidate(compile compiler, c candidate) (string, bool, error) { + if !c.polymorphic() { + sql, err := c.sql(c.Args) + if err != nil { + return "", false, err + } + t, err := compile(sql) + if err != nil { + return "", false, nil + } + got := typeSpelling(t) + if c.Query != "" && c.Returns != "" { + // The statement's result, if it has one, is not the call's. + return c.Returns, true, nil + } + if c.Returns != "" && c.Returns != got { + return "", false, fmt.Errorf("%s returns %s, not %s", c.Name, got, c.Returns) + } + return got, true, nil + } + for _, elem := range []string{"int64", "string"} { + args := make([]string, len(c.Args)) + for i, a := range c.Args { + switch a { + case "T": + args[i] = elem + case "AT": + args[i] = "array(" + elem + ")" + default: + args[i] = a + } + } + sql, err := c.sql(args) + if err != nil { + return "", false, err + } + t, err := compile(sql) + if err != nil { + return "", false, nil + } + want := c.Returns + for i := len(args); i >= 1; i-- { + want = strings.ReplaceAll(want, "$"+strconv.Itoa(i), args[i-1]) + } + switch want { + case "anyelement": + want = elem + case "anyarray": + want = "array(" + elem + ")" + } + if got := typeSpelling(t); got != want { + return "", false, fmt.Errorf("%s(%s) returns %s, not %s", c.Name, strings.Join(args, ", "), got, want) + } + } + return c.Returns, true, nil +} + +// typeSpelling spells a type the way functions.jsonl does. +func typeSpelling(t *spannerpb.Type) string { + if t == nil { + return "" + } + if t.Code == spannerpb.TypeCode_ARRAY { + return "array(" + typeSpelling(t.ArrayElementType) + ")" + } + return strings.ToLower(t.Code.String()) +} + +// libraryOperandTypes are the operands each operator is tried with. +var ( + numericOperands = []string{"int64", "float64", "float32", "numeric"} + operatorPairs = func() [][3]string { + var pairs [][3]string + for _, op := range []string{"+", "-", "*", "/"} { + for _, l := range numericOperands { + for _, r := range numericOperands { + pairs = append(pairs, [3]string{op, l, r}) + } + } + } + for _, t := range []string{"string", "bytes"} { + pairs = append(pairs, [3]string{"||", t, t}) + } + for _, op := range []string{"+", "-"} { + pairs = append(pairs, [3]string{op, "timestamp", "interval"}, [3]string{op, "interval", "interval"}) + } + return append(pairs, + [3]string{"+", "interval", "timestamp"}, + [3]string{"-", "date", "date"}, [3]string{"-", "timestamp", "timestamp"}, + [3]string{"*", "interval", "int64"}, [3]string{"/", "interval", "int64"}, + [3]string{"&", "int64", "int64"}, [3]string{"|", "int64", "int64"}, [3]string{"^", "int64", "int64"}, + [3]string{"<<", "int64", "int64"}, [3]string{">>", "int64", "int64"}, + [3]string{"&", "bytes", "bytes"}, [3]string{"|", "bytes", "bytes"}, [3]string{"^", "bytes", "bytes"}, + ) + }() +) + +// readLibraryOperators compiles each binary operator over the operands it +// is tried with and lists the ones Spanner accepts with their result. The +// comparisons are left to dialect.json's rules, which make every one of +// them a BOOL. +func readLibraryOperators(compile compiler) ([]dialect.Operator, error) { + var ops []dialect.Operator + for _, p := range operatorPairs { + t, err := compile("SELECT " + probeValues[p[1]] + " " + p[0] + " " + probeValues[p[2]] + " AS r FROM probe") + if err != nil { + continue + } + ops = append(ops, dialect.Operator{Name: p[0], Left: p[1], Right: p[2], Result: typeSpelling(t)}) + } + return ops, nil +} diff --git a/internal/goldeneye/spanner/library.jsonl b/internal/goldeneye/spanner/library.jsonl new file mode 100644 index 0000000000..a0a9c286b9 --- /dev/null +++ b/internal/goldeneye/spanner/library.jsonl @@ -0,0 +1,322 @@ +# Candidate signatures of Spanner's GoogleSQL functions. Spanner keeps no +# catalog of its functions, so this file lists the calls to try; goldeneye +# compiles each one in PLAN mode against the probe table in library.go, +# keeps the ones Spanner accepts and writes the result type Spanner reports. +# +# An argument is a type, a type=literal for an argument Spanner wants as a +# literal, T for a polymorphic value or AT for an array of one. A +# polymorphic signature is tried with INT64 and STRING, and its returns +# ($1 for the first argument's type, array($1), anyelement for an AT's +# element) must match what Spanner reports for both. nullable and +# never_null say what Spanner cannot: whether the result can be NULL when +# the arguments are not, or is never NULL when they are. +# Aggregates: NULL over no rows, except the counts. +{"name": "count", "kind": "a", "args": ["T"], "returns": "int64", "never_null": true} +{"name": "countif", "kind": "a", "args": ["bool"], "never_null": true} +{"name": "any_value", "kind": "a", "args": ["T"], "returns": "$1", "nullable": true} +{"name": "array_agg", "kind": "a", "args": ["T"], "returns": "array($1)", "nullable": true} +{"name": "array_concat_agg", "kind": "a", "args": ["AT"], "returns": "$1", "nullable": true} +{"name": "avg", "kind": "a", "args": ["int64"], "nullable": true} +{"name": "avg", "kind": "a", "args": ["float64"], "nullable": true} +{"name": "avg", "kind": "a", "args": ["float32"], "nullable": true} +{"name": "avg", "kind": "a", "args": ["numeric"], "nullable": true} +{"name": "avg", "kind": "a", "args": ["interval"], "nullable": true} +{"name": "bit_and", "kind": "a", "args": ["int64"], "nullable": true} +{"name": "bit_or", "kind": "a", "args": ["int64"], "nullable": true} +{"name": "bit_xor", "kind": "a", "args": ["int64"], "nullable": true} +{"name": "logical_and", "kind": "a", "args": ["bool"], "nullable": true} +{"name": "logical_or", "kind": "a", "args": ["bool"], "nullable": true} +{"name": "max", "kind": "a", "args": ["T"], "returns": "$1", "nullable": true} +{"name": "min", "kind": "a", "args": ["T"], "returns": "$1", "nullable": true} +{"name": "string_agg", "kind": "a", "args": ["string"], "nullable": true} +{"name": "string_agg", "kind": "a", "args": ["string", "string=','"], "nullable": true} +{"name": "string_agg", "kind": "a", "args": ["bytes"], "nullable": true} +{"name": "string_agg", "kind": "a", "args": ["bytes", "bytes=b','"], "nullable": true} +{"name": "sum", "kind": "a", "args": ["int64"], "nullable": true} +{"name": "sum", "kind": "a", "args": ["float64"], "nullable": true} +{"name": "sum", "kind": "a", "args": ["float32"], "nullable": true} +{"name": "sum", "kind": "a", "args": ["numeric"], "nullable": true} +{"name": "sum", "kind": "a", "args": ["interval"], "nullable": true} +{"name": "stddev", "kind": "a", "args": ["float64"], "nullable": true} +{"name": "stddev_samp", "kind": "a", "args": ["float64"], "nullable": true} +{"name": "variance", "kind": "a", "args": ["float64"], "nullable": true} +{"name": "var_samp", "kind": "a", "args": ["float64"], "nullable": true} +# Window functions. +# Math. +{"name": "abs", "args": ["int64"]} +{"name": "abs", "args": ["float64"]} +{"name": "abs", "args": ["float32"]} +{"name": "abs", "args": ["numeric"]} +{"name": "sign", "args": ["int64"]} +{"name": "sign", "args": ["float64"]} +{"name": "sign", "args": ["numeric"]} +{"name": "mod", "args": ["int64", "int64"]} +{"name": "mod", "args": ["numeric", "numeric"]} +{"name": "div", "args": ["int64", "int64"]} +{"name": "div", "args": ["numeric", "numeric"]} +{"name": "round", "args": ["float64"]} +{"name": "round", "args": ["numeric"]} +{"name": "round", "args": ["float64", "int64"]} +{"name": "round", "args": ["numeric", "int64"]} +{"name": "trunc", "args": ["float64"]} +{"name": "trunc", "args": ["numeric"]} +{"name": "trunc", "args": ["float64", "int64"]} +{"name": "trunc", "args": ["numeric", "int64"]} +{"name": "ceil", "args": ["float64"]} +{"name": "ceil", "args": ["numeric"]} +{"name": "ceiling", "args": ["float64"]} +{"name": "ceiling", "args": ["numeric"]} +{"name": "floor", "args": ["float64"]} +{"name": "floor", "args": ["numeric"]} +{"name": "sqrt", "args": ["float64"]} +{"name": "sqrt", "args": ["numeric"]} +{"name": "pow", "args": ["float64", "float64"]} +{"name": "pow", "args": ["numeric", "numeric"]} +{"name": "power", "args": ["float64", "float64"]} +{"name": "power", "args": ["numeric", "numeric"]} +{"name": "exp", "args": ["float64"]} +{"name": "exp", "args": ["numeric"]} +{"name": "ln", "args": ["float64"]} +{"name": "ln", "args": ["numeric"]} +{"name": "log", "args": ["float64"]} +{"name": "log", "args": ["numeric"]} +{"name": "log", "args": ["float64", "float64"]} +{"name": "log10", "args": ["float64"]} +{"name": "log10", "args": ["numeric"]} +{"name": "ieee_divide", "args": ["float64", "float64"]} +{"name": "safe_divide", "args": ["int64", "int64"], "nullable": true} +{"name": "safe_divide", "args": ["float64", "float64"], "nullable": true} +{"name": "safe_divide", "args": ["numeric", "numeric"], "nullable": true} +{"name": "safe_add", "args": ["int64", "int64"], "nullable": true} +{"name": "safe_add", "args": ["float64", "float64"], "nullable": true} +{"name": "safe_add", "args": ["numeric", "numeric"], "nullable": true} +{"name": "safe_subtract", "args": ["int64", "int64"], "nullable": true} +{"name": "safe_subtract", "args": ["float64", "float64"], "nullable": true} +{"name": "safe_subtract", "args": ["numeric", "numeric"], "nullable": true} +{"name": "safe_multiply", "args": ["int64", "int64"], "nullable": true} +{"name": "safe_multiply", "args": ["float64", "float64"], "nullable": true} +{"name": "safe_multiply", "args": ["numeric", "numeric"], "nullable": true} +{"name": "safe_negate", "args": ["int64"], "nullable": true} +{"name": "safe_negate", "args": ["float64"], "nullable": true} +{"name": "safe_negate", "args": ["numeric"], "nullable": true} +{"name": "is_inf", "args": ["float64"]} +{"name": "is_nan", "args": ["float64"]} +{"name": "sin", "args": ["float64"]} +{"name": "cos", "args": ["float64"]} +{"name": "tan", "args": ["float64"]} +{"name": "asin", "args": ["float64"]} +{"name": "acos", "args": ["float64"]} +{"name": "atan", "args": ["float64"]} +{"name": "atan2", "args": ["float64", "float64"]} +{"name": "bit_count", "args": ["int64"]} +{"name": "bit_count", "args": ["bytes"]} +{"name": "bit_reverse", "args": ["int64", "bool"]} +# Strings. +{"name": "length", "args": ["string"]} +{"name": "length", "args": ["bytes"]} +{"name": "byte_length", "args": ["string"]} +{"name": "byte_length", "args": ["bytes"]} +{"name": "char_length", "args": ["string"]} +{"name": "character_length", "args": ["string"]} +{"name": "concat", "args": ["string", "string"]} +{"name": "concat", "args": ["bytes", "bytes"]} +{"name": "lower", "args": ["string"]} +{"name": "lower", "args": ["bytes"]} +{"name": "upper", "args": ["string"]} +{"name": "upper", "args": ["bytes"]} +{"name": "trim", "args": ["string"]} +{"name": "trim", "args": ["string", "string"]} +{"name": "trim", "args": ["bytes", "bytes"]} +{"name": "ltrim", "args": ["string"]} +{"name": "ltrim", "args": ["string", "string"]} +{"name": "rtrim", "args": ["string"]} +{"name": "rtrim", "args": ["string", "string"]} +{"name": "lpad", "args": ["string", "int64"]} +{"name": "lpad", "args": ["string", "int64", "string"]} +{"name": "lpad", "args": ["bytes", "int64", "bytes"]} +{"name": "rpad", "args": ["string", "int64"]} +{"name": "rpad", "args": ["string", "int64", "string"]} +{"name": "rpad", "args": ["bytes", "int64", "bytes"]} +{"name": "substr", "args": ["string", "int64"]} +{"name": "substr", "args": ["string", "int64", "int64"]} +{"name": "substr", "args": ["bytes", "int64"]} +{"name": "substr", "args": ["bytes", "int64", "int64"]} +{"name": "substring", "args": ["string", "int64"]} +{"name": "substring", "args": ["string", "int64", "int64"]} +{"name": "strpos", "args": ["string", "string"]} +{"name": "strpos", "args": ["bytes", "bytes"]} +{"name": "starts_with", "args": ["string", "string"]} +{"name": "starts_with", "args": ["bytes", "bytes"]} +{"name": "ends_with", "args": ["string", "string"]} +{"name": "ends_with", "args": ["bytes", "bytes"]} +{"name": "replace", "args": ["string", "string", "string"]} +{"name": "replace", "args": ["bytes", "bytes", "bytes"]} +{"name": "repeat", "args": ["string", "int64"]} +{"name": "repeat", "args": ["bytes", "int64"]} +{"name": "reverse", "args": ["string"]} +{"name": "reverse", "args": ["bytes"]} +{"name": "split", "args": ["string"]} +{"name": "split", "args": ["string", "string"]} +{"name": "split", "args": ["bytes", "bytes"]} +{"name": "split_substr", "args": ["string", "string", "int64"]} +{"name": "split_substr", "args": ["string", "string", "int64", "int64"]} +{"name": "regexp_contains", "args": ["string", "string='a'"]} +{"name": "regexp_contains", "args": ["bytes", "bytes=b'a'"]} +{"name": "regexp_extract", "args": ["string", "string='a'"], "nullable": true} +{"name": "regexp_extract", "args": ["bytes", "bytes=b'a'"], "nullable": true} +{"name": "regexp_extract_all", "args": ["string", "string='a'"]} +{"name": "regexp_extract_all", "args": ["bytes", "bytes=b'a'"]} +{"name": "regexp_replace", "args": ["string", "string='a'", "string"]} +{"name": "regexp_replace", "args": ["bytes", "bytes=b'a'", "bytes"]} +{"name": "format", "args": ["string"]} +{"name": "to_base64", "args": ["bytes"]} +{"name": "from_base64", "args": ["string"]} +{"name": "to_base32", "args": ["bytes"]} +{"name": "from_base32", "args": ["string"]} +{"name": "to_hex", "args": ["bytes"]} +{"name": "from_hex", "args": ["string"]} +{"name": "to_code_points", "args": ["string"]} +{"name": "to_code_points", "args": ["bytes"]} +{"name": "code_points_to_string", "args": ["array(int64)"]} +{"name": "code_points_to_bytes", "args": ["array(int64)"]} +{"name": "safe_convert_bytes_to_string", "args": ["bytes"]} +{"name": "soundex", "args": ["string"]} +{"name": "normalize", "args": ["string"]} +{"name": "normalize_and_casefold", "args": ["string"]} +{"name": "ltrim", "args": ["bytes", "bytes"]} +{"name": "rtrim", "args": ["bytes", "bytes"]} +# Dates and timestamps; date parts are passed as their keyword. +{"name": "current_date"} +{"name": "current_timestamp"} +{"name": "date", "args": ["int64", "int64", "int64"]} +{"name": "date", "args": ["timestamp"]} +{"name": "date", "args": ["timestamp", "string"]} +{"name": "date_add", "args": ["date", "interval"]} +{"name": "date_sub", "args": ["date", "interval"]} +{"name": "date_diff", "args": ["date", "date", "string=DAY"]} +{"name": "date_trunc", "args": ["date", "string=MONTH"]} +{"name": "date_from_unix_date", "args": ["int64"]} +{"name": "unix_date", "args": ["date"]} +{"name": "format_date", "args": ["string", "date"]} +{"name": "parse_date", "args": ["string", "string"]} +{"name": "timestamp", "args": ["string"]} +{"name": "timestamp", "args": ["date"]} +{"name": "timestamp", "args": ["string", "string"]} +{"name": "timestamp", "args": ["date", "string"]} +{"name": "timestamp_add", "args": ["timestamp", "interval"]} +{"name": "timestamp_sub", "args": ["timestamp", "interval"]} +{"name": "timestamp_diff", "args": ["timestamp", "timestamp", "string=SECOND"]} +{"name": "timestamp_trunc", "args": ["timestamp", "string=DAY"]} +{"name": "timestamp_trunc", "args": ["timestamp", "string=DAY", "string"]} +{"name": "timestamp_seconds", "args": ["int64"]} +{"name": "timestamp_millis", "args": ["int64"]} +{"name": "timestamp_micros", "args": ["int64"]} +{"name": "unix_seconds", "args": ["timestamp"]} +{"name": "unix_millis", "args": ["timestamp"]} +{"name": "unix_micros", "args": ["timestamp"]} +{"name": "format_timestamp", "args": ["string", "timestamp"]} +{"name": "format_timestamp", "args": ["string", "timestamp", "string"]} +{"name": "parse_timestamp", "args": ["string", "string"]} +{"name": "parse_timestamp", "args": ["string", "string", "string"]} +{"name": "string", "args": ["timestamp"]} +{"name": "string", "args": ["timestamp", "string"]} +{"name": "string", "args": ["json"]} +{"name": "make_interval", "args": ["int64", "int64", "int64"]} +{"name": "justify_days", "args": ["interval"]} +{"name": "justify_hours", "args": ["interval"]} +{"name": "justify_interval", "args": ["interval"]} +# JSON. +{"name": "json_value", "args": ["json", "string='$.a'"], "nullable": true} +{"name": "json_value", "args": ["string", "string='$.a'"], "nullable": true} +{"name": "json_query", "args": ["json", "string='$.a'"], "nullable": true} +{"name": "json_query", "args": ["string", "string='$.a'"], "nullable": true} +{"name": "json_query_array", "args": ["json", "string='$.a'"], "nullable": true} +{"name": "json_query_array", "args": ["json"], "nullable": true} +{"name": "json_value_array", "args": ["json", "string='$.a'"], "nullable": true} +{"name": "json_value_array", "args": ["json"], "nullable": true} +{"name": "json_type", "args": ["json"]} +{"name": "json_keys", "args": ["json"]} +{"name": "json_strip_nulls", "args": ["json"]} +{"name": "parse_json", "args": ["string"]} +{"name": "to_json", "args": ["T"], "returns": "json", "never_null": true} +{"name": "to_json_string", "args": ["json"], "never_null": true} +{"name": "safe_to_json", "args": ["T"], "returns": "json", "never_null": true} +{"name": "bool", "args": ["json"]} +{"name": "int64", "args": ["json"]} +{"name": "float64", "args": ["json"]} +{"name": "float32", "args": ["json"]} +{"name": "lax_bool", "args": ["json"], "nullable": true} +{"name": "lax_int64", "args": ["json"], "nullable": true} +{"name": "lax_float64", "args": ["json"], "nullable": true} +{"name": "lax_string", "args": ["json"], "nullable": true} +{"name": "json_array", "args": ["T"], "returns": "json"} +{"name": "json_object", "args": ["string", "T"], "returns": "json"} +{"name": "json_set", "args": ["json", "string='$.a'", "T"], "returns": "json"} +{"name": "json_remove", "args": ["json", "string='$.a'"]} +{"name": "json_array_append", "args": ["json", "string='$'", "T"], "returns": "json"} +{"name": "json_array_insert", "args": ["json", "string='$[0]'", "T"], "returns": "json"} +{"name": "json_contains", "args": ["json", "json"]} +# Arrays. +{"name": "array_length", "args": ["AT"], "returns": "int64"} +{"name": "array_to_string", "args": ["array(string)", "string"]} +{"name": "array_to_string", "args": ["array(string)", "string", "string"]} +{"name": "array_to_string", "args": ["array(bytes)", "bytes"]} +{"name": "array_reverse", "args": ["AT"], "returns": "$1"} +{"name": "array_concat", "args": ["AT", "AT"], "returns": "$1"} +{"name": "array_first", "args": ["AT"], "returns": "anyelement", "nullable": true} +{"name": "array_last", "args": ["AT"], "returns": "anyelement", "nullable": true} +{"name": "array_min", "args": ["AT"], "returns": "anyelement", "nullable": true} +{"name": "array_max", "args": ["AT"], "returns": "anyelement", "nullable": true} +{"name": "array_slice", "args": ["AT", "int64", "int64"], "returns": "$1"} +{"name": "array_includes", "args": ["AT", "T"], "returns": "bool"} +{"name": "array_includes_any", "args": ["AT", "AT"], "returns": "bool"} +{"name": "array_includes_all", "args": ["AT", "AT"], "returns": "bool"} +{"name": "array_is_distinct", "args": ["AT"], "returns": "bool"} +{"name": "generate_array", "args": ["int64", "int64"]} +{"name": "generate_array", "args": ["int64", "int64", "int64"]} +{"name": "generate_array", "args": ["float64", "float64", "float64"]} +{"name": "generate_date_array", "args": ["date", "date"]} +{"name": "generate_date_array", "args": ["date", "date", "interval"]} +# Hashing, ids and sequences. +{"name": "farm_fingerprint", "args": ["string"]} +{"name": "farm_fingerprint", "args": ["bytes"]} +{"name": "md5", "args": ["string"]} +{"name": "md5", "args": ["bytes"]} +{"name": "sha1", "args": ["string"]} +{"name": "sha1", "args": ["bytes"]} +{"name": "sha256", "args": ["string"]} +{"name": "sha256", "args": ["bytes"]} +{"name": "sha512", "args": ["string"]} +{"name": "sha512", "args": ["bytes"]} +{"name": "generate_uuid", "never_null": true} +{"name": "new_uuid", "never_null": true} +# Search and vectors. +{"name": "search", "args": ["tokenlist", "string='a'"]} +{"name": "search_substring", "args": ["tokenlist", "string='a'"]} +{"name": "search_ngrams", "args": ["tokenlist", "string='a'"]} +{"name": "score", "args": ["tokenlist", "string='a'"]} +{"name": "score_ngrams", "args": ["tokenlist", "string='a'"]} +{"name": "snippet", "args": ["string", "string='a'"]} +{"name": "cosine_distance", "args": ["array(float64)", "array(float64)"]} +{"name": "cosine_distance", "args": ["array(float32)", "array(float32)"]} +{"name": "euclidean_distance", "args": ["array(float64)", "array(float64)"]} +{"name": "euclidean_distance", "args": ["array(float32)", "array(float32)"]} +{"name": "dot_product", "args": ["array(float64)", "array(float64)"]} +{"name": "dot_product", "args": ["array(float32)", "array(float32)"]} +{"name": "dot_product", "args": ["array(int64)", "array(int64)"]} +# Calls a select list cannot spell as name(args): the expression or the +# whole statement to compile instead, with $1, $2... for the arguments. A +# statement whose result is not the call names what the call returns. +{"name": "extract", "args": ["timestamp"], "expr": "EXTRACT(YEAR FROM $1)"} +{"name": "extract", "args": ["timestamp", "string"], "expr": "EXTRACT(YEAR FROM $1 AT TIME ZONE $2)"} +{"name": "extract", "args": ["date"], "expr": "EXTRACT(YEAR FROM $1)"} +{"name": "get_next_sequence_value", "args": ["anyelement"], "expr": "GET_NEXT_SEQUENCE_VALUE(SEQUENCE probe_sequence)", "never_null": true} +{"name": "pending_commit_timestamp", "query": "INSERT INTO probe_commits (id, committed_at) VALUES (1, PENDING_COMMIT_TIMESTAMP())", "returns": "timestamp", "never_null": true} +{"name": "search", "args": ["tokenlist", "string='a'"], "query": "SELECT id FROM probe WHERE SEARCH($1, $2)", "returns": "bool"} +{"name": "search_substring", "args": ["tokenlist", "string='a'"], "query": "SELECT id FROM probe WHERE SEARCH_SUBSTRING(tl_substring, $2)", "returns": "bool"} +{"name": "search_ngrams", "args": ["tokenlist", "string='a'"], "query": "SELECT id FROM probe WHERE SEARCH_NGRAMS(tl_ngrams, $2)", "returns": "bool"} +{"name": "score", "args": ["tokenlist", "string='a'"], "query": "SELECT SCORE($1, $2) FROM probe WHERE SEARCH($1, $2)"} +{"name": "score_ngrams", "args": ["tokenlist", "string='a'"], "query": "SELECT SCORE_NGRAMS(tl_ngrams, $2) FROM probe WHERE SEARCH_NGRAMS(tl_ngrams, $2)"} +# unnest stands for UNNEST(array) in FROM and IN, which sqlc reads as a +# call; its element can be NULL. +{"name": "unnest", "args": ["AT"], "returns": "anyelement", "expr": "(SELECT e FROM UNNEST($1) AS e LIMIT 1)", "nullable": true} diff --git a/internal/goldeneye/spanner/plan.go b/internal/goldeneye/spanner/plan.go new file mode 100644 index 0000000000..c0d91d0bc8 --- /dev/null +++ b/internal/goldeneye/spanner/plan.go @@ -0,0 +1,220 @@ +package spanner + +import ( + "regexp" + "strings" + + "cloud.google.com/go/spanner/apiv1/spannerpb" +) + +// The query plan is the one thing that says where a result column comes +// from and what a parameter stands for. It is a list of nodes: relational +// ones, such as a Scan of a table or the Serialize Result that produces the +// rows, and scalar ones, such as a Reference to a column or a variable, a +// Parameter, a Function. A relational node defines variables through its +// child links: a Scan of a table defines one per column it reads, named +// after the column, and any node may define one as another scalar, which +// a Reference names with a $. The children of Serialize Result after the +// relation it serializes are the result columns, in order; a DML plan +// lists its THEN RETURN columns first and the values it writes after +// them: for an INSERT the columns it inserts, in the statement's order, +// and for an UPDATE or DELETE the key columns of the table, then the +// columns an UPDATE sets. A comparison is a Function whose description +// reads ($col = @param). + +// origin is what a scalar of the plan resolves to: a table column, a +// parameter, or nothing. +type origin struct { + table, column string + param string +} + +// plan is a parsed query plan. +type plan struct { + nodes []*spannerpb.PlanNode + // vars maps a variable to the node that defines it and the scalar it + // is defined as. + vars map[string]definition +} + +type definition struct { + owner *spannerpb.PlanNode + child *spannerpb.PlanNode +} + +func newPlan(qp *spannerpb.QueryPlan) *plan { + p := &plan{vars: map[string]definition{}} + if qp == nil { + return p + } + p.nodes = qp.PlanNodes + for _, n := range p.nodes { + for _, l := range n.ChildLinks { + if l.Variable != "" { + p.vars[l.Variable] = definition{owner: n, child: p.node(l.ChildIndex)} + } + } + } + return p +} + +func (p *plan) node(index int32) *spannerpb.PlanNode { + for _, n := range p.nodes { + if n.Index == index { + return n + } + } + return nil +} + +func (p *plan) root() *spannerpb.PlanNode { + return p.node(0) +} + +func meta(n *spannerpb.PlanNode, key string) string { + if n == nil || n.Metadata == nil { + return "" + } + if v, ok := n.Metadata.Fields[key]; ok { + return v.GetStringValue() + } + return "" +} + +func description(n *spannerpb.PlanNode) string { + if n == nil || n.ShortRepresentation == nil { + return "" + } + return n.ShortRepresentation.Description +} + +// serializeResult finds the node that produces the rows, the first +// Serialize Result reached from the root. +func (p *plan) serializeResult() *spannerpb.PlanNode { + var found *spannerpb.PlanNode + seen := map[int32]bool{} + var walk func(n *spannerpb.PlanNode) + walk = func(n *spannerpb.PlanNode) { + if n == nil || found != nil || seen[n.Index] { + return + } + seen[n.Index] = true + if n.DisplayName == "Serialize Result" { + found = n + return + } + for _, l := range n.ChildLinks { + walk(p.node(l.ChildIndex)) + } + } + walk(p.root()) + return found +} + +// outputs lists the scalars Serialize Result produces, in order: every +// child after the relation it serializes. +func (p *plan) outputs() []*spannerpb.PlanNode { + sr := p.serializeResult() + if sr == nil { + return nil + } + var out []*spannerpb.PlanNode + for _, l := range sr.ChildLinks { + if c := p.node(l.ChildIndex); c != nil && c.Kind == spannerpb.PlanNode_SCALAR { + out = append(out, c) + } + } + return out +} + +// mutation names the table a DML plan writes, or "" for a query. +func (p *plan) mutation() (table, operation string) { + for _, n := range p.nodes { + if n.DisplayName == "Apply Mutations" { + return meta(n, "table"), meta(n, "operation_type") + } + } + return "", "" +} + +// resolve follows a scalar to what it stands for. +func (p *plan) resolve(n *spannerpb.PlanNode, seen map[int32]bool) origin { + if n == nil || seen[n.Index] { + return origin{} + } + seen[n.Index] = true + switch n.DisplayName { + case "Parameter": + return origin{param: meta(n, "name")} + case "Reference": + desc := description(n) + if name, ok := strings.CutPrefix(desc, "$"); ok { + return p.resolveVar(name, seen) + } + // A bare name is a column of the scan it is read by, or an input + // of a union, which names it in the link's type. + for _, m := range p.nodes { + for _, l := range m.ChildLinks { + if l.ChildIndex != n.Index { + continue + } + switch { + case m.DisplayName == "Scan" && meta(m, "scan_type") == "TableScan": + return origin{table: meta(m, "scan_target"), column: desc} + case m.DisplayName == "Scan": + // A batch scan reads the batch variable of that name. + target := strings.TrimPrefix(meta(m, "scan_target"), "$") + return p.resolveVar(target+".Batch."+desc, seen) + } + } + } + for _, m := range p.nodes { + if m.DisplayName != "Union Input" { + continue + } + for _, l := range m.ChildLinks { + if l.Type == desc { + return p.resolve(p.node(l.ChildIndex), seen) + } + } + } + } + return origin{} +} + +// resolveVar follows a variable to what it is defined as. +func (p *plan) resolveVar(name string, seen map[int32]bool) origin { + d, ok := p.vars[name] + if !ok { + return origin{} + } + return p.resolve(d.child, seen) +} + +var compareRe = regexp.MustCompile(`^\((.+) (=|!=|<>|<|<=|>|>=) (.+)\)$`) + +// partners finds the table column each parameter is compared with, keyed +// by parameter name: the other operand of a comparison Function the +// parameter is an operand of. The first found wins. +func (p *plan) partners() map[string]origin { + out := map[string]origin{} + for _, n := range p.nodes { + if n.DisplayName != "Function" || len(n.ChildLinks) != 2 || !compareRe.MatchString(description(n)) { + continue + } + sides := []*spannerpb.PlanNode{p.node(n.ChildLinks[0].ChildIndex), p.node(n.ChildLinks[1].ChildIndex)} + for i, side := range sides { + o := p.resolve(side, map[int32]bool{}) + if o.param == "" { + continue + } + other := p.resolve(sides[1-i], map[int32]bool{}) + if other.table != "" { + if _, ok := out[o.param]; !ok { + out[o.param] = other + } + } + } + } + return out +} diff --git a/internal/goldeneye/spanner/relations.go b/internal/goldeneye/spanner/relations.go new file mode 100644 index 0000000000..4899e8ba4f --- /dev/null +++ b/internal/goldeneye/spanner/relations.go @@ -0,0 +1,96 @@ +package spanner + +import ( + "context" + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// relationQuery lists the relations of every schema but the database's +// own, unnamed one — INFORMATION_SCHEMA and SPANNER_SYS — with their +// columns in declared order, so that the output is stable. A column's +// type is spelled the way SPANNER_TYPE spells a declaration: STRING(MAX), +// ARRAY. +const relationQuery = ` +SELECT t.TABLE_SCHEMA, t.TABLE_NAME, t.TABLE_TYPE, + c.COLUMN_NAME, c.SPANNER_TYPE, c.IS_NULLABLE +FROM INFORMATION_SCHEMA.TABLES AS t +JOIN INFORMATION_SCHEMA.COLUMNS AS c + ON c.TABLE_SCHEMA = t.TABLE_SCHEMA AND c.TABLE_NAME = t.TABLE_NAME +WHERE t.TABLE_SCHEMA != '' +ORDER BY t.TABLE_SCHEMA, t.TABLE_NAME, c.ORDINAL_POSITION` + +// readRelations reads the views of the system schemas. Their names are +// kept as the catalog spells them, in upper case, which is how a query +// names them; a column's type is spelled in lower case, the way the +// dialect's types.jsonl spells its types, with an ARRAY written as T +// with the array flag, since that is how a seed spells an array. +func readRelations(ctx context.Context, s *server, session string) ([]dialect.Relation, error) { + rows, err := s.query(ctx, session, relationQuery) + if err != nil { + return nil, err + } + var relations []dialect.Relation + var cur *dialect.Relation + for _, row := range rows { + if len(row) != 6 { + return nil, fmt.Errorf("expected 6 columns, got %d", len(row)) + } + schema, name, kind := row[0].GetStringValue(), row[1].GetStringValue(), row[2].GetStringValue() + if cur == nil || cur.Schema != schema || cur.Name != name { + rel := dialect.Relation{Schema: schema, Name: name} + if kind == "VIEW" { + rel.Kind = "v" + } + relations = append(relations, rel) + cur = &relations[len(relations)-1] + } + col := dialect.Column{ + Name: row[3].GetStringValue(), + NotNull: row[5].GetStringValue() == "NO", + } + col.Type, col.Array = typeName(row[4].GetStringValue()) + cur.Columns = append(cur.Columns, col) + } + return relations, nil +} + +// typeName spells a SPANNER_TYPE the way a seed spells a column's type: +// in lower case, with an ARRAY as its element and the array flag, a +// STRUCT as struct(a: t, b: u) and a PROTO or ENUM as +// proto('p.M') or enum('p.E'), since a seed spells a type's arguments in +// parentheses. +func typeName(spannerType string) (string, bool) { + t := strings.TrimSpace(spannerType) + if element, ok := strings.CutPrefix(t, "ARRAY<"); ok && strings.HasSuffix(element, ">") { + name, _ := typeName(strings.TrimSuffix(element, ">")) + return name, true + } + if fields, ok := strings.CutPrefix(t, "STRUCT<"); ok && strings.HasSuffix(fields, ">") { + var args []string + for _, f := range splitTop(strings.TrimSuffix(fields, ">"), ',') { + f = strings.TrimSpace(f) + label, typ := "", f + if i := strings.IndexAny(f, " \t"); i > 0 && !strings.ContainsAny(f[:i], "<(") { + label, typ = f[:i], strings.TrimSpace(f[i+1:]) + } + name, array := typeName(typ) + if array { + name += "[]" + } + if label != "" { + name = label + ": " + name + } + args = append(args, name) + } + return "struct(" + strings.Join(args, ", ") + ")", false + } + for _, kind := range []string{"PROTO<", "ENUM<"} { + if message, ok := strings.CutPrefix(t, kind); ok && strings.HasSuffix(message, ">") { + return strings.ToLower(strings.TrimSuffix(kind, "<")) + "('" + strings.TrimSuffix(message, ">") + "')", false + } + } + return strings.ToLower(t), false +} diff --git a/internal/goldeneye/spanner/spanner.go b/internal/goldeneye/spanner/spanner.go new file mode 100644 index 0000000000..61a8858fd0 --- /dev/null +++ b/internal/goldeneye/spanner/spanner.go @@ -0,0 +1,245 @@ +// Package spanner generates the GoogleSQL dialect seed under +// internal/engine/googlesql/dialect from a live Spanner server, and +// verifies the GoogleSQL analyze cases under internal/endtoend/testdata +// against the same server. The server is Spanner Omni, the downloadable +// Spanner, run from its container image; the package writes into the +// googlesql directory, since sqlc's engine is named after the language +// Spanner speaks rather than the database. +// +// relations.jsonl is every view of INFORMATION_SCHEMA and SPANNER_SYS, +// read from INFORMATION_SCHEMA itself. Spanner keeps no catalog of its +// types, functions or operators, so types.jsonl, functions.jsonl and +// operators.jsonl are read by asking: library.jsonl lists the function +// signatures to try, and each is compiled in PLAN mode against a probe +// database, the ones Spanner accepts kept with the type it reports; the +// operators and types are tried the same way (see library.go). +// +// The package also verifies the GoogleSQL analyze cases against the same +// server: each case's schema becomes a database of its own, its fixture is +// written there, and each query is compiled in PLAN mode, which runs +// nothing and reports the type of each result column and of each +// parameter the query leaves undeclared, and the query plan, which says +// which table column each result column and parameter stands for. The +// answer is printed in the JSON shape sqlc analyze prints and compared +// with the case's committed stdout.json byte for byte. +// +// The server is named by SPANNER_SERVER_URI, the gRPC endpoint of a +// Spanner Omni server such as localhost:15000, which is reached without +// TLS or credentials, as Omni is. Databases are created in the instance +// Omni's single server provides, projects/default/instances/default. +package spanner + +import ( + "context" + "errors" + "fmt" + "os" + "strings" + + database "cloud.google.com/go/spanner/admin/database/apiv1" + "cloud.google.com/go/spanner/admin/database/apiv1/databasepb" + instance "cloud.google.com/go/spanner/admin/instance/apiv1" + "cloud.google.com/go/spanner/admin/instance/apiv1/instancepb" + spannerapi "cloud.google.com/go/spanner/apiv1" + "cloud.google.com/go/spanner/apiv1/spannerpb" + "google.golang.org/api/option" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/structpb" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name goldeneye knows the database by. +const Engine = "spanner" + +// Dir is the name of the engine directory the dialect lives under, and +// Cases the name of the analyze case directories under +// internal/endtoend/testdata: both are named after the language, GoogleSQL, +// which is how sqlc knows the dialect. +const ( + Dir = "googlesql" + Cases = "googlesql" +) + +// Instance is the instance a Spanner Omni single server provides, which +// every database is created in. +const Instance = "projects/default/instances/default" + +// Locate returns the server to generate from, named by SPANNER_SERVER_URI. +func Locate() (string, error) { + endpoint := os.Getenv("SPANNER_SERVER_URI") + if endpoint == "" { + return "", errors.New("SPANNER_SERVER_URI is not set") + } + if strings.Contains(endpoint, "://") { + return "", fmt.Errorf("SPANNER_SERVER_URI: %q should be a host:port, the gRPC endpoint of a Spanner Omni server", endpoint) + } + return endpoint, nil +} + +// server holds the clients a run talks to the server through. +type server struct { + endpoint string + instances *instance.InstanceAdminClient + databases *database.DatabaseAdminClient + data *spannerapi.Client +} + +// open connects to the server. Omni serves plaintext gRPC and asks for no +// credentials. +func open(ctx context.Context, endpoint string) (*server, error) { + opts := []option.ClientOption{ + option.WithEndpoint(endpoint), + option.WithoutAuthentication(), + option.WithGRPCDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())), + } + s := &server{endpoint: endpoint} + var err error + if s.instances, err = instance.NewInstanceAdminClient(ctx, opts...); err != nil { + return nil, err + } + if s.databases, err = database.NewDatabaseAdminClient(ctx, opts...); err != nil { + s.Close() + return nil, err + } + if s.data, err = spannerapi.NewClient(ctx, opts...); err != nil { + s.Close() + return nil, err + } + return s, nil +} + +func (s *server) Close() { + if s.instances != nil { + s.instances.Close() + } + if s.databases != nil { + s.databases.Close() + } + if s.data != nil { + s.data.Close() + } +} + +// Version describes the server: Spanner Omni reports no release of its +// own through the API, so the instance the databases are created in is +// described instead. +func Version(ctx context.Context, endpoint string) (string, error) { + s, err := open(ctx, endpoint) + if err != nil { + return "", err + } + defer s.Close() + inst, err := s.instances.GetInstance(ctx, &instancepb.GetInstanceRequest{Name: Instance}) + if err != nil { + return "", fmt.Errorf("%s: %w", Instance, err) + } + return fmt.Sprintf("Spanner Omni at %s, instance %s (%s)", endpoint, inst.Name, inst.State), nil +} + +// createDatabase creates a database in the instance, running the DDL +// statements in it, and returns its full name. +func (s *server) createDatabase(ctx context.Context, name string, ddl []string) (string, error) { + op, err := s.databases.CreateDatabase(ctx, &databasepb.CreateDatabaseRequest{ + Parent: Instance, + CreateStatement: "CREATE DATABASE `" + name + "`", + ExtraStatements: ddl, + }) + if err != nil { + return "", err + } + db, err := op.Wait(ctx) + if err != nil { + return "", err + } + return db.Name, nil +} + +// dropDatabase drops a database by its full name. A database that does +// not exist is not an error, so that a run can clear the way for itself. +func (s *server) dropDatabase(ctx context.Context, db string) error { + err := s.databases.DropDatabase(ctx, &databasepb.DropDatabaseRequest{Database: db}) + if status.Code(err) == codes.NotFound && strings.Contains(err.Error(), "Database") { + return nil + } + return err +} + +// session opens a session on a database, multiplexed as Omni requires. +func (s *server) session(ctx context.Context, db string) (string, error) { + sess, err := s.data.CreateSession(ctx, &spannerpb.CreateSessionRequest{ + Database: db, + Session: &spannerpb.Session{Multiplexed: true}, + }) + if err != nil { + return "", err + } + return sess.Name, nil +} + +// query runs a statement and returns its rows as lists of values. +func (s *server) query(ctx context.Context, session, sql string) ([][]*structpb.Value, error) { + rs, err := s.data.ExecuteSql(ctx, &spannerpb.ExecuteSqlRequest{Session: session, Sql: sql}) + if err != nil { + return nil, err + } + var rows [][]*structpb.Value + for _, row := range rs.Rows { + rows = append(rows, row.Values) + } + return rows, nil +} + +// Generate reads the dialect from the server: relations.jsonl, the views of +// INFORMATION_SCHEMA and SPANNER_SYS, read from a database of their own, +// since every database has the same ones, and the types, functions and +// operators, read from a probe database. +func Generate(ctx context.Context, endpoint string) (dialect.Files, error) { + s, err := open(ctx, endpoint) + if err != nil { + return nil, err + } + defer s.Close() + db := Instance + "/databases/goldeneye_dialect" + if err := s.dropDatabase(ctx, db); err != nil { + return nil, err + } + if _, err := s.createDatabase(ctx, "goldeneye_dialect", nil); err != nil { + return nil, err + } + defer s.dropDatabase(context.WithoutCancel(ctx), db) + session, err := s.session(ctx, db) + if err != nil { + return nil, err + } + relations, err := readRelations(ctx, s, session) + if err != nil { + return nil, err + } + blob, err := dialect.JSONL(relations) + if err != nil { + return nil, err + } + + lib := Instance + "/databases/" + libraryDatabase + if err := s.dropDatabase(ctx, lib); err != nil { + return nil, err + } + if _, err := s.createDatabase(ctx, libraryDatabase, librarySchema); err != nil { + return nil, err + } + defer s.dropDatabase(context.WithoutCancel(ctx), lib) + libSession, err := s.session(ctx, lib) + if err != nil { + return nil, err + } + files, err := readLibrary(ctx, s, libSession) + if err != nil { + return nil, err + } + files[dialect.RelationsFile] = blob + return files, nil +} diff --git a/internal/goldeneye/spanner/spanner_test.go b/internal/goldeneye/spanner/spanner_test.go new file mode 100644 index 0000000000..3b5bf48ff6 --- /dev/null +++ b/internal/goldeneye/spanner/spanner_test.go @@ -0,0 +1,66 @@ +package spanner + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// TestDialect verifies the committed GoogleSQL dialect against what a +// Spanner server reports. It skips unless SPANNER_SERVER_URI names one. +func TestDialect(t *testing.T) { + endpoint, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, endpoint) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, endpoint) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Dir) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} + +// TestAnalyzeCases verifies every GoogleSQL analyze case under +// internal/endtoend/testdata against what a Spanner server reports. It +// skips unless SPANNER_SERVER_URI names one. +func TestAnalyzeCases(t *testing.T) { + endpoint, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Cases) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no googlesql analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), endpoint, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what Spanner reports (-committed +spanner):\n%s", c.Output, diff) + } + }) + } +} diff --git a/internal/goldeneye/sqlite/analyze.go b/internal/goldeneye/sqlite/analyze.go new file mode 100644 index 0000000000..b1a8003dff --- /dev/null +++ b/internal/goldeneye/sqlite/analyze.go @@ -0,0 +1,269 @@ +package sqlite + +import ( + "context" + "errors" + "fmt" + "os" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// The analyze cases are checked against the analysis shell, which is asked +// three things about each query. What the library reports about the +// prepared statement, through `.stats stmt`: each result column's name and, +// for one read straight from a table, its declared type and which table +// column it is, with the column's NOT NULL looked up in the catalog. What +// the query returns, over the case's fixture and again over no rows, for +// the columns the library has no answer for: an expression's type is the +// storage class of its value, since SQLite types values rather than +// expressions, and any column is nullable when a NULL comes back — an +// aggregate over no rows, the far side of an outer join. And the bytecode +// the statement compiles to, which is where the parameters are found, +// since the library reports nothing about them but their number. + +// placeholder is one parameter of a query as sqlc numbers them: each ? in +// turn, and each sqlc.arg name once, at its first appearance. SQLite +// numbers ?NNN the same way, so the query is rewritten with those. +type placeholder struct { + Number int + Name string +} + +func bind(sql string) (string, []placeholder) { + var phs []placeholder + numbers := map[string]int{} + out := endtoend.Rewrite(sql, func(name, _ string) string { + n, ok := numbers[name] + if name == "" || !ok { + n = len(phs) + 1 + phs = append(phs, placeholder{Number: n, Name: name}) + if name != "" { + numbers[name] = n + } + } + return fmt.Sprintf("?%d", n) + }) + return out, phs +} + +// Analyze runs a case's queries through the analysis shell and returns what +// SQLite reports in the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, dir string, c endtoend.Case) ([]byte, error) { + if err := checkOptions(ctx, dir, analysisShell); err != nil { + return nil, err + } + binary := analysisShell.binary(dir) + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := analyzeQuery(ctx, binary, string(schema), string(fixture), q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return analysis.Encode(out) +} + +// Check compares what SQLite reports for a case with the output the case +// committed, returning a diff when they differ. +func Check(ctx context.Context, dir string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, dir, c) + if err != nil { + return "", err + } + return c.Compare(got) +} + +func analyzeQuery(ctx context.Context, binary, schema, fixture string, q endtoend.Query) (analysis.Query, error) { + sql, phs := bind(q.SQL) + + // What the library says: the catalog, the bytecode, and the statement + // prepared, with nothing bound to its parameters. + s := newScript() + s.sql(schema) + s.sql(fixture) + s.add(".mode json") + s.add(".explain off") + for _, cq := range catalogQueries { + s.section(cq.section) + s.sql(cq.sql) + } + s.section("explain") + s.sql("EXPLAIN " + sql) + s.section("query") + s.add(".stats stmt") + line := s.sql(sql) + s.section("end") + out, err := run(ctx, binary, s) + if err != nil { + return analysis.Query{}, err + } + if errs := out.errorsBefore(line); len(errs) > 0 { + return analysis.Query{}, errors.New(strings.Join(errs, "\n")) + } + query := out.sections["query"] + if query == nil || !query.prepared { + msg := strings.TrimSpace(out.stderr) + if msg == "" { + msg = "the statement was not prepared" + } + return analysis.Query{}, errors.New(msg) + } + cat, err := readCatalog(out) + if err != nil { + return analysis.Query{}, err + } + var prog []instr + if explain := out.sections["explain"]; explain != nil && len(explain.blocks) > 0 { + if err := explain.decode(0, &prog); err != nil { + return analysis.Query{}, fmt.Errorf("reading the bytecode: %w", err) + } + } + var names []string + for _, m := range query.columns { + names = append(names, m.Name) + } + t := newTracer(cat, names) + t.run(prog) + params := make([]analysis.Column, len(phs)) + for i, ph := range phs { + params[i] = t.param(ph.Number) + } + + // What the statement returns: over the fixture, with each parameter + // bound to a value of the column it stands in for, so that the rows + // come through the WHERE clause, and over no rows. + s = newScript() + s.sql(schema) + s.sql(fixture) + s.add(".parameter init") + for i, ph := range phs { + if v := sample(params[i]); v != "" { + s.sql(fmt.Sprintf("REPLACE INTO temp.sqlite_parameters(key, value) VALUES ('?%d', %s)", ph.Number, v)) + } + } + s.add(".mode quote") + s.section("query") + s.sql(sql) + s.section("end") + bound, err := run(ctx, binary, s) + if err != nil { + return analysis.Query{}, err + } + s = newScript() + s.sql(schema) + s.add(".mode quote") + s.section("query") + s.sql(sql) + s.section("end") + empty, err := run(ctx, binary, s) + if err != nil { + return analysis.Query{}, err + } + var rows []string + for _, o := range []*output{bound, empty} { + if q := o.sections["query"]; q != nil { + rows = append(rows, q.rows...) + } + } + + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + for i, m := range query.columns { + aq.Columns = append(aq.Columns, describeColumn(cat, m, classes(rows, i))) + } + for i, ph := range phs { + ac := params[i] + if ph.Name != "" { + ac.Name = ph.Name + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} + +// sample is an expression for a value to bind to a parameter: one of its +// column's values in the fixture, or a value of its type when all that is +// known is the type. Empty when nothing is known. +func sample(ac analysis.Column) string { + if ac.Table != "" && ac.Name != "" { + col, tbl := quoteIdent(ac.Name), quoteIdent(ac.Table) + return fmt.Sprintf("(SELECT %s FROM %s WHERE %s IS NOT NULL LIMIT 1)", col, tbl, col) + } + if ac.Type == nil { + return "" + } + switch ac.Type.Name { + case "integer", "numeric": + return "1" + case "real": + return "1.0" + case "text": + return "'a'" + case "blob": + return "x'00'" + } + return "" +} + +func quoteIdent(s string) string { + return `"` + strings.ReplaceAll(s, `"`, `""`) + `"` +} + +// classes lists the storage classes of a column's values across rows. +func classes(rows []string, i int) []string { + var out []string + for _, row := range rows { + if c := cells(row); i < len(c) { + out = append(out, storageClass(c[i])) + } + } + return out +} + +// describeColumn describes a result column: as the table column it is read +// from when it is one, otherwise by the storage class of its values, and +// nullable when any of its values was NULL. +func describeColumn(cat *catalog, m columnMeta, classes []string) analysis.Column { + ac := analysis.Column{Name: m.Name} + if col := cat.lookup(m.Table, m.Origin); col != nil { + d := col.describe() + ac.Type, ac.Table = d.Type, d.Table + } else { + for _, class := range classes { + if class != "null" { + ac.Type = &analysis.TypeExpr{Name: class} + break + } + } + } + if ac.Type != nil { + for _, class := range classes { + if class == "null" { + ac.Type.Nullable = true + } + } + } + return ac +} diff --git a/internal/goldeneye/sqlite/bytecode.go b/internal/goldeneye/sqlite/bytecode.go new file mode 100644 index 0000000000..2a0e0dd281 --- /dev/null +++ b/internal/goldeneye/sqlite/bytecode.go @@ -0,0 +1,456 @@ +package sqlite + +import ( + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" +) + +// SQLite has nothing to say about a parameter's type: a bound value is +// whatever it is, and the column a parameter stands in for appears nowhere +// in what the library reports about a prepared statement. What it does +// report is the program it compiled the statement into. EXPLAIN prints the +// bytecode, in which a parameter is a Variable loading a register, and the +// column it stands in for is the other operand of the comparison the +// register reaches, the row the seek it drives lands on, or the position +// in the record that Insert writes. So each parameter is followed from the +// register it loads, through copies and through the expressions it is an +// argument of, to the first opcode that uses it against something the +// catalog can name, the way the ClickHouse check follows a placeholder +// through the query tree to the column it is compared with. +// +// Registers hold what the last opcode to write them wrote, and remember +// which parameters have been loaded into them, which a later constant does +// not clear: coalesce(?, 'x') overwrites the parameter's register with the +// fallback on the branch where the parameter is NULL, and the comparison +// that follows is still the parameter's. A parameter with no such use is +// described by what the program does to it before using it, when it does +// anything: MustBeInt says it has to be an integer, as LIMIT's does, and +// Affinity says which affinity it is coerced to. + +// instr is one line of EXPLAIN output. +type instr struct { + Addr int `json:"addr"` + Opcode string `json:"opcode"` + P1 int `json:"p1"` + P2 int `json:"p2"` + P3 int `json:"p3"` + P4 *string `json:"p4"` + P5 int `json:"p5"` +} + +func (in instr) p4() string { + if in.P4 == nil { + return "" + } + return *in.P4 +} + +type valueKind int + +const ( + vNone valueKind = iota + vParam // a Variable + vColumn // Column: a stored column of a cursor + vRowid // Rowid, IdxRowid: the rowid of a cursor + vConstant // a literal, with its storage class + vFunction // the result of a function call, with its name + vExpr // the result of an operator + vRecord // MakeRecord: the registers packed into a record +) + +// value is what a register holds. +type value struct { + kind valueKind + cursor int + index int + class string // vConstant + fn string // vFunction + regs []int // vRecord +} + +type register struct { + desc value + params []int // every parameter loaded into the register +} + +// tracer follows the parameters of one statement through its bytecode. +type tracer struct { + cat *catalog + names []string // the statement's result columns + // cursors is what each open cursor is on; ephemeral holds, for the + // cursors on ephemeral tables and sorters, the parameters stored in + // each column, so that a parameter put into an IN list's table comes + // back out with the Column that reads it. + cursors map[int]object + ephemeral map[int]map[int][]int + regs map[int]*register + // found is the column each parameter was found to stand in for, and + // hint what the program said about a parameter's type. + found map[int]analysis.Column + hint map[int]string +} + +func newTracer(cat *catalog, names []string) *tracer { + return &tracer{ + cat: cat, + names: names, + cursors: map[int]object{}, + ephemeral: map[int]map[int][]int{}, + regs: map[int]*register{}, + found: map[int]analysis.Column{}, + hint: map[int]string{}, + } +} + +// run walks the program in the order it runs: the prologue Init jumps to, +// where the Variables of a query are loaded, and then the body. +func (t *tracer) run(prog []instr) { + order := prog + if len(prog) > 0 && prog[0].Opcode == "Init" && prog[0].P2 > 0 && prog[0].P2 < len(prog) { + order = append(append([]instr{}, prog[prog[0].P2:]...), prog[1:prog[0].P2]...) + } + for _, in := range order { + t.step(in) + } +} + +// param describes what the parameter was found to stand in for. +func (t *tracer) param(number int) analysis.Column { + if ac, ok := t.found[number]; ok { + return ac + } + if typ := t.hint[number]; typ != "" { + return analysis.Column{Type: &analysis.TypeExpr{Name: typ}} + } + return analysis.Column{} +} + +func (t *tracer) reg(n int) *register { + r := t.regs[n] + if r == nil { + r = ®ister{} + t.regs[n] = r + } + return r +} + +func (t *tracer) params(n int) []int { + if r := t.regs[n]; r != nil { + return r.params + } + return nil +} + +// set records a write to a register. A Variable is the parameter and +// nothing else; a column read replaces whatever the register held, since +// the compiler reuses registers for the columns it reads; a constant keeps +// the parameters, for the coalesce case above; anything else carries the +// parameters it was computed from. +func (t *tracer) set(n int, v value, params []int) { + r := t.reg(n) + r.desc = v + switch v.kind { + case vConstant: + default: + r.params = params + } +} + +func (t *tracer) copy(from, to int) { + src := t.reg(from) + dst := t.reg(to) + dst.desc = src.desc + dst.params = append([]int{}, src.params...) +} + +// assoc records the column the parameters in a register stand in for, +// keeping the first found for each. +func (t *tracer) assoc(params []int, ac analysis.Column) { + for _, p := range params { + if _, ok := t.found[p]; !ok { + t.found[p] = ac + } + } +} + +// typeHint records what the program requires of a register's parameters. +func (t *tracer) typeHint(n int, typ string) { + if typ == "" { + return + } + for _, p := range t.params(n) { + if _, ok := t.hint[p]; !ok { + t.hint[p] = typ + } + } +} + +// describe turns what a register holds into the column a parameter +// compared with it stands in for, when it can be named: a stored column +// or rowid, a constant's storage class, or a function's name. +func (t *tracer) describe(v value) (analysis.Column, bool) { + switch v.kind { + case vColumn: + return t.stored(v.cursor, v.index) + case vRowid: + if owner := t.cursors[v.cursor].owner(); owner != nil { + return owner.rowid(), true + } + case vConstant: + if v.class != "null" && v.class != "" { + return analysis.Column{Type: &analysis.TypeExpr{Name: v.class}}, true + } + case vFunction: + return analysis.Column{Name: v.fn}, true + } + return analysis.Column{}, false +} + +// stored describes the ith stored column of a cursor. +func (t *tracer) stored(cursor, i int) (analysis.Column, bool) { + col, owner, ok := t.cursors[cursor].column(i) + switch { + case !ok: + return analysis.Column{}, false + case col != nil: + return col.describe(), true + default: + return owner.rowid(), true + } +} + +// rank orders what a parameter's fellow operands may be described by: a +// column first, then a function, then a constant. +func rank(v value) int { + switch v.kind { + case vColumn, vRowid: + return 0 + case vFunction: + return 1 + case vConstant: + if v.class != "null" && v.class != "" { + return 2 + } + } + return -1 +} + +// expression handles an opcode computing a result from operand registers: +// each parameter among the operands is described by the best other +// operand, and one with no other operand to be described by is carried +// into the result, for whatever the result is then compared with. +func (t *tracer) expression(args []int, dest int, result value) { + var carried []int + for _, a := range args { + params := t.params(a) + if len(params) == 0 { + continue + } + best := -1 + for _, b := range args { + if b == a { + continue + } + if r := rank(t.reg(b).desc); r >= 0 && (best < 0 || r < rank(t.reg(best).desc)) { + best = b + } + } + if best >= 0 { + if ac, ok := t.describe(t.reg(best).desc); ok { + t.assoc(params, ac) + continue + } + } + carried = append(carried, params...) + } + t.set(dest, result, carried) +} + +// compare handles a comparison of two registers: the parameters of each +// stand in for what the other holds. +func (t *tracer) compare(a, b int) { + if ac, ok := t.describe(t.reg(b).desc); ok { + t.assoc(t.params(a), ac) + } + if ac, ok := t.describe(t.reg(a).desc); ok { + t.assoc(t.params(b), ac) + } +} + +// store handles a register written as the ith column of a cursor's row: +// an ephemeral table remembers the parameters for the reads to come, and +// a real one is the column the parameters stand in for. +func (t *tracer) store(cursor, i, reg int) { + params := t.params(reg) + if len(params) == 0 { + return + } + if cols, ok := t.ephemeral[cursor]; ok { + cols[i] = append(cols[i], params...) + return + } + if ac, ok := t.stored(cursor, i); ok { + t.assoc(params, ac) + } +} + +// key handles registers used as a key into a cursor: n registers from +// start, or the record in start when n is zero. +func (t *tracer) key(cursor, start, n int) { + regs := t.span(start, n) + if n == 0 { + if r := t.reg(start); r.desc.kind == vRecord { + regs = r.desc.regs + } + } + for i, reg := range regs { + t.store(cursor, i, reg) + } +} + +func (t *tracer) span(start, n int) []int { + regs := make([]int, 0, max(n, 0)) + for i := 0; i < n; i++ { + regs = append(regs, start+i) + } + return regs +} + +// affinity names the type an affinity character coerces to. +func affinity(c byte) string { + switch c { + case 'A': + return "blob" + case 'B': + return "text" + case 'C': + return "numeric" + case 'D': + return "integer" + case 'E': + return "real" + } + return "" +} + +func (t *tracer) step(in instr) { + switch in.Opcode { + case "OpenRead", "OpenWrite", "ReopenIdx": + t.cursors[in.P1] = t.cat.root(in.P3, in.P2) + case "OpenDup": + t.cursors[in.P1] = t.cursors[in.P2] + if cols, ok := t.ephemeral[in.P2]; ok { + t.ephemeral[in.P1] = cols + } + case "OpenEphemeral", "OpenAutoindex", "SorterOpen", "OpenPseudo": + t.cursors[in.P1] = object{} + t.ephemeral[in.P1] = map[int][]int{} + case "Variable": + t.set(in.P2, value{kind: vParam}, []int{in.P1}) + case "Column", "VColumn": + t.set(in.P3, value{kind: vColumn, cursor: in.P1, index: in.P2}, t.ephemeral[in.P1][in.P2]) + case "Rowid", "IdxRowid": + t.set(in.P2, value{kind: vRowid, cursor: in.P1}, nil) + case "Copy": + for i := 0; i <= in.P3; i++ { + t.copy(in.P1+i, in.P2+i) + } + case "SCopy", "IntCopy": + t.copy(in.P1, in.P2) + case "Null", "SoftNull": + end := max(in.P2, in.P3) + if in.Opcode == "SoftNull" { + end = in.P1 + in.P2 = in.P1 + } + for r := in.P2; r <= end; r++ { + t.set(r, value{kind: vConstant, class: "null"}, nil) + } + case "Integer", "Int64": + t.set(in.P2, value{kind: vConstant, class: "integer"}, nil) + case "Real": + t.set(in.P2, value{kind: vConstant, class: "real"}, nil) + case "String8", "String": + t.set(in.P2, value{kind: vConstant, class: "text"}, nil) + case "Blob": + t.set(in.P2, value{kind: vConstant, class: "blob"}, nil) + case "Function", "PureFunc": + // P4 prints the function's arity, which for a variadic function + // is negative and says nothing about this call. Its arguments + // are the registers from P2 written so far, allocated together + // for the call. + name, n := parseCall(in.p4()) + if n < 0 { + n = 0 + for t.regs[in.P2+n] != nil { + n++ + } + } + t.expression(t.span(in.P2, n), in.P3, value{kind: vFunction, fn: name}) + case "Add", "Subtract", "Multiply", "Divide", "Remainder", "Concat", "BitAnd", "BitOr", "ShiftLeft", "ShiftRight": + t.expression([]int{in.P2, in.P1}, in.P3, value{kind: vExpr}) + case "MakeRecord": + t.set(in.P3, value{kind: vRecord, regs: t.span(in.P1, in.P2)}, nil) + case "Insert": + if r := t.reg(in.P2); r.desc.kind == vRecord { + for i, reg := range r.desc.regs { + t.store(in.P1, i, reg) + } + } + if owner := t.cursors[in.P1].owner(); owner != nil { + t.assoc(t.params(in.P3), owner.rowid()) + } + case "IdxInsert", "SorterInsert": + n, _ := strconv.Atoi(in.p4()) + if n > 0 { + t.key(in.P1, in.P3, n) + } else { + t.key(in.P1, in.P2, 0) + } + case "Eq", "Ne", "Lt", "Le", "Gt", "Ge": + t.compare(in.P1, in.P3) + case "SeekRowid", "NotExists": + if owner := t.cursors[in.P1].owner(); owner != nil { + t.assoc(t.params(in.P3), owner.rowid()) + } + case "SeekGE", "SeekGT", "SeekLE", "SeekLT": + // On a table with a rowid the seek is by the rowid in P3; on an + // index it is by the P4 registers from P3. + if o := t.cursors[in.P1]; o.table != nil && !o.table.withoutRowid { + t.assoc(t.params(in.P3), o.table.rowid()) + break + } + n, _ := strconv.Atoi(in.p4()) + t.key(in.P1, in.P3, n) + case "IdxGE", "IdxGT", "IdxLE", "IdxLT", "Found", "NotFound", "NoConflict": + n, _ := strconv.Atoi(in.p4()) + t.key(in.P1, in.P3, n) + case "MustBeInt": + t.typeHint(in.P1, "integer") + case "Affinity": + for i, c := range []byte(in.p4()) { + if i < in.P2 { + t.typeHint(in.P1+i, affinity(c)) + } + } + case "ResultRow": + for i := 0; i < in.P2; i++ { + if i < len(t.names) { + t.assoc(t.params(in.P1+i), analysis.Column{Name: t.names[i]}) + } + } + } +} + +// parseCall splits the `name(n)` a Function's P4 prints into the function's +// name and the number of arguments it is called with. +func parseCall(p4 string) (string, int) { + open := strings.LastIndexByte(p4, '(') + if open < 0 || !strings.HasSuffix(p4, ")") { + return p4, 0 + } + n, _ := strconv.Atoi(p4[open+1 : len(p4)-1]) + return p4[:open], n +} diff --git a/internal/goldeneye/sqlite/catalog.go b/internal/goldeneye/sqlite/catalog.go new file mode 100644 index 0000000000..8077543325 --- /dev/null +++ b/internal/goldeneye/sqlite/catalog.go @@ -0,0 +1,294 @@ +package sqlite + +import ( + "fmt" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" +) + +// catalog is what the database says about a schema: its tables and their +// columns, its indexes, and the b-tree each is stored in, which is how the +// bytecode names them. +type catalog struct { + tables map[string]*table + roots map[int]object // by root page +} + +type table struct { + name string + withoutRowid bool + cols []*tableColumn // by cid + // stored lists the columns in the order a row's record holds them, + // which is cid order less the generated columns that are not stored. + stored []*tableColumn + // pk is the PRIMARY KEY index of a WITHOUT ROWID table, whose order is + // the order the table's own b-tree stores a row in. + pk *index +} + +type tableColumn struct { + table *table + cid int + name string + declType string + notNull bool + pk int // position in the primary key, 0 for none +} + +type index struct { + name string + table *table + cids []int // by seqno: -1 for the rowid, -2 for an expression +} + +// object is what a cursor is open on: a table, an index, or, with neither +// set, something the catalog does not describe — an ephemeral table, a +// sorter, a virtual table. +type object struct { + table *table + index *index +} + +// The catalog is read with these, each in a section of its own, in json +// mode. A query that finds nothing prints nothing, so a section may be +// empty. +var catalogQueries = []struct{ section, sql string }{ + {"tables", `SELECT name, type, wr FROM pragma_table_list WHERE schema = 'main' ORDER BY name`}, + {"columns", `SELECT t.name AS tbl, c.cid, c.name, c.type, c."notnull" AS "notnull", c.pk, c.hidden + FROM pragma_table_list t, pragma_table_xinfo(t.name) c + WHERE t.schema = 'main' AND t.type IN ('table', 'virtual') ORDER BY t.name, c.cid`}, + {"indexes", `SELECT t.name AS tbl, i.name AS idx, i.origin, x.seqno, x.cid + FROM pragma_table_list t, pragma_index_list(t.name) i, pragma_index_xinfo(i.name) x + WHERE t.schema = 'main' ORDER BY t.name, i.name, x.seqno`}, + {"roots", `SELECT type, name, tbl_name, rootpage FROM sqlite_schema WHERE rootpage > 0`}, +} + +// readCatalog builds the catalog from the sections catalogQueries printed. +func readCatalog(out *output) (*catalog, error) { + var tables []struct { + Name string `json:"name"` + Type string `json:"type"` + WR int `json:"wr"` + } + var columns []struct { + Table string `json:"tbl"` + CID int `json:"cid"` + Name string `json:"name"` + Type string `json:"type"` + NotNull int `json:"notnull"` + PK int `json:"pk"` + Hidden int `json:"hidden"` + } + var indexes []struct { + Table string `json:"tbl"` + Index string `json:"idx"` + Origin string `json:"origin"` + Seqno int `json:"seqno"` + CID int `json:"cid"` + } + var roots []struct { + Type string `json:"type"` + Name string `json:"name"` + Table string `json:"tbl_name"` + Rootpage int `json:"rootpage"` + } + for name, v := range map[string]any{"tables": &tables, "columns": &columns, "indexes": &indexes, "roots": &roots} { + s := out.sections[name] + if s == nil { + return nil, fmt.Errorf("reading the catalog: no %s section in the output", name) + } + if len(s.blocks) > 0 { + if err := s.decode(0, v); err != nil { + return nil, fmt.Errorf("reading the catalog's %s: %w", name, err) + } + } + } + + c := &catalog{tables: map[string]*table{}, roots: map[int]object{}} + for _, t := range tables { + if t.Type == "table" || t.Type == "virtual" { + c.tables[t.Name] = &table{name: t.Name, withoutRowid: t.WR == 1} + } + } + for _, col := range columns { + t := c.tables[col.Table] + if t == nil { + continue + } + tc := &tableColumn{table: t, cid: col.CID, name: col.Name, declType: col.Type, notNull: col.NotNull == 1, pk: col.PK} + for len(t.cols) <= col.CID { + t.cols = append(t.cols, nil) + } + t.cols[col.CID] = tc + // A generated column that is not stored — hidden is 2 — has no + // place in the record. + if col.Hidden != 2 { + t.stored = append(t.stored, tc) + } + } + byName := map[string]*index{} + for _, ic := range indexes { + t := c.tables[ic.Table] + if t == nil { + continue + } + ix := byName[ic.Index] + if ix == nil { + ix = &index{name: ic.Index, table: t} + byName[ic.Index] = ix + if ic.Origin == "pk" && t.withoutRowid { + t.pk = ix + } + } + for len(ix.cids) <= ic.Seqno { + ix.cids = append(ix.cids, -2) + } + ix.cids[ic.Seqno] = ic.CID + } + for _, r := range roots { + switch r.Type { + case "table": + if t := c.tables[r.Name]; t != nil { + c.roots[r.Rootpage] = object{table: t} + } + case "index": + if ix := byName[r.Name]; ix != nil { + c.roots[r.Rootpage] = object{index: ix} + } + } + } + return c, nil +} + +// root returns what is stored in a b-tree of the main database. +func (c *catalog) root(db, page int) object { + if db != 0 { + return object{} + } + return c.roots[page] +} + +// lookup finds a table column by the names `.stats stmt` prints. +func (c *catalog) lookup(tbl, col string) *tableColumn { + t := c.tables[tbl] + if t == nil { + return nil + } + for _, tc := range t.cols { + if tc != nil && tc.name == col { + return tc + } + } + return nil +} + +// rowidAlias returns the column that is another name for the rowid: the +// lone INTEGER PRIMARY KEY of a table that has a rowid. +func (t *table) rowidAlias() *tableColumn { + if t.withoutRowid { + return nil + } + var alias *tableColumn + for _, tc := range t.cols { + if tc == nil || tc.pk == 0 { + continue + } + if alias != nil || !strings.EqualFold(tc.declType, "INTEGER") { + return nil + } + alias = tc + } + return alias +} + +// describe is the column as sqlc analyze describes one: its declared type, +// nullable unless declared NOT NULL or the rowid, which is never NULL. +func (tc *tableColumn) describe() analysis.Column { + typ := parseType(tc.declType) + typ.Nullable = !tc.notNull && tc.table.rowidAlias() != tc + return analysis.Column{Name: tc.name, Type: typ, Table: tc.table.name} +} + +// rowid describes the table's rowid: the column that aliases it, or the +// rowid itself. +func (t *table) rowid() analysis.Column { + if alias := t.rowidAlias(); alias != nil { + return alias.describe() + } + return analysis.Column{Name: "rowid", Type: &analysis.TypeExpr{Name: "integer"}, Table: t.name} +} + +// column returns what the object's ith stored column is: a table column, +// or the rowid of a table. An index stores the columns it is on and then +// the rowid; a WITHOUT ROWID table is stored in the order of its primary +// key; any other table is stored in column order. +func (o object) column(i int) (*tableColumn, *table, bool) { + ix := o.index + if o.table != nil && o.table.withoutRowid { + ix = o.table.pk + } + switch { + case ix != nil: + if i < 0 || i >= len(ix.cids) { + return nil, nil, false + } + cid := ix.cids[i] + switch { + case cid == -1: + return nil, ix.table, true + case cid >= 0 && cid < len(ix.table.cols) && ix.table.cols[cid] != nil: + return ix.table.cols[cid], nil, true + } + case o.table != nil: + if i >= 0 && i < len(o.table.stored) { + return o.table.stored[i], nil, true + } + } + return nil, nil, false +} + +// owner is the table the object stores rows of. +func (o object) owner() *table { + if o.index != nil { + return o.index.table + } + return o.table +} + +// parseType reads a declared type the way sqlc's catalog does: the name +// lowercased, with whatever is in parentheses after it as arguments. A +// column declared with no type at all can hold anything. +func parseType(decl string) *analysis.TypeExpr { + decl = strings.TrimSpace(decl) + if decl == "" { + return &analysis.TypeExpr{Name: "any"} + } + name, args := decl, "" + if open := strings.IndexByte(decl, '('); open >= 0 && strings.HasSuffix(decl, ")") { + name, args = decl[:open], decl[open+1:len(decl)-1] + } + t := &analysis.TypeExpr{Name: strings.ToLower(strings.TrimSpace(name))} + if strings.TrimSpace(args) == "" { + return t + } + for _, a := range strings.Split(args, ",") { + a = strings.TrimSpace(a) + switch { + case strings.HasPrefix(a, "'") && strings.HasSuffix(a, "'") && len(a) >= 2: + s := strings.ReplaceAll(a[1:len(a)-1], "''", "'") + t.Args = append(t.Args, analysis.TypeArg{String: &s}) + case strings.EqualFold(a, "true") || strings.EqualFold(a, "false"): + b := strings.EqualFold(a, "true") + t.Args = append(t.Args, analysis.TypeArg{Bool: &b}) + default: + if n, err := strconv.ParseInt(a, 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } else { + t.Args = append(t.Args, analysis.TypeArg{Type: &analysis.TypeExpr{Name: strings.ToLower(a)}}) + } + } + } + return t +} diff --git a/internal/goldeneye/sqlite/install.go b/internal/goldeneye/sqlite/install.go new file mode 100644 index 0000000000..d09a38013a --- /dev/null +++ b/internal/goldeneye/sqlite/install.go @@ -0,0 +1,347 @@ +package sqlite + +import ( + "archive/zip" + "context" + "crypto/sha3" + "encoding/hex" + "errors" + "fmt" + "io" + "net/http" + "os" + "os/exec" + "path/filepath" + "runtime" + "slices" + "strings" + "sync" +) + +// DefaultVersion is the SQLite release the dialect is generated from. It is +// the release the ncruces/go-sqlite3 driver in the main module embeds, so +// the functions the dialect knows are the ones the tests run against. +// Bumping it is a deliberate change: releases add functions and overloads, +// so regenerate and review the dialect after changing it, and add the new +// release's amalgamation to the table below. +const DefaultVersion = "3.53.4" + +// defaultOptions are the compile options the base dialect is built with: +// the ones sqlite.org's own configure turns on by default, and so the ones +// a stock sqlite3 has. JSON is part of the library unless omitted, so only +// the math functions need naming. +var defaultOptions = []string{"SQLITE_ENABLE_MATH_FUNCTIONS"} + +// extensions are the compile options that each become a directory under +// the dialect's extensions/, holding the functions a build with the option +// adds over the default build — the way each PostgreSQL contrib extension +// holds what CREATE EXTENSION adds. Each is named after its option as +// pragma compile_options spells it, in lower case, and lists the options +// its build needs: GEOPOLY lives inside the RTREE module, so enabling it +// alone adds nothing. Options that add virtual tables but no functions, +// such as SESSION and DBSTAT, are not listed, since the dialect has nothing +// to say about them, and ENABLE_FTS4 is the same module as ENABLE_FTS3. +var extensions = []build{ + {"soundex", []string{"SQLITE_SOUNDEX"}}, + {"enable_fts3", []string{"SQLITE_ENABLE_FTS3"}}, + {"enable_fts5", []string{"SQLITE_ENABLE_FTS5"}}, + {"enable_geopoly", []string{"SQLITE_ENABLE_RTREE", "SQLITE_ENABLE_GEOPOLY"}}, + {"enable_offset_sql_func", []string{"SQLITE_ENABLE_OFFSET_SQL_FUNC"}}, + {"enable_percentile", []string{"SQLITE_ENABLE_PERCENTILE"}}, + {"enable_rtree", []string{"SQLITE_ENABLE_RTREE"}}, +} + +// analysisShell is the shell the analyze cases run through, which is no +// dialect build: nothing is generated from it. It is built with column +// metadata, so that `.stats stmt` can say which table column each result +// column of a statement comes from, and with every extension option at +// once, so that whatever a case's schema asks for is there. +var analysisShell = build{"analysis", append([]string{"SQLITE_ENABLE_COLUMN_METADATA"}, extensionOptions()...)} + +// extensionOptions is every option an extension build turns on, once each. +func extensionOptions() []string { + var opts []string + for _, b := range extensions { + for _, opt := range b.options { + if !slices.Contains(opts, opt) { + opts = append(opts, opt) + } + } + } + return opts +} + +// asset is one downloadable amalgamation of SQLite: the zip published on +// sqlite.org holding sqlite3.c, sqlite3.h and the shell's shell.c. +type asset struct { + Version string + // Path is the download's address under https://sqlite.org/, the + // release year included, as the download page's index lists it. + Path string + // SHA3 is the SHA3-256 of the zip, as the download page lists it. + SHA3 string +} + +// assets lists every amalgamation Install knows how to fetch, with the +// SHA3-256 of the download. A version that is not in this table cannot be +// installed: verifying the download is the point of the table. The +// checksums are the ones in the index at the foot of +// https://sqlite.org/download.html. +var assets = []asset{ + {"3.53.4", "2026/sqlite-amalgamation-3530400.zip", "628a44cfe82c66aed1ccbbe85a562d2e33ebe64b3288981ed76285612227934e"}, +} + +// sources are the files taken out of the amalgamation. +var sources = []string{"sqlite3.c", "sqlite3.h", "shell.c"} + +func releaseAsset(version string) (asset, error) { + for _, a := range assets { + if a.Version == version { + return a, nil + } + } + return asset{}, fmt.Errorf("SQLite %s is not in the asset table; add its amalgamation and checksum to install.go", version) +} + +func (a asset) url() string { + return "https://sqlite.org/" + a.Path +} + +// cacheDir is where Install puts a version: the sources under src/, and one +// shell per build under default/, under each option's extension name and +// under analysis/. +func cacheDir(version string) (string, error) { + dir, err := os.UserCacheDir() + if err != nil { + return "", err + } + return filepath.Join(dir, "sqlc-sqlite", version), nil +} + +// build is one compiled shell: its name, which is the directory it is +// under in the version's cache directory and, for an extension, under the +// dialect's extensions/, and the options it is built with beyond the +// default ones. +type build struct { + name string + options []string +} + +// builds lists the dialect builds: the default build first, then one per +// extension. +func builds() []build { + return append([]build{{"default", nil}}, extensions...) +} + +// shells lists every build Install makes: the dialect builds and the +// analysis shell. +func shells() []build { + return append(builds(), analysisShell) +} + +// flags are every option a build is compiled with. +func (b build) flags() []string { + return append(append([]string{}, defaultOptions...), b.options...) +} + +func (b build) binary(dir string) string { + return filepath.Join(dir, b.name, "sqlite3") +} + +// Locate finds the directory of shells Install made for DefaultVersion. +func Locate() (string, error) { + dir, err := cacheDir(DefaultVersion) + if err != nil { + return "", err + } + for _, b := range shells() { + if _, err := os.Stat(b.binary(dir)); err != nil { + return "", fmt.Errorf("sqlite %s is not built with %s: run `go run ./cmd/goldeneye install sqlite` in internal/goldeneye", DefaultVersion, strings.Join(b.flags(), " ")) + } + } + return dir, nil +} + +// Install downloads the amalgamation for a version into the cache and +// compiles the shell from it once per build, returning the directory the +// shells are under. Builds already there are kept, so adding an option +// compiles only its shell. The download is checked against the table's +// SHA3-256 before it is unpacked. Compiling takes the compiler CC names, or +// cc, and a few seconds per build without optimisation, which a shell that +// only reads catalogs does not need. +// +// goos and goarch are what every installer is handed; the sources build the +// same everywhere a C compiler is, but no default compiler or link line is +// known for Windows. +func Install(ctx context.Context, version, goos, goarch string, progress io.Writer) (string, error) { + if goos == "windows" { + return "", errors.New("building SQLite from source is not supported on Windows") + } + dir, err := cacheDir(version) + if err != nil { + return "", err + } + var missing []build + for _, b := range shells() { + if _, err := os.Stat(b.binary(dir)); err != nil { + missing = append(missing, b) + } + } + if len(missing) == 0 { + return dir, nil + } + if err := download(ctx, version, dir, progress); err != nil { + return "", err + } + if err := compile(ctx, dir, missing, progress); err != nil { + return "", err + } + return dir, nil +} + +// download fetches the amalgamation and unpacks the sources into src/, +// unless they are already there. +func download(ctx context.Context, version, dir string, progress io.Writer) error { + src := filepath.Join(dir, "src") + have := true + for _, name := range sources { + if _, err := os.Stat(filepath.Join(src, name)); err != nil { + have = false + } + } + if have { + return nil + } + a, err := releaseAsset(version) + if err != nil { + return err + } + if err := os.MkdirAll(src, 0o755); err != nil { + return err + } + + url := a.url() + fmt.Fprintf(progress, "downloading %s\n", url) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) + if err != nil { + return err + } + resp, err := http.DefaultClient.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("downloading %s: %s", url, resp.Status) + } + + // The zip has to land on disk before it can be read — its directory is + // at the end — so download it whole and hash every byte on the way. + archive, err := os.CreateTemp(dir, "sqlite-amalgamation-*.partial") + if err != nil { + return err + } + defer os.Remove(archive.Name()) + sum := sha3.New256() + if _, err := io.Copy(io.MultiWriter(archive, sum), resp.Body); err != nil { + archive.Close() + return err + } + if err := archive.Close(); err != nil { + return err + } + if got := hex.EncodeToString(sum.Sum(nil)); got != a.SHA3 { + return fmt.Errorf("downloading %s: SHA3-256 mismatch: got %s, want %s", url, got, a.SHA3) + } + + zr, err := zip.OpenReader(archive.Name()) + if err != nil { + return err + } + defer zr.Close() + for _, name := range sources { + if err := extract(zr, name, filepath.Join(src, name)); err != nil { + return fmt.Errorf("downloading %s: %w", url, err) + } + } + return nil +} + +// extract copies the named file out of the zip. The amalgamation's files +// sit in one directory named after the release, so the name is matched on +// its base. +func extract(zr *zip.ReadCloser, name, dest string) error { + for _, f := range zr.File { + if filepath.Base(f.Name) != name || f.FileInfo().IsDir() { + continue + } + rc, err := f.Open() + if err != nil { + return err + } + defer rc.Close() + tmp, err := os.CreateTemp(filepath.Dir(dest), name+"-*.partial") + if err != nil { + return err + } + defer os.Remove(tmp.Name()) + if _, err := io.Copy(tmp, rc); err != nil { + tmp.Close() + return err + } + if err := tmp.Close(); err != nil { + return err + } + return os.Rename(tmp.Name(), dest) + } + return fmt.Errorf("zip does not contain %s", name) +} + +// compile builds the shells, as many at a time as there are CPUs. +func compile(ctx context.Context, dir string, todo []build, progress io.Writer) error { + cc := os.Getenv("CC") + if cc == "" { + cc = "cc" + } + if _, err := exec.LookPath(cc); err != nil { + return fmt.Errorf("no C compiler found: put cc on PATH or set CC to one") + } + var wg sync.WaitGroup + slots := make(chan struct{}, max(1, runtime.NumCPU())) + errs := make([]error, len(todo)) + for i, b := range todo { + wg.Add(1) + go func() { + defer wg.Done() + slots <- struct{}{} + defer func() { <-slots }() + errs[i] = b.compile(ctx, cc, dir, progress) + }() + } + wg.Wait() + return errors.Join(errs...) +} + +// compile builds one shell from the sources in src/, writing it beside its +// destination and renaming so a failed build never masquerades as one. +func (b build) compile(ctx context.Context, cc, dir string, progress io.Writer) error { + dest := b.binary(dir) + if err := os.MkdirAll(filepath.Dir(dest), 0o755); err != nil { + return err + } + tmp := dest + ".partial" + defer os.Remove(tmp) + args := []string{"-O0"} + for _, opt := range b.flags() { + args = append(args, "-D"+opt) + } + src := filepath.Join(dir, "src") + args = append(args, filepath.Join(src, "shell.c"), filepath.Join(src, "sqlite3.c"), "-o", tmp, "-lm", "-ldl", "-lpthread") + fmt.Fprintf(progress, "building %s: %s %s\n", b.name, cc, strings.Join(args, " ")) + cmd := exec.CommandContext(ctx, cc, args...) + out, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("building %s: %w\n%s", b.name, err, strings.TrimSpace(string(out))) + } + return os.Rename(tmp, dest) +} diff --git a/internal/goldeneye/sqlite/shell.go b/internal/goldeneye/sqlite/shell.go new file mode 100644 index 0000000000..f17b9333ae --- /dev/null +++ b/internal/goldeneye/sqlite/shell.go @@ -0,0 +1,254 @@ +package sqlite + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "os/exec" + "regexp" + "strconv" + "strings" +) + +// The analysis shell is driven with a script on its standard input, made +// of SQL and of the shell's own dot-commands: `.print` labels the sections +// of the output so that each statement's results can be found again, +// `.mode` chooses how rows print — json for the catalog and the bytecode, +// quote for a query's own rows, since quote mode is the one that tells a +// blob from a string and a real from an integer — and `.stats stmt` makes +// the shell print what it knows about each result column of the statement +// it has just run, which with column metadata compiled in is the column's +// name, declared type, database, table and origin column. + +// script is a shell script under construction, counting its lines so that +// an error the shell reports "near line N" can be placed. +type script struct { + buf strings.Builder + line int // the number of the next line written +} + +func newScript() *script { + return &script{line: 1} +} + +// add writes text on lines of its own, and returns the line it starts on. +func (s *script) add(text string) int { + start := s.line + text = strings.TrimSpace(text) + if text == "" { + return start + } + s.buf.WriteString(text) + s.buf.WriteByte('\n') + s.line += strings.Count(text, "\n") + 1 + return start +} + +// sql writes statements, ending them with a semicolon when they lack one. +func (s *script) sql(text string) int { + text = strings.TrimRight(strings.TrimSpace(text), "; \t\r\n") + if text == "" { + return s.line + } + return s.add(text + ";") +} + +// section labels what follows, up to the next label. +func (s *script) section(name string) { + s.add(".print @@" + name) +} + +// columnMeta is what `.stats stmt` prints about one result column. Table +// and Origin name the table column a result column is read from, and are +// empty for an expression. +type columnMeta struct { + Name string + DeclType string + Database string + Table string + Origin string +} + +// section is the output between two labels. +type section struct { + // blocks holds every JSON result set printed in the section. + blocks []json.RawMessage + // rows holds every other line printed before the statement's + // statistics: in quote mode, one row each. + rows []string + // prepared says a statement's statistics were printed, which the shell + // does only for a statement it could prepare. + prepared bool + columns []columnMeta +} + +// decode reads the section's nth JSON result set. +func (s *section) decode(n int, v any) error { + if n >= len(s.blocks) { + return fmt.Errorf("expected at least %d result set(s), got %d", n+1, len(s.blocks)) + } + return json.Unmarshal(s.blocks[n], v) +} + +// output is what one run of the shell printed, by section. +type output struct { + sections map[string]*section + stderr string +} + +var errLineRe = regexp.MustCompile(`near line (\d+):`) + +// errorsBefore returns the errors the shell reported for statements before +// the given line: the ones that are not the statement under analysis +// failing to run, which it may, with nothing bound to its parameters. +func (o *output) errorsBefore(line int) []string { + var errs []string + for _, l := range strings.Split(o.stderr, "\n") { + if m := errLineRe.FindStringSubmatch(l); m != nil { + if n, _ := strconv.Atoi(m[1]); n < line { + errs = append(errs, strings.TrimSpace(l)) + } + } + } + return errs +} + +// run feeds a script to the shell over a fresh in-memory database and +// parses what it printed. A statement that fails does not stop the shell, +// so a failure is read from the output: a section whose statement has no +// statistics was not prepared, and stderr says why. +func run(ctx context.Context, binary string, s *script) (*output, error) { + cmd := exec.CommandContext(ctx, binary, ":memory:") + cmd.Stdin = strings.NewReader(s.buf.String()) + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + var exit *exec.ExitError + if !errors.As(err, &exit) { + return nil, fmt.Errorf("sqlite3: %w", err) + } + } + out := &output{sections: map[string]*section{}, stderr: stderr.String()} + var ( + cur *section + block []string // lines of the JSON result set being read + row []string // lines of the quote-mode row being read + ) + for _, line := range strings.Split(stdout.String(), "\n") { + switch { + case block != nil: + block = append(block, line) + if strings.HasSuffix(line, "]") { + cur.blocks = append(cur.blocks, json.RawMessage(strings.Join(block, "\n"))) + block = nil + } + case row != nil: + row = append(row, line) + if joined := strings.Join(row, "\n"); strings.Count(joined, "'")%2 == 0 { + cur.rows = append(cur.rows, joined) + row = nil + } + case strings.HasPrefix(line, "@@"): + cur = §ion{} + out.sections[line[2:]] = cur + case cur == nil || line == "": + case strings.HasPrefix(line, "["): + if strings.HasSuffix(line, "]") { + cur.blocks = append(cur.blocks, json.RawMessage(line)) + } else { + block = []string{line} + } + case strings.HasPrefix(line, "Number of output columns:"): + cur.prepared = true + case cur.prepared: + if i, field, value, ok := statLine(line); ok { + for len(cur.columns) <= i { + cur.columns = append(cur.columns, columnMeta{}) + } + c := &cur.columns[i] + switch field { + case "name": + c.Name = value + case "declared type": + c.DeclType = value + case "database name": + c.Database = value + case "table name": + c.Table = value + case "origin name": + c.Origin = value + } + } + default: + // A quote-mode row, complete unless a string in it spans lines. + if strings.Count(line, "'")%2 == 0 { + cur.rows = append(cur.rows, line) + } else { + row = []string{line} + } + } + } + return out, nil +} + +var statLineRe = regexp.MustCompile(`^Column (\d+) ([a-z ]+):`) + +// statLine reads one line of `.stats stmt` column output, which the shell +// prints as the label padded to 36 columns, a space and the value; a value +// the library has no answer for prints as the C library prints a null +// string. +func statLine(line string) (int, string, string, bool) { + m := statLineRe.FindStringSubmatch(line) + if m == nil { + return 0, "", "", false + } + i, _ := strconv.Atoi(m[1]) + label := m[0] + value := "" + if start := max(len(label), 36) + 1; start < len(line) { + value = line[start:] + } + if value == "(null)" { + value = "" + } + return i, m[2], value, true +} + +// cells splits a quote-mode row into its values as printed. +func cells(row string) []string { + var out []string + start := 0 + quoted := false + for i := 0; i < len(row); i++ { + switch { + case row[i] == '\'': + quoted = !quoted + case row[i] == ',' && !quoted: + out = append(out, row[start:i]) + start = i + 1 + } + } + return append(out, row[start:]) +} + +// storageClass reads the storage class of a value as quote mode prints +// it: a string is quoted, a blob is quoted with an X, NULL is spelled +// out, and a real has a point, an exponent or is infinite or not a number +// where an integer is digits. +func storageClass(cell string) string { + switch { + case cell == "NULL": + return "null" + case strings.HasPrefix(cell, "'"): + return "text" + case strings.HasPrefix(cell, "x'") || strings.HasPrefix(cell, "X'"): + return "blob" + case strings.ContainsAny(cell, ".eEIN"): + return "real" + default: + return "integer" + } +} diff --git a/internal/goldeneye/sqlite/signatures.go b/internal/goldeneye/sqlite/signatures.go new file mode 100644 index 0000000000..5551061bd5 --- /dev/null +++ b/internal/goldeneye/sqlite/signatures.go @@ -0,0 +1,136 @@ +package sqlite + +import "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + +// signature is what a function returns and what its arguments hold, read +// from the amalgamation by source.signature. Args types the leading +// arguments in order; a position it does not cover is "any", which the +// analyzer resolves to the argument's own type. Variadic types the +// arguments an overload of variable arity repeats, "any" when empty. How +// many arguments an overload takes, and how many of them it requires, +// comes from the shell. Nullable is decided afterwards: for an aggregate by +// running it over no rows, for a scalar by the nullable list below. +// Numeric says the function returns an integer for an integer argument +// and a real for a real one, and Returns what it returns for anything +// else. +type signature struct { + Args []string + Variadic string + Returns string + Numeric bool + Nullable bool +} + +// args builds an overload's parameters from the shell's argument count. A +// fixed count is that many parameters; a negative count is the required +// leading parameters, any further ones the signature types marked as +// having a default, and a variadic tail. +func (s signature) args(narg int) []dialect.Arg { + if narg >= 0 { + args := make([]dialect.Arg, narg) + for i := range args { + args[i] = dialect.Arg{Type: s.argType(i)} + } + return args + } + required := minArgs(narg) + n := max(required, len(s.Args)) + args := make([]dialect.Arg, 0, n+1) + for i := 0; i < n; i++ { + args = append(args, dialect.Arg{Type: s.argType(i), HasDefault: i >= required}) + } + tail := s.Variadic + if tail == "" { + tail = "any" + } + return append(args, dialect.Arg{Type: tail, Mode: "v"}) +} + +func (s signature) argType(i int) string { + if i < len(s.Args) { + return s.Args[i] + } + return "any" +} + +// inlineReturns is what the functions the VDBE implements in bytecode +// return, by the INLINEFUNC_* constant their registration carries. All but +// one hand back one of their arguments, which is what the default of "any" +// says; sqlite_offset is a byte offset. +var inlineReturns = map[string]string{ + "INLINEFUNC_sqlite_offset": "integer", +} + +// realResults are the functions that return an integer or a real on +// something other than which their argument is, and so are typed real +// alone: unixepoch takes a time string and returns a real only with the +// 'subsec' modifier. +var realResults = map[string]bool{ + "unixepoch": true, +} + +// omitted are functions the dialect leaves out: ones that exist for their +// side effect and return nothing a query can use, and ones an extension +// uses to pass pointers to itself. +var omitted = map[string]bool{ + // Loads a shared library and returns NULL. + "load_extension": true, + // Writes to the error log and returns NULL. + "sqlite_log": true, + // FTS3's and FTS5's ways of passing pointers to their virtual tables, + // not functions a query calls. + "fts3_tokenizer": true, + "fts5": true, + // A debugging aid of GEOPOLY's. + "geopoly_debug": true, +} + +// nullable are the scalar functions that return NULL for arguments that +// are not: a lookup that finds nothing, an input that does not parse, a +// value with no sign. The source cannot say this — a SQLite function +// returns NULL as often by setting no result as by calling +// sqlite3_result_null — so it is listed by the documentation of each. +// Aggregates are not listed: whether one returns NULL over no rows is +// found by running it over none. +var nullable = map[string]bool{ + // Core functions. + "nullif": true, + "sign": true, + "sqlite_compileoption_get": true, + "sqlite_offset": true, + "unhex": true, + // Date and time functions, for a time value they cannot parse. + "date": true, + "datetime": true, + "julianday": true, + "strftime": true, + "time": true, + "timediff": true, + "unixepoch": true, + // JSON functions, for a path that leads nowhere. + "->": true, + "->>": true, + "json_array_length": true, + "json_extract": true, + "json_type": true, + "jsonb_extract": true, + // Window functions, for a row outside the frame. + "first_value": true, + "lag": true, + "last_value": true, + "lead": true, + "nth_value": true, + // FTS5, for a table with no locale. + "fts5_get_locale": true, + // GEOPOLY functions, for an argument that is not a polygon. + "geopoly_area": true, + "geopoly_bbox": true, + "geopoly_blob": true, + "geopoly_ccw": true, + "geopoly_contains_point": true, + "geopoly_json": true, + "geopoly_overlap": true, + "geopoly_svg": true, + "geopoly_within": true, + "geopoly_xform": true, +} diff --git a/internal/goldeneye/sqlite/source.go b/internal/goldeneye/sqlite/source.go new file mode 100644 index 0000000000..d7c551891e --- /dev/null +++ b/internal/goldeneye/sqlite/source.go @@ -0,0 +1,521 @@ +package sqlite + +import ( + "fmt" + "os" + "regexp" + "sort" + "strings" +) + +// source is what the amalgamation says about how SQLite's functions answer. +// A function is registered in one of a few shapes — the FuncDef macros of +// the built-in tables, a sqlite3_create_function call, or a struct table an +// extension walks — each naming the C functions that implement it. Those +// implementations set their result through sqlite3_result_* and read their +// arguments through sqlite3_value_*, which is as close as SQLite comes to +// declaring a signature. +type source struct { + funcs map[string]cfunc + aliases map[string]string + regs map[string]*registration +} + +// cfunc is one C function definition: its parameter list and its body. +type cfunc struct { + params string + body string +} + +// registration is the union of everything the source registers under one +// SQL function name. +type registration struct { + // scalar implements a scalar overload: its results and its arguments. + scalar []string + // step and final implement an aggregate or window overload: step reads + // the arguments, final and value set the result. + step []string + final []string + // inline names the INLINEFUNC_* constant of a function the VDBE + // implements in bytecode, which has no C body to read. + inline string + // json records what a JSON function's registration says it returns, + // "text" or "blob", since the json_ and jsonb_ forms share an + // implementation; jsonAlways says the registration promises JSON text + // whatever the implementation might otherwise return, as -> does. + json string + jsonAlways bool + // table marks a registration found only in a struct table, which is + // consulted when nothing more direct registered the name. + table bool +} + +// The FuncDef macros, with the positions of the C functions in each. +var macroEntry = regexp.MustCompile(`\b(FUNCTION2|FUNCTION|VFUNCTION|SFUNCTION|MFUNCTION|JFUNCTION|INLINE_FUNC|DFUNCTION|PURE_DATE|STR_FUNCTION|LIKEFUNC|WAGGREGATE|WINDOWFUNCX|WINDOWFUNCALL|WINDOWFUNCNOOP)\(`) + +var ( + createFunction = regexp.MustCompile(`\bsqlite3_create_(window_)?function\(`) + defineAlias = regexp.MustCompile(`(?m)^#define\s+(\w+)\s+(\w+)\s*$`) + definition = regexp.MustCompile(`(?m)^(?:static\s+|SQLITE_PRIVATE\s+)?(?:const\s+)?(?:unsigned\s+)?[A-Za-z_]\w*(?:\s*\*+\s*|\s+)([A-Za-z_]\w*)\(`) + initializer = regexp.MustCompile(`\{[^{}]*"([a-z_0-9>-]+)"[^{}]*\}`) + identifier = regexp.MustCompile(`\b([A-Za-z_]\w*)\b`) + resultCall = regexp.MustCompile(`\bsqlite3_result_(\w+)\(`) + valueCall = regexp.MustCompile(`\bsqlite3_value_(\w+)\(\s*(?:argv|apVal|apArg)\[(\w+)\]`) + callee = regexp.MustCompile(`\b([A-Za-z_]\w*)\s*\(`) +) + +// readSource reads the amalgamation. +func readSource(path string) (*source, error) { + data, err := os.ReadFile(path) + if err != nil { + return nil, err + } + text := string(data) + s := &source{ + funcs: map[string]cfunc{}, + aliases: map[string]string{}, + regs: map[string]*registration{}, + } + for _, m := range defineAlias.FindAllStringSubmatch(text, -1) { + s.aliases[m[1]] = m[2] + } + s.readDefinitions(text) + s.readMacros(text) + s.readCreateFunctions(text) + s.readTables(text) + return s, nil +} + +// readDefinitions indexes every function defined at the left margin. +func (s *source) readDefinitions(text string) { + for _, m := range definition.FindAllStringSubmatchIndex(text, -1) { + name := text[m[2]:m[3]] + params, end, ok := balanced(text, m[1]-1, '(', ')') + if !ok { + continue + } + i := end + for i < len(text) && (text[i] == ' ' || text[i] == '\n' || text[i] == '\r' || text[i] == '\t') { + i++ + } + if i >= len(text) || text[i] != '{' { + continue + } + body, _, ok := balanced(text, i, '{', '}') + if !ok { + continue + } + if _, dup := s.funcs[name]; !dup { + s.funcs[name] = cfunc{params: params, body: body} + } + } +} + +// balanced returns the text between the bracket at open and its match, +// skipping string and character literals and comments, and the index after +// the closing bracket. +func balanced(text string, open int, lb, rb byte) (string, int, bool) { + depth := 0 + for i := open; i < len(text); i++ { + switch c := text[i]; { + case c == '"' || c == '\'': + for i++; i < len(text) && text[i] != c; i++ { + if text[i] == '\\' { + i++ + } + } + case c == '/' && i+1 < len(text) && text[i+1] == '*': + end := strings.Index(text[i+2:], "*/") + if end < 0 { + return "", 0, false + } + i += end + 3 + case c == '/' && i+1 < len(text) && text[i+1] == '/': + end := strings.IndexByte(text[i:], '\n') + if end < 0 { + return "", 0, false + } + i += end + case c == lb: + depth++ + case c == rb: + depth-- + if depth == 0 { + return text[open+1 : i], i + 1, true + } + } + } + return "", 0, false +} + +// arguments splits a bracketed argument list at the commas of its own +// level, and reports the index after the closing bracket. +func arguments(text string, open int) ([]string, int, bool) { + inner, end, ok := balanced(text, open, '(', ')') + if !ok { + return nil, 0, false + } + var args []string + depth, start := 0, 0 + for i := 0; i < len(inner); i++ { + switch inner[i] { + case '(', '[', '{': + depth++ + case ')', ']', '}': + depth-- + case '"': + for i++; i < len(inner) && inner[i] != '"'; i++ { + if inner[i] == '\\' { + i++ + } + } + case ',': + if depth == 0 { + args = append(args, strings.TrimSpace(inner[start:i])) + start = i + 1 + } + } + } + args = append(args, strings.TrimSpace(inner[start:])) + return args, end, true +} + +func (s *source) reg(name string) *registration { + name = strings.ToLower(name) + r, ok := s.regs[name] + if !ok { + r = ®istration{} + s.regs[name] = r + } + return r +} + +// readMacros reads the FuncDef tables. The macro definitions themselves +// match too, and are told apart by their formal parameter names. +func (s *source) readMacros(text string) { + for _, m := range macroEntry.FindAllStringSubmatchIndex(text, -1) { + macro := text[m[2]:m[3]] + args, _, ok := arguments(text, m[1]-1) + if !ok || len(args) < 2 || args[0] == "zName" || args[0] == "name" { + continue + } + name := args[0] + switch macro { + case "FUNCTION", "FUNCTION2", "VFUNCTION", "SFUNCTION", "DFUNCTION", "PURE_DATE", "STR_FUNCTION": + if len(args) > 4 { + r := s.reg(name) + r.scalar = append(r.scalar, args[4]) + } + case "MFUNCTION": + if len(args) > 3 { + r := s.reg(name) + r.scalar = append(r.scalar, args[3]) + } + case "JFUNCTION": + // JFUNCTION(zName, nArg, bUseCache, bWS, bRS, bJsonB, iArg, xFunc) + if len(args) > 7 { + r := s.reg(name) + r.scalar = append(r.scalar, args[7]) + r.json = "text" + if args[5] == "1" { + r.json = "blob" + } + r.jsonAlways = strings.Contains(args[6], "JSON_JSON") + } + case "INLINE_FUNC": + if len(args) > 2 { + s.reg(name).inline = args[2] + } + case "LIKEFUNC": + r := s.reg(name) + r.scalar = append(r.scalar, "likeFunc") + case "WAGGREGATE": + // WAGGREGATE(zName, nArg, arg, nc, xStep, xFinal, xValue, xInverse, f) + // The JSON aggregates use it too, told by their implementation, + // with JSON_BLOB as the user data of the jsonb_ forms. + if len(args) > 6 { + r := s.reg(name) + r.step = append(r.step, args[4]) + r.final = append(r.final, args[5], args[6]) + if strings.HasPrefix(args[4], "json") { + r.json = "text" + if strings.Contains(args[2], "JSON_BLOB") { + r.json = "blob" + } + } + } + case "WINDOWFUNCX", "WINDOWFUNCALL": + r := s.reg(name) + r.step = append(r.step, name+"StepFunc") + r.final = append(r.final, name+"ValueFunc") + case "WINDOWFUNCNOOP": + s.reg(name).inline = "bytecode" + } + } +} + +// readCreateFunctions reads the functions extensions register by calling +// sqlite3_create_function or sqlite3_create_window_function with a literal +// name. +func (s *source) readCreateFunctions(text string) { + for _, m := range createFunction.FindAllStringSubmatchIndex(text, -1) { + window := m[2] != -1 + args, _, ok := arguments(text, m[1]-1) + if !ok || len(args) < 8 || !strings.HasPrefix(args[1], `"`) { + continue + } + r := s.reg(strings.Trim(args[1], `"`)) + if window { + // (db, zName, nArg, eTextRep, pApp, xStep, xFinal, xValue, xInverse, xDestroy) + r.step = given(r.step, args[5]) + r.final = given(r.final, args[6], args[7]) + } else { + // (db, zName, nArg, eTextRep, pApp, xFunc, xStep, xFinal) + r.scalar = given(r.scalar, args[5]) + r.step = given(r.step, args[6]) + r.final = given(r.final, args[7]) + } + } +} + +// given appends the implementations a registration names, leaving out the +// methods it passes as 0 or NULL. +func given(impls []string, names ...string) []string { + for _, name := range names { + if name != "0" && name != "NULL" { + impls = append(impls, name) + } + } + return impls +} + +// readTables reads the struct tables extensions walk to register their +// functions — geopoly's aFunc, FTS5's aBuiltin, FTS3's aOverload — each row +// an initializer holding the function's name and the C functions that +// implement it. Any C function in the row counts as an implementation; +// which reads arguments and which sets the result comes out in the +// reading. A row is consulted only for a name nothing else registered. +func (s *source) readTables(text string) { + for _, m := range initializer.FindAllStringSubmatch(text, -1) { + var impls []string + for _, id := range identifier.FindAllStringSubmatch(m[0], -1) { + if _, ok := s.funcs[s.resolve(id[1])]; ok { + impls = append(impls, id[1]) + } + } + if len(impls) == 0 { + continue + } + name := strings.ToLower(m[1]) + r, ok := s.regs[name] + if ok && !r.table { + continue + } + r = s.reg(name) + r.table = true + r.scalar = append(r.scalar, impls...) + } +} + +// resolve follows #define aliases from a C function name to the one that +// is defined. +func (s *source) resolve(name string) string { + for i := 0; i < 8; i++ { + alias, ok := s.aliases[name] + if !ok { + return name + } + name = alias + } + return name +} + +// noop reports a C function that does nothing: the stand-in for a function +// the VDBE implements in bytecode, whose result is one of its arguments. +func noop(name string) bool { + return strings.HasPrefix(name, "noop") +} + +// The kinds a result or argument call names, by the sqlite3_result_* or +// sqlite3_value_* suffix with any 64 dropped. Suffixes not listed — error, +// subtype, type, bytes, dup — say nothing about a type. +var ( + resultKinds = map[string]string{ + "int": "integer", "double": "real", + "text": "text", "text16": "text", "text16le": "text", "text16be": "text", + "blob": "blob", "zeroblob": "blob", + "value": "any", "pointer": "any", + } + valueKinds = map[string]string{ + "int": "integer", "double": "real", + "text": "text", "text16": "text", "text16le": "text", "text16be": "text", + "blob": "blob", + } +) + +func kindOf(kinds map[string]string, suffix string) (string, bool) { + k, ok := kinds[strings.TrimSuffix(suffix, "64")] + return k, ok +} + +// results collects the kinds a C function sets its result to, following +// the helpers it calls a few levels down, since many functions hand their +// result to one. +func (s *source) results(name string, depth int, seen map[string]bool) map[string]bool { + kinds := map[string]bool{} + name = s.resolve(name) + if noop(name) { + kinds["any"] = true + return kinds + } + fn, ok := s.funcs[name] + if !ok || seen[name] || depth > 3 { + return kinds + } + seen[name] = true + for _, m := range resultCall.FindAllStringSubmatch(fn.body, -1) { + if k, ok := kindOf(resultKinds, m[1]); ok { + kinds[k] = true + } + } + for _, m := range callee.FindAllStringSubmatch(fn.body, -1) { + c := m[1] + if c == name || strings.HasPrefix(c, "sqlite3_") || strings.HasPrefix(c, "sqlite3Vdbe") { + continue + } + if _, ok := s.funcs[c]; ok { + for k := range s.results(c, depth+1, seen) { + kinds[k] = true + } + } + } + return kinds +} + +// args collects the kinds a C function reads each of its arguments as, by +// position, and the kind it reads a run of arguments as under a loop +// index. An implementation called through the FTS5 extension API is handed +// the table as an implicit first argument, so its positions shift by one. +func (s *source) args(name string, positions map[int]map[string]bool, variadic map[string]bool) { + fn, ok := s.funcs[s.resolve(name)] + if !ok { + return + } + shift := 0 + if strings.Contains(fn.params, "Fts5ExtensionApi") { + shift = 1 + if positions[0] == nil { + positions[0] = map[string]bool{} + } + positions[0]["any"] = true + } + for _, m := range valueCall.FindAllStringSubmatch(fn.body, -1) { + k, ok := kindOf(valueKinds, m[1]) + if !ok { + continue + } + var pos int + if _, err := fmt.Sscanf(m[2], "%d", &pos); err != nil { + variadic[k] = true + continue + } + pos += shift + if positions[pos] == nil { + positions[pos] = map[string]bool{} + } + positions[pos][k] = true + } +} + +// single reduces the kinds seen at one position to a type: the one kind +// seen, or "any" for a mixture or nothing. +func single(kinds map[string]bool) string { + if len(kinds) == 1 { + for k := range kinds { + return k + } + } + return "any" +} + +// signature derives what the source says a SQL function returns and takes. +// A result of one kind is that type. A function that returns one of its +// arguments, or a mixture of kinds, takes the type of its first argument, +// which the seed spells "any" — except that integer and real together are +// real, and Numeric, since abs, ceil and sum hand back an integer for an +// integer and a real for a real, and a real for the text or blob they +// convert, unless the function is one of the few whose choice turns on +// something else; and text and blob together are text, since a function +// that returns either is handing back the bytes it was given, and the +// legacy compiler cannot follow "any" to an argument. +func (s *source) signature(name string) (signature, error) { + r, ok := s.regs[strings.ToLower(name)] + if !ok { + return signature{}, fmt.Errorf("the amalgamation registers no function named %s", name) + } + var sig signature + switch { + case r.inline != "": + sig.Returns = inlineReturns[r.inline] + if sig.Returns == "" { + sig.Returns = "any" + } + default: + kinds := map[string]bool{} + for _, fn := range append(append([]string{}, r.scalar...), r.final...) { + for k := range s.results(fn, 0, map[string]bool{}) { + kinds[k] = true + } + } + jsonOnly := r.json != "" && len(kinds) <= 2 && !kinds["integer"] && !kinds["real"] && !kinds["any"] + switch { + case len(kinds) == 0: + return signature{}, fmt.Errorf("cannot tell what %s returns: no sqlite3_result call in %s", name, strings.Join(append(append([]string{}, r.scalar...), r.final...), ", ")) + case r.jsonAlways: + sig.Returns = "text" + case kinds["any"]: + sig.Returns = "any" + case len(kinds) == 1: + for k := range kinds { + sig.Returns = k + } + case jsonOnly: + // The shared implementation writes JSON text or JSONB; the + // registration says which this form gets. + sig.Returns = r.json + case len(kinds) == 2 && kinds["integer"] && kinds["real"]: + sig.Returns = "real" + sig.Numeric = !realResults[strings.ToLower(name)] + case len(kinds) == 2 && kinds["text"] && kinds["blob"]: + sig.Returns = "text" + default: + sig.Returns = "any" + } + } + + positions := map[int]map[string]bool{} + variadic := map[string]bool{} + for _, fn := range append(append([]string{}, r.scalar...), r.step...) { + s.args(fn, positions, variadic) + } + if len(positions) > 0 { + var order []int + for pos := range positions { + order = append(order, pos) + } + sort.Ints(order) + sig.Args = make([]string, order[len(order)-1]+1) + for i := range sig.Args { + sig.Args[i] = single(positions[i]) + } + // Trailing positions nothing typed say nothing, unless a variadic + // tail follows them, when they keep it from starting early. + for len(variadic) == 0 && len(sig.Args) > 0 && sig.Args[len(sig.Args)-1] == "any" { + sig.Args = sig.Args[:len(sig.Args)-1] + } + } + if len(variadic) == 1 { + sig.Variadic = single(variadic) + } + return sig, nil +} diff --git a/internal/goldeneye/sqlite/sqlite.go b/internal/goldeneye/sqlite/sqlite.go new file mode 100644 index 0000000000..c176a55b36 --- /dev/null +++ b/internal/goldeneye/sqlite/sqlite.go @@ -0,0 +1,444 @@ +// Package sqlite generates the SQLite dialect seed under +// internal/engine/sqlite/dialect from sqlite3 shells built from the +// amalgamation sqlite.org publishes, run against in-memory databases that +// need no server, and from the amalgamation itself. +// +// SQLite describes its functions as far as their names, their kinds and the +// number of arguments each takes — pragma_function_list — and no further: +// it types values rather than columns or functions, so nothing in the +// database says what a function returns or what it expects. The source +// does, in its way. Every function is registered with the C functions that +// implement it, and those set their result through sqlite3_result_* and +// read their arguments through sqlite3_value_*, which is as close as SQLite +// comes to declaring a signature. So functions.jsonl is built from both: +// the shell says which functions exist, how many arguments each overload +// takes and whether it aggregates, and the amalgamation says what each +// returns and what its arguments hold. A function the shell reports that +// the source does not register, or whose implementation sets no result, +// fails generation rather than being guessed at. What neither can say — +// which scalar functions return NULL for arguments that are not — is a +// short list in signatures.go; for aggregates it is found by running each +// over no rows. +// +// Which functions a SQLite has is decided when it is compiled, so the +// dialect treats compile options the way the PostgreSQL dialect treats +// contrib extensions. functions.jsonl is what a build with the default +// options has, and each further option gets a directory under extensions/ +// holding the functions a build with that option adds — found the way +// CREATE EXTENSION's additions are, by comparing the catalog with and +// without. SQLite has no catalog of types or operators, so types.jsonl and +// operators.jsonl are hand-written. +// +// The shells are built once per pinned version by Install. +package sqlite + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "maps" + "os/exec" + "path" + "path/filepath" + "slices" + "sort" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name of the engine directory the dialect lives under. +const Engine = "sqlite" + +// functionList is every function the connection knows, one row per +// overload: name, whether the library builds it in or the shell or an +// extension registered it, 's', 'a' or 'w' for how it is called, and how +// many arguments it takes. Fixed arities come before the variable one so +// that an exact match is found first by anything reading the file in +// order. +const functionList = ` +SELECT name, builtin, type, narg +FROM pragma_function_list +ORDER BY name, narg < 0, narg` + +type functionRow struct { + Name string `json:"name"` + Builtin int `json:"builtin"` + Type string `json:"type"` + NArg int `json:"narg"` +} + +// key tells one overload from another. +func (r functionRow) key() string { + return r.Name + "/" + strconv.Itoa(r.NArg) +} + +// Version reports the release the default shell is. +func Version(ctx context.Context, dir string) (string, error) { + out, err := exec.CommandContext(ctx, builds()[0].binary(dir), "--version").Output() + if err != nil { + return "", fmt.Errorf("sqlite3 --version: %w", err) + } + return "SQLite " + strings.TrimSpace(string(out)), nil +} + +// query runs a SQL statement against an in-memory database and decodes the +// shell's JSON output into rows. +func query(ctx context.Context, binary, sql string, rows any) error { + cmd := exec.CommandContext(ctx, binary, "-json", "-bail", ":memory:", sql) + out, err := cmd.Output() + if err != nil { + var exit *exec.ExitError + if errors.As(err, &exit) { + return fmt.Errorf("sqlite3: %s: %s", err, bytes.TrimSpace(exit.Stderr)) + } + return fmt.Errorf("sqlite3: %w", err) + } + // An empty result set prints nothing rather than []. + if len(bytes.TrimSpace(out)) == 0 { + return nil + } + return json.Unmarshal(out, rows) +} + +// minArgs decodes a negative argument count from pragma_function_list, +// which prints the count SQLite keeps for the function as it is: -1 for any +// number of arguments, and the two values reserved for built-ins, -3 for +// one or more and -4 for two or more — see matchQuality in the SQLite +// source. No function is counted as -2. +func minArgs(narg int) int { + if narg < -2 { + return -2 - narg + } + return 0 +} + +// functionKind maps the type the shell reports onto the seed's letters. +// The shell says 's' for a scalar function, 'a' for an aggregate and 'w' +// for one with a window implementation — but every one of SQLite's +// aggregates has one, so 'w' covers avg and count as well as row_number. +// The two are told apart by calling the function without an OVER clause, +// which only a window function refuses. +func functionKind(ctx context.Context, binary string, row functionRow) (string, error) { + switch row.Type { + case "s": + return "", nil + case "a": + return "a", nil + case "w": + window, err := isWindowFunction(ctx, binary, row) + if err != nil { + return "", err + } + if window { + return "w", nil + } + return "a", nil + } + return "", fmt.Errorf("sqlite: function %s has unknown type %q", row.Name, row.Type) +} + +// isWindowFunction reports whether the shell refuses to call a function +// without an OVER clause. Any other complaint — an aggregate objecting to +// the NULLs it is handed — means the call was accepted as an aggregate. +func isWindowFunction(ctx context.Context, binary string, row functionRow) (bool, error) { + n := row.NArg + if n < 0 { + n = minArgs(n) + } + args := strings.TrimSuffix(strings.Repeat("NULL, ", n), ", ") + cmd := exec.CommandContext(ctx, binary, ":memory:", fmt.Sprintf("SELECT %s(%s)", row.Name, args)) + var stderr bytes.Buffer + cmd.Stdout = io.Discard + cmd.Stderr = &stderr + err := cmd.Run() + if err == nil { + return false, nil + } + if strings.Contains(stderr.String(), "misuse of window function") { + return true, nil + } + var exit *exec.ExitError + if errors.As(err, &exit) { + return false, nil + } + return false, fmt.Errorf("sqlite3: %w", err) +} + +// shell is one built sqlite3 and the functions it reports. +type shell struct { + build build + binary string + rows []functionRow +} + +// readShell lists a build's functions, after checking that the shell was +// built with the options the build says — a cached shell from before the +// option lists changed would otherwise describe the wrong dialect. +func readShell(ctx context.Context, dir string, b build) (*shell, error) { + s := &shell{build: b, binary: b.binary(dir)} + if err := checkOptions(ctx, dir, b); err != nil { + return nil, err + } + if err := query(ctx, s.binary, functionList, &s.rows); err != nil { + return nil, err + } + return s, nil +} + +// checkOptions asks a build's shell whether it was compiled with every +// option any build turns on, and fails when the answers do not match the +// build's own list. +func checkOptions(ctx context.Context, dir string, b build) error { + var used []struct { + Option string `json:"option"` + Used int `json:"used"` + } + known := map[string]bool{} + for _, b := range shells() { + for _, opt := range b.flags() { + known[opt] = true + } + } + var clauses []string + for _, opt := range slices.Sorted(maps.Keys(known)) { + clauses = append(clauses, fmt.Sprintf("SELECT '%s' AS option, sqlite_compileoption_used('%s') AS used", opt, opt)) + } + if err := query(ctx, b.binary(dir), strings.Join(clauses, " UNION ALL "), &used); err != nil { + return err + } + for _, u := range used { + want := 0 + if slices.Contains(b.flags(), u.Option) { + want = 1 + } + if u.Used != want { + return fmt.Errorf("sqlite: the %s shell was not built with the options it should have been (%s is %d): remove %s and run `go run ./cmd/goldeneye install sqlite` again", b.name, u.Option, u.Used, filepath.Join(dir, b.name)) + } + } + return nil +} + +// generator accumulates the functions of every build, reading their +// signatures from the amalgamation, and remembers which names were +// reported so that the lists in signatures.go can be checked against the +// shells at the end. +type generator struct { + ctx context.Context + src *source + reported map[string]bool + // numeric holds every spelling types.jsonl gives integer and real, in + // its order, for the functions written once per spelling. + numeric map[string][]string +} + +// overload is one row of a shell's list with what was found out about it. +type overload struct { + row functionRow + kind string + sig signature +} + +// functions turns rows into records, one per overload. Every row has to be +// a function the amalgamation registers unless omitted. In the default +// build only what the library builds in counts: the rest is what the shell +// registers on top — edit, sha3, the extensions it bundles — which is not +// the dialect's business, and which a comparison with the default build has +// already removed from an option's rows. +func (g *generator) functions(s *shell, base bool) ([]dialect.Function, error) { + var overloads []overload + seen := map[string]bool{} + var missing []string + for _, row := range s.rows { + g.reported[row.Name] = true + if omitted[row.Name] || seen[row.key()] || base && row.Builtin == 0 { + continue + } + seen[row.key()] = true + sig, err := g.src.signature(row.Name) + if err != nil { + if !seen[row.Name] { + seen[row.Name] = true + missing = append(missing, err.Error()) + } + continue + } + kind, err := functionKind(g.ctx, s.binary, row) + if err != nil { + return nil, err + } + overloads = append(overloads, overload{row: row, kind: kind, sig: sig}) + } + if len(missing) > 0 { + return nil, fmt.Errorf("sqlite: %s build: %s", s.build.name, strings.Join(missing, "; ")) + } + empty, err := overNoRows(g.ctx, s.binary, overloads) + if err != nil { + return nil, err + } + funcs := make([]dialect.Function, 0, len(overloads)) + for _, o := range overloads { + isNullable := nullable[o.row.Name] + if o.kind == "a" { + isNullable = empty[o.row.key()] == "null" + } + fn := dialect.Function{ + Name: o.row.Name, + Kind: o.kind, + Args: o.sig.args(o.row.NArg), + Returns: o.sig.Returns, + Nullable: isNullable, + } + funcs = append(funcs, fn) + // A function that returns an integer for an integer and a real for + // a real is written once more per spelling of each, the way + // PostgreSQL's catalog has a sum per numeric type. The overload over + // any comes first: the analysis core picks the overload whose + // parameter is the argument's type, but the legacy compiler takes + // the first of the right arity, and keeps what it had. + if o.sig.Numeric && len(fn.Args) > 0 { + for _, typ := range []string{"integer", "real"} { + for _, spelling := range g.numeric[typ] { + typed := fn + typed.Args = append([]dialect.Arg{{Type: spelling}}, fn.Args[1:]...) + typed.Returns = typ + funcs = append(funcs, typed) + } + } + } + } + return funcs, nil +} + +// overNoRows runs every aggregate over no rows and reports the type of +// what each returns, "null" for the ones — avg, max, group_concat — that +// return NULL when there is nothing to aggregate, and not count or total. +// The probes go through one shell process, each statement labelled with +// its overload so that the answers can be told apart. +func overNoRows(ctx context.Context, binary string, overloads []overload) (map[string]string, error) { + var script strings.Builder + for _, o := range overloads { + if o.kind != "a" { + continue + } + n := o.row.NArg + if n < 0 { + n = minArgs(n) + } + args := strings.TrimSuffix(strings.Repeat("x, ", n), ", ") + fmt.Fprintf(&script, "SELECT '%s', typeof(%s(%s)) FROM (SELECT NULL AS x) WHERE 0;\n", o.row.key(), o.row.Name, args) + } + results := map[string]string{} + if script.Len() == 0 { + return results, nil + } + cmd := exec.CommandContext(ctx, binary, "-list", ":memory:", script.String()) + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + var exit *exec.ExitError + if !errors.As(err, &exit) { + return nil, fmt.Errorf("sqlite3: %w", err) + } + } + for _, line := range strings.Split(strings.TrimSpace(stdout.String()), "\n") { + key, typ, ok := strings.Cut(line, "|") + if ok { + results[key] = typ + } + } + for _, o := range overloads { + if o.kind == "a" { + if _, ok := results[o.row.key()]; !ok { + return nil, fmt.Errorf("sqlite: cannot run %s over no rows: %s", o.row.Name, strings.TrimSpace(stderr.String())) + } + } + } + return results, nil +} + +// added returns the rows of an option's shell that the default shell does +// not have: what the option adds. +func added(opt, base *shell) *shell { + have := map[string]bool{} + for _, row := range base.rows { + have[row.key()] = true + } + diff := &shell{build: opt.build, binary: opt.binary} + for _, row := range opt.rows { + if !have[row.key()] { + diff.rows = append(diff.rows, row) + } + } + return diff +} + +// Generate reads the dialect from the shells under dir and the +// amalgamation they were built from. +func Generate(ctx context.Context, dir string) (dialect.Files, error) { + src, err := readSource(filepath.Join(dir, "src", "sqlite3.c")) + if err != nil { + return nil, err + } + g := &generator{ctx: ctx, src: src, reported: map[string]bool{}, numeric: map[string][]string{}} + dialectDir, err := dialect.Dir(Engine) + if err != nil { + return nil, err + } + types, err := dialect.ReadTypes(dialectDir) + if err != nil { + return nil, err + } + for _, t := range types { + if t.Name == "integer" || t.Name == "real" { + g.numeric[t.Name] = append([]string{t.Name}, t.Aliases...) + } + } + all := builds() + base, err := readShell(ctx, dir, all[0]) + if err != nil { + return nil, err + } + funcs, err := g.functions(base, true) + if err != nil { + return nil, err + } + files := dialect.Files{} + if files[dialect.FunctionsFile], err = dialect.JSONL(funcs); err != nil { + return nil, err + } + for _, b := range all[1:] { + s, err := readShell(ctx, dir, b) + if err != nil { + return nil, err + } + funcs, err := g.functions(added(s, base), false) + if err != nil { + return nil, err + } + if len(funcs) == 0 { + return nil, fmt.Errorf("sqlite: %s adds no functions over the default build; drop it from the extensions in install.go", strings.Join(b.options, " ")) + } + if files[path.Join(dialect.ExtensionsDir, b.name, dialect.FunctionsFile)], err = dialect.JSONL(funcs); err != nil { + return nil, err + } + } + var stale []string + for _, list := range []map[string]bool{omitted, nullable, realResults} { + for name := range list { + if !g.reported[name] { + stale = append(stale, name) + } + } + } + if len(stale) > 0 { + sort.Strings(stale) + return nil, fmt.Errorf("sqlite: signatures.go lists function(s) no shell reports: %s", strings.Join(stale, ", ")) + } + return files, nil +} diff --git a/internal/goldeneye/sqlite/sqlite_test.go b/internal/goldeneye/sqlite/sqlite_test.go new file mode 100644 index 0000000000..8327090d7e --- /dev/null +++ b/internal/goldeneye/sqlite/sqlite_test.go @@ -0,0 +1,66 @@ +package sqlite + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// TestDialect verifies the committed SQLite dialect against what the pinned +// sqlite3 shell reports. It skips unless the shell is installed. +func TestDialect(t *testing.T) { + binary, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, binary) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, binary) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Engine) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} + +// TestAnalyzeCases verifies every SQLite analyze case under +// internal/endtoend/testdata against what SQLite reports. It skips unless +// the shells are installed. +func TestAnalyzeCases(t *testing.T) { + dir, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Engine) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no sqlite analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), dir, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what SQLite reports (-committed +sqlite):\n%s", c.Output, diff) + } + }) + } +} diff --git a/internal/inflection/singular.go b/internal/inflection/singular.go index edac927603..64e042a6ab 100644 --- a/internal/inflection/singular.go +++ b/internal/inflection/singular.go @@ -43,5 +43,10 @@ func Singular(s SingularParams) string { if strings.ToLower(s.Name) == "waves" { return "wave" } + + if strings.ToLower(s.Name) == "metadata" { + return "metadata" + } + return upstream.Singular(s.Name) } diff --git a/internal/info/facts.go b/internal/info/facts.go index e150dae4d3..934814e365 100644 --- a/internal/info/facts.go +++ b/internal/info/facts.go @@ -2,4 +2,4 @@ package info // When no version is set, return the next bug fix version // after the most recent tag -const Version = "v1.22.0" +const Version = "v1.31.1" diff --git a/internal/metadata/meta.go b/internal/metadata/meta.go index 4176da1e2b..76ee992a7a 100644 --- a/internal/metadata/meta.go +++ b/internal/metadata/meta.go @@ -1,15 +1,29 @@ package metadata import ( + "bufio" "fmt" + "github.com/sqlc-dev/sqlc/internal/constants" "strings" "unicode" + + "github.com/sqlc-dev/sqlc/internal/source" ) -type CommentSyntax struct { - Dash bool - Hash bool - SlashStar bool +type CommentSyntax source.CommentSyntax + +type Metadata struct { + Name string + Cmd string + Comments []string + Params map[string]string + Flags map[string]bool + + // RuleSkiplist contains the names of rules to disable vetting for. + // If the map is empty, but the disable vet flag is specified, then all rules are ignored. + RuleSkiplist map[string]struct{} + + Filename string } const ( @@ -45,7 +59,7 @@ func validateQueryName(name string) error { } func ParseQueryNameAndType(t string, commentStyle CommentSyntax) (string, string, error) { - for _, line := range strings.Split(t, "\n") { + for line := range strings.SplitSeq(t, "\n") { var prefix string if strings.HasPrefix(line, "--") { if !commentStyle.Dash { @@ -83,7 +97,7 @@ func ParseQueryNameAndType(t string, commentStyle CommentSyntax) (string, string if prefix == "/*" { part = part[:len(part)-1] // removes the trailing "*/" element } - if len(part) == 2 { + if len(part) == 3 { return "", "", fmt.Errorf("missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: %s", line) } if len(part) != 4 { @@ -104,19 +118,55 @@ func ParseQueryNameAndType(t string, commentStyle CommentSyntax) (string, string return "", "", nil } -func ParseQueryFlags(comments []string) (map[string]bool, error) { +// ParseCommentFlags processes the comments provided with queries to determine the metadata params, flags and rules to skip. +// All flags in query comments are prefixed with `@`, e.g. @param, @@sqlc-vet-disable. +func ParseCommentFlags(comments []string) (map[string]string, map[string]bool, map[string]struct{}, error) { + params := make(map[string]string) flags := make(map[string]bool) + ruleSkiplist := make(map[string]struct{}) + for _, line := range comments { - cleanLine := strings.TrimPrefix(line, "--") - cleanLine = strings.TrimPrefix(cleanLine, "/*") - cleanLine = strings.TrimPrefix(cleanLine, "#") - cleanLine = strings.TrimSuffix(cleanLine, "*/") - cleanLine = strings.TrimSpace(cleanLine) - if strings.HasPrefix(cleanLine, "@") { - flagName := strings.SplitN(cleanLine, " ", 2)[0] - flags[flagName] = true + s := bufio.NewScanner(strings.NewReader(line)) + s.Split(bufio.ScanWords) + + s.Scan() + token := s.Text() + + if !strings.HasPrefix(token, "@") { continue } + + switch token { + case constants.QueryFlagParam: + s.Scan() + name := s.Text() + var rest []string + for s.Scan() { + paramToken := s.Text() + rest = append(rest, paramToken) + } + params[name] = strings.Join(rest, " ") + + case constants.QueryFlagSqlcVetDisable: + flags[token] = true + + // Vet rules can all be disabled in the same line or split across lines .i.e. + // /* @sqlc-vet-disable sqlc/db-prepare delete-without-where */ + // is equivalent to: + // /* @sqlc-vet-disable sqlc/db-prepare */ + // /* @sqlc-vet-disable delete-without-where */ + for s.Scan() { + ruleSkiplist[s.Text()] = struct{}{} + } + + default: + flags[token] = true + } + + if s.Err() != nil { + return params, flags, ruleSkiplist, s.Err() + } } - return flags, nil + + return params, flags, ruleSkiplist, nil } diff --git a/internal/metadata/meta_test.go b/internal/metadata/meta_test.go index cbfcb6fba6..e9ef54586e 100644 --- a/internal/metadata/meta_test.go +++ b/internal/metadata/meta_test.go @@ -1,6 +1,8 @@ package metadata -import "testing" +import ( + "testing" +) func TestParseQueryNameAndType(t *testing.T) { @@ -32,34 +34,149 @@ func TestParseQueryNameAndType(t *testing.T) { } } - query := `-- name: CreateFoo :one` - queryName, queryType, err := ParseQueryNameAndType(query, CommentSyntax{Dash: true}) - if err != nil { - t.Errorf("expected valid metadata: %q", query) - } - if queryName != "CreateFoo" { - t.Errorf("incorrect queryName parsed: %q", query) - } - if queryType != CmdOne { - t.Errorf("incorrect queryType parsed: %q", query) + for query, cs := range map[string]CommentSyntax{ + `-- name: CreateFoo :one`: {Dash: true}, + `# name: CreateFoo :one`: {Hash: true}, + `/* name: CreateFoo :one */`: {SlashStar: true}, + } { + queryName, queryCmd, err := ParseQueryNameAndType(query, cs) + if err != nil { + t.Errorf("expected valid metadata: %q", query) + } + if queryName != "CreateFoo" { + t.Errorf("incorrect queryName parsed: (%q) %q", queryName, query) + } + if queryCmd != CmdOne { + t.Errorf("incorrect queryCmd parsed: (%q) %q", queryCmd, query) + } } } +func TestParseQueryParams(t *testing.T) { + for _, comments := range [][]string{ + { + " name: CreateFoo :one", + " @param foo_id UUID", + }, + { + " name: CreateFoo :one ", + " @param foo_id UUID ", + }, + { + " name: CreateFoo :one", + "@param foo_id UUID", + " invalid", + }, + { + " name: CreateFoo :one", + " @invalid", + " @param foo_id UUID", + }, + { + " name: GetFoos :many ", + " @param foo_id UUID ", + " @param @invalid UUID ", + }, + } { + params, _, _, err := ParseCommentFlags(comments) + if err != nil { + t.Errorf("expected comments to parse, got err: %s", err) + } + + pt, ok := params["foo_id"] + if !ok { + t.Errorf("expected param not found") + } + + if pt != "UUID" { + t.Error("unexpected param metadata:", pt) + } + + _, ok = params["invalid"] + if ok { + t.Errorf("unexpected param found") + } + } +} + func TestParseQueryFlags(t *testing.T) { for _, comments := range [][]string{ { - "-- name: CreateFoo :one", - "-- @flag-foo", + " name: CreateFoo :one", + " @flag-foo", + }, + { + " name: CreateFoo :one ", + "@flag-foo ", + }, + { + " name: CreateFoo :one", + " @flag-foo @flag-bar", + }, + { + " name: GetFoos :many", + " @param @flag-bar UUID", + " @flag-foo", + }, + { + " name: GetFoos :many", + " @flag-foo", + " @param @flag-bar UUID", }, } { - flags, err := ParseQueryFlags(comments) + _, flags, _, err := ParseCommentFlags(comments) if err != nil { - t.Errorf("expected query flags to parse, got error: %s", err) + t.Errorf("expected comments to parse, got err: %s", err) } if !flags["@flag-foo"] { t.Errorf("expected flag not found") } + + if flags["@flag-bar"] { + t.Errorf("unexpected flag found") + } } -} \ No newline at end of file +} + +func TestParseQueryRuleSkiplist(t *testing.T) { + for _, comments := range [][]string{ + { + " name: CreateFoo :one", + " @sqlc-vet-disable sqlc/db-prepare delete-without-where ", + }, + { + " name: CreateFoo :one ", + " @sqlc-vet-disable sqlc/db-prepare ", + " @sqlc-vet-disable delete-without-where ", + }, + { + " name: CreateFoo :one", + " @sqlc-vet-disable sqlc/db-prepare ", + " update-without where", + " @sqlc-vet-disable delete-without-where ", + }, + } { + _, flags, ruleSkiplist, err := ParseCommentFlags(comments) + if err != nil { + t.Errorf("expected comments to parse, got err: %s", err) + } + + if !flags["@sqlc-vet-disable"] { + t.Errorf("expected @sqlc-vet-disable flag not found") + } + + if _, ok := ruleSkiplist["sqlc/db-prepare"]; !ok { + t.Errorf("expected rule not found in skiplist") + } + + if _, ok := ruleSkiplist["delete-without-where"]; !ok { + t.Errorf("expected rule not found in skiplist") + } + + if _, ok := ruleSkiplist["update-without-where"]; ok { + t.Errorf("unexpected rule found in skiplist") + } + } +} diff --git a/internal/migrations/migrations.go b/internal/migrations/migrations.go index ac0e8b3d9a..bd5da61ed5 100644 --- a/internal/migrations/migrations.go +++ b/internal/migrations/migrations.go @@ -2,9 +2,16 @@ package migrations import ( "bufio" + "regexp" "strings" ) +// psqlMetaCommand matches a psql meta-command (a line that begins with a +// backslash followed by a command name). pg_dump emits these starting with +// PostgreSQL 17.6 / 16.10 / 15.14 / 14.19 / 13.22 (e.g. `\restrict KEY` and +// `\unrestrict KEY`), and sqlc's SQL parsers cannot handle them. +var psqlMetaCommand = regexp.MustCompile(`^\\[A-Za-z!?;][^\n]*$`) + // Remove all lines after a rollback comment. // // goose: -- +goose Down @@ -15,16 +22,17 @@ func RemoveRollbackStatements(contents string) string { s := bufio.NewScanner(strings.NewReader(contents)) var lines []string for s.Scan() { - if strings.HasPrefix(s.Text(), "-- +goose Down") { + statement := strings.ToLower(s.Text()) + if strings.HasPrefix(statement, "-- +goose down") { break } - if strings.HasPrefix(s.Text(), "-- +migrate Down") { + if strings.HasPrefix(statement, "-- +migrate down") { break } - if strings.HasPrefix(s.Text(), "---- create above / drop below ----") { + if strings.HasPrefix(statement, "---- create above / drop below ----") { break } - if strings.HasPrefix(s.Text(), "-- migrate:down") { + if strings.HasPrefix(statement, "-- migrate:down") { break } lines = append(lines, s.Text()) @@ -32,6 +40,22 @@ func RemoveRollbackStatements(contents string) string { return strings.Join(lines, "\n") } +// RemovePsqlMetaCommands strips psql meta-command lines (e.g. `\restrict KEY`, +// `\unrestrict KEY`, `\connect foo`) from SQL input. These are emitted by +// pg_dump but are not valid SQL, so they must be removed before parsing. +func RemovePsqlMetaCommands(contents string) string { + s := bufio.NewScanner(strings.NewReader(contents)) + var lines []string + for s.Scan() { + line := s.Text() + if psqlMetaCommand.MatchString(line) { + continue + } + lines = append(lines, line) + } + return strings.Join(lines, "\n") +} + func IsDown(filename string) bool { // Remove golang-migrate rollback files. return strings.HasSuffix(filename, ".down.sql") diff --git a/internal/migrations/migrations_test.go b/internal/migrations/migrations_test.go index d987992582..1217674fdc 100644 --- a/internal/migrations/migrations_test.go +++ b/internal/migrations/migrations_test.go @@ -56,6 +56,17 @@ const outputDbmate = ` -- migrate:up CREATE TABLE foo (bar int);` +const inputPsqlMeta = `\restrict auwherpfqaiuwrhgp + +CREATE TABLE foo (id int); + +\unrestrict auwherpfqaiuwrhgp +` + +const outputPsqlMeta = ` +CREATE TABLE foo (id int); +` + func TestRemoveRollback(t *testing.T) { if diff := cmp.Diff(outputGoose, RemoveRollbackStatements(inputGoose)); diff != "" { t.Errorf("goose migration mismatch:\n%s", diff) @@ -71,6 +82,12 @@ func TestRemoveRollback(t *testing.T) { } } +func TestRemovePsqlMetaCommands(t *testing.T) { + if diff := cmp.Diff(outputPsqlMeta, RemovePsqlMetaCommands(inputPsqlMeta)); diff != "" { + t.Errorf("psql meta-command mismatch:\n%s", diff) + } +} + func TestRemoveGolangMigrateRollback(t *testing.T) { filenames := map[string]bool{ // make sure we let through golang-migrate files that aren't rollbacks diff --git a/internal/opts/debug.go b/internal/opts/debug.go deleted file mode 100644 index 94cda87863..0000000000 --- a/internal/opts/debug.go +++ /dev/null @@ -1,63 +0,0 @@ -package opts - -import ( - "os" - "strings" -) - -// The SQLCDEBUG variable controls debugging variables within the runtime. It -// is a comma-separated list of name=val pairs setting these named variables: -// -// dumpast: setting dumpast=1 will print the AST of every SQL statement -// dumpcatalog: setting dumpcatalog=1 will print the parsed database schema -// trace: setting trace= will output a trace -// processplugins: setting processplugins=0 will disable process-based plugins -// dumpvetenv: setting dumpvetenv=1 will print the variables available to -// a vet rule during evaluation -// dumpexplain: setting dumpexplain=1 will print the JSON-formatted output -// from executing EXPLAIN ... on a query during vet rule evaluation - -type Debug struct { - DumpAST bool - DumpCatalog bool - Trace string - ProcessPlugins bool - DumpVetEnv bool - DumpExplain bool -} - -func DebugFromEnv() Debug { - return DebugFromString(os.Getenv("SQLCDEBUG")) -} - -func DebugFromString(val string) Debug { - d := Debug{ - ProcessPlugins: true, - } - if val == "" { - return d - } - for _, pair := range strings.Split(val, ",") { - pair = strings.TrimSpace(pair) - switch { - case pair == "dumpast=1": - d.DumpAST = true - case pair == "dumpcatalog=1": - d.DumpCatalog = true - case strings.HasPrefix(pair, "trace="): - traceName := strings.TrimPrefix(pair, "trace=") - if traceName == "1" { - d.Trace = "trace.out" - } else { - d.Trace = traceName - } - case pair == "processplugins=0": - d.ProcessPlugins = false - case pair == "dumpvetenv=1": - d.DumpVetEnv = true - case pair == "dumpexplain=1": - d.DumpExplain = true - } - } - return d -} diff --git a/internal/opts/experiment.go b/internal/opts/experiment.go new file mode 100644 index 0000000000..8d4b1c1ea0 --- /dev/null +++ b/internal/opts/experiment.go @@ -0,0 +1,105 @@ +package opts + +import ( + "os" + "strings" +) + +// The SQLCEXPERIMENT variable controls experimental features within sqlc. It +// is a comma-separated list of experiment names. Experiment names can be +// prefixed with "no" to explicitly disable them. +// +// This is modeled after Go's GOEXPERIMENT environment variable. For more +// information, see https://pkg.go.dev/internal/goexperiment +// +// Available experiments: +// +// coreanalyzer - routes generate through the core catalog and analyzer +// +// Example usage: +// +// SQLCEXPERIMENT=foo,bar # enable foo and bar experiments +// SQLCEXPERIMENT=nofoo # explicitly disable foo experiment +// SQLCEXPERIMENT=foo,nobar # enable foo, disable bar + +// Experiment holds the state of all experimental features. +// Add new experiments as boolean fields to this struct. +type Experiment struct { + // CoreAnalyzer routes generate through the core catalog and analyzer + // instead of each engine's own analysis path. + CoreAnalyzer bool +} + +// ExperimentFromEnv returns an Experiment initialized from the SQLCEXPERIMENT +// environment variable. +func ExperimentFromEnv() Experiment { + return ExperimentFromString(os.Getenv("SQLCEXPERIMENT")) +} + +// ExperimentFromString parses a comma-separated list of experiment names +// and returns an Experiment with the appropriate flags set. +// +// Experiment names can be prefixed with "no" to explicitly disable them. +// Unknown experiment names are silently ignored. +func ExperimentFromString(val string) Experiment { + e := Experiment{} + if val == "" { + return e + } + + for name := range strings.SplitSeq(val, ",") { + name = strings.TrimSpace(name) + if name == "" { + continue + } + + // Check if this is a negation (noFoo) + enabled := true + if strings.HasPrefix(strings.ToLower(name), "no") && len(name) > 2 { + // Could be a negation, check if the rest is a valid experiment + possibleExp := name[2:] + if isKnownExperiment(possibleExp) { + name = possibleExp + enabled = false + } + // If not a known experiment, treat "no..." as a potential experiment name itself + } + + setExperiment(&e, name, enabled) + } + + return e +} + +// isKnownExperiment returns true if the given name (case-insensitive) is a +// known experiment. +func isKnownExperiment(name string) bool { + switch strings.ToLower(name) { + case "coreanalyzer": + return true + default: + return false + } +} + +// setExperiment sets the experiment flag with the given name to the given value. +func setExperiment(e *Experiment, name string, enabled bool) { + switch strings.ToLower(name) { + case "coreanalyzer": + e.CoreAnalyzer = enabled + } +} + +// Enabled returns a slice of all enabled experiment names. +func (e Experiment) Enabled() []string { + var enabled []string + if e.CoreAnalyzer { + enabled = append(enabled, "coreanalyzer") + } + return enabled +} + +// String returns a comma-separated list of enabled experiments. +func (e Experiment) String() string { + return strings.Join(e.Enabled(), ",") +} diff --git a/internal/opts/experiment_test.go b/internal/opts/experiment_test.go new file mode 100644 index 0000000000..b64204b4f7 --- /dev/null +++ b/internal/opts/experiment_test.go @@ -0,0 +1,155 @@ +package opts + +import "testing" + +func TestExperimentFromString(t *testing.T) { + tests := []struct { + name string + input string + want Experiment + }{ + { + name: "empty string", + input: "", + want: Experiment{}, + }, + { + name: "whitespace only", + input: " ", + want: Experiment{}, + }, + { + name: "unknown experiment", + input: "unknownexperiment", + want: Experiment{}, + }, + { + name: "multiple unknown experiments", + input: "foo,bar,baz", + want: Experiment{}, + }, + { + name: "unknown with no prefix", + input: "nounknown", + want: Experiment{}, + }, + { + name: "whitespace around experiments", + input: " foo , bar , baz ", + want: Experiment{}, + }, + { + name: "empty items in list", + input: "foo,,bar", + want: Experiment{}, + }, + { + name: "enable coreanalyzer", + input: "coreanalyzer", + want: Experiment{CoreAnalyzer: true}, + }, + { + name: "disable coreanalyzer", + input: "nocoreanalyzer", + want: Experiment{CoreAnalyzer: false}, + }, + { + name: "enable then disable coreanalyzer", + input: "coreanalyzer,nocoreanalyzer", + want: Experiment{CoreAnalyzer: false}, + }, + { + name: "coreanalyzer case insensitive", + input: "CoreAnalyzer", + want: Experiment{CoreAnalyzer: true}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := ExperimentFromString(tt.input) + if got != tt.want { + t.Errorf("ExperimentFromString(%q) = %+v, want %+v", tt.input, got, tt.want) + } + }) + } +} + +func TestExperimentEnabled(t *testing.T) { + tests := []struct { + name string + exp Experiment + want []string + }{ + { + name: "no experiments enabled", + exp: Experiment{}, + want: nil, + }, + { + name: "coreanalyzer enabled", + exp: Experiment{CoreAnalyzer: true}, + want: []string{"coreanalyzer"}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := tt.exp.Enabled() + if len(got) != len(tt.want) { + t.Errorf("Experiment.Enabled() = %v, want %v", got, tt.want) + return + } + for i := range got { + if got[i] != tt.want[i] { + t.Errorf("Experiment.Enabled()[%d] = %q, want %q", i, got[i], tt.want[i]) + } + } + }) + } +} + +func TestExperimentString(t *testing.T) { + exp := Experiment{} + if got := exp.String(); got != "" { + t.Errorf("Experiment.String() = %q, want %q", got, "") + } +} + +func TestIsKnownExperiment(t *testing.T) { + tests := []struct { + name string + input string + want bool + }{ + { + name: "unknown experiment", + input: "unknown", + want: false, + }, + { + name: "empty string", + input: "", + want: false, + }, + { + name: "coreanalyzer lowercase", + input: "coreanalyzer", + want: true, + }, + { + name: "coreanalyzer mixed case", + input: "CoreAnalyzer", + want: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := isKnownExperiment(tt.input) + if got != tt.want { + t.Errorf("isKnownExperiment(%q) = %v, want %v", tt.input, got, tt.want) + } + }) + } +} diff --git a/internal/opts/parser.go b/internal/opts/parser.go index d6fb399552..69112dcd95 100644 --- a/internal/opts/parser.go +++ b/internal/opts/parser.go @@ -1,5 +1,5 @@ package opts type Parser struct { - Debug Debug + Experiment Experiment } diff --git a/internal/pattern/match.go b/internal/pattern/match.go index 1cf8afb1e4..c72663d463 100644 --- a/internal/pattern/match.go +++ b/internal/pattern/match.go @@ -3,6 +3,7 @@ package pattern import ( "fmt" "regexp" + "strings" "sync" ) @@ -42,16 +43,16 @@ func MatchCompile(pattern string) (*Match, error) { } func matchCompile(pattern string) (match *Match, err error) { - regex := "" + var regex strings.Builder escaped := false arr := []byte(pattern) - for i := 0; i < len(arr); i++ { + for i := range arr { if escaped { escaped = false switch arr[i] { case '*', '?', '\\': - regex += "\\" + string(arr[i]) + regex.WriteString("\\" + string(arr[i])) default: return nil, fmt.Errorf("Invalid escaped character '%c'", arr[i]) } @@ -60,13 +61,13 @@ func matchCompile(pattern string) (match *Match, err error) { case '\\': escaped = true case '*': - regex += ".*" + regex.WriteString(".*") case '?': - regex += "." + regex.WriteString(".") case '.', '(', ')', '+', '|', '^', '$', '[', ']', '{', '}': - regex += "\\" + string(arr[i]) + regex.WriteString("\\" + string(arr[i])) default: - regex += string(arr[i]) + regex.WriteString(string(arr[i])) } } } @@ -77,7 +78,7 @@ func matchCompile(pattern string) (match *Match, err error) { var r *regexp.Regexp - if r, err = regexp.Compile("^" + regex + "$"); err != nil { + if r, err = regexp.Compile("^" + regex.String() + "$"); err != nil { return nil, err } diff --git a/internal/pgx/poolcache/poolcache.go b/internal/pgx/poolcache/poolcache.go new file mode 100644 index 0000000000..3fce3cb131 --- /dev/null +++ b/internal/pgx/poolcache/poolcache.go @@ -0,0 +1,61 @@ +package poolcache + +import ( + "context" + "fmt" + "sync" + + "github.com/jackc/pgx/v5/pgxpool" +) + +type Cache struct { + lock sync.RWMutex + closed bool + pools map[string]*pgxpool.Pool +} + +func New() *Cache { + return &Cache{ + pools: map[string]*pgxpool.Pool{}, + } +} + +func (c *Cache) Open(ctx context.Context, uri string) (*pgxpool.Pool, error) { + if c.closed { + return nil, fmt.Errorf("poolcache is closed") + } + + c.lock.RLock() + existing, found := c.pools[uri] + c.lock.RUnlock() + + if found { + return existing, nil + } + + pool, err := pgxpool.New(ctx, uri) + if err != nil { + return nil, err + } + + c.lock.Lock() + c.pools[uri] = pool + c.lock.Unlock() + + return pool, nil +} + +func (c *Cache) Close() error { + c.lock.Lock() + defer c.lock.Unlock() + + var closeErr error + for _, pool := range c.pools { + pool.Close() + } + + c.closed = true + clear(c.pools) + + return closeErr +} diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 7b3347c6e1..b740672f1c 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -75,211 +75,22 @@ func (x *File) GetContents() []byte { return nil } -type Override struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // name of the type to use, e.g. `github.com/segmentio/ksuid.KSUID` or `mymodule.Type` - CodeType string `protobuf:"bytes,1,opt,name=code_type,proto3" json:"code_type,omitempty"` - // name of the type to use, e.g. `text` - DbType string `protobuf:"bytes,3,opt,name=db_type,proto3" json:"db_type,omitempty"` - // True if the override should apply to a nullable database type - Nullable bool `protobuf:"varint,5,opt,name=nullable,proto3" json:"nullable,omitempty"` - // fully qualified name of the column, e.g. `accounts.id` - Column string `protobuf:"bytes,6,opt,name=column,proto3" json:"column,omitempty"` - Table *Identifier `protobuf:"bytes,7,opt,name=table,proto3" json:"table,omitempty"` - ColumnName string `protobuf:"bytes,8,opt,name=column_name,proto3" json:"column_name,omitempty"` - GoType *ParsedGoType `protobuf:"bytes,10,opt,name=go_type,json=goType,proto3" json:"go_type,omitempty"` - // True if the override should apply to a unsigned database type - Unsigned bool `protobuf:"varint,11,opt,name=unsigned,proto3" json:"unsigned,omitempty"` -} - -func (x *Override) Reset() { - *x = Override{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Override) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Override) ProtoMessage() {} - -func (x *Override) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Override.ProtoReflect.Descriptor instead. -func (*Override) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{1} -} - -func (x *Override) GetCodeType() string { - if x != nil { - return x.CodeType - } - return "" -} - -func (x *Override) GetDbType() string { - if x != nil { - return x.DbType - } - return "" -} - -func (x *Override) GetNullable() bool { - if x != nil { - return x.Nullable - } - return false -} - -func (x *Override) GetColumn() string { - if x != nil { - return x.Column - } - return "" -} - -func (x *Override) GetTable() *Identifier { - if x != nil { - return x.Table - } - return nil -} - -func (x *Override) GetColumnName() string { - if x != nil { - return x.ColumnName - } - return "" -} - -func (x *Override) GetGoType() *ParsedGoType { - if x != nil { - return x.GoType - } - return nil -} - -func (x *Override) GetUnsigned() bool { - if x != nil { - return x.Unsigned - } - return false -} - -type ParsedGoType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ImportPath string `protobuf:"bytes,1,opt,name=import_path,json=importPath,proto3" json:"import_path,omitempty"` - Package string `protobuf:"bytes,2,opt,name=package,proto3" json:"package,omitempty"` - TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` - BasicType bool `protobuf:"varint,4,opt,name=basic_type,json=basicType,proto3" json:"basic_type,omitempty"` - StructTags map[string]string `protobuf:"bytes,5,rep,name=struct_tags,json=structTags,proto3" json:"struct_tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *ParsedGoType) Reset() { - *x = ParsedGoType{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParsedGoType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParsedGoType) ProtoMessage() {} - -func (x *ParsedGoType) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParsedGoType.ProtoReflect.Descriptor instead. -func (*ParsedGoType) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{2} -} - -func (x *ParsedGoType) GetImportPath() string { - if x != nil { - return x.ImportPath - } - return "" -} - -func (x *ParsedGoType) GetPackage() string { - if x != nil { - return x.Package - } - return "" -} - -func (x *ParsedGoType) GetTypeName() string { - if x != nil { - return x.TypeName - } - return "" -} - -func (x *ParsedGoType) GetBasicType() bool { - if x != nil { - return x.BasicType - } - return false -} - -func (x *ParsedGoType) GetStructTags() map[string]string { - if x != nil { - return x.StructTags - } - return nil -} - type Settings struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` - Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` - Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` - Rename map[string]string `protobuf:"bytes,5,rep,name=rename,proto3" json:"rename,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Overrides []*Override `protobuf:"bytes,6,rep,name=overrides,proto3" json:"overrides,omitempty"` - Codegen *Codegen `protobuf:"bytes,12,opt,name=codegen,proto3" json:"codegen,omitempty"` + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` + Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` + Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` + Codegen *Codegen `protobuf:"bytes,12,opt,name=codegen,proto3" json:"codegen,omitempty"` } func (x *Settings) Reset() { *x = Settings{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[3] + mi := &file_plugin_codegen_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -292,7 +103,7 @@ func (x *Settings) String() string { func (*Settings) ProtoMessage() {} func (x *Settings) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[3] + mi := &file_plugin_codegen_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -305,7 +116,7 @@ func (x *Settings) ProtoReflect() protoreflect.Message { // Deprecated: Use Settings.ProtoReflect.Descriptor instead. func (*Settings) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{3} + return file_plugin_codegen_proto_rawDescGZIP(), []int{1} } func (x *Settings) GetVersion() string { @@ -336,20 +147,6 @@ func (x *Settings) GetQueries() []string { return nil } -func (x *Settings) GetRename() map[string]string { - if x != nil { - return x.Rename - } - return nil -} - -func (x *Settings) GetOverrides() []*Override { - if x != nil { - return x.Overrides - } - return nil -} - func (x *Settings) GetCodegen() *Codegen { if x != nil { return x.Codegen @@ -373,7 +170,7 @@ type Codegen struct { func (x *Codegen) Reset() { *x = Codegen{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[4] + mi := &file_plugin_codegen_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -386,7 +183,7 @@ func (x *Codegen) String() string { func (*Codegen) ProtoMessage() {} func (x *Codegen) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[4] + mi := &file_plugin_codegen_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -399,7 +196,7 @@ func (x *Codegen) ProtoReflect() protoreflect.Message { // Deprecated: Use Codegen.ProtoReflect.Descriptor instead. func (*Codegen) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{4} + return file_plugin_codegen_proto_rawDescGZIP(), []int{2} } func (x *Codegen) GetOut() string { @@ -458,7 +255,7 @@ type Catalog struct { func (x *Catalog) Reset() { *x = Catalog{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[5] + mi := &file_plugin_codegen_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -471,7 +268,7 @@ func (x *Catalog) String() string { func (*Catalog) ProtoMessage() {} func (x *Catalog) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[5] + mi := &file_plugin_codegen_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -484,7 +281,7 @@ func (x *Catalog) ProtoReflect() protoreflect.Message { // Deprecated: Use Catalog.ProtoReflect.Descriptor instead. func (*Catalog) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{5} + return file_plugin_codegen_proto_rawDescGZIP(), []int{3} } func (x *Catalog) GetComment() string { @@ -530,7 +327,7 @@ type Schema struct { func (x *Schema) Reset() { *x = Schema{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -543,7 +340,7 @@ func (x *Schema) String() string { func (*Schema) ProtoMessage() {} func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -556,7 +353,7 @@ func (x *Schema) ProtoReflect() protoreflect.Message { // Deprecated: Use Schema.ProtoReflect.Descriptor instead. func (*Schema) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{6} + return file_plugin_codegen_proto_rawDescGZIP(), []int{4} } func (x *Schema) GetComment() string { @@ -606,7 +403,7 @@ type CompositeType struct { func (x *CompositeType) Reset() { *x = CompositeType{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -619,7 +416,7 @@ func (x *CompositeType) String() string { func (*CompositeType) ProtoMessage() {} func (x *CompositeType) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -632,7 +429,7 @@ func (x *CompositeType) ProtoReflect() protoreflect.Message { // Deprecated: Use CompositeType.ProtoReflect.Descriptor instead. func (*CompositeType) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{7} + return file_plugin_codegen_proto_rawDescGZIP(), []int{5} } func (x *CompositeType) GetName() string { @@ -662,7 +459,7 @@ type Enum struct { func (x *Enum) Reset() { *x = Enum{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[8] + mi := &file_plugin_codegen_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -675,7 +472,7 @@ func (x *Enum) String() string { func (*Enum) ProtoMessage() {} func (x *Enum) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[8] + mi := &file_plugin_codegen_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -688,7 +485,7 @@ func (x *Enum) ProtoReflect() protoreflect.Message { // Deprecated: Use Enum.ProtoReflect.Descriptor instead. func (*Enum) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{8} + return file_plugin_codegen_proto_rawDescGZIP(), []int{6} } func (x *Enum) GetName() string { @@ -725,7 +522,7 @@ type Table struct { func (x *Table) Reset() { *x = Table{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[9] + mi := &file_plugin_codegen_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -738,7 +535,7 @@ func (x *Table) String() string { func (*Table) ProtoMessage() {} func (x *Table) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[9] + mi := &file_plugin_codegen_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -751,7 +548,7 @@ func (x *Table) ProtoReflect() protoreflect.Message { // Deprecated: Use Table.ProtoReflect.Descriptor instead. func (*Table) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{9} + return file_plugin_codegen_proto_rawDescGZIP(), []int{7} } func (x *Table) GetRel() *Identifier { @@ -788,7 +585,7 @@ type Identifier struct { func (x *Identifier) Reset() { *x = Identifier{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -801,7 +598,7 @@ func (x *Identifier) String() string { func (*Identifier) ProtoMessage() {} func (x *Identifier) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -814,7 +611,7 @@ func (x *Identifier) ProtoReflect() protoreflect.Message { // Deprecated: Use Identifier.ProtoReflect.Descriptor instead. func (*Identifier) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{10} + return file_plugin_codegen_proto_rawDescGZIP(), []int{8} } func (x *Identifier) GetCatalog() string { @@ -838,6 +635,211 @@ func (x *Identifier) GetName() string { return "" } +// TypeExpr is a column's type as an expression: its name, whether a value +// of it may be null, and its arguments — the (10, 2) of decimal(10, 2), the +// element of array(integer), the fields of struct(a: integer). It is set +// only when the analysis core typed the column; the flat description in +// Column (type, not_null, is_array, array_dims, length, unsigned) is set +// either way. +type TypeExpr struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Nullable bool `protobuf:"varint,2,opt,name=nullable,proto3" json:"nullable,omitempty"` + Args []*TypeArg `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"` +} + +func (x *TypeExpr) Reset() { + *x = TypeExpr{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TypeExpr) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TypeExpr) ProtoMessage() {} + +func (x *TypeExpr) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TypeExpr.ProtoReflect.Descriptor instead. +func (*TypeExpr) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{9} +} + +func (x *TypeExpr) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TypeExpr) GetNullable() bool { + if x != nil { + return x.Nullable + } + return false +} + +func (x *TypeExpr) GetArgs() []*TypeArg { + if x != nil { + return x.Args + } + return nil +} + +// TypeArg is one argument of a TypeExpr. Exactly one of the values is set: +// a type for array(integer), an integer for varchar(20), a boolean or a +// string for a dialect that takes them, or an identifier for a bare word +// that is not a type, such as the max of nvarchar(max). A label names the +// argument, as the fields of struct(a: integer, b: varchar) are named. +type TypeArg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` + // Types that are assignable to Value: + // + // *TypeArg_Type + // *TypeArg_IntValue + // *TypeArg_BoolValue + // *TypeArg_StringValue + // *TypeArg_Ident + Value isTypeArg_Value `protobuf_oneof:"value"` +} + +func (x *TypeArg) Reset() { + *x = TypeArg{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TypeArg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TypeArg) ProtoMessage() {} + +func (x *TypeArg) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TypeArg.ProtoReflect.Descriptor instead. +func (*TypeArg) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{10} +} + +func (x *TypeArg) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (m *TypeArg) GetValue() isTypeArg_Value { + if m != nil { + return m.Value + } + return nil +} + +func (x *TypeArg) GetType() *TypeExpr { + if x, ok := x.GetValue().(*TypeArg_Type); ok { + return x.Type + } + return nil +} + +func (x *TypeArg) GetIntValue() int64 { + if x, ok := x.GetValue().(*TypeArg_IntValue); ok { + return x.IntValue + } + return 0 +} + +func (x *TypeArg) GetBoolValue() bool { + if x, ok := x.GetValue().(*TypeArg_BoolValue); ok { + return x.BoolValue + } + return false +} + +func (x *TypeArg) GetStringValue() string { + if x, ok := x.GetValue().(*TypeArg_StringValue); ok { + return x.StringValue + } + return "" +} + +func (x *TypeArg) GetIdent() string { + if x, ok := x.GetValue().(*TypeArg_Ident); ok { + return x.Ident + } + return "" +} + +type isTypeArg_Value interface { + isTypeArg_Value() +} + +type TypeArg_Type struct { + Type *TypeExpr `protobuf:"bytes,2,opt,name=type,proto3,oneof"` +} + +type TypeArg_IntValue struct { + IntValue int64 `protobuf:"varint,3,opt,name=int_value,json=intValue,proto3,oneof"` +} + +type TypeArg_BoolValue struct { + BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` +} + +type TypeArg_StringValue struct { + StringValue string `protobuf:"bytes,5,opt,name=string_value,json=stringValue,proto3,oneof"` +} + +type TypeArg_Ident struct { + Ident string `protobuf:"bytes,6,opt,name=ident,proto3,oneof"` +} + +func (*TypeArg_Type) isTypeArg_Value() {} + +func (*TypeArg_IntValue) isTypeArg_Value() {} + +func (*TypeArg_BoolValue) isTypeArg_Value() {} + +func (*TypeArg_StringValue) isTypeArg_Value() {} + +func (*TypeArg_Ident) isTypeArg_Value() {} + type Column struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -860,6 +862,7 @@ type Column struct { OriginalName string `protobuf:"bytes,15,opt,name=original_name,json=originalName,proto3" json:"original_name,omitempty"` Unsigned bool `protobuf:"varint,16,opt,name=unsigned,proto3" json:"unsigned,omitempty"` ArrayDims int32 `protobuf:"varint,17,opt,name=array_dims,json=arrayDims,proto3" json:"array_dims,omitempty"` + TypeExpr *TypeExpr `protobuf:"bytes,18,opt,name=type_expr,json=typeExpr,proto3" json:"type_expr,omitempty"` } func (x *Column) Reset() { @@ -1006,6 +1009,13 @@ func (x *Column) GetArrayDims() int32 { return 0 } +func (x *Column) GetTypeExpr() *TypeExpr { + if x != nil { + return x.TypeExpr + } + return nil +} + type Query struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1116,6 +1126,7 @@ type Parameter struct { Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` Column *Column `protobuf:"bytes,2,opt,name=column,proto3" json:"column,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` } func (x *Parameter) Reset() { @@ -1164,7 +1175,14 @@ func (x *Parameter) GetColumn() *Column { return nil } -type CodeGenRequest struct { +func (x *Parameter) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GenerateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1174,10 +1192,11 @@ type CodeGenRequest struct { Queries []*Query `protobuf:"bytes,3,rep,name=queries,proto3" json:"queries,omitempty"` SqlcVersion string `protobuf:"bytes,4,opt,name=sqlc_version,proto3" json:"sqlc_version,omitempty"` PluginOptions []byte `protobuf:"bytes,5,opt,name=plugin_options,proto3" json:"plugin_options,omitempty"` + GlobalOptions []byte `protobuf:"bytes,6,opt,name=global_options,proto3" json:"global_options,omitempty"` } -func (x *CodeGenRequest) Reset() { - *x = CodeGenRequest{} +func (x *GenerateRequest) Reset() { + *x = GenerateRequest{} if protoimpl.UnsafeEnabled { mi := &file_plugin_codegen_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1185,13 +1204,13 @@ func (x *CodeGenRequest) Reset() { } } -func (x *CodeGenRequest) String() string { +func (x *GenerateRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CodeGenRequest) ProtoMessage() {} +func (*GenerateRequest) ProtoMessage() {} -func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { +func (x *GenerateRequest) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1203,47 +1222,54 @@ func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CodeGenRequest.ProtoReflect.Descriptor instead. -func (*CodeGenRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead. +func (*GenerateRequest) Descriptor() ([]byte, []int) { return file_plugin_codegen_proto_rawDescGZIP(), []int{14} } -func (x *CodeGenRequest) GetSettings() *Settings { +func (x *GenerateRequest) GetSettings() *Settings { if x != nil { return x.Settings } return nil } -func (x *CodeGenRequest) GetCatalog() *Catalog { +func (x *GenerateRequest) GetCatalog() *Catalog { if x != nil { return x.Catalog } return nil } -func (x *CodeGenRequest) GetQueries() []*Query { +func (x *GenerateRequest) GetQueries() []*Query { if x != nil { return x.Queries } return nil } -func (x *CodeGenRequest) GetSqlcVersion() string { +func (x *GenerateRequest) GetSqlcVersion() string { if x != nil { return x.SqlcVersion } return "" } -func (x *CodeGenRequest) GetPluginOptions() []byte { +func (x *GenerateRequest) GetPluginOptions() []byte { if x != nil { return x.PluginOptions } return nil } -type CodeGenResponse struct { +func (x *GenerateRequest) GetGlobalOptions() []byte { + if x != nil { + return x.GlobalOptions + } + return nil +} + +type GenerateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1251,8 +1277,8 @@ type CodeGenResponse struct { Files []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` } -func (x *CodeGenResponse) Reset() { - *x = CodeGenResponse{} +func (x *GenerateResponse) Reset() { + *x = GenerateResponse{} if protoimpl.UnsafeEnabled { mi := &file_plugin_codegen_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1260,13 +1286,13 @@ func (x *CodeGenResponse) Reset() { } } -func (x *CodeGenResponse) String() string { +func (x *GenerateResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CodeGenResponse) ProtoMessage() {} +func (*GenerateResponse) ProtoMessage() {} -func (x *CodeGenResponse) ProtoReflect() protoreflect.Message { +func (x *GenerateResponse) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1278,12 +1304,12 @@ func (x *CodeGenResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CodeGenResponse.ProtoReflect.Descriptor instead. -func (*CodeGenResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead. +func (*GenerateResponse) Descriptor() ([]byte, []int) { return file_plugin_codegen_proto_rawDescGZIP(), []int{15} } -func (x *CodeGenResponse) GetFiles() []*File { +func (x *GenerateResponse) GetFiles() []*File { if x != nil { return x.Files } @@ -1301,7 +1327,7 @@ type Codegen_Process struct { func (x *Codegen_Process) Reset() { *x = Codegen_Process{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[18] + mi := &file_plugin_codegen_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1314,7 +1340,7 @@ func (x *Codegen_Process) String() string { func (*Codegen_Process) ProtoMessage() {} func (x *Codegen_Process) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[18] + mi := &file_plugin_codegen_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1327,7 +1353,7 @@ func (x *Codegen_Process) ProtoReflect() protoreflect.Message { // Deprecated: Use Codegen_Process.ProtoReflect.Descriptor instead. func (*Codegen_Process) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{4, 0} + return file_plugin_codegen_proto_rawDescGZIP(), []int{2, 0} } func (x *Codegen_Process) GetCmd() string { @@ -1349,7 +1375,7 @@ type Codegen_WASM struct { func (x *Codegen_WASM) Reset() { *x = Codegen_WASM{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[19] + mi := &file_plugin_codegen_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1362,7 +1388,7 @@ func (x *Codegen_WASM) String() string { func (*Codegen_WASM) ProtoMessage() {} func (x *Codegen_WASM) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[19] + mi := &file_plugin_codegen_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1375,7 +1401,7 @@ func (x *Codegen_WASM) ProtoReflect() protoreflect.Message { // Deprecated: Use Codegen_WASM.ProtoReflect.Descriptor instead. func (*Codegen_WASM) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{4, 1} + return file_plugin_codegen_proto_rawDescGZIP(), []int{2, 1} } func (x *Codegen_WASM) GetUrl() string { @@ -1400,194 +1426,181 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x93, 0x02, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x72, - 0x69, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x64, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, - 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, - 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, - 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xb7, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, + 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, + 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, + 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, + 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, + 0x65, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, + 0x65, 0x6e, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, + 0x08, 0x09, 0x10, 0x0a, 0x4a, 0x04, 0x08, 0x0a, 0x10, 0x0b, 0x4a, 0x04, 0x08, 0x0b, 0x10, 0x0c, + 0x22, 0x8b, 0x02, 0x0a, 0x07, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x12, 0x10, 0x0a, 0x03, + 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x16, + 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x65, + 0x6e, 0x76, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x07, 0x70, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x57, 0x41, 0x53, 0x4d, 0x52, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x1a, + 0x1b, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x1a, 0x30, 0x0a, 0x04, + 0x57, 0x41, 0x53, 0x4d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x22, 0x88, + 0x01, 0x0a, 0x07, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x28, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x22, 0xc1, 0x01, 0x0a, 0x06, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, + 0x65, 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x05, 0x65, 0x6e, 0x75, + 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x12, 0x3e, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x63, + 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3d, 0x0a, + 0x0d, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x48, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, + 0x24, 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x52, 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, + 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, + 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x5f, 0x0a, + 0x08, 0x54, 0x79, 0x70, 0x65, 0x45, 0x78, 0x70, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x61, 0x72, 0x67, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x2e, 0x54, 0x79, 0x70, 0x65, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0xcd, + 0x01, 0x0a, 0x07, 0x54, 0x79, 0x70, 0x65, 0x41, 0x72, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, + 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x45, 0x78, 0x70, 0x72, + 0x48, 0x00, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, + 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, + 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, + 0x05, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbd, + 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, + 0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, + 0x72, 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, + 0x72, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, + 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, + 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, + 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, + 0x63, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, + 0x73, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, + 0x62, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, + 0x23, 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, + 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, + 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x12, + 0x2d, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x12, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65, + 0x45, 0x78, 0x70, 0x72, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x45, 0x78, 0x70, 0x72, 0x22, 0x94, + 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, + 0x6d, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, + 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, + 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, - 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x67, - 0x6f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x47, 0x6f, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x06, 0x67, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x8b, 0x02, 0x0a, - 0x0c, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x47, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, - 0x0b, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x18, - 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x74, - 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x47, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x3d, 0x0a, 0x0f, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd2, 0x02, 0x0a, 0x08, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x06, 0x72, - 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x52, 0x65, - 0x6e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4f, 0x76, - 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, - 0x67, 0x65, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x1a, 0x39, 0x0a, 0x0b, - 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, - 0x09, 0x10, 0x0a, 0x4a, 0x04, 0x08, 0x0a, 0x10, 0x0b, 0x4a, 0x04, 0x08, 0x0b, 0x10, 0x0c, 0x22, - 0x8b, 0x02, 0x0a, 0x07, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6f, - 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, - 0x76, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x07, 0x70, 0x72, 0x6f, - 0x63, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x57, 0x41, 0x53, 0x4d, 0x52, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x1a, 0x1b, - 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x1a, 0x30, 0x0a, 0x04, 0x57, - 0x41, 0x53, 0x4d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x22, 0x88, 0x01, - 0x0a, 0x07, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, - 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, - 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x22, 0xc1, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x25, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, - 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x12, 0x3e, 0x0a, 0x0f, - 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, - 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x63, 0x6f, - 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3d, 0x0a, 0x0d, - 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x48, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x24, - 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, - 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, - 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8e, 0x04, 0x0a, - 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, - 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, - 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, - 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, - 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, 0x5f, - 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x53, - 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, - 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, 0x0a, - 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, 0x1d, - 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x22, 0x94, 0x02, - 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, - 0x64, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, - 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x22, 0x4b, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, 0x6c, - 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x22, 0xde, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x61, 0x74, - 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x27, 0x0a, - 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x07, 0x71, - 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x71, - 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0x35, 0x0a, 0x0f, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, + 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x5f, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x87, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x12, 0x27, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, + 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x67, 0x6c, 0x6f, 0x62, + 0x61, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x22, 0x36, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x32, 0x4f, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, + 0x67, 0x65, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x08, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x18, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, @@ -1610,60 +1623,58 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { return file_plugin_codegen_proto_rawDescData } -var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_plugin_codegen_proto_goTypes = []interface{}{ - (*File)(nil), // 0: plugin.File - (*Override)(nil), // 1: plugin.Override - (*ParsedGoType)(nil), // 2: plugin.ParsedGoType - (*Settings)(nil), // 3: plugin.Settings - (*Codegen)(nil), // 4: plugin.Codegen - (*Catalog)(nil), // 5: plugin.Catalog - (*Schema)(nil), // 6: plugin.Schema - (*CompositeType)(nil), // 7: plugin.CompositeType - (*Enum)(nil), // 8: plugin.Enum - (*Table)(nil), // 9: plugin.Table - (*Identifier)(nil), // 10: plugin.Identifier - (*Column)(nil), // 11: plugin.Column - (*Query)(nil), // 12: plugin.Query - (*Parameter)(nil), // 13: plugin.Parameter - (*CodeGenRequest)(nil), // 14: plugin.CodeGenRequest - (*CodeGenResponse)(nil), // 15: plugin.CodeGenResponse - nil, // 16: plugin.ParsedGoType.StructTagsEntry - nil, // 17: plugin.Settings.RenameEntry - (*Codegen_Process)(nil), // 18: plugin.Codegen.Process - (*Codegen_WASM)(nil), // 19: plugin.Codegen.WASM + (*File)(nil), // 0: plugin.File + (*Settings)(nil), // 1: plugin.Settings + (*Codegen)(nil), // 2: plugin.Codegen + (*Catalog)(nil), // 3: plugin.Catalog + (*Schema)(nil), // 4: plugin.Schema + (*CompositeType)(nil), // 5: plugin.CompositeType + (*Enum)(nil), // 6: plugin.Enum + (*Table)(nil), // 7: plugin.Table + (*Identifier)(nil), // 8: plugin.Identifier + (*TypeExpr)(nil), // 9: plugin.TypeExpr + (*TypeArg)(nil), // 10: plugin.TypeArg + (*Column)(nil), // 11: plugin.Column + (*Query)(nil), // 12: plugin.Query + (*Parameter)(nil), // 13: plugin.Parameter + (*GenerateRequest)(nil), // 14: plugin.GenerateRequest + (*GenerateResponse)(nil), // 15: plugin.GenerateResponse + (*Codegen_Process)(nil), // 16: plugin.Codegen.Process + (*Codegen_WASM)(nil), // 17: plugin.Codegen.WASM } var file_plugin_codegen_proto_depIdxs = []int32{ - 10, // 0: plugin.Override.table:type_name -> plugin.Identifier - 2, // 1: plugin.Override.go_type:type_name -> plugin.ParsedGoType - 16, // 2: plugin.ParsedGoType.struct_tags:type_name -> plugin.ParsedGoType.StructTagsEntry - 17, // 3: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry - 1, // 4: plugin.Settings.overrides:type_name -> plugin.Override - 4, // 5: plugin.Settings.codegen:type_name -> plugin.Codegen - 18, // 6: plugin.Codegen.process:type_name -> plugin.Codegen.Process - 19, // 7: plugin.Codegen.wasm:type_name -> plugin.Codegen.WASM - 6, // 8: plugin.Catalog.schemas:type_name -> plugin.Schema - 9, // 9: plugin.Schema.tables:type_name -> plugin.Table - 8, // 10: plugin.Schema.enums:type_name -> plugin.Enum - 7, // 11: plugin.Schema.composite_types:type_name -> plugin.CompositeType - 10, // 12: plugin.Table.rel:type_name -> plugin.Identifier - 11, // 13: plugin.Table.columns:type_name -> plugin.Column - 10, // 14: plugin.Column.table:type_name -> plugin.Identifier - 10, // 15: plugin.Column.type:type_name -> plugin.Identifier - 10, // 16: plugin.Column.embed_table:type_name -> plugin.Identifier - 11, // 17: plugin.Query.columns:type_name -> plugin.Column - 13, // 18: plugin.Query.params:type_name -> plugin.Parameter - 10, // 19: plugin.Query.insert_into_table:type_name -> plugin.Identifier - 11, // 20: plugin.Parameter.column:type_name -> plugin.Column - 3, // 21: plugin.CodeGenRequest.settings:type_name -> plugin.Settings - 5, // 22: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog - 12, // 23: plugin.CodeGenRequest.queries:type_name -> plugin.Query - 0, // 24: plugin.CodeGenResponse.files:type_name -> plugin.File - 25, // [25:25] is the sub-list for method output_type - 25, // [25:25] is the sub-list for method input_type - 25, // [25:25] is the sub-list for extension type_name - 25, // [25:25] is the sub-list for extension extendee - 0, // [0:25] is the sub-list for field type_name + 2, // 0: plugin.Settings.codegen:type_name -> plugin.Codegen + 16, // 1: plugin.Codegen.process:type_name -> plugin.Codegen.Process + 17, // 2: plugin.Codegen.wasm:type_name -> plugin.Codegen.WASM + 4, // 3: plugin.Catalog.schemas:type_name -> plugin.Schema + 7, // 4: plugin.Schema.tables:type_name -> plugin.Table + 6, // 5: plugin.Schema.enums:type_name -> plugin.Enum + 5, // 6: plugin.Schema.composite_types:type_name -> plugin.CompositeType + 8, // 7: plugin.Table.rel:type_name -> plugin.Identifier + 11, // 8: plugin.Table.columns:type_name -> plugin.Column + 10, // 9: plugin.TypeExpr.args:type_name -> plugin.TypeArg + 9, // 10: plugin.TypeArg.type:type_name -> plugin.TypeExpr + 8, // 11: plugin.Column.table:type_name -> plugin.Identifier + 8, // 12: plugin.Column.type:type_name -> plugin.Identifier + 8, // 13: plugin.Column.embed_table:type_name -> plugin.Identifier + 9, // 14: plugin.Column.type_expr:type_name -> plugin.TypeExpr + 11, // 15: plugin.Query.columns:type_name -> plugin.Column + 13, // 16: plugin.Query.params:type_name -> plugin.Parameter + 8, // 17: plugin.Query.insert_into_table:type_name -> plugin.Identifier + 11, // 18: plugin.Parameter.column:type_name -> plugin.Column + 1, // 19: plugin.GenerateRequest.settings:type_name -> plugin.Settings + 3, // 20: plugin.GenerateRequest.catalog:type_name -> plugin.Catalog + 12, // 21: plugin.GenerateRequest.queries:type_name -> plugin.Query + 0, // 22: plugin.GenerateResponse.files:type_name -> plugin.File + 14, // 23: plugin.CodegenService.Generate:input_type -> plugin.GenerateRequest + 15, // 24: plugin.CodegenService.Generate:output_type -> plugin.GenerateResponse + 24, // [24:25] is the sub-list for method output_type + 23, // [23:24] is the sub-list for method input_type + 23, // [23:23] is the sub-list for extension type_name + 23, // [23:23] is the sub-list for extension extendee + 0, // [0:23] is the sub-list for field type_name } func init() { file_plugin_codegen_proto_init() } @@ -1685,7 +1696,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Override); i { + switch v := v.(*Settings); i { case 0: return &v.state case 1: @@ -1697,7 +1708,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParsedGoType); i { + switch v := v.(*Codegen); i { case 0: return &v.state case 1: @@ -1709,7 +1720,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Settings); i { + switch v := v.(*Catalog); i { case 0: return &v.state case 1: @@ -1721,7 +1732,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Codegen); i { + switch v := v.(*Schema); i { case 0: return &v.state case 1: @@ -1733,7 +1744,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Catalog); i { + switch v := v.(*CompositeType); i { case 0: return &v.state case 1: @@ -1745,7 +1756,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { + switch v := v.(*Enum); i { case 0: return &v.state case 1: @@ -1757,7 +1768,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CompositeType); i { + switch v := v.(*Table); i { case 0: return &v.state case 1: @@ -1769,7 +1780,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Enum); i { + switch v := v.(*Identifier); i { case 0: return &v.state case 1: @@ -1781,7 +1792,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Table); i { + switch v := v.(*TypeExpr); i { case 0: return &v.state case 1: @@ -1793,7 +1804,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identifier); i { + switch v := v.(*TypeArg); i { case 0: return &v.state case 1: @@ -1841,7 +1852,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenRequest); i { + switch v := v.(*GenerateRequest); i { case 0: return &v.state case 1: @@ -1853,7 +1864,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenResponse); i { + switch v := v.(*GenerateResponse); i { case 0: return &v.state case 1: @@ -1864,7 +1875,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Codegen_Process); i { case 0: return &v.state @@ -1876,7 +1887,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Codegen_WASM); i { case 0: return &v.state @@ -1889,15 +1900,22 @@ func file_plugin_codegen_proto_init() { } } } + file_plugin_codegen_proto_msgTypes[10].OneofWrappers = []interface{}{ + (*TypeArg_Type)(nil), + (*TypeArg_IntValue)(nil), + (*TypeArg_BoolValue)(nil), + (*TypeArg_StringValue)(nil), + (*TypeArg_Ident)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 20, + NumMessages: 18, NumExtensions: 0, - NumServices: 0, + NumServices: 1, }, GoTypes: file_plugin_codegen_proto_goTypes, DependencyIndexes: file_plugin_codegen_proto_depIdxs, diff --git a/internal/plugin/codegen_grpc.pb.go b/internal/plugin/codegen_grpc.pb.go new file mode 100644 index 0000000000..30287ac457 --- /dev/null +++ b/internal/plugin/codegen_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: plugin/codegen.proto + +package plugin + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + CodegenService_Generate_FullMethodName = "/plugin.CodegenService/Generate" +) + +// CodegenServiceClient is the client API for CodegenService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CodegenServiceClient interface { + Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) +} + +type codegenServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCodegenServiceClient(cc grpc.ClientConnInterface) CodegenServiceClient { + return &codegenServiceClient{cc} +} + +func (c *codegenServiceClient) Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) { + out := new(GenerateResponse) + err := c.cc.Invoke(ctx, CodegenService_Generate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CodegenServiceServer is the server API for CodegenService service. +// All implementations must embed UnimplementedCodegenServiceServer +// for forward compatibility +type CodegenServiceServer interface { + Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) + mustEmbedUnimplementedCodegenServiceServer() +} + +// UnimplementedCodegenServiceServer must be embedded to have forward compatible implementations. +type UnimplementedCodegenServiceServer struct { +} + +func (UnimplementedCodegenServiceServer) Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Generate not implemented") +} +func (UnimplementedCodegenServiceServer) mustEmbedUnimplementedCodegenServiceServer() {} + +// UnsafeCodegenServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CodegenServiceServer will +// result in compilation errors. +type UnsafeCodegenServiceServer interface { + mustEmbedUnimplementedCodegenServiceServer() +} + +func RegisterCodegenServiceServer(s grpc.ServiceRegistrar, srv CodegenServiceServer) { + s.RegisterService(&CodegenService_ServiceDesc, srv) +} + +func _CodegenService_Generate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CodegenServiceServer).Generate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CodegenService_Generate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CodegenServiceServer).Generate(ctx, req.(*GenerateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CodegenService_ServiceDesc is the grpc.ServiceDesc for CodegenService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CodegenService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "plugin.CodegenService", + HandlerType: (*CodegenServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Generate", + Handler: _CodegenService_Generate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plugin/codegen.proto", +} diff --git a/internal/plugin/codegen_vtproto.pb.go b/internal/plugin/codegen_vtproto.pb.go deleted file mode 100644 index 3ff0dc600f..0000000000 --- a/internal/plugin/codegen_vtproto.pb.go +++ /dev/null @@ -1,8219 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.4.0 -// source: plugin/codegen.proto - -package plugin - -import ( - fmt "fmt" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - bits "math/bits" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *File) CloneVT() *File { - if m == nil { - return (*File)(nil) - } - r := &File{ - Name: m.Name, - } - if rhs := m.Contents; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Contents = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *File) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Override) CloneVT() *Override { - if m == nil { - return (*Override)(nil) - } - r := &Override{ - CodeType: m.CodeType, - DbType: m.DbType, - Nullable: m.Nullable, - Column: m.Column, - Table: m.Table.CloneVT(), - ColumnName: m.ColumnName, - GoType: m.GoType.CloneVT(), - Unsigned: m.Unsigned, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Override) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ParsedGoType) CloneVT() *ParsedGoType { - if m == nil { - return (*ParsedGoType)(nil) - } - r := &ParsedGoType{ - ImportPath: m.ImportPath, - Package: m.Package, - TypeName: m.TypeName, - BasicType: m.BasicType, - } - if rhs := m.StructTags; rhs != nil { - tmpContainer := make(map[string]string, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v - } - r.StructTags = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ParsedGoType) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Settings) CloneVT() *Settings { - if m == nil { - return (*Settings)(nil) - } - r := &Settings{ - Version: m.Version, - Engine: m.Engine, - Codegen: m.Codegen.CloneVT(), - } - if rhs := m.Schema; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Schema = tmpContainer - } - if rhs := m.Queries; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Queries = tmpContainer - } - if rhs := m.Rename; rhs != nil { - tmpContainer := make(map[string]string, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v - } - r.Rename = tmpContainer - } - if rhs := m.Overrides; rhs != nil { - tmpContainer := make([]*Override, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Overrides = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Settings) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Codegen_Process) CloneVT() *Codegen_Process { - if m == nil { - return (*Codegen_Process)(nil) - } - r := &Codegen_Process{ - Cmd: m.Cmd, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Codegen_Process) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Codegen_WASM) CloneVT() *Codegen_WASM { - if m == nil { - return (*Codegen_WASM)(nil) - } - r := &Codegen_WASM{ - Url: m.Url, - Sha256: m.Sha256, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Codegen_WASM) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Codegen) CloneVT() *Codegen { - if m == nil { - return (*Codegen)(nil) - } - r := &Codegen{ - Out: m.Out, - Plugin: m.Plugin, - Process: m.Process.CloneVT(), - Wasm: m.Wasm.CloneVT(), - } - if rhs := m.Options; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Options = tmpBytes - } - if rhs := m.Env; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Env = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Codegen) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Catalog) CloneVT() *Catalog { - if m == nil { - return (*Catalog)(nil) - } - r := &Catalog{ - Comment: m.Comment, - DefaultSchema: m.DefaultSchema, - Name: m.Name, - } - if rhs := m.Schemas; rhs != nil { - tmpContainer := make([]*Schema, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Schemas = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Catalog) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Schema) CloneVT() *Schema { - if m == nil { - return (*Schema)(nil) - } - r := &Schema{ - Comment: m.Comment, - Name: m.Name, - } - if rhs := m.Tables; rhs != nil { - tmpContainer := make([]*Table, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Tables = tmpContainer - } - if rhs := m.Enums; rhs != nil { - tmpContainer := make([]*Enum, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Enums = tmpContainer - } - if rhs := m.CompositeTypes; rhs != nil { - tmpContainer := make([]*CompositeType, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.CompositeTypes = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Schema) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CompositeType) CloneVT() *CompositeType { - if m == nil { - return (*CompositeType)(nil) - } - r := &CompositeType{ - Name: m.Name, - Comment: m.Comment, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *CompositeType) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Enum) CloneVT() *Enum { - if m == nil { - return (*Enum)(nil) - } - r := &Enum{ - Name: m.Name, - Comment: m.Comment, - } - if rhs := m.Vals; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Vals = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Enum) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Table) CloneVT() *Table { - if m == nil { - return (*Table)(nil) - } - r := &Table{ - Rel: m.Rel.CloneVT(), - Comment: m.Comment, - } - if rhs := m.Columns; rhs != nil { - tmpContainer := make([]*Column, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Columns = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Table) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Identifier) CloneVT() *Identifier { - if m == nil { - return (*Identifier)(nil) - } - r := &Identifier{ - Catalog: m.Catalog, - Schema: m.Schema, - Name: m.Name, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Identifier) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Column) CloneVT() *Column { - if m == nil { - return (*Column)(nil) - } - r := &Column{ - Name: m.Name, - NotNull: m.NotNull, - IsArray: m.IsArray, - Comment: m.Comment, - Length: m.Length, - IsNamedParam: m.IsNamedParam, - IsFuncCall: m.IsFuncCall, - Scope: m.Scope, - Table: m.Table.CloneVT(), - TableAlias: m.TableAlias, - Type: m.Type.CloneVT(), - IsSqlcSlice: m.IsSqlcSlice, - EmbedTable: m.EmbedTable.CloneVT(), - OriginalName: m.OriginalName, - Unsigned: m.Unsigned, - ArrayDims: m.ArrayDims, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Column) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Query) CloneVT() *Query { - if m == nil { - return (*Query)(nil) - } - r := &Query{ - Text: m.Text, - Name: m.Name, - Cmd: m.Cmd, - Filename: m.Filename, - InsertIntoTable: m.InsertIntoTable.CloneVT(), - } - if rhs := m.Columns; rhs != nil { - tmpContainer := make([]*Column, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Columns = tmpContainer - } - if rhs := m.Params; rhs != nil { - tmpContainer := make([]*Parameter, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Params = tmpContainer - } - if rhs := m.Comments; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Comments = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Query) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Parameter) CloneVT() *Parameter { - if m == nil { - return (*Parameter)(nil) - } - r := &Parameter{ - Number: m.Number, - Column: m.Column.CloneVT(), - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Parameter) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CodeGenRequest) CloneVT() *CodeGenRequest { - if m == nil { - return (*CodeGenRequest)(nil) - } - r := &CodeGenRequest{ - Settings: m.Settings.CloneVT(), - Catalog: m.Catalog.CloneVT(), - SqlcVersion: m.SqlcVersion, - } - if rhs := m.Queries; rhs != nil { - tmpContainer := make([]*Query, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Queries = tmpContainer - } - if rhs := m.PluginOptions; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.PluginOptions = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *CodeGenRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CodeGenResponse) CloneVT() *CodeGenResponse { - if m == nil { - return (*CodeGenResponse)(nil) - } - r := &CodeGenResponse{} - if rhs := m.Files; rhs != nil { - tmpContainer := make([]*File, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Files = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *CodeGenResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *File) EqualVT(that *File) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if string(this.Contents) != string(that.Contents) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *File) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*File) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Override) EqualVT(that *Override) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.CodeType != that.CodeType { - return false - } - if this.DbType != that.DbType { - return false - } - if this.Nullable != that.Nullable { - return false - } - if this.Column != that.Column { - return false - } - if !this.Table.EqualVT(that.Table) { - return false - } - if this.ColumnName != that.ColumnName { - return false - } - if !this.GoType.EqualVT(that.GoType) { - return false - } - if this.Unsigned != that.Unsigned { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Override) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Override) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ParsedGoType) EqualVT(that *ParsedGoType) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ImportPath != that.ImportPath { - return false - } - if this.Package != that.Package { - return false - } - if this.TypeName != that.TypeName { - return false - } - if this.BasicType != that.BasicType { - return false - } - if len(this.StructTags) != len(that.StructTags) { - return false - } - for i, vx := range this.StructTags { - vy, ok := that.StructTags[i] - if !ok { - return false - } - if vx != vy { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ParsedGoType) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ParsedGoType) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Settings) EqualVT(that *Settings) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Version != that.Version { - return false - } - if this.Engine != that.Engine { - return false - } - if len(this.Schema) != len(that.Schema) { - return false - } - for i, vx := range this.Schema { - vy := that.Schema[i] - if vx != vy { - return false - } - } - if len(this.Queries) != len(that.Queries) { - return false - } - for i, vx := range this.Queries { - vy := that.Queries[i] - if vx != vy { - return false - } - } - if len(this.Rename) != len(that.Rename) { - return false - } - for i, vx := range this.Rename { - vy, ok := that.Rename[i] - if !ok { - return false - } - if vx != vy { - return false - } - } - if len(this.Overrides) != len(that.Overrides) { - return false - } - for i, vx := range this.Overrides { - vy := that.Overrides[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Override{} - } - if q == nil { - q = &Override{} - } - if !p.EqualVT(q) { - return false - } - } - } - if !this.Codegen.EqualVT(that.Codegen) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Settings) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Settings) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Codegen_Process) EqualVT(that *Codegen_Process) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Cmd != that.Cmd { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Codegen_Process) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Codegen_Process) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Codegen_WASM) EqualVT(that *Codegen_WASM) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Url != that.Url { - return false - } - if this.Sha256 != that.Sha256 { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Codegen_WASM) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Codegen_WASM) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Codegen) EqualVT(that *Codegen) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Out != that.Out { - return false - } - if this.Plugin != that.Plugin { - return false - } - if string(this.Options) != string(that.Options) { - return false - } - if len(this.Env) != len(that.Env) { - return false - } - for i, vx := range this.Env { - vy := that.Env[i] - if vx != vy { - return false - } - } - if !this.Process.EqualVT(that.Process) { - return false - } - if !this.Wasm.EqualVT(that.Wasm) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Codegen) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Codegen) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Catalog) EqualVT(that *Catalog) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Comment != that.Comment { - return false - } - if this.DefaultSchema != that.DefaultSchema { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Schemas) != len(that.Schemas) { - return false - } - for i, vx := range this.Schemas { - vy := that.Schemas[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Schema{} - } - if q == nil { - q = &Schema{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Catalog) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Catalog) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Schema) EqualVT(that *Schema) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Comment != that.Comment { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Tables) != len(that.Tables) { - return false - } - for i, vx := range this.Tables { - vy := that.Tables[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Table{} - } - if q == nil { - q = &Table{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Enums) != len(that.Enums) { - return false - } - for i, vx := range this.Enums { - vy := that.Enums[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Enum{} - } - if q == nil { - q = &Enum{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.CompositeTypes) != len(that.CompositeTypes) { - return false - } - for i, vx := range this.CompositeTypes { - vy := that.CompositeTypes[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &CompositeType{} - } - if q == nil { - q = &CompositeType{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Schema) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Schema) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CompositeType) EqualVT(that *CompositeType) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *CompositeType) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CompositeType) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Enum) EqualVT(that *Enum) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Vals) != len(that.Vals) { - return false - } - for i, vx := range this.Vals { - vy := that.Vals[i] - if vx != vy { - return false - } - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Enum) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Enum) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Table) EqualVT(that *Table) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if !this.Rel.EqualVT(that.Rel) { - return false - } - if len(this.Columns) != len(that.Columns) { - return false - } - for i, vx := range this.Columns { - vy := that.Columns[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Column{} - } - if q == nil { - q = &Column{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Table) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Table) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Identifier) EqualVT(that *Identifier) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Catalog != that.Catalog { - return false - } - if this.Schema != that.Schema { - return false - } - if this.Name != that.Name { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Identifier) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Identifier) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Column) EqualVT(that *Column) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.NotNull != that.NotNull { - return false - } - if this.IsArray != that.IsArray { - return false - } - if this.Comment != that.Comment { - return false - } - if this.Length != that.Length { - return false - } - if this.IsNamedParam != that.IsNamedParam { - return false - } - if this.IsFuncCall != that.IsFuncCall { - return false - } - if this.Scope != that.Scope { - return false - } - if !this.Table.EqualVT(that.Table) { - return false - } - if this.TableAlias != that.TableAlias { - return false - } - if !this.Type.EqualVT(that.Type) { - return false - } - if this.IsSqlcSlice != that.IsSqlcSlice { - return false - } - if !this.EmbedTable.EqualVT(that.EmbedTable) { - return false - } - if this.OriginalName != that.OriginalName { - return false - } - if this.Unsigned != that.Unsigned { - return false - } - if this.ArrayDims != that.ArrayDims { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Column) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Column) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Query) EqualVT(that *Query) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Text != that.Text { - return false - } - if this.Name != that.Name { - return false - } - if this.Cmd != that.Cmd { - return false - } - if len(this.Columns) != len(that.Columns) { - return false - } - for i, vx := range this.Columns { - vy := that.Columns[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Column{} - } - if q == nil { - q = &Column{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Params) != len(that.Params) { - return false - } - for i, vx := range this.Params { - vy := that.Params[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Parameter{} - } - if q == nil { - q = &Parameter{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Comments) != len(that.Comments) { - return false - } - for i, vx := range this.Comments { - vy := that.Comments[i] - if vx != vy { - return false - } - } - if this.Filename != that.Filename { - return false - } - if !this.InsertIntoTable.EqualVT(that.InsertIntoTable) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Query) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Query) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Parameter) EqualVT(that *Parameter) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Number != that.Number { - return false - } - if !this.Column.EqualVT(that.Column) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Parameter) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Parameter) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CodeGenRequest) EqualVT(that *CodeGenRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if !this.Settings.EqualVT(that.Settings) { - return false - } - if !this.Catalog.EqualVT(that.Catalog) { - return false - } - if len(this.Queries) != len(that.Queries) { - return false - } - for i, vx := range this.Queries { - vy := that.Queries[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Query{} - } - if q == nil { - q = &Query{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.SqlcVersion != that.SqlcVersion { - return false - } - if string(this.PluginOptions) != string(that.PluginOptions) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *CodeGenRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CodeGenRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CodeGenResponse) EqualVT(that *CodeGenResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.Files) != len(that.Files) { - return false - } - for i, vx := range this.Files { - vy := that.Files[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &File{} - } - if q == nil { - q = &File{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *CodeGenResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CodeGenResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *File) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *File) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *File) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Contents) > 0 { - i -= len(m.Contents) - copy(dAtA[i:], m.Contents) - i = encodeVarint(dAtA, i, uint64(len(m.Contents))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Override) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Override) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Override) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.GoType != nil { - size, err := m.GoType.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.ColumnName) > 0 { - i -= len(m.ColumnName) - copy(dAtA[i:], m.ColumnName) - i = encodeVarint(dAtA, i, uint64(len(m.ColumnName))) - i-- - dAtA[i] = 0x42 - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if len(m.Column) > 0 { - i -= len(m.Column) - copy(dAtA[i:], m.Column) - i = encodeVarint(dAtA, i, uint64(len(m.Column))) - i-- - dAtA[i] = 0x32 - } - if m.Nullable { - i-- - if m.Nullable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if len(m.DbType) > 0 { - i -= len(m.DbType) - copy(dAtA[i:], m.DbType) - i = encodeVarint(dAtA, i, uint64(len(m.DbType))) - i-- - dAtA[i] = 0x1a - } - if len(m.CodeType) > 0 { - i -= len(m.CodeType) - copy(dAtA[i:], m.CodeType) - i = encodeVarint(dAtA, i, uint64(len(m.CodeType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ParsedGoType) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ParsedGoType) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ParsedGoType) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.StructTags) > 0 { - for k := range m.StructTags { - v := m.StructTags[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.BasicType { - i-- - if m.BasicType { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.TypeName) > 0 { - i -= len(m.TypeName) - copy(dAtA[i:], m.TypeName) - i = encodeVarint(dAtA, i, uint64(len(m.TypeName))) - i-- - dAtA[i] = 0x1a - } - if len(m.Package) > 0 { - i -= len(m.Package) - copy(dAtA[i:], m.Package) - i = encodeVarint(dAtA, i, uint64(len(m.Package))) - i-- - dAtA[i] = 0x12 - } - if len(m.ImportPath) > 0 { - i -= len(m.ImportPath) - copy(dAtA[i:], m.ImportPath) - i = encodeVarint(dAtA, i, uint64(len(m.ImportPath))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Settings) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settings) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Settings) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Codegen != nil { - size, err := m.Codegen.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.Overrides) > 0 { - for iNdEx := len(m.Overrides) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Overrides[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Rename) > 0 { - for k := range m.Rename { - v := m.Rename[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Queries[iNdEx]) - copy(dAtA[i:], m.Queries[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Queries[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Schema) > 0 { - for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Schema[iNdEx]) - copy(dAtA[i:], m.Schema[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Schema[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Engine) > 0 { - i -= len(m.Engine) - copy(dAtA[i:], m.Engine) - i = encodeVarint(dAtA, i, uint64(len(m.Engine))) - i-- - dAtA[i] = 0x12 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarint(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen_Process) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen_Process) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Codegen_Process) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Cmd) > 0 { - i -= len(m.Cmd) - copy(dAtA[i:], m.Cmd) - i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen_WASM) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen_WASM) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Codegen_WASM) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Sha256) > 0 { - i -= len(m.Sha256) - copy(dAtA[i:], m.Sha256) - i = encodeVarint(dAtA, i, uint64(len(m.Sha256))) - i-- - dAtA[i] = 0x12 - } - if len(m.Url) > 0 { - i -= len(m.Url) - copy(dAtA[i:], m.Url) - i = encodeVarint(dAtA, i, uint64(len(m.Url))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Codegen) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Wasm != nil { - size, err := m.Wasm.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - if m.Process != nil { - size, err := m.Process.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if len(m.Env) > 0 { - for iNdEx := len(m.Env) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Env[iNdEx]) - copy(dAtA[i:], m.Env[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Env[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarint(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x1a - } - if len(m.Plugin) > 0 { - i -= len(m.Plugin) - copy(dAtA[i:], m.Plugin) - i = encodeVarint(dAtA, i, uint64(len(m.Plugin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Catalog) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Catalog) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Catalog) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Schemas) > 0 { - for iNdEx := len(m.Schemas) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Schemas[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DefaultSchema) > 0 { - i -= len(m.DefaultSchema) - copy(dAtA[i:], m.DefaultSchema) - i = encodeVarint(dAtA, i, uint64(len(m.DefaultSchema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Schema) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Schema) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Schema) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.CompositeTypes) > 0 { - for iNdEx := len(m.CompositeTypes) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.CompositeTypes[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Enums) > 0 { - for iNdEx := len(m.Enums) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Enums[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Tables) > 0 { - for iNdEx := len(m.Tables) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Tables[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompositeType) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompositeType) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CompositeType) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Enum) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Enum) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Enum) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Vals) > 0 { - for iNdEx := len(m.Vals) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Vals[iNdEx]) - copy(dAtA[i:], m.Vals[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Vals[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Table) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Table) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Table) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - } - if m.Rel != nil { - size, err := m.Rel.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Identifier) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Identifier) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Identifier) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarint(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Catalog) > 0 { - i -= len(m.Catalog) - copy(dAtA[i:], m.Catalog) - i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Column) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Column) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Column) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ArrayDims != 0 { - i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.OriginalName) > 0 { - i -= len(m.OriginalName) - copy(dAtA[i:], m.OriginalName) - i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) - i-- - dAtA[i] = 0x7a - } - if m.EmbedTable != nil { - size, err := m.EmbedTable.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x72 - } - if m.IsSqlcSlice { - i-- - if m.IsSqlcSlice { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if m.Type != nil { - size, err := m.Type.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.TableAlias) > 0 { - i -= len(m.TableAlias) - copy(dAtA[i:], m.TableAlias) - i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) - i-- - dAtA[i] = 0x5a - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.Scope) > 0 { - i -= len(m.Scope) - copy(dAtA[i:], m.Scope) - i = encodeVarint(dAtA, i, uint64(len(m.Scope))) - i-- - dAtA[i] = 0x4a - } - if m.IsFuncCall { - i-- - if m.IsFuncCall { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.IsNamedParam { - i-- - if m.IsNamedParam { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Length != 0 { - i = encodeVarint(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x30 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x2a - } - if m.IsArray { - i-- - if m.IsArray { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.NotNull { - i-- - if m.NotNull { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Query) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Query) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Query) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.InsertIntoTable != nil { - size, err := m.InsertIntoTable.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if len(m.Filename) > 0 { - i -= len(m.Filename) - copy(dAtA[i:], m.Filename) - i = encodeVarint(dAtA, i, uint64(len(m.Filename))) - i-- - dAtA[i] = 0x3a - } - if len(m.Comments) > 0 { - for iNdEx := len(m.Comments) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Comments[iNdEx]) - copy(dAtA[i:], m.Comments[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Comments[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Params) > 0 { - for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Params[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Cmd) > 0 { - i -= len(m.Cmd) - copy(dAtA[i:], m.Cmd) - i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Text) > 0 { - i -= len(m.Text) - copy(dAtA[i:], m.Text) - i = encodeVarint(dAtA, i, uint64(len(m.Text))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Parameter) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Parameter) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Parameter) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Column != nil { - size, err := m.Column.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Number != 0 { - i = encodeVarint(dAtA, i, uint64(m.Number)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CodeGenRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CodeGenRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CodeGenRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PluginOptions) > 0 { - i -= len(m.PluginOptions) - copy(dAtA[i:], m.PluginOptions) - i = encodeVarint(dAtA, i, uint64(len(m.PluginOptions))) - i-- - dAtA[i] = 0x2a - } - if len(m.SqlcVersion) > 0 { - i -= len(m.SqlcVersion) - copy(dAtA[i:], m.SqlcVersion) - i = encodeVarint(dAtA, i, uint64(len(m.SqlcVersion))) - i-- - dAtA[i] = 0x22 - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Queries[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.Catalog != nil { - size, err := m.Catalog.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Settings != nil { - size, err := m.Settings.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CodeGenResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CodeGenResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CodeGenResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Files) > 0 { - for iNdEx := len(m.Files) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Files[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarint(dAtA []byte, offset int, v uint64) int { - offset -= sov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *File) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *File) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *File) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Contents) > 0 { - i -= len(m.Contents) - copy(dAtA[i:], m.Contents) - i = encodeVarint(dAtA, i, uint64(len(m.Contents))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Override) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Override) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Override) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.GoType != nil { - size, err := m.GoType.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.ColumnName) > 0 { - i -= len(m.ColumnName) - copy(dAtA[i:], m.ColumnName) - i = encodeVarint(dAtA, i, uint64(len(m.ColumnName))) - i-- - dAtA[i] = 0x42 - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if len(m.Column) > 0 { - i -= len(m.Column) - copy(dAtA[i:], m.Column) - i = encodeVarint(dAtA, i, uint64(len(m.Column))) - i-- - dAtA[i] = 0x32 - } - if m.Nullable { - i-- - if m.Nullable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if len(m.DbType) > 0 { - i -= len(m.DbType) - copy(dAtA[i:], m.DbType) - i = encodeVarint(dAtA, i, uint64(len(m.DbType))) - i-- - dAtA[i] = 0x1a - } - if len(m.CodeType) > 0 { - i -= len(m.CodeType) - copy(dAtA[i:], m.CodeType) - i = encodeVarint(dAtA, i, uint64(len(m.CodeType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ParsedGoType) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ParsedGoType) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ParsedGoType) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.StructTags) > 0 { - for k := range m.StructTags { - v := m.StructTags[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.BasicType { - i-- - if m.BasicType { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.TypeName) > 0 { - i -= len(m.TypeName) - copy(dAtA[i:], m.TypeName) - i = encodeVarint(dAtA, i, uint64(len(m.TypeName))) - i-- - dAtA[i] = 0x1a - } - if len(m.Package) > 0 { - i -= len(m.Package) - copy(dAtA[i:], m.Package) - i = encodeVarint(dAtA, i, uint64(len(m.Package))) - i-- - dAtA[i] = 0x12 - } - if len(m.ImportPath) > 0 { - i -= len(m.ImportPath) - copy(dAtA[i:], m.ImportPath) - i = encodeVarint(dAtA, i, uint64(len(m.ImportPath))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Settings) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settings) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Settings) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Codegen != nil { - size, err := m.Codegen.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.Overrides) > 0 { - for iNdEx := len(m.Overrides) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Overrides[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Rename) > 0 { - for k := range m.Rename { - v := m.Rename[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Queries[iNdEx]) - copy(dAtA[i:], m.Queries[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Queries[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Schema) > 0 { - for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Schema[iNdEx]) - copy(dAtA[i:], m.Schema[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Schema[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Engine) > 0 { - i -= len(m.Engine) - copy(dAtA[i:], m.Engine) - i = encodeVarint(dAtA, i, uint64(len(m.Engine))) - i-- - dAtA[i] = 0x12 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarint(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen_Process) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen_Process) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Codegen_Process) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Cmd) > 0 { - i -= len(m.Cmd) - copy(dAtA[i:], m.Cmd) - i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen_WASM) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen_WASM) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Codegen_WASM) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Sha256) > 0 { - i -= len(m.Sha256) - copy(dAtA[i:], m.Sha256) - i = encodeVarint(dAtA, i, uint64(len(m.Sha256))) - i-- - dAtA[i] = 0x12 - } - if len(m.Url) > 0 { - i -= len(m.Url) - copy(dAtA[i:], m.Url) - i = encodeVarint(dAtA, i, uint64(len(m.Url))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Codegen) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Wasm != nil { - size, err := m.Wasm.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - if m.Process != nil { - size, err := m.Process.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if len(m.Env) > 0 { - for iNdEx := len(m.Env) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Env[iNdEx]) - copy(dAtA[i:], m.Env[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Env[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarint(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x1a - } - if len(m.Plugin) > 0 { - i -= len(m.Plugin) - copy(dAtA[i:], m.Plugin) - i = encodeVarint(dAtA, i, uint64(len(m.Plugin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Catalog) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Catalog) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Catalog) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Schemas) > 0 { - for iNdEx := len(m.Schemas) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Schemas[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DefaultSchema) > 0 { - i -= len(m.DefaultSchema) - copy(dAtA[i:], m.DefaultSchema) - i = encodeVarint(dAtA, i, uint64(len(m.DefaultSchema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Schema) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Schema) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Schema) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.CompositeTypes) > 0 { - for iNdEx := len(m.CompositeTypes) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.CompositeTypes[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Enums) > 0 { - for iNdEx := len(m.Enums) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Enums[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Tables) > 0 { - for iNdEx := len(m.Tables) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Tables[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompositeType) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompositeType) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CompositeType) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Enum) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Enum) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Enum) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Vals) > 0 { - for iNdEx := len(m.Vals) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Vals[iNdEx]) - copy(dAtA[i:], m.Vals[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Vals[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Table) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Table) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Table) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - } - if m.Rel != nil { - size, err := m.Rel.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Identifier) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Identifier) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Identifier) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarint(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Catalog) > 0 { - i -= len(m.Catalog) - copy(dAtA[i:], m.Catalog) - i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Column) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Column) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Column) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ArrayDims != 0 { - i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.OriginalName) > 0 { - i -= len(m.OriginalName) - copy(dAtA[i:], m.OriginalName) - i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) - i-- - dAtA[i] = 0x7a - } - if m.EmbedTable != nil { - size, err := m.EmbedTable.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x72 - } - if m.IsSqlcSlice { - i-- - if m.IsSqlcSlice { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if m.Type != nil { - size, err := m.Type.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.TableAlias) > 0 { - i -= len(m.TableAlias) - copy(dAtA[i:], m.TableAlias) - i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) - i-- - dAtA[i] = 0x5a - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.Scope) > 0 { - i -= len(m.Scope) - copy(dAtA[i:], m.Scope) - i = encodeVarint(dAtA, i, uint64(len(m.Scope))) - i-- - dAtA[i] = 0x4a - } - if m.IsFuncCall { - i-- - if m.IsFuncCall { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.IsNamedParam { - i-- - if m.IsNamedParam { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Length != 0 { - i = encodeVarint(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x30 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x2a - } - if m.IsArray { - i-- - if m.IsArray { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.NotNull { - i-- - if m.NotNull { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Query) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Query) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Query) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.InsertIntoTable != nil { - size, err := m.InsertIntoTable.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if len(m.Filename) > 0 { - i -= len(m.Filename) - copy(dAtA[i:], m.Filename) - i = encodeVarint(dAtA, i, uint64(len(m.Filename))) - i-- - dAtA[i] = 0x3a - } - if len(m.Comments) > 0 { - for iNdEx := len(m.Comments) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Comments[iNdEx]) - copy(dAtA[i:], m.Comments[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Comments[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Params) > 0 { - for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Params[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Cmd) > 0 { - i -= len(m.Cmd) - copy(dAtA[i:], m.Cmd) - i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Text) > 0 { - i -= len(m.Text) - copy(dAtA[i:], m.Text) - i = encodeVarint(dAtA, i, uint64(len(m.Text))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Parameter) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Parameter) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Parameter) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Column != nil { - size, err := m.Column.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Number != 0 { - i = encodeVarint(dAtA, i, uint64(m.Number)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CodeGenRequest) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CodeGenRequest) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CodeGenRequest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PluginOptions) > 0 { - i -= len(m.PluginOptions) - copy(dAtA[i:], m.PluginOptions) - i = encodeVarint(dAtA, i, uint64(len(m.PluginOptions))) - i-- - dAtA[i] = 0x2a - } - if len(m.SqlcVersion) > 0 { - i -= len(m.SqlcVersion) - copy(dAtA[i:], m.SqlcVersion) - i = encodeVarint(dAtA, i, uint64(len(m.SqlcVersion))) - i-- - dAtA[i] = 0x22 - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Queries[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.Catalog != nil { - size, err := m.Catalog.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Settings != nil { - size, err := m.Settings.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CodeGenResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CodeGenResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CodeGenResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Files) > 0 { - for iNdEx := len(m.Files) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Files[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *File) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Contents) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Override) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CodeType) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.DbType) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Nullable { - n += 2 - } - l = len(m.Column) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Table != nil { - l = m.Table.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.ColumnName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.GoType != nil { - l = m.GoType.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Unsigned { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *ParsedGoType) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ImportPath) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Package) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.TypeName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.BasicType { - n += 2 - } - if len(m.StructTags) > 0 { - for k, v := range m.StructTags { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) - n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Settings) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Version) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Engine) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Schema) > 0 { - for _, s := range m.Schema { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Queries) > 0 { - for _, s := range m.Queries { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Rename) > 0 { - for k, v := range m.Rename { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) - n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) - } - } - if len(m.Overrides) > 0 { - for _, e := range m.Overrides { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if m.Codegen != nil { - l = m.Codegen.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Codegen_Process) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Cmd) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Codegen_WASM) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Url) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Sha256) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Codegen) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Out) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Plugin) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Options) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Env) > 0 { - for _, s := range m.Env { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - if m.Process != nil { - l = m.Process.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Wasm != nil { - l = m.Wasm.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Catalog) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.DefaultSchema) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Schemas) > 0 { - for _, e := range m.Schemas { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Schema) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Tables) > 0 { - for _, e := range m.Tables { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Enums) > 0 { - for _, e := range m.Enums { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.CompositeTypes) > 0 { - for _, e := range m.CompositeTypes { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *CompositeType) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Enum) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Vals) > 0 { - for _, s := range m.Vals { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Table) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Rel != nil { - l = m.Rel.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Identifier) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Catalog) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Schema) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Column) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.NotNull { - n += 2 - } - if m.IsArray { - n += 2 - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Length != 0 { - n += 1 + sov(uint64(m.Length)) - } - if m.IsNamedParam { - n += 2 - } - if m.IsFuncCall { - n += 2 - } - l = len(m.Scope) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Table != nil { - l = m.Table.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.TableAlias) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Type != nil { - l = m.Type.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.IsSqlcSlice { - n += 2 - } - if m.EmbedTable != nil { - l = m.EmbedTable.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.OriginalName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Unsigned { - n += 3 - } - if m.ArrayDims != 0 { - n += 2 + sov(uint64(m.ArrayDims)) - } - n += len(m.unknownFields) - return n -} - -func (m *Query) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Text) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Cmd) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Params) > 0 { - for _, e := range m.Params { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Comments) > 0 { - for _, s := range m.Comments { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Filename) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.InsertIntoTable != nil { - l = m.InsertIntoTable.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Parameter) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Number != 0 { - n += 1 + sov(uint64(m.Number)) - } - if m.Column != nil { - l = m.Column.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *CodeGenRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Settings != nil { - l = m.Settings.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Catalog != nil { - l = m.Catalog.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if len(m.Queries) > 0 { - for _, e := range m.Queries { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.SqlcVersion) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.PluginOptions) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *CodeGenResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Files) > 0 { - for _, e := range m.Files { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func sov(x uint64) (n int) { - return (bits.Len64(x|1) + 6) / 7 -} -func soz(x uint64) (n int) { - return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *File) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: File: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: File: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contents = append(m.Contents[:0], dAtA[iNdEx:postIndex]...) - if m.Contents == nil { - m.Contents = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Override) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Override: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Override: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CodeType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DbType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DbType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nullable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Nullable = bool(v != 0) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Column", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Column = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Table == nil { - m.Table = &Identifier{} - } - if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ColumnName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GoType", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.GoType == nil { - m.GoType = &ParsedGoType{} - } - if err := m.GoType.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Unsigned = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParsedGoType) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ParsedGoType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParsedGoType: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ImportPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ImportPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Package", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Package = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TypeName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BasicType", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BasicType = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StructTags", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StructTags == nil { - m.StructTags = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLength - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLength - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.StructTags[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Settings) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Settings: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Settings: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Engine", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Engine = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schema = append(m.Schema, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Queries", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Queries = append(m.Queries, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rename", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Rename == nil { - m.Rename = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLength - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLength - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Rename[mapkey] = mapvalue - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Overrides", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Overrides = append(m.Overrides, &Override{}) - if err := m.Overrides[len(m.Overrides)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Codegen", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Codegen == nil { - m.Codegen = &Codegen{} - } - if err := m.Codegen.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Codegen_Process) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Codegen_Process: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Codegen_Process: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cmd", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cmd = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Codegen_WASM) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Codegen_WASM: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Codegen_WASM: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Url", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Url = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sha256", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sha256 = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Codegen) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Codegen: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Codegen: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Out", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Out = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Plugin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Plugin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Options = append(m.Options[:0], dAtA[iNdEx:postIndex]...) - if m.Options == nil { - m.Options = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Env", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Env = append(m.Env, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Process", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Process == nil { - m.Process = &Codegen_Process{} - } - if err := m.Process.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Wasm", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Wasm == nil { - m.Wasm = &Codegen_WASM{} - } - if err := m.Wasm.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Catalog) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Catalog: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Catalog: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultSchema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DefaultSchema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schemas", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schemas = append(m.Schemas, &Schema{}) - if err := m.Schemas[len(m.Schemas)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Schema) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Schema: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Schema: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tables", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Tables = append(m.Tables, &Table{}) - if err := m.Tables[len(m.Tables)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Enums", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Enums = append(m.Enums, &Enum{}) - if err := m.Enums[len(m.Enums)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompositeTypes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CompositeTypes = append(m.CompositeTypes, &CompositeType{}) - if err := m.CompositeTypes[len(m.CompositeTypes)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompositeType) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompositeType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompositeType: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Enum) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Enum: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Enum: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Vals", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Vals = append(m.Vals, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Table) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Table: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Table: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rel", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Rel == nil { - m.Rel = &Identifier{} - } - if err := m.Rel.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Columns = append(m.Columns, &Column{}) - if err := m.Columns[len(m.Columns)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Identifier) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Identifier: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Identifier: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Catalog", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Catalog = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Column) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Column: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Column: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NotNull", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.NotNull = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsArray", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsArray = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsNamedParam", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsNamedParam = bool(v != 0) - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsFuncCall", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsFuncCall = bool(v != 0) - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Scope", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Scope = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Table == nil { - m.Table = &Identifier{} - } - if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TableAlias", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TableAlias = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Type == nil { - m.Type = &Identifier{} - } - if err := m.Type.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsSqlcSlice", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsSqlcSlice = bool(v != 0) - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EmbedTable", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.EmbedTable == nil { - m.EmbedTable = &Identifier{} - } - if err := m.EmbedTable.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginalName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OriginalName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Unsigned = bool(v != 0) - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ArrayDims", wireType) - } - m.ArrayDims = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ArrayDims |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Query) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Query: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Query: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Text = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cmd", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cmd = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Columns = append(m.Columns, &Column{}) - if err := m.Columns[len(m.Columns)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Params = append(m.Params, &Parameter{}) - if err := m.Params[len(m.Params)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comments", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Comments = append(m.Comments, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filename", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filename = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InsertIntoTable", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.InsertIntoTable == nil { - m.InsertIntoTable = &Identifier{} - } - if err := m.InsertIntoTable.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Parameter) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Parameter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Parameter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) - } - m.Number = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Number |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Column", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Column == nil { - m.Column = &Column{} - } - if err := m.Column.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CodeGenRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CodeGenRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CodeGenRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Settings", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Settings == nil { - m.Settings = &Settings{} - } - if err := m.Settings.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Catalog", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Catalog == nil { - m.Catalog = &Catalog{} - } - if err := m.Catalog.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Queries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Queries = append(m.Queries, &Query{}) - if err := m.Queries[len(m.Queries)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SqlcVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SqlcVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PluginOptions", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PluginOptions = append(m.PluginOptions[:0], dAtA[iNdEx:postIndex]...) - if m.PluginOptions == nil { - m.PluginOptions = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CodeGenResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CodeGenResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CodeGenResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Files", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Files = append(m.Files, &File{}) - if err := m.Files[len(m.Files)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func skip(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLength - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) diff --git a/internal/quickdb/mysql.go b/internal/quickdb/mysql.go new file mode 100644 index 0000000000..628b08c6bb --- /dev/null +++ b/internal/quickdb/mysql.go @@ -0,0 +1,16 @@ +package quickdb + +import ( + "fmt" + "net/url" +) + +// The database URI returned by the QuickDB service isn't understood by the +// go-mysql-driver +func MySQLReformatURI(original string) (string, error) { + u, err := url.Parse(original) + if err != nil { + return "", err + } + return fmt.Sprintf("%s@tcp(%s)%s?multiStatements=true&parseTime=true&tls=true", u.User, u.Host, u.Path), nil +} diff --git a/internal/quickdb/region.go b/internal/quickdb/region.go deleted file mode 100644 index 1900e33a14..0000000000 --- a/internal/quickdb/region.go +++ /dev/null @@ -1,19 +0,0 @@ -package quickdb - -import ( - "net/http" - "sync" -) - -var region string -var once sync.Once - -func GetClosestRegion() string { - once.Do(func() { - resp, err := http.Get("https://find-closest-db-region.sqlc.dev") - if err == nil { - region = resp.Header.Get("Region") - } - }) - return region -} diff --git a/internal/quickdb/rpc.go b/internal/quickdb/rpc.go index c1f9ffd4c2..9d9649d3dc 100644 --- a/internal/quickdb/rpc.go +++ b/internal/quickdb/rpc.go @@ -2,7 +2,6 @@ package quickdb import ( "crypto/tls" - "os" "github.com/riza-io/grpc-go/credentials/basic" "google.golang.org/grpc" @@ -10,14 +9,14 @@ import ( "github.com/sqlc-dev/sqlc/internal/config" pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" + "github.com/sqlc-dev/sqlc/internal/rpc" ) const defaultHostname = "grpc.sqlc.dev" func NewClientFromConfig(cloudConfig config.Cloud) (pb.QuickClient, error) { projectID := cloudConfig.Project - authToken := os.Getenv("SQLC_AUTH_TOKEN") - return NewClient(projectID, authToken, WithHost(cloudConfig.Hostname)) + return NewClient(projectID, cloudConfig.AuthToken, WithHost(cloudConfig.Hostname)) } type options struct { @@ -41,6 +40,7 @@ func NewClient(project, token string, opts ...Option) (pb.QuickClient, error) { dialOpts := []grpc.DialOption{ grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})), grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(project, token)), + grpc.WithUnaryInterceptor(rpc.UnaryInterceptor), } hostname := o.hostname diff --git a/internal/quickdb/v1/quickdb.pb.go b/internal/quickdb/v1/quickdb.pb.go index 34f4e1739c..690dfc16f1 100755 --- a/internal/quickdb/v1/quickdb.pb.go +++ b/internal/quickdb/v1/quickdb.pb.go @@ -1,16 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.21.7 -// source: proto/quickdb/v1/quickdb.proto +// protoc (unknown) +// source: v1/quickdb.proto -package v1 +package quickdbv1 import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -38,7 +34,7 @@ type CreateEphemeralDatabaseRequest struct { func (x *CreateEphemeralDatabaseRequest) Reset() { *x = CreateEphemeralDatabaseRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[0] + mi := &file_v1_quickdb_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -51,7 +47,7 @@ func (x *CreateEphemeralDatabaseRequest) String() string { func (*CreateEphemeralDatabaseRequest) ProtoMessage() {} func (x *CreateEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[0] + mi := &file_v1_quickdb_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -64,7 +60,7 @@ func (x *CreateEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateEphemeralDatabaseRequest.ProtoReflect.Descriptor instead. func (*CreateEphemeralDatabaseRequest) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{0} + return file_v1_quickdb_proto_rawDescGZIP(), []int{0} } func (x *CreateEphemeralDatabaseRequest) GetRegion() string { @@ -107,7 +103,7 @@ type CreateEphemeralDatabaseResponse struct { func (x *CreateEphemeralDatabaseResponse) Reset() { *x = CreateEphemeralDatabaseResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[1] + mi := &file_v1_quickdb_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120,7 +116,7 @@ func (x *CreateEphemeralDatabaseResponse) String() string { func (*CreateEphemeralDatabaseResponse) ProtoMessage() {} func (x *CreateEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[1] + mi := &file_v1_quickdb_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -133,7 +129,7 @@ func (x *CreateEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateEphemeralDatabaseResponse.ProtoReflect.Descriptor instead. func (*CreateEphemeralDatabaseResponse) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{1} + return file_v1_quickdb_proto_rawDescGZIP(), []int{1} } func (x *CreateEphemeralDatabaseResponse) GetDatabaseId() string { @@ -161,7 +157,7 @@ type DropEphemeralDatabaseRequest struct { func (x *DropEphemeralDatabaseRequest) Reset() { *x = DropEphemeralDatabaseRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[2] + mi := &file_v1_quickdb_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -174,7 +170,7 @@ func (x *DropEphemeralDatabaseRequest) String() string { func (*DropEphemeralDatabaseRequest) ProtoMessage() {} func (x *DropEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[2] + mi := &file_v1_quickdb_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -187,7 +183,7 @@ func (x *DropEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DropEphemeralDatabaseRequest.ProtoReflect.Descriptor instead. func (*DropEphemeralDatabaseRequest) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{2} + return file_v1_quickdb_proto_rawDescGZIP(), []int{2} } func (x *DropEphemeralDatabaseRequest) GetDatabaseId() string { @@ -206,7 +202,7 @@ type DropEphemeralDatabaseResponse struct { func (x *DropEphemeralDatabaseResponse) Reset() { *x = DropEphemeralDatabaseResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[3] + mi := &file_v1_quickdb_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -219,7 +215,7 @@ func (x *DropEphemeralDatabaseResponse) String() string { func (*DropEphemeralDatabaseResponse) ProtoMessage() {} func (x *DropEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[3] + mi := &file_v1_quickdb_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -232,7 +228,7 @@ func (x *DropEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DropEphemeralDatabaseResponse.ProtoReflect.Descriptor instead. func (*DropEphemeralDatabaseResponse) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{3} + return file_v1_quickdb_proto_rawDescGZIP(), []int{3} } type File struct { @@ -247,7 +243,7 @@ type File struct { func (x *File) Reset() { *x = File{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[4] + mi := &file_v1_quickdb_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -260,7 +256,7 @@ func (x *File) String() string { func (*File) ProtoMessage() {} func (x *File) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[4] + mi := &file_v1_quickdb_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -273,7 +269,7 @@ func (x *File) ProtoReflect() protoreflect.Message { // Deprecated: Use File.ProtoReflect.Descriptor instead. func (*File) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{4} + return file_v1_quickdb_proto_rawDescGZIP(), []int{4} } func (x *File) GetName() string { @@ -290,20 +286,95 @@ func (x *File) GetContents() []byte { return nil } +type QuerySet struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Schema []*File `protobuf:"bytes,2,rep,name=schema,proto3" json:"schema,omitempty"` + Queries []*File `protobuf:"bytes,3,rep,name=queries,proto3" json:"queries,omitempty"` + CodegenRequest *File `protobuf:"bytes,4,opt,name=codegen_request,json=codegenRequest,proto3" json:"codegen_request,omitempty"` +} + +func (x *QuerySet) Reset() { + *x = QuerySet{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuerySet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuerySet) ProtoMessage() {} + +func (x *QuerySet) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QuerySet.ProtoReflect.Descriptor instead. +func (*QuerySet) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{5} +} + +func (x *QuerySet) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *QuerySet) GetSchema() []*File { + if x != nil { + return x.Schema + } + return nil +} + +func (x *QuerySet) GetQueries() []*File { + if x != nil { + return x.Queries + } + return nil +} + +func (x *QuerySet) GetCodegenRequest() *File { + if x != nil { + return x.CodegenRequest + } + return nil +} + type UploadArchiveRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SqlcVersion string `protobuf:"bytes,1,opt,name=sqlc_version,json=sqlcVersion,proto3" json:"sqlc_version,omitempty"` - Inputs []*File `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` - Outputs []*File `protobuf:"bytes,3,rep,name=outputs,proto3" json:"outputs,omitempty"` + SqlcVersion string `protobuf:"bytes,1,opt,name=sqlc_version,json=sqlcVersion,proto3" json:"sqlc_version,omitempty"` + Inputs []*File `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` // deprecated + Outputs []*File `protobuf:"bytes,3,rep,name=outputs,proto3" json:"outputs,omitempty"` // deprecated + Annotations map[string]string `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + QuerySets []*QuerySet `protobuf:"bytes,5,rep,name=query_sets,json=querySets,proto3" json:"query_sets,omitempty"` + Config *File `protobuf:"bytes,6,opt,name=config,proto3" json:"config,omitempty"` + Tags []string `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty"` } func (x *UploadArchiveRequest) Reset() { *x = UploadArchiveRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[5] + mi := &file_v1_quickdb_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -316,7 +387,7 @@ func (x *UploadArchiveRequest) String() string { func (*UploadArchiveRequest) ProtoMessage() {} func (x *UploadArchiveRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[5] + mi := &file_v1_quickdb_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -329,7 +400,7 @@ func (x *UploadArchiveRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UploadArchiveRequest.ProtoReflect.Descriptor instead. func (*UploadArchiveRequest) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{5} + return file_v1_quickdb_proto_rawDescGZIP(), []int{6} } func (x *UploadArchiveRequest) GetSqlcVersion() string { @@ -353,6 +424,34 @@ func (x *UploadArchiveRequest) GetOutputs() []*File { return nil } +func (x *UploadArchiveRequest) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *UploadArchiveRequest) GetQuerySets() []*QuerySet { + if x != nil { + return x.QuerySets + } + return nil +} + +func (x *UploadArchiveRequest) GetConfig() *File { + if x != nil { + return x.Config + } + return nil +} + +func (x *UploadArchiveRequest) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + type UploadArchiveResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -364,7 +463,7 @@ type UploadArchiveResponse struct { func (x *UploadArchiveResponse) Reset() { *x = UploadArchiveResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[6] + mi := &file_v1_quickdb_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -377,7 +476,7 @@ func (x *UploadArchiveResponse) String() string { func (*UploadArchiveResponse) ProtoMessage() {} func (x *UploadArchiveResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_quickdb_v1_quickdb_proto_msgTypes[6] + mi := &file_v1_quickdb_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -390,7 +489,7 @@ func (x *UploadArchiveResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UploadArchiveResponse.ProtoReflect.Descriptor instead. func (*UploadArchiveResponse) Descriptor() ([]byte, []int) { - return file_proto_quickdb_v1_quickdb_proto_rawDescGZIP(), []int{6} + return file_v1_quickdb_proto_rawDescGZIP(), []int{7} } func (x *UploadArchiveResponse) GetChecksum() []byte { @@ -400,125 +499,484 @@ func (x *UploadArchiveResponse) GetChecksum() []byte { return nil } -var File_proto_quickdb_v1_quickdb_proto protoreflect.FileDescriptor - -var file_proto_quickdb_v1_quickdb_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2f, - 0x76, 0x31, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x1a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x22, 0x8d, 0x01, 0x0a, - 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, - 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, - 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, - 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x54, 0x0a, 0x1f, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, - 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x49, 0x64, - 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, - 0x72, 0x69, 0x22, 0x3f, 0x0a, 0x1c, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, - 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, - 0x65, 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, - 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xaf, 0x01, 0x0a, - 0x14, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x71, 0x6c, - 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x06, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, - 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, - 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, - 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x33, - 0x0a, 0x15, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x32, 0xa1, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x12, 0x92, 0x01, - 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, - 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x3a, 0x2e, 0x72, 0x65, 0x6d, 0x6f, - 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, - 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, +type VerifyQuerySetsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SqlcVersion string `protobuf:"bytes,1,opt,name=sqlc_version,json=sqlcVersion,proto3" json:"sqlc_version,omitempty"` + QuerySets []*QuerySet `protobuf:"bytes,2,rep,name=query_sets,json=querySets,proto3" json:"query_sets,omitempty"` + Config *File `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"` + Annotations map[string]string `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Against string `protobuf:"bytes,5,opt,name=against,proto3" json:"against,omitempty"` +} + +func (x *VerifyQuerySetsRequest) Reset() { + *x = VerifyQuerySetsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifyQuerySetsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyQuerySetsRequest) ProtoMessage() {} + +func (x *VerifyQuerySetsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyQuerySetsRequest.ProtoReflect.Descriptor instead. +func (*VerifyQuerySetsRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{8} +} + +func (x *VerifyQuerySetsRequest) GetSqlcVersion() string { + if x != nil { + return x.SqlcVersion + } + return "" +} + +func (x *VerifyQuerySetsRequest) GetQuerySets() []*QuerySet { + if x != nil { + return x.QuerySets + } + return nil +} + +func (x *VerifyQuerySetsRequest) GetConfig() *File { + if x != nil { + return x.Config + } + return nil +} + +func (x *VerifyQuerySetsRequest) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *VerifyQuerySetsRequest) GetAgainst() string { + if x != nil { + return x.Against + } + return "" +} + +type VerifyQuerySetsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Errored bool `protobuf:"varint,1,opt,name=errored,proto3" json:"errored,omitempty"` + Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` + Summary string `protobuf:"bytes,3,opt,name=summary,proto3" json:"summary,omitempty"` +} + +func (x *VerifyQuerySetsResponse) Reset() { + *x = VerifyQuerySetsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifyQuerySetsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyQuerySetsResponse) ProtoMessage() {} + +func (x *VerifyQuerySetsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyQuerySetsResponse.ProtoReflect.Descriptor instead. +func (*VerifyQuerySetsResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{9} +} + +func (x *VerifyQuerySetsResponse) GetErrored() bool { + if x != nil { + return x.Errored + } + return false +} + +func (x *VerifyQuerySetsResponse) GetOutput() string { + if x != nil { + return x.Output + } + return "" +} + +func (x *VerifyQuerySetsResponse) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +type GetQuerySetsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` +} + +func (x *GetQuerySetsRequest) Reset() { + *x = GetQuerySetsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetQuerySetsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetQuerySetsRequest) ProtoMessage() {} + +func (x *GetQuerySetsRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetQuerySetsRequest.ProtoReflect.Descriptor instead. +func (*GetQuerySetsRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{10} +} + +func (x *GetQuerySetsRequest) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +type GetQuerySetsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + QuerySets []*QuerySet `protobuf:"bytes,1,rep,name=query_sets,json=querySets,proto3" json:"query_sets,omitempty"` +} + +func (x *GetQuerySetsResponse) Reset() { + *x = GetQuerySetsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetQuerySetsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetQuerySetsResponse) ProtoMessage() {} + +func (x *GetQuerySetsResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetQuerySetsResponse.ProtoReflect.Descriptor instead. +func (*GetQuerySetsResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{11} +} + +func (x *GetQuerySetsResponse) GetQuerySets() []*QuerySet { + if x != nil { + return x.QuerySets + } + return nil +} + +var File_v1_quickdb_proto protoreflect.FileDescriptor + +var file_v1_quickdb_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x1a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x22, 0x8d, + 0x01, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, + 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x67, + 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, + 0x0a, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x54, + 0x0a, 0x1f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, + 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x75, 0x72, 0x69, 0x22, 0x3f, 0x0a, 0x1c, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, + 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x62, + 0x61, 0x73, 0x65, 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, - 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, - 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x8c, 0x01, 0x0a, 0x15, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, - 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x38, 0x2e, 0x72, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xdf, + 0x01, 0x0a, 0x08, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x38, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3a, 0x0a, 0x07, 0x71, 0x75, 0x65, + 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, + 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x71, 0x75, + 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x0f, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x52, 0x0e, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0xe7, 0x03, 0x0a, 0x14, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x71, 0x6c, + 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x73, 0x71, 0x6c, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x06, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, - 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, - 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, - 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, - 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, - 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x74, 0x0a, 0x0d, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, - 0x76, 0x65, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, + 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, + 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x73, 0x12, 0x63, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, + 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x43, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, + 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, + 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, + 0x74, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x12, 0x38, 0x0a, 0x06, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, + 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x33, 0x0a, 0x15, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x22, + 0xfb, 0x02, 0x0a, 0x16, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, + 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x71, + 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x73, 0x71, 0x6c, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, + 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, + 0x74, 0x73, 0x12, 0x38, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, - 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, - 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x65, 0x0a, 0x0b, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x43, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x67, 0x61, 0x69, 0x6e, 0x73, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x67, 0x61, 0x69, 0x6e, 0x73, 0x74, 0x1a, 0x3e, 0x0a, + 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x65, 0x0a, + 0x17, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, + 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, + 0x6d, 0x61, 0x72, 0x79, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, + 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x5b, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, + 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, + 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x52, + 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x32, 0x90, 0x05, 0x0a, 0x05, 0x51, + 0x75, 0x69, 0x63, 0x6b, 0x12, 0x92, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, + 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0x12, 0x3a, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, + 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, + 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x72, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, + 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8c, 0x01, 0x0a, 0x15, 0x44, 0x72, + 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, + 0x61, 0x73, 0x65, 0x12, 0x38, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, + 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, + 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, + 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, + 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x45, + 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x0d, 0x55, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, + 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x72, 0x63, + 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, + 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, + 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, + 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, + 0x73, 0x12, 0x32, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, + 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, + 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x0c, 0x47, 0x65, + 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x74, 0x73, 0x12, 0x2f, 0x2e, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, + 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, + 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xeb, 0x01, + 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, + 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x2e, 0x76, 0x31, + 0x42, 0x0c, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, + 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x71, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x76, 0x31, + 0xa2, 0x02, 0x04, 0x52, 0x53, 0x44, 0x51, 0xaa, 0x02, 0x1a, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x2e, 0x53, 0x71, 0x6c, 0x63, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, + 0x62, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1a, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5c, 0x53, 0x71, + 0x6c, 0x63, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x5c, 0x56, + 0x31, 0xe2, 0x02, 0x26, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5c, 0x53, 0x71, 0x6c, 0x63, 0x5c, + 0x44, 0x65, 0x76, 0x5c, 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1e, 0x52, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x3a, 0x3a, 0x53, 0x71, 0x6c, 0x63, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, + 0x51, 0x75, 0x69, 0x63, 0x6b, 0x64, 0x62, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_proto_quickdb_v1_quickdb_proto_rawDescOnce sync.Once - file_proto_quickdb_v1_quickdb_proto_rawDescData = file_proto_quickdb_v1_quickdb_proto_rawDesc + file_v1_quickdb_proto_rawDescOnce sync.Once + file_v1_quickdb_proto_rawDescData = file_v1_quickdb_proto_rawDesc ) -func file_proto_quickdb_v1_quickdb_proto_rawDescGZIP() []byte { - file_proto_quickdb_v1_quickdb_proto_rawDescOnce.Do(func() { - file_proto_quickdb_v1_quickdb_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_quickdb_v1_quickdb_proto_rawDescData) +func file_v1_quickdb_proto_rawDescGZIP() []byte { + file_v1_quickdb_proto_rawDescOnce.Do(func() { + file_v1_quickdb_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_quickdb_proto_rawDescData) }) - return file_proto_quickdb_v1_quickdb_proto_rawDescData + return file_v1_quickdb_proto_rawDescData } -var file_proto_quickdb_v1_quickdb_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_proto_quickdb_v1_quickdb_proto_goTypes = []interface{}{ +var file_v1_quickdb_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_v1_quickdb_proto_goTypes = []interface{}{ (*CreateEphemeralDatabaseRequest)(nil), // 0: remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseRequest (*CreateEphemeralDatabaseResponse)(nil), // 1: remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseResponse (*DropEphemeralDatabaseRequest)(nil), // 2: remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseRequest (*DropEphemeralDatabaseResponse)(nil), // 3: remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseResponse (*File)(nil), // 4: remote.sqlc.dev.quickdb.v1.File - (*UploadArchiveRequest)(nil), // 5: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest - (*UploadArchiveResponse)(nil), // 6: remote.sqlc.dev.quickdb.v1.UploadArchiveResponse -} -var file_proto_quickdb_v1_quickdb_proto_depIdxs = []int32{ - 4, // 0: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.inputs:type_name -> remote.sqlc.dev.quickdb.v1.File - 4, // 1: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.outputs:type_name -> remote.sqlc.dev.quickdb.v1.File - 0, // 2: remote.sqlc.dev.quickdb.v1.Quick.CreateEphemeralDatabase:input_type -> remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseRequest - 2, // 3: remote.sqlc.dev.quickdb.v1.Quick.DropEphemeralDatabase:input_type -> remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseRequest - 5, // 4: remote.sqlc.dev.quickdb.v1.Quick.UploadArchive:input_type -> remote.sqlc.dev.quickdb.v1.UploadArchiveRequest - 1, // 5: remote.sqlc.dev.quickdb.v1.Quick.CreateEphemeralDatabase:output_type -> remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseResponse - 3, // 6: remote.sqlc.dev.quickdb.v1.Quick.DropEphemeralDatabase:output_type -> remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseResponse - 6, // 7: remote.sqlc.dev.quickdb.v1.Quick.UploadArchive:output_type -> remote.sqlc.dev.quickdb.v1.UploadArchiveResponse - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_proto_quickdb_v1_quickdb_proto_init() } -func file_proto_quickdb_v1_quickdb_proto_init() { - if File_proto_quickdb_v1_quickdb_proto != nil { + (*QuerySet)(nil), // 5: remote.sqlc.dev.quickdb.v1.QuerySet + (*UploadArchiveRequest)(nil), // 6: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest + (*UploadArchiveResponse)(nil), // 7: remote.sqlc.dev.quickdb.v1.UploadArchiveResponse + (*VerifyQuerySetsRequest)(nil), // 8: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest + (*VerifyQuerySetsResponse)(nil), // 9: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsResponse + (*GetQuerySetsRequest)(nil), // 10: remote.sqlc.dev.quickdb.v1.GetQuerySetsRequest + (*GetQuerySetsResponse)(nil), // 11: remote.sqlc.dev.quickdb.v1.GetQuerySetsResponse + nil, // 12: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.AnnotationsEntry + nil, // 13: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.AnnotationsEntry +} +var file_v1_quickdb_proto_depIdxs = []int32{ + 4, // 0: remote.sqlc.dev.quickdb.v1.QuerySet.schema:type_name -> remote.sqlc.dev.quickdb.v1.File + 4, // 1: remote.sqlc.dev.quickdb.v1.QuerySet.queries:type_name -> remote.sqlc.dev.quickdb.v1.File + 4, // 2: remote.sqlc.dev.quickdb.v1.QuerySet.codegen_request:type_name -> remote.sqlc.dev.quickdb.v1.File + 4, // 3: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.inputs:type_name -> remote.sqlc.dev.quickdb.v1.File + 4, // 4: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.outputs:type_name -> remote.sqlc.dev.quickdb.v1.File + 12, // 5: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.annotations:type_name -> remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.AnnotationsEntry + 5, // 6: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.query_sets:type_name -> remote.sqlc.dev.quickdb.v1.QuerySet + 4, // 7: remote.sqlc.dev.quickdb.v1.UploadArchiveRequest.config:type_name -> remote.sqlc.dev.quickdb.v1.File + 5, // 8: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.query_sets:type_name -> remote.sqlc.dev.quickdb.v1.QuerySet + 4, // 9: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.config:type_name -> remote.sqlc.dev.quickdb.v1.File + 13, // 10: remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.annotations:type_name -> remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest.AnnotationsEntry + 5, // 11: remote.sqlc.dev.quickdb.v1.GetQuerySetsResponse.query_sets:type_name -> remote.sqlc.dev.quickdb.v1.QuerySet + 0, // 12: remote.sqlc.dev.quickdb.v1.Quick.CreateEphemeralDatabase:input_type -> remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseRequest + 2, // 13: remote.sqlc.dev.quickdb.v1.Quick.DropEphemeralDatabase:input_type -> remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseRequest + 6, // 14: remote.sqlc.dev.quickdb.v1.Quick.UploadArchive:input_type -> remote.sqlc.dev.quickdb.v1.UploadArchiveRequest + 8, // 15: remote.sqlc.dev.quickdb.v1.Quick.VerifyQuerySets:input_type -> remote.sqlc.dev.quickdb.v1.VerifyQuerySetsRequest + 10, // 16: remote.sqlc.dev.quickdb.v1.Quick.GetQuerySets:input_type -> remote.sqlc.dev.quickdb.v1.GetQuerySetsRequest + 1, // 17: remote.sqlc.dev.quickdb.v1.Quick.CreateEphemeralDatabase:output_type -> remote.sqlc.dev.quickdb.v1.CreateEphemeralDatabaseResponse + 3, // 18: remote.sqlc.dev.quickdb.v1.Quick.DropEphemeralDatabase:output_type -> remote.sqlc.dev.quickdb.v1.DropEphemeralDatabaseResponse + 7, // 19: remote.sqlc.dev.quickdb.v1.Quick.UploadArchive:output_type -> remote.sqlc.dev.quickdb.v1.UploadArchiveResponse + 9, // 20: remote.sqlc.dev.quickdb.v1.Quick.VerifyQuerySets:output_type -> remote.sqlc.dev.quickdb.v1.VerifyQuerySetsResponse + 11, // 21: remote.sqlc.dev.quickdb.v1.Quick.GetQuerySets:output_type -> remote.sqlc.dev.quickdb.v1.GetQuerySetsResponse + 17, // [17:22] is the sub-list for method output_type + 12, // [12:17] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_v1_quickdb_proto_init() } +func file_v1_quickdb_proto_init() { + if File_v1_quickdb_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_proto_quickdb_v1_quickdb_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateEphemeralDatabaseRequest); i { case 0: return &v.state @@ -530,7 +988,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreateEphemeralDatabaseResponse); i { case 0: return &v.state @@ -542,7 +1000,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DropEphemeralDatabaseRequest); i { case 0: return &v.state @@ -554,7 +1012,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DropEphemeralDatabaseResponse); i { case 0: return &v.state @@ -566,7 +1024,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*File); i { case 0: return &v.state @@ -578,7 +1036,19 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QuerySet); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UploadArchiveRequest); i { case 0: return &v.state @@ -590,7 +1060,7 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } - file_proto_quickdb_v1_quickdb_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_v1_quickdb_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UploadArchiveResponse); i { case 0: return &v.state @@ -602,175 +1072,71 @@ func file_proto_quickdb_v1_quickdb_proto_init() { return nil } } + file_v1_quickdb_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyQuerySetsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyQuerySetsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetQuerySetsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetQuerySetsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_quickdb_v1_quickdb_proto_rawDesc, + RawDescriptor: file_v1_quickdb_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_proto_quickdb_v1_quickdb_proto_goTypes, - DependencyIndexes: file_proto_quickdb_v1_quickdb_proto_depIdxs, - MessageInfos: file_proto_quickdb_v1_quickdb_proto_msgTypes, + GoTypes: file_v1_quickdb_proto_goTypes, + DependencyIndexes: file_v1_quickdb_proto_depIdxs, + MessageInfos: file_v1_quickdb_proto_msgTypes, }.Build() - File_proto_quickdb_v1_quickdb_proto = out.File - file_proto_quickdb_v1_quickdb_proto_rawDesc = nil - file_proto_quickdb_v1_quickdb_proto_goTypes = nil - file_proto_quickdb_v1_quickdb_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// QuickClient is the client API for Quick service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QuickClient interface { - CreateEphemeralDatabase(ctx context.Context, in *CreateEphemeralDatabaseRequest, opts ...grpc.CallOption) (*CreateEphemeralDatabaseResponse, error) - DropEphemeralDatabase(ctx context.Context, in *DropEphemeralDatabaseRequest, opts ...grpc.CallOption) (*DropEphemeralDatabaseResponse, error) - UploadArchive(ctx context.Context, in *UploadArchiveRequest, opts ...grpc.CallOption) (*UploadArchiveResponse, error) -} - -type quickClient struct { - cc grpc.ClientConnInterface -} - -func NewQuickClient(cc grpc.ClientConnInterface) QuickClient { - return &quickClient{cc} -} - -func (c *quickClient) CreateEphemeralDatabase(ctx context.Context, in *CreateEphemeralDatabaseRequest, opts ...grpc.CallOption) (*CreateEphemeralDatabaseResponse, error) { - out := new(CreateEphemeralDatabaseResponse) - err := c.cc.Invoke(ctx, "/remote.sqlc.dev.quickdb.v1.Quick/CreateEphemeralDatabase", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *quickClient) DropEphemeralDatabase(ctx context.Context, in *DropEphemeralDatabaseRequest, opts ...grpc.CallOption) (*DropEphemeralDatabaseResponse, error) { - out := new(DropEphemeralDatabaseResponse) - err := c.cc.Invoke(ctx, "/remote.sqlc.dev.quickdb.v1.Quick/DropEphemeralDatabase", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *quickClient) UploadArchive(ctx context.Context, in *UploadArchiveRequest, opts ...grpc.CallOption) (*UploadArchiveResponse, error) { - out := new(UploadArchiveResponse) - err := c.cc.Invoke(ctx, "/remote.sqlc.dev.quickdb.v1.Quick/UploadArchive", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QuickServer is the server API for Quick service. -type QuickServer interface { - CreateEphemeralDatabase(context.Context, *CreateEphemeralDatabaseRequest) (*CreateEphemeralDatabaseResponse, error) - DropEphemeralDatabase(context.Context, *DropEphemeralDatabaseRequest) (*DropEphemeralDatabaseResponse, error) - UploadArchive(context.Context, *UploadArchiveRequest) (*UploadArchiveResponse, error) -} - -// UnimplementedQuickServer can be embedded to have forward compatible implementations. -type UnimplementedQuickServer struct { -} - -func (*UnimplementedQuickServer) CreateEphemeralDatabase(context.Context, *CreateEphemeralDatabaseRequest) (*CreateEphemeralDatabaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateEphemeralDatabase not implemented") -} -func (*UnimplementedQuickServer) DropEphemeralDatabase(context.Context, *DropEphemeralDatabaseRequest) (*DropEphemeralDatabaseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DropEphemeralDatabase not implemented") -} -func (*UnimplementedQuickServer) UploadArchive(context.Context, *UploadArchiveRequest) (*UploadArchiveResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UploadArchive not implemented") -} - -func RegisterQuickServer(s *grpc.Server, srv QuickServer) { - s.RegisterService(&_Quick_serviceDesc, srv) -} - -func _Quick_CreateEphemeralDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateEphemeralDatabaseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickServer).CreateEphemeralDatabase(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/remote.sqlc.dev.quickdb.v1.Quick/CreateEphemeralDatabase", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickServer).CreateEphemeralDatabase(ctx, req.(*CreateEphemeralDatabaseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Quick_DropEphemeralDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DropEphemeralDatabaseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickServer).DropEphemeralDatabase(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/remote.sqlc.dev.quickdb.v1.Quick/DropEphemeralDatabase", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickServer).DropEphemeralDatabase(ctx, req.(*DropEphemeralDatabaseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Quick_UploadArchive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UploadArchiveRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QuickServer).UploadArchive(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/remote.sqlc.dev.quickdb.v1.Quick/UploadArchive", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QuickServer).UploadArchive(ctx, req.(*UploadArchiveRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Quick_serviceDesc = grpc.ServiceDesc{ - ServiceName: "remote.sqlc.dev.quickdb.v1.Quick", - HandlerType: (*QuickServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateEphemeralDatabase", - Handler: _Quick_CreateEphemeralDatabase_Handler, - }, - { - MethodName: "DropEphemeralDatabase", - Handler: _Quick_DropEphemeralDatabase_Handler, - }, - { - MethodName: "UploadArchive", - Handler: _Quick_UploadArchive_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/quickdb/v1/quickdb.proto", + File_v1_quickdb_proto = out.File + file_v1_quickdb_proto_rawDesc = nil + file_v1_quickdb_proto_goTypes = nil + file_v1_quickdb_proto_depIdxs = nil } diff --git a/internal/quickdb/v1/quickdb_grpc.pb.go b/internal/quickdb/v1/quickdb_grpc.pb.go new file mode 100644 index 0000000000..f8f4a131fc --- /dev/null +++ b/internal/quickdb/v1/quickdb_grpc.pb.go @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: v1/quickdb.proto + +package quickdbv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Quick_CreateEphemeralDatabase_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/CreateEphemeralDatabase" + Quick_DropEphemeralDatabase_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/DropEphemeralDatabase" + Quick_UploadArchive_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/UploadArchive" + Quick_VerifyQuerySets_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/VerifyQuerySets" + Quick_GetQuerySets_FullMethodName = "/remote.sqlc.dev.quickdb.v1.Quick/GetQuerySets" +) + +// QuickClient is the client API for Quick service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type QuickClient interface { + CreateEphemeralDatabase(ctx context.Context, in *CreateEphemeralDatabaseRequest, opts ...grpc.CallOption) (*CreateEphemeralDatabaseResponse, error) + DropEphemeralDatabase(ctx context.Context, in *DropEphemeralDatabaseRequest, opts ...grpc.CallOption) (*DropEphemeralDatabaseResponse, error) + UploadArchive(ctx context.Context, in *UploadArchiveRequest, opts ...grpc.CallOption) (*UploadArchiveResponse, error) + VerifyQuerySets(ctx context.Context, in *VerifyQuerySetsRequest, opts ...grpc.CallOption) (*VerifyQuerySetsResponse, error) + GetQuerySets(ctx context.Context, in *GetQuerySetsRequest, opts ...grpc.CallOption) (*GetQuerySetsResponse, error) +} + +type quickClient struct { + cc grpc.ClientConnInterface +} + +func NewQuickClient(cc grpc.ClientConnInterface) QuickClient { + return &quickClient{cc} +} + +func (c *quickClient) CreateEphemeralDatabase(ctx context.Context, in *CreateEphemeralDatabaseRequest, opts ...grpc.CallOption) (*CreateEphemeralDatabaseResponse, error) { + out := new(CreateEphemeralDatabaseResponse) + err := c.cc.Invoke(ctx, Quick_CreateEphemeralDatabase_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quickClient) DropEphemeralDatabase(ctx context.Context, in *DropEphemeralDatabaseRequest, opts ...grpc.CallOption) (*DropEphemeralDatabaseResponse, error) { + out := new(DropEphemeralDatabaseResponse) + err := c.cc.Invoke(ctx, Quick_DropEphemeralDatabase_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quickClient) UploadArchive(ctx context.Context, in *UploadArchiveRequest, opts ...grpc.CallOption) (*UploadArchiveResponse, error) { + out := new(UploadArchiveResponse) + err := c.cc.Invoke(ctx, Quick_UploadArchive_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quickClient) VerifyQuerySets(ctx context.Context, in *VerifyQuerySetsRequest, opts ...grpc.CallOption) (*VerifyQuerySetsResponse, error) { + out := new(VerifyQuerySetsResponse) + err := c.cc.Invoke(ctx, Quick_VerifyQuerySets_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quickClient) GetQuerySets(ctx context.Context, in *GetQuerySetsRequest, opts ...grpc.CallOption) (*GetQuerySetsResponse, error) { + out := new(GetQuerySetsResponse) + err := c.cc.Invoke(ctx, Quick_GetQuerySets_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QuickServer is the server API for Quick service. +// All implementations must embed UnimplementedQuickServer +// for forward compatibility +type QuickServer interface { + CreateEphemeralDatabase(context.Context, *CreateEphemeralDatabaseRequest) (*CreateEphemeralDatabaseResponse, error) + DropEphemeralDatabase(context.Context, *DropEphemeralDatabaseRequest) (*DropEphemeralDatabaseResponse, error) + UploadArchive(context.Context, *UploadArchiveRequest) (*UploadArchiveResponse, error) + VerifyQuerySets(context.Context, *VerifyQuerySetsRequest) (*VerifyQuerySetsResponse, error) + GetQuerySets(context.Context, *GetQuerySetsRequest) (*GetQuerySetsResponse, error) + mustEmbedUnimplementedQuickServer() +} + +// UnimplementedQuickServer must be embedded to have forward compatible implementations. +type UnimplementedQuickServer struct { +} + +func (UnimplementedQuickServer) CreateEphemeralDatabase(context.Context, *CreateEphemeralDatabaseRequest) (*CreateEphemeralDatabaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateEphemeralDatabase not implemented") +} +func (UnimplementedQuickServer) DropEphemeralDatabase(context.Context, *DropEphemeralDatabaseRequest) (*DropEphemeralDatabaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DropEphemeralDatabase not implemented") +} +func (UnimplementedQuickServer) UploadArchive(context.Context, *UploadArchiveRequest) (*UploadArchiveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UploadArchive not implemented") +} +func (UnimplementedQuickServer) VerifyQuerySets(context.Context, *VerifyQuerySetsRequest) (*VerifyQuerySetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VerifyQuerySets not implemented") +} +func (UnimplementedQuickServer) GetQuerySets(context.Context, *GetQuerySetsRequest) (*GetQuerySetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetQuerySets not implemented") +} +func (UnimplementedQuickServer) mustEmbedUnimplementedQuickServer() {} + +// UnsafeQuickServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to QuickServer will +// result in compilation errors. +type UnsafeQuickServer interface { + mustEmbedUnimplementedQuickServer() +} + +func RegisterQuickServer(s grpc.ServiceRegistrar, srv QuickServer) { + s.RegisterService(&Quick_ServiceDesc, srv) +} + +func _Quick_CreateEphemeralDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateEphemeralDatabaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).CreateEphemeralDatabase(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_CreateEphemeralDatabase_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).CreateEphemeralDatabase(ctx, req.(*CreateEphemeralDatabaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Quick_DropEphemeralDatabase_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DropEphemeralDatabaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).DropEphemeralDatabase(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_DropEphemeralDatabase_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).DropEphemeralDatabase(ctx, req.(*DropEphemeralDatabaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Quick_UploadArchive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UploadArchiveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).UploadArchive(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_UploadArchive_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).UploadArchive(ctx, req.(*UploadArchiveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Quick_VerifyQuerySets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyQuerySetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).VerifyQuerySets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_VerifyQuerySets_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).VerifyQuerySets(ctx, req.(*VerifyQuerySetsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Quick_GetQuerySets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetQuerySetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuickServer).GetQuerySets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Quick_GetQuerySets_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuickServer).GetQuerySets(ctx, req.(*GetQuerySetsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Quick_ServiceDesc is the grpc.ServiceDesc for Quick service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Quick_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "remote.sqlc.dev.quickdb.v1.Quick", + HandlerType: (*QuickServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateEphemeralDatabase", + Handler: _Quick_CreateEphemeralDatabase_Handler, + }, + { + MethodName: "DropEphemeralDatabase", + Handler: _Quick_DropEphemeralDatabase_Handler, + }, + { + MethodName: "UploadArchive", + Handler: _Quick_UploadArchive_Handler, + }, + { + MethodName: "VerifyQuerySets", + Handler: _Quick_VerifyQuerySets_Handler, + }, + { + MethodName: "GetQuerySets", + Handler: _Quick_GetQuerySets_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v1/quickdb.proto", +} diff --git a/internal/remote/gen.pb.go b/internal/remote/gen.pb.go deleted file mode 100644 index bba3d16444..0000000000 --- a/internal/remote/gen.pb.go +++ /dev/null @@ -1,340 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.0 -// protoc v3.21.0 -// source: internal/remote/gen.proto - -package remote - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type GenerateRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Inputs []*File `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` -} - -func (x *GenerateRequest) Reset() { - *x = GenerateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_internal_remote_gen_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenerateRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenerateRequest) ProtoMessage() {} - -func (x *GenerateRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_remote_gen_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead. -func (*GenerateRequest) Descriptor() ([]byte, []int) { - return file_internal_remote_gen_proto_rawDescGZIP(), []int{0} -} - -func (x *GenerateRequest) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *GenerateRequest) GetInputs() []*File { - if x != nil { - return x.Inputs - } - return nil -} - -type GenerateResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Outputs []*File `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty"` - ExitCode int64 `protobuf:"varint,2,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"` - Stdout []byte `protobuf:"bytes,3,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr []byte `protobuf:"bytes,4,opt,name=stderr,proto3" json:"stderr,omitempty"` -} - -func (x *GenerateResponse) Reset() { - *x = GenerateResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_internal_remote_gen_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenerateResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenerateResponse) ProtoMessage() {} - -func (x *GenerateResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_remote_gen_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead. -func (*GenerateResponse) Descriptor() ([]byte, []int) { - return file_internal_remote_gen_proto_rawDescGZIP(), []int{1} -} - -func (x *GenerateResponse) GetOutputs() []*File { - if x != nil { - return x.Outputs - } - return nil -} - -func (x *GenerateResponse) GetExitCode() int64 { - if x != nil { - return x.ExitCode - } - return 0 -} - -func (x *GenerateResponse) GetStdout() []byte { - if x != nil { - return x.Stdout - } - return nil -} - -func (x *GenerateResponse) GetStderr() []byte { - if x != nil { - return x.Stderr - } - return nil -} - -type File struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - Bytes []byte `protobuf:"bytes,3,opt,name=bytes,proto3" json:"bytes,omitempty"` -} - -func (x *File) Reset() { - *x = File{} - if protoimpl.UnsafeEnabled { - mi := &file_internal_remote_gen_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *File) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*File) ProtoMessage() {} - -func (x *File) ProtoReflect() protoreflect.Message { - mi := &file_internal_remote_gen_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use File.ProtoReflect.Descriptor instead. -func (*File) Descriptor() ([]byte, []int) { - return file_internal_remote_gen_proto_rawDescGZIP(), []int{2} -} - -func (x *File) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *File) GetContentType() string { - if x != nil { - return x.ContentType - } - return "" -} - -func (x *File) GetBytes() []byte { - if x != nil { - return x.Bytes - } - return nil -} - -var File_internal_remote_gen_proto protoreflect.FileDescriptor - -var file_internal_remote_gen_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, - 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x72, 0x65, 0x6d, - 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x47, 0x65, 0x6e, - 0x2e, 0x76, 0x31, 0x22, 0x61, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x34, 0x0a, 0x06, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, - 0x65, 0x76, 0x2e, 0x47, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x06, - 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x22, 0x97, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, - 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x47, - 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x06, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x65, - 0x72, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, - 0x22, 0x53, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x21, 0x0a, 0x0c, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x62, 0x79, 0x74, 0x65, 0x73, 0x32, 0x64, 0x0a, 0x03, 0x47, 0x65, 0x6e, 0x12, 0x5d, 0x0a, 0x08, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, - 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x47, 0x65, 0x6e, 0x2e, 0x76, - 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x28, 0x2e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x2e, 0x73, 0x71, 0x6c, 0x63, 0x2e, - 0x64, 0x65, 0x76, 0x2e, 0x47, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_internal_remote_gen_proto_rawDescOnce sync.Once - file_internal_remote_gen_proto_rawDescData = file_internal_remote_gen_proto_rawDesc -) - -func file_internal_remote_gen_proto_rawDescGZIP() []byte { - file_internal_remote_gen_proto_rawDescOnce.Do(func() { - file_internal_remote_gen_proto_rawDescData = protoimpl.X.CompressGZIP(file_internal_remote_gen_proto_rawDescData) - }) - return file_internal_remote_gen_proto_rawDescData -} - -var file_internal_remote_gen_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_internal_remote_gen_proto_goTypes = []interface{}{ - (*GenerateRequest)(nil), // 0: remote.sqlc.dev.Gen.v1.GenerateRequest - (*GenerateResponse)(nil), // 1: remote.sqlc.dev.Gen.v1.GenerateResponse - (*File)(nil), // 2: remote.sqlc.dev.Gen.v1.File -} -var file_internal_remote_gen_proto_depIdxs = []int32{ - 2, // 0: remote.sqlc.dev.Gen.v1.GenerateRequest.inputs:type_name -> remote.sqlc.dev.Gen.v1.File - 2, // 1: remote.sqlc.dev.Gen.v1.GenerateResponse.outputs:type_name -> remote.sqlc.dev.Gen.v1.File - 0, // 2: remote.sqlc.dev.Gen.v1.Gen.Generate:input_type -> remote.sqlc.dev.Gen.v1.GenerateRequest - 1, // 3: remote.sqlc.dev.Gen.v1.Gen.Generate:output_type -> remote.sqlc.dev.Gen.v1.GenerateResponse - 3, // [3:4] is the sub-list for method output_type - 2, // [2:3] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_internal_remote_gen_proto_init() } -func file_internal_remote_gen_proto_init() { - if File_internal_remote_gen_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_internal_remote_gen_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenerateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_internal_remote_gen_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenerateResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_internal_remote_gen_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*File); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_internal_remote_gen_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_internal_remote_gen_proto_goTypes, - DependencyIndexes: file_internal_remote_gen_proto_depIdxs, - MessageInfos: file_internal_remote_gen_proto_msgTypes, - }.Build() - File_internal_remote_gen_proto = out.File - file_internal_remote_gen_proto_rawDesc = nil - file_internal_remote_gen_proto_goTypes = nil - file_internal_remote_gen_proto_depIdxs = nil -} diff --git a/internal/remote/gen.proto b/internal/remote/gen.proto deleted file mode 100644 index dc85465154..0000000000 --- a/internal/remote/gen.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; - -package remote.sqlc.dev.Gen.v1; - -service Gen { - rpc Generate(GenerateRequest) returns (GenerateResponse); -} - -message GenerateRequest { - string version = 1; - repeated File inputs = 2; -} - -message GenerateResponse { - repeated File outputs = 1; - int32 exit_code = 2; - bytes stdout = 3; - bytes stderr = 4; -} - -message File { - string path = 1; - string content_type = 2; - bytes bytes = 3; -} \ No newline at end of file diff --git a/internal/remote/gen_grpc.pb.go b/internal/remote/gen_grpc.pb.go deleted file mode 100644 index a2fb3d76a0..0000000000 --- a/internal/remote/gen_grpc.pb.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.0 -// source: internal/remote/gen.proto - -package remote - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// GenClient is the client API for Gen service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type GenClient interface { - Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) -} - -type genClient struct { - cc grpc.ClientConnInterface -} - -func NewGenClient(cc grpc.ClientConnInterface) GenClient { - return &genClient{cc} -} - -func (c *genClient) Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) { - out := new(GenerateResponse) - err := c.cc.Invoke(ctx, "/remote.sqlc.dev.Gen.v1.Gen/Generate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// GenServer is the server API for Gen service. -// All implementations must embed UnimplementedGenServer -// for forward compatibility -type GenServer interface { - Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) - mustEmbedUnimplementedGenServer() -} - -// UnimplementedGenServer must be embedded to have forward compatible implementations. -type UnimplementedGenServer struct { -} - -func (UnimplementedGenServer) Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Generate not implemented") -} -func (UnimplementedGenServer) mustEmbedUnimplementedGenServer() {} - -// UnsafeGenServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to GenServer will -// result in compilation errors. -type UnsafeGenServer interface { - mustEmbedUnimplementedGenServer() -} - -func RegisterGenServer(s grpc.ServiceRegistrar, srv GenServer) { - s.RegisterService(&Gen_ServiceDesc, srv) -} - -func _Gen_Generate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GenerateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(GenServer).Generate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/remote.sqlc.dev.Gen.v1.Gen/Generate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(GenServer).Generate(ctx, req.(*GenerateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Gen_ServiceDesc is the grpc.ServiceDesc for Gen service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Gen_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "remote.sqlc.dev.Gen.v1.Gen", - HandlerType: (*GenServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Generate", - Handler: _Gen_Generate_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "internal/remote/gen.proto", -} diff --git a/internal/remote/rpc.go b/internal/remote/rpc.go deleted file mode 100644 index d7b8556454..0000000000 --- a/internal/remote/rpc.go +++ /dev/null @@ -1,35 +0,0 @@ -package remote - -import ( - "crypto/tls" - "os" - - "github.com/riza-io/grpc-go/credentials/basic" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - - "github.com/sqlc-dev/sqlc/internal/config" -) - -const defaultHostname = "remote.sqlc.dev" - -func NewClient(cloudConfig config.Cloud) (GenClient, error) { - authID := cloudConfig.Organization + "/" + cloudConfig.Project - authToken := os.Getenv("SQLC_AUTH_TOKEN") - opts := []grpc.DialOption{ - grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})), - grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(authID, authToken)), - } - - hostname := cloudConfig.Hostname - if hostname == "" { - hostname = defaultHostname - } - - conn, err := grpc.Dial(hostname+":443", opts...) - if err != nil { - return nil, err - } - - return NewGenClient(conn), nil -} diff --git a/internal/rpc/errors.go b/internal/rpc/errors.go new file mode 100644 index 0000000000..80953343f8 --- /dev/null +++ b/internal/rpc/errors.go @@ -0,0 +1,13 @@ +package rpc + +import ( + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +const errMessageUnauthenticated = `rpc authentication failed + +You may be using a sqlc auth token that was created for a different project, +or your auth token may have expired.` + +var ErrUnauthenticated = status.New(codes.Unauthenticated, errMessageUnauthenticated).Err() diff --git a/internal/rpc/interceptor.go b/internal/rpc/interceptor.go new file mode 100644 index 0000000000..6d8dc798b1 --- /dev/null +++ b/internal/rpc/interceptor.go @@ -0,0 +1,22 @@ +package rpc + +import ( + "context" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func UnaryInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + err := invoker(ctx, method, req, reply, cc, opts...) + + switch status.Convert(err).Code() { + case codes.OK: + return nil + case codes.Unauthenticated: + return ErrUnauthenticated + default: + return err + } +} diff --git a/internal/shfmt/shfmt.go b/internal/shfmt/shfmt.go index a3f1c5bbff..88f3074b71 100644 --- a/internal/shfmt/shfmt.go +++ b/internal/shfmt/shfmt.go @@ -1,16 +1,38 @@ package shfmt import ( + "os" "regexp" "strings" ) var pat = regexp.MustCompile(`\$\{[A-Z_]+\}`) -func Replace(f string, vars map[string]string) string { +type Replacer struct { + envmap map[string]string +} + +func (r *Replacer) Replace(f string) string { return pat.ReplaceAllStringFunc(f, func(s string) string { s = strings.TrimPrefix(s, "${") s = strings.TrimSuffix(s, "}") - return vars[s] + return r.envmap[s] }) } + +func NewReplacer(env []string) *Replacer { + r := Replacer{ + envmap: map[string]string{}, + } + if env == nil { + env = os.Environ() + } + for _, e := range env { + k, v, _ := strings.Cut(e, "=") + if k == "SQLC_AUTH_TOKEN" { + continue + } + r.envmap[k] = v + } + return &r +} diff --git a/internal/shfmt/shfmt_test.go b/internal/shfmt/shfmt_test.go index ce5c29ea5a..cf99ed220b 100644 --- a/internal/shfmt/shfmt_test.go +++ b/internal/shfmt/shfmt_test.go @@ -4,14 +4,14 @@ import "testing" func TestReplace(t *testing.T) { s := "POSTGRES_SQL://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/AUTHORS" - env := map[string]string{ - "PG_USER": "user", - "PG_PASSWORD": "password", - "PG_HOST": "host", - "PG_PORT": "port", - } + r := NewReplacer([]string{ + "PG_USER=user", + "PG_PASSWORD=password", + "PG_HOST=host", + "PG_PORT=port", + }) e := "POSTGRES_SQL://user:password@host:port/AUTHORS" - if v := Replace(s, env); v != e { + if v := r.Replace(s); v != e { t.Errorf("%s != %s", v, e) } } diff --git a/internal/source/code.go b/internal/source/code.go index f34e3e3684..4ad14f0676 100644 --- a/internal/source/code.go +++ b/internal/source/code.go @@ -15,6 +15,12 @@ type Edit struct { OldFunc func(string) int } +type CommentSyntax struct { + Dash bool + Hash bool + SlashStar bool +} + func LineNumber(source string, head int) (int, int) { // Calculate the true line and column number for a query, ignoring spaces var comment bool @@ -101,17 +107,65 @@ func StripComments(sql string) (string, []string, error) { if strings.HasPrefix(t, "/* name:") && strings.HasSuffix(t, "*/") { continue } - if strings.HasPrefix(t, "--") { - comments = append(comments, strings.TrimPrefix(t, "--")) + if strings.HasPrefix(t, "# name:") { + continue + } + if after, ok := strings.CutPrefix(t, "--"); ok { + comments = append(comments, after) continue } if strings.HasPrefix(t, "/*") && strings.HasSuffix(t, "*/") { + // Preserve MySQL optimizer hints, which share block-comment + // syntax but are semantically part of the query. + if strings.HasPrefix(t, "/*+") { + lines = append(lines, t) + continue + } t = strings.TrimPrefix(t, "/*") t = strings.TrimSuffix(t, "*/") comments = append(comments, t) continue } + if after, ok := strings.CutPrefix(t, "#"); ok { + comments = append(comments, after) + continue + } lines = append(lines, t) } return strings.Join(lines, "\n"), comments, s.Err() } + +func CleanedComments(rawSQL string, cs CommentSyntax) ([]string, error) { + s := bufio.NewScanner(strings.NewReader(strings.TrimSpace(rawSQL))) + var comments []string + for s.Scan() { + line := s.Text() + var prefix string + if strings.HasPrefix(line, "--") { + if !cs.Dash { + continue + } + prefix = "--" + } + if strings.HasPrefix(line, "/*") { + if !cs.SlashStar { + continue + } + prefix = "/*" + } + if strings.HasPrefix(line, "#") { + if !cs.Hash { + continue + } + prefix = "#" + } + if prefix == "" { + continue + } + + rest := line[len(prefix):] + rest = strings.TrimSuffix(rest, "*/") + comments = append(comments, rest) + } + return comments, s.Err() +} diff --git a/internal/sql/ast/CLAUDE.md b/internal/sql/ast/CLAUDE.md new file mode 100644 index 0000000000..3c5d3381c2 --- /dev/null +++ b/internal/sql/ast/CLAUDE.md @@ -0,0 +1,169 @@ +# AST Package - Claude Code Guide + +This package defines the Abstract Syntax Tree (AST) nodes used by sqlc to represent SQL statements across all supported databases (PostgreSQL, MySQL, SQLite). + +## Key Concepts + +### Node Interface +All AST nodes implement the `Node` interface with: +- `Pos() int` - returns the source position +- `Format(buf *TrackedBuffer, d format.Dialect)` - formats the node back to SQL + +### TrackedBuffer +The `TrackedBuffer` type (`print.go`) handles SQL formatting with dialect-specific behavior: +- `astFormat(node Node)` - formats any AST node +- `join(list *List, sep string)` - joins list items with separator +- `WriteString(s string)` - writes raw SQL +- `QuoteIdent(name string)` - quotes identifiers (dialect-specific) +- `TypeName(ns, name string)` - formats type names (dialect-specific) + +### Pretty printing +The doc renderer lives in `ast/printer` (`printer.Buffer`), which knows +nothing about AST nodes; `TrackedBuffer` embeds it and adds the +AST-facing layer (`astFormat`, comment emission, anchors). +`TrackedBuffer` records a Wadler-style document (the model behind Prettier +and ruff): Format methods emit text plus layout tokens, and the renderer +decides which break opportunities become newlines. + +- `Line()` - a space when the group fits on one line, a newline otherwise +- `Softline()` - nothing when the group fits, a newline otherwise +- `Group()` / `EndGroup()` - a region laid out flat when its width fits +- `Indent()` / `EndIndent()` - one level deeper (2 spaces) after breaks +- `Breaker()` - forces every enclosing group to break (measures as + infinitely wide) +- `joinComma(list)` - joins items with `,` + `Line()` +- `condition(node)` - clause-level AND/OR chain without outer parentheses, + one branch per line when broken + +`ast.Format(n, d)` renders on a single line (all breaks collapse); +`ast.Pretty(n, d, width)` breaks lines to fit `width` columns. Statement +Format methods open a group and put `Line()` before each clause keyword +(`FROM`, `WHERE`, ...), so a statement that fits stays on one line and a +long one breaks at clause boundaries. When adding a Format method, write +tokens so the flat rendering is correct SQL; layout tokens are optional. + +The fmt command does not pass a real width: like gofmt it never rewraps +on its own, so it prints with an effectively infinite width and defers +to the author's line breaks instead. `AttachComments` records, for each +emission-point marker, whether its neighbouring printed nodes sat on +different source lines; when they did, `boundary()` emits a `Breaker()` +there on the real print, so the group the author broke stays broken and +everything else stays flat. + +### Comments +`ast.File{Stmts, Comments}` is what a comment-surfacing parser returns +(SQLite via meyer's ParseFile). `AttachComments(raw, d, comments, src)` +classifies each comment once, against a dry-run of the printer: source +positions and line numbers decide trailing (same line as the code +before) vs leading, and each comment is attached to the emission point +— node or clause/list boundary — where the printer will reach it. From +then on positions are never consulted: `PrettyWithComments(n, d, width, +table)` emits by node identity, which is what lets edited or synthetic +trees print their comments correctly (the dave/dst model; each record +also keeps the node the comment followed, for future rewriting tools). +A line comment forces every enclosing group to break — `hardline` and +`breaker` tokens measure as infinitely wide — so commented statements +format instead of collapsing. Emission points (`beforeClause`, +`boundary` in joinComma/condition) double as classification markers on +the dry run, guaranteeing attach-time decisions and print-time emission +agree. + +### Dialect Interface +Dialect-specific formatting is handled via the `Dialect` interface: +```go +type Dialect interface { + QuoteIdent(string) string + TypeName(ns, name string) string + Param(int) string // $1 for PostgreSQL, ? for MySQL + NamedParam(string) string // @name for PostgreSQL, :name for SQLite + Cast(string) string +} +``` + +## Adding New AST Nodes + +When adding a new AST node type: + +1. **Create the node file** (e.g., `variable_expr.go`): +```go +package ast + +type VariableExpr struct { + Name string + Location int +} + +func (n *VariableExpr) Pos() int { + return n.Location +} + +func (n *VariableExpr) Format(buf *TrackedBuffer) { + if n == nil { + return + } + buf.WriteString("@") + buf.WriteString(n.Name) +} +``` + +2. **Add to `astutils/walk.go`** - Add a case in the Walk function: +```go +case *ast.VariableExpr: + // Leaf node - no children to traverse +``` + +3. **Add to `astutils/rewrite.go`** - Add a case in the Apply function: +```go +case *ast.VariableExpr: + // Leaf node - no children to traverse +``` + +4. **Update the parser/converter** - In the relevant engine (e.g., `dolphin/convert.go` for MySQL) + +## Helper Functions for Format Methods + +- `set(node Node) bool` - returns true if node is non-nil and not an empty List +- `items(list *List) bool` - returns true if list has items +- `todo(node) Node` - placeholder for unimplemented conversions (returns nil) + +## Common Node Types + +### Statements +- `SelectStmt` - SELECT queries with FromClause, WhereClause, etc. +- `InsertStmt` - INSERT with Relation, Cols, SelectStmt, OnConflictClause +- `UpdateStmt` - UPDATE with Relations, TargetList, WhereClause +- `DeleteStmt` - DELETE with Relations, FromClause (for JOINs), Targets + +### Expressions +- `A_Expr` - General expression with operator (e.g., `a + b`, `@param`) +- `ColumnRef` - Column reference with Fields list +- `FuncCall` - Function call with Func, Args, aggregation options +- `TypeCast` - Type cast with Arg and TypeName +- `ParenExpr` - Parenthesized expression +- `VariableExpr` - MySQL user variable (e.g., `@user_id`) + +### Table References +- `RangeVar` - Table reference with schema, name, alias +- `JoinExpr` - JOIN with Larg, Rarg, Jointype, Quals/UsingClause + +## MySQL-Specific Nodes + +- `VariableExpr` - User variables (`@var`), distinct from sqlc's `@param` syntax +- `IntervalExpr` - INTERVAL expressions +- `OnDuplicateKeyUpdate` - MySQL's ON DUPLICATE KEY UPDATE clause +- `ParenExpr` - Explicit parentheses (TiDB parser wraps expressions) + +## Important Distinctions + +### MySQL @variable vs sqlc @param +- sqlc named parameters (`@param`) never reach the AST: `internal/sql/preprocess` + replaces them with the dialect's native placeholder before parsing, so engines + only ever see a `ParamRef` +- `@name` is only sqlc syntax where the preprocessor's dialect says so. MySQL is + excluded, so `@user_id` there stays a user variable (`VariableExpr`) + +### Type Modifiers +- `TypeName.Typmods` holds type modifiers like `varchar(255)` +- For MySQL, only populate Typmods for types where length is user-specified: + - VARCHAR, CHAR, VARBINARY, BINARY - need length + - DATETIME, TIMESTAMP, DATE - internal flen should NOT be output diff --git a/internal/sql/ast/a_array_expr.go b/internal/sql/ast/a_array_expr.go index dafa0e8e85..ed11abf998 100644 --- a/internal/sql/ast/a_array_expr.go +++ b/internal/sql/ast/a_array_expr.go @@ -1,10 +1,23 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_ArrayExpr struct { - Elements *List - Location int + Tag NodeTag[A_ArrayExpr] `json:"tag"` + + Elements *List `json:"elements,omitempty"` + Location int `json:"location"` } func (n *A_ArrayExpr) Pos() int { return n.Location } + +func (n *A_ArrayExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("ARRAY[") + buf.join(n.Elements, d, ", ") + buf.WriteString("]") +} diff --git a/internal/sql/ast/a_const.go b/internal/sql/ast/a_const.go index ec1d780945..0f507d99e3 100644 --- a/internal/sql/ast/a_const.go +++ b/internal/sql/ast/a_const.go @@ -1,23 +1,27 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_Const struct { - Val Node - Location int + Tag NodeTag[A_Const] `json:"tag"` + + Val Node `json:"val,omitempty"` + Location int `json:"location"` } func (n *A_Const) Pos() int { return n.Location } -func (n *A_Const) Format(buf *TrackedBuffer) { +func (n *A_Const) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } if _, ok := n.Val.(*String); ok { buf.WriteString("'") - buf.astFormat(n.Val) + buf.astFormat(n.Val, d) buf.WriteString("'") } else { - buf.astFormat(n.Val) + buf.astFormat(n.Val, d) } } diff --git a/internal/sql/ast/a_expr.go b/internal/sql/ast/a_expr.go index b0b7f75367..1327467cf5 100644 --- a/internal/sql/ast/a_expr.go +++ b/internal/sql/ast/a_expr.go @@ -1,34 +1,178 @@ package ast +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + type A_Expr struct { - Kind A_Expr_Kind - Name *List - Lexpr Node - Rexpr Node - Location int + Tag NodeTag[A_Expr] `json:"tag"` + + Kind A_Expr_Kind `json:"kind"` + // Name is the operator, as a list of String nodes: PostgreSQL's + // operator space is open (user-defined and schema-qualified operators), + // so the shared tree keeps pg_query's shape rather than an enum. Each + // engine's converter writes the operator as its parser saw it — for an + // engine that accepts more than one spelling of the same operator + // (SQLite's != for <>, == for =), that is the author's spelling, which + // is how the printer preserves it. + Name *List `json:"name,omitempty"` + Lexpr Node `json:"lexpr,omitempty"` + Rexpr Node `json:"rexpr,omitempty"` + Location int `json:"location"` } func (n *A_Expr) Pos() int { return n.Location } -func (n *A_Expr) Format(buf *TrackedBuffer) { +// isNamedParam reports whether this A_Expr represents a named parameter, +// returning its sigil and name. Engines encode a named parameter as a +// prefix pseudo-operator carrying the sigil the author wrote (@name for +// most engines; SQLite also spells :name and $name). The spellings mean +// different things to sqlc, so the printer emits the one it was given. +func (n *A_Expr) isNamedParam() (sigil, name string, ok bool) { + if n.Name == nil || len(n.Name.Items) != 1 { + return "", "", false + } + s, sok := n.Name.Items[0].(*String) + if !sok || (s.Str != "@" && s.Str != ":" && s.Str != "$") { + return "", "", false + } + if set(n.Lexpr) || !set(n.Rexpr) { + return "", "", false + } + if nameStr, sok := n.Rexpr.(*String); sok { + return s.Str, nameStr.Str, true + } + // Before the compiler rewrites named parameters, @name parses as the @ + // operator applied to a bare column reference. + if col, sok := n.Rexpr.(*ColumnRef); sok && col.Fields != nil && len(col.Fields.Items) == 1 { + if f, sok := col.Fields.Items[0].(*String); sok { + return s.Str, f.Str, true + } + } + return "", "", false +} + +// gluePrefix reports that this prefix expression must print with no space +// between the operator and its operand. `@name::type` is a sqlc named +// parameter with a cast: the cast binds tighter than the operator, so the +// parse is @ applied to a TypeCast and isNamedParam does not see it — but +// `@ name::type` would break the parameter apart for sqlc's scanner. Glue +// the sigils onto any operand that starts with an identifier, which also +// keeps a genuine prefix operator like pg's absolute-value @ meaning the +// same thing. +func (n *A_Expr) gluePrefix() bool { + if set(n.Lexpr) || n.Name == nil || len(n.Name.Items) != 1 { + return false + } + s, ok := n.Name.Items[0].(*String) + if !ok || (s.Str != "@" && s.Str != ":" && s.Str != "$") { + return false + } + operand := n.Rexpr + if tc, ok := operand.(*TypeCast); ok { + operand = tc.Arg + } + switch operand.(type) { + case *ColumnRef, *FuncCall: + return true + } + return false +} + +// negated returns true when the expression's operator carries the negated +// spelling of a pattern-match operator (e.g. "!~~" for NOT LIKE). +func (n *A_Expr) negated() bool { + if n.Name == nil || len(n.Name.Items) != 1 { + return false + } + s, ok := n.Name.Items[0].(*String) + return ok && strings.HasPrefix(s.Str, "!") +} + +func (n *A_Expr) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.astFormat(n.Lexpr) - buf.WriteString(" ") + + // Check for named parameter first (works regardless of Kind) + if sigil, name, ok := n.isNamedParam(); ok { + buf.WriteString(sigil) + buf.WriteString(name) + return + } + switch n.Kind { case A_Expr_Kind_IN: + buf.astFormat(n.Lexpr, d) buf.WriteString(" IN (") - buf.astFormat(n.Rexpr) + buf.astFormat(n.Rexpr, d) buf.WriteString(")") case A_Expr_Kind_LIKE: - buf.WriteString(" LIKE ") - buf.astFormat(n.Rexpr) + buf.astFormat(n.Lexpr, d) + if n.negated() { + buf.WriteString(" NOT LIKE ") + } else { + buf.WriteString(" LIKE ") + } + buf.astFormat(n.Rexpr, d) + case A_Expr_Kind_ILIKE: + buf.astFormat(n.Lexpr, d) + if n.negated() { + buf.WriteString(" NOT ILIKE ") + } else { + buf.WriteString(" ILIKE ") + } + buf.astFormat(n.Rexpr, d) + case A_Expr_Kind_SIMILAR: + buf.astFormat(n.Lexpr, d) + buf.WriteString(" SIMILAR TO ") + buf.astFormat(n.Rexpr, d) + case A_Expr_Kind_BETWEEN: + buf.astFormat(n.Lexpr, d) + buf.WriteString(" BETWEEN ") + if l, ok := n.Rexpr.(*List); ok && len(l.Items) == 2 { + buf.astFormat(l.Items[0], d) + buf.WriteString(" AND ") + buf.astFormat(l.Items[1], d) + } + case A_Expr_Kind_NOT_BETWEEN: + buf.astFormat(n.Lexpr, d) + buf.WriteString(" NOT BETWEEN ") + if l, ok := n.Rexpr.(*List); ok && len(l.Items) == 2 { + buf.astFormat(l.Items[0], d) + buf.WriteString(" AND ") + buf.astFormat(l.Items[1], d) + } + case A_Expr_Kind_DISTINCT: + buf.astFormat(n.Lexpr, d) + buf.WriteString(" IS DISTINCT FROM ") + buf.astFormat(n.Rexpr, d) + case A_Expr_Kind_NOT_DISTINCT: + buf.astFormat(n.Lexpr, d) + buf.WriteString(" IS NOT DISTINCT FROM ") + buf.astFormat(n.Rexpr, d) + case A_Expr_Kind_NULLIF: + buf.WriteString("NULLIF(") + buf.astFormat(n.Lexpr, d) + buf.WriteString(", ") + buf.astFormat(n.Rexpr, d) + buf.WriteString(")") default: - buf.astFormat(n.Name) - buf.WriteString(" ") - buf.astFormat(n.Rexpr) + // Standard operator (including A_Expr_Kind_OP) + if set(n.Lexpr) { + buf.astFormat(n.Lexpr, d) + buf.WriteString(" ") + } + buf.astFormat(n.Name, d) + if set(n.Rexpr) { + if !n.gluePrefix() { + buf.WriteString(" ") + } + buf.astFormat(n.Rexpr, d) + } } } diff --git a/internal/sql/ast/a_expr_kind.go b/internal/sql/ast/a_expr_kind.go index 53a237896b..3adc9232cf 100644 --- a/internal/sql/ast/a_expr_kind.go +++ b/internal/sql/ast/a_expr_kind.go @@ -3,8 +3,20 @@ package ast type A_Expr_Kind uint const ( - A_Expr_Kind_IN A_Expr_Kind = 7 - A_Expr_Kind_LIKE A_Expr_Kind = 8 + A_Expr_Kind_OP A_Expr_Kind = 1 + A_Expr_Kind_OP_ANY A_Expr_Kind = 2 + A_Expr_Kind_OP_ALL A_Expr_Kind = 3 + A_Expr_Kind_DISTINCT A_Expr_Kind = 4 + A_Expr_Kind_NOT_DISTINCT A_Expr_Kind = 5 + A_Expr_Kind_NULLIF A_Expr_Kind = 6 + A_Expr_Kind_IN A_Expr_Kind = 7 + A_Expr_Kind_LIKE A_Expr_Kind = 8 + A_Expr_Kind_ILIKE A_Expr_Kind = 9 + A_Expr_Kind_SIMILAR A_Expr_Kind = 10 + A_Expr_Kind_BETWEEN A_Expr_Kind = 11 + A_Expr_Kind_NOT_BETWEEN A_Expr_Kind = 12 + A_Expr_Kind_BETWEEN_SYM A_Expr_Kind = 13 + A_Expr_Kind_NOT_BETWEEN_SYM A_Expr_Kind = 14 ) func (n *A_Expr_Kind) Pos() int { diff --git a/internal/sql/ast/a_indices.go b/internal/sql/ast/a_indices.go index 8972f3a556..2f7715e8c7 100644 --- a/internal/sql/ast/a_indices.go +++ b/internal/sql/ast/a_indices.go @@ -1,11 +1,34 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_Indices struct { - IsSlice bool - Lidx Node - Uidx Node + Tag NodeTag[A_Indices] `json:"tag"` + + IsSlice bool `json:"is_slice"` + Lidx Node `json:"lidx,omitempty"` + Uidx Node `json:"uidx,omitempty"` } func (n *A_Indices) Pos() int { return 0 } + +func (n *A_Indices) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("[") + if n.IsSlice { + if set(n.Lidx) { + buf.astFormat(n.Lidx, d) + } + buf.WriteString(":") + if set(n.Uidx) { + buf.astFormat(n.Uidx, d) + } + } else { + buf.astFormat(n.Uidx, d) + } + buf.WriteString("]") +} diff --git a/internal/sql/ast/a_indirection.go b/internal/sql/ast/a_indirection.go index b03b4621a9..df682bb285 100644 --- a/internal/sql/ast/a_indirection.go +++ b/internal/sql/ast/a_indirection.go @@ -1,8 +1,10 @@ package ast type A_Indirection struct { - Arg Node - Indirection *List + Tag NodeTag[A_Indirection] `json:"tag"` + + Arg Node `json:"arg,omitempty"` + Indirection *List `json:"indirection,omitempty"` } func (n *A_Indirection) Pos() int { diff --git a/internal/sql/ast/a_star.go b/internal/sql/ast/a_star.go index a43b2ab5b7..c95d7c0b51 100644 --- a/internal/sql/ast/a_star.go +++ b/internal/sql/ast/a_star.go @@ -1,13 +1,16 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type A_Star struct { + Tag NodeTag[A_Star] `json:"tag"` } func (n *A_Star) Pos() int { return 0 } -func (n *A_Star) Format(buf *TrackedBuffer) { +func (n *A_Star) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/access_priv.go b/internal/sql/ast/access_priv.go index 8701adacdb..ab16946db3 100644 --- a/internal/sql/ast/access_priv.go +++ b/internal/sql/ast/access_priv.go @@ -1,8 +1,10 @@ package ast type AccessPriv struct { - PrivName *string - Cols *List + Tag NodeTag[AccessPriv] `json:"tag"` + + PrivName *string `json:"priv_name,omitempty"` + Cols *List `json:"cols,omitempty"` } func (n *AccessPriv) Pos() int { diff --git a/internal/sql/ast/aggref.go b/internal/sql/ast/aggref.go index c4fa9af7e5..f9c8a0833a 100644 --- a/internal/sql/ast/aggref.go +++ b/internal/sql/ast/aggref.go @@ -1,24 +1,25 @@ package ast type Aggref struct { - Xpr Node - Aggfnoid Oid - Aggtype Oid - Aggcollid Oid - Inputcollid Oid - Aggtranstype Oid - Aggargtypes *List - Aggdirectargs *List - Args *List - Aggorder *List - Aggdistinct *List - Aggfilter Node - Aggstar bool - Aggvariadic bool - Aggkind byte - Agglevelsup Index - Aggsplit AggSplit - Location int + Tag NodeTag[Aggref] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Aggfnoid Oid `json:"aggfnoid"` + Aggtype Oid `json:"aggtype"` + Aggcollid Oid `json:"aggcollid"` + Inputcollid Oid `json:"inputcollid"` + Aggargtypes *List `json:"aggargtypes,omitempty"` + Aggdirectargs *List `json:"aggdirectargs,omitempty"` + Args *List `json:"args,omitempty"` + Aggorder *List `json:"aggorder,omitempty"` + Aggdistinct *List `json:"aggdistinct,omitempty"` + Aggfilter Node `json:"aggfilter,omitempty"` + Aggstar bool `json:"aggstar"` + Aggvariadic bool `json:"aggvariadic"` + Aggkind byte `json:"aggkind"` + Agglevelsup Index `json:"agglevelsup"` + Aggsplit AggSplit `json:"aggsplit"` + Location int `json:"location"` } func (n *Aggref) Pos() int { diff --git a/internal/sql/ast/alias.go b/internal/sql/ast/alias.go index 55965b55c9..198120f5d0 100644 --- a/internal/sql/ast/alias.go +++ b/internal/sql/ast/alias.go @@ -1,15 +1,19 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type Alias struct { - Aliasname *string - Colnames *List + Tag NodeTag[Alias] `json:"tag"` + + Aliasname *string `json:"aliasname,omitempty"` + Colnames *List `json:"colnames,omitempty"` } func (n *Alias) Pos() int { return 0 } -func (n *Alias) Format(buf *TrackedBuffer) { +func (n *Alias) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } @@ -18,7 +22,7 @@ func (n *Alias) Format(buf *TrackedBuffer) { } if items(n.Colnames) { buf.WriteString("(") - buf.astFormat((n.Colnames)) + buf.astFormat(n.Colnames, d) buf.WriteString(")") } } diff --git a/internal/sql/ast/alter_collation_stmt.go b/internal/sql/ast/alter_collation_stmt.go index fa78ed7bf1..fedcf5a9d1 100644 --- a/internal/sql/ast/alter_collation_stmt.go +++ b/internal/sql/ast/alter_collation_stmt.go @@ -1,7 +1,9 @@ package ast type AlterCollationStmt struct { - Collname *List + Tag NodeTag[AlterCollationStmt] `json:"tag"` + + Collname *List `json:"collname,omitempty"` } func (n *AlterCollationStmt) Pos() int { diff --git a/internal/sql/ast/alter_database_set_stmt.go b/internal/sql/ast/alter_database_set_stmt.go index ba9926bed1..14d485eb30 100644 --- a/internal/sql/ast/alter_database_set_stmt.go +++ b/internal/sql/ast/alter_database_set_stmt.go @@ -1,8 +1,10 @@ package ast type AlterDatabaseSetStmt struct { - Dbname *string - Setstmt *VariableSetStmt + Tag NodeTag[AlterDatabaseSetStmt] `json:"tag"` + + Dbname *string `json:"dbname,omitempty"` + Setstmt *VariableSetStmt `json:"setstmt,omitempty"` } func (n *AlterDatabaseSetStmt) Pos() int { diff --git a/internal/sql/ast/alter_database_stmt.go b/internal/sql/ast/alter_database_stmt.go index 84d91f089c..9eb3dae54d 100644 --- a/internal/sql/ast/alter_database_stmt.go +++ b/internal/sql/ast/alter_database_stmt.go @@ -1,8 +1,10 @@ package ast type AlterDatabaseStmt struct { - Dbname *string - Options *List + Tag NodeTag[AlterDatabaseStmt] `json:"tag"` + + Dbname *string `json:"dbname,omitempty"` + Options *List `json:"options,omitempty"` } func (n *AlterDatabaseStmt) Pos() int { diff --git a/internal/sql/ast/alter_default_privileges_stmt.go b/internal/sql/ast/alter_default_privileges_stmt.go index 64632a726d..f72a412eb1 100644 --- a/internal/sql/ast/alter_default_privileges_stmt.go +++ b/internal/sql/ast/alter_default_privileges_stmt.go @@ -1,8 +1,10 @@ package ast type AlterDefaultPrivilegesStmt struct { - Options *List - Action *GrantStmt + Tag NodeTag[AlterDefaultPrivilegesStmt] `json:"tag"` + + Options *List `json:"options,omitempty"` + Action *GrantStmt `json:"action,omitempty"` } func (n *AlterDefaultPrivilegesStmt) Pos() int { diff --git a/internal/sql/ast/alter_domain_stmt.go b/internal/sql/ast/alter_domain_stmt.go index f9f419937f..669b7a5337 100644 --- a/internal/sql/ast/alter_domain_stmt.go +++ b/internal/sql/ast/alter_domain_stmt.go @@ -1,12 +1,14 @@ package ast type AlterDomainStmt struct { - Subtype byte - TypeName *List - Name *string - Def Node - Behavior DropBehavior - MissingOk bool + Tag NodeTag[AlterDomainStmt] `json:"tag"` + + Subtype byte `json:"subtype"` + TypeName *List `json:"type_name,omitempty"` + Name *string `json:"name,omitempty"` + Def Node `json:"def,omitempty"` + Behavior DropBehavior `json:"behavior"` + MissingOk bool `json:"missing_ok"` } func (n *AlterDomainStmt) Pos() int { diff --git a/internal/sql/ast/alter_enum_stmt.go b/internal/sql/ast/alter_enum_stmt.go index 1346b3c0d0..70a6a850bd 100644 --- a/internal/sql/ast/alter_enum_stmt.go +++ b/internal/sql/ast/alter_enum_stmt.go @@ -1,12 +1,14 @@ package ast type AlterEnumStmt struct { - TypeName *List - OldVal *string - NewVal *string - NewValNeighbor *string - NewValIsAfter bool - SkipIfNewValExists bool + Tag NodeTag[AlterEnumStmt] `json:"tag"` + + TypeName *List `json:"type_name,omitempty"` + OldVal *string `json:"old_val,omitempty"` + NewVal *string `json:"new_val,omitempty"` + NewValNeighbor *string `json:"new_val_neighbor,omitempty"` + NewValIsAfter bool `json:"new_val_is_after"` + SkipIfNewValExists bool `json:"skip_if_new_val_exists"` } func (n *AlterEnumStmt) Pos() int { diff --git a/internal/sql/ast/alter_event_trig_stmt.go b/internal/sql/ast/alter_event_trig_stmt.go index eeb5f75d42..14356fabe7 100644 --- a/internal/sql/ast/alter_event_trig_stmt.go +++ b/internal/sql/ast/alter_event_trig_stmt.go @@ -1,8 +1,10 @@ package ast type AlterEventTrigStmt struct { - Trigname *string - Tgenabled byte + Tag NodeTag[AlterEventTrigStmt] `json:"tag"` + + Trigname *string `json:"trigname,omitempty"` + Tgenabled byte `json:"tgenabled"` } func (n *AlterEventTrigStmt) Pos() int { diff --git a/internal/sql/ast/alter_extension_contents_stmt.go b/internal/sql/ast/alter_extension_contents_stmt.go index 27ad1c31d6..3821812720 100644 --- a/internal/sql/ast/alter_extension_contents_stmt.go +++ b/internal/sql/ast/alter_extension_contents_stmt.go @@ -1,10 +1,12 @@ package ast type AlterExtensionContentsStmt struct { - Extname *string - Action int - Objtype ObjectType - Object Node + Tag NodeTag[AlterExtensionContentsStmt] `json:"tag"` + + Extname *string `json:"extname,omitempty"` + Action int `json:"action"` + Objtype ObjectType `json:"objtype"` + Object Node `json:"object,omitempty"` } func (n *AlterExtensionContentsStmt) Pos() int { diff --git a/internal/sql/ast/alter_extension_stmt.go b/internal/sql/ast/alter_extension_stmt.go index 049e712c94..c1daf85e91 100644 --- a/internal/sql/ast/alter_extension_stmt.go +++ b/internal/sql/ast/alter_extension_stmt.go @@ -1,8 +1,10 @@ package ast type AlterExtensionStmt struct { - Extname *string - Options *List + Tag NodeTag[AlterExtensionStmt] `json:"tag"` + + Extname *string `json:"extname,omitempty"` + Options *List `json:"options,omitempty"` } func (n *AlterExtensionStmt) Pos() int { diff --git a/internal/sql/ast/alter_fdw_stmt.go b/internal/sql/ast/alter_fdw_stmt.go index 12c6457d71..6a74137bfb 100644 --- a/internal/sql/ast/alter_fdw_stmt.go +++ b/internal/sql/ast/alter_fdw_stmt.go @@ -1,9 +1,11 @@ package ast type AlterFdwStmt struct { - Fdwname *string - FuncOptions *List - Options *List + Tag NodeTag[AlterFdwStmt] `json:"tag"` + + Fdwname *string `json:"fdwname,omitempty"` + FuncOptions *List `json:"func_options,omitempty"` + Options *List `json:"options,omitempty"` } func (n *AlterFdwStmt) Pos() int { diff --git a/internal/sql/ast/alter_foreign_server_stmt.go b/internal/sql/ast/alter_foreign_server_stmt.go index 9f3e8dbe64..fcdbad116f 100644 --- a/internal/sql/ast/alter_foreign_server_stmt.go +++ b/internal/sql/ast/alter_foreign_server_stmt.go @@ -1,10 +1,12 @@ package ast type AlterForeignServerStmt struct { - Servername *string - Version *string - Options *List - HasVersion bool + Tag NodeTag[AlterForeignServerStmt] `json:"tag"` + + Servername *string `json:"servername,omitempty"` + Version *string `json:"version,omitempty"` + Options *List `json:"options,omitempty"` + HasVersion bool `json:"has_version"` } func (n *AlterForeignServerStmt) Pos() int { diff --git a/internal/sql/ast/alter_function_stmt.go b/internal/sql/ast/alter_function_stmt.go index 1193ab7656..93d393111d 100644 --- a/internal/sql/ast/alter_function_stmt.go +++ b/internal/sql/ast/alter_function_stmt.go @@ -1,8 +1,10 @@ package ast type AlterFunctionStmt struct { - Func *ObjectWithArgs - Actions *List + Tag NodeTag[AlterFunctionStmt] `json:"tag"` + + Func *ObjectWithArgs `json:"func,omitempty"` + Actions *List `json:"actions,omitempty"` } func (n *AlterFunctionStmt) Pos() int { diff --git a/internal/sql/ast/alter_object_depends_stmt.go b/internal/sql/ast/alter_object_depends_stmt.go index 83cc3c9641..f7b46aeeab 100644 --- a/internal/sql/ast/alter_object_depends_stmt.go +++ b/internal/sql/ast/alter_object_depends_stmt.go @@ -1,10 +1,12 @@ package ast type AlterObjectDependsStmt struct { - ObjectType ObjectType - Relation *RangeVar - Object Node - Extname Node + Tag NodeTag[AlterObjectDependsStmt] `json:"tag"` + + ObjectType ObjectType `json:"object_type"` + Relation *RangeVar `json:"relation,omitempty"` + Object Node `json:"object,omitempty"` + Extname Node `json:"extname,omitempty"` } func (n *AlterObjectDependsStmt) Pos() int { diff --git a/internal/sql/ast/alter_object_schema_stmt.go b/internal/sql/ast/alter_object_schema_stmt.go index 664e6f1495..3a5a5bd332 100644 --- a/internal/sql/ast/alter_object_schema_stmt.go +++ b/internal/sql/ast/alter_object_schema_stmt.go @@ -1,11 +1,13 @@ package ast type AlterObjectSchemaStmt struct { - ObjectType ObjectType - Relation *RangeVar - Object Node - Newschema *string - MissingOk bool + Tag NodeTag[AlterObjectSchemaStmt] `json:"tag"` + + ObjectType ObjectType `json:"object_type"` + Relation *RangeVar `json:"relation,omitempty"` + Object Node `json:"object,omitempty"` + Newschema *string `json:"newschema,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *AlterObjectSchemaStmt) Pos() int { diff --git a/internal/sql/ast/alter_op_family_stmt.go b/internal/sql/ast/alter_op_family_stmt.go index 60655d76b0..7d287d5a26 100644 --- a/internal/sql/ast/alter_op_family_stmt.go +++ b/internal/sql/ast/alter_op_family_stmt.go @@ -1,10 +1,12 @@ package ast type AlterOpFamilyStmt struct { - Opfamilyname *List - Amname *string - IsDrop bool - Items *List + Tag NodeTag[AlterOpFamilyStmt] `json:"tag"` + + Opfamilyname *List `json:"opfamilyname,omitempty"` + Amname *string `json:"amname,omitempty"` + IsDrop bool `json:"is_drop"` + Items *List `json:"items,omitempty"` } func (n *AlterOpFamilyStmt) Pos() int { diff --git a/internal/sql/ast/alter_operator_stmt.go b/internal/sql/ast/alter_operator_stmt.go index 11ef659a8c..0d61c657a6 100644 --- a/internal/sql/ast/alter_operator_stmt.go +++ b/internal/sql/ast/alter_operator_stmt.go @@ -1,8 +1,10 @@ package ast type AlterOperatorStmt struct { - Opername *ObjectWithArgs - Options *List + Tag NodeTag[AlterOperatorStmt] `json:"tag"` + + Opername *ObjectWithArgs `json:"opername,omitempty"` + Options *List `json:"options,omitempty"` } func (n *AlterOperatorStmt) Pos() int { diff --git a/internal/sql/ast/alter_owner_stmt.go b/internal/sql/ast/alter_owner_stmt.go index 8a4be65183..041c0d4d67 100644 --- a/internal/sql/ast/alter_owner_stmt.go +++ b/internal/sql/ast/alter_owner_stmt.go @@ -1,10 +1,12 @@ package ast type AlterOwnerStmt struct { - ObjectType ObjectType - Relation *RangeVar - Object Node - Newowner *RoleSpec + Tag NodeTag[AlterOwnerStmt] `json:"tag"` + + ObjectType ObjectType `json:"object_type"` + Relation *RangeVar `json:"relation,omitempty"` + Object Node `json:"object,omitempty"` + Newowner *RoleSpec `json:"newowner,omitempty"` } func (n *AlterOwnerStmt) Pos() int { diff --git a/internal/sql/ast/alter_policy_stmt.go b/internal/sql/ast/alter_policy_stmt.go index 03e814328c..b7f9d7be4f 100644 --- a/internal/sql/ast/alter_policy_stmt.go +++ b/internal/sql/ast/alter_policy_stmt.go @@ -1,11 +1,13 @@ package ast type AlterPolicyStmt struct { - PolicyName *string - Table *RangeVar - Roles *List - Qual Node - WithCheck Node + Tag NodeTag[AlterPolicyStmt] `json:"tag"` + + PolicyName *string `json:"policy_name,omitempty"` + Table *RangeVar `json:"table,omitempty"` + Roles *List `json:"roles,omitempty"` + Qual Node `json:"qual,omitempty"` + WithCheck Node `json:"with_check,omitempty"` } func (n *AlterPolicyStmt) Pos() int { diff --git a/internal/sql/ast/alter_publication_stmt.go b/internal/sql/ast/alter_publication_stmt.go index c1288858eb..718368fd26 100644 --- a/internal/sql/ast/alter_publication_stmt.go +++ b/internal/sql/ast/alter_publication_stmt.go @@ -1,11 +1,13 @@ package ast type AlterPublicationStmt struct { - Pubname *string - Options *List - Tables *List - ForAllTables bool - TableAction DefElemAction + Tag NodeTag[AlterPublicationStmt] `json:"tag"` + + Pubname *string `json:"pubname,omitempty"` + Options *List `json:"options,omitempty"` + Tables *List `json:"tables,omitempty"` + ForAllTables bool `json:"for_all_tables"` + TableAction DefElemAction `json:"table_action"` } func (n *AlterPublicationStmt) Pos() int { diff --git a/internal/sql/ast/alter_role_set_stmt.go b/internal/sql/ast/alter_role_set_stmt.go index cda679017c..a973ccb4a4 100644 --- a/internal/sql/ast/alter_role_set_stmt.go +++ b/internal/sql/ast/alter_role_set_stmt.go @@ -1,9 +1,11 @@ package ast type AlterRoleSetStmt struct { - Role *RoleSpec - Database *string - Setstmt *VariableSetStmt + Tag NodeTag[AlterRoleSetStmt] `json:"tag"` + + Role *RoleSpec `json:"role,omitempty"` + Database *string `json:"database,omitempty"` + Setstmt *VariableSetStmt `json:"setstmt,omitempty"` } func (n *AlterRoleSetStmt) Pos() int { diff --git a/internal/sql/ast/alter_role_stmt.go b/internal/sql/ast/alter_role_stmt.go index e616f05917..3c7d60767c 100644 --- a/internal/sql/ast/alter_role_stmt.go +++ b/internal/sql/ast/alter_role_stmt.go @@ -1,9 +1,11 @@ package ast type AlterRoleStmt struct { - Role *RoleSpec - Options *List - Action int + Tag NodeTag[AlterRoleStmt] `json:"tag"` + + Role *RoleSpec `json:"role,omitempty"` + Options *List `json:"options,omitempty"` + Action int `json:"action"` } func (n *AlterRoleStmt) Pos() int { diff --git a/internal/sql/ast/alter_seq_stmt.go b/internal/sql/ast/alter_seq_stmt.go index ca4c86a413..53e46d47c4 100644 --- a/internal/sql/ast/alter_seq_stmt.go +++ b/internal/sql/ast/alter_seq_stmt.go @@ -1,10 +1,12 @@ package ast type AlterSeqStmt struct { - Sequence *RangeVar - Options *List - ForIdentity bool - MissingOk bool + Tag NodeTag[AlterSeqStmt] `json:"tag"` + + Sequence *RangeVar `json:"sequence,omitempty"` + Options *List `json:"options,omitempty"` + ForIdentity bool `json:"for_identity"` + MissingOk bool `json:"missing_ok"` } func (n *AlterSeqStmt) Pos() int { diff --git a/internal/sql/ast/alter_subscription_stmt.go b/internal/sql/ast/alter_subscription_stmt.go index 443fc7bfb8..3b54140fe7 100644 --- a/internal/sql/ast/alter_subscription_stmt.go +++ b/internal/sql/ast/alter_subscription_stmt.go @@ -1,11 +1,13 @@ package ast type AlterSubscriptionStmt struct { - Kind AlterSubscriptionType - Subname *string - Conninfo *string - Publication *List - Options *List + Tag NodeTag[AlterSubscriptionStmt] `json:"tag"` + + Kind AlterSubscriptionType `json:"kind"` + Subname *string `json:"subname,omitempty"` + Conninfo *string `json:"conninfo,omitempty"` + Publication *List `json:"publication,omitempty"` + Options *List `json:"options,omitempty"` } func (n *AlterSubscriptionStmt) Pos() int { diff --git a/internal/sql/ast/alter_system_stmt.go b/internal/sql/ast/alter_system_stmt.go index c5657f9c1a..724ad8f3a7 100644 --- a/internal/sql/ast/alter_system_stmt.go +++ b/internal/sql/ast/alter_system_stmt.go @@ -1,7 +1,9 @@ package ast type AlterSystemStmt struct { - Setstmt *VariableSetStmt + Tag NodeTag[AlterSystemStmt] `json:"tag"` + + Setstmt *VariableSetStmt `json:"setstmt,omitempty"` } func (n *AlterSystemStmt) Pos() int { diff --git a/internal/sql/ast/alter_table_cmd.go b/internal/sql/ast/alter_table_cmd.go index 80fad95eaf..b357605dd8 100644 --- a/internal/sql/ast/alter_table_cmd.go +++ b/internal/sql/ast/alter_table_cmd.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + const ( AT_AddColumn AlterTableType = iota AT_AlterColumnType @@ -28,19 +30,21 @@ func (t AlterTableType) String() string { } type AlterTableCmd struct { - Subtype AlterTableType - Name *string - Def *ColumnDef - Newowner *RoleSpec - Behavior DropBehavior - MissingOk bool + Tag NodeTag[AlterTableCmd] `json:"tag"` + + Subtype AlterTableType `json:"subtype"` + Name *string `json:"name,omitempty"` + Def *ColumnDef `json:"def,omitempty"` + Newowner *RoleSpec `json:"newowner,omitempty"` + Behavior DropBehavior `json:"behavior"` + MissingOk bool `json:"missing_ok"` } func (n *AlterTableCmd) Pos() int { return 0 } -func (n *AlterTableCmd) Format(buf *TrackedBuffer) { +func (n *AlterTableCmd) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } @@ -51,5 +55,5 @@ func (n *AlterTableCmd) Format(buf *TrackedBuffer) { buf.WriteString(" DROP COLUMN ") } - buf.astFormat(n.Def) + buf.astFormat(n.Def, d) } diff --git a/internal/sql/ast/alter_table_move_all_stmt.go b/internal/sql/ast/alter_table_move_all_stmt.go index 39f1256083..ac028a06aa 100644 --- a/internal/sql/ast/alter_table_move_all_stmt.go +++ b/internal/sql/ast/alter_table_move_all_stmt.go @@ -1,11 +1,13 @@ package ast type AlterTableMoveAllStmt struct { - OrigTablespacename *string - Objtype ObjectType - Roles *List - NewTablespacename *string - Nowait bool + Tag NodeTag[AlterTableMoveAllStmt] `json:"tag"` + + OrigTablespacename *string `json:"orig_tablespacename,omitempty"` + Objtype ObjectType `json:"objtype"` + Roles *List `json:"roles,omitempty"` + NewTablespacename *string `json:"new_tablespacename,omitempty"` + Nowait bool `json:"nowait"` } func (n *AlterTableMoveAllStmt) Pos() int { diff --git a/internal/sql/ast/alter_table_set_schema_stmt.go b/internal/sql/ast/alter_table_set_schema_stmt.go index 890cb3e5e8..d7f62bf334 100644 --- a/internal/sql/ast/alter_table_set_schema_stmt.go +++ b/internal/sql/ast/alter_table_set_schema_stmt.go @@ -1,9 +1,11 @@ package ast type AlterTableSetSchemaStmt struct { - Table *TableName - NewSchema *string - MissingOk bool + Tag NodeTag[AlterTableSetSchemaStmt] `json:"tag"` + + Table *TableName `json:"table,omitempty"` + NewSchema *string `json:"new_schema,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *AlterTableSetSchemaStmt) Pos() int { diff --git a/internal/sql/ast/alter_table_space_options_stmt.go b/internal/sql/ast/alter_table_space_options_stmt.go index fc49cfe6b8..f9b97b2d2f 100644 --- a/internal/sql/ast/alter_table_space_options_stmt.go +++ b/internal/sql/ast/alter_table_space_options_stmt.go @@ -1,9 +1,11 @@ package ast type AlterTableSpaceOptionsStmt struct { - Tablespacename *string - Options *List - IsReset bool + Tag NodeTag[AlterTableSpaceOptionsStmt] `json:"tag"` + + Tablespacename *string `json:"tablespacename,omitempty"` + Options *List `json:"options,omitempty"` + IsReset bool `json:"is_reset"` } func (n *AlterTableSpaceOptionsStmt) Pos() int { diff --git a/internal/sql/ast/alter_table_stmt.go b/internal/sql/ast/alter_table_stmt.go index 5d4a22f50e..5e541023f1 100644 --- a/internal/sql/ast/alter_table_stmt.go +++ b/internal/sql/ast/alter_table_stmt.go @@ -1,24 +1,38 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type AlterTableStmt struct { + Tag NodeTag[AlterTableStmt] `json:"tag"` + // TODO: Only TableName or Relation should be defined - Relation *RangeVar - Table *TableName - Cmds *List - MissingOk bool - Relkind ObjectType + Relation *RangeVar `json:"relation,omitempty"` + Table *TableName `json:"table,omitempty"` + Cmds *List `json:"cmds,omitempty"` + MissingOk bool `json:"missing_ok"` + Relkind ObjectType `json:"relkind"` + // Incomplete marks a statement whose source carried syntax this node + // does not model, such as column constraints beyond plain NOT NULL and + // PRIMARY KEY on an added column. No faithful rendering exists for it. + Incomplete bool `json:"incomplete"` } func (n *AlterTableStmt) Pos() int { return 0 } -func (n *AlterTableStmt) Format(buf *TrackedBuffer) { +func (n *AlterTableStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } + // An incomplete statement cannot be printed back: part of its source + // was parsed away. Render nothing, which no verification accepts, so + // the formatter keeps the statement as written. + if n.Incomplete { + return + } buf.WriteString("ALTER TABLE ") - buf.astFormat(n.Relation) - buf.astFormat(n.Table) - buf.astFormat(n.Cmds) + buf.astFormat(n.Relation, d) + buf.astFormat(n.Table, d) + buf.astFormat(n.Cmds, d) } diff --git a/internal/sql/ast/alter_ts_configuration_stmt.go b/internal/sql/ast/alter_ts_configuration_stmt.go index 6b58ada4e6..9ecd8bc2bb 100644 --- a/internal/sql/ast/alter_ts_configuration_stmt.go +++ b/internal/sql/ast/alter_ts_configuration_stmt.go @@ -1,13 +1,15 @@ package ast type AlterTSConfigurationStmt struct { - Kind AlterTSConfigType - Cfgname *List - Tokentype *List - Dicts *List - Override bool - Replace bool - MissingOk bool + Tag NodeTag[AlterTSConfigurationStmt] `json:"tag"` + + Kind AlterTSConfigType `json:"kind"` + Cfgname *List `json:"cfgname,omitempty"` + Tokentype *List `json:"tokentype,omitempty"` + Dicts *List `json:"dicts,omitempty"` + Override bool `json:"override"` + Replace bool `json:"replace"` + MissingOk bool `json:"missing_ok"` } func (n *AlterTSConfigurationStmt) Pos() int { diff --git a/internal/sql/ast/alter_ts_dictionary_stmt.go b/internal/sql/ast/alter_ts_dictionary_stmt.go index 0506c49b34..6c89127cca 100644 --- a/internal/sql/ast/alter_ts_dictionary_stmt.go +++ b/internal/sql/ast/alter_ts_dictionary_stmt.go @@ -1,8 +1,10 @@ package ast type AlterTSDictionaryStmt struct { - Dictname *List - Options *List + Tag NodeTag[AlterTSDictionaryStmt] `json:"tag"` + + Dictname *List `json:"dictname,omitempty"` + Options *List `json:"options,omitempty"` } func (n *AlterTSDictionaryStmt) Pos() int { diff --git a/internal/sql/ast/alter_type_add_value_stmt.go b/internal/sql/ast/alter_type_add_value_stmt.go index 56ae7dd9b7..a8878d6153 100644 --- a/internal/sql/ast/alter_type_add_value_stmt.go +++ b/internal/sql/ast/alter_type_add_value_stmt.go @@ -1,12 +1,14 @@ package ast type AlterTypeAddValueStmt struct { - Type *TypeName - NewValue *string - NewValHasNeighbor bool - NewValNeighbor *string - NewValIsAfter bool - SkipIfNewValExists bool + Tag NodeTag[AlterTypeAddValueStmt] `json:"tag"` + + Type *TypeName `json:"type,omitempty"` + NewValue *string `json:"new_value,omitempty"` + NewValHasNeighbor bool `json:"new_val_has_neighbor"` + NewValNeighbor *string `json:"new_val_neighbor,omitempty"` + NewValIsAfter bool `json:"new_val_is_after"` + SkipIfNewValExists bool `json:"skip_if_new_val_exists"` } func (n *AlterTypeAddValueStmt) Pos() int { diff --git a/internal/sql/ast/alter_type_rename_value_stmt.go b/internal/sql/ast/alter_type_rename_value_stmt.go index 376286511f..52e59d40d1 100644 --- a/internal/sql/ast/alter_type_rename_value_stmt.go +++ b/internal/sql/ast/alter_type_rename_value_stmt.go @@ -1,9 +1,11 @@ package ast type AlterTypeRenameValueStmt struct { - Type *TypeName - OldValue *string - NewValue *string + Tag NodeTag[AlterTypeRenameValueStmt] `json:"tag"` + + Type *TypeName `json:"type,omitempty"` + OldValue *string `json:"old_value,omitempty"` + NewValue *string `json:"new_value,omitempty"` } func (n *AlterTypeRenameValueStmt) Pos() int { diff --git a/internal/sql/ast/alter_type_set_schema_stmt.go b/internal/sql/ast/alter_type_set_schema_stmt.go index 22206d85cd..46d312beaa 100644 --- a/internal/sql/ast/alter_type_set_schema_stmt.go +++ b/internal/sql/ast/alter_type_set_schema_stmt.go @@ -1,8 +1,10 @@ package ast type AlterTypeSetSchemaStmt struct { - Type *TypeName - NewSchema *string + Tag NodeTag[AlterTypeSetSchemaStmt] `json:"tag"` + + Type *TypeName `json:"type,omitempty"` + NewSchema *string `json:"new_schema,omitempty"` } func (n *AlterTypeSetSchemaStmt) Pos() int { diff --git a/internal/sql/ast/alter_user_mapping_stmt.go b/internal/sql/ast/alter_user_mapping_stmt.go index aeeb0912ae..ab85751f10 100644 --- a/internal/sql/ast/alter_user_mapping_stmt.go +++ b/internal/sql/ast/alter_user_mapping_stmt.go @@ -1,9 +1,11 @@ package ast type AlterUserMappingStmt struct { - User *RoleSpec - Servername *string - Options *List + Tag NodeTag[AlterUserMappingStmt] `json:"tag"` + + User *RoleSpec `json:"user,omitempty"` + Servername *string `json:"servername,omitempty"` + Options *List `json:"options,omitempty"` } func (n *AlterUserMappingStmt) Pos() int { diff --git a/internal/sql/ast/alternative_sub_plan.go b/internal/sql/ast/alternative_sub_plan.go index 86031afd19..ad374d1d76 100644 --- a/internal/sql/ast/alternative_sub_plan.go +++ b/internal/sql/ast/alternative_sub_plan.go @@ -1,8 +1,10 @@ package ast type AlternativeSubPlan struct { - Xpr Node - Subplans *List + Tag NodeTag[AlternativeSubPlan] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Subplans *List `json:"subplans,omitempty"` } func (n *AlternativeSubPlan) Pos() int { diff --git a/internal/sql/ast/array_coerce_expr.go b/internal/sql/ast/array_coerce_expr.go index 314c6881bf..ce8c95200f 100644 --- a/internal/sql/ast/array_coerce_expr.go +++ b/internal/sql/ast/array_coerce_expr.go @@ -1,15 +1,17 @@ package ast type ArrayCoerceExpr struct { - Xpr Node - Arg Node - Elemfuncid Oid - Resulttype Oid - Resulttypmod int32 - Resultcollid Oid - IsExplicit bool - Coerceformat CoercionForm - Location int + Tag NodeTag[ArrayCoerceExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Elemfuncid Oid `json:"elemfuncid"` + Resulttype Oid `json:"resulttype"` + Resulttypmod int32 `json:"resulttypmod"` + Resultcollid Oid `json:"resultcollid"` + IsExplicit bool `json:"is_explicit"` + Coerceformat CoercionForm `json:"coerceformat"` + Location int `json:"location"` } func (n *ArrayCoerceExpr) Pos() int { diff --git a/internal/sql/ast/array_expr.go b/internal/sql/ast/array_expr.go index c61aed8df7..753ed0f782 100644 --- a/internal/sql/ast/array_expr.go +++ b/internal/sql/ast/array_expr.go @@ -1,13 +1,15 @@ package ast type ArrayExpr struct { - Xpr Node - ArrayTypeid Oid - ArrayCollid Oid - ElementTypeid Oid - Elements *List - Multidims bool - Location int + Tag NodeTag[ArrayExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + ArrayTypeid Oid `json:"array_typeid"` + ArrayCollid Oid `json:"array_collid"` + ElementTypeid Oid `json:"element_typeid"` + Elements *List `json:"elements,omitempty"` + Multidims bool `json:"multidims"` + Location int `json:"location"` } func (n *ArrayExpr) Pos() int { diff --git a/internal/sql/ast/array_ref.go b/internal/sql/ast/array_ref.go index d94d800bb9..9fb4a35f5b 100644 --- a/internal/sql/ast/array_ref.go +++ b/internal/sql/ast/array_ref.go @@ -1,15 +1,17 @@ package ast type ArrayRef struct { - Xpr Node - Refarraytype Oid - Refelemtype Oid - Reftypmod int32 - Refcollid Oid - Refupperindexpr *List - Reflowerindexpr *List - Refexpr Node - Refassgnexpr Node + Tag NodeTag[ArrayRef] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Refarraytype Oid `json:"refarraytype"` + Refelemtype Oid `json:"refelemtype"` + Reftypmod int32 `json:"reftypmod"` + Refcollid Oid `json:"refcollid"` + Refupperindexpr *List `json:"refupperindexpr,omitempty"` + Reflowerindexpr *List `json:"reflowerindexpr,omitempty"` + Refexpr Node `json:"refexpr,omitempty"` + Refassgnexpr Node `json:"refassgnexpr,omitempty"` } func (n *ArrayRef) Pos() int { diff --git a/internal/sql/ast/between_expr.go b/internal/sql/ast/between_expr.go index 0811caee31..f1e4508006 100644 --- a/internal/sql/ast/between_expr.go +++ b/internal/sql/ast/between_expr.go @@ -1,17 +1,36 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type BetweenExpr struct { + Tag NodeTag[BetweenExpr] `json:"tag"` + // Expr is the value expression to be compared. - Expr Node + Expr Node `json:"expr,omitempty"` // Left is the left expression in the between statement. - Left Node + Left Node `json:"left,omitempty"` // Right is the right expression in the between statement. - Right Node + Right Node `json:"right,omitempty"` // Not is true, the expression is "not between". - Not bool - Location int + Not bool `json:"not"` + Location int `json:"location"` } func (n *BetweenExpr) Pos() int { return n.Location } + +func (n *BetweenExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.astFormat(n.Expr, d) + if n.Not { + buf.WriteString(" NOT BETWEEN ") + } else { + buf.WriteString(" BETWEEN ") + } + buf.astFormat(n.Left, d) + buf.WriteString(" AND ") + buf.astFormat(n.Right, d) +} diff --git a/internal/sql/ast/bit_string.go b/internal/sql/ast/bit_string.go index f1f069d079..fb53f2d765 100644 --- a/internal/sql/ast/bit_string.go +++ b/internal/sql/ast/bit_string.go @@ -1,7 +1,9 @@ package ast type BitString struct { - Str string + Tag NodeTag[BitString] `json:"tag"` + + Str string `json:"str"` } func (n *BitString) Pos() int { diff --git a/internal/sql/ast/block_id_data.go b/internal/sql/ast/block_id_data.go index ce5563f6bb..bcb5171924 100644 --- a/internal/sql/ast/block_id_data.go +++ b/internal/sql/ast/block_id_data.go @@ -1,8 +1,10 @@ package ast type BlockIdData struct { - BiHi uint16 - BiLo uint16 + Tag NodeTag[BlockIdData] `json:"tag"` + + BiHi uint16 `json:"bi_hi"` + BiLo uint16 `json:"bi_lo"` } func (n *BlockIdData) Pos() int { diff --git a/internal/sql/ast/bool_expr.go b/internal/sql/ast/bool_expr.go index 6d15276a05..9efea3de12 100644 --- a/internal/sql/ast/bool_expr.go +++ b/internal/sql/ast/bool_expr.go @@ -1,31 +1,70 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type BoolExpr struct { - Xpr Node - Boolop BoolExprType - Args *List - Location int + Tag NodeTag[BoolExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Boolop BoolExprType `json:"boolop"` + Args *List `json:"args,omitempty"` + Location int `json:"location"` } func (n *BoolExpr) Pos() int { return n.Location } -func (n *BoolExpr) Format(buf *TrackedBuffer) { +func (n *BoolExpr) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.WriteString("(") - if items(n.Args) { + switch n.Boolop { + case BoolExprTypeIsNull: + if items(n.Args) && len(n.Args.Items) > 0 { + buf.astFormat(n.Args.Items[0], d) + } + buf.WriteString(" IS NULL") + case BoolExprTypeIsNotNull: + if items(n.Args) && len(n.Args.Items) > 0 { + buf.astFormat(n.Args.Items[0], d) + } + buf.WriteString(" IS NOT NULL") + case BoolExprTypeNot: + // NOT expression: format as NOT + buf.WriteString("NOT ") + if items(n.Args) && len(n.Args.Items) > 0 { + buf.astFormat(n.Args.Items[0], d) + } + default: + var op string switch n.Boolop { case BoolExprTypeAnd: - buf.join(n.Args, " AND ") + op = "AND " case BoolExprTypeOr: - buf.join(n.Args, " OR ") - case BoolExprTypeNot: - buf.WriteString(" NOT ") - buf.astFormat(n.Args) + op = "OR " + } + buf.WriteString("(") + buf.Group() + buf.Indent() + buf.Softline() + if items(n.Args) && op != "" { + first := true + for _, item := range n.Args.Items { + if _, ok := item.(*TODO); ok { + continue + } + if !first { + buf.Line() + buf.WriteString(op) + } + first = false + buf.astFormat(item, d) + } } + buf.EndIndent() + buf.Softline() + buf.EndGroup() + buf.WriteString(")") } - buf.WriteString(")") } diff --git a/internal/sql/ast/boolean.go b/internal/sql/ast/boolean.go index 522af84868..b5a7502986 100644 --- a/internal/sql/ast/boolean.go +++ b/internal/sql/ast/boolean.go @@ -1,16 +1,22 @@ package ast -import "fmt" +import ( + "fmt" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) type Boolean struct { - Boolval bool + Tag NodeTag[Boolean] `json:"tag"` + + Boolval bool `json:"boolval"` } func (n *Boolean) Pos() int { return 0 } -func (n *Boolean) Format(buf *TrackedBuffer) { +func (n *Boolean) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/boolean_test_expr.go b/internal/sql/ast/boolean_test_expr.go index 7efbb46462..f6f3d90680 100644 --- a/internal/sql/ast/boolean_test_expr.go +++ b/internal/sql/ast/boolean_test_expr.go @@ -1,10 +1,12 @@ package ast type BooleanTest struct { - Xpr Node - Arg Node - Booltesttype BoolTestType - Location int + Tag NodeTag[BooleanTest] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Booltesttype BoolTestType `json:"booltesttype"` + Location int `json:"location"` } func (n *BooleanTest) Pos() int { diff --git a/internal/sql/ast/call_stmt.go b/internal/sql/ast/call_stmt.go index 5267a1ff3f..c64b5a8aa4 100644 --- a/internal/sql/ast/call_stmt.go +++ b/internal/sql/ast/call_stmt.go @@ -1,7 +1,11 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CallStmt struct { - FuncCall *FuncCall + Tag NodeTag[CallStmt] `json:"tag"` + + FuncCall *FuncCall `json:"func_call,omitempty"` } func (n *CallStmt) Pos() int { @@ -11,7 +15,7 @@ func (n *CallStmt) Pos() int { return n.FuncCall.Pos() } -func (n *CallStmt) Format(buf *TrackedBuffer) { +func (n *CallStmt) Format(buf *TrackedBuffer, d format.Dialect) { buf.WriteString("CALL ") - buf.astFormat(n.FuncCall) + buf.astFormat(n.FuncCall, d) } diff --git a/internal/sql/ast/case_expr.go b/internal/sql/ast/case_expr.go index 1da54f0d78..4d9b6181a5 100644 --- a/internal/sql/ast/case_expr.go +++ b/internal/sql/ast/case_expr.go @@ -1,26 +1,36 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CaseExpr struct { - Xpr Node - Casetype Oid - Casecollid Oid - Arg Node - Args *List - Defresult Node - Location int + Tag NodeTag[CaseExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Casetype Oid `json:"casetype"` + Casecollid Oid `json:"casecollid"` + Arg Node `json:"arg,omitempty"` + Args *List `json:"args,omitempty"` + Defresult Node `json:"defresult,omitempty"` + Location int `json:"location"` } func (n *CaseExpr) Pos() int { return n.Location } -func (n *CaseExpr) Format(buf *TrackedBuffer) { +func (n *CaseExpr) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } buf.WriteString("CASE ") - buf.astFormat(n.Args) - buf.WriteString(" ELSE ") - buf.astFormat(n.Defresult) - buf.WriteString(" END ") + if set(n.Arg) { + buf.astFormat(n.Arg, d) + buf.WriteString(" ") + } + buf.join(n.Args, d, " ") + if set(n.Defresult) { + buf.WriteString(" ELSE ") + buf.astFormat(n.Defresult, d) + } + buf.WriteString(" END") } diff --git a/internal/sql/ast/case_test_expr.go b/internal/sql/ast/case_test_expr.go index 8899985ca8..493293e93f 100644 --- a/internal/sql/ast/case_test_expr.go +++ b/internal/sql/ast/case_test_expr.go @@ -1,10 +1,12 @@ package ast type CaseTestExpr struct { - Xpr Node - TypeId Oid - TypeMod int32 - Collation Oid + Tag NodeTag[CaseTestExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + TypeId Oid `json:"type_id"` + TypeMod int32 `json:"type_mod"` + Collation Oid `json:"collation"` } func (n *CaseTestExpr) Pos() int { diff --git a/internal/sql/ast/case_when.go b/internal/sql/ast/case_when.go index b036411d54..fb39c4e269 100644 --- a/internal/sql/ast/case_when.go +++ b/internal/sql/ast/case_when.go @@ -1,22 +1,26 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CaseWhen struct { - Xpr Node - Expr Node - Result Node - Location int + Tag NodeTag[CaseWhen] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Expr Node `json:"expr,omitempty"` + Result Node `json:"result,omitempty"` + Location int `json:"location"` } func (n *CaseWhen) Pos() int { return n.Location } -func (n *CaseWhen) Format(buf *TrackedBuffer) { +func (n *CaseWhen) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } buf.WriteString("WHEN ") - buf.astFormat(n.Expr) + buf.astFormat(n.Expr, d) buf.WriteString(" THEN ") - buf.astFormat(n.Result) + buf.astFormat(n.Result, d) } diff --git a/internal/sql/ast/check_point_stmt.go b/internal/sql/ast/check_point_stmt.go index b528fdc80b..55f6d13d67 100644 --- a/internal/sql/ast/check_point_stmt.go +++ b/internal/sql/ast/check_point_stmt.go @@ -1,6 +1,7 @@ package ast type CheckPointStmt struct { + Tag NodeTag[CheckPointStmt] `json:"tag"` } func (n *CheckPointStmt) Pos() int { diff --git a/internal/sql/ast/close_portal_stmt.go b/internal/sql/ast/close_portal_stmt.go index 0b5afddeeb..d690543df9 100644 --- a/internal/sql/ast/close_portal_stmt.go +++ b/internal/sql/ast/close_portal_stmt.go @@ -1,7 +1,9 @@ package ast type ClosePortalStmt struct { - Portalname *string + Tag NodeTag[ClosePortalStmt] `json:"tag"` + + Portalname *string `json:"portalname,omitempty"` } func (n *ClosePortalStmt) Pos() int { diff --git a/internal/sql/ast/cluster_stmt.go b/internal/sql/ast/cluster_stmt.go index 5e235eb482..f2b4588d51 100644 --- a/internal/sql/ast/cluster_stmt.go +++ b/internal/sql/ast/cluster_stmt.go @@ -1,9 +1,11 @@ package ast type ClusterStmt struct { - Relation *RangeVar - Indexname *string - Verbose bool + Tag NodeTag[ClusterStmt] `json:"tag"` + + Relation *RangeVar `json:"relation,omitempty"` + Indexname *string `json:"indexname,omitempty"` + Verbose bool `json:"verbose"` } func (n *ClusterStmt) Pos() int { diff --git a/internal/sql/ast/coalesce_expr.go b/internal/sql/ast/coalesce_expr.go index cbf7025748..f51c2c5c8e 100644 --- a/internal/sql/ast/coalesce_expr.go +++ b/internal/sql/ast/coalesce_expr.go @@ -1,22 +1,28 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CoalesceExpr struct { - Xpr Node - Coalescetype Oid - Coalescecollid Oid - Args *List - Location int + Tag NodeTag[CoalesceExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Coalescetype Oid `json:"coalescetype"` + Coalescecollid Oid `json:"coalescecollid"` + Args *List `json:"args,omitempty"` + Location int `json:"location"` } func (n *CoalesceExpr) Pos() int { return n.Location } -func (n *CoalesceExpr) Format(buf *TrackedBuffer) { +func (n *CoalesceExpr) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.WriteString("COALESCE(") - buf.astFormat(n.Args) + // Lower case, like every other function name: the printer upper-cases + // keywords, and function names are identifiers, which fold lower. + buf.WriteString("coalesce(") + buf.astFormat(n.Args, d) buf.WriteString(")") } diff --git a/internal/sql/ast/coerce_to_domain.go b/internal/sql/ast/coerce_to_domain.go index e81a83f15d..09e681b537 100644 --- a/internal/sql/ast/coerce_to_domain.go +++ b/internal/sql/ast/coerce_to_domain.go @@ -1,13 +1,15 @@ package ast type CoerceToDomain struct { - Xpr Node - Arg Node - Resulttype Oid - Resulttypmod int32 - Resultcollid Oid - Coercionformat CoercionForm - Location int + Tag NodeTag[CoerceToDomain] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Resulttype Oid `json:"resulttype"` + Resulttypmod int32 `json:"resulttypmod"` + Resultcollid Oid `json:"resultcollid"` + Coercionformat CoercionForm `json:"coercionformat"` + Location int `json:"location"` } func (n *CoerceToDomain) Pos() int { diff --git a/internal/sql/ast/coerce_to_domain_value.go b/internal/sql/ast/coerce_to_domain_value.go index b2e26cb00c..d78b3bf89c 100644 --- a/internal/sql/ast/coerce_to_domain_value.go +++ b/internal/sql/ast/coerce_to_domain_value.go @@ -1,11 +1,13 @@ package ast type CoerceToDomainValue struct { - Xpr Node - TypeId Oid - TypeMod int32 - Collation Oid - Location int + Tag NodeTag[CoerceToDomainValue] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + TypeId Oid `json:"type_id"` + TypeMod int32 `json:"type_mod"` + Collation Oid `json:"collation"` + Location int `json:"location"` } func (n *CoerceToDomainValue) Pos() int { diff --git a/internal/sql/ast/coerce_via_io.go b/internal/sql/ast/coerce_via_io.go index 48aea6ce72..5c9f80970c 100644 --- a/internal/sql/ast/coerce_via_io.go +++ b/internal/sql/ast/coerce_via_io.go @@ -1,12 +1,14 @@ package ast type CoerceViaIO struct { - Xpr Node - Arg Node - Resulttype Oid - Resultcollid Oid - Coerceformat CoercionForm - Location int + Tag NodeTag[CoerceViaIO] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Resulttype Oid `json:"resulttype"` + Resultcollid Oid `json:"resultcollid"` + Coerceformat CoercionForm `json:"coerceformat"` + Location int `json:"location"` } func (n *CoerceViaIO) Pos() int { diff --git a/internal/sql/ast/collate_clause.go b/internal/sql/ast/collate_clause.go index 0c1629a05d..494b3e1f7b 100644 --- a/internal/sql/ast/collate_clause.go +++ b/internal/sql/ast/collate_clause.go @@ -1,9 +1,11 @@ package ast type CollateClause struct { - Arg Node - Collname *List - Location int + Tag NodeTag[CollateClause] `json:"tag"` + + Arg Node `json:"arg,omitempty"` + Collname *List `json:"collname,omitempty"` + Location int `json:"location"` } func (n *CollateClause) Pos() int { diff --git a/internal/sql/ast/collate_expr.go b/internal/sql/ast/collate_expr.go index 6c32eece77..c5643584b8 100644 --- a/internal/sql/ast/collate_expr.go +++ b/internal/sql/ast/collate_expr.go @@ -1,12 +1,25 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CollateExpr struct { - Xpr Node - Arg Node - CollOid Oid - Location int + Tag NodeTag[CollateExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + CollOid Oid `json:"coll_oid"` + Location int `json:"location"` } func (n *CollateExpr) Pos() int { return n.Location } + +func (n *CollateExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.astFormat(n.Xpr, d) + buf.WriteString(" COLLATE ") + buf.astFormat(n.Arg, d) +} diff --git a/internal/sql/ast/column_def.go b/internal/sql/ast/column_def.go index f9504eefc7..9bacaa8083 100644 --- a/internal/sql/ast/column_def.go +++ b/internal/sql/ast/column_def.go @@ -1,48 +1,72 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type ColumnDef struct { - Colname string - TypeName *TypeName - IsNotNull bool - IsUnsigned bool - IsArray bool - ArrayDims int - Vals *List - Length *int - PrimaryKey bool + Tag NodeTag[ColumnDef] `json:"tag"` + + Colname string `json:"colname"` + // TypeName is the column's type for the catalog. When Typeless is set + // the author wrote no type at all — SQLite allows it — and the column + // prints without one, whatever TypeName carries. + TypeName *TypeName `json:"type_name,omitempty"` + Typeless bool `json:"typeless"` + IsNotNull bool `json:"is_not_null"` + IsUnsigned bool `json:"is_unsigned"` + IsArray bool `json:"is_array"` + ArrayDims int `json:"array_dims"` + Vals *List `json:"vals,omitempty"` + Length *int `json:"length,omitempty"` + PrimaryKey bool `json:"primary_key"` + // IsHidden marks a column a relation offers by name without listing it, + // like the column an sqlite fts5 table names after itself. The legacy + // catalog drops hidden columns; the core catalog keeps them out of star + // expansions and models. + IsHidden bool `json:"is_hidden"` // From pg.ColumnDef - Inhcount int - IsLocal bool - IsFromType bool - IsFromParent bool - Storage byte - RawDefault Node - CookedDefault Node - Identity byte - CollClause *CollateClause - CollOid Oid - Constraints *List - Fdwoptions *List - Location int - Comment string + Inhcount int `json:"inhcount"` + IsLocal bool `json:"is_local"` + IsFromType bool `json:"is_from_type"` + IsFromParent bool `json:"is_from_parent"` + Storage byte `json:"storage"` + RawDefault Node `json:"raw_default,omitempty"` + CookedDefault Node `json:"cooked_default,omitempty"` + Identity byte `json:"identity"` + CollClause *CollateClause `json:"coll_clause,omitempty"` + CollOid Oid `json:"coll_oid"` + Constraints *List `json:"constraints,omitempty"` + Fdwoptions *List `json:"fdwoptions,omitempty"` + Location int `json:"location"` + Comment string `json:"comment"` } func (n *ColumnDef) Pos() int { return n.Location } -func (n *ColumnDef) Format(buf *TrackedBuffer) { +func (n *ColumnDef) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } buf.WriteString(n.Colname) - buf.WriteString(" ") - buf.astFormat(n.TypeName) + if !n.Typeless { + buf.WriteString(" ") + buf.astFormat(n.TypeName, d) + // MySQL integer types: signedness is part of the type. + if n.IsUnsigned { + buf.WriteString(" unsigned") + } + } + // Use IsArray from ColumnDef since TypeName.ArrayBounds may not be set + // (for type resolution compatibility) + if n.IsArray && !items(n.TypeName.ArrayBounds) { + buf.WriteString("[]") + } if n.PrimaryKey { buf.WriteString(" PRIMARY KEY") } else if n.IsNotNull { buf.WriteString(" NOT NULL") } - buf.astFormat(n.Constraints) + buf.astFormat(n.Constraints, d) } diff --git a/internal/sql/ast/column_ref.go b/internal/sql/ast/column_ref.go index e95b844896..f04c7b406d 100644 --- a/internal/sql/ast/column_ref.go +++ b/internal/sql/ast/column_ref.go @@ -1,20 +1,26 @@ package ast -import "strings" +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) type ColumnRef struct { - Name string + Tag NodeTag[ColumnRef] `json:"tag"` + + Name string `json:"name"` // From pg.ColumnRef - Fields *List - Location int + Fields *List `json:"fields,omitempty"` + Location int `json:"location"` } func (n *ColumnRef) Pos() int { return n.Location } -func (n *ColumnRef) Format(buf *TrackedBuffer) { +func (n *ColumnRef) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } @@ -24,11 +30,7 @@ func (n *ColumnRef) Format(buf *TrackedBuffer) { for _, item := range n.Fields.Items { switch nn := item.(type) { case *String: - if nn.Str == "user" { - items = append(items, `"user"`) - } else { - items = append(items, nn.Str) - } + items = append(items, d.QuoteIdent(nn.Str)) case *A_Star: items = append(items, "*") } diff --git a/internal/sql/ast/comment.go b/internal/sql/ast/comment.go new file mode 100644 index 0000000000..ea877328b0 --- /dev/null +++ b/internal/sql/ast/comment.go @@ -0,0 +1,235 @@ +package ast + +import ( + "sort" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + +// File is a parsed query file: its statements together with the comments +// the parser's lexer saw. Engines whose parsers surface their trivia — the +// lexical channel of whitespace and comments the grammar never sees, in +// Roslyn's terminology — return it from ParseFile, so the formatter gets +// statements and comments from one lexer pass. +type File struct { + Stmts []Statement + Comments []Comment +} + +// Comment is a single SQL comment, positioned by byte offsets into the +// source the statement was parsed from — the same coordinates the engine +// parsers stamp on nodes. +type Comment struct { + // Text is the comment as written, marker included ("-- x", "/* x */"). + Text string + Start int + End int + // OwnLine reports that only blank space preceded the comment on its + // line, so it leads the code after it rather than trailing the code + // before it. + OwnLine bool +} + +// Line reports whether the comment runs to the end of its line (-- or #), +// so nothing may be printed after it on the same line. +func (c Comment) Line() bool { + return len(c.Text) < 2 || c.Text[0] != '/' || c.Text[1] != '*' +} + +// commentRec is one attached comment: the anchor nodes on either side of it +// in print order, and whether it trails the code before it (same source +// line) or leads the code after it (its own line). +// +// The next anchor is where the printer emits the comment; the prev anchor +// is the node the comment belongs to when the tree is edited — a trailing +// comment travels with the node it annotates, the way dave/dst attaches +// decorations in the Go ecosystem. +type commentRec struct { + c Comment + prev, next Node + trailing bool +} + +// CommentTable holds a statement's comments attached to its nodes. It is +// built once by AttachComments, before any printing (or, later, editing): +// each comment is classified against the statement's anchor nodes by source +// position and line, and from then on positions are never consulted again — +// the printer emits comments by node identity, which is what lets an edited +// or synthetic tree print its comments correctly. +type CommentTable struct { + recs []commentRec + // byNext indexes recs by their next anchor, in source order; end holds + // the comments with no anchor after them, which trail the statement. + byNext map[Node][]int + end []int + taken []bool + nTaken int + // breaks marks the emission points where the author broke the line: + // the printer keeps those breaks, gofmt-style, instead of imposing a + // line width. + breaks map[Node]bool +} + +// breakAt reports whether the author broke the line at this emission point. +func (t *CommentTable) breakAt(n Node) bool { + return t != nil && t.breaks[n] +} + +// Exhausted reports whether every attached comment was printed. +func (t *CommentTable) Exhausted() bool { + return t == nil || t.nTaken == len(t.recs) +} + +// take returns and consumes the comments anchored to n, in order. +func (t *CommentTable) take(n Node) []commentRec { + if t == nil || n == nil { + return nil + } + idxs := t.byNext[n] + if len(idxs) == 0 { + return nil + } + out := make([]commentRec, 0, len(idxs)) + for _, i := range idxs { + if t.taken[i] { + continue + } + t.taken[i] = true + t.nTaken++ + out = append(out, t.recs[i]) + } + return out +} + +// takeRemaining returns and consumes every comment not yet printed; the +// statement is over, so everything left trails it. +func (t *CommentTable) takeRemaining() []commentRec { + if t == nil { + return nil + } + var out []commentRec + for i := range t.recs { + if t.taken[i] { + continue + } + t.taken[i] = true + t.nTaken++ + out = append(out, t.recs[i]) + } + return out +} + +// AttachComments classifies a statement's interior comments against its +// nodes, producing the table the printer (and any future rewriting tool) +// works from. Placement follows gofmt's rules, decided here once from +// source positions and lines: a comment on the same line as the code before +// it trails that code; any other comment leads the first node printed after +// it; a comment after the last node trails the statement. +func AttachComments(raw *RawStmt, d format.Dialect, comments []Comment, src string) *CommentTable { + anchors := collectAnchors(raw, d) + lines := []int{0} + for i := 0; i < len(src); i++ { + if src[i] == '\n' { + lines = append(lines, i+1) + } + } + lineOf := func(pos int) int { + return sort.SearchInts(lines, pos+1) - 1 + } + + table := &CommentTable{byNext: make(map[Node][]int, len(anchors))} + for _, c := range comments { + // prev: the printed node with the greatest position before the + // comment (for the trailing/leading call). next: the emission point + // for the first printed node after the comment — the node itself, + // or, when boundary markers immediately precede it in print order, + // the earliest of those markers, which is where the printer will + // look for this comment first. + var prev, next Node + prevPos := -1 + for _, a := range anchors { + if !a.marker && a.pos < c.Start && a.pos > prevPos { + prev, prevPos = a.node, a.pos + } + } + for i, a := range anchors { + if a.marker || a.pos <= c.Start { + continue + } + j := i + for j > 0 && anchors[j-1].marker { + j-- + } + next = anchors[j].node + break + } + rec := commentRec{ + c: c, + prev: prev, + next: next, + trailing: !c.OwnLine && prev != nil && lineOf(prevPos) == lineOf(c.Start), + } + table.recs = append(table.recs, rec) + i := len(table.recs) - 1 + if next == nil { + table.end = append(table.end, i) + } else { + table.byNext[next] = append(table.byNext[next], i) + } + } + table.taken = make([]bool, len(table.recs)) + + // Record where the author broke the line: an emission point whose + // neighbouring printed nodes sit on different source lines. The printer + // keeps these breaks (and only imposes new ones for comments), so the + // statement's shape stays the author's. + table.breaks = make(map[Node]bool) + for i, a := range anchors { + if !a.marker { + continue + } + prevPos, nextPos := -1, -1 + for j := i - 1; j >= 0; j-- { + if !anchors[j].marker { + prevPos = anchors[j].pos + break + } + } + for j := i + 1; j < len(anchors); j++ { + if !anchors[j].marker { + nextPos = anchors[j].pos + break + } + } + if prevPos >= 0 && nextPos >= 0 && lineOf(prevPos) != lineOf(nextPos) { + table.breaks[a.node] = true + } + } + return table +} + +type anchor struct { + node Node + pos int + // marker anchors are emission points (beforeClause, list boundaries) + // rather than printed nodes; they carry no position of their own. + marker bool +} + +// collectAnchors renders the statement once, flat, recording every +// positioned node in the order the printer visits them. Print order is what +// comment emission is defined against, so classifying against it keeps the +// attach-time decision and the print-time emission point identical. +func collectAnchors(n Node, d format.Dialect) (out []anchor) { + defer func() { + // A formatter panic here surfaces later, on the real print; anchors + // collected so far still place most comments. + recover() + }() + tb := NewTrackedBuffer() + tb.anchors = &out + if ft, ok := n.(nodeFormatter); ok { + ft.Format(tb, d) + } + return out +} diff --git a/internal/sql/ast/comment_on_column_stmt.go b/internal/sql/ast/comment_on_column_stmt.go index 6438b4ccc7..c35517ee27 100644 --- a/internal/sql/ast/comment_on_column_stmt.go +++ b/internal/sql/ast/comment_on_column_stmt.go @@ -1,9 +1,11 @@ package ast type CommentOnColumnStmt struct { - Table *TableName - Col *ColumnRef - Comment *string + Tag NodeTag[CommentOnColumnStmt] `json:"tag"` + + Table *TableName `json:"table,omitempty"` + Col *ColumnRef `json:"col,omitempty"` + Comment *string `json:"comment,omitempty"` } func (n *CommentOnColumnStmt) Pos() int { diff --git a/internal/sql/ast/comment_on_schema_stmt.go b/internal/sql/ast/comment_on_schema_stmt.go index edff162db0..aac64c4cac 100644 --- a/internal/sql/ast/comment_on_schema_stmt.go +++ b/internal/sql/ast/comment_on_schema_stmt.go @@ -1,8 +1,10 @@ package ast type CommentOnSchemaStmt struct { - Schema *String - Comment *string + Tag NodeTag[CommentOnSchemaStmt] `json:"tag"` + + Schema *String `json:"schema,omitempty"` + Comment *string `json:"comment,omitempty"` } func (n *CommentOnSchemaStmt) Pos() int { diff --git a/internal/sql/ast/comment_on_table_stmt.go b/internal/sql/ast/comment_on_table_stmt.go index efb158f94b..d6056fa170 100644 --- a/internal/sql/ast/comment_on_table_stmt.go +++ b/internal/sql/ast/comment_on_table_stmt.go @@ -1,8 +1,10 @@ package ast type CommentOnTableStmt struct { - Table *TableName - Comment *string + Tag NodeTag[CommentOnTableStmt] `json:"tag"` + + Table *TableName `json:"table,omitempty"` + Comment *string `json:"comment,omitempty"` } func (n *CommentOnTableStmt) Pos() int { diff --git a/internal/sql/ast/comment_on_type_stmt.go b/internal/sql/ast/comment_on_type_stmt.go index eb90bf5115..616fca31cc 100644 --- a/internal/sql/ast/comment_on_type_stmt.go +++ b/internal/sql/ast/comment_on_type_stmt.go @@ -1,8 +1,10 @@ package ast type CommentOnTypeStmt struct { - Type *TypeName - Comment *string + Tag NodeTag[CommentOnTypeStmt] `json:"tag"` + + Type *TypeName `json:"type,omitempty"` + Comment *string `json:"comment,omitempty"` } func (n *CommentOnTypeStmt) Pos() int { diff --git a/internal/sql/ast/comment_on_view_stmt.go b/internal/sql/ast/comment_on_view_stmt.go index 2648d87918..c857f77c4c 100644 --- a/internal/sql/ast/comment_on_view_stmt.go +++ b/internal/sql/ast/comment_on_view_stmt.go @@ -1,8 +1,10 @@ package ast type CommentOnViewStmt struct { - View *TableName - Comment *string + Tag NodeTag[CommentOnViewStmt] `json:"tag"` + + View *TableName `json:"view,omitempty"` + Comment *string `json:"comment,omitempty"` } func (n *CommentOnViewStmt) Pos() int { diff --git a/internal/sql/ast/comment_stmt.go b/internal/sql/ast/comment_stmt.go index 304827a294..61f6269ac1 100644 --- a/internal/sql/ast/comment_stmt.go +++ b/internal/sql/ast/comment_stmt.go @@ -1,9 +1,11 @@ package ast type CommentStmt struct { - Objtype ObjectType - Object Node - Comment *string + Tag NodeTag[CommentStmt] `json:"tag"` + + Objtype ObjectType `json:"objtype"` + Object Node `json:"object,omitempty"` + Comment *string `json:"comment,omitempty"` } func (n *CommentStmt) Pos() int { diff --git a/internal/sql/ast/common_table_expr.go b/internal/sql/ast/common_table_expr.go index f2edddff79..84f7db47af 100644 --- a/internal/sql/ast/common_table_expr.go +++ b/internal/sql/ast/common_table_expr.go @@ -1,33 +1,49 @@ package ast -import ( - "fmt" -) +import "github.com/sqlc-dev/sqlc/internal/sql/format" type CommonTableExpr struct { - Ctename *string - Aliascolnames *List - Ctequery Node - Location int - Cterecursive bool - Cterefcount int - Ctecolnames *List - Ctecoltypes *List - Ctecoltypmods *List - Ctecolcollations *List + Tag NodeTag[CommonTableExpr] `json:"tag"` + + Ctename *string `json:"ctename,omitempty"` + Aliascolnames *List `json:"aliascolnames,omitempty"` + Ctequery Node `json:"ctequery,omitempty"` + Location int `json:"location"` + Cterecursive bool `json:"cterecursive"` + Cterefcount int `json:"cterefcount"` + Ctecolnames *List `json:"ctecolnames,omitempty"` + Ctecoltypes *List `json:"ctecoltypes,omitempty"` + Ctecoltypmods *List `json:"ctecoltypmods,omitempty"` + Ctecolcollations *List `json:"ctecolcollations,omitempty"` } func (n *CommonTableExpr) Pos() int { return n.Location } -func (n *CommonTableExpr) Format(buf *TrackedBuffer) { +func (n *CommonTableExpr) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } if n.Ctename != nil { - fmt.Fprintf(buf, " %s AS (", *n.Ctename) + buf.WriteString(*n.Ctename) + } + if items(n.Aliascolnames) { + buf.WriteString("(") + buf.join(n.Aliascolnames, d, ", ") + buf.WriteString(")") } - buf.astFormat(n.Ctequery) + buf.WriteString(" AS (") + buf.Group() + buf.Indent() + // The body's boundary: a comment at the top of the CTE prints here, and + // an author who broke the line after the parenthesis keeps the CTE — and + // therefore the statement around it — broken open. + buf.boundary(n.Ctequery) + buf.Softline() + buf.astFormat(n.Ctequery, d) + buf.EndIndent() + buf.Softline() + buf.EndGroup() buf.WriteString(")") } diff --git a/internal/sql/ast/composite_type_stmt.go b/internal/sql/ast/composite_type_stmt.go index f9a19b2653..a7f27a8b54 100644 --- a/internal/sql/ast/composite_type_stmt.go +++ b/internal/sql/ast/composite_type_stmt.go @@ -1,7 +1,11 @@ package ast type CompositeTypeStmt struct { - TypeName *TypeName + Tag NodeTag[CompositeTypeStmt] `json:"tag"` + + TypeName *TypeName `json:"type_name,omitempty"` + // Coldeflist is the type's fields, each a ColumnDef. + Coldeflist *List `json:"coldeflist,omitempty"` } func (n *CompositeTypeStmt) Pos() int { diff --git a/internal/sql/ast/const.go b/internal/sql/ast/const.go index d33f0e84ed..58d33e9920 100644 --- a/internal/sql/ast/const.go +++ b/internal/sql/ast/const.go @@ -1,15 +1,17 @@ package ast type Const struct { - Xpr Node - Consttype Oid - Consttypmod int32 - Constcollid Oid - Constlen int - Constvalue Datum - Constisnull bool - Constbyval bool - Location int + Tag NodeTag[Const] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Consttype Oid `json:"consttype"` + Consttypmod int32 `json:"consttypmod"` + Constcollid Oid `json:"constcollid"` + Constlen int `json:"constlen"` + Constvalue Datum `json:"constvalue"` + Constisnull bool `json:"constisnull"` + Constbyval bool `json:"constbyval"` + Location int `json:"location"` } func (n *Const) Pos() int { diff --git a/internal/sql/ast/constr_type.go b/internal/sql/ast/constr_type.go index d84e4d8c4a..c058682672 100644 --- a/internal/sql/ast/constr_type.go +++ b/internal/sql/ast/constr_type.go @@ -5,3 +5,10 @@ type ConstrType uint func (n *ConstrType) Pos() int { return 0 } + +// The constraint kinds the analysis reads, numbered as PostgreSQL's parser +// numbers them, which is what an engine's converter records. +const ( + ConstrTypeNull ConstrType = 1 + ConstrTypeNotNull ConstrType = 2 +) diff --git a/internal/sql/ast/constraint.go b/internal/sql/ast/constraint.go index 5b628506af..bd9c7348f1 100644 --- a/internal/sql/ast/constraint.go +++ b/internal/sql/ast/constraint.go @@ -1,32 +1,34 @@ package ast type Constraint struct { - Contype ConstrType - Conname *string - Deferrable bool - Initdeferred bool - Location int - IsNoInherit bool - RawExpr Node - CookedExpr *string - GeneratedWhen byte - Keys *List - Exclusions *List - Options *List - Indexname *string - Indexspace *string - AccessMethod *string - WhereClause Node - Pktable *RangeVar - FkAttrs *List - PkAttrs *List - FkMatchtype byte - FkUpdAction byte - FkDelAction byte - OldConpfeqop *List - OldPktableOid Oid - SkipValidation bool - InitiallyValid bool + Tag NodeTag[Constraint] `json:"tag"` + + Contype ConstrType `json:"contype"` + Conname *string `json:"conname,omitempty"` + Deferrable bool `json:"deferrable"` + Initdeferred bool `json:"initdeferred"` + Location int `json:"location"` + IsNoInherit bool `json:"is_no_inherit"` + RawExpr Node `json:"raw_expr,omitempty"` + CookedExpr *string `json:"cooked_expr,omitempty"` + GeneratedWhen byte `json:"generated_when"` + Keys *List `json:"keys,omitempty"` + Exclusions *List `json:"exclusions,omitempty"` + Options *List `json:"options,omitempty"` + Indexname *string `json:"indexname,omitempty"` + Indexspace *string `json:"indexspace,omitempty"` + AccessMethod *string `json:"access_method,omitempty"` + WhereClause Node `json:"where_clause,omitempty"` + Pktable *RangeVar `json:"pktable,omitempty"` + FkAttrs *List `json:"fk_attrs,omitempty"` + PkAttrs *List `json:"pk_attrs,omitempty"` + FkMatchtype byte `json:"fk_matchtype"` + FkUpdAction byte `json:"fk_upd_action"` + FkDelAction byte `json:"fk_del_action"` + OldConpfeqop *List `json:"old_conpfeqop,omitempty"` + OldPktableOid Oid `json:"old_pktable_oid"` + SkipValidation bool `json:"skip_validation"` + InitiallyValid bool `json:"initially_valid"` } func (n *Constraint) Pos() int { diff --git a/internal/sql/ast/constraints_set_stmt.go b/internal/sql/ast/constraints_set_stmt.go index ca0a33323d..b677dca751 100644 --- a/internal/sql/ast/constraints_set_stmt.go +++ b/internal/sql/ast/constraints_set_stmt.go @@ -1,8 +1,10 @@ package ast type ConstraintsSetStmt struct { - Constraints *List - Deferred bool + Tag NodeTag[ConstraintsSetStmt] `json:"tag"` + + Constraints *List `json:"constraints,omitempty"` + Deferred bool `json:"deferred"` } func (n *ConstraintsSetStmt) Pos() int { diff --git a/internal/sql/ast/convert_rowtype_expr.go b/internal/sql/ast/convert_rowtype_expr.go index 9e72c0c5c5..60c3f12c1d 100644 --- a/internal/sql/ast/convert_rowtype_expr.go +++ b/internal/sql/ast/convert_rowtype_expr.go @@ -1,11 +1,13 @@ package ast type ConvertRowtypeExpr struct { - Xpr Node - Arg Node - Resulttype Oid - Convertformat CoercionForm - Location int + Tag NodeTag[ConvertRowtypeExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Resulttype Oid `json:"resulttype"` + Convertformat CoercionForm `json:"convertformat"` + Location int `json:"location"` } func (n *ConvertRowtypeExpr) Pos() int { diff --git a/internal/sql/ast/copy_stmt.go b/internal/sql/ast/copy_stmt.go index 65d4dc69cc..93d83d6fde 100644 --- a/internal/sql/ast/copy_stmt.go +++ b/internal/sql/ast/copy_stmt.go @@ -1,13 +1,15 @@ package ast type CopyStmt struct { - Relation *RangeVar - Query Node - Attlist *List - IsFrom bool - IsProgram bool - Filename *string - Options *List + Tag NodeTag[CopyStmt] `json:"tag"` + + Relation *RangeVar `json:"relation,omitempty"` + Query Node `json:"query,omitempty"` + Attlist *List `json:"attlist,omitempty"` + IsFrom bool `json:"is_from"` + IsProgram bool `json:"is_program"` + Filename *string `json:"filename,omitempty"` + Options *List `json:"options,omitempty"` } func (n *CopyStmt) Pos() int { diff --git a/internal/sql/ast/create_am_stmt.go b/internal/sql/ast/create_am_stmt.go index 16fe6455c5..8f0859067b 100644 --- a/internal/sql/ast/create_am_stmt.go +++ b/internal/sql/ast/create_am_stmt.go @@ -1,9 +1,11 @@ package ast type CreateAmStmt struct { - Amname *string - HandlerName *List - Amtype byte + Tag NodeTag[CreateAmStmt] `json:"tag"` + + Amname *string `json:"amname,omitempty"` + HandlerName *List `json:"handler_name,omitempty"` + Amtype byte `json:"amtype"` } func (n *CreateAmStmt) Pos() int { diff --git a/internal/sql/ast/create_cast_stmt.go b/internal/sql/ast/create_cast_stmt.go index 7ae94d3c6b..188d633c8c 100644 --- a/internal/sql/ast/create_cast_stmt.go +++ b/internal/sql/ast/create_cast_stmt.go @@ -1,11 +1,13 @@ package ast type CreateCastStmt struct { - Sourcetype *TypeName - Targettype *TypeName - Func *ObjectWithArgs - Context CoercionContext - Inout bool + Tag NodeTag[CreateCastStmt] `json:"tag"` + + Sourcetype *TypeName `json:"sourcetype,omitempty"` + Targettype *TypeName `json:"targettype,omitempty"` + Func *ObjectWithArgs `json:"func,omitempty"` + Context CoercionContext `json:"context"` + Inout bool `json:"inout"` } func (n *CreateCastStmt) Pos() int { diff --git a/internal/sql/ast/create_conversion_stmt.go b/internal/sql/ast/create_conversion_stmt.go index c0f4de14b1..38be006520 100644 --- a/internal/sql/ast/create_conversion_stmt.go +++ b/internal/sql/ast/create_conversion_stmt.go @@ -1,11 +1,13 @@ package ast type CreateConversionStmt struct { - ConversionName *List - ForEncodingName *string - ToEncodingName *string - FuncName *List - Def bool + Tag NodeTag[CreateConversionStmt] `json:"tag"` + + ConversionName *List `json:"conversion_name,omitempty"` + ForEncodingName *string `json:"for_encoding_name,omitempty"` + ToEncodingName *string `json:"to_encoding_name,omitempty"` + FuncName *List `json:"func_name,omitempty"` + Def bool `json:"def"` } func (n *CreateConversionStmt) Pos() int { diff --git a/internal/sql/ast/create_domain_stmt.go b/internal/sql/ast/create_domain_stmt.go index 3c541c4b2e..8cc2324c35 100644 --- a/internal/sql/ast/create_domain_stmt.go +++ b/internal/sql/ast/create_domain_stmt.go @@ -1,10 +1,12 @@ package ast type CreateDomainStmt struct { - Domainname *List - TypeName *TypeName - CollClause *CollateClause - Constraints *List + Tag NodeTag[CreateDomainStmt] `json:"tag"` + + Domainname *List `json:"domainname,omitempty"` + TypeName *TypeName `json:"type_name,omitempty"` + CollClause *CollateClause `json:"coll_clause,omitempty"` + Constraints *List `json:"constraints,omitempty"` } func (n *CreateDomainStmt) Pos() int { diff --git a/internal/sql/ast/create_enum_stmt.go b/internal/sql/ast/create_enum_stmt.go index a7d2df0fc9..f38316b4aa 100644 --- a/internal/sql/ast/create_enum_stmt.go +++ b/internal/sql/ast/create_enum_stmt.go @@ -1,8 +1,10 @@ package ast type CreateEnumStmt struct { - TypeName *TypeName - Vals *List + Tag NodeTag[CreateEnumStmt] `json:"tag"` + + TypeName *TypeName `json:"type_name,omitempty"` + Vals *List `json:"vals,omitempty"` } func (n *CreateEnumStmt) Pos() int { diff --git a/internal/sql/ast/create_event_trig_stmt.go b/internal/sql/ast/create_event_trig_stmt.go index 276b32a6a0..eea8012286 100644 --- a/internal/sql/ast/create_event_trig_stmt.go +++ b/internal/sql/ast/create_event_trig_stmt.go @@ -1,10 +1,12 @@ package ast type CreateEventTrigStmt struct { - Trigname *string - Eventname *string - Whenclause *List - Funcname *List + Tag NodeTag[CreateEventTrigStmt] `json:"tag"` + + Trigname *string `json:"trigname,omitempty"` + Eventname *string `json:"eventname,omitempty"` + Whenclause *List `json:"whenclause,omitempty"` + Funcname *List `json:"funcname,omitempty"` } func (n *CreateEventTrigStmt) Pos() int { diff --git a/internal/sql/ast/create_extension_stmt.go b/internal/sql/ast/create_extension_stmt.go index 2fe8755b6a..d73aed8308 100644 --- a/internal/sql/ast/create_extension_stmt.go +++ b/internal/sql/ast/create_extension_stmt.go @@ -1,11 +1,28 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CreateExtensionStmt struct { - Extname *string - IfNotExists bool - Options *List + Tag NodeTag[CreateExtensionStmt] `json:"tag"` + + Extname *string `json:"extname,omitempty"` + IfNotExists bool `json:"if_not_exists"` + Options *List `json:"options,omitempty"` } func (n *CreateExtensionStmt) Pos() int { return 0 } + +func (n *CreateExtensionStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("CREATE EXTENSION ") + if n.IfNotExists { + buf.WriteString("IF NOT EXISTS ") + } + if n.Extname != nil { + buf.WriteString(*n.Extname) + } +} diff --git a/internal/sql/ast/create_fdw_stmt.go b/internal/sql/ast/create_fdw_stmt.go index fd97378308..74cb794294 100644 --- a/internal/sql/ast/create_fdw_stmt.go +++ b/internal/sql/ast/create_fdw_stmt.go @@ -1,9 +1,11 @@ package ast type CreateFdwStmt struct { - Fdwname *string - FuncOptions *List - Options *List + Tag NodeTag[CreateFdwStmt] `json:"tag"` + + Fdwname *string `json:"fdwname,omitempty"` + FuncOptions *List `json:"func_options,omitempty"` + Options *List `json:"options,omitempty"` } func (n *CreateFdwStmt) Pos() int { diff --git a/internal/sql/ast/create_foreign_server_stmt.go b/internal/sql/ast/create_foreign_server_stmt.go index b7d24445b4..da9d78a58e 100644 --- a/internal/sql/ast/create_foreign_server_stmt.go +++ b/internal/sql/ast/create_foreign_server_stmt.go @@ -1,12 +1,14 @@ package ast type CreateForeignServerStmt struct { - Servername *string - Servertype *string - Version *string - Fdwname *string - IfNotExists bool - Options *List + Tag NodeTag[CreateForeignServerStmt] `json:"tag"` + + Servername *string `json:"servername,omitempty"` + Servertype *string `json:"servertype,omitempty"` + Version *string `json:"version,omitempty"` + Fdwname *string `json:"fdwname,omitempty"` + IfNotExists bool `json:"if_not_exists"` + Options *List `json:"options,omitempty"` } func (n *CreateForeignServerStmt) Pos() int { diff --git a/internal/sql/ast/create_foreign_table_stmt.go b/internal/sql/ast/create_foreign_table_stmt.go index 6661588786..764e72996d 100644 --- a/internal/sql/ast/create_foreign_table_stmt.go +++ b/internal/sql/ast/create_foreign_table_stmt.go @@ -1,9 +1,11 @@ package ast type CreateForeignTableStmt struct { - Base *CreateStmt - Servername *string - Options *List + Tag NodeTag[CreateForeignTableStmt] `json:"tag"` + + Base *CreateStmt `json:"base,omitempty"` + Servername *string `json:"servername,omitempty"` + Options *List `json:"options,omitempty"` } func (n *CreateForeignTableStmt) Pos() int { diff --git a/internal/sql/ast/create_function_stmt.go b/internal/sql/ast/create_function_stmt.go index a1e0b8f728..3fb3bb79fa 100644 --- a/internal/sql/ast/create_function_stmt.go +++ b/internal/sql/ast/create_function_stmt.go @@ -1,15 +1,47 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CreateFunctionStmt struct { - Replace bool - Params *List - ReturnType *TypeName - Func *FuncName - // TODO: Undertand these two fields - Options *List - WithClause *List + Tag NodeTag[CreateFunctionStmt] `json:"tag"` + + Replace bool `json:"replace"` + Params *List `json:"params,omitempty"` + ReturnType *TypeName `json:"return_type,omitempty"` + Func *FuncName `json:"func,omitempty"` + // TODO: Understand these two fields + Options *List `json:"options,omitempty"` + WithClause *List `json:"with_clause,omitempty"` } func (n *CreateFunctionStmt) Pos() int { return 0 } + +func (n *CreateFunctionStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("CREATE ") + if n.Replace { + buf.WriteString("OR REPLACE ") + } + buf.WriteString("FUNCTION ") + buf.astFormat(n.Func, d) + buf.WriteString("(") + if items(n.Params) { + buf.join(n.Params, d, ", ") + } + buf.WriteString(")") + if n.ReturnType != nil { + buf.WriteString(" RETURNS ") + buf.astFormat(n.ReturnType, d) + } + // Format options (AS, LANGUAGE, etc.) + if items(n.Options) { + for _, opt := range n.Options.Items { + buf.WriteString(" ") + buf.astFormat(opt, d) + } + } +} diff --git a/internal/sql/ast/create_op_class_item.go b/internal/sql/ast/create_op_class_item.go index 09621bd0d8..0b1f4ad728 100644 --- a/internal/sql/ast/create_op_class_item.go +++ b/internal/sql/ast/create_op_class_item.go @@ -1,12 +1,14 @@ package ast type CreateOpClassItem struct { - Itemtype int - Name *ObjectWithArgs - Number int - OrderFamily *List - ClassArgs *List - Storedtype *TypeName + Tag NodeTag[CreateOpClassItem] `json:"tag"` + + Itemtype int `json:"itemtype"` + Name *ObjectWithArgs `json:"name,omitempty"` + Number int `json:"number"` + OrderFamily *List `json:"order_family,omitempty"` + ClassArgs *List `json:"class_args,omitempty"` + Storedtype *TypeName `json:"storedtype,omitempty"` } func (n *CreateOpClassItem) Pos() int { diff --git a/internal/sql/ast/create_op_class_stmt.go b/internal/sql/ast/create_op_class_stmt.go index a4ab7b067c..9b606c4610 100644 --- a/internal/sql/ast/create_op_class_stmt.go +++ b/internal/sql/ast/create_op_class_stmt.go @@ -1,12 +1,14 @@ package ast type CreateOpClassStmt struct { - Opclassname *List - Opfamilyname *List - Amname *string - Datatype *TypeName - Items *List - IsDefault bool + Tag NodeTag[CreateOpClassStmt] `json:"tag"` + + Opclassname *List `json:"opclassname,omitempty"` + Opfamilyname *List `json:"opfamilyname,omitempty"` + Amname *string `json:"amname,omitempty"` + Datatype *TypeName `json:"datatype,omitempty"` + Items *List `json:"items,omitempty"` + IsDefault bool `json:"is_default"` } func (n *CreateOpClassStmt) Pos() int { diff --git a/internal/sql/ast/create_op_family_stmt.go b/internal/sql/ast/create_op_family_stmt.go index b939625ed3..4db1cc411b 100644 --- a/internal/sql/ast/create_op_family_stmt.go +++ b/internal/sql/ast/create_op_family_stmt.go @@ -1,8 +1,10 @@ package ast type CreateOpFamilyStmt struct { - Opfamilyname *List - Amname *string + Tag NodeTag[CreateOpFamilyStmt] `json:"tag"` + + Opfamilyname *List `json:"opfamilyname,omitempty"` + Amname *string `json:"amname,omitempty"` } func (n *CreateOpFamilyStmt) Pos() int { diff --git a/internal/sql/ast/create_p_lang_stmt.go b/internal/sql/ast/create_p_lang_stmt.go index 5f11ce9eb1..f6d43980e9 100644 --- a/internal/sql/ast/create_p_lang_stmt.go +++ b/internal/sql/ast/create_p_lang_stmt.go @@ -1,12 +1,14 @@ package ast type CreatePLangStmt struct { - Replace bool - Plname *string - Plhandler *List - Plinline *List - Plvalidator *List - Pltrusted bool + Tag NodeTag[CreatePLangStmt] `json:"tag"` + + Replace bool `json:"replace"` + Plname *string `json:"plname,omitempty"` + Plhandler *List `json:"plhandler,omitempty"` + Plinline *List `json:"plinline,omitempty"` + Plvalidator *List `json:"plvalidator,omitempty"` + Pltrusted bool `json:"pltrusted"` } func (n *CreatePLangStmt) Pos() int { diff --git a/internal/sql/ast/create_policy_stmt.go b/internal/sql/ast/create_policy_stmt.go index 39e244f7a4..3d191a2480 100644 --- a/internal/sql/ast/create_policy_stmt.go +++ b/internal/sql/ast/create_policy_stmt.go @@ -1,13 +1,15 @@ package ast type CreatePolicyStmt struct { - PolicyName *string - Table *RangeVar - CmdName *string - Permissive bool - Roles *List - Qual Node - WithCheck Node + Tag NodeTag[CreatePolicyStmt] `json:"tag"` + + PolicyName *string `json:"policy_name,omitempty"` + Table *RangeVar `json:"table,omitempty"` + CmdName *string `json:"cmd_name,omitempty"` + Permissive bool `json:"permissive"` + Roles *List `json:"roles,omitempty"` + Qual Node `json:"qual,omitempty"` + WithCheck Node `json:"with_check,omitempty"` } func (n *CreatePolicyStmt) Pos() int { diff --git a/internal/sql/ast/create_publication_stmt.go b/internal/sql/ast/create_publication_stmt.go index 5d0b6a05f5..90e0c737af 100644 --- a/internal/sql/ast/create_publication_stmt.go +++ b/internal/sql/ast/create_publication_stmt.go @@ -1,10 +1,12 @@ package ast type CreatePublicationStmt struct { - Pubname *string - Options *List - Tables *List - ForAllTables bool + Tag NodeTag[CreatePublicationStmt] `json:"tag"` + + Pubname *string `json:"pubname,omitempty"` + Options *List `json:"options,omitempty"` + Tables *List `json:"tables,omitempty"` + ForAllTables bool `json:"for_all_tables"` } func (n *CreatePublicationStmt) Pos() int { diff --git a/internal/sql/ast/create_range_stmt.go b/internal/sql/ast/create_range_stmt.go index 6e0aaa5092..7ac3b8a353 100644 --- a/internal/sql/ast/create_range_stmt.go +++ b/internal/sql/ast/create_range_stmt.go @@ -1,8 +1,10 @@ package ast type CreateRangeStmt struct { - TypeName *List - Params *List + Tag NodeTag[CreateRangeStmt] `json:"tag"` + + TypeName *List `json:"type_name,omitempty"` + Params *List `json:"params,omitempty"` } func (n *CreateRangeStmt) Pos() int { diff --git a/internal/sql/ast/create_role_stmt.go b/internal/sql/ast/create_role_stmt.go index 144540863e..667d702dd9 100644 --- a/internal/sql/ast/create_role_stmt.go +++ b/internal/sql/ast/create_role_stmt.go @@ -1,9 +1,11 @@ package ast type CreateRoleStmt struct { - StmtType RoleStmtType - Role *string - Options *List + Tag NodeTag[CreateRoleStmt] `json:"tag"` + + StmtType RoleStmtType `json:"stmt_type"` + Role *string `json:"role,omitempty"` + Options *List `json:"options,omitempty"` } func (n *CreateRoleStmt) Pos() int { diff --git a/internal/sql/ast/create_schema_stmt.go b/internal/sql/ast/create_schema_stmt.go index 522f404ec4..e07dafaffd 100644 --- a/internal/sql/ast/create_schema_stmt.go +++ b/internal/sql/ast/create_schema_stmt.go @@ -1,10 +1,12 @@ package ast type CreateSchemaStmt struct { - Name *string - SchemaElts *List - Authrole *RoleSpec - IfNotExists bool + Tag NodeTag[CreateSchemaStmt] `json:"tag"` + + Name *string `json:"name,omitempty"` + SchemaElts *List `json:"schema_elts,omitempty"` + Authrole *RoleSpec `json:"authrole,omitempty"` + IfNotExists bool `json:"if_not_exists"` } func (n *CreateSchemaStmt) Pos() int { diff --git a/internal/sql/ast/create_seq_stmt.go b/internal/sql/ast/create_seq_stmt.go index f7b9ef564d..66c35a7080 100644 --- a/internal/sql/ast/create_seq_stmt.go +++ b/internal/sql/ast/create_seq_stmt.go @@ -1,11 +1,13 @@ package ast type CreateSeqStmt struct { - Sequence *RangeVar - Options *List - OwnerId Oid - ForIdentity bool - IfNotExists bool + Tag NodeTag[CreateSeqStmt] `json:"tag"` + + Sequence *RangeVar `json:"sequence,omitempty"` + Options *List `json:"options,omitempty"` + OwnerId Oid `json:"owner_id"` + ForIdentity bool `json:"for_identity"` + IfNotExists bool `json:"if_not_exists"` } func (n *CreateSeqStmt) Pos() int { diff --git a/internal/sql/ast/create_stats_stmt.go b/internal/sql/ast/create_stats_stmt.go index 4bd64e162c..17b8af22a3 100644 --- a/internal/sql/ast/create_stats_stmt.go +++ b/internal/sql/ast/create_stats_stmt.go @@ -1,11 +1,13 @@ package ast type CreateStatsStmt struct { - Defnames *List - StatTypes *List - Exprs *List - Relations *List - IfNotExists bool + Tag NodeTag[CreateStatsStmt] `json:"tag"` + + Defnames *List `json:"defnames,omitempty"` + StatTypes *List `json:"stat_types,omitempty"` + Exprs *List `json:"exprs,omitempty"` + Relations *List `json:"relations,omitempty"` + IfNotExists bool `json:"if_not_exists"` } func (n *CreateStatsStmt) Pos() int { diff --git a/internal/sql/ast/create_stmt.go b/internal/sql/ast/create_stmt.go index 7982b690a2..5d69e7bb16 100644 --- a/internal/sql/ast/create_stmt.go +++ b/internal/sql/ast/create_stmt.go @@ -1,17 +1,19 @@ package ast type CreateStmt struct { - Relation *RangeVar - TableElts *List - InhRelations *List - Partbound *PartitionBoundSpec - Partspec *PartitionSpec - OfTypename *TypeName - Constraints *List - Options *List - Oncommit OnCommitAction - Tablespacename *string - IfNotExists bool + Tag NodeTag[CreateStmt] `json:"tag"` + + Relation *RangeVar `json:"relation,omitempty"` + TableElts *List `json:"table_elts,omitempty"` + InhRelations *List `json:"inh_relations,omitempty"` + Partbound *PartitionBoundSpec `json:"partbound,omitempty"` + Partspec *PartitionSpec `json:"partspec,omitempty"` + OfTypename *TypeName `json:"of_typename,omitempty"` + Constraints *List `json:"constraints,omitempty"` + Options *List `json:"options,omitempty"` + Oncommit OnCommitAction `json:"oncommit"` + Tablespacename *string `json:"tablespacename,omitempty"` + IfNotExists bool `json:"if_not_exists"` } func (n *CreateStmt) Pos() int { diff --git a/internal/sql/ast/create_subscription_stmt.go b/internal/sql/ast/create_subscription_stmt.go index 1d7d49c403..d4c3c678a4 100644 --- a/internal/sql/ast/create_subscription_stmt.go +++ b/internal/sql/ast/create_subscription_stmt.go @@ -1,10 +1,12 @@ package ast type CreateSubscriptionStmt struct { - Subname *string - Conninfo *string - Publication *List - Options *List + Tag NodeTag[CreateSubscriptionStmt] `json:"tag"` + + Subname *string `json:"subname,omitempty"` + Conninfo *string `json:"conninfo,omitempty"` + Publication *List `json:"publication,omitempty"` + Options *List `json:"options,omitempty"` } func (n *CreateSubscriptionStmt) Pos() int { diff --git a/internal/sql/ast/create_table_as_stmt.go b/internal/sql/ast/create_table_as_stmt.go index 6dbf291de4..862d0c45d0 100644 --- a/internal/sql/ast/create_table_as_stmt.go +++ b/internal/sql/ast/create_table_as_stmt.go @@ -1,11 +1,13 @@ package ast type CreateTableAsStmt struct { - Query Node - Into *IntoClause - Relkind ObjectType - IsSelectInto bool - IfNotExists bool + Tag NodeTag[CreateTableAsStmt] `json:"tag"` + + Query Node `json:"query,omitempty"` + Into *IntoClause `json:"into,omitempty"` + Relkind ObjectType `json:"relkind"` + IsSelectInto bool `json:"is_select_into"` + IfNotExists bool `json:"if_not_exists"` } func (n *CreateTableAsStmt) Pos() int { diff --git a/internal/sql/ast/create_table_space_stmt.go b/internal/sql/ast/create_table_space_stmt.go index 92951572d3..7c55d5d86a 100644 --- a/internal/sql/ast/create_table_space_stmt.go +++ b/internal/sql/ast/create_table_space_stmt.go @@ -1,10 +1,12 @@ package ast type CreateTableSpaceStmt struct { - Tablespacename *string - Owner *RoleSpec - Location *string - Options *List + Tag NodeTag[CreateTableSpaceStmt] `json:"tag"` + + Tablespacename *string `json:"tablespacename,omitempty"` + Owner *RoleSpec `json:"owner,omitempty"` + Location *string `json:"location,omitempty"` + Options *List `json:"options,omitempty"` } func (n *CreateTableSpaceStmt) Pos() int { diff --git a/internal/sql/ast/create_table_stmt.go b/internal/sql/ast/create_table_stmt.go index ce88a1b244..4abe5d09fb 100644 --- a/internal/sql/ast/create_table_stmt.go +++ b/internal/sql/ast/create_table_stmt.go @@ -1,31 +1,106 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type CreateTableStmt struct { - IfNotExists bool - Name *TableName - Cols []*ColumnDef - ReferTable *TableName - Comment string - Inherits []*TableName + Tag NodeTag[CreateTableStmt] `json:"tag"` + + IfNotExists bool `json:"if_not_exists"` + Name *TableName `json:"name,omitempty"` + Cols []*ColumnDef `json:"cols,omitempty"` + ReferTable *TableName `json:"refer_table,omitempty"` + Comment string `json:"comment"` + Inherits []*TableName `json:"inherits,omitempty"` + // Using names the module of a virtual table (SQLite's CREATE VIRTUAL + // TABLE ... USING module(...)), and ModuleArgs carries the module's + // argument list as written — its grammar belongs to the module, so the + // arguments pass through verbatim; nil means the declaration had no + // argument list at all. Cols still holds the columns sqlc derives from + // the arguments for the catalog; the statement prints as its + // declaration, not as those columns. + Using string `json:"using"` + ModuleArgs []string `json:"module_args,omitempty"` + // ModuleArgsMultiline records that the declaration was written across + // lines. The arguments carry no positions, so the printer cannot keep + // the author's exact breaks and prints the canonical broken form — one + // argument per line — instead. + ModuleArgsMultiline bool `json:"module_args_multiline"` + // Incomplete marks a statement whose source carried syntax this node + // does not model — column or table constraints beyond plain NOT NULL + // and PRIMARY KEY, table options, TEMP, or an AS SELECT body. No + // faithful rendering exists for it. + Incomplete bool `json:"incomplete"` } func (n *CreateTableStmt) Pos() int { return 0 } -func (n *CreateTableStmt) Format(buf *TrackedBuffer) { +func (n *CreateTableStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } + // A virtual table prints as its declaration: the module name and the + // argument list as written. + if n.Using != "" { + buf.WriteString("CREATE VIRTUAL TABLE ") + if n.IfNotExists { + buf.WriteString("IF NOT EXISTS ") + } + buf.astFormat(n.Name, d) + buf.WriteString(" USING ") + buf.WriteString(n.Using) + if n.ModuleArgs != nil { + buf.WriteString("(") + buf.Group() + buf.Indent() + if n.ModuleArgsMultiline { + buf.Breaker() + } + buf.Softline() + for i, arg := range n.ModuleArgs { + if i > 0 { + buf.WriteString(",") + buf.Line() + } + buf.WriteString(arg) + } + buf.EndIndent() + buf.Softline() + buf.EndGroup() + buf.WriteString(")") + } + return + } + // An incomplete statement cannot be printed back: part of its source + // was parsed away. Render nothing, which no verification accepts, so + // the formatter keeps the statement as written. + if n.Incomplete { + return + } buf.WriteString("CREATE TABLE ") - buf.astFormat(n.Name) + if n.IfNotExists { + buf.WriteString("IF NOT EXISTS ") + } + buf.astFormat(n.Name, d) - buf.WriteString("(") + buf.WriteString(" (") + buf.Group() + buf.Indent() + if len(n.Cols) > 0 { + buf.boundary(n.Cols[0]) + } + buf.Softline() for i, col := range n.Cols { if i > 0 { - buf.WriteString(", ") + buf.WriteString(",") + buf.boundary(col) + buf.Line() } - buf.astFormat(col) + buf.astFormat(col, d) } + buf.EndIndent() + buf.Softline() + buf.EndGroup() buf.WriteString(")") } diff --git a/internal/sql/ast/create_transform_stmt.go b/internal/sql/ast/create_transform_stmt.go index ef83e2c49a..20b0c633fc 100644 --- a/internal/sql/ast/create_transform_stmt.go +++ b/internal/sql/ast/create_transform_stmt.go @@ -1,11 +1,13 @@ package ast type CreateTransformStmt struct { - Replace bool - TypeName *TypeName - Lang *string - Fromsql *ObjectWithArgs - Tosql *ObjectWithArgs + Tag NodeTag[CreateTransformStmt] `json:"tag"` + + Replace bool `json:"replace"` + TypeName *TypeName `json:"type_name,omitempty"` + Lang *string `json:"lang,omitempty"` + Fromsql *ObjectWithArgs `json:"fromsql,omitempty"` + Tosql *ObjectWithArgs `json:"tosql,omitempty"` } func (n *CreateTransformStmt) Pos() int { diff --git a/internal/sql/ast/create_trig_stmt.go b/internal/sql/ast/create_trig_stmt.go index acecce084c..b0c81d6891 100644 --- a/internal/sql/ast/create_trig_stmt.go +++ b/internal/sql/ast/create_trig_stmt.go @@ -1,20 +1,22 @@ package ast type CreateTrigStmt struct { - Trigname *string - Relation *RangeVar - Funcname *List - Args *List - Row bool - Timing int16 - Events int16 - Columns *List - WhenClause Node - Isconstraint bool - TransitionRels *List - Deferrable bool - Initdeferred bool - Constrrel *RangeVar + Tag NodeTag[CreateTrigStmt] `json:"tag"` + + Trigname *string `json:"trigname,omitempty"` + Relation *RangeVar `json:"relation,omitempty"` + Funcname *List `json:"funcname,omitempty"` + Args *List `json:"args,omitempty"` + Row bool `json:"row"` + Timing int16 `json:"timing"` + Events int16 `json:"events"` + Columns *List `json:"columns,omitempty"` + WhenClause Node `json:"when_clause,omitempty"` + Isconstraint bool `json:"isconstraint"` + TransitionRels *List `json:"transition_rels,omitempty"` + Deferrable bool `json:"deferrable"` + Initdeferred bool `json:"initdeferred"` + Constrrel *RangeVar `json:"constrrel,omitempty"` } func (n *CreateTrigStmt) Pos() int { diff --git a/internal/sql/ast/create_user_mapping_stmt.go b/internal/sql/ast/create_user_mapping_stmt.go index f5fd41f76c..e67bd62302 100644 --- a/internal/sql/ast/create_user_mapping_stmt.go +++ b/internal/sql/ast/create_user_mapping_stmt.go @@ -1,10 +1,12 @@ package ast type CreateUserMappingStmt struct { - User *RoleSpec - Servername *string - IfNotExists bool - Options *List + Tag NodeTag[CreateUserMappingStmt] `json:"tag"` + + User *RoleSpec `json:"user,omitempty"` + Servername *string `json:"servername,omitempty"` + IfNotExists bool `json:"if_not_exists"` + Options *List `json:"options,omitempty"` } func (n *CreateUserMappingStmt) Pos() int { diff --git a/internal/sql/ast/createdb_stmt.go b/internal/sql/ast/createdb_stmt.go index 114505862d..ee08567a07 100644 --- a/internal/sql/ast/createdb_stmt.go +++ b/internal/sql/ast/createdb_stmt.go @@ -1,8 +1,10 @@ package ast type CreatedbStmt struct { - Dbname *string - Options *List + Tag NodeTag[CreatedbStmt] `json:"tag"` + + Dbname *string `json:"dbname,omitempty"` + Options *List `json:"options,omitempty"` } func (n *CreatedbStmt) Pos() int { diff --git a/internal/sql/ast/current_of_expr.go b/internal/sql/ast/current_of_expr.go index 88b457f8d2..ac9eb35b3f 100644 --- a/internal/sql/ast/current_of_expr.go +++ b/internal/sql/ast/current_of_expr.go @@ -1,10 +1,12 @@ package ast type CurrentOfExpr struct { - Xpr Node - Cvarno Index - CursorName *string - CursorParam int + Tag NodeTag[CurrentOfExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Cvarno Index `json:"cvarno"` + CursorName *string `json:"cursor_name,omitempty"` + CursorParam int `json:"cursor_param"` } func (n *CurrentOfExpr) Pos() int { diff --git a/internal/sql/ast/deallocate_stmt.go b/internal/sql/ast/deallocate_stmt.go index b11807b57b..c51908fb82 100644 --- a/internal/sql/ast/deallocate_stmt.go +++ b/internal/sql/ast/deallocate_stmt.go @@ -1,7 +1,9 @@ package ast type DeallocateStmt struct { - Name *string + Tag NodeTag[DeallocateStmt] `json:"tag"` + + Name *string `json:"name,omitempty"` } func (n *DeallocateStmt) Pos() int { diff --git a/internal/sql/ast/declare_cursor_stmt.go b/internal/sql/ast/declare_cursor_stmt.go index 82b0e6a2e0..52c8a226d5 100644 --- a/internal/sql/ast/declare_cursor_stmt.go +++ b/internal/sql/ast/declare_cursor_stmt.go @@ -1,9 +1,11 @@ package ast type DeclareCursorStmt struct { - Portalname *string - Options int - Query Node + Tag NodeTag[DeclareCursorStmt] `json:"tag"` + + Portalname *string `json:"portalname,omitempty"` + Options int `json:"options"` + Query Node `json:"query,omitempty"` } func (n *DeclareCursorStmt) Pos() int { diff --git a/internal/sql/ast/def_elem.go b/internal/sql/ast/def_elem.go index 03ecf88e77..9ccf44366a 100644 --- a/internal/sql/ast/def_elem.go +++ b/internal/sql/ast/def_elem.go @@ -1,13 +1,70 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type DefElem struct { - Defnamespace *string - Defname *string - Arg Node - Defaction DefElemAction - Location int + Tag NodeTag[DefElem] `json:"tag"` + + Defnamespace *string `json:"defnamespace,omitempty"` + Defname *string `json:"defname,omitempty"` + Arg Node `json:"arg,omitempty"` + Defaction DefElemAction `json:"defaction"` + Location int `json:"location"` } func (n *DefElem) Pos() int { return n.Location } + +func (n *DefElem) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Defname != nil { + switch *n.Defname { + case "as": + buf.WriteString("AS ") + // AS clause contains function body which needs quoting + if l, ok := n.Arg.(*List); ok { + for i, item := range l.Items { + if i > 0 { + buf.WriteString(", ") + } + if s, ok := item.(*String); ok { + buf.WriteString("'") + buf.WriteString(s.Str) + buf.WriteString("'") + } else { + buf.astFormat(item, d) + } + } + } else { + buf.astFormat(n.Arg, d) + } + case "language": + buf.WriteString("LANGUAGE ") + buf.astFormat(n.Arg, d) + case "volatility": + // VOLATILE, STABLE, IMMUTABLE + buf.astFormat(n.Arg, d) + case "strict": + if s, ok := n.Arg.(*Boolean); ok && s.Boolval { + buf.WriteString("STRICT") + } else { + buf.WriteString("CALLED ON NULL INPUT") + } + case "security": + if s, ok := n.Arg.(*Boolean); ok && s.Boolval { + buf.WriteString("SECURITY DEFINER") + } else { + buf.WriteString("SECURITY INVOKER") + } + default: + buf.WriteString(*n.Defname) + if n.Arg != nil { + buf.WriteString(" ") + buf.astFormat(n.Arg, d) + } + } + } +} diff --git a/internal/sql/ast/define_stmt.go b/internal/sql/ast/define_stmt.go index 3860183d7e..9ac5e7a1e8 100644 --- a/internal/sql/ast/define_stmt.go +++ b/internal/sql/ast/define_stmt.go @@ -1,12 +1,14 @@ package ast type DefineStmt struct { - Kind ObjectType - Oldstyle bool - Defnames *List - Args *List - Definition *List - IfNotExists bool + Tag NodeTag[DefineStmt] `json:"tag"` + + Kind ObjectType `json:"kind"` + Oldstyle bool `json:"oldstyle"` + Defnames *List `json:"defnames,omitempty"` + Args *List `json:"args,omitempty"` + Definition *List `json:"definition,omitempty"` + IfNotExists bool `json:"if_not_exists"` } func (n *DefineStmt) Pos() int { diff --git a/internal/sql/ast/delete_stmt.go b/internal/sql/ast/delete_stmt.go index d77f043a12..5d584b6d0c 100644 --- a/internal/sql/ast/delete_stmt.go +++ b/internal/sql/ast/delete_stmt.go @@ -1,45 +1,91 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type DeleteStmt struct { - Relations *List - UsingClause *List - WhereClause Node - LimitCount Node - ReturningList *List - WithClause *WithClause + Tag NodeTag[DeleteStmt] `json:"tag"` + + Relations *List `json:"relations,omitempty"` + UsingClause *List `json:"using_clause,omitempty"` + WhereClause Node `json:"where_clause,omitempty"` + LimitCount Node `json:"limit_count,omitempty"` + ReturningList *List `json:"returning_list,omitempty"` + WithClause *WithClause `json:"with_clause,omitempty"` + // MySQL multi-table DELETE support + Targets *List `json:"targets,omitempty"` // Tables to delete from (e.g., jt.*, pt.*) + FromClause Node `json:"from_clause,omitempty"` // FROM clause with JOINs (Node to support JoinExpr) + // PostgreSQL 18 RETURNING WITH (OLD AS ..., NEW AS ...) aliases + ReturningOldAlias string `json:"returning_old_alias"` + ReturningNewAlias string `json:"returning_new_alias"` } func (n *DeleteStmt) Pos() int { return 0 } -func (n *DeleteStmt) Format(buf *TrackedBuffer) { +func (n *DeleteStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } + buf.Group() + defer buf.EndGroup() + if n.WithClause != nil { - buf.astFormat(n.WithClause) - buf.WriteString(" ") + buf.astFormat(n.WithClause, d) + // The boundary between the WITH clause and the statement's own + // first keyword; the group keeps a break inside the WITH clause + // from forcing the statement body apart clause by clause. + buf.boundary(n.Relations) + buf.Line() + buf.Group() + defer buf.EndGroup() + } + + buf.WriteString("DELETE ") + + // MySQL multi-table DELETE: DELETE t1.*, t2.* FROM t1 JOIN t2 ... + if items(n.Targets) { + buf.join(n.Targets, d, ", ") + buf.WriteString(" FROM ") + if set(n.FromClause) { + buf.astFormat(n.FromClause, d) + } else if items(n.Relations) { + buf.astFormat(n.Relations, d) + } + } else { + buf.WriteString("FROM ") + if items(n.Relations) { + buf.astFormat(n.Relations, d) + } } - buf.WriteString("DELETE FROM ") - if items(n.Relations) { - buf.astFormat(n.Relations) + if items(n.UsingClause) { + buf.beforeClause(n.UsingClause, d) + buf.Line() + buf.WriteString("USING ") + buf.join(n.UsingClause, d, ", ") } if set(n.WhereClause) { - buf.WriteString(" WHERE ") - buf.astFormat(n.WhereClause) + buf.beforeClause(n.WhereClause, d) + buf.Line() + buf.WriteString("WHERE ") + buf.condition(n.WhereClause, d) } if set(n.LimitCount) { - buf.WriteString(" LIMIT ") - buf.astFormat(n.LimitCount) + buf.beforeClause(n.LimitCount, d) + buf.Line() + buf.WriteString("LIMIT ") + buf.astFormat(n.LimitCount, d) } if items(n.ReturningList) { - buf.WriteString(" RETURNING ") - buf.astFormat(n.ReturningList) + buf.beforeClause(n.ReturningList, d) + buf.Line() + buf.WriteString("RETURNING ") + formatReturningOptions(buf, d, n.ReturningOldAlias, n.ReturningNewAlias) + buf.astFormat(n.ReturningList, d) } } diff --git a/internal/sql/ast/discard_stmt.go b/internal/sql/ast/discard_stmt.go index 9c731df1fb..6831f7df81 100644 --- a/internal/sql/ast/discard_stmt.go +++ b/internal/sql/ast/discard_stmt.go @@ -1,7 +1,9 @@ package ast type DiscardStmt struct { - Target DiscardMode + Tag NodeTag[DiscardStmt] `json:"tag"` + + Target DiscardMode `json:"target"` } func (n *DiscardStmt) Pos() int { diff --git a/internal/sql/ast/do_stmt.go b/internal/sql/ast/do_stmt.go index edc831f15c..f21bafe8c5 100644 --- a/internal/sql/ast/do_stmt.go +++ b/internal/sql/ast/do_stmt.go @@ -1,9 +1,32 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type DoStmt struct { - Args *List + Tag NodeTag[DoStmt] `json:"tag"` + + Args *List `json:"args,omitempty"` } func (n *DoStmt) Pos() int { return 0 } + +func (n *DoStmt) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("DO ") + // Find the "as" argument which contains the body + if items(n.Args) { + for _, arg := range n.Args.Items { + if de, ok := arg.(*DefElem); ok && de.Defname != nil && *de.Defname == "as" { + if s, ok := de.Arg.(*String); ok { + buf.WriteString("$$") + buf.WriteString(s.Str) + buf.WriteString("$$") + } + } + } + } +} diff --git a/internal/sql/ast/drop_function_stmt.go b/internal/sql/ast/drop_function_stmt.go index c1b10b95c1..e5fec40469 100644 --- a/internal/sql/ast/drop_function_stmt.go +++ b/internal/sql/ast/drop_function_stmt.go @@ -1,8 +1,10 @@ package ast type DropFunctionStmt struct { - Funcs []*FuncSpec - MissingOk bool + Tag NodeTag[DropFunctionStmt] `json:"tag"` + + Funcs []*FuncSpec `json:"funcs,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *DropFunctionStmt) Pos() int { diff --git a/internal/sql/ast/drop_owned_stmt.go b/internal/sql/ast/drop_owned_stmt.go index 5826c33bbc..ab988187a0 100644 --- a/internal/sql/ast/drop_owned_stmt.go +++ b/internal/sql/ast/drop_owned_stmt.go @@ -1,8 +1,10 @@ package ast type DropOwnedStmt struct { - Roles *List - Behavior DropBehavior + Tag NodeTag[DropOwnedStmt] `json:"tag"` + + Roles *List `json:"roles,omitempty"` + Behavior DropBehavior `json:"behavior"` } func (n *DropOwnedStmt) Pos() int { diff --git a/internal/sql/ast/drop_role_stmt.go b/internal/sql/ast/drop_role_stmt.go index 95bd26a671..2bdcffd2ab 100644 --- a/internal/sql/ast/drop_role_stmt.go +++ b/internal/sql/ast/drop_role_stmt.go @@ -1,8 +1,10 @@ package ast type DropRoleStmt struct { - Roles *List - MissingOk bool + Tag NodeTag[DropRoleStmt] `json:"tag"` + + Roles *List `json:"roles,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *DropRoleStmt) Pos() int { diff --git a/internal/sql/ast/drop_schema_stmt.go b/internal/sql/ast/drop_schema_stmt.go index 8b7bad5180..f5d9f1e7ca 100644 --- a/internal/sql/ast/drop_schema_stmt.go +++ b/internal/sql/ast/drop_schema_stmt.go @@ -1,8 +1,10 @@ package ast type DropSchemaStmt struct { - Schemas []*String - MissingOk bool + Tag NodeTag[DropSchemaStmt] `json:"tag"` + + Schemas []*String `json:"schemas,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *DropSchemaStmt) Pos() int { diff --git a/internal/sql/ast/drop_stmt.go b/internal/sql/ast/drop_stmt.go index 9bb7d649a0..3305e16bf5 100644 --- a/internal/sql/ast/drop_stmt.go +++ b/internal/sql/ast/drop_stmt.go @@ -1,11 +1,13 @@ package ast type DropStmt struct { - Objects *List - RemoveType ObjectType - Behavior DropBehavior - MissingOk bool - Concurrent bool + Tag NodeTag[DropStmt] `json:"tag"` + + Objects *List `json:"objects,omitempty"` + RemoveType ObjectType `json:"remove_type"` + Behavior DropBehavior `json:"behavior"` + MissingOk bool `json:"missing_ok"` + Concurrent bool `json:"concurrent"` } func (n *DropStmt) Pos() int { diff --git a/internal/sql/ast/drop_subscription_stmt.go b/internal/sql/ast/drop_subscription_stmt.go index 7b8b025ac6..3fbd8528e4 100644 --- a/internal/sql/ast/drop_subscription_stmt.go +++ b/internal/sql/ast/drop_subscription_stmt.go @@ -1,9 +1,11 @@ package ast type DropSubscriptionStmt struct { - Subname *string - MissingOk bool - Behavior DropBehavior + Tag NodeTag[DropSubscriptionStmt] `json:"tag"` + + Subname *string `json:"subname,omitempty"` + MissingOk bool `json:"missing_ok"` + Behavior DropBehavior `json:"behavior"` } func (n *DropSubscriptionStmt) Pos() int { diff --git a/internal/sql/ast/drop_table_space_stmt.go b/internal/sql/ast/drop_table_space_stmt.go index bf96094d80..8093e7331c 100644 --- a/internal/sql/ast/drop_table_space_stmt.go +++ b/internal/sql/ast/drop_table_space_stmt.go @@ -1,8 +1,10 @@ package ast type DropTableSpaceStmt struct { - Tablespacename *string - MissingOk bool + Tag NodeTag[DropTableSpaceStmt] `json:"tag"` + + Tablespacename *string `json:"tablespacename,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *DropTableSpaceStmt) Pos() int { diff --git a/internal/sql/ast/drop_table_stmt.go b/internal/sql/ast/drop_table_stmt.go index 7485ceb887..4687b7cbe3 100644 --- a/internal/sql/ast/drop_table_stmt.go +++ b/internal/sql/ast/drop_table_stmt.go @@ -1,8 +1,10 @@ package ast type DropTableStmt struct { - IfExists bool - Tables []*TableName + Tag NodeTag[DropTableStmt] `json:"tag"` + + IfExists bool `json:"if_exists"` + Tables []*TableName `json:"tables,omitempty"` } func (n *DropTableStmt) Pos() int { diff --git a/internal/sql/ast/drop_type_stmt.go b/internal/sql/ast/drop_type_stmt.go index 3aa0401b19..dcef895f1b 100644 --- a/internal/sql/ast/drop_type_stmt.go +++ b/internal/sql/ast/drop_type_stmt.go @@ -1,8 +1,10 @@ package ast type DropTypeStmt struct { - IfExists bool - Types []*TypeName + Tag NodeTag[DropTypeStmt] `json:"tag"` + + IfExists bool `json:"if_exists"` + Types []*TypeName `json:"types,omitempty"` } func (n *DropTypeStmt) Pos() int { diff --git a/internal/sql/ast/drop_user_mapping_stmt.go b/internal/sql/ast/drop_user_mapping_stmt.go index f5852c708f..9503d8a259 100644 --- a/internal/sql/ast/drop_user_mapping_stmt.go +++ b/internal/sql/ast/drop_user_mapping_stmt.go @@ -1,9 +1,11 @@ package ast type DropUserMappingStmt struct { - User *RoleSpec - Servername *string - MissingOk bool + Tag NodeTag[DropUserMappingStmt] `json:"tag"` + + User *RoleSpec `json:"user,omitempty"` + Servername *string `json:"servername,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *DropUserMappingStmt) Pos() int { diff --git a/internal/sql/ast/dropdb_stmt.go b/internal/sql/ast/dropdb_stmt.go index 62a0c47346..da6eb860bb 100644 --- a/internal/sql/ast/dropdb_stmt.go +++ b/internal/sql/ast/dropdb_stmt.go @@ -1,8 +1,10 @@ package ast type DropdbStmt struct { - Dbname *string - MissingOk bool + Tag NodeTag[DropdbStmt] `json:"tag"` + + Dbname *string `json:"dbname,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *DropdbStmt) Pos() int { diff --git a/internal/sql/ast/execute_stmt.go b/internal/sql/ast/execute_stmt.go index 92a237141d..4ede4f42ca 100644 --- a/internal/sql/ast/execute_stmt.go +++ b/internal/sql/ast/execute_stmt.go @@ -1,8 +1,10 @@ package ast type ExecuteStmt struct { - Name *string - Params *List + Tag NodeTag[ExecuteStmt] `json:"tag"` + + Name *string `json:"name,omitempty"` + Params *List `json:"params,omitempty"` } func (n *ExecuteStmt) Pos() int { diff --git a/internal/sql/ast/explain_stmt.go b/internal/sql/ast/explain_stmt.go index 1d78aa815a..66c5608035 100644 --- a/internal/sql/ast/explain_stmt.go +++ b/internal/sql/ast/explain_stmt.go @@ -1,8 +1,10 @@ package ast type ExplainStmt struct { - Query Node - Options *List + Tag NodeTag[ExplainStmt] `json:"tag"` + + Query Node `json:"query,omitempty"` + Options *List `json:"options,omitempty"` } func (n *ExplainStmt) Pos() int { diff --git a/internal/sql/ast/expr.go b/internal/sql/ast/expr.go index a054970ccf..4de58b5214 100644 --- a/internal/sql/ast/expr.go +++ b/internal/sql/ast/expr.go @@ -1,6 +1,7 @@ package ast type Expr struct { + Tag NodeTag[Expr] `json:"tag"` } func (n *Expr) Pos() int { diff --git a/internal/sql/ast/fetch_stmt.go b/internal/sql/ast/fetch_stmt.go index cd43ef19ed..7a59569e37 100644 --- a/internal/sql/ast/fetch_stmt.go +++ b/internal/sql/ast/fetch_stmt.go @@ -1,10 +1,12 @@ package ast type FetchStmt struct { - Direction FetchDirection - HowMany int64 - Portalname *string - Ismove bool + Tag NodeTag[FetchStmt] `json:"tag"` + + Direction FetchDirection `json:"direction"` + HowMany int64 `json:"how_many"` + Portalname *string `json:"portalname,omitempty"` + Ismove bool `json:"ismove"` } func (n *FetchStmt) Pos() int { diff --git a/internal/sql/ast/field_select.go b/internal/sql/ast/field_select.go index 347abd44bf..57f77a6794 100644 --- a/internal/sql/ast/field_select.go +++ b/internal/sql/ast/field_select.go @@ -1,12 +1,14 @@ package ast type FieldSelect struct { - Xpr Node - Arg Node - Fieldnum AttrNumber - Resulttype Oid - Resulttypmod int32 - Resultcollid Oid + Tag NodeTag[FieldSelect] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Fieldnum AttrNumber `json:"fieldnum"` + Resulttype Oid `json:"resulttype"` + Resulttypmod int32 `json:"resulttypmod"` + Resultcollid Oid `json:"resultcollid"` } func (n *FieldSelect) Pos() int { diff --git a/internal/sql/ast/field_store.go b/internal/sql/ast/field_store.go index 6c2cfc230c..505c924a9c 100644 --- a/internal/sql/ast/field_store.go +++ b/internal/sql/ast/field_store.go @@ -1,11 +1,13 @@ package ast type FieldStore struct { - Xpr Node - Arg Node - Newvals *List - Fieldnums *List - Resulttype Oid + Tag NodeTag[FieldStore] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Newvals *List `json:"newvals,omitempty"` + Fieldnums *List `json:"fieldnums,omitempty"` + Resulttype Oid `json:"resulttype"` } func (n *FieldStore) Pos() int { diff --git a/internal/sql/ast/float.go b/internal/sql/ast/float.go index fee8655bbe..a91b89a273 100644 --- a/internal/sql/ast/float.go +++ b/internal/sql/ast/float.go @@ -1,14 +1,18 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type Float struct { - Str string + Tag NodeTag[Float] `json:"tag"` + + Str string `json:"str"` } func (n *Float) Pos() int { return 0 } -func (n *Float) Format(buf *TrackedBuffer) { +func (n *Float) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/from_expr.go b/internal/sql/ast/from_expr.go index deb93da4a4..021ac30cf8 100644 --- a/internal/sql/ast/from_expr.go +++ b/internal/sql/ast/from_expr.go @@ -1,8 +1,10 @@ package ast type FromExpr struct { - Fromlist *List - Quals Node + Tag NodeTag[FromExpr] `json:"tag"` + + Fromlist *List `json:"fromlist,omitempty"` + Quals Node `json:"quals,omitempty"` } func (n *FromExpr) Pos() int { diff --git a/internal/sql/ast/func_call.go b/internal/sql/ast/func_call.go index 2bfe961b50..f7e041f3cd 100644 --- a/internal/sql/ast/func_call.go +++ b/internal/sql/ast/func_call.go @@ -1,33 +1,68 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type FuncCall struct { - Func *FuncName - Funcname *List - Args *List - AggOrder *List - AggFilter Node - AggWithinGroup bool - AggStar bool - AggDistinct bool - FuncVariadic bool - Over *WindowDef - Location int + Tag NodeTag[FuncCall] `json:"tag"` + + Func *FuncName `json:"func,omitempty"` + Funcname *List `json:"funcname,omitempty"` + Args *List `json:"args,omitempty"` + AggOrder *List `json:"agg_order,omitempty"` + AggFilter Node `json:"agg_filter,omitempty"` + AggWithinGroup bool `json:"agg_within_group"` + AggStar bool `json:"agg_star"` + AggDistinct bool `json:"agg_distinct"` + FuncVariadic bool `json:"func_variadic"` + Over *WindowDef `json:"over,omitempty"` + Separator *string `json:"separator,omitempty"` // MySQL GROUP_CONCAT SEPARATOR + Location int `json:"location"` } func (n *FuncCall) Pos() int { return n.Location } -func (n *FuncCall) Format(buf *TrackedBuffer) { +func (n *FuncCall) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.astFormat(n.Func) + buf.astFormat(n.Func, d) buf.WriteString("(") + if n.AggDistinct { + buf.WriteString("DISTINCT ") + } if n.AggStar { buf.WriteString("*") } else { - buf.astFormat(n.Args) + buf.astFormat(n.Args, d) + } + // ORDER BY inside function call (not WITHIN GROUP) + if items(n.AggOrder) && !n.AggWithinGroup { + buf.WriteString(" ORDER BY ") + buf.join(n.AggOrder, d, ", ") + } + // SEPARATOR for GROUP_CONCAT (MySQL) + if n.Separator != nil { + buf.WriteString(" SEPARATOR ") + buf.WriteString("'") + buf.WriteString(*n.Separator) + buf.WriteString("'") } buf.WriteString(")") + // WITHIN GROUP clause for ordered-set aggregates + if items(n.AggOrder) && n.AggWithinGroup { + buf.WriteString(" WITHIN GROUP (ORDER BY ") + buf.join(n.AggOrder, d, ", ") + buf.WriteString(")") + } + if set(n.AggFilter) { + buf.WriteString(" FILTER (WHERE ") + buf.astFormat(n.AggFilter, d) + buf.WriteString(")") + } + if n.Over != nil { + buf.WriteString(" OVER ") + buf.astFormat(n.Over, d) + } } diff --git a/internal/sql/ast/func_expr.go b/internal/sql/ast/func_expr.go index e571a63049..39dee6f0ae 100644 --- a/internal/sql/ast/func_expr.go +++ b/internal/sql/ast/func_expr.go @@ -1,16 +1,18 @@ package ast type FuncExpr struct { - Xpr Node - Funcid Oid - Funcresulttype Oid - Funcretset bool - Funcvariadic bool - Funcformat CoercionForm - Funccollid Oid - Inputcollid Oid - Args *List - Location int + Tag NodeTag[FuncExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Funcid Oid `json:"funcid"` + Funcresulttype Oid `json:"funcresulttype"` + Funcretset bool `json:"funcretset"` + Funcvariadic bool `json:"funcvariadic"` + Funcformat CoercionForm `json:"funcformat"` + Funccollid Oid `json:"funccollid"` + Inputcollid Oid `json:"inputcollid"` + Args *List `json:"args,omitempty"` + Location int `json:"location"` } func (n *FuncExpr) Pos() int { diff --git a/internal/sql/ast/func_name.go b/internal/sql/ast/func_name.go index 29b8e0fa61..0c1d6fb7a3 100644 --- a/internal/sql/ast/func_name.go +++ b/internal/sql/ast/func_name.go @@ -1,16 +1,20 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type FuncName struct { - Catalog string - Schema string - Name string + Tag NodeTag[FuncName] `json:"tag"` + + Catalog string `json:"catalog"` + Schema string `json:"schema"` + Name string `json:"name"` } func (n *FuncName) Pos() int { return 0 } -func (n *FuncName) Format(buf *TrackedBuffer) { +func (n *FuncName) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/func_param.go b/internal/sql/ast/func_param.go index b5cf8cfcf0..ae353f36d9 100644 --- a/internal/sql/ast/func_param.go +++ b/internal/sql/ast/func_param.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type FuncParamMode int const ( @@ -12,12 +14,36 @@ const ( ) type FuncParam struct { - Name *string - Type *TypeName - DefExpr Node // Will always be &ast.TODO - Mode FuncParamMode + Tag NodeTag[FuncParam] `json:"tag"` + + Name *string `json:"name,omitempty"` + Type *TypeName `json:"type,omitempty"` + DefExpr Node `json:"def_expr,omitempty"` // Will always be &ast.TODO + Mode FuncParamMode `json:"mode"` } func (n *FuncParam) Pos() int { return 0 } + +func (n *FuncParam) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + // Parameter mode prefix (OUT, INOUT, VARIADIC) + switch n.Mode { + case FuncParamOut: + buf.WriteString("OUT ") + case FuncParamInOut: + buf.WriteString("INOUT ") + case FuncParamVariadic: + buf.WriteString("VARIADIC ") + } + // Parameter name (if present) + if n.Name != nil { + buf.WriteString(*n.Name) + buf.WriteString(" ") + } + // Parameter type + buf.astFormat(n.Type, d) +} diff --git a/internal/sql/ast/func_spec.go b/internal/sql/ast/func_spec.go index f9d4bb40c6..019bac9218 100644 --- a/internal/sql/ast/func_spec.go +++ b/internal/sql/ast/func_spec.go @@ -1,9 +1,11 @@ package ast type FuncSpec struct { - Name *FuncName - Args []*TypeName - HasArgs bool + Tag NodeTag[FuncSpec] `json:"tag"` + + Name *FuncName `json:"name,omitempty"` + Args []*TypeName `json:"args,omitempty"` + HasArgs bool `json:"has_args"` } func (n *FuncSpec) Pos() int { diff --git a/internal/sql/ast/function_parameter.go b/internal/sql/ast/function_parameter.go index 54262f6130..3bbb086713 100644 --- a/internal/sql/ast/function_parameter.go +++ b/internal/sql/ast/function_parameter.go @@ -1,10 +1,12 @@ package ast type FunctionParameter struct { - Name *string - ArgType *TypeName - Mode FunctionParameterMode - Defexpr Node + Tag NodeTag[FunctionParameter] `json:"tag"` + + Name *string `json:"name,omitempty"` + ArgType *TypeName `json:"arg_type,omitempty"` + Mode FunctionParameterMode `json:"mode"` + Defexpr Node `json:"defexpr,omitempty"` } func (n *FunctionParameter) Pos() int { diff --git a/internal/sql/ast/grant_role_stmt.go b/internal/sql/ast/grant_role_stmt.go index 5d785efa7e..0dd26f9cc3 100644 --- a/internal/sql/ast/grant_role_stmt.go +++ b/internal/sql/ast/grant_role_stmt.go @@ -1,12 +1,13 @@ package ast type GrantRoleStmt struct { - GrantedRoles *List - GranteeRoles *List - IsGrant bool - AdminOpt bool - Grantor *RoleSpec - Behavior DropBehavior + Tag NodeTag[GrantRoleStmt] `json:"tag"` + + GrantedRoles *List `json:"granted_roles,omitempty"` + GranteeRoles *List `json:"grantee_roles,omitempty"` + IsGrant bool `json:"is_grant"` + Grantor *RoleSpec `json:"grantor,omitempty"` + Behavior DropBehavior `json:"behavior"` } func (n *GrantRoleStmt) Pos() int { diff --git a/internal/sql/ast/grant_stmt.go b/internal/sql/ast/grant_stmt.go index cbed7911ac..964395c146 100644 --- a/internal/sql/ast/grant_stmt.go +++ b/internal/sql/ast/grant_stmt.go @@ -1,14 +1,16 @@ package ast type GrantStmt struct { - IsGrant bool - Targtype GrantTargetType - Objtype GrantObjectType - Objects *List - Privileges *List - Grantees *List - GrantOption bool - Behavior DropBehavior + Tag NodeTag[GrantStmt] `json:"tag"` + + IsGrant bool `json:"is_grant"` + Targtype GrantTargetType `json:"targtype"` + Objtype GrantObjectType `json:"objtype"` + Objects *List `json:"objects,omitempty"` + Privileges *List `json:"privileges,omitempty"` + Grantees *List `json:"grantees,omitempty"` + GrantOption bool `json:"grant_option"` + Behavior DropBehavior `json:"behavior"` } func (n *GrantStmt) Pos() int { diff --git a/internal/sql/ast/grouping_func.go b/internal/sql/ast/grouping_func.go index 059bfb9dec..80f8471560 100644 --- a/internal/sql/ast/grouping_func.go +++ b/internal/sql/ast/grouping_func.go @@ -1,12 +1,14 @@ package ast type GroupingFunc struct { - Xpr Node - Args *List - Refs *List - Cols *List - Agglevelsup Index - Location int + Tag NodeTag[GroupingFunc] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Args *List `json:"args,omitempty"` + Refs *List `json:"refs,omitempty"` + Cols *List `json:"cols,omitempty"` + Agglevelsup Index `json:"agglevelsup"` + Location int `json:"location"` } func (n *GroupingFunc) Pos() int { diff --git a/internal/sql/ast/grouping_set.go b/internal/sql/ast/grouping_set.go index 32db38a607..10c5098f82 100644 --- a/internal/sql/ast/grouping_set.go +++ b/internal/sql/ast/grouping_set.go @@ -1,9 +1,11 @@ package ast type GroupingSet struct { - Kind GroupingSetKind - Content *List - Location int + Tag NodeTag[GroupingSet] `json:"tag"` + + Kind GroupingSetKind `json:"kind"` + Content *List `json:"content,omitempty"` + Location int `json:"location"` } func (n *GroupingSet) Pos() int { diff --git a/internal/sql/ast/import_foreign_schema_stmt.go b/internal/sql/ast/import_foreign_schema_stmt.go index 6b333f665b..7d824bdbf3 100644 --- a/internal/sql/ast/import_foreign_schema_stmt.go +++ b/internal/sql/ast/import_foreign_schema_stmt.go @@ -1,12 +1,14 @@ package ast type ImportForeignSchemaStmt struct { - ServerName *string - RemoteSchema *string - LocalSchema *string - ListType ImportForeignSchemaType - TableList *List - Options *List + Tag NodeTag[ImportForeignSchemaStmt] `json:"tag"` + + ServerName *string `json:"server_name,omitempty"` + RemoteSchema *string `json:"remote_schema,omitempty"` + LocalSchema *string `json:"local_schema,omitempty"` + ListType ImportForeignSchemaType `json:"list_type"` + TableList *List `json:"table_list,omitempty"` + Options *List `json:"options,omitempty"` } func (n *ImportForeignSchemaStmt) Pos() int { diff --git a/internal/sql/ast/in.go b/internal/sql/ast/in.go index e11b2086a1..6afa9fcaf0 100644 --- a/internal/sql/ast/in.go +++ b/internal/sql/ast/in.go @@ -1,19 +1,50 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + // In describes a 'select foo in (bar, baz)' type statement, though there are multiple important variants handled. type In struct { + Tag NodeTag[In] `json:"tag"` + // Expr is the value expression to be compared. - Expr Node + Expr Node `json:"expr,omitempty"` // List is the list expression in compare list. - List []Node + List []Node `json:"list,omitempty"` // Not is true, the expression is "not in". - Not bool + Not bool `json:"not"` // Sel is the subquery, may be rewritten to other type of expression. - Sel Node - Location int + Sel Node `json:"sel,omitempty"` + Location int `json:"location"` } // Pos returns the location. func (n *In) Pos() int { return n.Location } + +// Format formats the In expression. +func (n *In) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.astFormat(n.Expr, d) + if n.Not { + buf.WriteString(" NOT IN ") + } else { + buf.WriteString(" IN ") + } + if n.Sel != nil { + buf.WriteString("(") + buf.astFormat(n.Sel, d) + buf.WriteString(")") + } else if len(n.List) > 0 { + buf.WriteString("(") + for i, item := range n.List { + if i > 0 { + buf.WriteString(", ") + } + buf.astFormat(item, d) + } + buf.WriteString(")") + } +} diff --git a/internal/sql/ast/index_elem.go b/internal/sql/ast/index_elem.go index 52ac09688b..e49ea05c28 100644 --- a/internal/sql/ast/index_elem.go +++ b/internal/sql/ast/index_elem.go @@ -1,15 +1,30 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type IndexElem struct { - Name *string - Expr Node - Indexcolname *string - Collation *List - Opclass *List - Ordering SortByDir - NullsOrdering SortByNulls + Tag NodeTag[IndexElem] `json:"tag"` + + Name *string `json:"name,omitempty"` + Expr Node `json:"expr,omitempty"` + Indexcolname *string `json:"indexcolname,omitempty"` + Collation *List `json:"collation,omitempty"` + Opclass *List `json:"opclass,omitempty"` + Ordering SortByDir `json:"ordering"` + NullsOrdering SortByNulls `json:"nulls_ordering"` } func (n *IndexElem) Pos() int { return 0 } + +func (n *IndexElem) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Name != nil && *n.Name != "" { + buf.WriteString(*n.Name) + } else if set(n.Expr) { + buf.astFormat(n.Expr, d) + } +} diff --git a/internal/sql/ast/index_stmt.go b/internal/sql/ast/index_stmt.go index c0f12bdb68..5eafbcb95f 100644 --- a/internal/sql/ast/index_stmt.go +++ b/internal/sql/ast/index_stmt.go @@ -1,25 +1,26 @@ package ast type IndexStmt struct { - Idxname *string - Relation *RangeVar - AccessMethod *string - TableSpace *string - IndexParams *List - Options *List - WhereClause Node - ExcludeOpNames *List - Idxcomment *string - IndexOid Oid - OldNode Oid - Unique bool - Primary bool - Isconstraint bool - Deferrable bool - Initdeferred bool - Transformed bool - Concurrent bool - IfNotExists bool + Tag NodeTag[IndexStmt] `json:"tag"` + + Idxname *string `json:"idxname,omitempty"` + Relation *RangeVar `json:"relation,omitempty"` + AccessMethod *string `json:"access_method,omitempty"` + TableSpace *string `json:"table_space,omitempty"` + IndexParams *List `json:"index_params,omitempty"` + Options *List `json:"options,omitempty"` + WhereClause Node `json:"where_clause,omitempty"` + ExcludeOpNames *List `json:"exclude_op_names,omitempty"` + Idxcomment *string `json:"idxcomment,omitempty"` + IndexOid Oid `json:"index_oid"` + Unique bool `json:"unique"` + Primary bool `json:"primary"` + Isconstraint bool `json:"isconstraint"` + Deferrable bool `json:"deferrable"` + Initdeferred bool `json:"initdeferred"` + Transformed bool `json:"transformed"` + Concurrent bool `json:"concurrent"` + IfNotExists bool `json:"if_not_exists"` } func (n *IndexStmt) Pos() int { diff --git a/internal/sql/ast/infer_clause.go b/internal/sql/ast/infer_clause.go index 1e1d93c3d8..f4dc4bc46d 100644 --- a/internal/sql/ast/infer_clause.go +++ b/internal/sql/ast/infer_clause.go @@ -1,12 +1,34 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type InferClause struct { - IndexElems *List - WhereClause Node - Conname *string - Location int + Tag NodeTag[InferClause] `json:"tag"` + + IndexElems *List `json:"index_elems,omitempty"` + WhereClause Node `json:"where_clause,omitempty"` + Conname *string `json:"conname,omitempty"` + Location int `json:"location"` } func (n *InferClause) Pos() int { return n.Location } + +func (n *InferClause) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + if n.Conname != nil && *n.Conname != "" { + buf.WriteString("ON CONSTRAINT ") + buf.WriteString(*n.Conname) + } else if items(n.IndexElems) { + buf.WriteString("(") + buf.join(n.IndexElems, d, ", ") + buf.WriteString(")") + if set(n.WhereClause) { + buf.WriteString(" WHERE ") + buf.astFormat(n.WhereClause, d) + } + } +} diff --git a/internal/sql/ast/inference_elem.go b/internal/sql/ast/inference_elem.go index d7b4e091c2..be27eb88a8 100644 --- a/internal/sql/ast/inference_elem.go +++ b/internal/sql/ast/inference_elem.go @@ -1,10 +1,12 @@ package ast type InferenceElem struct { - Xpr Node - Expr Node - Infercollid Oid - Inferopclass Oid + Tag NodeTag[InferenceElem] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Expr Node `json:"expr,omitempty"` + Infercollid Oid `json:"infercollid"` + Inferopclass Oid `json:"inferopclass"` } func (n *InferenceElem) Pos() int { diff --git a/internal/sql/ast/inline_code_block.go b/internal/sql/ast/inline_code_block.go index 91aebcc2e8..6698334d1e 100644 --- a/internal/sql/ast/inline_code_block.go +++ b/internal/sql/ast/inline_code_block.go @@ -1,9 +1,11 @@ package ast type InlineCodeBlock struct { - SourceText *string - LangOid Oid - LangIsTrusted bool + Tag NodeTag[InlineCodeBlock] `json:"tag"` + + SourceText *string `json:"source_text,omitempty"` + LangOid Oid `json:"lang_oid"` + LangIsTrusted bool `json:"lang_is_trusted"` } func (n *InlineCodeBlock) Pos() int { diff --git a/internal/sql/ast/insert_stmt.go b/internal/sql/ast/insert_stmt.go index 3cdf854091..e6d3d3a190 100644 --- a/internal/sql/ast/insert_stmt.go +++ b/internal/sql/ast/insert_stmt.go @@ -1,49 +1,86 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type InsertStmt struct { - Relation *RangeVar - Cols *List - SelectStmt Node - OnConflictClause *OnConflictClause - ReturningList *List - WithClause *WithClause - Override OverridingKind + Tag NodeTag[InsertStmt] `json:"tag"` + + Relation *RangeVar `json:"relation,omitempty"` + Cols *List `json:"cols,omitempty"` + SelectStmt Node `json:"select_stmt,omitempty"` + OnConflictClause *OnConflictClause `json:"on_conflict_clause,omitempty"` + OnDuplicateKeyUpdate *OnDuplicateKeyUpdate `json:"on_duplicate_key_update,omitempty"` // MySQL-specific + ReturningList *List `json:"returning_list,omitempty"` + WithClause *WithClause `json:"with_clause,omitempty"` + Override OverridingKind `json:"override"` + DefaultValues bool `json:"default_values"` // SQLite-specific: INSERT INTO ... DEFAULT VALUES + // PostgreSQL 18 RETURNING WITH (OLD AS ..., NEW AS ...) aliases + ReturningOldAlias string `json:"returning_old_alias"` + ReturningNewAlias string `json:"returning_new_alias"` } func (n *InsertStmt) Pos() int { return 0 } -func (n *InsertStmt) Format(buf *TrackedBuffer) { +func (n *InsertStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } + buf.Group() + defer buf.EndGroup() + if n.WithClause != nil { - buf.astFormat(n.WithClause) - buf.WriteString(" ") + buf.astFormat(n.WithClause, d) + // The boundary between the WITH clause and the statement's own + // first keyword; the group keeps a break inside the WITH clause + // from forcing the statement body apart clause by clause. + buf.boundary(n.Relation) + buf.Line() + buf.Group() + defer buf.EndGroup() } buf.WriteString("INSERT INTO ") if n.Relation != nil { - buf.astFormat(n.Relation) + buf.astFormat(n.Relation, d) } if items(n.Cols) { buf.WriteString(" (") - buf.astFormat(n.Cols) - buf.WriteString(") ") + buf.Group() + buf.Indent() + buf.Softline() + buf.joinComma(n.Cols, d) + buf.EndIndent() + buf.Softline() + buf.EndGroup() + buf.WriteString(")") } - if set(n.SelectStmt) { - buf.astFormat(n.SelectStmt) + if n.DefaultValues { + buf.WriteString(" DEFAULT VALUES") + } else if set(n.SelectStmt) { + buf.beforeClause(n.SelectStmt, d) + buf.Line() + buf.astFormat(n.SelectStmt, d) } if n.OnConflictClause != nil { - buf.WriteString(" ON CONFLICT DO NOTHING ") + buf.Line() + buf.astFormat(n.OnConflictClause, d) + } + + if n.OnDuplicateKeyUpdate != nil { + buf.Line() + buf.astFormat(n.OnDuplicateKeyUpdate, d) } if items(n.ReturningList) { - buf.WriteString(" RETURNING ") - buf.astFormat(n.ReturningList) + buf.beforeClause(n.ReturningList, d) + buf.Line() + buf.WriteString("RETURNING ") + formatReturningOptions(buf, d, n.ReturningOldAlias, n.ReturningNewAlias) + buf.astFormat(n.ReturningList, d) } } diff --git a/internal/sql/ast/integer.go b/internal/sql/ast/integer.go index e9f911add2..30c270572b 100644 --- a/internal/sql/ast/integer.go +++ b/internal/sql/ast/integer.go @@ -1,16 +1,22 @@ package ast -import "strconv" +import ( + "strconv" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) type Integer struct { - Ival int64 + Tag NodeTag[Integer] `json:"tag"` + + Ival int64 `json:"ival"` } func (n *Integer) Pos() int { return 0 } -func (n *Integer) Format(buf *TrackedBuffer) { +func (n *Integer) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/interval_expr.go b/internal/sql/ast/interval_expr.go new file mode 100644 index 0000000000..f89ceed80c --- /dev/null +++ b/internal/sql/ast/interval_expr.go @@ -0,0 +1,26 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +// IntervalExpr represents a MySQL INTERVAL expression like "INTERVAL 1 DAY" +type IntervalExpr struct { + Tag NodeTag[IntervalExpr] `json:"tag"` + + Value Node `json:"value,omitempty"` + Unit string `json:"unit"` + Location int `json:"location"` +} + +func (n *IntervalExpr) Pos() int { + return n.Location +} + +func (n *IntervalExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("INTERVAL ") + buf.astFormat(n.Value, d) + buf.WriteString(" ") + buf.WriteString(n.Unit) +} diff --git a/internal/sql/ast/into_clause.go b/internal/sql/ast/into_clause.go index e460b65ea0..1a74d37bf4 100644 --- a/internal/sql/ast/into_clause.go +++ b/internal/sql/ast/into_clause.go @@ -1,13 +1,15 @@ package ast type IntoClause struct { - Rel *RangeVar - ColNames *List - Options *List - OnCommit OnCommitAction - TableSpaceName *string - ViewQuery Node - SkipData bool + Tag NodeTag[IntoClause] `json:"tag"` + + Rel *RangeVar `json:"rel,omitempty"` + ColNames *List `json:"col_names,omitempty"` + Options *List `json:"options,omitempty"` + OnCommit OnCommitAction `json:"on_commit"` + TableSpaceName *string `json:"table_space_name,omitempty"` + ViewQuery Node `json:"view_query,omitempty"` + SkipData bool `json:"skip_data"` } func (n *IntoClause) Pos() int { diff --git a/internal/sql/ast/join_expr.go b/internal/sql/ast/join_expr.go index e316869560..59df9b3aee 100644 --- a/internal/sql/ast/join_expr.go +++ b/internal/sql/ast/join_expr.go @@ -1,42 +1,59 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type JoinExpr struct { - Jointype JoinType - IsNatural bool - Larg Node - Rarg Node - UsingClause *List - Quals Node - Alias *Alias - Rtindex int + Tag NodeTag[JoinExpr] `json:"tag"` + + Jointype JoinType `json:"jointype"` + IsNatural bool `json:"is_natural"` + Larg Node `json:"larg,omitempty"` + Rarg Node `json:"rarg,omitempty"` + UsingClause *List `json:"using_clause,omitempty"` + Quals Node `json:"quals,omitempty"` + Alias *Alias `json:"alias,omitempty"` + Rtindex int `json:"rtindex"` } func (n *JoinExpr) Pos() int { return 0 } -func (n *JoinExpr) Format(buf *TrackedBuffer) { +func (n *JoinExpr) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.astFormat(n.Larg) - switch n.Jointype { - case JoinTypeLeft: - buf.WriteString(" LEFT JOIN ") - case JoinTypeInner: - buf.WriteString(" INNER JOIN ") - default: - buf.WriteString(" JOIN ") - } - buf.astFormat(n.Rarg) - buf.WriteString(" ON ") - if n.Jointype == JoinTypeInner { - if set(n.Quals) { - buf.astFormat(n.Quals) - } else { - buf.WriteString("TRUE") - } + buf.astFormat(n.Larg, d) + if n.Jointype == JoinTypeComma { + buf.WriteString(",") + buf.beforeClause(n.Rarg, d) + buf.Line() } else { - buf.astFormat(n.Quals) + buf.beforeClause(n.Rarg, d) + buf.Line() + if n.IsNatural { + buf.WriteString("NATURAL ") + } + switch n.Jointype { + case JoinTypeLeft: + buf.WriteString("LEFT JOIN ") + case JoinTypeRight: + buf.WriteString("RIGHT JOIN ") + case JoinTypeFull: + buf.WriteString("FULL JOIN ") + case JoinTypeCross: + buf.WriteString("CROSS JOIN ") + default: + buf.WriteString("JOIN ") + } + } + buf.astFormat(n.Rarg, d) + if items(n.UsingClause) { + buf.WriteString(" USING (") + buf.join(n.UsingClause, d, ", ") + buf.WriteString(")") + } else if set(n.Quals) { + buf.WriteString(" ON ") + buf.condition(n.Quals, d) } } diff --git a/internal/sql/ast/join_type.go b/internal/sql/ast/join_type.go index 824e0b357f..d4f5565b80 100644 --- a/internal/sql/ast/join_type.go +++ b/internal/sql/ast/join_type.go @@ -12,6 +12,13 @@ const ( JoinTypeAnti JoinTypeUniqueOuter JoinTypeUniqueInner + // Beyond the libpg_query set: joins SQLite spells (and treats) + // distinctly. Both behave as inner joins, but CROSS JOIN carries a + // planner hint — SQLite will not reorder the pair — and a + // comma-separated FROM item is its own syntax, so neither may be + // rewritten into the other. + JoinTypeCross + JoinTypeComma ) type JoinType uint diff --git a/internal/sql/ast/list.go b/internal/sql/ast/list.go index 1c89d55339..86a3fe00dc 100644 --- a/internal/sql/ast/list.go +++ b/internal/sql/ast/list.go @@ -1,16 +1,20 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type List struct { - Items []Node + Tag NodeTag[List] `json:"tag"` + + Items []Node `json:"items,omitempty"` } func (n *List) Pos() int { return 0 } -func (n *List) Format(buf *TrackedBuffer) { +func (n *List) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.join(n, ",") + buf.join(n, d, ", ") } diff --git a/internal/sql/ast/listen_stmt.go b/internal/sql/ast/listen_stmt.go index 79c1b132c1..3989225754 100644 --- a/internal/sql/ast/listen_stmt.go +++ b/internal/sql/ast/listen_stmt.go @@ -1,14 +1,18 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type ListenStmt struct { - Conditionname *string + Tag NodeTag[ListenStmt] `json:"tag"` + + Conditionname *string `json:"conditionname,omitempty"` } func (n *ListenStmt) Pos() int { return 0 } -func (n *ListenStmt) Format(buf *TrackedBuffer) { +func (n *ListenStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/load_stmt.go b/internal/sql/ast/load_stmt.go index 1a211fc11a..276f05a134 100644 --- a/internal/sql/ast/load_stmt.go +++ b/internal/sql/ast/load_stmt.go @@ -1,7 +1,9 @@ package ast type LoadStmt struct { - Filename *string + Tag NodeTag[LoadStmt] `json:"tag"` + + Filename *string `json:"filename,omitempty"` } func (n *LoadStmt) Pos() int { diff --git a/internal/sql/ast/lock_stmt.go b/internal/sql/ast/lock_stmt.go index 70ec64dce3..82f2481640 100644 --- a/internal/sql/ast/lock_stmt.go +++ b/internal/sql/ast/lock_stmt.go @@ -1,9 +1,11 @@ package ast type LockStmt struct { - Relations *List - Mode int - Nowait bool + Tag NodeTag[LockStmt] `json:"tag"` + + Relations *List `json:"relations,omitempty"` + Mode int `json:"mode"` + Nowait bool `json:"nowait"` } func (n *LockStmt) Pos() int { diff --git a/internal/sql/ast/locking_clause.go b/internal/sql/ast/locking_clause.go index 11a9159de2..00a3848f03 100644 --- a/internal/sql/ast/locking_clause.go +++ b/internal/sql/ast/locking_clause.go @@ -1,24 +1,59 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type LockingClause struct { - LockedRels *List - Strength LockClauseStrength - WaitPolicy LockWaitPolicy + Tag NodeTag[LockingClause] `json:"tag"` + + LockedRels *List `json:"locked_rels,omitempty"` + Strength LockClauseStrength `json:"strength"` + WaitPolicy LockWaitPolicy `json:"wait_policy"` } func (n *LockingClause) Pos() int { return 0 } -func (n *LockingClause) Format(buf *TrackedBuffer) { +// LockClauseStrength values (matching pg_query_go) +const ( + LockClauseStrengthUndefined LockClauseStrength = 0 + LockClauseStrengthNone LockClauseStrength = 1 + LockClauseStrengthForKeyShare LockClauseStrength = 2 + LockClauseStrengthForShare LockClauseStrength = 3 + LockClauseStrengthForNoKeyUpdate LockClauseStrength = 4 + LockClauseStrengthForUpdate LockClauseStrength = 5 +) + +// LockWaitPolicy values +const ( + LockWaitPolicyBlock LockWaitPolicy = 1 + LockWaitPolicySkip LockWaitPolicy = 2 + LockWaitPolicyError LockWaitPolicy = 3 +) + +func (n *LockingClause) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } buf.WriteString("FOR ") switch n.Strength { - case 3: + case LockClauseStrengthForKeyShare: + buf.WriteString("KEY SHARE") + case LockClauseStrengthForShare: buf.WriteString("SHARE") - case 5: + case LockClauseStrengthForNoKeyUpdate: + buf.WriteString("NO KEY UPDATE") + case LockClauseStrengthForUpdate: buf.WriteString("UPDATE") } + if items(n.LockedRels) { + buf.WriteString(" OF ") + buf.join(n.LockedRels, d, ", ") + } + switch n.WaitPolicy { + case LockWaitPolicySkip: + buf.WriteString(" SKIP LOCKED") + case LockWaitPolicyError: + buf.WriteString(" NOWAIT") + } } diff --git a/internal/sql/ast/min_max_expr.go b/internal/sql/ast/min_max_expr.go index 8f0f7ea578..56da82aed1 100644 --- a/internal/sql/ast/min_max_expr.go +++ b/internal/sql/ast/min_max_expr.go @@ -1,13 +1,15 @@ package ast type MinMaxExpr struct { - Xpr Node - Minmaxtype Oid - Minmaxcollid Oid - Inputcollid Oid - Op MinMaxOp - Args *List - Location int + Tag NodeTag[MinMaxExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Minmaxtype Oid `json:"minmaxtype"` + Minmaxcollid Oid `json:"minmaxcollid"` + Inputcollid Oid `json:"inputcollid"` + Op MinMaxOp `json:"op"` + Args *List `json:"args,omitempty"` + Location int `json:"location"` } func (n *MinMaxExpr) Pos() int { diff --git a/internal/sql/ast/multi_assign_ref.go b/internal/sql/ast/multi_assign_ref.go index 16302b4e4c..c1a7e30fc6 100644 --- a/internal/sql/ast/multi_assign_ref.go +++ b/internal/sql/ast/multi_assign_ref.go @@ -1,18 +1,22 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type MultiAssignRef struct { - Source Node - Colno int - Ncolumns int + Tag NodeTag[MultiAssignRef] `json:"tag"` + + Source Node `json:"source,omitempty"` + Colno int `json:"colno"` + Ncolumns int `json:"ncolumns"` } func (n *MultiAssignRef) Pos() int { return 0 } -func (n *MultiAssignRef) Format(buf *TrackedBuffer) { +func (n *MultiAssignRef) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.astFormat(n.Source) + buf.astFormat(n.Source, d) } diff --git a/internal/sql/ast/named_arg_expr.go b/internal/sql/ast/named_arg_expr.go index e37427826e..ec3d5a187e 100644 --- a/internal/sql/ast/named_arg_expr.go +++ b/internal/sql/ast/named_arg_expr.go @@ -1,18 +1,22 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type NamedArgExpr struct { - Xpr Node - Arg Node - Name *string - Argnumber int - Location int + Tag NodeTag[NamedArgExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Name *string `json:"name,omitempty"` + Argnumber int `json:"argnumber"` + Location int `json:"location"` } func (n *NamedArgExpr) Pos() int { return n.Location } -func (n *NamedArgExpr) Format(buf *TrackedBuffer) { +func (n *NamedArgExpr) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } @@ -20,5 +24,5 @@ func (n *NamedArgExpr) Format(buf *TrackedBuffer) { buf.WriteString(*n.Name) } buf.WriteString(" => ") - buf.astFormat(n.Arg) + buf.astFormat(n.Arg, d) } diff --git a/internal/sql/ast/next_value_expr.go b/internal/sql/ast/next_value_expr.go index 050c090368..6832e40449 100644 --- a/internal/sql/ast/next_value_expr.go +++ b/internal/sql/ast/next_value_expr.go @@ -1,9 +1,11 @@ package ast type NextValueExpr struct { - Xpr Node - Seqid Oid - TypeId Oid + Tag NodeTag[NextValueExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Seqid Oid `json:"seqid"` + TypeId Oid `json:"type_id"` } func (n *NextValueExpr) Pos() int { diff --git a/internal/sql/ast/node_tag.go b/internal/sql/ast/node_tag.go new file mode 100644 index 0000000000..5b3f43b90a --- /dev/null +++ b/internal/sql/ast/node_tag.go @@ -0,0 +1,40 @@ +package ast + +import ( + "encoding/json" + "fmt" + "reflect" +) + +// NodeTag names its containing node type in JSON. +// +// Node is an interface, so the JSON encoding of an AST would otherwise carry no +// record of which node a given object is. Nodes with no fields of their own +// (A_Star, Null, TODO) would all encode as "{}", and an empty List would be +// indistinguishable from them. Every node struct instead declares +// +// Tag NodeTag[T] `json:"tag"` +// +// as its first field, with T the node's own type. The field is zero-sized and +// its zero value is valid, so constructing nodes as struct literals is +// unaffected; encoding/json calls MarshalJSON on the field, and the type +// parameter carries the node's identity to it at compile time. +type NodeTag[T any] struct{} + +func (NodeTag[T]) MarshalJSON() ([]byte, error) { + return json.Marshal(reflect.TypeFor[T]().Name()) +} + +// UnmarshalJSON accepts only the containing node's own name, so a document +// decoded into the wrong node type is an error rather than a silently +// misfielded tree. +func (*NodeTag[T]) UnmarshalJSON(data []byte) error { + var name string + if err := json.Unmarshal(data, &name); err != nil { + return err + } + if want := reflect.TypeFor[T]().Name(); name != want { + return fmt.Errorf("node tagged %q decoded into %s", name, want) + } + return nil +} diff --git a/internal/sql/ast/notify_stmt.go b/internal/sql/ast/notify_stmt.go index 0c50a11123..1f2df47a9f 100644 --- a/internal/sql/ast/notify_stmt.go +++ b/internal/sql/ast/notify_stmt.go @@ -1,15 +1,19 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type NotifyStmt struct { - Conditionname *string - Payload *string + Tag NodeTag[NotifyStmt] `json:"tag"` + + Conditionname *string `json:"conditionname,omitempty"` + Payload *string `json:"payload,omitempty"` } func (n *NotifyStmt) Pos() int { return 0 } -func (n *NotifyStmt) Format(buf *TrackedBuffer) { +func (n *NotifyStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/null.go b/internal/sql/ast/null.go index 380c8e7372..4fbba22f15 100644 --- a/internal/sql/ast/null.go +++ b/internal/sql/ast/null.go @@ -1,11 +1,14 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type Null struct { + Tag NodeTag[Null] `json:"tag"` } func (n *Null) Pos() int { return 0 } -func (n *Null) Format(buf *TrackedBuffer) { +func (n *Null) Format(buf *TrackedBuffer, d format.Dialect) { buf.WriteString("NULL") } diff --git a/internal/sql/ast/null_test_expr.go b/internal/sql/ast/null_test_expr.go index 51fd37f6bb..ed0d1fddaf 100644 --- a/internal/sql/ast/null_test_expr.go +++ b/internal/sql/ast/null_test_expr.go @@ -1,13 +1,36 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type NullTest struct { - Xpr Node - Arg Node - Nulltesttype NullTestType - Argisrow bool - Location int + Tag NodeTag[NullTest] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Nulltesttype NullTestType `json:"nulltesttype"` + Argisrow bool `json:"argisrow"` + Location int `json:"location"` } func (n *NullTest) Pos() int { return n.Location } + +// NullTestType values +const ( + NullTestTypeIsNull NullTestType = 1 + NullTestTypeIsNotNull NullTestType = 2 +) + +func (n *NullTest) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.astFormat(n.Arg, d) + switch n.Nulltesttype { + case NullTestTypeIsNull: + buf.WriteString(" IS NULL") + case NullTestTypeIsNotNull: + buf.WriteString(" IS NOT NULL") + } +} diff --git a/internal/sql/ast/object_with_args.go b/internal/sql/ast/object_with_args.go index 5b5a1a8bd9..05b0a0ce07 100644 --- a/internal/sql/ast/object_with_args.go +++ b/internal/sql/ast/object_with_args.go @@ -1,9 +1,11 @@ package ast type ObjectWithArgs struct { - Objname *List - Objargs *List - ArgsUnspecified bool + Tag NodeTag[ObjectWithArgs] `json:"tag"` + + Objname *List `json:"objname,omitempty"` + Objargs *List `json:"objargs,omitempty"` + ArgsUnspecified bool `json:"args_unspecified"` } func (n *ObjectWithArgs) Pos() int { diff --git a/internal/sql/ast/on_conflict_clause.go b/internal/sql/ast/on_conflict_clause.go index 25333d6d59..bbf01d6a82 100644 --- a/internal/sql/ast/on_conflict_clause.go +++ b/internal/sql/ast/on_conflict_clause.go @@ -1,13 +1,75 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type OnConflictClause struct { - Action OnConflictAction - Infer *InferClause - TargetList *List - WhereClause Node - Location int + Tag NodeTag[OnConflictClause] `json:"tag"` + + Action OnConflictAction `json:"action"` + Infer *InferClause `json:"infer,omitempty"` + TargetList *List `json:"target_list,omitempty"` + WhereClause Node `json:"where_clause,omitempty"` + Location int `json:"location"` } func (n *OnConflictClause) Pos() int { return n.Location } + +// OnConflictAction values matching pg_query_go +const ( + OnConflictActionUndefined OnConflictAction = 0 + OnConflictActionNone OnConflictAction = 1 + OnConflictActionNothing OnConflictAction = 2 + OnConflictActionUpdate OnConflictAction = 3 +) + +func (n *OnConflictClause) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("ON CONFLICT ") + if n.Infer != nil { + buf.astFormat(n.Infer, d) + buf.WriteString(" ") + } + switch n.Action { + case OnConflictActionNothing: + buf.WriteString("DO NOTHING") + case OnConflictActionUpdate: + buf.WriteString("DO UPDATE SET") + buf.Group() + buf.Indent() + // Format as assignment list: name = val, one per line when the + // author broke the list (or a comment forces it open). + if n.TargetList != nil { + for i, item := range n.TargetList.Items { + if i == 0 { + buf.boundary(item) + buf.Line() + } else { + buf.WriteString(",") + buf.boundary(item) + buf.Line() + } + if rt, ok := item.(*ResTarget); ok { + if rt.Name != nil { + buf.WriteString(*rt.Name) + } + buf.WriteString(" = ") + buf.astFormat(rt.Val, d) + } else { + buf.astFormat(item, d) + } + } + } + buf.EndIndent() + if set(n.WhereClause) { + buf.boundary(n.WhereClause) + buf.Line() + buf.WriteString("WHERE ") + buf.condition(n.WhereClause, d) + } + buf.EndGroup() + } +} diff --git a/internal/sql/ast/on_conflict_expr.go b/internal/sql/ast/on_conflict_expr.go index ae9659c754..5bd559e1c8 100644 --- a/internal/sql/ast/on_conflict_expr.go +++ b/internal/sql/ast/on_conflict_expr.go @@ -1,14 +1,16 @@ package ast type OnConflictExpr struct { - Action OnConflictAction - ArbiterElems *List - ArbiterWhere Node - Constraint Oid - OnConflictSet *List - OnConflictWhere Node - ExclRelIndex int - ExclRelTlist *List + Tag NodeTag[OnConflictExpr] `json:"tag"` + + Action OnConflictAction `json:"action"` + ArbiterElems *List `json:"arbiter_elems,omitempty"` + ArbiterWhere Node `json:"arbiter_where,omitempty"` + Constraint Oid `json:"constraint"` + OnConflictSet *List `json:"on_conflict_set,omitempty"` + OnConflictWhere Node `json:"on_conflict_where,omitempty"` + ExclRelIndex int `json:"excl_rel_index"` + ExclRelTlist *List `json:"excl_rel_tlist,omitempty"` } func (n *OnConflictExpr) Pos() int { diff --git a/internal/sql/ast/on_duplicate_key_update.go b/internal/sql/ast/on_duplicate_key_update.go new file mode 100644 index 0000000000..bc1dbf4d13 --- /dev/null +++ b/internal/sql/ast/on_duplicate_key_update.go @@ -0,0 +1,39 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +// OnDuplicateKeyUpdate represents MySQL's ON DUPLICATE KEY UPDATE clause +type OnDuplicateKeyUpdate struct { + Tag NodeTag[OnDuplicateKeyUpdate] `json:"tag"` + + // TargetList contains the assignments (column = value pairs) + TargetList *List `json:"target_list,omitempty"` + Location int `json:"location"` +} + +func (n *OnDuplicateKeyUpdate) Pos() int { + return n.Location +} + +func (n *OnDuplicateKeyUpdate) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("ON DUPLICATE KEY UPDATE ") + if n.TargetList != nil { + for i, item := range n.TargetList.Items { + if i > 0 { + buf.WriteString(", ") + } + if rt, ok := item.(*ResTarget); ok { + if rt.Name != nil { + buf.WriteString(*rt.Name) + } + buf.WriteString(" = ") + buf.astFormat(rt.Val, d) + } else { + buf.astFormat(item, d) + } + } + } +} diff --git a/internal/sql/ast/op_expr.go b/internal/sql/ast/op_expr.go index 5b371545dc..0d81af54ab 100644 --- a/internal/sql/ast/op_expr.go +++ b/internal/sql/ast/op_expr.go @@ -1,15 +1,16 @@ package ast type OpExpr struct { - Xpr Node - Opno Oid - Opfuncid Oid - Opresulttype Oid - Opretset bool - Opcollid Oid - Inputcollid Oid - Args *List - Location int + Tag NodeTag[OpExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Opno Oid `json:"opno"` + Opresulttype Oid `json:"opresulttype"` + Opretset bool `json:"opretset"` + Opcollid Oid `json:"opcollid"` + Inputcollid Oid `json:"inputcollid"` + Args *List `json:"args,omitempty"` + Location int `json:"location"` } func (n *OpExpr) Pos() int { diff --git a/internal/sql/ast/param.go b/internal/sql/ast/param.go index 33220800bb..d9121de50e 100644 --- a/internal/sql/ast/param.go +++ b/internal/sql/ast/param.go @@ -1,13 +1,15 @@ package ast type Param struct { - Xpr Node - Paramkind ParamKind - Paramid int - Paramtype Oid - Paramtypmod int32 - Paramcollid Oid - Location int + Tag NodeTag[Param] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Paramkind ParamKind `json:"paramkind"` + Paramid int `json:"paramid"` + Paramtype Oid `json:"paramtype"` + Paramtypmod int32 `json:"paramtypmod"` + Paramcollid Oid `json:"paramcollid"` + Location int `json:"location"` } func (n *Param) Pos() int { diff --git a/internal/sql/ast/param_exec_data.go b/internal/sql/ast/param_exec_data.go index 83e9b04f9a..6f151ea20a 100644 --- a/internal/sql/ast/param_exec_data.go +++ b/internal/sql/ast/param_exec_data.go @@ -1,9 +1,11 @@ package ast type ParamExecData struct { - ExecPlan interface{} - Value Datum - Isnull bool + Tag NodeTag[ParamExecData] `json:"tag"` + + ExecPlan any `json:"exec_plan,omitempty"` + Value Datum `json:"value"` + Isnull bool `json:"isnull"` } func (n *ParamExecData) Pos() int { diff --git a/internal/sql/ast/param_extern_data.go b/internal/sql/ast/param_extern_data.go index a5d9bfcd49..4da009ff3f 100644 --- a/internal/sql/ast/param_extern_data.go +++ b/internal/sql/ast/param_extern_data.go @@ -1,10 +1,12 @@ package ast type ParamExternData struct { - Value Datum - Isnull bool - Pflags uint16 - Ptype Oid + Tag NodeTag[ParamExternData] `json:"tag"` + + Value Datum `json:"value"` + Isnull bool `json:"isnull"` + Pflags uint16 `json:"pflags"` + Ptype Oid `json:"ptype"` } func (n *ParamExternData) Pos() int { diff --git a/internal/sql/ast/param_list_info_data.go b/internal/sql/ast/param_list_info_data.go index 1275124244..30e34d0bed 100644 --- a/internal/sql/ast/param_list_info_data.go +++ b/internal/sql/ast/param_list_info_data.go @@ -1,10 +1,12 @@ package ast type ParamListInfoData struct { - ParamFetchArg interface{} - ParserSetupArg interface{} - NumParams int - ParamMask []uint32 + Tag NodeTag[ParamListInfoData] `json:"tag"` + + ParamFetchArg any `json:"param_fetch_arg,omitempty"` + ParserSetupArg any `json:"parser_setup_arg,omitempty"` + NumParams int `json:"num_params"` + ParamMask []uint32 `json:"param_mask,omitempty"` } func (n *ParamListInfoData) Pos() int { diff --git a/internal/sql/ast/param_ref.go b/internal/sql/ast/param_ref.go index 8bd724993d..c533fc0387 100644 --- a/internal/sql/ast/param_ref.go +++ b/internal/sql/ast/param_ref.go @@ -1,20 +1,26 @@ package ast -import "fmt" +import "github.com/sqlc-dev/sqlc/internal/sql/format" type ParamRef struct { - Number int - Location int - Dollar bool + Tag NodeTag[ParamRef] `json:"tag"` + + Number int `json:"number"` + Location int `json:"location"` + Dollar bool `json:"dollar"` + // Name is the name the query gave the placeholder, when its syntax + // has one: SQL Server's and Spanner's @name and ClickHouse's + // {name:Type}. + Name string `json:"name,omitempty"` } func (n *ParamRef) Pos() int { return n.Location } -func (n *ParamRef) Format(buf *TrackedBuffer) { +func (n *ParamRef) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - fmt.Fprintf(buf, "$%d", n.Number) + buf.WriteString(d.Param(n.Number, n.Dollar)) } diff --git a/internal/sql/ast/paren_expr.go b/internal/sql/ast/paren_expr.go new file mode 100644 index 0000000000..79cb15b42b --- /dev/null +++ b/internal/sql/ast/paren_expr.go @@ -0,0 +1,24 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +// ParenExpr represents a parenthesized expression +type ParenExpr struct { + Tag NodeTag[ParenExpr] `json:"tag"` + + Expr Node `json:"expr,omitempty"` + Location int `json:"location"` +} + +func (n *ParenExpr) Pos() int { + return n.Location +} + +func (n *ParenExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("(") + buf.astFormat(n.Expr, d) + buf.WriteString(")") +} diff --git a/internal/sql/ast/partition_bound_spec.go b/internal/sql/ast/partition_bound_spec.go index fb4ada70af..6f45517835 100644 --- a/internal/sql/ast/partition_bound_spec.go +++ b/internal/sql/ast/partition_bound_spec.go @@ -1,11 +1,13 @@ package ast type PartitionBoundSpec struct { - Strategy byte - Listdatums *List - Lowerdatums *List - Upperdatums *List - Location int + Tag NodeTag[PartitionBoundSpec] `json:"tag"` + + Strategy byte `json:"strategy"` + Listdatums *List `json:"listdatums,omitempty"` + Lowerdatums *List `json:"lowerdatums,omitempty"` + Upperdatums *List `json:"upperdatums,omitempty"` + Location int `json:"location"` } func (n *PartitionBoundSpec) Pos() int { diff --git a/internal/sql/ast/partition_cmd.go b/internal/sql/ast/partition_cmd.go index 2deb30e998..931b809172 100644 --- a/internal/sql/ast/partition_cmd.go +++ b/internal/sql/ast/partition_cmd.go @@ -1,8 +1,10 @@ package ast type PartitionCmd struct { - Name *RangeVar - Bound *PartitionBoundSpec + Tag NodeTag[PartitionCmd] `json:"tag"` + + Name *RangeVar `json:"name,omitempty"` + Bound *PartitionBoundSpec `json:"bound,omitempty"` } func (n *PartitionCmd) Pos() int { diff --git a/internal/sql/ast/partition_elem.go b/internal/sql/ast/partition_elem.go index b4be165d36..1fe38fccb2 100644 --- a/internal/sql/ast/partition_elem.go +++ b/internal/sql/ast/partition_elem.go @@ -1,11 +1,13 @@ package ast type PartitionElem struct { - Name *string - Expr Node - Collation *List - Opclass *List - Location int + Tag NodeTag[PartitionElem] `json:"tag"` + + Name *string `json:"name,omitempty"` + Expr Node `json:"expr,omitempty"` + Collation *List `json:"collation,omitempty"` + Opclass *List `json:"opclass,omitempty"` + Location int `json:"location"` } func (n *PartitionElem) Pos() int { diff --git a/internal/sql/ast/partition_range_datum.go b/internal/sql/ast/partition_range_datum.go index 312437dd32..d827ced496 100644 --- a/internal/sql/ast/partition_range_datum.go +++ b/internal/sql/ast/partition_range_datum.go @@ -1,9 +1,11 @@ package ast type PartitionRangeDatum struct { - Kind PartitionRangeDatumKind - Value Node - Location int + Tag NodeTag[PartitionRangeDatum] `json:"tag"` + + Kind PartitionRangeDatumKind `json:"kind"` + Value Node `json:"value,omitempty"` + Location int `json:"location"` } func (n *PartitionRangeDatum) Pos() int { diff --git a/internal/sql/ast/partition_spec.go b/internal/sql/ast/partition_spec.go index 2918119e68..1d0b17400d 100644 --- a/internal/sql/ast/partition_spec.go +++ b/internal/sql/ast/partition_spec.go @@ -1,9 +1,11 @@ package ast type PartitionSpec struct { - Strategy *string - PartParams *List - Location int + Tag NodeTag[PartitionSpec] `json:"tag"` + + Strategy *string `json:"strategy,omitempty"` + PartParams *List `json:"part_params,omitempty"` + Location int `json:"location"` } func (n *PartitionSpec) Pos() int { diff --git a/internal/sql/ast/prepare_stmt.go b/internal/sql/ast/prepare_stmt.go index a088ac29b1..a31633d1c8 100644 --- a/internal/sql/ast/prepare_stmt.go +++ b/internal/sql/ast/prepare_stmt.go @@ -1,9 +1,11 @@ package ast type PrepareStmt struct { - Name *string - Argtypes *List - Query Node + Tag NodeTag[PrepareStmt] `json:"tag"` + + Name *string `json:"name,omitempty"` + Argtypes *List `json:"argtypes,omitempty"` + Query Node `json:"query,omitempty"` } func (n *PrepareStmt) Pos() int { diff --git a/internal/sql/ast/print.go b/internal/sql/ast/print.go index 867a53a177..1ec48a0873 100644 --- a/internal/sql/ast/print.go +++ b/internal/sql/ast/print.go @@ -1,56 +1,247 @@ package ast import ( - "strings" - "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/sql/ast/printer" + "github.com/sqlc-dev/sqlc/internal/sql/format" ) -type formatter interface { - Format(*TrackedBuffer) +type nodeFormatter interface { + Format(*TrackedBuffer, format.Dialect) } +// TrackedBuffer layers AST formatting over the document renderer in +// ast/printer: node dispatch, list joins, and comment emission. The +// renderer itself — tokens, groups, width fitting — lives in the printer +// package; TrackedBuffer stays here because every node's Format method +// names it, which an ast → printer → ast import cycle would forbid. type TrackedBuffer struct { - *strings.Builder + *printer.Buffer + // ct, when set, carries the statement's interior comments attached to + // their anchor nodes; the buffer emits each comment when it reaches the + // comment's anchor. Positions were consulted once, in AttachComments — + // never here — so edited and synthetic trees print comments correctly. + ct *CommentTable + // anchors, when set, records every positioned node and emission point + // in print order instead of producing output; AttachComments uses this + // dry run to classify comments against the same order printing will + // use. + anchors *[]anchor } // NewTrackedBuffer creates a new TrackedBuffer. func NewTrackedBuffer() *TrackedBuffer { - buf := &TrackedBuffer{ - Builder: new(strings.Builder), - } - return buf + return &TrackedBuffer{Buffer: &printer.Buffer{}} } -func (t *TrackedBuffer) astFormat(n Node) { - if ft, ok := n.(formatter); ok { - ft.Format(t) +func (t *TrackedBuffer) astFormat(n Node, d format.Dialect) { + if t.anchors != nil && n != nil && n.Pos() > 0 { + *t.anchors = append(*t.anchors, anchor{node: n, pos: n.Pos()}) + } + if t.ct != nil && n != nil { + t.emitComments(t.ct.take(n)) + } + if ft, ok := n.(nodeFormatter); ok { + ft.Format(t, d) } else { debug.Dump(n) } } -func (t *TrackedBuffer) join(n *List, sep string) { +// emitComments prints attached comments at the boundary before their anchor +// node. A trailing comment continues the line before it (a line comment +// then forces the enclosing groups to break); an own-line or line comment +// goes on its own line; an inline block comment stays in the flow. +func (t *TrackedBuffer) emitComments(recs []commentRec) { + for _, rec := range recs { + switch { + case rec.trailing: + t.WriteString(" ") + t.WriteString(rec.c.Text) + if rec.c.Line() { + t.Breaker() + } + case rec.c.OwnLine || rec.c.Line(): + t.Hardline() + t.WriteString(rec.c.Text) + t.Hardline() + default: + t.WriteString(rec.c.Text) + t.WriteString(" ") + } + } +} + +// beforeClause is the emission point for comments that sit between the +// previous clause and the one about to be printed, so they land before the +// clause keyword. Call it before the clause's line break. During the +// AttachComments dry run it records itself as a boundary marker, which is +// how classification and emission are guaranteed to pick the same spot — +// and how the author's own line break before the clause is observed and +// kept. +func (t *TrackedBuffer) beforeClause(n Node, d format.Dialect) { + t.boundary(n) +} + +// boundary is a separator-adjacent emission point (before a clause, after a +// comma, before an AND/OR): comments classified to the upcoming node print +// here, before the separator's line break, and a line break the author +// wrote at this boundary forces the break to stay. On the dry run it +// records a marker instead, so classification and emission agree by +// construction. +func (t *TrackedBuffer) boundary(next Node) { + if next == nil { + return + } + if t.anchors != nil { + *t.anchors = append(*t.anchors, anchor{node: next, marker: true}) + return + } + if t.ct != nil { + t.emitComments(t.ct.take(next)) + if t.ct.breakAt(next) { + t.Breaker() + } + } +} + +// flushRemaining prints every comment not yet printed; the statement is +// over, so everything left trails it. +func (t *TrackedBuffer) flushRemaining() { + if t.ct == nil { + return + } + for _, rec := range t.ct.takeRemaining() { + if rec.trailing { + t.WriteString(" ") + t.WriteString(rec.c.Text) + if rec.c.Line() { + t.Breaker() + } + } else { + t.Hardline() + t.WriteString(rec.c.Text) + } + } +} + +func (t *TrackedBuffer) join(n *List, d format.Dialect, sep string) { if n == nil { return } - for i, item := range n.Items { + first := true + for _, item := range n.Items { if _, ok := item.(*TODO); ok { continue } - if i > 0 { + if !first { t.WriteString(sep) } - t.astFormat(item) + first = false + t.astFormat(item, d) + } +} + +// joinComma writes the list items separated by a comma and a break +// opportunity, so a list that fits stays on one line and a list that does +// not puts every item on its own line. An item's trailing comment prints +// after the comma, gofmt-style: `total, -- computed`. +func (t *TrackedBuffer) joinComma(n *List, d format.Dialect) { + if n == nil { + return + } + items := make([]Node, 0, len(n.Items)) + for _, item := range n.Items { + if _, ok := item.(*TODO); ok { + continue + } + items = append(items, item) + } + for i, item := range items { + if i > 0 { + t.WriteString(",") + t.boundary(item) + t.Line() + } + t.astFormat(item, d) } } -func Format(n Node) string { +// condition formats a clause-level boolean condition (WHERE, HAVING, ON). +// A top-level AND/OR chain is printed without the enclosing parentheses a +// nested BoolExpr gets — the clause keyword already delimits it — and each +// branch goes on its own line when the chain does not fit: +// +// WHERE name LIKE $1 +// AND id > $2 +func (t *TrackedBuffer) condition(n Node, d format.Dialect) { + be, ok := n.(*BoolExpr) + if !ok || (be.Boolop != BoolExprTypeAnd && be.Boolop != BoolExprTypeOr) { + t.astFormat(n, d) + return + } + op := "AND " + if be.Boolop == BoolExprTypeOr { + op = "OR " + } + t.Group() + t.Indent() + first := true + t.conditionArgs(be, d, op, &first) + t.EndIndent() + t.EndGroup() +} + +// conditionArgs writes the branches of an AND/OR chain, flattening nested +// chains of the same operator (some parsers produce `a AND b AND c` as a +// left-nested tree) so no redundant parentheses appear. +func (t *TrackedBuffer) conditionArgs(be *BoolExpr, d format.Dialect, op string, first *bool) { + if be.Args == nil { + return + } + for _, item := range be.Args.Items { + if _, ok := item.(*TODO); ok { + continue + } + if nested, ok := item.(*BoolExpr); ok && nested.Boolop == be.Boolop { + t.conditionArgs(nested, d, op, first) + continue + } + if !*first { + t.boundary(item) + t.Line() + t.WriteString(op) + } + *first = false + t.astFormat(item, d) + } +} + +// Format renders the node as SQL on a single line. +func Format(n Node, d format.Dialect) string { + return Pretty(n, d, -1) +} + +// Pretty renders the node as SQL, breaking lines so the output fits within +// width columns where the statement's structure allows it. A negative width +// renders everything on a single line. +func Pretty(n Node, d format.Dialect, width int) string { + return PrettyWithComments(n, d, width, nil) +} + +// PrettyWithComments renders the node as SQL like Pretty, emitting the +// comments a prior AttachComments call anchored to its nodes and keeping +// the line breaks the author wrote at the boundaries the printer models. +// Each comment prints at the boundary before its anchor, a trailing comment +// continues the line of the code it followed, and every comment in the +// table is printed — anything left when the statement ends trails it. +func PrettyWithComments(n Node, d format.Dialect, width int, ct *CommentTable) string { tb := NewTrackedBuffer() - if ft, ok := n.(formatter); ok { - ft.Format(tb) + tb.ct = ct + if ft, ok := n.(nodeFormatter); ok { + ft.Format(tb, d) } - return tb.String() + return tb.Print(width) } func set(n Node) bool { @@ -58,10 +249,7 @@ func set(n Node) bool { return false } _, ok := n.(*TODO) - if ok { - return false - } - return true + return !ok } func items(n *List) bool { diff --git a/internal/sql/ast/printer/printer.go b/internal/sql/ast/printer/printer.go new file mode 100644 index 0000000000..69c8bbacbe --- /dev/null +++ b/internal/sql/ast/printer/printer.go @@ -0,0 +1,250 @@ +// Package printer implements the document renderer the SQL formatter +// prints through: a small Wadler-style engine, the model behind Prettier +// and ruff (via Biome's printer). Callers emit a stream of tokens — literal +// text, break opportunities, and markers that open and close groups and +// indented regions — and Print lays each group out on a single line when +// its flat width fits, breaking it otherwise. The package knows nothing +// about SQL or the AST; the ast package's TrackedBuffer embeds a Buffer and +// layers node formatting and comment emission on top. +package printer + +import ( + "strings" + "unicode/utf8" +) + +type tokenKind uint8 + +const ( + tokenText tokenKind = iota + // tokenLine renders as a single space when its group fits on one line + // and as a line break when the group is broken. + tokenLine + // tokenSoftline renders as nothing when its group fits on one line and + // as a line break when the group is broken. + tokenSoftline + // tokenHardline always renders a line break and forces every group + // containing it to break (it measures as infinitely wide). Emitted + // around comments, which pin the author's layout open. + tokenHardline + // tokenBreaker renders nothing but forces every group containing it to + // break. Emitted after a trailing line comment, whose text swallows the + // rest of the line, and at boundaries where the author broke the line. + tokenBreaker + tokenOpenGroup + tokenCloseGroup + tokenOpenIndent + tokenCloseIndent +) + +// breakWidth is the measured width of tokens that force a break: wider than +// any real line, so no group containing one ever fits. +const breakWidth = 1 << 24 + +// indentWidth is the number of spaces per indentation level in broken +// (multi-line) output. +const indentWidth = 2 + +type token struct { + kind tokenKind + text string +} + +// Buffer accumulates the document token stream. +type Buffer struct { + tokens []token +} + +func (t *Buffer) WriteString(s string) (int, error) { + if s == "" { + return 0, nil + } + t.tokens = append(t.tokens, token{kind: tokenText, text: s}) + return len(s), nil +} + +// Write implements io.Writer so callers can use fmt.Fprintf. +func (t *Buffer) Write(p []byte) (int, error) { + return t.WriteString(string(p)) +} + +func (t *Buffer) WriteRune(r rune) (int, error) { + return t.WriteString(string(r)) +} + +// String renders the buffer on a single line. +func (t *Buffer) String() string { + return t.Print(-1) +} + +// Line marks a break opportunity between two tokens: a space when the +// surrounding group fits on one line, a line break when it does not. +func (t *Buffer) Line() { + t.tokens = append(t.tokens, token{kind: tokenLine}) +} + +// Softline marks a break opportunity that disappears entirely when the +// surrounding group fits on one line. +func (t *Buffer) Softline() { + t.tokens = append(t.tokens, token{kind: tokenSoftline}) +} + +// Hardline always renders a line break and forces every enclosing group to +// break. +func (t *Buffer) Hardline() { + t.tokens = append(t.tokens, token{kind: tokenHardline}) +} + +// Breaker renders nothing but forces every enclosing group to break, so the +// next break opportunity becomes a real line break. +func (t *Buffer) Breaker() { + t.tokens = append(t.tokens, token{kind: tokenBreaker}) +} + +// Group opens a region the renderer tries to lay out on a single line, +// breaking it only when its flat form does not fit. Must be paired with +// EndGroup. +func (t *Buffer) Group() { + t.tokens = append(t.tokens, token{kind: tokenOpenGroup}) +} + +func (t *Buffer) EndGroup() { + t.tokens = append(t.tokens, token{kind: tokenCloseGroup}) +} + +// Indent opens a region printed one indentation level deeper when line +// breaks occur inside it. Must be paired with EndIndent. +func (t *Buffer) Indent() { + t.tokens = append(t.tokens, token{kind: tokenOpenIndent}) +} + +func (t *Buffer) EndIndent() { + t.tokens = append(t.tokens, token{kind: tokenCloseIndent}) +} + +// docNode is the tree form of the token stream: text and break tokens are +// leaves, groups and indented regions are interior nodes. +type docNode struct { + kind tokenKind + text string + kids []*docNode + width int // flat width in runes, filled in by measure +} + +// tree assembles the flat token stream into a document tree. Stray close +// markers are ignored and unclosed regions end at the end of the stream. +func (t *Buffer) tree() *docNode { + root := &docNode{kind: tokenOpenGroup} + stack := []*docNode{root} + for _, tok := range t.tokens { + top := stack[len(stack)-1] + switch tok.kind { + case tokenText, tokenLine, tokenSoftline, tokenHardline, tokenBreaker: + top.kids = append(top.kids, &docNode{kind: tok.kind, text: tok.text}) + case tokenOpenGroup, tokenOpenIndent: + n := &docNode{kind: tok.kind} + top.kids = append(top.kids, n) + stack = append(stack, n) + case tokenCloseGroup, tokenCloseIndent: + if len(stack) > 1 { + stack = stack[:len(stack)-1] + } + } + } + return root +} + +// measure computes the width of every node when rendered flat. Hardlines +// and breakers measure wider than any real line, so no group containing one +// ever fits — Prettier's breakParent, by arithmetic. +func measure(d *docNode) int { + switch d.kind { + case tokenText: + d.width = utf8.RuneCountInString(d.text) + case tokenLine: + d.width = 1 + case tokenSoftline: + d.width = 0 + case tokenHardline, tokenBreaker: + d.width = breakWidth + default: + for _, kid := range d.kids { + d.width += measure(kid) + if d.width > breakWidth { + d.width = breakWidth + } + } + } + return d.width +} + +// Print renders the token stream. A negative width renders everything on +// one line; otherwise each group is rendered flat only when it fits in the +// space remaining on its line — and a group holding a hardline or breaker +// never fits, whatever the width, so forced breaks survive even an +// unlimited line length. +func (t *Buffer) Print(width int) string { + root := t.tree() + measure(root) + + type frame struct { + d *docNode + indent int + flat bool + } + var sb strings.Builder + col := 0 + // atLineStart dedupes consecutive breaks: a break that fires when the + // output is already at the start of a fresh line writes nothing, so a + // comment's surrounding hardlines collapse against clause breaks + // instead of leaving blank lines. + atLineStart := true + newline := func(indent int) { + if atLineStart { + return + } + sb.WriteByte('\n') + for i := 0; i < indent; i++ { + sb.WriteByte(' ') + } + col = indent + atLineStart = true + } + stack := []frame{{d: root, flat: width < 0}} + for len(stack) > 0 { + f := stack[len(stack)-1] + stack = stack[:len(stack)-1] + switch f.d.kind { + case tokenText: + sb.WriteString(f.d.text) + col += f.d.width + atLineStart = false + case tokenLine: + if f.flat { + sb.WriteByte(' ') + col++ + atLineStart = false + } else { + newline(f.indent) + } + case tokenSoftline: + if !f.flat { + newline(f.indent) + } + case tokenHardline: + newline(f.indent) + case tokenBreaker: + // forces enclosing groups broken; renders nothing + case tokenOpenGroup: + flat := f.flat || (f.d.width < breakWidth && f.d.width <= width-col) + for i := len(f.d.kids) - 1; i >= 0; i-- { + stack = append(stack, frame{d: f.d.kids[i], indent: f.indent, flat: flat}) + } + case tokenOpenIndent: + for i := len(f.d.kids) - 1; i >= 0; i-- { + stack = append(stack, frame{d: f.d.kids[i], indent: f.indent + indentWidth, flat: f.flat}) + } + } + } + return sb.String() +} diff --git a/internal/sql/ast/query.go b/internal/sql/ast/query.go index db25dfeb5d..7ace8aa9d9 100644 --- a/internal/sql/ast/query.go +++ b/internal/sql/ast/query.go @@ -1,42 +1,44 @@ package ast type Query struct { - CommandType CmdType - QuerySource QuerySource - QueryId uint32 - CanSetTag bool - UtilityStmt Node - ResultRelation int - HasAggs bool - HasWindowFuncs bool - HasTargetSrfs bool - HasSubLinks bool - HasDistinctOn bool - HasRecursive bool - HasModifyingCte bool - HasForUpdate bool - HasRowSecurity bool - CteList *List - Rtable *List - Jointree *FromExpr - TargetList *List - Override OverridingKind - OnConflict *OnConflictExpr - ReturningList *List - GroupClause *List - GroupingSets *List - HavingQual Node - WindowClause *List - DistinctClause *List - SortClause *List - LimitOffset Node - LimitCount Node - RowMarks *List - SetOperations Node - ConstraintDeps *List - WithCheckOptions *List - StmtLocation int - StmtLen int + Tag NodeTag[Query] `json:"tag"` + + CommandType CmdType `json:"command_type"` + QuerySource QuerySource `json:"query_source"` + QueryId uint32 `json:"query_id"` + CanSetTag bool `json:"can_set_tag"` + UtilityStmt Node `json:"utility_stmt,omitempty"` + ResultRelation int `json:"result_relation"` + HasAggs bool `json:"has_aggs"` + HasWindowFuncs bool `json:"has_window_funcs"` + HasTargetSrfs bool `json:"has_target_srfs"` + HasSubLinks bool `json:"has_sub_links"` + HasDistinctOn bool `json:"has_distinct_on"` + HasRecursive bool `json:"has_recursive"` + HasModifyingCte bool `json:"has_modifying_cte"` + HasForUpdate bool `json:"has_for_update"` + HasRowSecurity bool `json:"has_row_security"` + CteList *List `json:"cte_list,omitempty"` + Rtable *List `json:"rtable,omitempty"` + Jointree *FromExpr `json:"jointree,omitempty"` + TargetList *List `json:"target_list,omitempty"` + Override OverridingKind `json:"override"` + OnConflict *OnConflictExpr `json:"on_conflict,omitempty"` + ReturningList *List `json:"returning_list,omitempty"` + GroupClause *List `json:"group_clause,omitempty"` + GroupingSets *List `json:"grouping_sets,omitempty"` + HavingQual Node `json:"having_qual,omitempty"` + WindowClause *List `json:"window_clause,omitempty"` + DistinctClause *List `json:"distinct_clause,omitempty"` + SortClause *List `json:"sort_clause,omitempty"` + LimitOffset Node `json:"limit_offset,omitempty"` + LimitCount Node `json:"limit_count,omitempty"` + RowMarks *List `json:"row_marks,omitempty"` + SetOperations Node `json:"set_operations,omitempty"` + ConstraintDeps *List `json:"constraint_deps,omitempty"` + WithCheckOptions *List `json:"with_check_options,omitempty"` + StmtLocation int `json:"stmt_location"` + StmtLen int `json:"stmt_len"` } func (n *Query) Pos() int { diff --git a/internal/sql/ast/range_function.go b/internal/sql/ast/range_function.go index 299078d481..3d1b6d0c30 100644 --- a/internal/sql/ast/range_function.go +++ b/internal/sql/ast/range_function.go @@ -1,25 +1,35 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RangeFunction struct { - Lateral bool - Ordinality bool - IsRowsfrom bool - Functions *List - Alias *Alias - Coldeflist *List + Tag NodeTag[RangeFunction] `json:"tag"` + + Lateral bool `json:"lateral"` + Ordinality bool `json:"ordinality"` + IsRowsfrom bool `json:"is_rowsfrom"` + Functions *List `json:"functions,omitempty"` + Alias *Alias `json:"alias,omitempty"` + Coldeflist *List `json:"coldeflist,omitempty"` } func (n *RangeFunction) Pos() int { return 0 } -func (n *RangeFunction) Format(buf *TrackedBuffer) { +func (n *RangeFunction) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.astFormat(n.Functions) + if n.Lateral { + buf.WriteString("LATERAL ") + } + buf.astFormat(n.Functions, d) if n.Ordinality { - buf.WriteString(" WITH ORDINALITY ") + buf.WriteString(" WITH ORDINALITY") + } + if n.Alias != nil { + buf.WriteString(" AS ") + buf.astFormat(n.Alias, d) } - buf.astFormat(n.Alias) } diff --git a/internal/sql/ast/range_subselect.go b/internal/sql/ast/range_subselect.go index 1506ee7994..8f2efe9b1e 100644 --- a/internal/sql/ast/range_subselect.go +++ b/internal/sql/ast/range_subselect.go @@ -1,24 +1,31 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RangeSubselect struct { - Lateral bool - Subquery Node - Alias *Alias + Tag NodeTag[RangeSubselect] `json:"tag"` + + Lateral bool `json:"lateral"` + Subquery Node `json:"subquery,omitempty"` + Alias *Alias `json:"alias,omitempty"` } func (n *RangeSubselect) Pos() int { return 0 } -func (n *RangeSubselect) Format(buf *TrackedBuffer) { +func (n *RangeSubselect) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } + if n.Lateral { + buf.WriteString("LATERAL ") + } buf.WriteString("(") - buf.astFormat(n.Subquery) + buf.astFormat(n.Subquery, d) buf.WriteString(")") if n.Alias != nil { - buf.WriteString(" ") - buf.astFormat(n.Alias) + buf.WriteString(" AS ") + buf.astFormat(n.Alias, d) } } diff --git a/internal/sql/ast/range_table_func.go b/internal/sql/ast/range_table_func.go index e53992edab..7758339c96 100644 --- a/internal/sql/ast/range_table_func.go +++ b/internal/sql/ast/range_table_func.go @@ -1,13 +1,15 @@ package ast type RangeTableFunc struct { - Lateral bool - Docexpr Node - Rowexpr Node - Namespaces *List - Columns *List - Alias *Alias - Location int + Tag NodeTag[RangeTableFunc] `json:"tag"` + + Lateral bool `json:"lateral"` + Docexpr Node `json:"docexpr,omitempty"` + Rowexpr Node `json:"rowexpr,omitempty"` + Namespaces *List `json:"namespaces,omitempty"` + Columns *List `json:"columns,omitempty"` + Alias *Alias `json:"alias,omitempty"` + Location int `json:"location"` } func (n *RangeTableFunc) Pos() int { diff --git a/internal/sql/ast/range_table_func_col.go b/internal/sql/ast/range_table_func_col.go index 2c06db1c08..d3fc620f3b 100644 --- a/internal/sql/ast/range_table_func_col.go +++ b/internal/sql/ast/range_table_func_col.go @@ -1,13 +1,15 @@ package ast type RangeTableFuncCol struct { - Colname *string - TypeName *TypeName - ForOrdinality bool - IsNotNull bool - Colexpr Node - Coldefexpr Node - Location int + Tag NodeTag[RangeTableFuncCol] `json:"tag"` + + Colname *string `json:"colname,omitempty"` + TypeName *TypeName `json:"type_name,omitempty"` + ForOrdinality bool `json:"for_ordinality"` + IsNotNull bool `json:"is_not_null"` + Colexpr Node `json:"colexpr,omitempty"` + Coldefexpr Node `json:"coldefexpr,omitempty"` + Location int `json:"location"` } func (n *RangeTableFuncCol) Pos() int { diff --git a/internal/sql/ast/range_table_sample.go b/internal/sql/ast/range_table_sample.go index c5fa2a2880..cf4c41f5b8 100644 --- a/internal/sql/ast/range_table_sample.go +++ b/internal/sql/ast/range_table_sample.go @@ -1,11 +1,13 @@ package ast type RangeTableSample struct { - Relation Node - Method *List - Args *List - Repeatable Node - Location int + Tag NodeTag[RangeTableSample] `json:"tag"` + + Relation Node `json:"relation,omitempty"` + Method *List `json:"method,omitempty"` + Args *List `json:"args,omitempty"` + Repeatable Node `json:"repeatable,omitempty"` + Location int `json:"location"` } func (n *RangeTableSample) Pos() int { diff --git a/internal/sql/ast/range_tbl_entry.go b/internal/sql/ast/range_tbl_entry.go index be40e619b4..e3dbf2b39f 100644 --- a/internal/sql/ast/range_tbl_entry.go +++ b/internal/sql/ast/range_tbl_entry.go @@ -1,37 +1,39 @@ package ast type RangeTblEntry struct { - Rtekind RTEKind - Relid Oid - Relkind byte - Tablesample *TableSampleClause - Subquery *Query - SecurityBarrier bool - Jointype JoinType - Joinaliasvars *List - Functions *List - Funcordinality bool - Tablefunc *TableFunc - ValuesLists *List - Ctename *string - Ctelevelsup Index - SelfReference bool - Coltypes *List - Coltypmods *List - Colcollations *List - Enrname *string - Enrtuples float64 - Alias *Alias - Eref *Alias - Lateral bool - Inh bool - InFromCl bool - RequiredPerms AclMode - CheckAsUser Oid - SelectedCols []uint32 - InsertedCols []uint32 - UpdatedCols []uint32 - SecurityQuals *List + Tag NodeTag[RangeTblEntry] `json:"tag"` + + Rtekind RTEKind `json:"rtekind"` + Relid Oid `json:"relid"` + Relkind byte `json:"relkind"` + Tablesample *TableSampleClause `json:"tablesample,omitempty"` + Subquery *Query `json:"subquery,omitempty"` + SecurityBarrier bool `json:"security_barrier"` + Jointype JoinType `json:"jointype"` + Joinaliasvars *List `json:"joinaliasvars,omitempty"` + Functions *List `json:"functions,omitempty"` + Funcordinality bool `json:"funcordinality"` + Tablefunc *TableFunc `json:"tablefunc,omitempty"` + ValuesLists *List `json:"values_lists,omitempty"` + Ctename *string `json:"ctename,omitempty"` + Ctelevelsup Index `json:"ctelevelsup"` + SelfReference bool `json:"self_reference"` + Coltypes *List `json:"coltypes,omitempty"` + Coltypmods *List `json:"coltypmods,omitempty"` + Colcollations *List `json:"colcollations,omitempty"` + Enrname *string `json:"enrname,omitempty"` + Enrtuples float64 `json:"enrtuples"` + Alias *Alias `json:"alias,omitempty"` + Eref *Alias `json:"eref,omitempty"` + Lateral bool `json:"lateral"` + Inh bool `json:"inh"` + InFromCl bool `json:"in_from_cl"` + RequiredPerms AclMode `json:"required_perms"` + CheckAsUser Oid `json:"check_as_user"` + SelectedCols []uint32 `json:"selected_cols,omitempty"` + InsertedCols []uint32 `json:"inserted_cols,omitempty"` + UpdatedCols []uint32 `json:"updated_cols,omitempty"` + SecurityQuals *List `json:"security_quals,omitempty"` } func (n *RangeTblEntry) Pos() int { diff --git a/internal/sql/ast/range_tbl_function.go b/internal/sql/ast/range_tbl_function.go index ee0e609f74..c4f54e1d55 100644 --- a/internal/sql/ast/range_tbl_function.go +++ b/internal/sql/ast/range_tbl_function.go @@ -1,13 +1,15 @@ package ast type RangeTblFunction struct { - Funcexpr Node - Funccolcount int - Funccolnames *List - Funccoltypes *List - Funccoltypmods *List - Funccolcollations *List - Funcparams []uint32 + Tag NodeTag[RangeTblFunction] `json:"tag"` + + Funcexpr Node `json:"funcexpr,omitempty"` + Funccolcount int `json:"funccolcount"` + Funccolnames *List `json:"funccolnames,omitempty"` + Funccoltypes *List `json:"funccoltypes,omitempty"` + Funccoltypmods *List `json:"funccoltypmods,omitempty"` + Funccolcollations *List `json:"funccolcollations,omitempty"` + Funcparams []uint32 `json:"funcparams,omitempty"` } func (n *RangeTblFunction) Pos() int { diff --git a/internal/sql/ast/range_tbl_ref.go b/internal/sql/ast/range_tbl_ref.go index de537568de..e3e1cc2a22 100644 --- a/internal/sql/ast/range_tbl_ref.go +++ b/internal/sql/ast/range_tbl_ref.go @@ -1,7 +1,9 @@ package ast type RangeTblRef struct { - Rtindex int + Tag NodeTag[RangeTblRef] `json:"tag"` + + Rtindex int `json:"rtindex"` } func (n *RangeTblRef) Pos() int { diff --git a/internal/sql/ast/range_var.go b/internal/sql/ast/range_var.go index 1d1656f6c0..ce70c97114 100644 --- a/internal/sql/ast/range_var.go +++ b/internal/sql/ast/range_var.go @@ -1,39 +1,36 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RangeVar struct { - Catalogname *string - Schemaname *string - Relname *string - Inh bool - Relpersistence byte - Alias *Alias - Location int + Tag NodeTag[RangeVar] `json:"tag"` + + Catalogname *string `json:"catalogname,omitempty"` + Schemaname *string `json:"schemaname,omitempty"` + Relname *string `json:"relname,omitempty"` + Inh bool `json:"inh"` + Relpersistence byte `json:"relpersistence"` + Alias *Alias `json:"alias,omitempty"` + Location int `json:"location"` } func (n *RangeVar) Pos() int { return n.Location } -func (n *RangeVar) Format(buf *TrackedBuffer) { +func (n *RangeVar) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - if n.Schemaname != nil { - buf.WriteString(*n.Schemaname) + if n.Schemaname != nil && *n.Schemaname != "" { + buf.WriteString(d.QuoteIdent(*n.Schemaname)) buf.WriteString(".") } if n.Relname != nil { - // TODO: What names need to be quoted - if *n.Relname == "user" { - buf.WriteString(`"`) - buf.WriteString(*n.Relname) - buf.WriteString(`"`) - } else { - buf.WriteString(*n.Relname) - } + buf.WriteString(d.QuoteIdent(*n.Relname)) } if n.Alias != nil { - buf.WriteString(" ") - buf.astFormat(n.Alias) + buf.WriteString(" AS ") + buf.astFormat(n.Alias, d) } } diff --git a/internal/sql/ast/raw_stmt.go b/internal/sql/ast/raw_stmt.go index 55192d2eec..73e50d508e 100644 --- a/internal/sql/ast/raw_stmt.go +++ b/internal/sql/ast/raw_stmt.go @@ -1,18 +1,24 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RawStmt struct { - Stmt Node - StmtLocation int - StmtLen int + Tag NodeTag[RawStmt] `json:"tag"` + + Stmt Node `json:"stmt,omitempty"` + StmtLocation int `json:"stmt_location"` + StmtLen int `json:"stmt_len"` } func (n *RawStmt) Pos() int { return n.StmtLocation } -func (n *RawStmt) Format(buf *TrackedBuffer) { +func (n *RawStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n.Stmt != nil { - buf.astFormat(n.Stmt) + buf.astFormat(n.Stmt, d) } + // The terminator goes first: a trailing line comment would swallow it. buf.WriteString(";") + buf.flushRemaining() } diff --git a/internal/sql/ast/reassign_owned_stmt.go b/internal/sql/ast/reassign_owned_stmt.go index 9162131f46..d062e7826c 100644 --- a/internal/sql/ast/reassign_owned_stmt.go +++ b/internal/sql/ast/reassign_owned_stmt.go @@ -1,8 +1,10 @@ package ast type ReassignOwnedStmt struct { - Roles *List - Newrole *RoleSpec + Tag NodeTag[ReassignOwnedStmt] `json:"tag"` + + Roles *List `json:"roles,omitempty"` + Newrole *RoleSpec `json:"newrole,omitempty"` } func (n *ReassignOwnedStmt) Pos() int { diff --git a/internal/sql/ast/refresh_mat_view_stmt.go b/internal/sql/ast/refresh_mat_view_stmt.go index e9b3e26bfa..d8c76e55f7 100644 --- a/internal/sql/ast/refresh_mat_view_stmt.go +++ b/internal/sql/ast/refresh_mat_view_stmt.go @@ -1,19 +1,23 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RefreshMatViewStmt struct { - Concurrent bool - SkipData bool - Relation *RangeVar + Tag NodeTag[RefreshMatViewStmt] `json:"tag"` + + Concurrent bool `json:"concurrent"` + SkipData bool `json:"skip_data"` + Relation *RangeVar `json:"relation,omitempty"` } func (n *RefreshMatViewStmt) Pos() int { return 0 } -func (n *RefreshMatViewStmt) Format(buf *TrackedBuffer) { +func (n *RefreshMatViewStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } buf.WriteString("REFRESH MATERIALIZED VIEW ") - buf.astFormat(n.Relation) + buf.astFormat(n.Relation, d) } diff --git a/internal/sql/ast/reindex_stmt.go b/internal/sql/ast/reindex_stmt.go index 9d33d490fe..7261134655 100644 --- a/internal/sql/ast/reindex_stmt.go +++ b/internal/sql/ast/reindex_stmt.go @@ -1,10 +1,12 @@ package ast type ReindexStmt struct { - Kind ReindexObjectType - Relation *RangeVar - Name *string - Options int + Tag NodeTag[ReindexStmt] `json:"tag"` + + Kind ReindexObjectType `json:"kind"` + Relation *RangeVar `json:"relation,omitempty"` + Name *string `json:"name,omitempty"` + Options int `json:"options"` } func (n *ReindexStmt) Pos() int { diff --git a/internal/sql/ast/relabel_type.go b/internal/sql/ast/relabel_type.go index e30e93184e..efaf74250c 100644 --- a/internal/sql/ast/relabel_type.go +++ b/internal/sql/ast/relabel_type.go @@ -1,13 +1,15 @@ package ast type RelabelType struct { - Xpr Node - Arg Node - Resulttype Oid - Resulttypmod int32 - Resultcollid Oid - Relabelformat CoercionForm - Location int + Tag NodeTag[RelabelType] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Arg Node `json:"arg,omitempty"` + Resulttype Oid `json:"resulttype"` + Resulttypmod int32 `json:"resulttypmod"` + Resultcollid Oid `json:"resultcollid"` + Relabelformat CoercionForm `json:"relabelformat"` + Location int `json:"location"` } func (n *RelabelType) Pos() int { diff --git a/internal/sql/ast/rename_column_stmt.go b/internal/sql/ast/rename_column_stmt.go index 498b89d6ef..e677ce4661 100644 --- a/internal/sql/ast/rename_column_stmt.go +++ b/internal/sql/ast/rename_column_stmt.go @@ -1,10 +1,12 @@ package ast type RenameColumnStmt struct { - Table *TableName - Col *ColumnRef - NewName *string - MissingOk bool + Tag NodeTag[RenameColumnStmt] `json:"tag"` + + Table *TableName `json:"table,omitempty"` + Col *ColumnRef `json:"col,omitempty"` + NewName *string `json:"new_name,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *RenameColumnStmt) Pos() int { diff --git a/internal/sql/ast/rename_stmt.go b/internal/sql/ast/rename_stmt.go index cb9c176324..47865132c8 100644 --- a/internal/sql/ast/rename_stmt.go +++ b/internal/sql/ast/rename_stmt.go @@ -1,14 +1,16 @@ package ast type RenameStmt struct { - RenameType ObjectType - RelationType ObjectType - Relation *RangeVar - Object Node - Subname *string - Newname *string - Behavior DropBehavior - MissingOk bool + Tag NodeTag[RenameStmt] `json:"tag"` + + RenameType ObjectType `json:"rename_type"` + RelationType ObjectType `json:"relation_type"` + Relation *RangeVar `json:"relation,omitempty"` + Object Node `json:"object,omitempty"` + Subname *string `json:"subname,omitempty"` + Newname *string `json:"newname,omitempty"` + Behavior DropBehavior `json:"behavior"` + MissingOk bool `json:"missing_ok"` } func (n *RenameStmt) Pos() int { diff --git a/internal/sql/ast/rename_table_stmt.go b/internal/sql/ast/rename_table_stmt.go index b879ddb0b7..a8473e0310 100644 --- a/internal/sql/ast/rename_table_stmt.go +++ b/internal/sql/ast/rename_table_stmt.go @@ -1,9 +1,11 @@ package ast type RenameTableStmt struct { - Table *TableName - NewName *string - MissingOk bool + Tag NodeTag[RenameTableStmt] `json:"tag"` + + Table *TableName `json:"table,omitempty"` + NewName *string `json:"new_name,omitempty"` + MissingOk bool `json:"missing_ok"` } func (n *RenameTableStmt) Pos() int { diff --git a/internal/sql/ast/rename_type_stmt.go b/internal/sql/ast/rename_type_stmt.go index 67472d02f2..fced204dc8 100644 --- a/internal/sql/ast/rename_type_stmt.go +++ b/internal/sql/ast/rename_type_stmt.go @@ -1,8 +1,10 @@ package ast type RenameTypeStmt struct { - Type *TypeName - NewName *string + Tag NodeTag[RenameTypeStmt] `json:"tag"` + + Type *TypeName `json:"type,omitempty"` + NewName *string `json:"new_name,omitempty"` } func (n *RenameTypeStmt) Pos() int { diff --git a/internal/sql/ast/replica_identity_stmt.go b/internal/sql/ast/replica_identity_stmt.go index 2d4291597b..abe08e05e4 100644 --- a/internal/sql/ast/replica_identity_stmt.go +++ b/internal/sql/ast/replica_identity_stmt.go @@ -1,8 +1,10 @@ package ast type ReplicaIdentityStmt struct { - IdentityType byte - Name *string + Tag NodeTag[ReplicaIdentityStmt] `json:"tag"` + + IdentityType byte `json:"identity_type"` + Name *string `json:"name,omitempty"` } func (n *ReplicaIdentityStmt) Pos() int { diff --git a/internal/sql/ast/res_target.go b/internal/sql/ast/res_target.go index 4ee2e72112..8a58b273d2 100644 --- a/internal/sql/ast/res_target.go +++ b/internal/sql/ast/res_target.go @@ -1,29 +1,37 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type ResTarget struct { - Name *string - Indirection *List - Val Node - Location int + Tag NodeTag[ResTarget] `json:"tag"` + + Name *string `json:"name,omitempty"` + Indirection *List `json:"indirection,omitempty"` + Val Node `json:"val,omitempty"` + Location int `json:"location"` + // Relation qualifies Name in a multi-table UPDATE's SET list (MySQL: + // SET t.col = ...). Analysis matches on Name alone; printing needs the + // qualifier to keep the assignment on the table the author named. + Relation *string `json:"relation,omitempty"` } func (n *ResTarget) Pos() int { return n.Location } -func (n *ResTarget) Format(buf *TrackedBuffer) { +func (n *ResTarget) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } if set(n.Val) { - buf.astFormat(n.Val) + buf.astFormat(n.Val, d) if n.Name != nil { buf.WriteString(" AS ") - buf.WriteString(*n.Name) + buf.WriteString(d.QuoteIdent(*n.Name)) } } else { if n.Name != nil { - buf.WriteString(*n.Name) + buf.WriteString(d.QuoteIdent(*n.Name)) } } } diff --git a/internal/sql/ast/returning.go b/internal/sql/ast/returning.go new file mode 100644 index 0000000000..70de843415 --- /dev/null +++ b/internal/sql/ast/returning.go @@ -0,0 +1,24 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +// formatReturningOptions writes the PostgreSQL 18 RETURNING WITH (...) option +// list that renames the OLD and NEW aliases available in a RETURNING clause. +func formatReturningOptions(buf *TrackedBuffer, d format.Dialect, oldAlias, newAlias string) { + if oldAlias == "" && newAlias == "" { + return + } + buf.WriteString("WITH (") + if oldAlias != "" { + buf.WriteString("OLD AS ") + buf.WriteString(d.QuoteIdent(oldAlias)) + } + if newAlias != "" { + if oldAlias != "" { + buf.WriteString(", ") + } + buf.WriteString("NEW AS ") + buf.WriteString(d.QuoteIdent(newAlias)) + } + buf.WriteString(") ") +} diff --git a/internal/sql/ast/role_spec.go b/internal/sql/ast/role_spec.go index fba4cecf7d..154ddf3ce4 100644 --- a/internal/sql/ast/role_spec.go +++ b/internal/sql/ast/role_spec.go @@ -1,9 +1,11 @@ package ast type RoleSpec struct { - Roletype RoleSpecType - Rolename *string - Location int + Tag NodeTag[RoleSpec] `json:"tag"` + + Roletype RoleSpecType `json:"roletype"` + Rolename *string `json:"rolename,omitempty"` + Location int `json:"location"` } func (n *RoleSpec) Pos() int { diff --git a/internal/sql/ast/row_compare_expr.go b/internal/sql/ast/row_compare_expr.go index 884cc3420d..bbab320eda 100644 --- a/internal/sql/ast/row_compare_expr.go +++ b/internal/sql/ast/row_compare_expr.go @@ -1,13 +1,15 @@ package ast type RowCompareExpr struct { - Xpr Node - Rctype RowCompareType - Opnos *List - Opfamilies *List - Inputcollids *List - Largs *List - Rargs *List + Tag NodeTag[RowCompareExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Rctype RowCompareType `json:"rctype"` + Opnos *List `json:"opnos,omitempty"` + Opfamilies *List `json:"opfamilies,omitempty"` + Inputcollids *List `json:"inputcollids,omitempty"` + Largs *List `json:"largs,omitempty"` + Rargs *List `json:"rargs,omitempty"` } func (n *RowCompareExpr) Pos() int { diff --git a/internal/sql/ast/row_expr.go b/internal/sql/ast/row_expr.go index 14804f5821..d898086da6 100644 --- a/internal/sql/ast/row_expr.go +++ b/internal/sql/ast/row_expr.go @@ -1,29 +1,33 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type RowExpr struct { - Xpr Node - Args *List - RowTypeid Oid - RowFormat CoercionForm - Colnames *List - Location int + Tag NodeTag[RowExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Args *List `json:"args,omitempty"` + RowTypeid Oid `json:"row_typeid"` + RowFormat CoercionForm `json:"row_format"` + Colnames *List `json:"colnames,omitempty"` + Location int `json:"location"` } func (n *RowExpr) Pos() int { return n.Location } -func (n *RowExpr) Format(buf *TrackedBuffer) { +func (n *RowExpr) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } if items(n.Args) { buf.WriteString("args") - buf.astFormat(n.Args) + buf.astFormat(n.Args, d) } - buf.astFormat(n.Xpr) + buf.astFormat(n.Xpr, d) if items(n.Colnames) { buf.WriteString("cols") - buf.astFormat(n.Colnames) + buf.astFormat(n.Colnames, d) } } diff --git a/internal/sql/ast/row_mark_clause.go b/internal/sql/ast/row_mark_clause.go index 5f2f8fa2f2..121174e6ba 100644 --- a/internal/sql/ast/row_mark_clause.go +++ b/internal/sql/ast/row_mark_clause.go @@ -1,10 +1,12 @@ package ast type RowMarkClause struct { - Rti Index - Strength LockClauseStrength - WaitPolicy LockWaitPolicy - PushedDown bool + Tag NodeTag[RowMarkClause] `json:"tag"` + + Rti Index `json:"rti"` + Strength LockClauseStrength `json:"strength"` + WaitPolicy LockWaitPolicy `json:"wait_policy"` + PushedDown bool `json:"pushed_down"` } func (n *RowMarkClause) Pos() int { diff --git a/internal/sql/ast/rule_stmt.go b/internal/sql/ast/rule_stmt.go index 5ed05a8c5f..7821866d58 100644 --- a/internal/sql/ast/rule_stmt.go +++ b/internal/sql/ast/rule_stmt.go @@ -1,13 +1,15 @@ package ast type RuleStmt struct { - Relation *RangeVar - Rulename *string - WhereClause Node - Event CmdType - Instead bool - Actions *List - Replace bool + Tag NodeTag[RuleStmt] `json:"tag"` + + Relation *RangeVar `json:"relation,omitempty"` + Rulename *string `json:"rulename,omitempty"` + WhereClause Node `json:"where_clause,omitempty"` + Event CmdType `json:"event"` + Instead bool `json:"instead"` + Actions *List `json:"actions,omitempty"` + Replace bool `json:"replace"` } func (n *RuleStmt) Pos() int { diff --git a/internal/sql/ast/scalar_array_op_expr.go b/internal/sql/ast/scalar_array_op_expr.go index 6b9ad6ad8b..a427fd0e67 100644 --- a/internal/sql/ast/scalar_array_op_expr.go +++ b/internal/sql/ast/scalar_array_op_expr.go @@ -1,15 +1,37 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type ScalarArrayOpExpr struct { - Xpr Node - Opno Oid - Opfuncid Oid - UseOr bool - Inputcollid Oid - Args *List - Location int + Tag NodeTag[ScalarArrayOpExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Opno Oid `json:"opno"` + UseOr bool `json:"use_or"` + Inputcollid Oid `json:"inputcollid"` + Args *List `json:"args,omitempty"` + Location int `json:"location"` } func (n *ScalarArrayOpExpr) Pos() int { return n.Location } + +func (n *ScalarArrayOpExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + // ScalarArrayOpExpr represents "scalar op ANY/ALL (array)" + // Args[0] is the left operand, Args[1] is the array + if n.Args != nil && len(n.Args.Items) >= 2 { + buf.astFormat(n.Args.Items[0], d) + buf.WriteString(" = ") // TODO: Use actual operator based on Opno + if n.UseOr { + buf.WriteString("ANY(") + } else { + buf.WriteString("ALL(") + } + buf.astFormat(n.Args.Items[1], d) + buf.WriteString(")") + } +} diff --git a/internal/sql/ast/sec_label_stmt.go b/internal/sql/ast/sec_label_stmt.go index 608edb733f..3a00bee0c4 100644 --- a/internal/sql/ast/sec_label_stmt.go +++ b/internal/sql/ast/sec_label_stmt.go @@ -1,10 +1,12 @@ package ast type SecLabelStmt struct { - Objtype ObjectType - Object Node - Provider *string - Label *string + Tag NodeTag[SecLabelStmt] `json:"tag"` + + Objtype ObjectType `json:"objtype"` + Object Node `json:"object,omitempty"` + Provider *string `json:"provider,omitempty"` + Label *string `json:"label,omitempty"` } func (n *SecLabelStmt) Pos() int { diff --git a/internal/sql/ast/select_stmt.go b/internal/sql/ast/select_stmt.go index 051dd5c8c5..e4e9eaf8a8 100644 --- a/internal/sql/ast/select_stmt.go +++ b/internal/sql/ast/select_stmt.go @@ -1,112 +1,183 @@ package ast import ( - "fmt" + "github.com/sqlc-dev/sqlc/internal/sql/format" ) type SelectStmt struct { - DistinctClause *List - IntoClause *IntoClause - TargetList *List - FromClause *List - WhereClause Node - GroupClause *List - HavingClause Node - WindowClause *List - ValuesLists *List - SortClause *List - LimitOffset Node - LimitCount Node - LockingClause *List - WithClause *WithClause - Op SetOperation - All bool - Larg *SelectStmt - Rarg *SelectStmt + Tag NodeTag[SelectStmt] `json:"tag"` + + DistinctClause *List `json:"distinct_clause,omitempty"` + IntoClause *IntoClause `json:"into_clause,omitempty"` + TargetList *List `json:"target_list,omitempty"` + FromClause *List `json:"from_clause,omitempty"` + WhereClause Node `json:"where_clause,omitempty"` + GroupClause *List `json:"group_clause,omitempty"` + HavingClause Node `json:"having_clause,omitempty"` + WindowClause *List `json:"window_clause,omitempty"` + ValuesLists *List `json:"values_lists,omitempty"` + SortClause *List `json:"sort_clause,omitempty"` + LimitOffset Node `json:"limit_offset,omitempty"` + LimitCount Node `json:"limit_count,omitempty"` + LockingClause *List `json:"locking_clause,omitempty"` + WithClause *WithClause `json:"with_clause,omitempty"` + Op SetOperation `json:"op"` + All bool `json:"all"` + Larg *SelectStmt `json:"larg,omitempty"` + Rarg *SelectStmt `json:"rarg,omitempty"` + // TableHints is the text inside a MySQL optimizer-hint comment + // (SELECT /*+ MAX_EXECUTION_TIME(1000) */ ...). The compiler ignores + // hints; printing keeps them because they change how the server runs + // the query. + TableHints string `json:"table_hints,omitempty"` } func (n *SelectStmt) Pos() int { return 0 } -func (n *SelectStmt) Format(buf *TrackedBuffer) { +func (n *SelectStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } if items(n.ValuesLists) { - buf.WriteString("VALUES (") - buf.astFormat(n.ValuesLists) - buf.WriteString(")") + buf.WriteString("VALUES ") + // ValuesLists is a list of rows, where each row is a List of values + for i, row := range n.ValuesLists.Items { + if i > 0 { + buf.WriteString(", ") + } + buf.WriteString("(") + buf.Group() + buf.Indent() + buf.Softline() + if r, ok := row.(*List); ok { + buf.joinComma(r, d) + } else { + buf.astFormat(row, d) + } + buf.EndIndent() + buf.Softline() + buf.EndGroup() + buf.WriteString(")") + } return } + buf.Group() + defer buf.EndGroup() + if n.WithClause != nil { - buf.astFormat(n.WithClause) - buf.WriteString(" ") + buf.astFormat(n.WithClause, d) + // The boundary between the WITH clause and the statement's own + // first keyword; the group keeps a break inside the WITH clause + // from forcing the statement body apart clause by clause. + if n.Larg != nil { + buf.boundary(n.Larg) + } else { + buf.boundary(n.TargetList) + } + buf.Line() + buf.Group() + defer buf.EndGroup() } if n.Larg != nil && n.Rarg != nil { - buf.astFormat(n.Larg) + buf.astFormat(n.Larg, d) + // The seam between the compound halves: an author who broke the + // line around UNION / INTERSECT / EXCEPT keeps the operator on its + // own line, and a comment above it prints here. + buf.boundary(n.Rarg) + buf.Line() switch n.Op { case Union: - buf.WriteString(" UNION ") + buf.WriteString("UNION") case Except: - buf.WriteString(" EXCEPT ") + buf.WriteString("EXCEPT") case Intersect: - buf.WriteString(" INTERSECT ") + buf.WriteString("INTERSECT") } if n.All { - buf.WriteString("ALL ") + buf.WriteString(" ALL") } - buf.astFormat(n.Rarg) + buf.Line() + buf.astFormat(n.Rarg, d) } else { - buf.WriteString("SELECT ") - } - - if items(n.DistinctClause) { - buf.WriteString("DISTINCT ") - if !todo(n.DistinctClause) { - fmt.Fprintf(buf, "ON (") - buf.astFormat(n.DistinctClause) - fmt.Fprintf(buf, ")") + buf.WriteString("SELECT") + if n.TableHints != "" { + buf.WriteString(" /*+ ") + buf.WriteString(n.TableHints) + buf.WriteString(" */") + } + if items(n.DistinctClause) { + buf.WriteString(" DISTINCT") + if !todo(n.DistinctClause) { + buf.WriteString(" ON (") + buf.astFormat(n.DistinctClause, d) + buf.WriteString(")") + } } + buf.Group() + buf.Indent() + buf.Line() + buf.joinComma(n.TargetList, d) + buf.EndIndent() + buf.EndGroup() } - buf.astFormat(n.TargetList) if items(n.FromClause) { - buf.WriteString(" FROM ") - buf.astFormat(n.FromClause) + buf.beforeClause(n.FromClause, d) + buf.Line() + buf.WriteString("FROM ") + buf.astFormat(n.FromClause, d) } if set(n.WhereClause) { - buf.WriteString(" WHERE ") - buf.astFormat(n.WhereClause) + buf.beforeClause(n.WhereClause, d) + buf.Line() + buf.WriteString("WHERE ") + buf.condition(n.WhereClause, d) } if items(n.GroupClause) { - buf.WriteString(" GROUP BY ") - buf.astFormat(n.GroupClause) + buf.beforeClause(n.GroupClause, d) + buf.Line() + buf.WriteString("GROUP BY ") + buf.astFormat(n.GroupClause, d) + } + + if set(n.HavingClause) { + buf.beforeClause(n.HavingClause, d) + buf.Line() + buf.WriteString("HAVING ") + buf.condition(n.HavingClause, d) } if items(n.SortClause) { - buf.WriteString(" ORDER BY ") - buf.astFormat(n.SortClause) + buf.beforeClause(n.SortClause, d) + buf.Line() + buf.WriteString("ORDER BY ") + buf.astFormat(n.SortClause, d) } if set(n.LimitCount) { - buf.WriteString(" LIMIT ") - buf.astFormat(n.LimitCount) + buf.beforeClause(n.LimitCount, d) + buf.Line() + buf.WriteString("LIMIT ") + buf.astFormat(n.LimitCount, d) } if set(n.LimitOffset) { - buf.WriteString(" OFFSET ") - buf.astFormat(n.LimitOffset) + buf.beforeClause(n.LimitOffset, d) + buf.Line() + buf.WriteString("OFFSET ") + buf.astFormat(n.LimitOffset, d) } if items(n.LockingClause) { - buf.WriteString(" ") - buf.astFormat(n.LockingClause) + buf.Line() + buf.astFormat(n.LockingClause, d) } } diff --git a/internal/sql/ast/set_operation_stmt.go b/internal/sql/ast/set_operation_stmt.go index 9ab1950d1b..975460facb 100644 --- a/internal/sql/ast/set_operation_stmt.go +++ b/internal/sql/ast/set_operation_stmt.go @@ -1,14 +1,16 @@ package ast type SetOperationStmt struct { - Op SetOperation - All bool - Larg Node - Rarg Node - ColTypes *List - ColTypmods *List - ColCollations *List - GroupClauses *List + Tag NodeTag[SetOperationStmt] `json:"tag"` + + Op SetOperation `json:"op"` + All bool `json:"all"` + Larg Node `json:"larg,omitempty"` + Rarg Node `json:"rarg,omitempty"` + ColTypes *List `json:"col_types,omitempty"` + ColTypmods *List `json:"col_typmods,omitempty"` + ColCollations *List `json:"col_collations,omitempty"` + GroupClauses *List `json:"group_clauses,omitempty"` } func (n *SetOperationStmt) Pos() int { diff --git a/internal/sql/ast/set_to_default.go b/internal/sql/ast/set_to_default.go index c127d3bc77..6ae1d066c4 100644 --- a/internal/sql/ast/set_to_default.go +++ b/internal/sql/ast/set_to_default.go @@ -1,11 +1,13 @@ package ast type SetToDefault struct { - Xpr Node - TypeId Oid - TypeMod int32 - Collation Oid - Location int + Tag NodeTag[SetToDefault] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + TypeId Oid `json:"type_id"` + TypeMod int32 `json:"type_mod"` + Collation Oid `json:"collation"` + Location int `json:"location"` } func (n *SetToDefault) Pos() int { diff --git a/internal/sql/ast/sort_by.go b/internal/sql/ast/sort_by.go index 21a7a079aa..f1e241cc54 100644 --- a/internal/sql/ast/sort_by.go +++ b/internal/sql/ast/sort_by.go @@ -1,26 +1,36 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type SortBy struct { - Node Node - SortbyDir SortByDir - SortbyNulls SortByNulls - UseOp *List - Location int + Tag NodeTag[SortBy] `json:"tag"` + + Node Node `json:"node,omitempty"` + SortbyDir SortByDir `json:"sortby_dir"` + SortbyNulls SortByNulls `json:"sortby_nulls"` + UseOp *List `json:"use_op,omitempty"` + Location int `json:"location"` } func (n *SortBy) Pos() int { return n.Location } -func (n *SortBy) Format(buf *TrackedBuffer) { +func (n *SortBy) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.astFormat(n.Node) + buf.astFormat(n.Node, d) switch n.SortbyDir { case SortByDirAsc: buf.WriteString(" ASC") case SortByDirDesc: buf.WriteString(" DESC") } + switch n.SortbyNulls { + case SortByNullsFirst: + buf.WriteString(" NULLS FIRST") + case SortByNullsLast: + buf.WriteString(" NULLS LAST") + } } diff --git a/internal/sql/ast/sort_group_clause.go b/internal/sql/ast/sort_group_clause.go index 775035d799..e28cc89a8b 100644 --- a/internal/sql/ast/sort_group_clause.go +++ b/internal/sql/ast/sort_group_clause.go @@ -1,11 +1,13 @@ package ast type SortGroupClause struct { - TleSortGroupRef Index - Eqop Oid - Sortop Oid - NullsFirst bool - Hashable bool + Tag NodeTag[SortGroupClause] `json:"tag"` + + TleSortGroupRef Index `json:"tle_sort_group_ref"` + Eqop Oid `json:"eqop"` + Sortop Oid `json:"sortop"` + NullsFirst bool `json:"nulls_first"` + Hashable bool `json:"hashable"` } func (n *SortGroupClause) Pos() int { diff --git a/internal/sql/ast/sql_value_function.go b/internal/sql/ast/sql_value_function.go index 0bd0777374..4c9fd2b670 100644 --- a/internal/sql/ast/sql_value_function.go +++ b/internal/sql/ast/sql_value_function.go @@ -1,18 +1,22 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type SQLValueFunction struct { - Xpr Node - Op SQLValueFunctionOp - Type Oid - Typmod int32 - Location int + Tag NodeTag[SQLValueFunction] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Op SQLValueFunctionOp `json:"op"` + Type Oid `json:"type"` + Typmod int32 `json:"typmod"` + Location int `json:"location"` } func (n *SQLValueFunction) Pos() int { return n.Location } -func (n *SQLValueFunction) Format(buf *TrackedBuffer) { +func (n *SQLValueFunction) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/statement.go b/internal/sql/ast/statement.go index 4d01d949ca..dff54d6fb8 100644 --- a/internal/sql/ast/statement.go +++ b/internal/sql/ast/statement.go @@ -1,7 +1,9 @@ package ast type Statement struct { - Raw *RawStmt + Tag NodeTag[Statement] `json:"tag"` + + Raw *RawStmt `json:"raw,omitempty"` } func (n *Statement) Pos() int { diff --git a/internal/sql/ast/string.go b/internal/sql/ast/string.go index 977fc19a2f..b2ebe3b211 100644 --- a/internal/sql/ast/string.go +++ b/internal/sql/ast/string.go @@ -1,14 +1,18 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type String struct { - Str string + Tag NodeTag[String] `json:"tag"` + + Str string `json:"str"` } func (n *String) Pos() int { return 0 } -func (n *String) Format(buf *TrackedBuffer) { +func (n *String) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/sub_link.go b/internal/sql/ast/sub_link.go index 9463f98c54..184f36c96f 100644 --- a/internal/sql/ast/sub_link.go +++ b/internal/sql/ast/sub_link.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type SubLinkType uint const ( @@ -14,32 +16,52 @@ const ( ) type SubLink struct { - Xpr Node - SubLinkType SubLinkType - SubLinkId int - Testexpr Node - OperName *List - Subselect Node - Location int + Tag NodeTag[SubLink] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + SubLinkType SubLinkType `json:"sub_link_type"` + SubLinkId int `json:"sub_link_id"` + Testexpr Node `json:"testexpr,omitempty"` + OperName *List `json:"oper_name,omitempty"` + Subselect Node `json:"subselect,omitempty"` + Location int `json:"location"` } func (n *SubLink) Pos() int { return n.Location } -func (n *SubLink) Format(buf *TrackedBuffer) { +func (n *SubLink) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.astFormat(n.Testexpr) + // Format the test expression if present (for IN subqueries etc.) + hasTestExpr := n.Testexpr != nil + if hasTestExpr { + buf.astFormat(n.Testexpr, d) + } switch n.SubLinkType { case EXISTS_SUBLINK: - buf.WriteString(" EXISTS (") + buf.WriteString("EXISTS (") case ANY_SUBLINK: - buf.WriteString(" IN (") + if hasTestExpr { + buf.WriteString(" IN (") + } else { + buf.WriteString("IN (") + } default: - buf.WriteString(" (") + if hasTestExpr { + buf.WriteString(" (") + } else { + buf.WriteString("(") + } } - buf.astFormat(n.Subselect) + buf.Group() + buf.Indent() + buf.Softline() + buf.astFormat(n.Subselect, d) + buf.EndIndent() + buf.Softline() + buf.EndGroup() buf.WriteString(")") } diff --git a/internal/sql/ast/sub_plan.go b/internal/sql/ast/sub_plan.go index 2443e86c98..50908c7134 100644 --- a/internal/sql/ast/sub_plan.go +++ b/internal/sql/ast/sub_plan.go @@ -1,23 +1,25 @@ package ast type SubPlan struct { - Xpr Node - SubLinkType SubLinkType - Testexpr Node - ParamIds *List - PlanId int - PlanName *string - FirstColType Oid - FirstColTypmod int32 - FirstColCollation Oid - UseHashTable bool - UnknownEqFalse bool - ParallelSafe bool - SetParam *List - ParParam *List - Args *List - StartupCost Cost - PerCallCost Cost + Tag NodeTag[SubPlan] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + SubLinkType SubLinkType `json:"sub_link_type"` + Testexpr Node `json:"testexpr,omitempty"` + ParamIds *List `json:"param_ids,omitempty"` + PlanId int `json:"plan_id"` + PlanName *string `json:"plan_name,omitempty"` + FirstColType Oid `json:"first_col_type"` + FirstColTypmod int32 `json:"first_col_typmod"` + FirstColCollation Oid `json:"first_col_collation"` + UseHashTable bool `json:"use_hash_table"` + UnknownEqFalse bool `json:"unknown_eq_false"` + ParallelSafe bool `json:"parallel_safe"` + SetParam *List `json:"set_param,omitempty"` + ParParam *List `json:"par_param,omitempty"` + Args *List `json:"args,omitempty"` + StartupCost Cost `json:"startup_cost"` + PerCallCost Cost `json:"per_call_cost"` } func (n *SubPlan) Pos() int { diff --git a/internal/sql/ast/table_func.go b/internal/sql/ast/table_func.go index 615ff82074..d2a22e365e 100644 --- a/internal/sql/ast/table_func.go +++ b/internal/sql/ast/table_func.go @@ -1,19 +1,21 @@ package ast type TableFunc struct { - NsUris *List - NsNames *List - Docexpr Node - Rowexpr Node - Colnames *List - Coltypes *List - Coltypmods *List - Colcollations *List - Colexprs *List - Coldefexprs *List - Notnulls []uint32 - Ordinalitycol int - Location int + Tag NodeTag[TableFunc] `json:"tag"` + + NsUris *List `json:"ns_uris,omitempty"` + NsNames *List `json:"ns_names,omitempty"` + Docexpr Node `json:"docexpr,omitempty"` + Rowexpr Node `json:"rowexpr,omitempty"` + Colnames *List `json:"colnames,omitempty"` + Coltypes *List `json:"coltypes,omitempty"` + Coltypmods *List `json:"coltypmods,omitempty"` + Colcollations *List `json:"colcollations,omitempty"` + Colexprs *List `json:"colexprs,omitempty"` + Coldefexprs *List `json:"coldefexprs,omitempty"` + Notnulls []uint32 `json:"notnulls,omitempty"` + Ordinalitycol int `json:"ordinalitycol"` + Location int `json:"location"` } func (n *TableFunc) Pos() int { diff --git a/internal/sql/ast/table_like_clause.go b/internal/sql/ast/table_like_clause.go index 338065f3a2..8a5af1d5e2 100644 --- a/internal/sql/ast/table_like_clause.go +++ b/internal/sql/ast/table_like_clause.go @@ -1,8 +1,10 @@ package ast type TableLikeClause struct { - Relation *RangeVar - Options uint32 + Tag NodeTag[TableLikeClause] `json:"tag"` + + Relation *RangeVar `json:"relation,omitempty"` + Options uint32 `json:"options"` } func (n *TableLikeClause) Pos() int { diff --git a/internal/sql/ast/table_name.go b/internal/sql/ast/table_name.go index a95a510c83..1dfe61fd4f 100644 --- a/internal/sql/ast/table_name.go +++ b/internal/sql/ast/table_name.go @@ -1,16 +1,20 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type TableName struct { - Catalog string - Schema string - Name string + Tag NodeTag[TableName] `json:"tag"` + + Catalog string `json:"catalog"` + Schema string `json:"schema"` + Name string `json:"name"` } func (n *TableName) Pos() int { return 0 } -func (n *TableName) Format(buf *TrackedBuffer) { +func (n *TableName) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } diff --git a/internal/sql/ast/table_sample_clause.go b/internal/sql/ast/table_sample_clause.go index b92f731430..c8d05779ea 100644 --- a/internal/sql/ast/table_sample_clause.go +++ b/internal/sql/ast/table_sample_clause.go @@ -1,9 +1,11 @@ package ast type TableSampleClause struct { - Tsmhandler Oid - Args *List - Repeatable Node + Tag NodeTag[TableSampleClause] `json:"tag"` + + Tsmhandler Oid `json:"tsmhandler"` + Args *List `json:"args,omitempty"` + Repeatable Node `json:"repeatable,omitempty"` } func (n *TableSampleClause) Pos() int { diff --git a/internal/sql/ast/target_entry.go b/internal/sql/ast/target_entry.go index c9f72184e8..eeb5a33d00 100644 --- a/internal/sql/ast/target_entry.go +++ b/internal/sql/ast/target_entry.go @@ -1,14 +1,16 @@ package ast type TargetEntry struct { - Xpr Node - Expr Node - Resno AttrNumber - Resname *string - Ressortgroupref Index - Resorigtbl Oid - Resorigcol AttrNumber - Resjunk bool + Tag NodeTag[TargetEntry] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Expr Node `json:"expr,omitempty"` + Resno AttrNumber `json:"resno"` + Resname *string `json:"resname,omitempty"` + Ressortgroupref Index `json:"ressortgroupref"` + Resorigtbl Oid `json:"resorigtbl"` + Resorigcol AttrNumber `json:"resorigcol"` + Resjunk bool `json:"resjunk"` } func (n *TargetEntry) Pos() int { diff --git a/internal/sql/ast/todo.go b/internal/sql/ast/todo.go index 88e05e1ccf..c9b9d054f1 100644 --- a/internal/sql/ast/todo.go +++ b/internal/sql/ast/todo.go @@ -1,6 +1,7 @@ package ast type TODO struct { + Tag NodeTag[TODO] `json:"tag"` } func (n *TODO) Pos() int { diff --git a/internal/sql/ast/transaction_stmt.go b/internal/sql/ast/transaction_stmt.go index a6bf4bdf83..60dbe32e0d 100644 --- a/internal/sql/ast/transaction_stmt.go +++ b/internal/sql/ast/transaction_stmt.go @@ -1,9 +1,11 @@ package ast type TransactionStmt struct { - Kind TransactionStmtKind - Options *List - Gid *string + Tag NodeTag[TransactionStmt] `json:"tag"` + + Kind TransactionStmtKind `json:"kind"` + Options *List `json:"options,omitempty"` + Gid *string `json:"gid,omitempty"` } func (n *TransactionStmt) Pos() int { diff --git a/internal/sql/ast/trigger_transition.go b/internal/sql/ast/trigger_transition.go index 376745067a..1d09a9547d 100644 --- a/internal/sql/ast/trigger_transition.go +++ b/internal/sql/ast/trigger_transition.go @@ -1,9 +1,11 @@ package ast type TriggerTransition struct { - Name *string - IsNew bool - IsTable bool + Tag NodeTag[TriggerTransition] `json:"tag"` + + Name *string `json:"name,omitempty"` + IsNew bool `json:"is_new"` + IsTable bool `json:"is_table"` } func (n *TriggerTransition) Pos() int { diff --git a/internal/sql/ast/truncate_stmt.go b/internal/sql/ast/truncate_stmt.go index f23a5bbcb3..9a7a21dee1 100644 --- a/internal/sql/ast/truncate_stmt.go +++ b/internal/sql/ast/truncate_stmt.go @@ -1,19 +1,23 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type TruncateStmt struct { - Relations *List - RestartSeqs bool - Behavior DropBehavior + Tag NodeTag[TruncateStmt] `json:"tag"` + + Relations *List `json:"relations,omitempty"` + RestartSeqs bool `json:"restart_seqs"` + Behavior DropBehavior `json:"behavior"` } func (n *TruncateStmt) Pos() int { return 0 } -func (n *TruncateStmt) Format(buf *TrackedBuffer) { +func (n *TruncateStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } buf.WriteString("TRUNCATE ") - buf.astFormat(n.Relations) + buf.astFormat(n.Relations, d) } diff --git a/internal/sql/ast/type_cast.go b/internal/sql/ast/type_cast.go index 0b549eb4b1..56c8fbb55f 100644 --- a/internal/sql/ast/type_cast.go +++ b/internal/sql/ast/type_cast.go @@ -1,20 +1,29 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type TypeCast struct { - Arg Node - TypeName *TypeName - Location int + Tag NodeTag[TypeCast] `json:"tag"` + + Arg Node `json:"arg,omitempty"` + TypeName *TypeName `json:"type_name,omitempty"` + Location int `json:"location"` } func (n *TypeCast) Pos() int { return n.Location } -func (n *TypeCast) Format(buf *TrackedBuffer) { +func (n *TypeCast) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.astFormat(n.Arg) - buf.WriteString("::") - buf.astFormat(n.TypeName) + // Format the arg and type to strings first + argBuf := NewTrackedBuffer() + argBuf.astFormat(n.Arg, d) + + typeBuf := NewTrackedBuffer() + typeBuf.astFormat(n.TypeName, d) + + buf.WriteString(d.Cast(argBuf.String(), typeBuf.String())) } diff --git a/internal/sql/ast/type_name.go b/internal/sql/ast/type_name.go index e26404b3ba..ddf7decfaa 100644 --- a/internal/sql/ast/type_name.go +++ b/internal/sql/ast/type_name.go @@ -1,37 +1,74 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type TypeName struct { - Catalog string - Schema string - Name string + Tag NodeTag[TypeName] `json:"tag"` + + Catalog string `json:"catalog"` + Schema string `json:"schema"` + Name string `json:"name"` + // Spelling is the type as the author wrote it, when that differs from + // Name: SQLite folds the spaces out of multi-word type names ("VARYING + // CHARACTER" resolves as "VARYINGCHARACTER" in the catalog), so the + // formatter prints this back instead of the folded form. + Spelling string `json:"spelling"` + // Canonical is the type as a call expression the analysis core reads, + // when an engine spells it differently from what the formatter prints + // back: DuckDB's STRUCT(a INTEGER, b VARCHAR) as struct(a: integer, b: + // varchar), ClickHouse's Enum('a', 'b') as Enum8('a' = 1, 'b' = 2). + Canonical string `json:"canonical,omitempty"` // From pg.TypeName - Names *List - TypeOid Oid - Setof bool - PctType bool - Typmods *List - Typemod int32 - ArrayBounds *List - Location int + Names *List `json:"names,omitempty"` + TypeOid Oid `json:"type_oid"` + Setof bool `json:"setof"` + PctType bool `json:"pct_type"` + Typmods *List `json:"typmods,omitempty"` + Typemod int32 `json:"typemod"` + ArrayBounds *List `json:"array_bounds,omitempty"` + Location int `json:"location"` } func (n *TypeName) Pos() int { return n.Location } -func (n *TypeName) Format(buf *TrackedBuffer) { +func (n *TypeName) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } + if n.Spelling != "" { + buf.WriteString(n.Spelling) + goto addMods + } if items(n.Names) { - buf.join(n.Names, ".") - } else { - if n.Name == "int4" { - buf.WriteString("INTEGER") - } else { - buf.WriteString(n.Name) + // Check if this is a qualified type (e.g., pg_catalog.int4) + if len(n.Names.Items) == 2 { + first, _ := n.Names.Items[0].(*String) + second, _ := n.Names.Items[1].(*String) + if first != nil && second != nil { + buf.WriteString(d.TypeName(first.Str, second.Str)) + goto addMods + } } + // For single name types, just output as-is + if len(n.Names.Items) == 1 { + if s, ok := n.Names.Items[0].(*String); ok { + buf.WriteString(d.TypeName("", s.Str)) + goto addMods + } + } + buf.join(n.Names, d, ".") + } else { + buf.WriteString(d.TypeName(n.Schema, n.Name)) + } +addMods: + // Add type modifiers (e.g., varchar(255)) + if items(n.Typmods) { + buf.WriteString("(") + buf.join(n.Typmods, d, ", ") + buf.WriteString(")") } if items(n.ArrayBounds) { buf.WriteString("[]") diff --git a/internal/sql/ast/typedefs.go b/internal/sql/ast/typedefs.go index 351008e841..924fad767b 100644 --- a/internal/sql/ast/typedefs.go +++ b/internal/sql/ast/typedefs.go @@ -1,5 +1,7 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type AclMode uint32 func (n *AclMode) Pos() int { @@ -18,6 +20,15 @@ func (n *NullIfExpr) Pos() int { return 0 } +func (n *NullIfExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("NULLIF(") + buf.join(n.Args, d, ", ") + buf.WriteString(")") +} + type Selectivity float64 func (n *Selectivity) Pos() int { diff --git a/internal/sql/ast/unlisten_stmt.go b/internal/sql/ast/unlisten_stmt.go index ca74e055f8..8c57881ca4 100644 --- a/internal/sql/ast/unlisten_stmt.go +++ b/internal/sql/ast/unlisten_stmt.go @@ -1,7 +1,9 @@ package ast type UnlistenStmt struct { - Conditionname *string + Tag NodeTag[UnlistenStmt] `json:"tag"` + + Conditionname *string `json:"conditionname,omitempty"` } func (n *UnlistenStmt) Pos() int { diff --git a/internal/sql/ast/update_stmt.go b/internal/sql/ast/update_stmt.go index efd496ad75..3c92fb929c 100644 --- a/internal/sql/ast/update_stmt.go +++ b/internal/sql/ast/update_stmt.go @@ -1,37 +1,64 @@ package ast -import "strings" +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/sql/format" +) type UpdateStmt struct { - Relations *List - TargetList *List - WhereClause Node - FromClause *List - LimitCount Node - ReturningList *List - WithClause *WithClause + Tag NodeTag[UpdateStmt] `json:"tag"` + + Relations *List `json:"relations,omitempty"` + TargetList *List `json:"target_list,omitempty"` + WhereClause Node `json:"where_clause,omitempty"` + FromClause *List `json:"from_clause,omitempty"` + LimitCount Node `json:"limit_count,omitempty"` + ReturningList *List `json:"returning_list,omitempty"` + WithClause *WithClause `json:"with_clause,omitempty"` + // PostgreSQL 18 RETURNING WITH (OLD AS ..., NEW AS ...) aliases + ReturningOldAlias string `json:"returning_old_alias"` + ReturningNewAlias string `json:"returning_new_alias"` + // TableRefs is the statement's table-reference tree as the author wrote + // it (MySQL: UPDATE a JOIN b ON ...). Relations flattens that tree to + // bare tables for analysis; printing prefers TableRefs when it is set, + // so a join's ON condition survives formatting. + TableRefs *List `json:"table_refs,omitempty"` } func (n *UpdateStmt) Pos() int { return 0 } -func (n *UpdateStmt) Format(buf *TrackedBuffer) { +func (n *UpdateStmt) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } + buf.Group() + defer buf.EndGroup() + if n.WithClause != nil { - buf.astFormat(n.WithClause) - buf.WriteString(" ") + buf.astFormat(n.WithClause, d) + // The boundary between the WITH clause and the statement's own + // first keyword; the group keeps a break inside the WITH clause + // from forcing the statement body apart clause by clause. + buf.boundary(n.Relations) + buf.Line() + buf.Group() + defer buf.EndGroup() } buf.WriteString("UPDATE ") - if items(n.Relations) { - buf.astFormat(n.Relations) + if items(n.TableRefs) { + buf.astFormat(n.TableRefs, d) + } else if items(n.Relations) { + buf.astFormat(n.Relations, d) } if items(n.TargetList) { - buf.WriteString(" SET ") + buf.beforeClause(n.TargetList, d) + buf.Line() + buf.WriteString("SET ") multi := false for _, item := range n.TargetList.Items { @@ -69,44 +96,69 @@ func (n *UpdateStmt) Format(buf *TrackedBuffer) { buf.WriteString("(") buf.WriteString(strings.Join(names, ",")) buf.WriteString(") = (") - buf.join(vals, ",") + buf.join(vals, d, ",") buf.WriteString(")") } else { + buf.Group() + buf.Indent() for i, item := range n.TargetList.Items { if i > 0 { - buf.WriteString(", ") + buf.WriteString(",") + buf.boundary(item) + buf.Line() } switch nn := item.(type) { case *ResTarget: + if nn.Relation != nil { + buf.WriteString(d.QuoteIdent(*nn.Relation)) + buf.WriteString(".") + } if nn.Name != nil { - buf.WriteString(*nn.Name) + buf.WriteString(d.QuoteIdent(*nn.Name)) + } + // Handle array subscript indirection (e.g., names[$1]) + if items(nn.Indirection) { + for _, ind := range nn.Indirection.Items { + buf.astFormat(ind, d) + } } buf.WriteString(" = ") - buf.astFormat(nn.Val) + buf.astFormat(nn.Val, d) default: - buf.astFormat(item) + buf.astFormat(item, d) } } + buf.EndIndent() + buf.EndGroup() } } if items(n.FromClause) { - buf.WriteString(" FROM ") - buf.astFormat(n.FromClause) + buf.beforeClause(n.FromClause, d) + buf.Line() + buf.WriteString("FROM ") + buf.astFormat(n.FromClause, d) } if set(n.WhereClause) { - buf.WriteString(" WHERE ") - buf.astFormat(n.WhereClause) + buf.beforeClause(n.WhereClause, d) + buf.Line() + buf.WriteString("WHERE ") + buf.condition(n.WhereClause, d) } if set(n.LimitCount) { - buf.WriteString(" LIMIT ") - buf.astFormat(n.LimitCount) + buf.beforeClause(n.LimitCount, d) + buf.Line() + buf.WriteString("LIMIT ") + buf.astFormat(n.LimitCount, d) } if items(n.ReturningList) { - buf.WriteString(" RETURNING ") - buf.astFormat(n.ReturningList) + buf.beforeClause(n.ReturningList, d) + buf.Line() + buf.WriteString("RETURNING ") + formatReturningOptions(buf, d, n.ReturningOldAlias, n.ReturningNewAlias) + buf.astFormat(n.ReturningList, d) } } diff --git a/internal/sql/ast/vacuum_stmt.go b/internal/sql/ast/vacuum_stmt.go index 942fb762b2..c04ebc6662 100644 --- a/internal/sql/ast/vacuum_stmt.go +++ b/internal/sql/ast/vacuum_stmt.go @@ -1,9 +1,11 @@ package ast type VacuumStmt struct { - Options int - Relation *RangeVar - VaCols *List + Tag NodeTag[VacuumStmt] `json:"tag"` + + Options int `json:"options"` + Relation *RangeVar `json:"relation,omitempty"` + VaCols *List `json:"va_cols,omitempty"` } func (n *VacuumStmt) Pos() int { diff --git a/internal/sql/ast/var.go b/internal/sql/ast/var.go index 0d558180cb..97d707f999 100644 --- a/internal/sql/ast/var.go +++ b/internal/sql/ast/var.go @@ -1,16 +1,18 @@ package ast type Var struct { - Xpr Node - Varno Index - Varattno AttrNumber - Vartype Oid - Vartypmod int32 - Varcollid Oid - Varlevelsup Index - Varnoold Index - Varoattno AttrNumber - Location int + Tag NodeTag[Var] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Varno Index `json:"varno"` + Varattno AttrNumber `json:"varattno"` + Vartype Oid `json:"vartype"` + Vartypmod int32 `json:"vartypmod"` + Varcollid Oid `json:"varcollid"` + Varlevelsup Index `json:"varlevelsup"` + Varnoold Index `json:"varnoold"` + Varoattno AttrNumber `json:"varoattno"` + Location int `json:"location"` } func (n *Var) Pos() int { diff --git a/internal/sql/ast/variable_expr.go b/internal/sql/ast/variable_expr.go new file mode 100644 index 0000000000..84026a1103 --- /dev/null +++ b/internal/sql/ast/variable_expr.go @@ -0,0 +1,24 @@ +package ast + +import "github.com/sqlc-dev/sqlc/internal/sql/format" + +// VariableExpr represents a MySQL user variable (e.g., @user_id) +// This is distinct from sqlc's @param named parameter syntax. +type VariableExpr struct { + Tag NodeTag[VariableExpr] `json:"tag"` + + Name string `json:"name"` + Location int `json:"location"` +} + +func (n *VariableExpr) Pos() int { + return n.Location +} + +func (n *VariableExpr) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + buf.WriteString("@") + buf.WriteString(n.Name) +} diff --git a/internal/sql/ast/variable_set_stmt.go b/internal/sql/ast/variable_set_stmt.go index 9307152293..74cf712b7f 100644 --- a/internal/sql/ast/variable_set_stmt.go +++ b/internal/sql/ast/variable_set_stmt.go @@ -1,10 +1,12 @@ package ast type VariableSetStmt struct { - Kind VariableSetKind - Name *string - Args *List - IsLocal bool + Tag NodeTag[VariableSetStmt] `json:"tag"` + + Kind VariableSetKind `json:"kind"` + Name *string `json:"name,omitempty"` + Args *List `json:"args,omitempty"` + IsLocal bool `json:"is_local"` } func (n *VariableSetStmt) Pos() int { diff --git a/internal/sql/ast/variable_show_stmt.go b/internal/sql/ast/variable_show_stmt.go index c1dc7e95ef..e697115229 100644 --- a/internal/sql/ast/variable_show_stmt.go +++ b/internal/sql/ast/variable_show_stmt.go @@ -1,7 +1,9 @@ package ast type VariableShowStmt struct { - Name *string + Tag NodeTag[VariableShowStmt] `json:"tag"` + + Name *string `json:"name,omitempty"` } func (n *VariableShowStmt) Pos() int { diff --git a/internal/sql/ast/view_stmt.go b/internal/sql/ast/view_stmt.go index be93733f72..ec99b66730 100644 --- a/internal/sql/ast/view_stmt.go +++ b/internal/sql/ast/view_stmt.go @@ -1,12 +1,14 @@ package ast type ViewStmt struct { - View *RangeVar - Aliases *List - Query Node - Replace bool - Options *List - WithCheckOption ViewCheckOption + Tag NodeTag[ViewStmt] `json:"tag"` + + View *RangeVar `json:"view,omitempty"` + Aliases *List `json:"aliases,omitempty"` + Query Node `json:"query,omitempty"` + Replace bool `json:"replace"` + Options *List `json:"options,omitempty"` + WithCheckOption ViewCheckOption `json:"with_check_option"` } func (n *ViewStmt) Pos() int { diff --git a/internal/sql/ast/window_clause.go b/internal/sql/ast/window_clause.go index 0a2f082f01..6f5a826c51 100644 --- a/internal/sql/ast/window_clause.go +++ b/internal/sql/ast/window_clause.go @@ -1,15 +1,17 @@ package ast type WindowClause struct { - Name *string - Refname *string - PartitionClause *List - OrderClause *List - FrameOptions int - StartOffset Node - EndOffset Node - Winref Index - CopiedOrder bool + Tag NodeTag[WindowClause] `json:"tag"` + + Name *string `json:"name,omitempty"` + Refname *string `json:"refname,omitempty"` + PartitionClause *List `json:"partition_clause,omitempty"` + OrderClause *List `json:"order_clause,omitempty"` + FrameOptions int `json:"frame_options"` + StartOffset Node `json:"start_offset,omitempty"` + EndOffset Node `json:"end_offset,omitempty"` + Winref Index `json:"winref"` + CopiedOrder bool `json:"copied_order"` } func (n *WindowClause) Pos() int { diff --git a/internal/sql/ast/window_def.go b/internal/sql/ast/window_def.go index 29840767c9..7a04800353 100644 --- a/internal/sql/ast/window_def.go +++ b/internal/sql/ast/window_def.go @@ -1,16 +1,116 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type WindowDef struct { - Name *string - Refname *string - PartitionClause *List - OrderClause *List - FrameOptions int - StartOffset Node - EndOffset Node - Location int + Tag NodeTag[WindowDef] `json:"tag"` + + Name *string `json:"name,omitempty"` + Refname *string `json:"refname,omitempty"` + PartitionClause *List `json:"partition_clause,omitempty"` + OrderClause *List `json:"order_clause,omitempty"` + FrameOptions int `json:"frame_options"` + StartOffset Node `json:"start_offset,omitempty"` + EndOffset Node `json:"end_offset,omitempty"` + Location int `json:"location"` } func (n *WindowDef) Pos() int { return n.Location } + +// Frame option constants (from PostgreSQL's parsenodes.h) +const ( + FrameOptionNonDefault = 0x00001 + FrameOptionRange = 0x00002 + FrameOptionRows = 0x00004 + FrameOptionGroups = 0x00008 + FrameOptionBetween = 0x00010 + FrameOptionStartUnboundedPreceding = 0x00020 + FrameOptionEndUnboundedPreceding = 0x00040 + FrameOptionStartUnboundedFollowing = 0x00080 + FrameOptionEndUnboundedFollowing = 0x00100 + FrameOptionStartCurrentRow = 0x00200 + FrameOptionEndCurrentRow = 0x00400 + FrameOptionStartOffset = 0x00800 + FrameOptionEndOffset = 0x01000 + FrameOptionExcludeCurrentRow = 0x02000 + FrameOptionExcludeGroup = 0x04000 + FrameOptionExcludeTies = 0x08000 +) + +func (n *WindowDef) Format(buf *TrackedBuffer, d format.Dialect) { + if n == nil { + return + } + + // Named window reference + if n.Refname != nil && *n.Refname != "" { + buf.WriteString(*n.Refname) + return + } + + buf.WriteString("(") + needSpace := false + + if items(n.PartitionClause) { + buf.WriteString("PARTITION BY ") + buf.join(n.PartitionClause, d, ", ") + needSpace = true + } + + if items(n.OrderClause) { + if needSpace { + buf.WriteString(" ") + } + buf.WriteString("ORDER BY ") + buf.join(n.OrderClause, d, ", ") + needSpace = true + } + + // Frame clause + if n.FrameOptions&FrameOptionNonDefault != 0 { + if needSpace { + buf.WriteString(" ") + } + + // Frame type + if n.FrameOptions&FrameOptionRows != 0 { + buf.WriteString("ROWS ") + } else if n.FrameOptions&FrameOptionRange != 0 { + buf.WriteString("RANGE ") + } else if n.FrameOptions&FrameOptionGroups != 0 { + buf.WriteString("GROUPS ") + } + + if n.FrameOptions&FrameOptionBetween != 0 { + buf.WriteString("BETWEEN ") + } + + // Start bound + if n.FrameOptions&FrameOptionStartUnboundedPreceding != 0 { + buf.WriteString("UNBOUNDED PRECEDING") + } else if n.FrameOptions&FrameOptionStartCurrentRow != 0 { + buf.WriteString("CURRENT ROW") + } else if n.FrameOptions&FrameOptionStartOffset != 0 { + buf.astFormat(n.StartOffset, d) + buf.WriteString(" PRECEDING") + } + + if n.FrameOptions&FrameOptionBetween != 0 { + buf.WriteString(" AND ") + + // End bound + if n.FrameOptions&FrameOptionEndUnboundedFollowing != 0 { + buf.WriteString("UNBOUNDED FOLLOWING") + } else if n.FrameOptions&FrameOptionEndCurrentRow != 0 { + buf.WriteString("CURRENT ROW") + } else if n.FrameOptions&FrameOptionEndOffset != 0 { + buf.astFormat(n.EndOffset, d) + buf.WriteString(" FOLLOWING") + } + } + } + + buf.WriteString(")") +} diff --git a/internal/sql/ast/window_func.go b/internal/sql/ast/window_func.go index eb0ba5c968..4202b48f79 100644 --- a/internal/sql/ast/window_func.go +++ b/internal/sql/ast/window_func.go @@ -1,17 +1,19 @@ package ast type WindowFunc struct { - Xpr Node - Winfnoid Oid - Wintype Oid - Wincollid Oid - Inputcollid Oid - Args *List - Aggfilter Node - Winref Index - Winstar bool - Winagg bool - Location int + Tag NodeTag[WindowFunc] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Winfnoid Oid `json:"winfnoid"` + Wintype Oid `json:"wintype"` + Wincollid Oid `json:"wincollid"` + Inputcollid Oid `json:"inputcollid"` + Args *List `json:"args,omitempty"` + Aggfilter Node `json:"aggfilter,omitempty"` + Winref Index `json:"winref"` + Winstar bool `json:"winstar"` + Winagg bool `json:"winagg"` + Location int `json:"location"` } func (n *WindowFunc) Pos() int { diff --git a/internal/sql/ast/with_check_option.go b/internal/sql/ast/with_check_option.go index b622db4753..416c92d0e7 100644 --- a/internal/sql/ast/with_check_option.go +++ b/internal/sql/ast/with_check_option.go @@ -1,11 +1,13 @@ package ast type WithCheckOption struct { - Kind WCOKind - Relname *string - Polname *string - Qual Node - Cascaded bool + Tag NodeTag[WithCheckOption] `json:"tag"` + + Kind WCOKind `json:"kind"` + Relname *string `json:"relname,omitempty"` + Polname *string `json:"polname,omitempty"` + Qual Node `json:"qual,omitempty"` + Cascaded bool `json:"cascaded"` } func (n *WithCheckOption) Pos() int { diff --git a/internal/sql/ast/with_clause.go b/internal/sql/ast/with_clause.go index 634326fa7e..0124661b59 100644 --- a/internal/sql/ast/with_clause.go +++ b/internal/sql/ast/with_clause.go @@ -1,22 +1,26 @@ package ast +import "github.com/sqlc-dev/sqlc/internal/sql/format" + type WithClause struct { - Ctes *List - Recursive bool - Location int + Tag NodeTag[WithClause] `json:"tag"` + + Ctes *List `json:"ctes,omitempty"` + Recursive bool `json:"recursive"` + Location int `json:"location"` } func (n *WithClause) Pos() int { return n.Location } -func (n *WithClause) Format(buf *TrackedBuffer) { +func (n *WithClause) Format(buf *TrackedBuffer, d format.Dialect) { if n == nil { return } - buf.WriteString("WITH") + buf.WriteString("WITH ") if n.Recursive { - buf.WriteString(" RECURSIVE") + buf.WriteString("RECURSIVE ") } - buf.astFormat(n.Ctes) + buf.joinComma(n.Ctes, d) } diff --git a/internal/sql/ast/xml_expr.go b/internal/sql/ast/xml_expr.go index cbd82b3653..42497118a9 100644 --- a/internal/sql/ast/xml_expr.go +++ b/internal/sql/ast/xml_expr.go @@ -1,16 +1,18 @@ package ast type XmlExpr struct { - Xpr Node - Op XmlExprOp - Name *string - NamedArgs *List - ArgNames *List - Args *List - Xmloption XmlOptionType - Type Oid - Typmod int32 - Location int + Tag NodeTag[XmlExpr] `json:"tag"` + + Xpr Node `json:"xpr,omitempty"` + Op XmlExprOp `json:"op"` + Name *string `json:"name,omitempty"` + NamedArgs *List `json:"named_args,omitempty"` + ArgNames *List `json:"arg_names,omitempty"` + Args *List `json:"args,omitempty"` + Xmloption XmlOptionType `json:"xmloption"` + Type Oid `json:"type"` + Typmod int32 `json:"typmod"` + Location int `json:"location"` } func (n *XmlExpr) Pos() int { diff --git a/internal/sql/ast/xml_serialize.go b/internal/sql/ast/xml_serialize.go index 32e4cc476d..e514db5480 100644 --- a/internal/sql/ast/xml_serialize.go +++ b/internal/sql/ast/xml_serialize.go @@ -1,10 +1,12 @@ package ast type XmlSerialize struct { - Xmloption XmlOptionType - Expr Node - TypeName *TypeName - Location int + Tag NodeTag[XmlSerialize] `json:"tag"` + + Xmloption XmlOptionType `json:"xmloption"` + Expr Node `json:"expr,omitempty"` + TypeName *TypeName `json:"type_name,omitempty"` + Location int `json:"location"` } func (n *XmlSerialize) Pos() int { diff --git a/internal/sql/astutils/CLAUDE.md b/internal/sql/astutils/CLAUDE.md new file mode 100644 index 0000000000..7575ea9a12 --- /dev/null +++ b/internal/sql/astutils/CLAUDE.md @@ -0,0 +1,122 @@ +# AST Utilities Package - Claude Code Guide + +This package provides utilities for traversing and transforming AST nodes. + +## Key Functions + +### Walk +`Walk(f Visitor, node ast.Node)` traverses the AST depth-first, calling `f.Visit()` on each node. + +```go +type Visitor interface { + Visit(node ast.Node) Visitor +} +``` + +**Important**: When adding new AST node types, you MUST add a case to the switch statement in `walk.go`, otherwise you'll get a panic: +``` +panic: walk: unexpected node type *ast.YourNewType +``` + +### Apply (Rewrite) +`Apply(root ast.Node, pre, post ApplyFunc) ast.Node` traverses and optionally transforms the AST. + +```go +type ApplyFunc func(*Cursor) bool +``` + +The `Cursor` provides: +- `Node()` - current node +- `Parent()` - parent node +- `Name()` - field name in parent +- `Index()` - index if in a list +- `Replace(node)` - replace current node + +**Important**: When adding new AST node types, you MUST add a case to the switch statement in `rewrite.go`, otherwise you'll get a panic: +``` +panic: Apply: unexpected node type *ast.YourNewType +``` + +### Search +`Search(root ast.Node, fn func(ast.Node) bool) *ast.List` finds all nodes matching a predicate. + +### Join +`Join(list *ast.List, sep string) string` joins string nodes with a separator. + +## Adding Support for New AST Nodes + +When you create a new AST node type, you must update BOTH `walk.go` and `rewrite.go`: + +### In walk.go +Add a case that walks all child nodes: +```go +case *ast.YourNewType: + if n.ChildField != nil { + Walk(f, n.ChildField) + } + if n.ChildList != nil { + Walk(f, n.ChildList) + } +``` + +For leaf nodes with no children: +```go +case *ast.YourNewType: + // Leaf node - no children to traverse +``` + +### In rewrite.go +Add a case that applies to all child nodes: +```go +case *ast.YourNewType: + a.apply(n, "ChildField", nil, n.ChildField) + a.apply(n, "ChildList", nil, n.ChildList) +``` + +For leaf nodes: +```go +case *ast.YourNewType: + // Leaf node - no children to traverse +``` + +## Common Patterns + +### Finding All Tables in a Statement +```go +var tv tableVisitor +astutils.Walk(&tv, stmt.FromClause) +// tv.list now contains all RangeVar nodes +``` + +### Rewriting Nodes In Place +Apply replaces a node with a new one as the tree is walked: +```go +astutils.Apply(root, func(cr *astutils.Cursor) bool { + if _, ok := cr.Node().(*ast.SomeType); ok { + cr.Replace(&ast.OtherType{}) + } + return true +}, nil) +``` + +Note that sqlc syntax (`sqlc.arg()`, `@name`) is *not* handled here. It is +rewritten to native SQL by `internal/sql/preprocess` before the engine parses a +query, so a node type missing from walk.go/rewrite.go can no longer silently +drop a parameter. + +## Node Types That Must Be Handled + +All node types in `internal/sql/ast/` must have cases in both walk.go and rewrite.go. Key MySQL-specific nodes: +- `IntervalExpr` - INTERVAL expressions +- `OnDuplicateKeyUpdate` - MySQL ON DUPLICATE KEY UPDATE +- `ParenExpr` - Parenthesized expressions +- `VariableExpr` - MySQL user variables (@var) + +## Debugging Tips + +If you see a panic like: +``` +panic: walk: unexpected node type *ast.SomeType +``` + +Check that `SomeType` has a case in both `walk.go` and `rewrite.go`. diff --git a/internal/sql/astutils/rewrite.go b/internal/sql/astutils/rewrite.go index 93c5be3cfb..25b274a16c 100644 --- a/internal/sql/astutils/rewrite.go +++ b/internal/sql/astutils/rewrite.go @@ -120,7 +120,7 @@ type application struct { func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.Node) { // convert typed nil into untyped nil - if v := reflect.ValueOf(n); v.Kind() == reflect.Ptr && v.IsNil() { + if v := reflect.ValueOf(n); v.Kind() == reflect.Pointer && v.IsNil() { n = nil } @@ -687,6 +687,8 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "WhereClause", nil, n.WhereClause) a.apply(n, "ReturningList", nil, n.ReturningList) a.apply(n, "WithClause", nil, n.WithClause) + a.apply(n, "Targets", nil, n.Targets) + a.apply(n, "FromClause", nil, n.FromClause) case *ast.DiscardStmt: // pass @@ -812,12 +814,16 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "Cols", nil, n.Cols) a.apply(n, "SelectStmt", nil, n.SelectStmt) a.apply(n, "OnConflictClause", nil, n.OnConflictClause) + a.apply(n, "OnDuplicateKeyUpdate", nil, n.OnDuplicateKeyUpdate) a.apply(n, "ReturningList", nil, n.ReturningList) a.apply(n, "WithClause", nil, n.WithClause) case *ast.Integer: // pass + case *ast.IntervalExpr: + a.apply(n, "Value", nil, n.Value) + case *ast.IntoClause: a.apply(n, "Rel", nil, n.Rel) a.apply(n, "ColNames", nil, n.ColNames) @@ -883,6 +889,9 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "OnConflictWhere", nil, n.OnConflictWhere) a.apply(n, "ExclRelTlist", nil, n.ExclRelTlist) + case *ast.OnDuplicateKeyUpdate: + a.apply(n, "TargetList", nil, n.TargetList) + case *ast.OpExpr: a.apply(n, "Xpr", nil, n.Xpr) a.apply(n, "Args", nil, n.Args) @@ -902,6 +911,12 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. case *ast.ParamRef: // pass + case *ast.ParenExpr: + a.apply(n, "Expr", nil, n.Expr) + + case *ast.VariableExpr: + // Leaf node - no children to traverse + case *ast.PartitionBoundSpec: a.apply(n, "Listdatums", nil, n.Listdatums) a.apply(n, "Lowerdatums", nil, n.Lowerdatums) diff --git a/internal/sql/astutils/walk.go b/internal/sql/astutils/walk.go index 0943379f03..6d5e80bdc3 100644 --- a/internal/sql/astutils/walk.go +++ b/internal/sql/astutils/walk.go @@ -1077,6 +1077,12 @@ func Walk(f Visitor, node ast.Node) { if n.WithClause != nil { Walk(f, n.WithClause) } + if n.Targets != nil { + Walk(f, n.Targets) + } + if n.FromClause != nil { + Walk(f, n.FromClause) + } case *ast.DiscardStmt: // pass @@ -1312,6 +1318,9 @@ func Walk(f Visitor, node ast.Node) { if n.OnConflictClause != nil { Walk(f, n.OnConflictClause) } + if n.OnDuplicateKeyUpdate != nil { + Walk(f, n.OnDuplicateKeyUpdate) + } if n.ReturningList != nil { Walk(f, n.ReturningList) } @@ -1336,6 +1345,11 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.ViewQuery) } + case *ast.IntervalExpr: + if n.Value != nil { + Walk(f, n.Value) + } + case *ast.JoinExpr: if n.Larg != nil { Walk(f, n.Larg) @@ -1445,6 +1459,11 @@ func Walk(f Visitor, node ast.Node) { Walk(f, n.ExclRelTlist) } + case *ast.OnDuplicateKeyUpdate: + if n.TargetList != nil { + Walk(f, n.TargetList) + } + case *ast.OpExpr: if n.Xpr != nil { Walk(f, n.Xpr) @@ -1470,6 +1489,14 @@ func Walk(f Visitor, node ast.Node) { case *ast.ParamRef: // pass + case *ast.ParenExpr: + if n.Expr != nil { + Walk(f, n.Expr) + } + + case *ast.VariableExpr: + // Leaf node - no children to traverse + case *ast.PartitionBoundSpec: if n.Listdatums != nil { Walk(f, n.Listdatums) diff --git a/internal/sql/catalog/extension.go b/internal/sql/catalog/extension.go index fdb717f2d2..268bf01927 100644 --- a/internal/sql/catalog/extension.go +++ b/internal/sql/catalog/extension.go @@ -9,16 +9,28 @@ func (c *Catalog) createExtension(stmt *ast.CreateExtensionStmt) error { return nil } // TODO: Implement IF NOT EXISTS - if _, exists := c.Extensions[*stmt.Extname]; exists { + return c.loadExtension(*stmt.Extname) +} + +// loadExtension adds what the engine knows of the named extension — or of +// the virtual table module that stands for one — to the default schema, +// once. An engine without extension data, or without data for this one, +// adds nothing. +func (c *Catalog) loadExtension(name string) error { + if _, exists := c.Extensions[name]; exists { return nil } if c.LoadExtension == nil { return nil } - ext := c.LoadExtension(*stmt.Extname) + ext := c.LoadExtension(name) if ext == nil { return nil } + if c.Extensions == nil { + c.Extensions = map[string]struct{}{} + } + c.Extensions[name] = struct{}{} s, err := c.getSchema(c.DefaultSchema) if err != nil { return err diff --git a/internal/sql/catalog/func.go b/internal/sql/catalog/func.go index 7cc712492d..e170777311 100644 --- a/internal/sql/catalog/func.go +++ b/internal/sql/catalog/func.go @@ -39,6 +39,17 @@ func (f *Function) InArgs() []*Argument { return args } +func (f *Function) OutArgs() []*Argument { + var args []*Argument + for _, a := range f.Args { + switch a.Mode { + case ast.FuncParamOut: + args = append(args, a) + } + } + return args +} + func (c *Catalog) createFunction(stmt *ast.CreateFunctionStmt) error { ns := stmt.Func.Schema if ns == "" { diff --git a/internal/sql/catalog/table.go b/internal/sql/catalog/table.go index bfa2da027e..1cf114721c 100644 --- a/internal/sql/catalog/table.go +++ b/internal/sql/catalog/table.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" + "github.com/sqlc-dev/sqlc/internal/core" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) @@ -129,6 +130,11 @@ type Column struct { Comment string Length *int + // TypeExpr is the type as the analysis core wrote it, with the + // arguments and nesting Type and IsArray flatten away. It is unset + // on the legacy path. + TypeExpr *core.TypeExpr + linkedType bool } @@ -248,6 +254,13 @@ func (c *Catalog) alterTableSetSchema(stmt *ast.AlterTableSetSchemaStmt) error { } func (c *Catalog) createTable(stmt *ast.CreateTableStmt) error { + // A virtual table's module is the engine's word for the extension it + // needs, the way CREATE EXTENSION is PostgreSQL's. + if stmt.Using != "" { + if err := c.loadExtension(stmt.Using); err != nil { + return err + } + } ns := stmt.Name.Schema if ns == "" { ns = c.DefaultSchema @@ -289,10 +302,6 @@ func (c *Catalog) createTable(stmt *ast.CreateTableStmt) error { } } - if stmt.ReferTable != nil && len(stmt.Cols) != 0 { - return errors.New("create table node cannot have both a ReferTable and Cols") - } - if stmt.ReferTable != nil { _, original, err := c.getTable(stmt.ReferTable) if err != nil { @@ -302,23 +311,28 @@ func (c *Catalog) createTable(stmt *ast.CreateTableStmt) error { newCol := *col // make a copy, so changes to the ReferTable don't propagate tbl.Columns = append(tbl.Columns, &newCol) } - } else { - for _, col := range stmt.Cols { - if notNull, ok := seen[col.Colname]; ok { - seen[col.Colname] = notNull || col.IsNotNull - if a, ok := coltype[col.Colname]; ok { - if !sameType(&a, col.TypeName) { - return fmt.Errorf("column %q has a type conflict", col.Colname) - } + } + + for _, col := range stmt.Cols { + // The legacy catalog has no notion of a hidden column, so it drops + // them rather than list them on the table. + if col.IsHidden { + continue + } + if notNull, ok := seen[col.Colname]; ok { + seen[col.Colname] = notNull || col.IsNotNull + if a, ok := coltype[col.Colname]; ok { + if !sameType(&a, col.TypeName) { + return fmt.Errorf("column %q has a type conflict", col.Colname) } - continue - } - tc, err := c.defineColumn(stmt.Name, col) - if err != nil { - return err } - tbl.Columns = append(tbl.Columns, tc) + continue + } + tc, err := c.defineColumn(stmt.Name, col) + if err != nil { + return err } + tbl.Columns = append(tbl.Columns, tc) } // If one of the merged columns was not null, mark the column as not null diff --git a/internal/sql/format/format.go b/internal/sql/format/format.go new file mode 100644 index 0000000000..b61b9cf5e7 --- /dev/null +++ b/internal/sql/format/format.go @@ -0,0 +1,23 @@ +package format + +// Dialect provides SQL dialect-specific formatting behavior +type Dialect interface { + // QuoteIdent returns a quoted identifier if it needs quoting + // (e.g., reserved words, mixed case identifiers) + QuoteIdent(s string) string + + // TypeName returns the SQL type name for the given namespace and name. + // This handles dialect-specific type name mappings (e.g., pg_catalog.int4 -> integer) + TypeName(ns, name string) string + + // Param returns the placeholder for the parameter with this number. + // numbered reports that the author wrote the number out (SQLite's ?2, + // where a bare ? takes the next index), so engines with both forms can + // keep the one that was written. + // PostgreSQL uses $1, $2, etc. MySQL uses ? + Param(n int, numbered bool) string + + // Cast formats a type cast expression. + // PostgreSQL uses expr::type, MySQL uses CAST(expr AS type) + Cast(arg, typeName string) string +} diff --git a/internal/sql/lang/operator.go b/internal/sql/lang/operator.go index cd5ef50e38..c1ece1d290 100644 --- a/internal/sql/lang/operator.go +++ b/internal/sql/lang/operator.go @@ -9,8 +9,28 @@ func IsComparisonOperator(s string) bool { case "<=": case ">=": case "=": + case "==": case "<>": case "!=": + // Comparisons an engine spells as a keyword rather than as punctuation. + // They are written upper case, which is how SQLite's parser records + // them; PostgreSQL and MySQL use distinct node types or their own + // operator names for these, so the spellings do not overlap. + case "IS": + case "IS NOT": + case "IS DISTINCT FROM": + case "IS NOT DISTINCT FROM": + case "ISNULL": + case "NOTNULL": + case "NOT NULL": + case "LIKE": + case "NOT LIKE": + case "GLOB": + case "NOT GLOB": + case "REGEXP": + case "NOT REGEXP": + case "MATCH": + case "NOT MATCH": default: return false } diff --git a/internal/sql/named/CLAUDE.md b/internal/sql/named/CLAUDE.md new file mode 100644 index 0000000000..b1f1cae22e --- /dev/null +++ b/internal/sql/named/CLAUDE.md @@ -0,0 +1,58 @@ +# Named Parameters Package - Claude Code Guide + +This package models a query's parameters: their names, their nullability and +whether they came from `sqlc.slice()`. + +It no longer knows anything about sqlc's *syntax*. `sqlc.arg()`, `sqlc.narg()`, +`sqlc.slice()` and `@name` are rewritten to native placeholders by +`internal/sql/preprocess` before any engine parser runs, and that package builds +the `ParamSet` while it rewrites. + +## Param + +A `Param` carries the user-facing name plus a nullability that combines what was +inferred from the schema with what the user asked for: + +- `NewParam(name)` — unspecified nullability, from `sqlc.arg()` or `@name` +- `NewUserNullableParam(name)` — from `sqlc.narg()`, always nullable +- `NewSqlcSlice(name)` — from `sqlc.slice()` +- `NewInferredParam(name, notNull)` — what the compiler inferred + +A user-specified nullability outranks an inferred one. `mergeParam` ORs the +nullability bits together, so the order the two sources arrive in does not +matter. + +## ParamSet + +`ParamSet` maps placeholder numbers to `Param` values for a single statement. + +```go +ps := named.NewParamSet(numbersAlreadyUsed, hasNamedSupport) +n := ps.Add(named.NewParam("author_id")) // returns the placeholder number +``` + +`hasNamedSupport` is false for dialects that send one argument per `?` +(MySQL, ClickHouse). There, every occurrence of a name gets its own number. For +`$1`/`?1`/`@name` dialects repeated uses of a name share a number. + +The compiler reads the set back with: + +- `NameFor(number)` — the user-facing name for a placeholder +- `FetchMerge(number, inferred)` — the merged param and whether it was named + +## MySQL @variable vs sqlc @param + +`@name` is only sqlc syntax where the preprocessor's dialect says it is. MySQL +sets `AtSign: false`, so `@user_id` there is a user variable and reaches the +parser untouched (converted to `ast.VariableExpr`). PostgreSQL, SQLite and +GoogleSQL treat `@name` as a named parameter. + +```sql +-- PostgreSQL with sqlc @param syntax: +SELECT * FROM users WHERE id = @user_id +-- Preprocessed to: SELECT * FROM users WHERE id = $1 + +-- MySQL with user variable: +SELECT * FROM users WHERE id != @user_id +-- Stays: SELECT * FROM users WHERE id != @user_id +``` diff --git a/internal/sql/named/is.go b/internal/sql/named/is.go deleted file mode 100644 index d53c1d9905..0000000000 --- a/internal/sql/named/is.go +++ /dev/null @@ -1,26 +0,0 @@ -package named - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/astutils" -) - -// IsParamFunc fulfills the astutils.Search -func IsParamFunc(node ast.Node) bool { - call, ok := node.(*ast.FuncCall) - if !ok { - return false - } - - if call.Func == nil { - return false - } - - isValid := call.Func.Schema == "sqlc" && (call.Func.Name == "arg" || call.Func.Name == "narg" || call.Func.Name == "slice") - return isValid -} - -func IsParamSign(node ast.Node) bool { - expr, ok := node.(*ast.A_Expr) - return ok && astutils.Join(expr.Name, ".") == "@" -} diff --git a/internal/sql/preprocess/CLAUDE.md b/internal/sql/preprocess/CLAUDE.md new file mode 100644 index 0000000000..a7f4d9aafe --- /dev/null +++ b/internal/sql/preprocess/CLAUDE.md @@ -0,0 +1,114 @@ +# SQL Preprocess Package - Claude Code Guide + +This package rewrites sqlc's query syntax into native SQL **before** any engine +parser sees a query. After it runs, no sqlc syntax remains in the text, so +parsers, converters and `astutils` traversals only ever deal with SQL. + +## What it rewrites + +| syntax | becomes | +| --- | --- | +| `sqlc.arg(name)` / `sqlc.narg(name)` | the dialect's native placeholder | +| `sqlc.slice(name)` | the placeholder wrapped in `/*SLICE:name*/` | +| `sqlc.embed(table)` | `table.*` | +| `@name` | the native placeholder, on dialects where `@` is sqlc syntax | + +Native placeholders by dialect: + +| engine | placeholder | `@name` | +| --- | --- | --- | +| postgresql | `$1` | sqlc syntax | +| mysql | `?` | user variable, left alone | +| sqlite | `?1` | sqlc syntax | + +GoogleSQL and ClickHouse are deliberately absent. They handle their own +parameter syntax, so `File` returns their source unchanged and sqlc syntax is +not available to them — `sqlc.arg()` reaches the parser as the function call it +looks like. + +## How it works + +`lexer` is a dialect-parameterized scanner. It does not parse SQL — it knows +only enough to skip the regions where sqlc syntax must not be rewritten: +comments (`--`, `/* */`, `#`), string literals, quoted identifiers, backticks +and PostgreSQL dollar-quoted strings. `Dialect` (dialect.go) is the single +place those lexical rules live. + +`File(engine, src)` looks up the dialect; an engine with no entry gets its +source back untouched. Otherwise it walks the whole file, splits it at +top-level semicolons and, for each statement: + +1. `scan` collects every sqlc construct **and** every native placeholder, in + source order. +2. `number` assigns placeholder numbers. Numbered dialects keep the numbers the + user wrote and fill in the gaps; `?` dialects renumber everything in source + order, because each `?` is its own argument. +3. The statement is rewritten into the output buffer and a `Statement` records + what changed. + +## The side table + +`Result.Statement(offset)` returns the `Statement` covering an offset in the +**rewritten** text: + +- `Params` — the `named.ParamSet` for the statement +- `Embeds` — each rewritten `table.*`, keyed by its location so the compiler can + tell it apart from a star reference the user wrote +- `Slices` — the location of each `sqlc.slice()` placeholder +- `Numbers` — location → parameter number, used by the compiler to override the + numbers an engine assigned in AST-conversion order +- `Dollar` / `ParamErr` — the placeholder-style validation that used to live in + `validate.ParamRef` +- `Err` — a sqlc syntax error (unknown `sqlc.*` function, wrong arity, an + argument that is not an identifier or string) + +`Result.Origin(offset)` maps an offset in the rewritten text back to the +original source, so errors point at what the user wrote. + +## Invariants + +- **A rewrite never adds a line.** Replacements are single-line, so a line + number taken from the rewritten text is never past the end of the original. It + can *lose* lines, when the sqlc call itself spanned several — map offsets + through `Origin` rather than trusting line numbers. +- **An invalid statement is copied through untouched.** The engine still parses + what the user wrote and the error is reported per statement, not per file. +- **Nothing inside a comment or literal is rewritten.** Query annotations like + `-- name: GetAuthor :one` are comments, so they are always safe. + +## Tests + +`testdata///` holds the input and the expected results: + +| file | contents | +| --- | --- | +| `input.sql` | the query file | +| `output.sql` | the rewritten SQL | +| `side_table.json` | everything the preprocessor recorded | +| `stderr.txt` | reported errors, only when the input is invalid | + +`TestRewrite` runs one subtest per directory. `side_table.json` is rendered by +reading the result back through the same API the compiler uses, so it covers +parameter names and nullability, embed and slice spans, placeholder numbering +and the offset map — a parameter's `location` is its offset in the rewritten +text and its `origin` is where it came from. + +Regenerate every golden with: + +```bash +go test ./internal/sql/preprocess -update +``` + +The cases cover every shape of sqlc syntax that appears in +`internal/endtoend`, per preprocessed engine — each function against a bare +reference, a string constant and a quoted identifier, the placeholder styles, +and the constructs that must be left alone (comments, literals, MySQL user +variables and `$1`, PostgreSQL's `@>` and `?` operators). When you add a shape +to the corpus, add it here too. + +## Adding a dialect + +Add an entry to `dialects` in dialect.go. Nothing else in the codebase needs to +change for `sqlc.arg`/`narg`/`slice`/`embed` to work for a new engine — but only +add one if the engine should support sqlc syntax at all. Leaving an engine out +is a deliberate choice, not an oversight. diff --git a/internal/sql/preprocess/dialect.go b/internal/sql/preprocess/dialect.go new file mode 100644 index 0000000000..4d8d4ae85b --- /dev/null +++ b/internal/sql/preprocess/dialect.go @@ -0,0 +1,114 @@ +package preprocess + +import ( + "github.com/sqlc-dev/sqlc/internal/config" +) + +// Style is the native placeholder syntax a dialect uses for bind parameters. +type Style int + +const ( + // StyleDollar numbers parameters as $1, $2, ... (PostgreSQL) + StyleDollar Style = iota + // StyleQuestion uses an unnumbered ? for every parameter (MySQL) + StyleQuestion + // StyleOrdinal numbers parameters as ?1, ?2, ... (SQLite) + StyleOrdinal +) + +// Dialect describes the lexical rules the preprocessor needs to walk a query +// without parsing it: how the dialect quotes strings and identifiers, how it +// writes comments and which placeholder syntax it accepts. +// +// The preprocessor never interprets SQL. It only needs to know enough to skip +// the regions of a query where sqlc syntax must not be rewritten. +type Dialect struct { + // Style is the native placeholder syntax used for rewritten parameters. + Style Style + + // AtSign reports whether a bare "@name" is sqlc named-parameter syntax. + // It is false for MySQL, where "@name" is a user variable. + AtSign bool + + // DollarQuote reports whether $tag$ ... $tag$ string literals are valid. + DollarQuote bool + + // DollarNumber reports whether $1 is a bind parameter. + DollarNumber bool + + // Question reports whether ? is a bind parameter. + Question bool + + // Backtick reports whether `ident` is a quoted identifier. + Backtick bool + + // HashComment reports whether # starts a line comment. + HashComment bool + + // DoubleQuoteString reports whether "..." is a string literal rather than + // a quoted identifier. MySQL treats it as a string unless ANSI_QUOTES is + // enabled. + DoubleQuoteString bool + + // NestedBlockComment reports whether /* ... /* ... */ ... */ nests. + NestedBlockComment bool + + // Backslash reports whether a backslash escapes the next character inside + // a string literal. + Backslash bool + + // FoldIdentifier reports whether the dialect lowercases unquoted + // identifiers. It decides the case of a parameter named by a bare + // reference, e.g. sqlc.arg(FooBar). + FoldIdentifier bool +} + +var dialects = map[config.Engine]Dialect{ + config.EnginePostgreSQL: { + Style: StyleDollar, + AtSign: true, + DollarQuote: true, + DollarNumber: true, + NestedBlockComment: true, + FoldIdentifier: true, + }, + config.EngineMySQL: { + Style: StyleQuestion, + Question: true, + Backtick: true, + HashComment: true, + DoubleQuoteString: true, + Backslash: true, + FoldIdentifier: true, + }, + config.EngineSQLite: { + Style: StyleOrdinal, + AtSign: true, + Question: true, + Backtick: true, + Backslash: true, + }, + // ClickHouse binds with an unnumbered ?, like MySQL, and its identifiers + // keep their case. + config.EngineClickHouse: { + Style: StyleQuestion, + Question: true, + Backtick: true, + Backslash: true, + }, +} + +// DialectFor returns the lexical rules for an engine, and whether the engine is +// preprocessed at all. GoogleSQL is not: it handles its own parameter syntax, +// so its queries reach the parser unchanged. +func DialectFor(engine config.Engine) (Dialect, bool) { + d, ok := dialects[engine] + return d, ok +} + +// hasNamedSupport reports whether repeated uses of the same parameter name can +// share a single placeholder. MySQL sends an argument per "?", so every +// occurrence needs its own number. +func (d Dialect) hasNamedSupport() bool { + return d.Style != StyleQuestion +} diff --git a/internal/sql/preprocess/lexer.go b/internal/sql/preprocess/lexer.go new file mode 100644 index 0000000000..d17d80b077 --- /dev/null +++ b/internal/sql/preprocess/lexer.go @@ -0,0 +1,284 @@ +package preprocess + +import ( + "strings" +) + +// lexer is a dialect-parameterized scanner over a SQL file. It does not parse +// SQL; it knows just enough about comments, string literals, quoted identifiers +// and dollar-quoted strings to walk a query without ever looking inside a +// region where sqlc syntax must be left alone. +type lexer struct { + d Dialect + src string +} + +func isIdentStart(c byte) bool { + return c == '_' || + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + c >= 0x80 +} + +func isIdentPart(c byte) bool { + return isIdentStart(c) || (c >= '0' && c <= '9') || c == '$' +} + +func isDigit(c byte) bool { + return c >= '0' && c <= '9' +} + +func isSpace(c byte) bool { + return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v' +} + +func (l *lexer) at(i int) byte { + if i < 0 || i >= len(l.src) { + return 0 + } + return l.src[i] +} + +// skip returns the offset just past the comment, string literal, quoted +// identifier or dollar-quoted string that starts at i. It returns -1 when no +// such token starts at i. +func (l *lexer) skip(i int) int { + switch c := l.at(i); c { + case '\'': + return l.skipQuoted(i, '\'', l.d.Backslash || l.isEscapeString(i)) + case '"': + return l.skipQuoted(i, '"', l.d.DoubleQuoteString && l.d.Backslash) + case '`': + if !l.d.Backtick { + return -1 + } + return l.skipQuoted(i, '`', false) + case '-': + if l.at(i+1) == '-' { + return l.skipLine(i) + } + case '#': + if l.d.HashComment { + return l.skipLine(i) + } + case '/': + if l.at(i+1) == '*' { + return l.skipBlockComment(i) + } + case '$': + if l.d.DollarQuote { + if end := l.skipDollarQuoted(i); end >= 0 { + return end + } + } + } + return -1 +} + +// isEscapeString reports whether the string literal starting at i is a +// PostgreSQL escape string constant, written E'...', where a backslash escapes +// the following character. +func (l *lexer) isEscapeString(i int) bool { + if !l.d.DollarQuote { // PostgreSQL-only syntax + return false + } + c := l.at(i - 1) + if c != 'e' && c != 'E' { + return false + } + // The E must not be the tail of a longer identifier. + return !isIdentPart(l.at(i - 2)) +} + +func (l *lexer) skipQuoted(i int, quote byte, backslash bool) int { + for j := i + 1; j < len(l.src); j++ { + switch l.src[j] { + case '\\': + if backslash { + j++ + } + case quote: + // A doubled quote is an escaped quote, not the end. + if l.at(j+1) == quote { + j++ + continue + } + return j + 1 + } + } + return len(l.src) +} + +func (l *lexer) skipLine(i int) int { + if idx := strings.IndexByte(l.src[i:], '\n'); idx >= 0 { + return i + idx + 1 + } + return len(l.src) +} + +func (l *lexer) skipBlockComment(i int) int { + depth := 0 + for j := i; j < len(l.src)-1; j++ { + if l.src[j] == '/' && l.src[j+1] == '*' { + depth++ + j++ + continue + } + if l.src[j] == '*' && l.src[j+1] == '/' { + depth-- + j++ + if depth == 0 || !l.d.NestedBlockComment { + return j + 1 + } + } + } + return len(l.src) +} + +// skipDollarQuoted handles PostgreSQL's $tag$ ... $tag$ string literals. It +// returns -1 when i does not start a dollar quote. +func (l *lexer) skipDollarQuoted(i int) int { + tag := l.dollarTag(i) + if tag == "" { + return -1 + } + if idx := strings.Index(l.src[i+len(tag):], tag); idx >= 0 { + return i + len(tag) + idx + len(tag) + } + return len(l.src) +} + +// dollarTag returns the full opening delimiter ("$$" or "$tag$") when one +// starts at i, and "" otherwise. +func (l *lexer) dollarTag(i int) string { + if l.at(i) != '$' { + return "" + } + j := i + 1 + for j < len(l.src) && l.src[j] != '$' { + c := l.src[j] + if isDigit(c) && j == i+1 { + return "" // $1 is a bind parameter, not a tag + } + if !isIdentPart(c) || c == '$' { + return "" + } + j++ + } + if j >= len(l.src) { + return "" + } + return l.src[i : j+1] +} + +// identEnd returns the offset just past the identifier that starts at i. +func (l *lexer) identEnd(i int) int { + j := i + for j < len(l.src) && isIdentPart(l.src[j]) { + j++ + } + return j +} + +// skipSpace advances past whitespace and comments. +func (l *lexer) skipSpace(i int) int { + for i < len(l.src) { + if isSpace(l.src[i]) { + i++ + continue + } + if l.src[i] == '-' && l.at(i+1) == '-' { + i = l.skipLine(i) + continue + } + if l.src[i] == '/' && l.at(i+1) == '*' { + i = l.skipBlockComment(i) + continue + } + if l.src[i] == '#' && l.d.HashComment { + i = l.skipLine(i) + continue + } + break + } + return i +} + +// statements splits the source into statement spans at top-level semicolons. +// The spans cover the whole source, so every byte belongs to exactly one +// statement. +func (l *lexer) statements() [][2]int { + var out [][2]int + start := 0 + for i := 0; i < len(l.src); { + if end := l.skip(i); end >= 0 { + i = end + continue + } + if l.src[i] == ';' { + out = append(out, [2]int{start, i + 1}) + start = i + 1 + } + i++ + } + if start < len(l.src) { + out = append(out, [2]int{start, len(l.src)}) + } + return out +} + +// matchParen returns the offset of the ")" that closes the "(" at i, or -1. +func (l *lexer) matchParen(i int) int { + depth := 0 + for j := i; j < len(l.src); { + if end := l.skip(j); end >= 0 { + j = end + continue + } + switch l.src[j] { + case '(': + depth++ + case ')': + depth-- + if depth == 0 { + return j + } + } + j++ + } + return -1 +} + +// splitArgs splits the text between parentheses on top-level commas. Empty or +// whitespace-only input yields no arguments. +func (l *lexer) splitArgs(start, end int) []string { + var args []string + depth := 0 + last := start + for j := start; j < end; { + if stop := l.skip(j); stop >= 0 { + if stop > end { + stop = end + } + j = stop + continue + } + switch l.src[j] { + case '(': + depth++ + case ')': + depth-- + case ',': + if depth == 0 { + args = append(args, l.src[last:j]) + last = j + 1 + } + } + j++ + } + tail := l.src[last:end] + if len(args) == 0 && strings.TrimSpace(tail) == "" { + return nil + } + return append(args, tail) +} diff --git a/internal/sql/preprocess/preprocess.go b/internal/sql/preprocess/preprocess.go new file mode 100644 index 0000000000..ad25bc9b2f --- /dev/null +++ b/internal/sql/preprocess/preprocess.go @@ -0,0 +1,398 @@ +// Package preprocess rewrites sqlc's query syntax into native SQL before any +// engine parser sees a query. +// +// sqlc.arg(), sqlc.narg(), sqlc.slice(), sqlc.embed() and @name are sqlc +// syntax, not SQL. Historically they survived all the way through each engine's +// parser and were replaced by walking the resulting AST, which meant every +// engine had to round-trip a schema-qualified function call it did not +// understand. This package removes that requirement: it scans the query text +// with a dialect-parameterized lexer, replaces each construct with the engine's +// native placeholder, and records what it replaced. Engines then only ever see +// valid SQL. +package preprocess + +import ( + "errors" + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/named" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +// Embed is a rewritten sqlc.embed(table) call. +type Embed struct { + Table *ast.TableName + + // Location is the offset of the rewritten "table.*" in the preprocessed + // text. The compiler uses it to tell a rewritten star reference apart from + // one the user wrote. + Location int + + param string +} + +// Orig returns the sqlc syntax this embed was rewritten from. +func (e Embed) Orig() string { + return fmt.Sprintf("sqlc.embed(%s)", e.param) +} + +// EmbedSet is the set of embeds in a single statement. +type EmbedSet []*Embed + +// Find returns the embed recorded at any of the given locations. Engines do not +// all populate the same location fields, so callers pass every location that +// could identify the node. +func (es EmbedSet) Find(locations ...int) (*Embed, bool) { + for _, e := range es { + for _, loc := range locations { + if loc == e.Location { + return e, true + } + } + } + return nil, false +} + +// Statement holds everything the preprocessor learned about a single statement. +type Statement struct { + // Start and End delimit the statement in the rewritten text. + Start, End int + + // Params maps each placeholder number to its sqlc metadata. + Params *named.ParamSet + + // Embeds records the sqlc.embed() calls that were rewritten to "table.*". + Embeds EmbedSet + + // Slices holds the offset, in the rewritten text, of every placeholder that + // came from sqlc.slice(), mapped to the parameter name. + Slices map[int]string + + // Numbers maps the offset of every placeholder in the rewritten text to the + // number assigned to it. Engines number bind parameters in whatever order + // they happen to convert the AST, so the compiler uses this to restore + // source order. + Numbers map[int]int + + // Dollar reports whether the statement's own placeholders are numbered. + Dollar bool + + // ParamErr is set when the placeholders the user wrote are inconsistent: + // numbered and unnumbered styles mixed, or a gap in the numbering. + ParamErr error + + // Err is a validation error found while rewriting. The statement text is + // left untouched when this is set, so the engine still sees the original + // query and the error can be reported against it. + Err error +} + +// Result is the outcome of preprocessing a SQL file. +type Result struct { + // Text is the rewritten SQL. It has the same number of statements and the + // same line structure as the input. + Text string + + stmts []*Statement + edits []edit +} + +// edit records one rewritten span, in both coordinate systems. +type edit struct { + oldStart, oldEnd int + newStart, newEnd int +} + +// Statements returns every statement in the rewritten text, in source order. +func (r *Result) Statements() []*Statement { + return r.stmts +} + +// Statement returns the preprocessing results for the statement covering the +// given offset in the rewritten text. It never returns nil. +func (r *Result) Statement(location int) *Statement { + for _, s := range r.stmts { + if location < s.End { + return s + } + } + return &Statement{Params: named.NewParamSet(nil, true)} +} + +// Origin maps an offset in the rewritten text back to the offset in the +// original source, so errors can be reported against what the user wrote. +func (r *Result) Origin(location int) int { + delta := 0 + for _, e := range r.edits { + if location < e.newStart { + break + } + if location < e.newEnd { + return e.oldStart + } + delta += (e.oldEnd - e.oldStart) - (e.newEnd - e.newStart) + } + return location + delta +} + +type kind int + +const ( + kindArg kind = iota + kindNarg + kindSlice + kindEmbed + kindNative +) + +// occurrence is one construct found in the query text. +type occurrence struct { + kind kind + start int // offset in the original source + end int + name string + // ident is the argument exactly as written, used to rebuild "table.*" for + // embeds so quoting is preserved. + ident string + // number is the placeholder number assigned to this occurrence. + number int + // explicit reports whether a native placeholder carried its own number. + explicit bool + err *sqlerr.Error +} + +// File rewrites every sqlc construct in src to native SQL for the given engine. +// +// An engine that is not preprocessed — GoogleSQL, which handles its own +// parameter syntax — gets the source back unchanged, with an empty side +// table. sqlc.arg() and friends are not rewritten for it, so they reach the +// parser as the function calls they look like. +func File(engine config.Engine, src string) *Result { + d, ok := DialectFor(engine) + if !ok { + return &Result{Text: src} + } + return Dialected(d, src) +} + +// Dialected rewrites src using an explicit dialect. +func Dialected(d Dialect, src string) *Result { + l := &lexer{d: d, src: src} + res := &Result{} + + var b strings.Builder + b.Grow(len(src)) + + spans := l.statements() + for i, span := range spans { + start, end := span[0], span[1] + + // Whatever trails the last semicolon is only whitespace in a + // well-formed file. It still belongs in the output, but it is not a + // statement. + if i == len(spans)-1 && strings.TrimSpace(src[start:end]) == "" { + b.WriteString(src[start:end]) + continue + } + + occs := l.scan(start, end) + stmt := &Statement{Start: b.Len()} + + // A statement that fails validation is copied through unchanged so the + // engine parses what the user actually wrote and the error keeps its + // original shape. + if err := firstError(occs); err != nil { + b.WriteString(src[start:end]) + stmt.End = b.Len() + err.Location = stmt.Start + (err.Location - start) + stmt.Err = err + stmt.Params = named.NewParamSet(nil, d.hasNamedSupport()) + stmt.Dollar = true + res.stmts = append(res.stmts, stmt) + continue + } + + stmt.Dollar, stmt.ParamErr = validatePlaceholders(occs) + stmt.Params = number(d, occs) + stmt.Numbers = map[int]int{} + + prev := start + for i := range occs { + occ := &occs[i] + b.WriteString(src[prev:occ.start]) + newStart := b.Len() + replacement := d.replacement(occ) + b.WriteString(replacement) + newEnd := b.Len() + prev = occ.end + + if replacement != src[occ.start:occ.end] { + res.edits = append(res.edits, edit{ + oldStart: occ.start, oldEnd: occ.end, + newStart: newStart, newEnd: newEnd, + }) + } + + if occ.kind != kindEmbed { + stmt.Numbers[newStart+sliceMarkerLen(d, occ)] = occ.number + } + + switch occ.kind { + case kindEmbed: + stmt.Embeds = append(stmt.Embeds, &Embed{ + Table: &ast.TableName{Name: occ.name}, + Location: newStart, + param: occ.ident, + }) + case kindSlice: + if stmt.Slices == nil { + stmt.Slices = map[int]string{} + } + // The placeholder follows the /*SLICE:name*/ marker, so record + // the offset the engine will report for the parameter node. + stmt.Slices[newStart+sliceMarkerLen(d, occ)] = occ.name + } + } + b.WriteString(src[prev:end]) + stmt.End = b.Len() + res.stmts = append(res.stmts, stmt) + } + + res.Text = b.String() + return res +} + +func firstError(occs []occurrence) *sqlerr.Error { + for _, occ := range occs { + if occ.err != nil { + return occ.err + } + } + return nil +} + +// sliceMarkerLen returns the length of the /*SLICE:name*/ prefix a slice +// placeholder is written with, or 0 when there is none. +func sliceMarkerLen(d Dialect, occ *occurrence) int { + if occ.kind != kindSlice || d.Style == StyleDollar { + return 0 + } + return len("/*SLICE:") + len(occ.name) + len("*/") +} + +// validatePlaceholders checks the placeholders the user wrote, reproducing the +// rules the AST-based validator applied before sqlc syntax was rewritten: a +// query may not mix numbered and unnumbered placeholders, and the numbers it +// does use may not have gaps. +func validatePlaceholders(occs []occurrence) (dollar bool, err error) { + var numbered, unnumbered bool + seen := map[int]bool{} + for _, occ := range occs { + if occ.kind != kindNative { + continue + } + if occ.explicit { + numbered = true + seen[occ.number] = true + } else { + unnumbered = true + } + } + if numbered && unnumbered { + return false, errors.New("can not mix $1 format with ? format") + } + for i := 1; i <= len(seen); i++ { + if !seen[i] { + return !unnumbered, &sqlerr.Error{ + Code: "42P18", + Message: fmt.Sprintf("could not determine data type of parameter $%d", i), + } + } + } + return !unnumbered, nil +} + +// number assigns a placeholder number to every occurrence and builds the +// parameter set for the statement. +func number(d Dialect, occs []occurrence) *named.ParamSet { + if d.Style == StyleQuestion { + // Every "?" is sent as its own argument, so existing and rewritten + // placeholders are numbered together in source order. + ps := named.NewParamSet(nil, false) + for i := range occs { + occ := &occs[i] + if occ.kind == kindEmbed { + continue + } + occ.number = ps.Add(param(occ)) + } + return ps + } + + // Numbered dialects keep the numbers the user wrote and fill in the gaps. + numbs := map[int]bool{} + count := 0 + for i := range occs { + occ := &occs[i] + if occ.kind != kindNative { + continue + } + count++ + if !occ.explicit { + occ.number = count + } + numbs[occ.number] = true + } + ps := named.NewParamSet(numbs, d.hasNamedSupport()) + for i := range occs { + occ := &occs[i] + if occ.kind == kindEmbed || occ.kind == kindNative { + continue + } + occ.number = ps.Add(param(occ)) + } + return ps +} + +func param(occ *occurrence) named.Param { + switch occ.kind { + case kindNarg: + return named.NewUserNullableParam(occ.name) + case kindSlice: + return named.NewSqlcSlice(occ.name) + default: + return named.NewParam(occ.name) + } +} + +// replacement returns the native SQL that stands in for an occurrence. +func (d Dialect) replacement(occ *occurrence) string { + switch occ.kind { + case kindEmbed: + return occ.ident + ".*" + case kindNative: + return occ.ident + } + switch d.Style { + case StyleDollar: + // PostgreSQL passes a slice as a single array parameter, so it needs no + // expansion marker. + return fmt.Sprintf("$%d", occ.number) + case StyleOrdinal: + if occ.kind == kindSlice { + // This sequence is also replicated in + // internal/codegen/golang.Field since it's needed during template + // generation for replacement. + return fmt.Sprintf("/*SLICE:%s*/?", occ.name) + } + return fmt.Sprintf("?%d", occ.number) + default: + if occ.kind == kindSlice { + return fmt.Sprintf("/*SLICE:%s*/?", occ.name) + } + return "?" + } +} diff --git a/internal/sql/preprocess/preprocess_test.go b/internal/sql/preprocess/preprocess_test.go new file mode 100644 index 0000000000..5b0eb3e0aa --- /dev/null +++ b/internal/sql/preprocess/preprocess_test.go @@ -0,0 +1,232 @@ +package preprocess_test + +import ( + "encoding/json" + "flag" + "fmt" + "os" + "path/filepath" + "sort" + "strings" + "testing" + + "github.com/google/go-cmp/cmp" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/source" + "github.com/sqlc-dev/sqlc/internal/sql/named" + "github.com/sqlc-dev/sqlc/internal/sql/preprocess" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +var update = flag.Bool("update", false, "update the testdata golden files") + +// TestRewrite runs every case under testdata. Each case is a directory holding +// the input and the expected results, grouped by engine: +// +// testdata///input.sql the query file +// testdata///output.sql the rewritten SQL +// testdata///side_table.json what the preprocessor recorded +// testdata///stderr.txt reported errors (only when invalid) +// +// Regenerate the golden files with `go test ./internal/sql/preprocess -update`. +func TestRewrite(t *testing.T) { + for _, dir := range cases(t) { + t.Run(filepath.ToSlash(dir), func(t *testing.T) { + path := filepath.Join("testdata", dir) + engine := config.Engine(filepath.Dir(dir)) + + input := readFile(t, filepath.Join(path, "input.sql")) + res := preprocess.File(engine, input) + + compare(t, filepath.Join(path, "output.sql"), res.Text) + compare(t, filepath.Join(path, "side_table.json"), sideTable(res)) + compare(t, filepath.Join(path, "stderr.txt"), errors(input, res)) + + // A rewrite only ever replaces text with something shorter or + // equal in lines, so a line number taken from the rewritten text is + // never past the end of the original. + if want, got := strings.Count(input, "\n"), strings.Count(res.Text, "\n"); got > want { + t.Errorf("rewrite added lines: got %d, want at most %d", got, want) + } + }) + } +} + +// The JSON shape of the side table the preprocessor records alongside the +// rewritten SQL. Locations are offsets into the rewritten text; origins are the +// offsets they map back to in the original source. +type statement struct { + Start int `json:"start"` + End int `json:"end"` + Dollar bool `json:"dollar"` + Params []parameter `json:"params,omitempty"` + Embeds []embed `json:"embeds,omitempty"` + Error string `json:"error,omitempty"` + ErrorAt int `json:"error_at,omitempty"` + ParamError string `json:"param_error,omitempty"` +} + +type parameter struct { + Number int `json:"number"` + Location int `json:"location"` + Origin int `json:"origin"` + Name string `json:"name,omitempty"` + // Named is false for a placeholder the user wrote themselves, which the + // preprocessor numbers but does not name. + Named bool `json:"named"` + // Nullable is true when sqlc.narg() forced the parameter nullable, even + // though the schema says it is NOT NULL. + Nullable bool `json:"nullable,omitempty"` + Slice bool `json:"slice,omitempty"` +} + +type embed struct { + Table string `json:"table"` + Location int `json:"location"` + Origin int `json:"origin"` + Orig string `json:"orig"` +} + +// sideTable renders everything the preprocessor recorded, reading it back +// through the same API the compiler uses. +func sideTable(res *preprocess.Result) string { + out := make([]statement, 0, len(res.Statements())) + for _, stmt := range res.Statements() { + s := statement{Start: stmt.Start, End: stmt.End, Dollar: stmt.Dollar} + if stmt.Err != nil { + s.Error = stmt.Err.Error() + if e, ok := stmt.Err.(*sqlerr.Error); ok { + s.ErrorAt = e.Location + } + } + if stmt.ParamErr != nil { + s.ParamError = stmt.ParamErr.Error() + } + + locations := make([]int, 0, len(stmt.Numbers)) + for loc := range stmt.Numbers { + locations = append(locations, loc) + } + sort.Ints(locations) + for _, loc := range locations { + number := stmt.Numbers[loc] + name, _ := stmt.Params.NameFor(number) + // Merging against a NOT NULL parameter is how the compiler asks + // whether the user overrode nullability with sqlc.narg(). + p, isNamed := stmt.Params.FetchMerge(number, named.NewInferredParam(name, true)) + _, isSlice := stmt.Slices[loc] + s.Params = append(s.Params, parameter{ + Number: number, + Location: loc, + Origin: res.Origin(loc), + Name: name, + Named: isNamed, + Nullable: isNamed && !p.NotNull(), + Slice: isSlice, + }) + } + + for _, e := range stmt.Embeds { + s.Embeds = append(s.Embeds, embed{ + Table: e.Table.Name, + Location: e.Location, + Origin: res.Origin(e.Location), + Orig: e.Orig(), + }) + } + out = append(out, s) + } + + blob, err := json.MarshalIndent(out, "", " ") + if err != nil { + panic(err) + } + return string(blob) + "\n" +} + +// errors renders every validation error the preprocessor recorded, one per +// line, as "line:column: message" against the original source. +func errors(input string, res *preprocess.Result) string { + var out []string + for _, stmt := range res.Statements() { + for _, err := range []error{stmt.Err, stmt.ParamErr} { + if err == nil { + continue + } + loc := stmt.Start + if e, ok := err.(*sqlerr.Error); ok && e.Location != 0 { + loc = e.Location + } + line, column := source.LineNumber(input, res.Origin(loc)) + out = append(out, fmt.Sprintf("%d:%d: %s", line, column, err)) + } + } + if len(out) == 0 { + return "" + } + return strings.Join(out, "\n") + "\n" +} + +// cases returns every testdata directory that holds an input.sql, relative to +// testdata and in a stable order. +func cases(t *testing.T) []string { + t.Helper() + var dirs []string + err := filepath.Walk("testdata", func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() || info.Name() != "input.sql" { + return nil + } + rel, err := filepath.Rel("testdata", filepath.Dir(path)) + if err != nil { + return err + } + dirs = append(dirs, rel) + return nil + }) + if err != nil { + t.Fatal(err) + } + if len(dirs) == 0 { + t.Fatal("no test cases found in testdata") + } + sort.Strings(dirs) + return dirs +} + +func readFile(t *testing.T, path string) string { + t.Helper() + blob, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + return string(blob) +} + +// compare checks actual against a golden file. An empty expectation means the +// file should not exist. +func compare(t *testing.T, path, actual string) { + t.Helper() + if *update { + if actual == "" { + os.Remove(path) + return + } + if err := os.WriteFile(path, []byte(actual), 0644); err != nil { + t.Fatal(err) + } + return + } + var expected string + if blob, err := os.ReadFile(path); err == nil { + expected = string(blob) + } else if !os.IsNotExist(err) { + t.Fatal(err) + } + if diff := cmp.Diff(expected, actual); diff != "" { + t.Errorf("%s differed (-want +got):\n%s", filepath.Base(path), diff) + } +} diff --git a/internal/sql/preprocess/scan.go b/internal/sql/preprocess/scan.go new file mode 100644 index 0000000000..b2b4b1f534 --- /dev/null +++ b/internal/sql/preprocess/scan.go @@ -0,0 +1,209 @@ +package preprocess + +import ( + "fmt" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +// scan walks a single statement and returns every sqlc construct and native +// placeholder it contains, in source order. +func (l *lexer) scan(start, end int) []occurrence { + var out []occurrence + for i := start; i < end; { + if stop := l.skip(i); stop >= 0 { + if stop <= i { + stop = i + 1 + } + i = stop + continue + } + c := l.src[i] + switch { + case isIdentStart(c): + j := l.identEnd(i) + if strings.EqualFold(l.src[i:j], "sqlc") { + if occ, next, ok := l.sqlcCall(i, j); ok { + out = append(out, occ) + i = next + continue + } + } + i = j + + case c == '@' && l.d.AtSign && isIdentStart(l.at(i+1)): + j := l.identEnd(i + 1) + out = append(out, occurrence{ + kind: kindArg, + start: i, + end: j, + name: l.src[i+1 : j], + ident: l.src[i:j], + }) + i = j + + case c == '$' && l.d.DollarNumber && isDigit(l.at(i+1)): + j := i + 1 + for j < len(l.src) && isDigit(l.src[j]) { + j++ + } + n, _ := strconv.Atoi(l.src[i+1 : j]) + out = append(out, occurrence{ + kind: kindNative, + start: i, + end: j, + number: n, + explicit: true, + ident: l.src[i:j], + }) + i = j + + case c == '?' && l.d.Question: + j := i + 1 + for j < len(l.src) && isDigit(l.src[j]) { + j++ + } + occ := occurrence{kind: kindNative, start: i, end: j, ident: l.src[i:j]} + if j > i+1 { + occ.number, _ = strconv.Atoi(l.src[i+1 : j]) + occ.explicit = true + } + out = append(out, occ) + i = j + + default: + i++ + } + } + return out +} + +// sqlcCall parses a "sqlc.()" call that starts at start, where +// afterSqlc is the offset just past the "sqlc" identifier. It reports false +// when the text is not a sqlc call at all, in which case scanning continues +// normally. +func (l *lexer) sqlcCall(start, afterSqlc int) (occurrence, int, bool) { + i := l.skipSpace(afterSqlc) + if l.at(i) != '.' { + return occurrence{}, 0, false + } + i = l.skipSpace(i + 1) + if !isIdentStart(l.at(i)) { + return occurrence{}, 0, false + } + nameEnd := l.identEnd(i) + fn := strings.ToLower(l.src[i:nameEnd]) + + open := l.skipSpace(nameEnd) + if l.at(open) != '(' { + return occurrence{}, 0, false + } + closing := l.matchParen(open) + if closing < 0 { + return occurrence{}, 0, false + } + + occ := occurrence{start: start, end: closing + 1} + switch fn { + case "arg": + occ.kind = kindArg + case "narg": + occ.kind = kindNarg + case "slice": + occ.kind = kindSlice + case "embed": + occ.kind = kindEmbed + default: + occ.err = sqlerr.FunctionNotFound("sqlc." + fn) + occ.err.Location = start + return occ, occ.end, true + } + + args := l.splitArgs(open+1, closing) + if len(args) != 1 { + occ.err = &sqlerr.Error{ + Message: fmt.Sprintf("expected 1 parameter to sqlc.%s; got %d", fn, len(args)), + Location: start, + } + return occ, occ.end, true + } + + name, ident, ok := argument(l.d, args[0]) + if !ok { + occ.err = &sqlerr.Error{ + Message: fmt.Sprintf("expected parameter to sqlc.%s to be string or reference; got %q", fn, strings.TrimSpace(args[0])), + Location: start, + } + return occ, occ.end, true + } + occ.name = name + occ.ident = ident + return occ, occ.end, true +} + +// argument interprets the single argument to a sqlc function. It returns the +// parameter name and the text to reuse when rebuilding a reference, which keeps +// any identifier quoting the user wrote. +func argument(d Dialect, arg string) (name, ident string, ok bool) { + arg = strings.TrimSpace(arg) + if arg == "" { + return "", "", false + } + switch arg[0] { + case '\'': + // A string constant names the parameter but is not a reference, so the + // rebuilt identifier drops the quotes. + s, ok := unquote(arg, '\'') + return s, s, ok + case '"': + s, ok := unquote(arg, '"') + if !ok { + return "", "", false + } + if d.DoubleQuoteString { + return s, s, true + } + return s, arg, true + case '`': + if !d.Backtick { + return "", "", false + } + s, ok := unquote(arg, '`') + if !ok { + return "", "", false + } + return s, arg, true + } + if !isIdentStart(arg[0]) { + return "", "", false + } + for i := 0; i < len(arg); i++ { + if !isIdentPart(arg[i]) && arg[i] != '.' { + return "", "", false + } + } + // A qualified reference flattens to a single name, matching how the AST + // rewrite joined the parts of a ColumnRef. + name = strings.ReplaceAll(arg, ".", "") + if d.FoldIdentifier { + name = strings.ToLower(name) + } + return name, arg, true +} + +func unquote(s string, quote byte) (string, bool) { + if len(s) < 2 || s[0] != quote || s[len(s)-1] != quote { + return "", false + } + inner := s[1 : len(s)-1] + if strings.IndexByte(inner, quote) >= 0 { + doubled := string([]byte{quote, quote}) + if strings.Contains(inner, doubled) { + return strings.ReplaceAll(inner, doubled, string(quote)), true + } + return "", false + } + return inner, true +} diff --git a/internal/sql/preprocess/testdata/mysql/arg/input.sql b/internal/sql/preprocess/testdata/mysql/arg/input.sql new file mode 100644 index 0000000000..180ea26b3b --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/arg/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = sqlc.arg(x) AND b = sqlc.arg(x); diff --git a/internal/sql/preprocess/testdata/mysql/arg/output.sql b/internal/sql/preprocess/testdata/mysql/arg/output.sql new file mode 100644 index 0000000000..0091b6db39 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/arg/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ? AND b = ?; diff --git a/internal/sql/preprocess/testdata/mysql/arg/side_table.json b/internal/sql/preprocess/testdata/mysql/arg/side_table.json new file mode 100644 index 0000000000..78b83b34a6 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/arg/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 43, + "dollar": true, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "name": "x", + "named": true + }, + { + "number": 2, + "location": 41, + "origin": 51, + "name": "x", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/input.sql b/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/input.sql new file mode 100644 index 0000000000..d933db8127 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/input.sql @@ -0,0 +1 @@ +SELECT * FROM second_view WHERE val2 = $1; diff --git a/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/output.sql b/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/output.sql new file mode 100644 index 0000000000..d933db8127 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/output.sql @@ -0,0 +1 @@ +SELECT * FROM second_view WHERE val2 = $1; diff --git a/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/side_table.json b/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/side_table.json new file mode 100644 index 0000000000..05701e1815 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 42, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/mysql/double_quoted_argument/input.sql b/internal/sql/preprocess/testdata/mysql/double_quoted_argument/input.sql new file mode 100644 index 0000000000..37f43141bf --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/double_quoted_argument/input.sql @@ -0,0 +1,4 @@ +SELECT + (CASE WHEN sqlc.arg("Timezone") = "calendar" THEN cal.Timezone ELSE sqlc.arg("Timezone") END), + COALESCE(sqlc.narg("calName"), "") +FROM Calendar cal; diff --git a/internal/sql/preprocess/testdata/mysql/double_quoted_argument/output.sql b/internal/sql/preprocess/testdata/mysql/double_quoted_argument/output.sql new file mode 100644 index 0000000000..201532c117 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/double_quoted_argument/output.sql @@ -0,0 +1,4 @@ +SELECT + (CASE WHEN ? = "calendar" THEN cal.Timezone ELSE ? END), + COALESCE(?, "") +FROM Calendar cal; diff --git a/internal/sql/preprocess/testdata/mysql/double_quoted_argument/side_table.json b/internal/sql/preprocess/testdata/mysql/double_quoted_argument/side_table.json new file mode 100644 index 0000000000..711a8833c2 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/double_quoted_argument/side_table.json @@ -0,0 +1,31 @@ +[ + { + "start": 0, + "end": 106, + "dollar": true, + "params": [ + { + "number": 1, + "location": 22, + "origin": 22, + "name": "Timezone", + "named": true + }, + { + "number": 2, + "location": 60, + "origin": 79, + "name": "Timezone", + "named": true + }, + { + "number": 3, + "location": 81, + "origin": 119, + "name": "calName", + "named": true, + "nullable": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/embed/input.sql b/internal/sql/preprocess/testdata/mysql/embed/input.sql new file mode 100644 index 0000000000..bb5188a008 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/embed/input.sql @@ -0,0 +1 @@ +SELECT sqlc.embed(users) FROM users; diff --git a/internal/sql/preprocess/testdata/mysql/embed/output.sql b/internal/sql/preprocess/testdata/mysql/embed/output.sql new file mode 100644 index 0000000000..e9d0968e18 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/embed/output.sql @@ -0,0 +1 @@ +SELECT users.* FROM users; diff --git a/internal/sql/preprocess/testdata/mysql/embed/side_table.json b/internal/sql/preprocess/testdata/mysql/embed/side_table.json new file mode 100644 index 0000000000..840d08c39d --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/embed/side_table.json @@ -0,0 +1,15 @@ +[ + { + "start": 0, + "end": 26, + "dollar": true, + "embeds": [ + { + "table": "users", + "location": 7, + "origin": 7, + "orig": "sqlc.embed(users)" + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/error_invalid_calls/input.sql b/internal/sql/preprocess/testdata/mysql/error_invalid_calls/input.sql new file mode 100644 index 0000000000..51f7ddb8ee --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/error_invalid_calls/input.sql @@ -0,0 +1,11 @@ +-- name: WrongFunc :one +SELECT id FROM users WHERE id = sqlc.argh(target_id); + +-- name: TooManyArgs :one +SELECT id FROM users WHERE id = sqlc.arg('foo', 'bar'); + +-- name: TooFewArgs :one +SELECT id FROM users WHERE id = sqlc.arg(); + +-- name: InvalidArgPlaceholder :one +SELECT id FROM users WHERE id = sqlc.arg(?); diff --git a/internal/sql/preprocess/testdata/mysql/error_invalid_calls/output.sql b/internal/sql/preprocess/testdata/mysql/error_invalid_calls/output.sql new file mode 100644 index 0000000000..51f7ddb8ee --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/error_invalid_calls/output.sql @@ -0,0 +1,11 @@ +-- name: WrongFunc :one +SELECT id FROM users WHERE id = sqlc.argh(target_id); + +-- name: TooManyArgs :one +SELECT id FROM users WHERE id = sqlc.arg('foo', 'bar'); + +-- name: TooFewArgs :one +SELECT id FROM users WHERE id = sqlc.arg(); + +-- name: InvalidArgPlaceholder :one +SELECT id FROM users WHERE id = sqlc.arg(?); diff --git a/internal/sql/preprocess/testdata/mysql/error_invalid_calls/side_table.json b/internal/sql/preprocess/testdata/mysql/error_invalid_calls/side_table.json new file mode 100644 index 0000000000..a36ba15e41 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/error_invalid_calls/side_table.json @@ -0,0 +1,30 @@ +[ + { + "start": 0, + "end": 77, + "dollar": true, + "error": "function \"sqlc.argh\" does not exist", + "error_at": 56 + }, + { + "start": 77, + "end": 160, + "dollar": true, + "error": "expected 1 parameter to sqlc.arg; got 2", + "error_at": 137 + }, + { + "start": 160, + "end": 230, + "dollar": true, + "error": "expected 1 parameter to sqlc.arg; got 0", + "error_at": 219 + }, + { + "start": 230, + "end": 312, + "dollar": true, + "error": "expected parameter to sqlc.arg to be string or reference; got \"?\"", + "error_at": 300 + } +] diff --git a/internal/sql/preprocess/testdata/mysql/error_invalid_calls/stderr.txt b/internal/sql/preprocess/testdata/mysql/error_invalid_calls/stderr.txt new file mode 100644 index 0000000000..aae154ee46 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/error_invalid_calls/stderr.txt @@ -0,0 +1,4 @@ +2:33: function "sqlc.argh" does not exist +5:33: expected 1 parameter to sqlc.arg; got 2 +8:33: expected 1 parameter to sqlc.arg; got 0 +11:33: expected parameter to sqlc.arg to be string or reference; got "?" diff --git a/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/input.sql b/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/input.sql new file mode 100644 index 0000000000..9b9c75668e --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ? AND b = sqlc.arg(x) AND c = ?; diff --git a/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/output.sql b/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/output.sql new file mode 100644 index 0000000000..8f52c1ae1b --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ? AND b = ? AND c = ?; diff --git a/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/side_table.json b/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/side_table.json new file mode 100644 index 0000000000..2f8a512eef --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/side_table.json @@ -0,0 +1,28 @@ +[ + { + "start": 0, + "end": 53, + "dollar": false, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "named": false + }, + { + "number": 2, + "location": 41, + "origin": 41, + "name": "x", + "named": true + }, + { + "number": 3, + "location": 51, + "origin": 61, + "named": false + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/narg_identifier/input.sql b/internal/sql/preprocess/testdata/mysql/narg_identifier/input.sql new file mode 100644 index 0000000000..c36f3d6aaa --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/narg_identifier/input.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE name = sqlc.narg(name); diff --git a/internal/sql/preprocess/testdata/mysql/narg_identifier/output.sql b/internal/sql/preprocess/testdata/mysql/narg_identifier/output.sql new file mode 100644 index 0000000000..e48f33043d --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/narg_identifier/output.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE name = ?; diff --git a/internal/sql/preprocess/testdata/mysql/narg_identifier/side_table.json b/internal/sql/preprocess/testdata/mysql/narg_identifier/side_table.json new file mode 100644 index 0000000000..c3b25fbcda --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/narg_identifier/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 35, + "dollar": true, + "params": [ + { + "number": 1, + "location": 33, + "origin": 33, + "name": "name", + "named": true, + "nullable": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/input.sql b/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/input.sql new file mode 100644 index 0000000000..4da5824466 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/input.sql @@ -0,0 +1,2 @@ +INSERT INTO t (a) VALUES (sqlc.arg(val)) +ON DUPLICATE KEY UPDATE a = sqlc.arg(new_val); diff --git a/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/output.sql b/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/output.sql new file mode 100644 index 0000000000..9681976c94 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/output.sql @@ -0,0 +1,2 @@ +INSERT INTO t (a) VALUES (?) +ON DUPLICATE KEY UPDATE a = ?; diff --git a/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/side_table.json b/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/side_table.json new file mode 100644 index 0000000000..6b4e506b56 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 59, + "dollar": true, + "params": [ + { + "number": 1, + "location": 26, + "origin": 26, + "name": "val", + "named": true + }, + { + "number": 2, + "location": 57, + "origin": 69, + "name": "new_val", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/input.sql b/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/input.sql new file mode 100644 index 0000000000..ae9b08ce68 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/input.sql @@ -0,0 +1 @@ +SELECT 'a\' sqlc.arg(nope)'; diff --git a/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/output.sql b/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/output.sql new file mode 100644 index 0000000000..ae9b08ce68 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/output.sql @@ -0,0 +1 @@ +SELECT 'a\' sqlc.arg(nope)'; diff --git a/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/side_table.json b/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/side_table.json new file mode 100644 index 0000000000..7ab9eaedd2 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_backslash_escape/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 28, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/input.sql b/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/input.sql new file mode 100644 index 0000000000..124b3d3a96 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/input.sql @@ -0,0 +1 @@ +SELECT `sqlc.arg(nope)` FROM t; diff --git a/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/output.sql b/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/output.sql new file mode 100644 index 0000000000..124b3d3a96 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/output.sql @@ -0,0 +1 @@ +SELECT `sqlc.arg(nope)` FROM t; diff --git a/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/side_table.json b/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/side_table.json new file mode 100644 index 0000000000..cdde9a6d54 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 31, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/input.sql b/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/input.sql new file mode 100644 index 0000000000..3fb25577ba --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/input.sql @@ -0,0 +1 @@ +SELECT "sqlc.arg(nope)" FROM t; diff --git a/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/output.sql b/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/output.sql new file mode 100644 index 0000000000..3fb25577ba --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/output.sql @@ -0,0 +1 @@ +SELECT "sqlc.arg(nope)" FROM t; diff --git a/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/side_table.json b/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/side_table.json new file mode 100644 index 0000000000..cdde9a6d54 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 31, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/mysql/skip_hash_comment/input.sql b/internal/sql/preprocess/testdata/mysql/skip_hash_comment/input.sql new file mode 100644 index 0000000000..755efa7a13 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_hash_comment/input.sql @@ -0,0 +1,2 @@ +# sqlc.arg(nope) +SELECT 1; diff --git a/internal/sql/preprocess/testdata/mysql/skip_hash_comment/output.sql b/internal/sql/preprocess/testdata/mysql/skip_hash_comment/output.sql new file mode 100644 index 0000000000..755efa7a13 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_hash_comment/output.sql @@ -0,0 +1,2 @@ +# sqlc.arg(nope) +SELECT 1; diff --git a/internal/sql/preprocess/testdata/mysql/skip_hash_comment/side_table.json b/internal/sql/preprocess/testdata/mysql/skip_hash_comment/side_table.json new file mode 100644 index 0000000000..667e960a18 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/skip_hash_comment/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 26, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/mysql/slice/input.sql b/internal/sql/preprocess/testdata/mysql/slice/input.sql new file mode 100644 index 0000000000..f5d89640d7 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/slice/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE id IN (sqlc.slice(ids)); diff --git a/internal/sql/preprocess/testdata/mysql/slice/output.sql b/internal/sql/preprocess/testdata/mysql/slice/output.sql new file mode 100644 index 0000000000..542215158c --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/slice/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE id IN (/*SLICE:ids*/?); diff --git a/internal/sql/preprocess/testdata/mysql/slice/side_table.json b/internal/sql/preprocess/testdata/mysql/slice/side_table.json new file mode 100644 index 0000000000..4b16794ab9 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/slice/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 50, + "dollar": true, + "params": [ + { + "number": 1, + "location": 47, + "origin": 34, + "name": "ids", + "named": true, + "slice": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/input.sql b/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/input.sql new file mode 100644 index 0000000000..3fdbab315d --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/input.sql @@ -0,0 +1 @@ +SELECT * FROM foo WHERE retyped IN (sqlc.slice(paramName)); diff --git a/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/output.sql b/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/output.sql new file mode 100644 index 0000000000..451d50ce5b --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/output.sql @@ -0,0 +1 @@ +SELECT * FROM foo WHERE retyped IN (/*SLICE:paramname*/?); diff --git a/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/side_table.json b/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/side_table.json new file mode 100644 index 0000000000..43154fe710 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/slice_folds_identifier/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 58, + "dollar": true, + "params": [ + { + "number": 1, + "location": 55, + "origin": 36, + "name": "paramname", + "named": true, + "slice": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/string_constant/input.sql b/internal/sql/preprocess/testdata/mysql/string_constant/input.sql new file mode 100644 index 0000000000..21f5701a00 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/string_constant/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = sqlc.arg('x') AND b = sqlc.narg('y') AND c IN (sqlc.slice('ids')); diff --git a/internal/sql/preprocess/testdata/mysql/string_constant/output.sql b/internal/sql/preprocess/testdata/mysql/string_constant/output.sql new file mode 100644 index 0000000000..7dd7adcca6 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/string_constant/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ? AND b = ? AND c IN (/*SLICE:ids*/?); diff --git a/internal/sql/preprocess/testdata/mysql/string_constant/side_table.json b/internal/sql/preprocess/testdata/mysql/string_constant/side_table.json new file mode 100644 index 0000000000..45ffcd24b8 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/string_constant/side_table.json @@ -0,0 +1,32 @@ +[ + { + "start": 0, + "end": 69, + "dollar": true, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "name": "x", + "named": true + }, + { + "number": 2, + "location": 41, + "origin": 53, + "name": "y", + "named": true, + "nullable": true + }, + { + "number": 3, + "location": 66, + "origin": 78, + "name": "ids", + "named": true, + "slice": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/input.sql b/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/input.sql new file mode 100644 index 0000000000..beec84e61c --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg('MixedCase'), sqlc.arg(MixedCase); diff --git a/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/output.sql b/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/output.sql new file mode 100644 index 0000000000..99dcdde756 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/output.sql @@ -0,0 +1 @@ +SELECT ?, ?; diff --git a/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/side_table.json b/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/side_table.json new file mode 100644 index 0000000000..16a138bfc4 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 12, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "MixedCase", + "named": true + }, + { + "number": 2, + "location": 10, + "origin": 30, + "name": "mixedcase", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/input.sql b/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/input.sql new file mode 100644 index 0000000000..ce518fcf22 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/input.sql @@ -0,0 +1 @@ +SELECT @row := @row + 1 FROM users WHERE id = sqlc.arg(id); diff --git a/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/output.sql b/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/output.sql new file mode 100644 index 0000000000..4db8a1b06c --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/output.sql @@ -0,0 +1 @@ +SELECT @row := @row + 1 FROM users WHERE id = ?; diff --git a/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/side_table.json b/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/side_table.json new file mode 100644 index 0000000000..ccf1ada0f7 --- /dev/null +++ b/internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 48, + "dollar": true, + "params": [ + { + "number": 1, + "location": 46, + "origin": 46, + "name": "id", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/arg/input.sql b/internal/sql/preprocess/testdata/postgresql/arg/input.sql new file mode 100644 index 0000000000..4f78775148 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/arg/input.sql @@ -0,0 +1,2 @@ +-- name: GetUser :one +SELECT id FROM users WHERE name = sqlc.arg(name); diff --git a/internal/sql/preprocess/testdata/postgresql/arg/output.sql b/internal/sql/preprocess/testdata/postgresql/arg/output.sql new file mode 100644 index 0000000000..e6d2e2ea8a --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/arg/output.sql @@ -0,0 +1,2 @@ +-- name: GetUser :one +SELECT id FROM users WHERE name = $1; diff --git a/internal/sql/preprocess/testdata/postgresql/arg/side_table.json b/internal/sql/preprocess/testdata/postgresql/arg/side_table.json new file mode 100644 index 0000000000..d01162f091 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/arg/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 59, + "dollar": true, + "params": [ + { + "number": 1, + "location": 56, + "origin": 56, + "name": "name", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign/input.sql b/internal/sql/preprocess/testdata/postgresql/at_sign/input.sql new file mode 100644 index 0000000000..57c7883786 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE name = @name AND age = @age; diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign/output.sql b/internal/sql/preprocess/testdata/postgresql/at_sign/output.sql new file mode 100644 index 0000000000..90875ab313 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE name = $1 AND age = $2; diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign/side_table.json b/internal/sql/preprocess/testdata/postgresql/at_sign/side_table.json new file mode 100644 index 0000000000..bebc9a14d7 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 50, + "dollar": true, + "params": [ + { + "number": 1, + "location": 34, + "origin": 34, + "name": "name", + "named": true + }, + { + "number": 2, + "location": 47, + "origin": 50, + "name": "age", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign_cast/input.sql b/internal/sql/preprocess/testdata/postgresql/at_sign_cast/input.sql new file mode 100644 index 0000000000..a167ed5961 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign_cast/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE ok = @flag::bool; diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign_cast/output.sql b/internal/sql/preprocess/testdata/postgresql/at_sign_cast/output.sql new file mode 100644 index 0000000000..28cdd95fca --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign_cast/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE ok = $1::bool; diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign_cast/side_table.json b/internal/sql/preprocess/testdata/postgresql/at_sign_cast/side_table.json new file mode 100644 index 0000000000..02ec768518 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign_cast/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 41, + "dollar": true, + "params": [ + { + "number": 1, + "location": 32, + "origin": 32, + "name": "flag", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/input.sql b/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/input.sql new file mode 100644 index 0000000000..d06af4e9eb --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/input.sql @@ -0,0 +1,3 @@ +-- name: SkipVetAll :exec +-- @sqlc-vet-disable always-fail no-exec +SELECT true FROM users WHERE id = sqlc.arg(id); diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/output.sql b/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/output.sql new file mode 100644 index 0000000000..5bbca3dd62 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/output.sql @@ -0,0 +1,3 @@ +-- name: SkipVetAll :exec +-- @sqlc-vet-disable always-fail no-exec +SELECT true FROM users WHERE id = $1; diff --git a/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/side_table.json b/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/side_table.json new file mode 100644 index 0000000000..3430150bb0 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 104, + "dollar": true, + "params": [ + { + "number": 1, + "location": 101, + "origin": 101, + "name": "id", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/comment_inside_call/input.sql b/internal/sql/preprocess/testdata/postgresql/comment_inside_call/input.sql new file mode 100644 index 0000000000..58bb27fc93 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/comment_inside_call/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg/* here */(name); diff --git a/internal/sql/preprocess/testdata/postgresql/comment_inside_call/output.sql b/internal/sql/preprocess/testdata/postgresql/comment_inside_call/output.sql new file mode 100644 index 0000000000..37699f7c74 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/comment_inside_call/output.sql @@ -0,0 +1 @@ +SELECT $1; diff --git a/internal/sql/preprocess/testdata/postgresql/comment_inside_call/side_table.json b/internal/sql/preprocess/testdata/postgresql/comment_inside_call/side_table.json new file mode 100644 index 0000000000..80979ab73b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/comment_inside_call/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 10, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "name", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/embed/input.sql b/internal/sql/preprocess/testdata/postgresql/embed/input.sql new file mode 100644 index 0000000000..551607433a --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed/input.sql @@ -0,0 +1 @@ +SELECT sqlc.embed(users), sqlc.embed(pets) FROM users JOIN pets ON true; diff --git a/internal/sql/preprocess/testdata/postgresql/embed/output.sql b/internal/sql/preprocess/testdata/postgresql/embed/output.sql new file mode 100644 index 0000000000..59d0cab37b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed/output.sql @@ -0,0 +1 @@ +SELECT users.*, pets.* FROM users JOIN pets ON true; diff --git a/internal/sql/preprocess/testdata/postgresql/embed/side_table.json b/internal/sql/preprocess/testdata/postgresql/embed/side_table.json new file mode 100644 index 0000000000..ed71a0d974 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed/side_table.json @@ -0,0 +1,21 @@ +[ + { + "start": 0, + "end": 52, + "dollar": true, + "embeds": [ + { + "table": "users", + "location": 7, + "origin": 7, + "orig": "sqlc.embed(users)" + }, + { + "table": "pets", + "location": 16, + "origin": 26, + "orig": "sqlc.embed(pets)" + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/input.sql b/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/input.sql new file mode 100644 index 0000000000..bec18076c7 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/input.sql @@ -0,0 +1 @@ +SELECT sqlc.embed(a), b.* FROM a, b; diff --git a/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/output.sql b/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/output.sql new file mode 100644 index 0000000000..e3ea7edc61 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/output.sql @@ -0,0 +1 @@ +SELECT a.*, b.* FROM a, b; diff --git a/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/side_table.json b/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/side_table.json new file mode 100644 index 0000000000..d30b005ee8 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_and_user_star/side_table.json @@ -0,0 +1,15 @@ +[ + { + "start": 0, + "end": 26, + "dollar": true, + "embeds": [ + { + "table": "a", + "location": 7, + "origin": 7, + "orig": "sqlc.embed(a)" + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/input.sql b/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/input.sql new file mode 100644 index 0000000000..86af411c74 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/input.sql @@ -0,0 +1 @@ +SELECT sqlc.embed("Users") FROM "Users"; diff --git a/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/output.sql b/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/output.sql new file mode 100644 index 0000000000..390936296b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/output.sql @@ -0,0 +1 @@ +SELECT "Users".* FROM "Users"; diff --git a/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/side_table.json b/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/side_table.json new file mode 100644 index 0000000000..02f9e3ddb4 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/side_table.json @@ -0,0 +1,15 @@ +[ + { + "start": 0, + "end": 30, + "dollar": true, + "embeds": [ + { + "table": "Users", + "location": 7, + "origin": 7, + "orig": "sqlc.embed(\"Users\")" + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/embed_string_constant/input.sql b/internal/sql/preprocess/testdata/postgresql/embed_string_constant/input.sql new file mode 100644 index 0000000000..77203a9818 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_string_constant/input.sql @@ -0,0 +1 @@ +SELECT sqlc.embed('t') FROM t; diff --git a/internal/sql/preprocess/testdata/postgresql/embed_string_constant/output.sql b/internal/sql/preprocess/testdata/postgresql/embed_string_constant/output.sql new file mode 100644 index 0000000000..269c8bb8c7 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_string_constant/output.sql @@ -0,0 +1 @@ +SELECT t.* FROM t; diff --git a/internal/sql/preprocess/testdata/postgresql/embed_string_constant/side_table.json b/internal/sql/preprocess/testdata/postgresql/embed_string_constant/side_table.json new file mode 100644 index 0000000000..b7b97cfaf3 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_string_constant/side_table.json @@ -0,0 +1,15 @@ +[ + { + "start": 0, + "end": 18, + "dollar": true, + "embeds": [ + { + "table": "t", + "location": 7, + "origin": 7, + "orig": "sqlc.embed(t)" + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/embed_with_args/input.sql b/internal/sql/preprocess/testdata/postgresql/embed_with_args/input.sql new file mode 100644 index 0000000000..68b9efb581 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_with_args/input.sql @@ -0,0 +1 @@ +SELECT sqlc.embed(a), b.name FROM a JOIN b ON b.id = a.b_id WHERE a.id = sqlc.arg(id); diff --git a/internal/sql/preprocess/testdata/postgresql/embed_with_args/output.sql b/internal/sql/preprocess/testdata/postgresql/embed_with_args/output.sql new file mode 100644 index 0000000000..aaa0860aa2 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_with_args/output.sql @@ -0,0 +1 @@ +SELECT a.*, b.name FROM a JOIN b ON b.id = a.b_id WHERE a.id = $1; diff --git a/internal/sql/preprocess/testdata/postgresql/embed_with_args/side_table.json b/internal/sql/preprocess/testdata/postgresql/embed_with_args/side_table.json new file mode 100644 index 0000000000..93a6a0f157 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/embed_with_args/side_table.json @@ -0,0 +1,24 @@ +[ + { + "start": 0, + "end": 66, + "dollar": true, + "params": [ + { + "number": 1, + "location": 63, + "origin": 73, + "name": "id", + "named": true + } + ], + "embeds": [ + { + "table": "a", + "location": 7, + "origin": 7, + "orig": "sqlc.embed(a)" + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/input.sql b/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/input.sql new file mode 100644 index 0000000000..f1f94d0d0a --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/input.sql @@ -0,0 +1,2 @@ +SELECT sqlc.argh(a); +SELECT sqlc.arg(b); diff --git a/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/output.sql b/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/output.sql new file mode 100644 index 0000000000..43f926284c --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/output.sql @@ -0,0 +1,2 @@ +SELECT sqlc.argh(a); +SELECT $1; diff --git a/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/side_table.json b/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/side_table.json new file mode 100644 index 0000000000..e4c5d10b30 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 20, + "dollar": true, + "error": "function \"sqlc.argh\" does not exist", + "error_at": 7 + }, + { + "start": 20, + "end": 31, + "dollar": true, + "params": [ + { + "number": 1, + "location": 28, + "origin": 28, + "name": "b", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/stderr.txt b/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/stderr.txt new file mode 100644 index 0000000000..c55d98608c --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_is_per_statement/stderr.txt @@ -0,0 +1 @@ +1:8: function "sqlc.argh" does not exist diff --git a/internal/sql/preprocess/testdata/postgresql/error_nested_call/input.sql b/internal/sql/preprocess/testdata/postgresql/error_nested_call/input.sql new file mode 100644 index 0000000000..e8d7485252 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_nested_call/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg(sqlc.arg(a)); diff --git a/internal/sql/preprocess/testdata/postgresql/error_nested_call/output.sql b/internal/sql/preprocess/testdata/postgresql/error_nested_call/output.sql new file mode 100644 index 0000000000..e8d7485252 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_nested_call/output.sql @@ -0,0 +1 @@ +SELECT sqlc.arg(sqlc.arg(a)); diff --git a/internal/sql/preprocess/testdata/postgresql/error_nested_call/side_table.json b/internal/sql/preprocess/testdata/postgresql/error_nested_call/side_table.json new file mode 100644 index 0000000000..988c57ab6e --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_nested_call/side_table.json @@ -0,0 +1,9 @@ +[ + { + "start": 0, + "end": 29, + "dollar": true, + "error": "expected parameter to sqlc.arg to be string or reference; got \"sqlc.arg(a)\"", + "error_at": 7 + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/error_nested_call/stderr.txt b/internal/sql/preprocess/testdata/postgresql/error_nested_call/stderr.txt new file mode 100644 index 0000000000..7faabf74a6 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_nested_call/stderr.txt @@ -0,0 +1 @@ +1:8: expected parameter to sqlc.arg to be string or reference; got "sqlc.arg(a)" diff --git a/internal/sql/preprocess/testdata/postgresql/error_no_arguments/input.sql b/internal/sql/preprocess/testdata/postgresql/error_no_arguments/input.sql new file mode 100644 index 0000000000..540bfb17b1 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_no_arguments/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg(); diff --git a/internal/sql/preprocess/testdata/postgresql/error_no_arguments/output.sql b/internal/sql/preprocess/testdata/postgresql/error_no_arguments/output.sql new file mode 100644 index 0000000000..540bfb17b1 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_no_arguments/output.sql @@ -0,0 +1 @@ +SELECT sqlc.arg(); diff --git a/internal/sql/preprocess/testdata/postgresql/error_no_arguments/side_table.json b/internal/sql/preprocess/testdata/postgresql/error_no_arguments/side_table.json new file mode 100644 index 0000000000..3f37493ae4 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_no_arguments/side_table.json @@ -0,0 +1,9 @@ +[ + { + "start": 0, + "end": 18, + "dollar": true, + "error": "expected 1 parameter to sqlc.arg; got 0", + "error_at": 7 + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/error_no_arguments/stderr.txt b/internal/sql/preprocess/testdata/postgresql/error_no_arguments/stderr.txt new file mode 100644 index 0000000000..46c7fcd096 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_no_arguments/stderr.txt @@ -0,0 +1 @@ +1:8: expected 1 parameter to sqlc.arg; got 0 diff --git a/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/input.sql b/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/input.sql new file mode 100644 index 0000000000..5a0ead05c7 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = $2 AND b = $3; diff --git a/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/output.sql b/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/output.sql new file mode 100644 index 0000000000..5a0ead05c7 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = $2 AND b = $3; diff --git a/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/side_table.json b/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/side_table.json new file mode 100644 index 0000000000..18933caa30 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/side_table.json @@ -0,0 +1,22 @@ +[ + { + "start": 0, + "end": 45, + "dollar": true, + "params": [ + { + "number": 2, + "location": 31, + "origin": 31, + "named": false + }, + { + "number": 3, + "location": 42, + "origin": 42, + "named": false + } + ], + "param_error": "could not determine data type of parameter $1" + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/stderr.txt b/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/stderr.txt new file mode 100644 index 0000000000..a9cbefb9c2 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_numbering_gap/stderr.txt @@ -0,0 +1 @@ +1:1: could not determine data type of parameter $1 diff --git a/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/input.sql b/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/input.sql new file mode 100644 index 0000000000..3589b18fb6 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg($1); diff --git a/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/output.sql b/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/output.sql new file mode 100644 index 0000000000..3589b18fb6 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/output.sql @@ -0,0 +1 @@ +SELECT sqlc.arg($1); diff --git a/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/side_table.json b/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/side_table.json new file mode 100644 index 0000000000..918be18b6d --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/side_table.json @@ -0,0 +1,9 @@ +[ + { + "start": 0, + "end": 20, + "dollar": true, + "error": "expected parameter to sqlc.arg to be string or reference; got \"$1\"", + "error_at": 7 + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/stderr.txt b/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/stderr.txt new file mode 100644 index 0000000000..16d54e925a --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/stderr.txt @@ -0,0 +1 @@ +1:8: expected parameter to sqlc.arg to be string or reference; got "$1" diff --git a/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/input.sql b/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/input.sql new file mode 100644 index 0000000000..d5e1c628b6 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg('a', 'b'); diff --git a/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/output.sql b/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/output.sql new file mode 100644 index 0000000000..d5e1c628b6 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/output.sql @@ -0,0 +1 @@ +SELECT sqlc.arg('a', 'b'); diff --git a/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/side_table.json b/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/side_table.json new file mode 100644 index 0000000000..501e713b55 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/side_table.json @@ -0,0 +1,9 @@ +[ + { + "start": 0, + "end": 26, + "dollar": true, + "error": "expected 1 parameter to sqlc.arg; got 2", + "error_at": 7 + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/stderr.txt b/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/stderr.txt new file mode 100644 index 0000000000..92e71bd342 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_too_many_arguments/stderr.txt @@ -0,0 +1 @@ +1:8: expected 1 parameter to sqlc.arg; got 2 diff --git a/internal/sql/preprocess/testdata/postgresql/error_unknown_function/input.sql b/internal/sql/preprocess/testdata/postgresql/error_unknown_function/input.sql new file mode 100644 index 0000000000..5a344b175a --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_unknown_function/input.sql @@ -0,0 +1 @@ +SELECT sqlc.argh(a); diff --git a/internal/sql/preprocess/testdata/postgresql/error_unknown_function/output.sql b/internal/sql/preprocess/testdata/postgresql/error_unknown_function/output.sql new file mode 100644 index 0000000000..5a344b175a --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_unknown_function/output.sql @@ -0,0 +1 @@ +SELECT sqlc.argh(a); diff --git a/internal/sql/preprocess/testdata/postgresql/error_unknown_function/side_table.json b/internal/sql/preprocess/testdata/postgresql/error_unknown_function/side_table.json new file mode 100644 index 0000000000..99e103eaa7 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_unknown_function/side_table.json @@ -0,0 +1,9 @@ +[ + { + "start": 0, + "end": 20, + "dollar": true, + "error": "function \"sqlc.argh\" does not exist", + "error_at": 7 + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/error_unknown_function/stderr.txt b/internal/sql/preprocess/testdata/postgresql/error_unknown_function/stderr.txt new file mode 100644 index 0000000000..c55d98608c --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/error_unknown_function/stderr.txt @@ -0,0 +1 @@ +1:8: function "sqlc.argh" does not exist diff --git a/internal/sql/preprocess/testdata/postgresql/existing_placeholder/input.sql b/internal/sql/preprocess/testdata/postgresql/existing_placeholder/input.sql new file mode 100644 index 0000000000..1d7497ac8b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/existing_placeholder/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = $1 AND b = sqlc.arg(x); diff --git a/internal/sql/preprocess/testdata/postgresql/existing_placeholder/output.sql b/internal/sql/preprocess/testdata/postgresql/existing_placeholder/output.sql new file mode 100644 index 0000000000..1742cc3d85 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/existing_placeholder/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = $1 AND b = $2; diff --git a/internal/sql/preprocess/testdata/postgresql/existing_placeholder/side_table.json b/internal/sql/preprocess/testdata/postgresql/existing_placeholder/side_table.json new file mode 100644 index 0000000000..8f0974672b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/existing_placeholder/side_table.json @@ -0,0 +1,22 @@ +[ + { + "start": 0, + "end": 45, + "dollar": true, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "named": false + }, + { + "number": 2, + "location": 42, + "origin": 42, + "name": "x", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/extra_whitespace/input.sql b/internal/sql/preprocess/testdata/postgresql/extra_whitespace/input.sql new file mode 100644 index 0000000000..1ddb921525 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/extra_whitespace/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg ( name ), sqlc . arg(other); diff --git a/internal/sql/preprocess/testdata/postgresql/extra_whitespace/output.sql b/internal/sql/preprocess/testdata/postgresql/extra_whitespace/output.sql new file mode 100644 index 0000000000..ca9e5428bf --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/extra_whitespace/output.sql @@ -0,0 +1 @@ +SELECT $1, $2; diff --git a/internal/sql/preprocess/testdata/postgresql/extra_whitespace/side_table.json b/internal/sql/preprocess/testdata/postgresql/extra_whitespace/side_table.json new file mode 100644 index 0000000000..58dc58d402 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/extra_whitespace/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 14, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "name", + "named": true + }, + { + "number": 2, + "location": 11, + "origin": 28, + "name": "other", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/input.sql b/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/input.sql new file mode 100644 index 0000000000..523e2d7ef0 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/input.sql @@ -0,0 +1,2 @@ +SELECT * FROM transactions +WHERE jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb(sqlc.arg('data')::text); diff --git a/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/output.sql b/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/output.sql new file mode 100644 index 0000000000..acc0a99dc5 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/output.sql @@ -0,0 +1,2 @@ +SELECT * FROM transactions +WHERE jsonb_extract_path(transactions.data, '$.transaction.signatures[0]') @> to_jsonb($1::text); diff --git a/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/side_table.json b/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/side_table.json new file mode 100644 index 0000000000..36f37fe0bb --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/jsonb_operator_and_path_string/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 124, + "dollar": true, + "params": [ + { + "number": 1, + "location": 114, + "origin": 114, + "name": "data", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/multiline_call/input.sql b/internal/sql/preprocess/testdata/postgresql/multiline_call/input.sql new file mode 100644 index 0000000000..d377f42ba0 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/multiline_call/input.sql @@ -0,0 +1,3 @@ +SELECT sqlc.arg( + name +); diff --git a/internal/sql/preprocess/testdata/postgresql/multiline_call/output.sql b/internal/sql/preprocess/testdata/postgresql/multiline_call/output.sql new file mode 100644 index 0000000000..37699f7c74 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/multiline_call/output.sql @@ -0,0 +1 @@ +SELECT $1; diff --git a/internal/sql/preprocess/testdata/postgresql/multiline_call/side_table.json b/internal/sql/preprocess/testdata/postgresql/multiline_call/side_table.json new file mode 100644 index 0000000000..80979ab73b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/multiline_call/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 10, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "name", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/narg/input.sql b/internal/sql/preprocess/testdata/postgresql/narg/input.sql new file mode 100644 index 0000000000..7e5109ad6e --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/narg/input.sql @@ -0,0 +1,2 @@ +-- name: GetUser :one +SELECT id FROM users WHERE name = sqlc.narg(name); diff --git a/internal/sql/preprocess/testdata/postgresql/narg/output.sql b/internal/sql/preprocess/testdata/postgresql/narg/output.sql new file mode 100644 index 0000000000..e6d2e2ea8a --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/narg/output.sql @@ -0,0 +1,2 @@ +-- name: GetUser :one +SELECT id FROM users WHERE name = $1; diff --git a/internal/sql/preprocess/testdata/postgresql/narg/side_table.json b/internal/sql/preprocess/testdata/postgresql/narg/side_table.json new file mode 100644 index 0000000000..7d3175896b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/narg/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 59, + "dollar": true, + "params": [ + { + "number": 1, + "location": 56, + "origin": 56, + "name": "name", + "named": true, + "nullable": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/narg_string_constant/input.sql b/internal/sql/preprocess/testdata/postgresql/narg_string_constant/input.sql new file mode 100644 index 0000000000..1563e71033 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/narg_string_constant/input.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE name = COALESCE(sqlc.narg('name'), name); diff --git a/internal/sql/preprocess/testdata/postgresql/narg_string_constant/output.sql b/internal/sql/preprocess/testdata/postgresql/narg_string_constant/output.sql new file mode 100644 index 0000000000..50612d0580 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/narg_string_constant/output.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE name = COALESCE($1, name); diff --git a/internal/sql/preprocess/testdata/postgresql/narg_string_constant/side_table.json b/internal/sql/preprocess/testdata/postgresql/narg_string_constant/side_table.json new file mode 100644 index 0000000000..a076148449 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/narg_string_constant/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 52, + "dollar": true, + "params": [ + { + "number": 1, + "location": 42, + "origin": 42, + "name": "name", + "named": true, + "nullable": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/input.sql b/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/input.sql new file mode 100644 index 0000000000..80e729d3de --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/input.sql @@ -0,0 +1,2 @@ +SELECT sqlc.arg(a); +SELECT sqlc.arg(b); diff --git a/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/output.sql b/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/output.sql new file mode 100644 index 0000000000..aa0274e34d --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/output.sql @@ -0,0 +1,2 @@ +SELECT $1; +SELECT $1; diff --git a/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/side_table.json b/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/side_table.json new file mode 100644 index 0000000000..2921bcb179 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/numbering_restarts_per_statement/side_table.json @@ -0,0 +1,30 @@ +[ + { + "start": 0, + "end": 10, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "a", + "named": true + } + ] + }, + { + "start": 10, + "end": 21, + "dollar": true, + "params": [ + { + "number": 1, + "location": 18, + "origin": 27, + "name": "b", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/quoted_names/input.sql b/internal/sql/preprocess/testdata/postgresql/quoted_names/input.sql new file mode 100644 index 0000000000..155e2f5963 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/quoted_names/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg('a'), sqlc.arg("b"); diff --git a/internal/sql/preprocess/testdata/postgresql/quoted_names/output.sql b/internal/sql/preprocess/testdata/postgresql/quoted_names/output.sql new file mode 100644 index 0000000000..ca9e5428bf --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/quoted_names/output.sql @@ -0,0 +1 @@ +SELECT $1, $2; diff --git a/internal/sql/preprocess/testdata/postgresql/quoted_names/side_table.json b/internal/sql/preprocess/testdata/postgresql/quoted_names/side_table.json new file mode 100644 index 0000000000..c6fedbd2fa --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/quoted_names/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 14, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "a", + "named": true + }, + { + "number": 2, + "location": 11, + "origin": 22, + "name": "b", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/repeated_name/input.sql b/internal/sql/preprocess/testdata/postgresql/repeated_name/input.sql new file mode 100644 index 0000000000..1f6121aa81 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/repeated_name/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = sqlc.arg(x) OR b = sqlc.arg(x) OR c = sqlc.arg(y); diff --git a/internal/sql/preprocess/testdata/postgresql/repeated_name/output.sql b/internal/sql/preprocess/testdata/postgresql/repeated_name/output.sql new file mode 100644 index 0000000000..b138d6c0cc --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/repeated_name/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = $1 OR b = $1 OR c = $2; diff --git a/internal/sql/preprocess/testdata/postgresql/repeated_name/side_table.json b/internal/sql/preprocess/testdata/postgresql/repeated_name/side_table.json new file mode 100644 index 0000000000..4203a72bca --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/repeated_name/side_table.json @@ -0,0 +1,30 @@ +[ + { + "start": 0, + "end": 54, + "dollar": true, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "name": "x", + "named": true + }, + { + "number": 1, + "location": 41, + "origin": 50, + "name": "x", + "named": true + }, + { + "number": 2, + "location": 51, + "origin": 69, + "name": "y", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_block_comment/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_block_comment/input.sql new file mode 100644 index 0000000000..eb0245e5c0 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_block_comment/input.sql @@ -0,0 +1,3 @@ +/* sqlc.arg(nope) + @nope */ +SELECT 1; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_block_comment/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_block_comment/output.sql new file mode 100644 index 0000000000..eb0245e5c0 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_block_comment/output.sql @@ -0,0 +1,3 @@ +/* sqlc.arg(nope) + @nope */ +SELECT 1; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_block_comment/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_block_comment/side_table.json new file mode 100644 index 0000000000..33fdd7c2f2 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_block_comment/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 39, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/input.sql new file mode 100644 index 0000000000..448b6aef67 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/input.sql @@ -0,0 +1 @@ +CREATE FUNCTION f() RETURNS int AS $$ SELECT sqlc.arg(nope); $$ LANGUAGE sql; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/output.sql new file mode 100644 index 0000000000..448b6aef67 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/output.sql @@ -0,0 +1 @@ +CREATE FUNCTION f() RETURNS int AS $$ SELECT sqlc.arg(nope); $$ LANGUAGE sql; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/side_table.json new file mode 100644 index 0000000000..d67323c3c8 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_dollar_quoted/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 77, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_escape_string/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_escape_string/input.sql new file mode 100644 index 0000000000..800fd62008 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_escape_string/input.sql @@ -0,0 +1 @@ +SELECT E'\' sqlc.arg(nope)'; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_escape_string/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_escape_string/output.sql new file mode 100644 index 0000000000..800fd62008 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_escape_string/output.sql @@ -0,0 +1 @@ +SELECT E'\' sqlc.arg(nope)'; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_escape_string/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_escape_string/side_table.json new file mode 100644 index 0000000000..7ab9eaedd2 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_escape_string/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 28, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/input.sql new file mode 100644 index 0000000000..a41da4767c --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/input.sql @@ -0,0 +1 @@ +SELECT 1 FROM t WHERE a @> b AND j ? 'a'; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/output.sql new file mode 100644 index 0000000000..a41da4767c --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/output.sql @@ -0,0 +1 @@ +SELECT 1 FROM t WHERE a @> b AND j ? 'a'; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/side_table.json new file mode 100644 index 0000000000..85b41b892c --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_jsonb_operators/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 41, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_line_comment/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_line_comment/input.sql new file mode 100644 index 0000000000..b718e04c02 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_line_comment/input.sql @@ -0,0 +1,2 @@ +-- name: Get :one -- sqlc.arg(nope) @nope +SELECT 1; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_line_comment/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_line_comment/output.sql new file mode 100644 index 0000000000..b718e04c02 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_line_comment/output.sql @@ -0,0 +1,2 @@ +-- name: Get :one -- sqlc.arg(nope) @nope +SELECT 1; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_line_comment/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_line_comment/side_table.json new file mode 100644 index 0000000000..93bd6b47a1 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_line_comment/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 51, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/input.sql new file mode 100644 index 0000000000..46ac007ae0 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/input.sql @@ -0,0 +1 @@ +/* /* sqlc.arg(nope) */ @nope */ SELECT 1; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/output.sql new file mode 100644 index 0000000000..46ac007ae0 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/output.sql @@ -0,0 +1 @@ +/* /* sqlc.arg(nope) */ @nope */ SELECT 1; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/side_table.json new file mode 100644 index 0000000000..05701e1815 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_nested_block_comment/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 42, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/input.sql new file mode 100644 index 0000000000..07cf2dc8da --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/input.sql @@ -0,0 +1 @@ +SELECT sqlcx.arg(a), other.embed(b); diff --git a/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/output.sql new file mode 100644 index 0000000000..07cf2dc8da --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/output.sql @@ -0,0 +1 @@ +SELECT sqlcx.arg(a), other.embed(b); diff --git a/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/side_table.json new file mode 100644 index 0000000000..c279f2b3d7 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_other_schemas/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 36, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/input.sql new file mode 100644 index 0000000000..3fb25577ba --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/input.sql @@ -0,0 +1 @@ +SELECT "sqlc.arg(nope)" FROM t; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/output.sql new file mode 100644 index 0000000000..3fb25577ba --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/output.sql @@ -0,0 +1 @@ +SELECT "sqlc.arg(nope)" FROM t; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/side_table.json new file mode 100644 index 0000000000..cdde9a6d54 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_quoted_identifier/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 31, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_string_literal/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_string_literal/input.sql new file mode 100644 index 0000000000..4e5ef9f87f --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_string_literal/input.sql @@ -0,0 +1 @@ +SELECT 'sqlc.arg(nope) @nope'; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_string_literal/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_string_literal/output.sql new file mode 100644 index 0000000000..4e5ef9f87f --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_string_literal/output.sql @@ -0,0 +1 @@ +SELECT 'sqlc.arg(nope) @nope'; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_string_literal/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_string_literal/side_table.json new file mode 100644 index 0000000000..06317d80bf --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_string_literal/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 30, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/input.sql b/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/input.sql new file mode 100644 index 0000000000..8b4be6fdd8 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/input.sql @@ -0,0 +1 @@ +SELECT $tag$ sqlc.arg(nope) @nope $tag$; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/output.sql b/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/output.sql new file mode 100644 index 0000000000..8b4be6fdd8 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/output.sql @@ -0,0 +1 @@ +SELECT $tag$ sqlc.arg(nope) @nope $tag$; diff --git a/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/side_table.json b/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/side_table.json new file mode 100644 index 0000000000..3bd689e974 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/skip_tagged_dollar_quoted/side_table.json @@ -0,0 +1,7 @@ +[ + { + "start": 0, + "end": 40, + "dollar": true + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/input.sql b/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/input.sql new file mode 100644 index 0000000000..0c69e21e7f --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE id = ANY(sqlc.slice(ids)); diff --git a/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/output.sql b/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/output.sql new file mode 100644 index 0000000000..06bb99772d --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE id = ANY($1); diff --git a/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/side_table.json b/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/side_table.json new file mode 100644 index 0000000000..f9350ea654 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/slice_is_an_array/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 40, + "dollar": true, + "params": [ + { + "number": 1, + "location": 36, + "origin": 36, + "name": "ids", + "named": true, + "slice": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/slice_string_constant/input.sql b/internal/sql/preprocess/testdata/postgresql/slice_string_constant/input.sql new file mode 100644 index 0000000000..3132a9fa60 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/slice_string_constant/input.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE id = ANY(sqlc.slice('ids')); diff --git a/internal/sql/preprocess/testdata/postgresql/slice_string_constant/output.sql b/internal/sql/preprocess/testdata/postgresql/slice_string_constant/output.sql new file mode 100644 index 0000000000..bd7ba1f310 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/slice_string_constant/output.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE id = ANY($1); diff --git a/internal/sql/preprocess/testdata/postgresql/slice_string_constant/side_table.json b/internal/sql/preprocess/testdata/postgresql/slice_string_constant/side_table.json new file mode 100644 index 0000000000..d7f67eea34 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/slice_string_constant/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 39, + "dollar": true, + "params": [ + { + "number": 1, + "location": 35, + "origin": 35, + "name": "ids", + "named": true, + "slice": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/input.sql b/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/input.sql new file mode 100644 index 0000000000..1d254ec1a0 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/input.sql @@ -0,0 +1,2 @@ +SELECT ';', sqlc.arg(a); +SELECT sqlc.arg(b); diff --git a/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/output.sql b/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/output.sql new file mode 100644 index 0000000000..f5baebfc00 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/output.sql @@ -0,0 +1,2 @@ +SELECT ';', $1; +SELECT $1; diff --git a/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/side_table.json b/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/side_table.json new file mode 100644 index 0000000000..a3e7e0545b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/statement_terminator_in_string/side_table.json @@ -0,0 +1,30 @@ +[ + { + "start": 0, + "end": 15, + "dollar": true, + "params": [ + { + "number": 1, + "location": 12, + "origin": 12, + "name": "a", + "named": true + } + ] + }, + { + "start": 15, + "end": 26, + "dollar": true, + "params": [ + { + "number": 1, + "location": 23, + "origin": 32, + "name": "b", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/input.sql b/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/input.sql new file mode 100644 index 0000000000..1643d3792c --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg('it''s'); diff --git a/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/output.sql b/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/output.sql new file mode 100644 index 0000000000..37699f7c74 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/output.sql @@ -0,0 +1 @@ +SELECT $1; diff --git a/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/side_table.json b/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/side_table.json new file mode 100644 index 0000000000..5c7870733f --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/string_constant_escaped_quote/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 10, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "it's", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/input.sql b/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/input.sql new file mode 100644 index 0000000000..beec84e61c --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/input.sql @@ -0,0 +1 @@ +SELECT sqlc.arg('MixedCase'), sqlc.arg(MixedCase); diff --git a/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/output.sql b/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/output.sql new file mode 100644 index 0000000000..ca9e5428bf --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/output.sql @@ -0,0 +1 @@ +SELECT $1, $2; diff --git a/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/side_table.json b/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/side_table.json new file mode 100644 index 0000000000..48ccbea4b5 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/string_constant_keeps_case/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 14, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "MixedCase", + "named": true + }, + { + "number": 2, + "location": 11, + "origin": 30, + "name": "mixedcase", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/postgresql/uppercase/input.sql b/internal/sql/preprocess/testdata/postgresql/uppercase/input.sql new file mode 100644 index 0000000000..4931f5942b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/uppercase/input.sql @@ -0,0 +1 @@ +SELECT SQLC.ARG(name); diff --git a/internal/sql/preprocess/testdata/postgresql/uppercase/output.sql b/internal/sql/preprocess/testdata/postgresql/uppercase/output.sql new file mode 100644 index 0000000000..37699f7c74 --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/uppercase/output.sql @@ -0,0 +1 @@ +SELECT $1; diff --git a/internal/sql/preprocess/testdata/postgresql/uppercase/side_table.json b/internal/sql/preprocess/testdata/postgresql/uppercase/side_table.json new file mode 100644 index 0000000000..80979ab73b --- /dev/null +++ b/internal/sql/preprocess/testdata/postgresql/uppercase/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 10, + "dollar": true, + "params": [ + { + "number": 1, + "location": 7, + "origin": 7, + "name": "name", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/arg/input.sql b/internal/sql/preprocess/testdata/sqlite/arg/input.sql new file mode 100644 index 0000000000..238d2d1c85 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/arg/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = sqlc.arg(x) AND b = sqlc.arg(y); diff --git a/internal/sql/preprocess/testdata/sqlite/arg/output.sql b/internal/sql/preprocess/testdata/sqlite/arg/output.sql new file mode 100644 index 0000000000..8d719f8cc6 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/arg/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ?1 AND b = ?2; diff --git a/internal/sql/preprocess/testdata/sqlite/arg/side_table.json b/internal/sql/preprocess/testdata/sqlite/arg/side_table.json new file mode 100644 index 0000000000..1e687873c6 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/arg/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 45, + "dollar": true, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "name": "x", + "named": true + }, + { + "number": 2, + "location": 42, + "origin": 51, + "name": "y", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/at_sign/input.sql b/internal/sql/preprocess/testdata/sqlite/at_sign/input.sql new file mode 100644 index 0000000000..00688da206 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/at_sign/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE name = @name; diff --git a/internal/sql/preprocess/testdata/sqlite/at_sign/output.sql b/internal/sql/preprocess/testdata/sqlite/at_sign/output.sql new file mode 100644 index 0000000000..e232a5b5bc --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/at_sign/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE name = ?1; diff --git a/internal/sql/preprocess/testdata/sqlite/at_sign/side_table.json b/internal/sql/preprocess/testdata/sqlite/at_sign/side_table.json new file mode 100644 index 0000000000..5b95487501 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/at_sign/side_table.json @@ -0,0 +1,16 @@ +[ + { + "start": 0, + "end": 37, + "dollar": true, + "params": [ + { + "number": 1, + "location": 34, + "origin": 34, + "name": "name", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/embed/input.sql b/internal/sql/preprocess/testdata/sqlite/embed/input.sql new file mode 100644 index 0000000000..2c00b3bee4 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/embed/input.sql @@ -0,0 +1 @@ +SELECT sqlc.embed(users) FROM users WHERE id = sqlc.arg(id); diff --git a/internal/sql/preprocess/testdata/sqlite/embed/output.sql b/internal/sql/preprocess/testdata/sqlite/embed/output.sql new file mode 100644 index 0000000000..022b9929db --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/embed/output.sql @@ -0,0 +1 @@ +SELECT users.* FROM users WHERE id = ?1; diff --git a/internal/sql/preprocess/testdata/sqlite/embed/side_table.json b/internal/sql/preprocess/testdata/sqlite/embed/side_table.json new file mode 100644 index 0000000000..2a2c4fc4ad --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/embed/side_table.json @@ -0,0 +1,24 @@ +[ + { + "start": 0, + "end": 40, + "dollar": true, + "params": [ + { + "number": 1, + "location": 37, + "origin": 47, + "name": "id", + "named": true + } + ], + "embeds": [ + { + "table": "users", + "location": 7, + "origin": 7, + "orig": "sqlc.embed(users)" + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/input.sql b/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/input.sql new file mode 100644 index 0000000000..51f7ddb8ee --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/input.sql @@ -0,0 +1,11 @@ +-- name: WrongFunc :one +SELECT id FROM users WHERE id = sqlc.argh(target_id); + +-- name: TooManyArgs :one +SELECT id FROM users WHERE id = sqlc.arg('foo', 'bar'); + +-- name: TooFewArgs :one +SELECT id FROM users WHERE id = sqlc.arg(); + +-- name: InvalidArgPlaceholder :one +SELECT id FROM users WHERE id = sqlc.arg(?); diff --git a/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/output.sql b/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/output.sql new file mode 100644 index 0000000000..51f7ddb8ee --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/output.sql @@ -0,0 +1,11 @@ +-- name: WrongFunc :one +SELECT id FROM users WHERE id = sqlc.argh(target_id); + +-- name: TooManyArgs :one +SELECT id FROM users WHERE id = sqlc.arg('foo', 'bar'); + +-- name: TooFewArgs :one +SELECT id FROM users WHERE id = sqlc.arg(); + +-- name: InvalidArgPlaceholder :one +SELECT id FROM users WHERE id = sqlc.arg(?); diff --git a/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/side_table.json b/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/side_table.json new file mode 100644 index 0000000000..a36ba15e41 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/side_table.json @@ -0,0 +1,30 @@ +[ + { + "start": 0, + "end": 77, + "dollar": true, + "error": "function \"sqlc.argh\" does not exist", + "error_at": 56 + }, + { + "start": 77, + "end": 160, + "dollar": true, + "error": "expected 1 parameter to sqlc.arg; got 2", + "error_at": 137 + }, + { + "start": 160, + "end": 230, + "dollar": true, + "error": "expected 1 parameter to sqlc.arg; got 0", + "error_at": 219 + }, + { + "start": 230, + "end": 312, + "dollar": true, + "error": "expected parameter to sqlc.arg to be string or reference; got \"?\"", + "error_at": 300 + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/stderr.txt b/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/stderr.txt new file mode 100644 index 0000000000..aae154ee46 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/error_invalid_calls/stderr.txt @@ -0,0 +1,4 @@ +2:33: function "sqlc.argh" does not exist +5:33: expected 1 parameter to sqlc.arg; got 2 +8:33: expected 1 parameter to sqlc.arg; got 0 +11:33: expected parameter to sqlc.arg to be string or reference; got "?" diff --git a/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/input.sql b/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/input.sql new file mode 100644 index 0000000000..0c98f3e515 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ?1 AND b = ?; diff --git a/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/output.sql b/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/output.sql new file mode 100644 index 0000000000..0c98f3e515 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ?1 AND b = ?; diff --git a/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/side_table.json b/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/side_table.json new file mode 100644 index 0000000000..ae8f878474 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/side_table.json @@ -0,0 +1,22 @@ +[ + { + "start": 0, + "end": 44, + "dollar": false, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "named": false + }, + { + "number": 2, + "location": 42, + "origin": 42, + "named": false + } + ], + "param_error": "can not mix $1 format with ? format" + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/stderr.txt b/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/stderr.txt new file mode 100644 index 0000000000..9d9039890f --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/error_mixed_placeholder_styles/stderr.txt @@ -0,0 +1 @@ +1:1: can not mix $1 format with ? format diff --git a/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/input.sql b/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/input.sql new file mode 100644 index 0000000000..838caa52c8 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ?1 AND b = sqlc.arg(x); diff --git a/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/output.sql b/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/output.sql new file mode 100644 index 0000000000..8d719f8cc6 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ?1 AND b = ?2; diff --git a/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/side_table.json b/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/side_table.json new file mode 100644 index 0000000000..8f0974672b --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/existing_numbered_placeholder/side_table.json @@ -0,0 +1,22 @@ +[ + { + "start": 0, + "end": 45, + "dollar": true, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "named": false + }, + { + "number": 2, + "location": 42, + "origin": 42, + "name": "x", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/narg_identifier/input.sql b/internal/sql/preprocess/testdata/sqlite/narg_identifier/input.sql new file mode 100644 index 0000000000..c36f3d6aaa --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/narg_identifier/input.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE name = sqlc.narg(name); diff --git a/internal/sql/preprocess/testdata/sqlite/narg_identifier/output.sql b/internal/sql/preprocess/testdata/sqlite/narg_identifier/output.sql new file mode 100644 index 0000000000..58a07d1185 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/narg_identifier/output.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE name = ?1; diff --git a/internal/sql/preprocess/testdata/sqlite/narg_identifier/side_table.json b/internal/sql/preprocess/testdata/sqlite/narg_identifier/side_table.json new file mode 100644 index 0000000000..dfa9deb94a --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/narg_identifier/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 36, + "dollar": true, + "params": [ + { + "number": 1, + "location": 33, + "origin": 33, + "name": "name", + "named": true, + "nullable": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/repeated_name/input.sql b/internal/sql/preprocess/testdata/sqlite/repeated_name/input.sql new file mode 100644 index 0000000000..180ea26b3b --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/repeated_name/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = sqlc.arg(x) AND b = sqlc.arg(x); diff --git a/internal/sql/preprocess/testdata/sqlite/repeated_name/output.sql b/internal/sql/preprocess/testdata/sqlite/repeated_name/output.sql new file mode 100644 index 0000000000..143e91e71b --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/repeated_name/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE a = ?1 AND b = ?1; diff --git a/internal/sql/preprocess/testdata/sqlite/repeated_name/side_table.json b/internal/sql/preprocess/testdata/sqlite/repeated_name/side_table.json new file mode 100644 index 0000000000..490774d5fd --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/repeated_name/side_table.json @@ -0,0 +1,23 @@ +[ + { + "start": 0, + "end": 45, + "dollar": true, + "params": [ + { + "number": 1, + "location": 31, + "origin": 31, + "name": "x", + "named": true + }, + { + "number": 1, + "location": 42, + "origin": 51, + "name": "x", + "named": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/slice/input.sql b/internal/sql/preprocess/testdata/sqlite/slice/input.sql new file mode 100644 index 0000000000..f5d89640d7 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/slice/input.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE id IN (sqlc.slice(ids)); diff --git a/internal/sql/preprocess/testdata/sqlite/slice/output.sql b/internal/sql/preprocess/testdata/sqlite/slice/output.sql new file mode 100644 index 0000000000..542215158c --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/slice/output.sql @@ -0,0 +1 @@ +SELECT id FROM users WHERE id IN (/*SLICE:ids*/?); diff --git a/internal/sql/preprocess/testdata/sqlite/slice/side_table.json b/internal/sql/preprocess/testdata/sqlite/slice/side_table.json new file mode 100644 index 0000000000..4b16794ab9 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/slice/side_table.json @@ -0,0 +1,17 @@ +[ + { + "start": 0, + "end": 50, + "dollar": true, + "params": [ + { + "number": 1, + "location": 47, + "origin": 34, + "name": "ids", + "named": true, + "slice": true + } + ] + } +] diff --git a/internal/sql/preprocess/testdata/sqlite/string_constant/input.sql b/internal/sql/preprocess/testdata/sqlite/string_constant/input.sql new file mode 100644 index 0000000000..3efd6a9c11 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/string_constant/input.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE a = sqlc.arg('x') AND b = sqlc.narg('y') AND c IN (sqlc.slice('ids')); diff --git a/internal/sql/preprocess/testdata/sqlite/string_constant/output.sql b/internal/sql/preprocess/testdata/sqlite/string_constant/output.sql new file mode 100644 index 0000000000..ea33ad30e7 --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/string_constant/output.sql @@ -0,0 +1 @@ +SELECT * FROM users WHERE a = ?1 AND b = ?2 AND c IN (/*SLICE:ids*/?); diff --git a/internal/sql/preprocess/testdata/sqlite/string_constant/side_table.json b/internal/sql/preprocess/testdata/sqlite/string_constant/side_table.json new file mode 100644 index 0000000000..f48044c3bc --- /dev/null +++ b/internal/sql/preprocess/testdata/sqlite/string_constant/side_table.json @@ -0,0 +1,32 @@ +[ + { + "start": 0, + "end": 70, + "dollar": true, + "params": [ + { + "number": 1, + "location": 30, + "origin": 30, + "name": "x", + "named": true + }, + { + "number": 2, + "location": 41, + "origin": 52, + "name": "y", + "named": true, + "nullable": true + }, + { + "number": 3, + "location": 67, + "origin": 77, + "name": "ids", + "named": true, + "slice": true + } + ] + } +] diff --git a/internal/sql/rewrite/embeds.go b/internal/sql/rewrite/embeds.go deleted file mode 100644 index 596c03be89..0000000000 --- a/internal/sql/rewrite/embeds.go +++ /dev/null @@ -1,91 +0,0 @@ -package rewrite - -import ( - "fmt" - - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/astutils" -) - -// Embed is an instance of `sqlc.embed(param)` -type Embed struct { - Table *ast.TableName - param string - Node *ast.ColumnRef -} - -// Orig string to replace -func (e Embed) Orig() string { - return fmt.Sprintf("sqlc.embed(%s)", e.param) -} - -// EmbedSet is a set of Embed instances -type EmbedSet []*Embed - -// Find a matching embed by column ref -func (es EmbedSet) Find(node *ast.ColumnRef) (*Embed, bool) { - for _, e := range es { - if e.Node == node { - return e, true - } - } - return nil, false -} - -// Embeds rewrites `sqlc.embed(param)` to a `ast.ColumnRef` of form `param.*`. -// The compiler can make use of the returned `EmbedSet` while expanding the -// `param.*` column refs to produce the correct source edits. -func Embeds(raw *ast.RawStmt) (*ast.RawStmt, EmbedSet) { - var embeds []*Embed - - node := astutils.Apply(raw, func(cr *astutils.Cursor) bool { - node := cr.Node() - - switch { - case isEmbed(node): - fun := node.(*ast.FuncCall) - - if len(fun.Args.Items) == 0 { - return false - } - - param, _ := flatten(fun.Args) - - node := &ast.ColumnRef{ - Fields: &ast.List{ - Items: []ast.Node{ - &ast.String{Str: param}, - &ast.A_Star{}, - }, - }, - } - - embeds = append(embeds, &Embed{ - Table: &ast.TableName{Name: param}, - param: param, - Node: node, - }) - - cr.Replace(node) - return false - default: - return true - } - }, nil) - - return node.(*ast.RawStmt), embeds -} - -func isEmbed(node ast.Node) bool { - call, ok := node.(*ast.FuncCall) - if !ok { - return false - } - - if call.Func == nil { - return false - } - - isValid := call.Func.Schema == "sqlc" && call.Func.Name == "embed" - return isValid -} diff --git a/internal/sql/rewrite/parameters.go b/internal/sql/rewrite/parameters.go deleted file mode 100644 index d1ea1a22cc..0000000000 --- a/internal/sql/rewrite/parameters.go +++ /dev/null @@ -1,192 +0,0 @@ -package rewrite - -import ( - "fmt" - "strings" - - "github.com/sqlc-dev/sqlc/internal/config" - "github.com/sqlc-dev/sqlc/internal/source" - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/astutils" - "github.com/sqlc-dev/sqlc/internal/sql/named" -) - -// Given an AST node, return the string representation of names -func flatten(root ast.Node) (string, bool) { - sw := &stringWalker{} - astutils.Walk(sw, root) - return sw.String, sw.IsConst -} - -type stringWalker struct { - String string - IsConst bool -} - -func (s *stringWalker) Visit(node ast.Node) astutils.Visitor { - if _, ok := node.(*ast.A_Const); ok { - s.IsConst = true - } - if n, ok := node.(*ast.String); ok { - s.String += n.Str - } - return s -} - -func isNamedParamSignCast(node ast.Node) bool { - expr, ok := node.(*ast.A_Expr) - if !ok { - return false - } - _, cast := expr.Rexpr.(*ast.TypeCast) - return astutils.Join(expr.Name, ".") == "@" && cast -} - -// paramFromFuncCall creates a param from sqlc.n?arg() calls return the -// parameter and whether the parameter name was specified a best guess as its -// "source" string representation (used for replacing this function call in the -// original SQL query) -func paramFromFuncCall(call *ast.FuncCall) (named.Param, string) { - paramName, isConst := flatten(call.Args) - - // origName keeps track of how the parameter was specified in the source SQL - origName := paramName - if isConst { - origName = fmt.Sprintf("'%s'", paramName) - } - - var param named.Param - switch call.Func.Name { - case "narg": - param = named.NewUserNullableParam(paramName) - case "slice": - param = named.NewSqlcSlice(paramName) - default: - param = named.NewParam(paramName) - } - - // TODO: This code assumes that sqlc.arg(name) / sqlc.narg(name) is on a single line - // with no extraneous spaces (or any non-significant tokens for that matter) - // except between the function name and argument - funcName := call.Func.Schema + "." + call.Func.Name - spaces := "" - if call.Args != nil && len(call.Args.Items) > 0 { - leftParen := call.Args.Items[0].Pos() - 1 - spaces = strings.Repeat(" ", leftParen-call.Location-len(funcName)) - } - origText := fmt.Sprintf("%s%s(%s)", funcName, spaces, origName) - return param, origText -} - -func NamedParameters(engine config.Engine, raw *ast.RawStmt, numbs map[int]bool, dollar bool) (*ast.RawStmt, *named.ParamSet, []source.Edit) { - foundFunc := astutils.Search(raw, named.IsParamFunc) - foundSign := astutils.Search(raw, named.IsParamSign) - hasNamedParameterSupport := engine != config.EngineMySQL - allParams := named.NewParamSet(numbs, hasNamedParameterSupport) - - if len(foundFunc.Items)+len(foundSign.Items) == 0 { - return raw, allParams, nil - } - - var edits []source.Edit - node := astutils.Apply(raw, func(cr *astutils.Cursor) bool { - node := cr.Node() - switch { - case named.IsParamFunc(node): - fun := node.(*ast.FuncCall) - param, origText := paramFromFuncCall(fun) - argn := allParams.Add(param) - cr.Replace(&ast.ParamRef{ - Number: argn, - Location: fun.Location, - }) - - var replace string - if engine == config.EngineMySQL || engine == config.EngineSQLite || !dollar { - if param.IsSqlcSlice() { - // This sequence is also replicated in internal/codegen/golang.Field - // since it's needed during template generation for replacement - replace = fmt.Sprintf(`/*SLICE:%s*/?`, param.Name()) - } else { - if engine == config.EngineSQLite { - replace = fmt.Sprintf("?%d", argn) - } else { - replace = "?" - } - } - } else { - replace = fmt.Sprintf("$%d", argn) - } - - edits = append(edits, source.Edit{ - Location: fun.Location - raw.StmtLocation, - Old: origText, - New: replace, - }) - return false - - case isNamedParamSignCast(node): - expr := node.(*ast.A_Expr) - cast := expr.Rexpr.(*ast.TypeCast) - paramName, _ := flatten(cast.Arg) - param := named.NewParam(paramName) - - argn := allParams.Add(param) - cast.Arg = &ast.ParamRef{ - Number: argn, - Location: expr.Location, - } - cr.Replace(cast) - - // TODO: This code assumes that @foo::bool is on a single line - var replace string - if engine == config.EngineMySQL || !dollar { - replace = "?" - } else if engine == config.EngineSQLite { - replace = fmt.Sprintf("?%d", argn) - } else { - replace = fmt.Sprintf("$%d", argn) - } - - edits = append(edits, source.Edit{ - Location: expr.Location - raw.StmtLocation, - Old: fmt.Sprintf("@%s", paramName), - New: replace, - }) - return false - - case named.IsParamSign(node): - expr := node.(*ast.A_Expr) - paramName, _ := flatten(expr.Rexpr) - param := named.NewParam(paramName) - - argn := allParams.Add(param) - cr.Replace(&ast.ParamRef{ - Number: argn, - Location: expr.Location, - }) - - // TODO: This code assumes that @foo is on a single line - var replace string - if engine == config.EngineMySQL || !dollar { - replace = "?" - } else if engine == config.EngineSQLite { - replace = fmt.Sprintf("?%d", argn) - } else { - replace = fmt.Sprintf("$%d", argn) - } - - edits = append(edits, source.Edit{ - Location: expr.Location - raw.StmtLocation, - Old: fmt.Sprintf("@%s", paramName), - New: replace, - }) - return false - - default: - return true - } - }, nil) - - return node.(*ast.RawStmt), allParams, edits -} diff --git a/internal/sql/sqlfile/split.go b/internal/sql/sqlfile/split.go new file mode 100644 index 0000000000..b54dc87485 --- /dev/null +++ b/internal/sql/sqlfile/split.go @@ -0,0 +1,241 @@ +package sqlfile + +import ( + "bufio" + "context" + "io" + "strings" +) + +// Split reads SQL queries from an io.Reader and returns them as a slice of strings. +// Each SQL query is delimited by a semicolon (;). +// The function handles: +// - Single-line comments (-- comment) +// - Multi-line comments (/* comment */) +// - Single-quoted strings ('string') +// - Double-quoted identifiers ("identifier") +// - Dollar-quoted strings ($$string$$ or $tag$string$tag$) +func Split(ctx context.Context, r io.Reader) ([]string, error) { + scanner := bufio.NewScanner(r) + var queries []string + var currentQuery strings.Builder + var inSingleQuote bool + var inDoubleQuote bool + var inDollarQuote bool + var dollarTag string + var inMultiLineComment bool + + for scanner.Scan() { + // Check context cancellation + select { + case <-ctx.Done(): + return nil, ctx.Err() + default: + } + + line := scanner.Text() + i := 0 + lineLen := len(line) + + for i < lineLen { + ch := line[i] + + // Handle multi-line comments + if inMultiLineComment { + if i+1 < lineLen && ch == '*' && line[i+1] == '/' { + inMultiLineComment = false + currentQuery.WriteString("*/") + i += 2 + continue + } + currentQuery.WriteByte(ch) + i++ + continue + } + + // Handle dollar-quoted strings (PostgreSQL) + if inDollarQuote { + if ch == '$' { + // Try to match the closing tag + endTag := extractDollarTag(line[i:]) + if endTag == dollarTag { + inDollarQuote = false + currentQuery.WriteString(endTag) + i += len(endTag) + continue + } + } + currentQuery.WriteByte(ch) + i++ + continue + } + + // Handle single-quoted strings + if inSingleQuote { + currentQuery.WriteByte(ch) + if ch == '\'' { + // Check for escaped quote '' + if i+1 < lineLen && line[i+1] == '\'' { + currentQuery.WriteByte('\'') + i += 2 + continue + } + inSingleQuote = false + } + i++ + continue + } + + // Handle double-quoted identifiers + if inDoubleQuote { + currentQuery.WriteByte(ch) + if ch == '"' { + // Check for escaped quote "" + if i+1 < lineLen && line[i+1] == '"' { + currentQuery.WriteByte('"') + i += 2 + continue + } + inDoubleQuote = false + } + i++ + continue + } + + // Check for single-line comment + if i+1 < lineLen && ch == '-' && line[i+1] == '-' { + // Rest of line is a comment + currentQuery.WriteString(line[i:]) + break + } + + // Check for multi-line comment start + if i+1 < lineLen && ch == '/' && line[i+1] == '*' { + inMultiLineComment = true + currentQuery.WriteString("/*") + i += 2 + continue + } + + // Check for dollar quote start + if ch == '$' { + tag := extractDollarTag(line[i:]) + if tag != "" { + inDollarQuote = true + dollarTag = tag + currentQuery.WriteString(tag) + i += len(tag) + continue + } + } + + // Check for single quote + if ch == '\'' { + inSingleQuote = true + currentQuery.WriteByte(ch) + i++ + continue + } + + // Check for double quote + if ch == '"' { + inDoubleQuote = true + currentQuery.WriteByte(ch) + i++ + continue + } + + // Check for semicolon (statement terminator) + if ch == ';' { + currentQuery.WriteByte(ch) + // Check if there's a comment after the semicolon on the same line + i++ + if i < lineLen { + // Skip whitespace + for i < lineLen && (line[i] == ' ' || line[i] == '\t') { + currentQuery.WriteByte(line[i]) + i++ + } + // If there's a comment, include it + if i+1 < lineLen && line[i] == '-' && line[i+1] == '-' { + currentQuery.WriteString(line[i:]) + } + } + query := strings.TrimSpace(currentQuery.String()) + if query != "" && query != ";" { + queries = append(queries, query) + } + currentQuery.Reset() + break // Move to next line + } + + // Regular character + currentQuery.WriteByte(ch) + i++ + } + + // Add newline if we're building a query + if currentQuery.Len() > 0 { + currentQuery.WriteByte('\n') + } + } + + if err := scanner.Err(); err != nil { + return nil, err + } + + // Handle any remaining query + query := strings.TrimSpace(currentQuery.String()) + if query != "" && query != ";" { + queries = append(queries, query) + } + + return queries, nil +} + +// extractDollarTag extracts a dollar-quoted string tag from the beginning of s. +// Returns empty string if no valid dollar tag is found. +// Valid tags: $$ or $identifier$ where identifier contains only alphanumeric and underscore. +func extractDollarTag(s string) string { + if len(s) == 0 || s[0] != '$' { + return "" + } + + // Find the closing $ + for i := 1; i < len(s); i++ { + if s[i] == '$' { + tag := s[:i+1] + // Validate tag content (only alphanumeric and underscore allowed between $) + tagContent := tag[1 : len(tag)-1] + if isValidDollarTagContent(tagContent) { + return tag + } + return "" + } + // If we hit a character that's not allowed in a tag, it's not a dollar quote + if !isValidDollarTagChar(s[i]) { + return "" + } + } + + return "" +} + +// isValidDollarTagContent returns true if s contains only valid characters for a dollar tag. +func isValidDollarTagContent(s string) bool { + if s == "" { + return true // $$ is valid + } + for _, ch := range s { + if !isValidDollarTagChar(byte(ch)) { + return false + } + } + return true +} + +// isValidDollarTagChar returns true if ch is a valid character in a dollar tag. +// Valid characters are alphanumeric and underscore. +func isValidDollarTagChar(ch byte) bool { + return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '_' +} diff --git a/internal/sql/sqlfile/split_test.go b/internal/sql/sqlfile/split_test.go new file mode 100644 index 0000000000..749b0a9d9a --- /dev/null +++ b/internal/sql/sqlfile/split_test.go @@ -0,0 +1,149 @@ +package sqlfile + +import ( + "context" + "fmt" + "os" + "path/filepath" + "strings" + "testing" +) + +func TestSplit(t *testing.T) { + testdataDir := "testdata" + + entries, err := os.ReadDir(testdataDir) + if err != nil { + t.Fatalf("Failed to read testdata directory: %v", err) + } + + for _, entry := range entries { + if !entry.IsDir() { + continue + } + + testName := entry.Name() + t.Run(testName, func(t *testing.T) { + testDir := filepath.Join(testdataDir, testName) + + // Read input file + inputPath := filepath.Join(testDir, "input.sql") + inputData, err := os.ReadFile(inputPath) + if err != nil { + t.Fatalf("Failed to read input file: %v", err) + } + + // Read expected output files + var expected []string + for i := 1; ; i++ { + outputPath := filepath.Join(testDir, fmt.Sprintf("output_%d.sql", i)) + data, err := os.ReadFile(outputPath) + if err != nil { + if os.IsNotExist(err) { + break + } + t.Fatalf("Failed to read output file %s: %v", outputPath, err) + } + expected = append(expected, string(data)) + } + + // Run Split + ctx := context.Background() + reader := strings.NewReader(string(inputData)) + + got, err := Split(ctx, reader) + if err != nil { + t.Fatalf("Split() error = %v", err) + } + + // Compare results + if len(got) != len(expected) { + t.Errorf("Split() got %d queries, expected %d", len(got), len(expected)) + t.Logf("Got: %v", got) + t.Logf("Expected: %v", expected) + return + } + + for i := range got { + if got[i] != expected[i] { + t.Errorf("Query %d:\ngot: %q\nexpected: %q", i, got[i], expected[i]) + } + } + }) + } +} + +func TestSplitContextCancellation(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + cancel() // Cancel immediately + + reader := strings.NewReader("SELECT * FROM users;") + _, err := Split(ctx, reader) + + if err != context.Canceled { + t.Errorf("Expected context.Canceled error, got %v", err) + } +} + +func TestExtractDollarTag(t *testing.T) { + tests := []struct { + name string + input string + expected string + }{ + { + name: "empty dollar quote", + input: "$$", + expected: "$$", + }, + { + name: "simple tag", + input: "$tag$", + expected: "$tag$", + }, + { + name: "tag with numbers", + input: "$tag123$", + expected: "$tag123$", + }, + { + name: "tag with underscore", + input: "$my_tag$", + expected: "$my_tag$", + }, + { + name: "not a dollar quote (no closing)", + input: "$tag", + expected: "", + }, + { + name: "not a dollar quote (invalid char)", + input: "$tag-name$", + expected: "", + }, + { + name: "empty string", + input: "", + expected: "", + }, + { + name: "no dollar sign", + input: "tag", + expected: "", + }, + { + name: "tag with extra content", + input: "$tag$rest of string", + expected: "$tag$", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := extractDollarTag(tt.input) + if got != tt.expected { + t.Errorf("extractDollarTag(%q) = %q, expected %q", tt.input, got, tt.expected) + } + }) + } +} diff --git a/internal/sql/sqlfile/testdata/complex_query/input.sql b/internal/sql/sqlfile/testdata/complex_query/input.sql new file mode 100644 index 0000000000..a4c0adc165 --- /dev/null +++ b/internal/sql/sqlfile/testdata/complex_query/input.sql @@ -0,0 +1,13 @@ +-- Create a user +INSERT INTO users (name, email) VALUES ('John''s', 'john@example.com'); -- comment; + +/* Multi-line + comment with ; */ +CREATE FUNCTION test() RETURNS text AS $$ +BEGIN + -- Internal comment + RETURN 'test;value'; +END; +$$ LANGUAGE plpgsql; + +SELECT "weird;column" FROM users WHERE name = 'test;value'; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/complex_query/output_1.sql b/internal/sql/sqlfile/testdata/complex_query/output_1.sql new file mode 100644 index 0000000000..ce779a9937 --- /dev/null +++ b/internal/sql/sqlfile/testdata/complex_query/output_1.sql @@ -0,0 +1,2 @@ +-- Create a user +INSERT INTO users (name, email) VALUES ('John''s', 'john@example.com'); -- comment; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/complex_query/output_2.sql b/internal/sql/sqlfile/testdata/complex_query/output_2.sql new file mode 100644 index 0000000000..a40e997054 --- /dev/null +++ b/internal/sql/sqlfile/testdata/complex_query/output_2.sql @@ -0,0 +1,8 @@ +/* Multi-line + comment with ; */ +CREATE FUNCTION test() RETURNS text AS $$ +BEGIN + -- Internal comment + RETURN 'test;value'; +END; +$$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/complex_query/output_3.sql b/internal/sql/sqlfile/testdata/complex_query/output_3.sql new file mode 100644 index 0000000000..0f122014fb --- /dev/null +++ b/internal/sql/sqlfile/testdata/complex_query/output_3.sql @@ -0,0 +1 @@ +SELECT "weird;column" FROM users WHERE name = 'test;value'; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/dollar_quote_with_newlines/input.sql b/internal/sql/sqlfile/testdata/dollar_quote_with_newlines/input.sql new file mode 100644 index 0000000000..29c560145f --- /dev/null +++ b/internal/sql/sqlfile/testdata/dollar_quote_with_newlines/input.sql @@ -0,0 +1,3 @@ +SELECT $$Line 1 +Line 2; with semicolon +Line 3$$; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/dollar_quote_with_newlines/output_1.sql b/internal/sql/sqlfile/testdata/dollar_quote_with_newlines/output_1.sql new file mode 100644 index 0000000000..29c560145f --- /dev/null +++ b/internal/sql/sqlfile/testdata/dollar_quote_with_newlines/output_1.sql @@ -0,0 +1,3 @@ +SELECT $$Line 1 +Line 2; with semicolon +Line 3$$; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/dollar_quoted_function/input.sql b/internal/sql/sqlfile/testdata/dollar_quoted_function/input.sql new file mode 100644 index 0000000000..1e8bcf443f --- /dev/null +++ b/internal/sql/sqlfile/testdata/dollar_quoted_function/input.sql @@ -0,0 +1,5 @@ +CREATE FUNCTION foo() RETURNS text AS $$ +BEGIN + RETURN 'test;'; +END; +$$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/dollar_quoted_function/output_1.sql b/internal/sql/sqlfile/testdata/dollar_quoted_function/output_1.sql new file mode 100644 index 0000000000..1e8bcf443f --- /dev/null +++ b/internal/sql/sqlfile/testdata/dollar_quoted_function/output_1.sql @@ -0,0 +1,5 @@ +CREATE FUNCTION foo() RETURNS text AS $$ +BEGIN + RETURN 'test;'; +END; +$$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/dollar_quoted_string/input.sql b/internal/sql/sqlfile/testdata/dollar_quoted_string/input.sql new file mode 100644 index 0000000000..f6b17df41b --- /dev/null +++ b/internal/sql/sqlfile/testdata/dollar_quoted_string/input.sql @@ -0,0 +1 @@ +SELECT $$This has a ; semicolon$$; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/dollar_quoted_string/output_1.sql b/internal/sql/sqlfile/testdata/dollar_quoted_string/output_1.sql new file mode 100644 index 0000000000..f6b17df41b --- /dev/null +++ b/internal/sql/sqlfile/testdata/dollar_quoted_string/output_1.sql @@ -0,0 +1 @@ +SELECT $$This has a ; semicolon$$; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/double_quoted_identifier/input.sql b/internal/sql/sqlfile/testdata/double_quoted_identifier/input.sql new file mode 100644 index 0000000000..ec10c4a4c3 --- /dev/null +++ b/internal/sql/sqlfile/testdata/double_quoted_identifier/input.sql @@ -0,0 +1 @@ +SELECT "column;name" FROM "table;name"; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/double_quoted_identifier/output_1.sql b/internal/sql/sqlfile/testdata/double_quoted_identifier/output_1.sql new file mode 100644 index 0000000000..ec10c4a4c3 --- /dev/null +++ b/internal/sql/sqlfile/testdata/double_quoted_identifier/output_1.sql @@ -0,0 +1 @@ +SELECT "column;name" FROM "table;name"; \ No newline at end of file diff --git a/examples/python/src/jets/__init__.py b/internal/sql/sqlfile/testdata/empty_input/input.sql similarity index 100% rename from examples/python/src/jets/__init__.py rename to internal/sql/sqlfile/testdata/empty_input/input.sql diff --git a/internal/sql/sqlfile/testdata/escaped_double_quotes/input.sql b/internal/sql/sqlfile/testdata/escaped_double_quotes/input.sql new file mode 100644 index 0000000000..b76ac625ae --- /dev/null +++ b/internal/sql/sqlfile/testdata/escaped_double_quotes/input.sql @@ -0,0 +1 @@ +SELECT "column""name" FROM users; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/escaped_double_quotes/output_1.sql b/internal/sql/sqlfile/testdata/escaped_double_quotes/output_1.sql new file mode 100644 index 0000000000..b76ac625ae --- /dev/null +++ b/internal/sql/sqlfile/testdata/escaped_double_quotes/output_1.sql @@ -0,0 +1 @@ +SELECT "column""name" FROM users; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/escaped_quotes/input.sql b/internal/sql/sqlfile/testdata/escaped_quotes/input.sql new file mode 100644 index 0000000000..adbed971cc --- /dev/null +++ b/internal/sql/sqlfile/testdata/escaped_quotes/input.sql @@ -0,0 +1 @@ +INSERT INTO users (name) VALUES ('It''s a test'); \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/escaped_quotes/output_1.sql b/internal/sql/sqlfile/testdata/escaped_quotes/output_1.sql new file mode 100644 index 0000000000..adbed971cc --- /dev/null +++ b/internal/sql/sqlfile/testdata/escaped_quotes/output_1.sql @@ -0,0 +1 @@ +INSERT INTO users (name) VALUES ('It''s a test'); \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/last_query_no_semicolon/input.sql b/internal/sql/sqlfile/testdata/last_query_no_semicolon/input.sql new file mode 100644 index 0000000000..327c60ae25 --- /dev/null +++ b/internal/sql/sqlfile/testdata/last_query_no_semicolon/input.sql @@ -0,0 +1,2 @@ +SELECT * FROM users; +INSERT INTO posts (title) VALUES ('Test') \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/last_query_no_semicolon/output_1.sql b/internal/sql/sqlfile/testdata/last_query_no_semicolon/output_1.sql new file mode 100644 index 0000000000..b28910ea2e --- /dev/null +++ b/internal/sql/sqlfile/testdata/last_query_no_semicolon/output_1.sql @@ -0,0 +1 @@ +SELECT * FROM users; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/last_query_no_semicolon/output_2.sql b/internal/sql/sqlfile/testdata/last_query_no_semicolon/output_2.sql new file mode 100644 index 0000000000..0a9979585d --- /dev/null +++ b/internal/sql/sqlfile/testdata/last_query_no_semicolon/output_2.sql @@ -0,0 +1 @@ +INSERT INTO posts (title) VALUES ('Test') \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multi_line_comment/input.sql b/internal/sql/sqlfile/testdata/multi_line_comment/input.sql new file mode 100644 index 0000000000..9a5e75afc5 --- /dev/null +++ b/internal/sql/sqlfile/testdata/multi_line_comment/input.sql @@ -0,0 +1,3 @@ +SELECT * FROM users /* this is +a multi-line comment */; +SELECT * FROM posts; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multi_line_comment/output_1.sql b/internal/sql/sqlfile/testdata/multi_line_comment/output_1.sql new file mode 100644 index 0000000000..22792d2eb5 --- /dev/null +++ b/internal/sql/sqlfile/testdata/multi_line_comment/output_1.sql @@ -0,0 +1,2 @@ +SELECT * FROM users /* this is +a multi-line comment */; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multi_line_comment/output_2.sql b/internal/sql/sqlfile/testdata/multi_line_comment/output_2.sql new file mode 100644 index 0000000000..7707478524 --- /dev/null +++ b/internal/sql/sqlfile/testdata/multi_line_comment/output_2.sql @@ -0,0 +1 @@ +SELECT * FROM posts; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/input.sql b/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/input.sql new file mode 100644 index 0000000000..2b89a4a5cd --- /dev/null +++ b/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/input.sql @@ -0,0 +1,2 @@ +SELECT * FROM users /* this has ; in it */; +SELECT * FROM posts; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/output_1.sql b/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/output_1.sql new file mode 100644 index 0000000000..22da00e422 --- /dev/null +++ b/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/output_1.sql @@ -0,0 +1 @@ +SELECT * FROM users /* this has ; in it */; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/output_2.sql b/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/output_2.sql new file mode 100644 index 0000000000..7707478524 --- /dev/null +++ b/internal/sql/sqlfile/testdata/multi_line_comment_with_semicolon/output_2.sql @@ -0,0 +1 @@ +SELECT * FROM posts; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multiple_queries/input.sql b/internal/sql/sqlfile/testdata/multiple_queries/input.sql new file mode 100644 index 0000000000..fccb5d335e --- /dev/null +++ b/internal/sql/sqlfile/testdata/multiple_queries/input.sql @@ -0,0 +1,3 @@ +SELECT * FROM users; +INSERT INTO users (name) VALUES ('John'); +DELETE FROM users WHERE id = 1; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multiple_queries/output_1.sql b/internal/sql/sqlfile/testdata/multiple_queries/output_1.sql new file mode 100644 index 0000000000..b28910ea2e --- /dev/null +++ b/internal/sql/sqlfile/testdata/multiple_queries/output_1.sql @@ -0,0 +1 @@ +SELECT * FROM users; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multiple_queries/output_2.sql b/internal/sql/sqlfile/testdata/multiple_queries/output_2.sql new file mode 100644 index 0000000000..0ec06c386f --- /dev/null +++ b/internal/sql/sqlfile/testdata/multiple_queries/output_2.sql @@ -0,0 +1 @@ +INSERT INTO users (name) VALUES ('John'); \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/multiple_queries/output_3.sql b/internal/sql/sqlfile/testdata/multiple_queries/output_3.sql new file mode 100644 index 0000000000..cad242da06 --- /dev/null +++ b/internal/sql/sqlfile/testdata/multiple_queries/output_3.sql @@ -0,0 +1 @@ +DELETE FROM users WHERE id = 1; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/nested_dollar_quotes/input.sql b/internal/sql/sqlfile/testdata/nested_dollar_quotes/input.sql new file mode 100644 index 0000000000..e1c9b52217 --- /dev/null +++ b/internal/sql/sqlfile/testdata/nested_dollar_quotes/input.sql @@ -0,0 +1 @@ +SELECT $outer$This contains $inner$nested; quote$inner$;$outer$; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/nested_dollar_quotes/output_1.sql b/internal/sql/sqlfile/testdata/nested_dollar_quotes/output_1.sql new file mode 100644 index 0000000000..e1c9b52217 --- /dev/null +++ b/internal/sql/sqlfile/testdata/nested_dollar_quotes/output_1.sql @@ -0,0 +1 @@ +SELECT $outer$This contains $inner$nested; quote$inner$;$outer$; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/no_trailing_semicolon/input.sql b/internal/sql/sqlfile/testdata/no_trailing_semicolon/input.sql new file mode 100644 index 0000000000..e9e19fac54 --- /dev/null +++ b/internal/sql/sqlfile/testdata/no_trailing_semicolon/input.sql @@ -0,0 +1 @@ +SELECT * FROM users \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/no_trailing_semicolon/output_1.sql b/internal/sql/sqlfile/testdata/no_trailing_semicolon/output_1.sql new file mode 100644 index 0000000000..e9e19fac54 --- /dev/null +++ b/internal/sql/sqlfile/testdata/no_trailing_semicolon/output_1.sql @@ -0,0 +1 @@ +SELECT * FROM users \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/only_semicolons/input.sql b/internal/sql/sqlfile/testdata/only_semicolons/input.sql new file mode 100644 index 0000000000..3e62726793 --- /dev/null +++ b/internal/sql/sqlfile/testdata/only_semicolons/input.sql @@ -0,0 +1 @@ +;;; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/semicolon_in_string/input.sql b/internal/sql/sqlfile/testdata/semicolon_in_string/input.sql new file mode 100644 index 0000000000..ad364a7b2a --- /dev/null +++ b/internal/sql/sqlfile/testdata/semicolon_in_string/input.sql @@ -0,0 +1 @@ +INSERT INTO users (name) VALUES ('John; DROP TABLE users;'); \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/semicolon_in_string/output_1.sql b/internal/sql/sqlfile/testdata/semicolon_in_string/output_1.sql new file mode 100644 index 0000000000..ad364a7b2a --- /dev/null +++ b/internal/sql/sqlfile/testdata/semicolon_in_string/output_1.sql @@ -0,0 +1 @@ +INSERT INTO users (name) VALUES ('John; DROP TABLE users;'); \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/single_line_comment/input.sql b/internal/sql/sqlfile/testdata/single_line_comment/input.sql new file mode 100644 index 0000000000..ba996d6fc8 --- /dev/null +++ b/internal/sql/sqlfile/testdata/single_line_comment/input.sql @@ -0,0 +1,2 @@ +SELECT * FROM users; -- this is a comment +SELECT * FROM posts; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/single_line_comment/output_1.sql b/internal/sql/sqlfile/testdata/single_line_comment/output_1.sql new file mode 100644 index 0000000000..d6dd4dc402 --- /dev/null +++ b/internal/sql/sqlfile/testdata/single_line_comment/output_1.sql @@ -0,0 +1 @@ +SELECT * FROM users; -- this is a comment \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/single_line_comment/output_2.sql b/internal/sql/sqlfile/testdata/single_line_comment/output_2.sql new file mode 100644 index 0000000000..7707478524 --- /dev/null +++ b/internal/sql/sqlfile/testdata/single_line_comment/output_2.sql @@ -0,0 +1 @@ +SELECT * FROM posts; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/input.sql b/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/input.sql new file mode 100644 index 0000000000..1c86be964a --- /dev/null +++ b/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/input.sql @@ -0,0 +1,2 @@ +SELECT * FROM users; -- this has a ; in it +SELECT * FROM posts; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/output_1.sql b/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/output_1.sql new file mode 100644 index 0000000000..1c252dfdbb --- /dev/null +++ b/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/output_1.sql @@ -0,0 +1 @@ +SELECT * FROM users; -- this has a ; in it \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/output_2.sql b/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/output_2.sql new file mode 100644 index 0000000000..7707478524 --- /dev/null +++ b/internal/sql/sqlfile/testdata/single_line_comment_with_semicolon/output_2.sql @@ -0,0 +1 @@ +SELECT * FROM posts; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/single_query/input.sql b/internal/sql/sqlfile/testdata/single_query/input.sql new file mode 100644 index 0000000000..b28910ea2e --- /dev/null +++ b/internal/sql/sqlfile/testdata/single_query/input.sql @@ -0,0 +1 @@ +SELECT * FROM users; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/single_query/output_1.sql b/internal/sql/sqlfile/testdata/single_query/output_1.sql new file mode 100644 index 0000000000..b28910ea2e --- /dev/null +++ b/internal/sql/sqlfile/testdata/single_query/output_1.sql @@ -0,0 +1 @@ +SELECT * FROM users; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/tagged_dollar_quoted_string/input.sql b/internal/sql/sqlfile/testdata/tagged_dollar_quoted_string/input.sql new file mode 100644 index 0000000000..65ffbae738 --- /dev/null +++ b/internal/sql/sqlfile/testdata/tagged_dollar_quoted_string/input.sql @@ -0,0 +1 @@ +SELECT $tag$This has a ; semicolon$tag$; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/tagged_dollar_quoted_string/output_1.sql b/internal/sql/sqlfile/testdata/tagged_dollar_quoted_string/output_1.sql new file mode 100644 index 0000000000..65ffbae738 --- /dev/null +++ b/internal/sql/sqlfile/testdata/tagged_dollar_quoted_string/output_1.sql @@ -0,0 +1 @@ +SELECT $tag$This has a ; semicolon$tag$; \ No newline at end of file diff --git a/internal/sql/sqlfile/testdata/whitespace_only/input.sql b/internal/sql/sqlfile/testdata/whitespace_only/input.sql new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/internal/sql/sqlfile/testdata/whitespace_only/input.sql @@ -0,0 +1,2 @@ + + diff --git a/internal/sql/sqlpath/read.go b/internal/sql/sqlpath/read.go index 24072001c9..278ebf3a05 100644 --- a/internal/sql/sqlpath/read.go +++ b/internal/sql/sqlpath/read.go @@ -9,14 +9,33 @@ import ( "github.com/sqlc-dev/sqlc/internal/migrations" ) -// Return a list of SQL files in the listed paths. Only includes files ending -// in .sql. Omits hidden files, directories, and migrations. -func Glob(paths []string) ([]string, error) { - var files []string +// Return a list of SQL files in the listed paths. +// +// Only includes files ending in .sql. Omits hidden files, directories, and +// down migrations. + +// If a path contains *, ?, [, or ], treat the path as a pattern and expand it +// filepath.Glob. +func Glob(patterns []string) ([]string, error) { + var files, paths []string + for _, pattern := range patterns { + if strings.ContainsAny(pattern, "*?[]") { + matches, err := filepath.Glob(pattern) + if err != nil { + return nil, err + } + // if len(matches) == 0 { + // slog.Warn("zero files matched", "pattern", pattern) + // } + paths = append(paths, matches...) + } else { + paths = append(paths, pattern) + } + } for _, path := range paths { f, err := os.Stat(path) if err != nil { - return nil, fmt.Errorf("path %s does not exist", path) + return nil, fmt.Errorf("path error: %w", err) } if f.IsDir() { listing, err := os.ReadDir(path) @@ -27,7 +46,7 @@ func Glob(paths []string) ([]string, error) { files = append(files, filepath.Join(path, f.Name())) } } else { - files = append(files, path) + files = append(files, filepath.Clean(path)) } } var sqlFiles []string diff --git a/internal/sql/sqlpath/read_test.go b/internal/sql/sqlpath/read_test.go new file mode 100644 index 0000000000..e4d959085b --- /dev/null +++ b/internal/sql/sqlpath/read_test.go @@ -0,0 +1,243 @@ +package sqlpath + +import ( + "fmt" + "path/filepath" + "strings" + "testing" + + "github.com/google/go-cmp/cmp" +) + +// Returns a list of SQL files from given paths. +func TestReturnsListOfSQLFiles(t *testing.T) { + // Arrange + paths := []string{"testdata/file1.sql", "testdata/file2.sql"} + + // Act + result, err := Glob(paths) + + // Assert + expected := []string{filepath.Join("testdata", "file1.sql"), filepath.Join("testdata", "file2.sql")} + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v, %v", expected, result, cmp.Diff(expected, result)) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestReturnsNilListWhenNoSQLFilesFound(t *testing.T) { + // Arrange + paths := []string{"testdata/extra.txt"} + + // Act + result, err := Glob(paths) + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v, %v", expected, result, cmp.Diff(expected, result)) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestIgnoresHiddenFilesWhenSearchingForSQLFiles(t *testing.T) { + // Arrange + paths := []string{"testdata/.hidden.sql"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestIgnoresNonSQLFilesWhenSearchingForSQLFiles(t *testing.T) { + // Arrange + paths := []string{"testdata/extra.txt"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestExcludesSQLFilesEndingWithDownSQLWhenSearchingForSQLFiles(t *testing.T) { + // Arrange + paths := []string{"testdata/file1.sql", "testdata/file3.down.sql"} + + // Act + result, err := Glob(paths) + + // Assert + expected := []string{filepath.Join("testdata", "file1.sql")} + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestReturnsErrorWhenPathDoesNotExist(t *testing.T) { + // Arrange + paths := []string{"non_existent_path"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err == nil { + t.Errorf("Expected an error, but got nil") + } else { + expectedError := fmt.Errorf("path error:") + if !strings.HasPrefix(err.Error(), expectedError.Error()) { + t.Errorf("Expected error %v, but got %v", expectedError, err) + } + } +} + +func TestReturnsErrorWhenDirectoryCannotBeRead(t *testing.T) { + // Arrange + paths := []string{"testdata/unreadable"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err == nil { + t.Errorf("Expected an error, but got nil") + } else { + expectedError := fmt.Errorf("path error:") + if !strings.HasPrefix(err.Error(), expectedError.Error()) { + t.Errorf("Expected error %v, but got %v", expectedError, err) + } + } +} + +func TestDoesNotIncludesSQLFilesWithUppercaseExtension(t *testing.T) { + // Arrange + paths := []string{"testdata/file4.SQL"} + + // Act + result, err := Glob(paths) + + // Assert + var expected []string + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestNotIncludesHiddenFilesAnyPath(t *testing.T) { + // Arrange + paths := []string{ + "./testdata/.hiddendir/file1.sql", // pass + "./testdata/.hidden.sql", // skip + } + + // Act + result, err := Glob(paths) + + // Assert + expected := []string{filepath.Join("testdata", ".hiddendir", "file1.sql")} + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestFollowSymlinks(t *testing.T) { + // Arrange + paths := []string{"testdata/symlink", "testdata/file1.symlink.sql"} + + // Act + result, err := Glob(paths) + + // Assert + expected := []string{ + filepath.Join("testdata", "symlink", "file1.sql"), + filepath.Join("testdata", "symlink", "file1.symlink.sql"), + filepath.Join("testdata", "symlink", "file2.sql"), + filepath.Join("testdata", "file1.symlink.sql"), + } + if !cmp.Equal(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } + if err != nil { + t.Errorf("Expected no error, but got %v", err) + } +} + +func TestGlobPattern(t *testing.T) { + // Arrange + tests := []struct { + pattern string + expected []string + }{ + { + pattern: "testdata/glob/*/queries", + expected: []string{ + filepath.Join("testdata", "glob", "sub1", "queries", "file1.sql"), + filepath.Join("testdata", "glob", "sub2", "queries", "file2.sql"), + filepath.Join("testdata", "glob", "sub3", "queries", "file3.sql"), + filepath.Join("testdata", "glob", "sub3", "queries", "file4.sql"), + }, + }, + { + pattern: "testdata/glob/sub3/queries/file?.sql", + expected: []string{ + filepath.Join("testdata", "glob", "sub3", "queries", "file3.sql"), + filepath.Join("testdata", "glob", "sub3", "queries", "file4.sql"), + }, + }, + { + pattern: "testdata/glob/sub3/queries/file[1-5].sql", + expected: []string{ + filepath.Join("testdata", "glob", "sub3", "queries", "file3.sql"), + filepath.Join("testdata", "glob", "sub3", "queries", "file4.sql"), + }, + }, + } + + for _, test := range tests { + // Act + result, err := Glob([]string{test.pattern}) + + // Assert + if !cmp.Equal(result, test.expected) { + t.Errorf("Pattern %v: Expected %v, but got %v", test.pattern, test.expected, result) + } + if err != nil { + t.Errorf("Pattern %v: Expected no error, but got %v", test.pattern, err) + } + } +} diff --git a/examples/python/src/ondeck/__init__.py b/internal/sql/sqlpath/testdata/.hidden.sql similarity index 100% rename from examples/python/src/ondeck/__init__.py rename to internal/sql/sqlpath/testdata/.hidden.sql diff --git a/examples/python/src/tests/__init__.py b/internal/sql/sqlpath/testdata/.hiddendir/file1.sql similarity index 100% rename from examples/python/src/tests/__init__.py rename to internal/sql/sqlpath/testdata/.hiddendir/file1.sql diff --git a/internal/endtoend/testdata/emit_pydantic_models/postgresql/__init__.py b/internal/sql/sqlpath/testdata/extra.txt similarity index 100% rename from internal/endtoend/testdata/emit_pydantic_models/postgresql/__init__.py rename to internal/sql/sqlpath/testdata/extra.txt diff --git a/internal/sql/sqlpath/testdata/file1.sql b/internal/sql/sqlpath/testdata/file1.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/file1.symlink.sql b/internal/sql/sqlpath/testdata/file1.symlink.sql new file mode 120000 index 0000000000..7c823b3226 --- /dev/null +++ b/internal/sql/sqlpath/testdata/file1.symlink.sql @@ -0,0 +1 @@ +./file1.sql \ No newline at end of file diff --git a/internal/sql/sqlpath/testdata/file2.sql b/internal/sql/sqlpath/testdata/file2.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/file3.down.sql b/internal/sql/sqlpath/testdata/file3.down.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/file4.SQL b/internal/sql/sqlpath/testdata/file4.SQL new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/glob/sub1/queries/file1.sql b/internal/sql/sqlpath/testdata/glob/sub1/queries/file1.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/glob/sub2/queries/file2.sql b/internal/sql/sqlpath/testdata/glob/sub2/queries/file2.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/glob/sub3/queries/file3.sql b/internal/sql/sqlpath/testdata/glob/sub3/queries/file3.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/glob/sub3/queries/file4.sql b/internal/sql/sqlpath/testdata/glob/sub3/queries/file4.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/subdir/file2.sql b/internal/sql/sqlpath/testdata/subdir/file2.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/sql/sqlpath/testdata/symlink b/internal/sql/sqlpath/testdata/symlink new file mode 120000 index 0000000000..945c9b46d6 --- /dev/null +++ b/internal/sql/sqlpath/testdata/symlink @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/internal/sql/validate/cmd.go b/internal/sql/validate/cmd.go index 7b9261e20c..e9d9dd03cb 100644 --- a/internal/sql/validate/cmd.go +++ b/internal/sql/validate/cmd.go @@ -7,7 +7,6 @@ import ( "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" - "github.com/sqlc-dev/sqlc/internal/sql/named" ) func validateCopyfrom(n ast.Node) error { @@ -39,10 +38,7 @@ func validateCopyfrom(n ast.Node) error { return nil } for _, v := range sublist.Items { - _, ok := v.(*ast.ParamRef) - ok = ok || named.IsParamFunc(v) - ok = ok || named.IsParamSign(v) - if !ok { + if _, ok := v.(*ast.ParamRef); !ok { return errors.New(":copyfrom doesn't support non-parameter values") } } @@ -50,13 +46,11 @@ func validateCopyfrom(n ast.Node) error { } func validateBatch(n ast.Node) error { - funcs := astutils.Search(n, named.IsParamFunc) - params := astutils.Search(n, named.IsParamSign) args := astutils.Search(n, func(n ast.Node) bool { _, ok := n.(*ast.ParamRef) return ok }) - if (len(params.Items) + len(funcs.Items) + len(args.Items)) == 0 { + if len(args.Items) == 0 { return errors.New(":batch* commands require parameters") } return nil @@ -67,9 +61,11 @@ func Cmd(n ast.Node, name, cmd string) error { return validateCopyfrom(n) } if (cmd == metadata.CmdBatchExec || cmd == metadata.CmdBatchMany) || cmd == metadata.CmdBatchOne { - return validateBatch(n) + if err := validateBatch(n); err != nil { + return err + } } - if !(cmd == metadata.CmdMany || cmd == metadata.CmdOne) { + if !(cmd == metadata.CmdMany || cmd == metadata.CmdOne || cmd == metadata.CmdBatchMany || cmd == metadata.CmdBatchOne) { return nil } var list *ast.List diff --git a/internal/sql/validate/func_call.go b/internal/sql/validate/func_call.go index dad621eb12..c60cbaa04b 100644 --- a/internal/sql/validate/func_call.go +++ b/internal/sql/validate/func_call.go @@ -30,10 +30,6 @@ func (v *funcCallVisitor) Visit(node ast.Node) astutils.Visitor { return v } - if fn.Schema == "sqlc" { - return nil - } - fun, err := v.catalog.ResolveFuncCall(call) if fun != nil { return v diff --git a/internal/sql/validate/in.go b/internal/sql/validate/in.go deleted file mode 100644 index 56bcee125d..0000000000 --- a/internal/sql/validate/in.go +++ /dev/null @@ -1,86 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/astutils" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" - "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" -) - -type inVisitor struct { - catalog *catalog.Catalog - err error -} - -func (v *inVisitor) Visit(node ast.Node) astutils.Visitor { - if v.err != nil { - return nil - } - - in, ok := node.(*ast.In) - if !ok { - return v - } - - // Validate that sqlc.slice in an IN statement is the only arg, eg: - // id IN (sqlc.slice("ids")) -- GOOD - // id in (0, 1, sqlc.slice("ids")) -- BAD - - if len(in.List) <= 1 { - return v - } - - for _, n := range in.List { - call, ok := n.(*ast.FuncCall) - if !ok { - continue - } - fn := call.Func - if fn == nil { - continue - } - - if fn.Schema == "sqlc" && fn.Name == "slice" { - var inExpr, sliceArg string - - // determine inExpr - switch n := in.Expr.(type) { - case *ast.ColumnRef: - inExpr = n.Name - default: - inExpr = "..." - } - - // determine sliceArg - if len(call.Args.Items) == 1 { - switch n := call.Args.Items[0].(type) { - case *ast.A_Const: - if str, ok := n.Val.(*ast.String); ok { - sliceArg = "\"" + str.Str + "\"" - } else { - sliceArg = "?" - } - case *ast.ColumnRef: - sliceArg = n.Name - default: - // impossible, validate.FuncCall should have caught this - sliceArg = "..." - } - } - v.err = &sqlerr.Error{ - Message: fmt.Sprintf("expected '%s IN' expr to consist only of sqlc.slice(%s); eg ", inExpr, sliceArg), - Location: call.Pos(), - } - } - } - - return v -} - -func In(c *catalog.Catalog, n ast.Node) error { - visitor := inVisitor{catalog: c} - astutils.Walk(&visitor, n) - return visitor.err -} diff --git a/internal/sql/validate/insert_stmt.go b/internal/sql/validate/insert_stmt.go index dd8041ea23..236ddbfceb 100644 --- a/internal/sql/validate/insert_stmt.go +++ b/internal/sql/validate/insert_stmt.go @@ -1,11 +1,16 @@ package validate import ( + "strings" + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/catalog" "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" ) -func InsertStmt(stmt *ast.InsertStmt) error { +const excludedTable = "EXCLUDED" + +func InsertStmt(c *catalog.Catalog, fqn *ast.TableName, stmt *ast.InsertStmt) error { sel, ok := stmt.SelectStmt.(*ast.SelectStmt) if !ok { return nil @@ -35,5 +40,102 @@ func InsertStmt(stmt *ast.InsertStmt) error { Message: "INSERT has more expressions than target columns", } } + + return onConflictClause(c, fqn, stmt) +} + +// onConflictClause validates an ON CONFLICT DO UPDATE clause against the target +// table. It checks: +// - ON CONFLICT (col, ...) conflict target columns exist +// - DO UPDATE SET col = ... assignment target columns exist +// - EXCLUDED.col references exist +func onConflictClause(c *catalog.Catalog, fqn *ast.TableName, n *ast.InsertStmt) error { + if fqn == nil || n.OnConflictClause == nil || n.OnConflictClause.Action != ast.OnConflictActionUpdate { + return nil + } + + table, err := c.GetTable(fqn) + if err != nil { + return err + } + + // Build set of column names for existence checks. + colNames := make(map[string]struct{}, len(table.Columns)) + for _, col := range table.Columns { + colNames[col.Name] = struct{}{} + } + + // DO UPDATE requires a conflict target: ON CONFLICT (col) or ON CONFLICT ON CONSTRAINT name. + if n.OnConflictClause.Infer == nil { + return &sqlerr.Error{ + Code: "42601", + Message: "ON CONFLICT DO UPDATE requires inference specification or constraint name", + } + } + + // Validate ON CONFLICT (col, ...) conflict target columns. + if n.OnConflictClause.Infer.IndexElems != nil { + for _, item := range n.OnConflictClause.Infer.IndexElems.Items { + elem, ok := item.(*ast.IndexElem) + if !ok || elem.Name == nil { + continue + } + + if _, exists := colNames[*elem.Name]; !exists { + e := sqlerr.ColumnNotFound(table.Rel.Name, *elem.Name) + e.Location = n.OnConflictClause.Infer.Location + return e + } + } + } + + // Validate DO UPDATE SET col = ... assignment target columns and EXCLUDED.col references. + if n.OnConflictClause.TargetList == nil { + return nil + } + + for _, item := range n.OnConflictClause.TargetList.Items { + target, ok := item.(*ast.ResTarget) + if !ok || target.Name == nil { + continue + } + + if _, exists := colNames[*target.Name]; !exists { + e := sqlerr.ColumnNotFound(table.Rel.Name, *target.Name) + e.Location = target.Location + return e + } + + if ref, ok := target.Val.(*ast.ColumnRef); ok { + if excludedCol, ok := excludedColumnRef(ref); ok { + if _, exists := colNames[excludedCol]; !exists { + e := sqlerr.ColumnNotFound(excludedTable, excludedCol) + e.Location = ref.Location + return e + } + } + } + } + return nil } + +// excludedColumnRef returns the column name if the ColumnRef is an EXCLUDED.col +// reference, and ok=true. Returns "", false otherwise. +func excludedColumnRef(ref *ast.ColumnRef) (string, bool) { + if ref.Fields == nil || len(ref.Fields.Items) != 2 { + return "", false + } + + first, ok := ref.Fields.Items[0].(*ast.String) + if !ok || !strings.EqualFold(first.Str, excludedTable) { + return "", false + } + + second, ok := ref.Fields.Items[1].(*ast.String) + if !ok { + return "", false + } + + return second.Str, true +} diff --git a/internal/sql/validate/param_ref.go b/internal/sql/validate/param_ref.go deleted file mode 100644 index ab9413f40f..0000000000 --- a/internal/sql/validate/param_ref.go +++ /dev/null @@ -1,48 +0,0 @@ -package validate - -import ( - "errors" - "fmt" - - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/astutils" - "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" -) - -func ParamRef(n ast.Node) (map[int]bool, bool, error) { - var allrefs []*ast.ParamRef - var dollar bool - var nodollar bool - // Find all parameter references - astutils.Walk(astutils.VisitorFunc(func(node ast.Node) { - switch n := node.(type) { - case *ast.ParamRef: - ref := node.(*ast.ParamRef) - if ref.Dollar { - dollar = true - } else { - nodollar = true - } - allrefs = append(allrefs, n) - } - }), n) - if dollar && nodollar { - return nil, false, errors.New("can not mix $1 format with ? format") - } - - seen := map[int]bool{} - for _, r := range allrefs { - if r.Number > 0 { - seen[r.Number] = true - } - } - for i := 1; i <= len(seen); i += 1 { - if _, ok := seen[i]; !ok { - return seen, !nodollar, &sqlerr.Error{ - Code: "42P18", - Message: fmt.Sprintf("could not determine data type of parameter $%d", i), - } - } - } - return seen, !nodollar, nil -} diff --git a/internal/sql/validate/param_style.go b/internal/sql/validate/param_style.go deleted file mode 100644 index 1182051d20..0000000000 --- a/internal/sql/validate/param_style.go +++ /dev/null @@ -1,68 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/astutils" - "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" -) - -type sqlcFuncVisitor struct { - err error -} - -func (v *sqlcFuncVisitor) Visit(node ast.Node) astutils.Visitor { - if v.err != nil { - return nil - } - - call, ok := node.(*ast.FuncCall) - if !ok { - return v - } - fn := call.Func - if fn == nil { - return v - } - - // Custom validation for sqlc.arg, sqlc.narg and sqlc.slice - // TODO: Replace this once type-checking is implemented - if fn.Schema == "sqlc" { - if !(fn.Name == "arg" || fn.Name == "narg" || fn.Name == "slice" || fn.Name == "embed") { - v.err = sqlerr.FunctionNotFound("sqlc." + fn.Name) - return nil - } - - if len(call.Args.Items) != 1 { - v.err = &sqlerr.Error{ - Message: fmt.Sprintf("expected 1 parameter to sqlc.%s; got %d", fn.Name, len(call.Args.Items)), - Location: call.Pos(), - } - return nil - } - - switch n := call.Args.Items[0].(type) { - case *ast.A_Const: - case *ast.ColumnRef: - default: - v.err = &sqlerr.Error{ - Message: fmt.Sprintf("expected parameter to sqlc.%s to be string or reference; got %T", fn.Name, n), - Location: call.Pos(), - } - return nil - } - - // If we have sqlc.arg or sqlc.narg, there is no need to resolve the function call. - // It won't resolve anyway, sinc it is not a real function. - return nil - } - - return nil -} - -func SqlcFunctions(n ast.Node) error { - visitor := sqlcFuncVisitor{} - astutils.Walk(&visitor, n) - return visitor.err -} diff --git a/internal/sql/validate/slice.go b/internal/sql/validate/slice.go new file mode 100644 index 0000000000..cbd45ed9fe --- /dev/null +++ b/internal/sql/validate/slice.go @@ -0,0 +1,70 @@ +package validate + +import ( + "fmt" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/sqlerr" +) + +type sliceVisitor struct { + // slices maps the location of a placeholder in the query text to the name + // of the sqlc.slice() parameter it was rewritten from. + slices map[int]string + err error +} + +func (v *sliceVisitor) Visit(node ast.Node) astutils.Visitor { + if v.err != nil { + return nil + } + + in, ok := node.(*ast.In) + if !ok { + return v + } + + // A slice expands to a comma-separated list at query time, so it has to be + // the only element of the IN expression: + // id IN (sqlc.slice("ids")) -- GOOD + // id in (0, 1, sqlc.slice("ids")) -- BAD + if len(in.List) <= 1 { + return v + } + + for _, n := range in.List { + ref, ok := n.(*ast.ParamRef) + if !ok { + continue + } + name, ok := v.slices[ref.Location] + if !ok { + continue + } + + inExpr := "..." + if col, ok := in.Expr.(*ast.ColumnRef); ok { + inExpr = col.Name + } + v.err = &sqlerr.Error{ + Message: fmt.Sprintf("expected '%s IN' expr to consist only of sqlc.slice(%s); eg ", inExpr, name), + Location: ref.Location, + } + return nil + } + + return v +} + +// Slice reports whether every sqlc.slice() parameter is the only element of the +// IN expression that contains it. The slices map is keyed by the location the +// preprocessor recorded for each rewritten slice placeholder. +func Slice(n ast.Node, slices map[int]string) error { + if len(slices) == 0 { + return nil + } + visitor := sliceVisitor{slices: slices} + astutils.Walk(&visitor, n) + return visitor.err +} diff --git a/internal/sqlcdebug/sqlcdebug.go b/internal/sqlcdebug/sqlcdebug.go new file mode 100644 index 0000000000..2f5eef01fa --- /dev/null +++ b/internal/sqlcdebug/sqlcdebug.go @@ -0,0 +1,182 @@ +// Package sqlcdebug parses the SQLCDEBUG environment variable and exposes +// its key=value settings to the rest of the codebase. +// +// The SQLCDEBUG variable is a comma-separated list of name=value pairs: +// +// SQLCDEBUG=dumpast=1,trace=trace.out +// +// Settings are looked up at the call site by declaring a package-level +// variable: +// +// var dumpAST = sqlcdebug.New("dumpast") +// +// func parse() { +// if dumpAST.Value() == "1" { ... } +// } +// +// New panics if name is not registered in [Settings] below. Adding a new +// setting therefore requires extending the [Settings] table so that all +// known keys are documented in one place. +// +// This package is modeled after Go's internal/godebug. Unlike Go, sqlc is +// short-lived, so settings are parsed once at process startup; the +// [Update] hook exists for tests that need to reparse mid-run. +package sqlcdebug + +import ( + "os" + "strings" + "sync" + "sync/atomic" +) + +// Info documents a single SQLCDEBUG setting. +type Info struct { + // Name is the SQLCDEBUG key, e.g. "dumpast". + Name string + // Description is a short human-readable description. + Description string + // Default is the value returned by [Setting.Value] when the key is + // not present in SQLCDEBUG. + Default string +} + +// Settings is the master table of all known SQLCDEBUG keys. New keys must +// be added here before they can be looked up via [New]. +var Settings = []Info{ + {Name: "dumpast", Description: "print the AST of every SQL statement"}, + {Name: "dumpcatalog", Description: "print the parsed database schema"}, + {Name: "trace", Description: "write a runtime trace to the named file (1 means trace.out)"}, + {Name: "processplugins", Description: "set to 0 to disable process-based plugins", Default: "1"}, + {Name: "databases", Description: "set to 'managed' to disable database connections via URI"}, + {Name: "dumpvetenv", Description: "print the variables available to a vet rule during evaluation"}, + {Name: "dumpexplain", Description: "print the JSON-formatted output from EXPLAIN during vet evaluation"}, +} + +func info(name string) (Info, bool) { + for _, s := range Settings { + if s.Name == name { + return s, true + } + } + return Info{}, false +} + +// Setting is a single SQLCDEBUG key. Obtain one with [New]; reading it +// with [Setting.Value] returns the value parsed from the SQLCDEBUG +// environment variable, or the registered default. +type Setting struct { + info Info + set atomic.Bool + value atomic.Pointer[string] +} + +var ( + registryMu sync.Mutex + registry = map[string]*Setting{} +) + +// New returns the Setting for name. The same pointer is returned for +// repeated calls. New panics if name is not present in [Settings]. +func New(name string) *Setting { + registryMu.Lock() + defer registryMu.Unlock() + if s, ok := registry[name]; ok { + return s + } + i, ok := info(name) + if !ok { + panic("sqlcdebug: unknown setting " + name) + } + s := &Setting{info: i} + registry[name] = s + apply(s, parsedEnv()) + return s +} + +// Name returns the setting's key. +func (s *Setting) Name() string { return s.info.Name } + +// Default returns the value used when the key is absent from SQLCDEBUG. +func (s *Setting) Default() string { return s.info.Default } + +// Value returns the parsed value of the SQLCDEBUG setting, falling back +// to the registered default. +func (s *Setting) Value() string { + if v := s.value.Load(); v != nil { + return *v + } + return s.info.Default +} + +// IsSet reports whether the key was present in SQLCDEBUG. +func (s *Setting) IsSet() bool { return s.set.Load() } + +// Any reports whether SQLCDEBUG contained any recognized key=value pair. +// It mirrors the legacy "is debug active?" check. +func Any() bool { + for _, s := range registry { + if s.IsSet() { + return true + } + } + return parsedEnvHasAny() +} + +var ( + envOnce sync.Once + envMap map[string]string +) + +func parsedEnv() map[string]string { + envOnce.Do(func() { + envMap = parse(os.Getenv("SQLCDEBUG")) + }) + return envMap +} + +func parsedEnvHasAny() bool { + return len(parsedEnv()) > 0 +} + +func parse(raw string) map[string]string { + out := map[string]string{} + if raw == "" { + return out + } + for pair := range strings.SplitSeq(raw, ",") { + pair = strings.TrimSpace(pair) + if pair == "" { + continue + } + k, v, ok := strings.Cut(pair, "=") + if !ok { + continue + } + out[k] = v + } + return out +} + +func apply(s *Setting, env map[string]string) { + if v, ok := env[s.info.Name]; ok { + s.value.Store(&v) + s.set.Store(true) + } else { + s.value.Store(nil) + s.set.Store(false) + } +} + +// Update reparses the given SQLCDEBUG-formatted string and refreshes +// every registered setting. Intended for tests; production code should +// rely on the value parsed at startup. +func Update(raw string) { + registryMu.Lock() + defer registryMu.Unlock() + envMap = parse(raw) + envOnce.Do(func() {}) // mark as parsed so future New() calls see envMap. + for _, s := range registry { + apply(s, envMap) + } +} diff --git a/internal/sqlcdebug/sqlcdebug_test.go b/internal/sqlcdebug/sqlcdebug_test.go new file mode 100644 index 0000000000..6fbd118e34 --- /dev/null +++ b/internal/sqlcdebug/sqlcdebug_test.go @@ -0,0 +1,107 @@ +package sqlcdebug + +import ( + "sync" + "testing" +) + +func resetForTest(t *testing.T) { + t.Helper() + registryMu.Lock() + registry = map[string]*Setting{} + envMap = nil + envOnce = sync.Once{} + registryMu.Unlock() +} + +func TestParse(t *testing.T) { + tests := []struct { + input string + want map[string]string + }{ + {"", map[string]string{}}, + {"dumpast=1", map[string]string{"dumpast": "1"}}, + {"dumpast=1,trace=trace.out", map[string]string{"dumpast": "1", "trace": "trace.out"}}, + {" dumpast=1 , processplugins=0 ", map[string]string{"dumpast": "1", "processplugins": "0"}}, + {"trace=", map[string]string{"trace": ""}}, + {"bare", map[string]string{}}, + } + for _, tt := range tests { + got := parse(tt.input) + if len(got) != len(tt.want) { + t.Errorf("parse(%q): got %v, want %v", tt.input, got, tt.want) + continue + } + for k, v := range tt.want { + if got[k] != v { + t.Errorf("parse(%q)[%q] = %q, want %q", tt.input, k, got[k], v) + } + } + } +} + +func TestSettingValue(t *testing.T) { + resetForTest(t) + Update("dumpast=1,trace=foo.out") + + if v := New("dumpast").Value(); v != "1" { + t.Errorf("dumpast = %q, want %q", v, "1") + } + if v := New("trace").Value(); v != "foo.out" { + t.Errorf("trace = %q, want %q", v, "foo.out") + } + if !New("dumpast").IsSet() { + t.Errorf("IsSet(dumpast) = false, want true") + } + + // Unset key returns its registered default. + if v := New("processplugins").Value(); v != "1" { + t.Errorf("processplugins default = %q, want %q", v, "1") + } + if New("processplugins").IsSet() { + t.Errorf("IsSet(processplugins) = true, want false") + } +} + +func TestUpdateRefreshesExistingSettings(t *testing.T) { + resetForTest(t) + dumpAST := New("dumpast") + + if v := dumpAST.Value(); v != "" { + t.Errorf("initial dumpast = %q, want empty", v) + } + + Update("dumpast=1") + if v := dumpAST.Value(); v != "1" { + t.Errorf("after Update dumpast = %q, want %q", v, "1") + } + + Update("") + if v := dumpAST.Value(); v != "" { + t.Errorf("after reset dumpast = %q, want empty", v) + } + if dumpAST.IsSet() { + t.Errorf("after reset IsSet = true, want false") + } +} + +func TestAny(t *testing.T) { + resetForTest(t) + if Any() { + t.Errorf("Any() = true, want false on empty env") + } + Update("trace=1") + if !Any() { + t.Errorf("Any() = false, want true after Update") + } +} + +func TestNewPanicsOnUnknown(t *testing.T) { + resetForTest(t) + defer func() { + if r := recover(); r == nil { + t.Errorf("New(\"bogus\") did not panic") + } + }() + New("bogus") +} diff --git a/internal/sqlite3ext/sqlite3ext.go b/internal/sqlite3ext/sqlite3ext.go new file mode 100644 index 0000000000..b3382e4920 --- /dev/null +++ b/internal/sqlite3ext/sqlite3ext.go @@ -0,0 +1,21 @@ +// Package sqlite3ext registers the SQLite extensions sqlc relies on with +// github.com/ncruces/go-sqlite3. +// +// As of go-sqlite3 v0.35.0 the FTS5 and R*Tree/Geopoly extensions are compiled +// separately and are no longer part of the default build. Registering them as +// auto extensions makes them available on every connection, matching the +// behavior of earlier releases. +// +// Import this package for side effects wherever a SQLite connection is opened. +package sqlite3ext + +import ( + "github.com/ncruces/go-sqlite3" + "github.com/ncruces/go-sqlite3/ext/fts5" + "github.com/ncruces/go-sqlite3/ext/rtree" +) + +func init() { + sqlite3.AutoExtension(fts5.Register) + sqlite3.AutoExtension(rtree.Register) +} diff --git a/internal/sqltest/docker/enabled.go b/internal/sqltest/docker/enabled.go new file mode 100644 index 0000000000..251ae1f332 --- /dev/null +++ b/internal/sqltest/docker/enabled.go @@ -0,0 +1,23 @@ +package docker + +import ( + "fmt" + "os/exec" + + "golang.org/x/sync/singleflight" +) + +var flight singleflight.Group + +func Installed() error { + if _, err := exec.LookPath("docker"); err != nil { + return fmt.Errorf("docker not found: %w", err) + } + // Verify the Docker daemon is actually running and accessible. + // Without this check, tests will try Docker, fail on docker pull, + // and t.Fatal instead of falling back to native database support. + if out, err := exec.Command("docker", "info").CombinedOutput(); err != nil { + return fmt.Errorf("docker daemon not available: %w\n%s", err, out) + } + return nil +} diff --git a/internal/sqltest/docker/mysql.go b/internal/sqltest/docker/mysql.go new file mode 100644 index 0000000000..2079b7cc44 --- /dev/null +++ b/internal/sqltest/docker/mysql.go @@ -0,0 +1,104 @@ +package docker + +import ( + "context" + "database/sql" + "fmt" + "os/exec" + "strings" + "time" + + _ "github.com/go-sql-driver/mysql" +) + +var mysqlHost string + +func StartMySQLServer(c context.Context) (string, error) { + if err := Installed(); err != nil { + return "", err + } + if mysqlHost != "" { + return mysqlHost, nil + } + value, err, _ := flight.Do("mysql", func() (any, error) { + host, err := startMySQLServer(c) + if err != nil { + return "", err + } + mysqlHost = host + return host, nil + }) + if err != nil { + return "", err + } + data, ok := value.(string) + if !ok { + return "", fmt.Errorf("returned value was not a string") + } + return data, nil +} + +func startMySQLServer(c context.Context) (string, error) { + { + _, err := exec.Command("docker", "pull", "mysql:9").CombinedOutput() + if err != nil { + return "", fmt.Errorf("docker pull: mysql:9 %w", err) + } + } + + var exists bool + { + cmd := exec.Command("docker", "container", "inspect", "sqlc_sqltest_docker_mysql") + // This means we've already started the container + exists = cmd.Run() == nil + } + + if !exists { + cmd := exec.Command("docker", "run", + "--name", "sqlc_sqltest_docker_mysql", + "-e", "MYSQL_ROOT_PASSWORD=mysecretpassword", + "-e", "MYSQL_DATABASE=dinotest", + "-p", "3306:3306", + "-d", + "mysql:9", + ) + + output, err := cmd.CombinedOutput() + fmt.Println(string(output)) + + msg := `Conflict. The container name "/sqlc_sqltest_docker_mysql" is already in use by container` + if !strings.Contains(string(output), msg) && err != nil { + return "", err + } + } + + ctx, cancel := context.WithTimeout(c, 10*time.Second) + defer cancel() + + // Create a ticker that fires every 10ms + ticker := time.NewTicker(10 * time.Millisecond) + defer ticker.Stop() + + uri := "root:mysecretpassword@/dinotest?multiStatements=true&parseTime=true" + + db, err := sql.Open("mysql", uri) + if err != nil { + return "", fmt.Errorf("sql.Open: %w", err) + } + + defer db.Close() + + for { + select { + case <-ctx.Done(): + return "", fmt.Errorf("timeout reached: %w", ctx.Err()) + + case <-ticker.C: + // Run your function here + if err := db.PingContext(ctx); err != nil { + continue + } + return uri, nil + } + } +} diff --git a/internal/sqltest/docker/postgres.go b/internal/sqltest/docker/postgres.go new file mode 100644 index 0000000000..243a53b90b --- /dev/null +++ b/internal/sqltest/docker/postgres.go @@ -0,0 +1,105 @@ +package docker + +import ( + "context" + "fmt" + "log/slog" + "os/exec" + "strings" + "time" + + "github.com/jackc/pgx/v5" +) + +var postgresHost string + +func StartPostgreSQLServer(c context.Context) (string, error) { + if err := Installed(); err != nil { + return "", err + } + if postgresHost != "" { + return postgresHost, nil + } + value, err, _ := flight.Do("postgresql", func() (any, error) { + host, err := startPostgreSQLServer(c) + if err != nil { + return "", err + } + postgresHost = host + return host, err + }) + if err != nil { + return "", err + } + data, ok := value.(string) + if !ok { + return "", fmt.Errorf("returned value was not a string") + } + return data, nil +} + +func startPostgreSQLServer(c context.Context) (string, error) { + { + _, err := exec.Command("docker", "pull", "postgres:16").CombinedOutput() + if err != nil { + return "", fmt.Errorf("docker pull: postgres:16 %w", err) + } + } + + uri := "postgres://postgres:mysecretpassword@localhost:5432/postgres?sslmode=disable" + + var exists bool + { + cmd := exec.Command("docker", "container", "inspect", "sqlc_sqltest_docker_postgres") + // This means we've already started the container + exists = cmd.Run() == nil + } + + if !exists { + cmd := exec.Command("docker", "run", + "--name", "sqlc_sqltest_docker_postgres", + "-e", "POSTGRES_PASSWORD=mysecretpassword", + "-e", "POSTGRES_USER=postgres", + "-p", "5432:5432", + "-d", + "postgres:16", + "-c", "max_connections=200", + ) + + output, err := cmd.CombinedOutput() + fmt.Println(string(output)) + + msg := `Conflict. The container name "/sqlc_sqltest_docker_postgres" is already in use by container` + if !strings.Contains(string(output), msg) && err != nil { + return "", err + } + } + + ctx, cancel := context.WithTimeout(c, 5*time.Second) + defer cancel() + + // Create a ticker that fires every 10ms + ticker := time.NewTicker(10 * time.Millisecond) + defer ticker.Stop() + + for { + select { + case <-ctx.Done(): + return "", fmt.Errorf("timeout reached: %w", ctx.Err()) + + case <-ticker.C: + // Run your function here + conn, err := pgx.Connect(ctx, uri) + if err != nil { + slog.Debug("sqltest", "connect", err) + continue + } + defer conn.Close(ctx) + if err := conn.Ping(ctx); err != nil { + slog.Error("sqltest", "ping", err) + continue + } + return uri, nil + } + } +} diff --git a/internal/sqltest/hosted/db.go b/internal/sqltest/hosted/db.go deleted file mode 100644 index 74bbf35421..0000000000 --- a/internal/sqltest/hosted/db.go +++ /dev/null @@ -1,78 +0,0 @@ -package hosted - -import ( - "context" - "fmt" - "os" - "sync" - "testing" - - "github.com/sqlc-dev/sqlc/internal/quickdb" - pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1" - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" -) - -var client pb.QuickClient -var once sync.Once - -func initClient() error { - projectID := os.Getenv("CI_SQLC_PROJECT_ID") - authToken := os.Getenv("CI_SQLC_AUTH_TOKEN") - if projectID == "" || authToken == "" { - return fmt.Errorf("missing project id or auth token") - } - c, err := quickdb.NewClient(projectID, authToken) - if err != nil { - return err - } - client = c - return nil -} - -func PostgreSQL(t *testing.T, migrations []string) string { - ctx := context.Background() - t.Helper() - - once.Do(func() { - if err := initClient(); err != nil { - t.Log(err) - } - }) - - if client == nil { - t.Skip("client init failed") - } - - var seed []string - files, err := sqlpath.Glob(migrations) - if err != nil { - t.Fatal(err) - } - for _, f := range files { - blob, err := os.ReadFile(f) - if err != nil { - t.Fatal(err) - } - seed = append(seed, string(blob)) - } - - resp, err := client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{ - Engine: "postgresql", - Region: quickdb.GetClosestRegion(), - Migrations: seed, - }) - if err != nil { - t.Fatalf("region %s: %s", quickdb.GetClosestRegion(), err) - } - - t.Cleanup(func() { - _, err = client.DropEphemeralDatabase(ctx, &pb.DropEphemeralDatabaseRequest{ - DatabaseId: resp.DatabaseId, - }) - if err != nil { - t.Fatal(err) - } - }) - - return resp.Uri -} diff --git a/internal/sqltest/local/id.go b/internal/sqltest/local/id.go new file mode 100644 index 0000000000..919e2dca1d --- /dev/null +++ b/internal/sqltest/local/id.go @@ -0,0 +1,13 @@ +package local + +import "math/rand" + +var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +func id() string { + b := make([]rune, 10) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/internal/sqltest/local/mysql.go b/internal/sqltest/local/mysql.go new file mode 100644 index 0000000000..05733f6e8b --- /dev/null +++ b/internal/sqltest/local/mysql.go @@ -0,0 +1,109 @@ +package local + +import ( + "context" + "database/sql" + "fmt" + "os" + "strings" + "sync" + "testing" + + "github.com/go-sql-driver/mysql" + + migrate "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sqltest/docker" + "github.com/sqlc-dev/sqlc/internal/sqltest/native" +) + +var mysqlSync sync.Once +var mysqlPool *sql.DB + +func MySQL(t *testing.T, migrations []string) string { + ctx := context.Background() + t.Helper() + + dburi := os.Getenv("MYSQL_SERVER_URI") + if dburi == "" { + if ierr := docker.Installed(); ierr == nil { + u, err := docker.StartMySQLServer(ctx) + if err != nil { + t.Fatal(err) + } + dburi = u + } else if ierr := native.Supported(); ierr == nil { + // Fall back to native installation when Docker is not available + u, err := native.StartMySQLServer(ctx) + if err != nil { + t.Fatal(err) + } + dburi = u + } else { + t.Skip("MYSQL_SERVER_URI is empty and neither Docker nor native installation is available") + } + } + + mysqlSync.Do(func() { + db, err := sql.Open("mysql", dburi) + if err != nil { + t.Fatal(err) + } + mysqlPool = db + }) + + if mysqlPool == nil { + t.Fatalf("MySQL pool creation failed") + } + + var seed []string + files, err := sqlpath.Glob(migrations) + if err != nil { + t.Fatal(err) + } + for _, f := range files { + blob, err := os.ReadFile(f) + if err != nil { + t.Fatal(err) + } + seed = append(seed, migrate.RemoveRollbackStatements(string(blob))) + } + + cfg, err := mysql.ParseDSN(dburi) + if err != nil { + t.Fatal(err) + } + + name := fmt.Sprintf("sqlc_test_%s", id()) + + if _, err := mysqlPool.ExecContext(ctx, fmt.Sprintf("CREATE DATABASE `%s`", name)); err != nil { + t.Fatal(err) + } + + cfg.DBName = name + + dropQuery := fmt.Sprintf("DROP DATABASE `%s`", name) + + t.Cleanup(func() { + if _, err := mysqlPool.ExecContext(ctx, dropQuery); err != nil { + t.Fatal(err) + } + }) + + db, err := sql.Open("mysql", cfg.FormatDSN()) + if err != nil { + t.Fatalf("connect %s: %s", name, err) + } + defer db.Close() + + for _, q := range seed { + if len(strings.TrimSpace(q)) == 0 { + continue + } + if _, err := db.ExecContext(ctx, q); err != nil { + t.Fatalf("%s: %s", q, err) + } + } + + return cfg.FormatDSN() +} diff --git a/internal/sqltest/local/postgres.go b/internal/sqltest/local/postgres.go new file mode 100644 index 0000000000..7b5a848dc7 --- /dev/null +++ b/internal/sqltest/local/postgres.go @@ -0,0 +1,136 @@ +package local + +import ( + "context" + "fmt" + "hash/fnv" + "net/url" + "os" + "strings" + "testing" + + "github.com/jackc/pgx/v5" + "golang.org/x/sync/singleflight" + + migrate "github.com/sqlc-dev/sqlc/internal/migrations" + "github.com/sqlc-dev/sqlc/internal/pgx/poolcache" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "github.com/sqlc-dev/sqlc/internal/sqltest/docker" + "github.com/sqlc-dev/sqlc/internal/sqltest/native" +) + +var flight singleflight.Group +var cache = poolcache.New() + +func PostgreSQL(t *testing.T, migrations []string) string { + return postgreSQL(t, migrations, true) +} + +func ReadOnlyPostgreSQL(t *testing.T, migrations []string) string { + return postgreSQL(t, migrations, false) +} + +func postgreSQL(t *testing.T, migrations []string, rw bool) string { + ctx := context.Background() + t.Helper() + + dburi := os.Getenv("POSTGRESQL_SERVER_URI") + if dburi == "" { + if ierr := docker.Installed(); ierr == nil { + u, err := docker.StartPostgreSQLServer(ctx) + if err != nil { + t.Fatal(err) + } + dburi = u + } else if ierr := native.Supported(); ierr == nil { + // Fall back to native installation when Docker is not available + u, err := native.StartPostgreSQLServer(ctx) + if err != nil { + t.Fatal(err) + } + dburi = u + } else { + t.Skip("POSTGRESQL_SERVER_URI is empty and neither Docker nor native installation is available") + } + } + + postgresPool, err := cache.Open(ctx, dburi) + if err != nil { + t.Fatalf("PostgreSQL pool creation failed: %s", err) + } + + var seed []string + files, err := sqlpath.Glob(migrations) + if err != nil { + t.Fatal(err) + } + + h := fnv.New64() + for _, f := range files { + blob, err := os.ReadFile(f) + if err != nil { + t.Fatal(err) + } + h.Write(blob) + seed = append(seed, migrate.RemoveRollbackStatements(string(blob))) + } + + var name string + if rw { + name = fmt.Sprintf("sqlc_test_%s", id()) + } else { + name = fmt.Sprintf("sqlc_test_%x", h.Sum(nil)) + } + + uri, err := url.Parse(dburi) + if err != nil { + t.Fatal(err) + } + uri.Path = name + dropQuery := fmt.Sprintf(`DROP DATABASE IF EXISTS "%s" WITH (FORCE)`, name) + + key := uri.String() + + _, err, _ = flight.Do(key, func() (any, error) { + row := postgresPool.QueryRow(ctx, + fmt.Sprintf(`SELECT datname FROM pg_database WHERE datname = '%s'`, name)) + + var datname string + if err := row.Scan(&datname); err == nil { + t.Logf("database exists: %s", name) + return nil, nil + } + + t.Logf("creating database: %s", name) + if _, err := postgresPool.Exec(ctx, fmt.Sprintf(`CREATE DATABASE "%s"`, name)); err != nil { + return nil, err + } + + conn, err := pgx.Connect(ctx, uri.String()) + if err != nil { + return nil, fmt.Errorf("connect %s: %s", name, err) + } + defer conn.Close(ctx) + + for _, q := range seed { + if len(strings.TrimSpace(q)) == 0 { + continue + } + if _, err := conn.Exec(ctx, q); err != nil { + return nil, fmt.Errorf("%s: %s", q, err) + } + } + return nil, nil + }) + if rw || err != nil { + t.Cleanup(func() { + if _, err := postgresPool.Exec(ctx, dropQuery); err != nil { + t.Fatalf("failed cleaning up: %s", err) + } + }) + } + if err != nil { + t.Fatalf("create db: %s", err) + } + return key +} diff --git a/internal/sqltest/mysql.go b/internal/sqltest/mysql.go index a1fbf41571..cdeb8b8b7a 100644 --- a/internal/sqltest/mysql.go +++ b/internal/sqltest/mysql.go @@ -3,15 +3,31 @@ package sqltest import ( "database/sql" "fmt" + "math/rand" "os" "path/filepath" "testing" - - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + "time" _ "github.com/go-sql-driver/mysql" + + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" ) +func init() { + rand.Seed(time.Now().UnixNano()) +} + +var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +func id() string { + b := make([]rune, 10) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} + func MySQL(t *testing.T, migrations []string) (*sql.DB, func()) { // For each test, pick a new database name at random. name := "sqltest_mysql_" + id() diff --git a/internal/sqltest/native/enabled.go b/internal/sqltest/native/enabled.go new file mode 100644 index 0000000000..e5e12ccd80 --- /dev/null +++ b/internal/sqltest/native/enabled.go @@ -0,0 +1,20 @@ +package native + +import ( + "fmt" + "os/exec" + "runtime" +) + +// Supported returns nil if native database installation is supported on this platform. +// Currently only Linux (Ubuntu/Debian) is supported. +func Supported() error { + if runtime.GOOS != "linux" { + return fmt.Errorf("native database installation only supported on linux, got %s", runtime.GOOS) + } + // Check if apt-get is available (Debian/Ubuntu) + if _, err := exec.LookPath("apt-get"); err != nil { + return fmt.Errorf("apt-get not found: %w", err) + } + return nil +} diff --git a/internal/sqltest/native/mysql.go b/internal/sqltest/native/mysql.go new file mode 100644 index 0000000000..924e23b13b --- /dev/null +++ b/internal/sqltest/native/mysql.go @@ -0,0 +1,203 @@ +package native + +import ( + "context" + "database/sql" + "fmt" + "log/slog" + "os/exec" + "time" + + _ "github.com/go-sql-driver/mysql" + "golang.org/x/sync/singleflight" +) + +var mysqlFlight singleflight.Group +var mysqlURI string + +// StartMySQLServer starts an existing MySQL installation natively (without Docker). +func StartMySQLServer(ctx context.Context) (string, error) { + if err := Supported(); err != nil { + return "", err + } + if mysqlURI != "" { + return mysqlURI, nil + } + value, err, _ := mysqlFlight.Do("mysql", func() (any, error) { + uri, err := startMySQLServer(ctx) + if err != nil { + return "", err + } + mysqlURI = uri + return uri, nil + }) + if err != nil { + return "", err + } + data, ok := value.(string) + if !ok { + return "", fmt.Errorf("returned value was not a string") + } + return data, nil +} + +func startMySQLServer(ctx context.Context) (string, error) { + // Standard URI for test MySQL + uri := "root:mysecretpassword@tcp(localhost:3306)/mysql?multiStatements=true&parseTime=true" + + // Try to connect first - it might already be running + if err := waitForMySQL(ctx, uri, 500*time.Millisecond); err == nil { + slog.Info("native/mysql", "status", "already running") + return uri, nil + } + + // Also try without password (default MySQL installation) + uriNoPassword := "root@tcp(localhost:3306)/mysql?multiStatements=true&parseTime=true" + if err := waitForMySQL(ctx, uriNoPassword, 500*time.Millisecond); err == nil { + slog.Info("native/mysql", "status", "already running (no password)") + // MySQL is running without password, try to set one + if err := setMySQLPassword(ctx); err != nil { + slog.Debug("native/mysql", "set-password-error", err) + // Return without password if we can't set one + return uriNoPassword, nil + } + // Try again with password + if err := waitForMySQL(ctx, uri, 1*time.Second); err == nil { + return uri, nil + } + // If password didn't work, use no password + return uriNoPassword, nil + } + + // Try to start existing MySQL service (might be installed but not running) + if _, err := exec.LookPath("mysqld"); err == nil { + slog.Info("native/mysql", "status", "starting existing service") + if err := startMySQLService(); err != nil { + slog.Debug("native/mysql", "start-error", err) + } else { + // Wait for MySQL to be ready + waitCtx, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() + + // Try with password first + if err := waitForMySQL(waitCtx, uri, 15*time.Second); err == nil { + return uri, nil + } + + // Try without password + if err := waitForMySQL(waitCtx, uriNoPassword, 15*time.Second); err == nil { + if err := setMySQLPassword(ctx); err != nil { + slog.Debug("native/mysql", "set-password-error", err) + return uriNoPassword, nil + } + if err := waitForMySQL(ctx, uri, 1*time.Second); err == nil { + return uri, nil + } + return uriNoPassword, nil + } + } + } + + return "", fmt.Errorf("MySQL is not installed or could not be started") +} + +func startMySQLService() error { + // Try systemctl first + cmd := exec.Command("sudo", "systemctl", "start", "mysql") + if err := cmd.Run(); err == nil { + // Give MySQL time to fully initialize + time.Sleep(2 * time.Second) + return nil + } + + // Try mysqld + cmd = exec.Command("sudo", "systemctl", "start", "mysqld") + if err := cmd.Run(); err == nil { + time.Sleep(2 * time.Second) + return nil + } + + // Try service command + cmd = exec.Command("sudo", "service", "mysql", "start") + if err := cmd.Run(); err == nil { + time.Sleep(2 * time.Second) + return nil + } + + cmd = exec.Command("sudo", "service", "mysqld", "start") + if err := cmd.Run(); err == nil { + time.Sleep(2 * time.Second) + return nil + } + + return fmt.Errorf("could not start MySQL service") +} + +func setMySQLPassword(ctx context.Context) error { + // Connect without password + db, err := sql.Open("mysql", "root@tcp(localhost:3306)/mysql") + if err != nil { + return err + } + defer db.Close() + + // Set root password using mysql_native_password for broader compatibility + _, err = db.ExecContext(ctx, "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysecretpassword';") + if err != nil { + // Try without specifying auth plugin + _, err = db.ExecContext(ctx, "ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysecretpassword';") + if err != nil { + // Try older MySQL syntax + _, err = db.ExecContext(ctx, "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mysecretpassword');") + if err != nil { + return fmt.Errorf("could not set MySQL password: %w", err) + } + } + } + + // Flush privileges + _, _ = db.ExecContext(ctx, "FLUSH PRIVILEGES;") + + return nil +} + +func waitForMySQL(ctx context.Context, uri string, timeout time.Duration) error { + deadline := time.Now().Add(timeout) + ticker := time.NewTicker(500 * time.Millisecond) + defer ticker.Stop() + + // Make an immediate first attempt before waiting for the ticker + if err := tryMySQLConnection(ctx, uri); err == nil { + return nil + } + + var lastErr error + for { + select { + case <-ctx.Done(): + return fmt.Errorf("context cancelled: %w (last error: %v)", ctx.Err(), lastErr) + case <-ticker.C: + if time.Now().After(deadline) { + return fmt.Errorf("timeout waiting for MySQL (last error: %v)", lastErr) + } + if err := tryMySQLConnection(ctx, uri); err != nil { + lastErr = err + continue + } + return nil + } + } +} + +func tryMySQLConnection(ctx context.Context, uri string) error { + db, err := sql.Open("mysql", uri) + if err != nil { + slog.Debug("native/mysql", "open-attempt", err) + return err + } + defer db.Close() + // Use a short timeout for ping to avoid hanging + pingCtx, cancel := context.WithTimeout(ctx, 2*time.Second) + defer cancel() + return db.PingContext(pingCtx) +} diff --git a/internal/sqltest/native/postgres.go b/internal/sqltest/native/postgres.go new file mode 100644 index 0000000000..91b7f56afe --- /dev/null +++ b/internal/sqltest/native/postgres.go @@ -0,0 +1,221 @@ +package native + +import ( + "context" + "fmt" + "log/slog" + "os/exec" + "strings" + "time" + + "github.com/jackc/pgx/v5" + "golang.org/x/sync/singleflight" +) + +var postgresFlight singleflight.Group +var postgresURI string + +// StartPostgreSQLServer starts an existing PostgreSQL installation natively (without Docker). +func StartPostgreSQLServer(ctx context.Context) (string, error) { + if err := Supported(); err != nil { + return "", err + } + if postgresURI != "" { + return postgresURI, nil + } + value, err, _ := postgresFlight.Do("postgresql", func() (any, error) { + uri, err := startPostgreSQLServer(ctx) + if err != nil { + return "", err + } + postgresURI = uri + return uri, nil + }) + if err != nil { + return "", err + } + data, ok := value.(string) + if !ok { + return "", fmt.Errorf("returned value was not a string") + } + return data, nil +} + +func startPostgreSQLServer(ctx context.Context) (string, error) { + // Standard URI for test PostgreSQL + uri := "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" + + // Try to connect first - it might already be running + if err := waitForPostgres(ctx, uri, 500*time.Millisecond); err == nil { + slog.Info("native/postgres", "status", "already running") + return uri, nil + } + + // Check if PostgreSQL is installed + if _, err := exec.LookPath("psql"); err != nil { + return "", fmt.Errorf("PostgreSQL is not installed (psql not found)") + } + + // Start PostgreSQL service + slog.Info("native/postgres", "status", "starting service") + + // Try systemctl first, fall back to pg_ctlcluster + if err := startPostgresService(); err != nil { + return "", fmt.Errorf("failed to start PostgreSQL: %w", err) + } + + // Configure PostgreSQL for password authentication + if err := configurePostgres(); err != nil { + return "", fmt.Errorf("failed to configure PostgreSQL: %w", err) + } + + // Wait for PostgreSQL to be ready + waitCtx, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() + + if err := waitForPostgres(waitCtx, uri, 30*time.Second); err != nil { + return "", fmt.Errorf("timeout waiting for PostgreSQL: %w", err) + } + + return uri, nil +} + +func startPostgresService() error { + // Try systemctl first + cmd := exec.Command("sudo", "systemctl", "start", "postgresql") + if err := cmd.Run(); err == nil { + return nil + } + + // Try service command + cmd = exec.Command("sudo", "service", "postgresql", "start") + if err := cmd.Run(); err == nil { + return nil + } + + // Try pg_ctlcluster (Debian/Ubuntu specific) + // Find the installed PostgreSQL version + output, err := exec.Command("ls", "/etc/postgresql/").CombinedOutput() + if err != nil { + return fmt.Errorf("could not find PostgreSQL version: %w", err) + } + + versions := strings.Fields(string(output)) + if len(versions) == 0 { + return fmt.Errorf("no PostgreSQL version found in /etc/postgresql/") + } + + version := versions[0] + cmd = exec.Command("sudo", "pg_ctlcluster", version, "main", "start") + if output, err := cmd.CombinedOutput(); err != nil { + return fmt.Errorf("pg_ctlcluster start failed: %w\n%s", err, output) + } + + return nil +} + +func configurePostgres() error { + // Set password for postgres user using sudo -u postgres + cmd := exec.Command("sudo", "-u", "postgres", "psql", "-c", "ALTER USER postgres PASSWORD 'postgres';") + if output, err := cmd.CombinedOutput(); err != nil { + // This might fail if password is already set, which is fine + slog.Debug("native/postgres", "set-password", string(output)) + } + + // Update pg_hba.conf to allow password authentication + // First, find the pg_hba.conf file + output, err := exec.Command("sudo", "-u", "postgres", "psql", "-t", "-c", "SHOW hba_file;").CombinedOutput() + if err != nil { + return fmt.Errorf("could not find hba_file: %w", err) + } + + hbaFile := strings.TrimSpace(string(output)) + if hbaFile == "" { + return fmt.Errorf("empty hba_file path") + } + + // Check if we need to update pg_hba.conf + catOutput, err := exec.Command("sudo", "cat", hbaFile).CombinedOutput() + if err != nil { + return fmt.Errorf("could not read %s: %w", hbaFile, err) + } + + // If md5 or scram-sha-256 auth is not configured for local connections, add it + content := string(catOutput) + if !strings.Contains(content, "host all all 127.0.0.1/32 md5") && + !strings.Contains(content, "host all all 127.0.0.1/32 scram-sha-256") { + + // Prepend a rule for localhost password authentication + newRule := "host all all 127.0.0.1/32 md5\n" + + // Use sed to add the rule at the beginning (after comments) + cmd := exec.Command("sudo", "bash", "-c", + fmt.Sprintf(`echo '%s' | cat - %s > /tmp/pg_hba.conf.new && sudo mv /tmp/pg_hba.conf.new %s`, + newRule, hbaFile, hbaFile)) + if output, err := cmd.CombinedOutput(); err != nil { + slog.Debug("native/postgres", "update-hba-error", string(output)) + } + + // Reload PostgreSQL to apply changes + if err := reloadPostgres(); err != nil { + slog.Debug("native/postgres", "reload-error", err) + } + } + + return nil +} + +func reloadPostgres() error { + // Try systemctl reload + cmd := exec.Command("sudo", "systemctl", "reload", "postgresql") + if err := cmd.Run(); err == nil { + return nil + } + + // Try service reload + cmd = exec.Command("sudo", "service", "postgresql", "reload") + if err := cmd.Run(); err == nil { + return nil + } + + // Try pg_ctlcluster reload + output, _ := exec.Command("ls", "/etc/postgresql/").CombinedOutput() + versions := strings.Fields(string(output)) + if len(versions) > 0 { + cmd = exec.Command("sudo", "pg_ctlcluster", versions[0], "main", "reload") + return cmd.Run() + } + + return fmt.Errorf("could not reload PostgreSQL") +} + +func waitForPostgres(ctx context.Context, uri string, timeout time.Duration) error { + deadline := time.Now().Add(timeout) + ticker := time.NewTicker(100 * time.Millisecond) + defer ticker.Stop() + + var lastErr error + for { + select { + case <-ctx.Done(): + return fmt.Errorf("context cancelled: %w (last error: %v)", ctx.Err(), lastErr) + case <-ticker.C: + if time.Now().After(deadline) { + return fmt.Errorf("timeout waiting for PostgreSQL (last error: %v)", lastErr) + } + conn, err := pgx.Connect(ctx, uri) + if err != nil { + lastErr = err + slog.Debug("native/postgres", "connect-attempt", err) + continue + } + if err := conn.Ping(ctx); err != nil { + lastErr = err + conn.Close(ctx) + continue + } + conn.Close(ctx) + return nil + } + } +} diff --git a/internal/sqltest/pgx.go b/internal/sqltest/pgx.go deleted file mode 100644 index 73e01701bd..0000000000 --- a/internal/sqltest/pgx.go +++ /dev/null @@ -1,88 +0,0 @@ -package sqltest - -import ( - "context" - "fmt" - "math/rand" - "os" - "path/filepath" - "testing" - "time" - - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" - - "github.com/jackc/pgx/v4" -) - -func init() { - rand.Seed(time.Now().UnixNano()) -} - -func PostgreSQLPgx(t *testing.T, migrations []string) (*pgx.Conn, func()) { - t.Helper() - - pgUser := os.Getenv("PG_USER") - pgHost := os.Getenv("PG_HOST") - pgPort := os.Getenv("PG_PORT") - pgPass := os.Getenv("PG_PASSWORD") - pgDB := os.Getenv("PG_DATABASE") - - if pgUser == "" { - pgUser = "postgres" - } - - if pgPass == "" { - pgPass = "mysecretpassword" - } - - if pgPort == "" { - pgPort = "5432" - } - - if pgHost == "" { - pgHost = "127.0.0.1" - } - - if pgDB == "" { - pgDB = "dinotest" - } - - source := fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable", pgUser, pgPass, pgHost, pgPort, pgDB) - t.Logf("db: %s", source) - - db, err := pgx.Connect(context.Background(), source) - if err != nil { - t.Fatal(err) - } - - // For each test, pick a new schema name at random. - schema := "sqltest_postgresql_" + id() - if _, err := db.Exec(context.Background(), "CREATE SCHEMA "+schema); err != nil { - t.Fatal(err) - } - - sdb, err := pgx.Connect(context.Background(), source+"&search_path="+schema) - if err != nil { - t.Fatal(err) - } - - files, err := sqlpath.Glob(migrations) - if err != nil { - t.Fatal(err) - } - for _, f := range files { - blob, err := os.ReadFile(f) - if err != nil { - t.Fatal(err) - } - if _, err := sdb.Exec(context.Background(), string(blob)); err != nil { - t.Fatalf("%s: %s", filepath.Base(f), err) - } - } - - return sdb, func() { - if _, err := db.Exec(context.Background(), "DROP SCHEMA "+schema+" CASCADE"); err != nil { - t.Fatal(err) - } - } -} diff --git a/internal/sqltest/postgres.go b/internal/sqltest/postgres.go deleted file mode 100644 index edf6272d41..0000000000 --- a/internal/sqltest/postgres.go +++ /dev/null @@ -1,117 +0,0 @@ -package sqltest - -import ( - "database/sql" - "fmt" - "math/rand" - "os" - "path/filepath" - "testing" - "time" - - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" - - _ "github.com/lib/pq" -) - -func init() { - rand.Seed(time.Now().UnixNano()) -} - -var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") - -func id() string { - b := make([]rune, 10) - for i := range b { - b[i] = letterRunes[rand.Intn(len(letterRunes))] - } - return string(b) -} - -func PostgreSQL(t *testing.T, migrations []string) (*sql.DB, func()) { - t.Helper() - - // For each test, pick a new schema name at random. - schema := "sqltest_postgresql_" + id() - return CreatePostgreSQLDatabase(t, schema, true, migrations) -} - -func CreatePostgreSQLDatabase(t *testing.T, name string, schema bool, migrations []string) (*sql.DB, func()) { - t.Helper() - - pgUser := os.Getenv("PG_USER") - pgHost := os.Getenv("PG_HOST") - pgPort := os.Getenv("PG_PORT") - pgPass := os.Getenv("PG_PASSWORD") - pgDB := os.Getenv("PG_DATABASE") - - if pgUser == "" { - pgUser = "postgres" - } - - if pgPass == "" { - pgPass = "mysecretpassword" - } - - if pgPort == "" { - pgPort = "5432" - } - - if pgHost == "" { - pgHost = "127.0.0.1" - } - - if pgDB == "" { - pgDB = "dinotest" - } - - source := fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable", pgUser, pgPass, pgHost, pgPort, pgDB) - t.Logf("db: %s", source) - - db, err := sql.Open("postgres", source) - if err != nil { - t.Fatal(err) - } - - // For each test, pick a new schema name at random. - var newsource, dropQuery string - if schema { - if _, err := db.Exec("CREATE SCHEMA " + name); err != nil { - t.Fatal(err) - } - newsource = source + "&search_path=" + name - dropQuery = "DROP SCHEMA " + name + " CASCADE" - } else { - if _, err := db.Exec("CREATE DATABASE " + name); err != nil { - t.Fatal(err) - } - newsource = fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable", pgUser, pgPass, pgHost, pgPort, name) - dropQuery = "DROP DATABASE IF EXISTS " + name + " WITH (FORCE)" - } - - sdb, err := sql.Open("postgres", newsource) - if err != nil { - t.Fatal(err) - } - - files, err := sqlpath.Glob(migrations) - if err != nil { - t.Fatal(err) - } - for _, f := range files { - blob, err := os.ReadFile(f) - if err != nil { - t.Fatal(err) - } - if _, err := sdb.Exec(string(blob)); err != nil { - t.Fatalf("%s: %s", filepath.Base(f), err) - } - } - - return sdb, func() { - if _, err := db.Exec(dropQuery); err != nil { - t.Fatal(err) - } - db.Close() - } -} diff --git a/internal/sqltest/sqlite.go b/internal/sqltest/sqlite.go index cd7eff3872..b102fc97f9 100644 --- a/internal/sqltest/sqlite.go +++ b/internal/sqltest/sqlite.go @@ -6,9 +6,10 @@ import ( "path/filepath" "testing" - "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + _ "github.com/ncruces/go-sqlite3/driver" - _ "github.com/mattn/go-sqlite3" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" + _ "github.com/sqlc-dev/sqlc/internal/sqlite3ext" ) func SQLite(t *testing.T, migrations []string) (*sql.DB, func()) { @@ -18,6 +19,9 @@ func SQLite(t *testing.T, migrations []string) (*sql.DB, func()) { if err != nil { t.Fatal(err) } + if err := source.Close(); err != nil { + t.Fatal(err) + } return CreateSQLiteDatabase(t, source.Name(), migrations) } diff --git a/internal/tools/sqlc-pg-gen/main.go b/internal/tools/sqlc-pg-gen/main.go deleted file mode 100644 index d70dcb9595..0000000000 --- a/internal/tools/sqlc-pg-gen/main.go +++ /dev/null @@ -1,431 +0,0 @@ -package main - -import ( - "bytes" - "context" - "flag" - "fmt" - "go/format" - "log" - "os" - "path/filepath" - "sort" - "strings" - "text/template" - - "github.com/jackc/pgx/v4" -) - -// https://dba.stackexchange.com/questions/255412/how-to-select-functions-that-belong-in-a-given-extension-in-postgresql -// -// Extension functions are added to the public schema -const extensionFuncs = ` -WITH extension_funcs AS ( - SELECT p.oid - FROM pg_catalog.pg_extension AS e - INNER JOIN pg_catalog.pg_depend AS d ON (d.refobjid = e.oid) - INNER JOIN pg_catalog.pg_proc AS p ON (p.oid = d.objid) - INNER JOIN pg_catalog.pg_namespace AS ne ON (ne.oid = e.extnamespace) - INNER JOIN pg_catalog.pg_namespace AS np ON (np.oid = p.pronamespace) - WHERE d.deptype = 'e' AND e.extname = $1 -) -SELECT p.proname as name, - format_type(p.prorettype, NULL), - array(select format_type(unnest(p.proargtypes), NULL)), - p.proargnames, - p.proargnames[p.pronargs-p.pronargdefaults+1:p.pronargs], - p.proargmodes::text[] -FROM pg_catalog.pg_proc p -JOIN extension_funcs ef ON ef.oid = p.oid -WHERE pg_function_is_visible(p.oid) --- simply order all columns to keep subsequent runs stable -ORDER BY 1, 2, 3, 4, 5; -` - -const catalogTmpl = ` -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package {{.Pkg}} - -import ( - "github.com/sqlc-dev/sqlc/internal/sql/ast" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -var funcs{{.GenFnName}} = []*catalog.Function { - {{- range .Procs}} - { - Name: "{{.Name}}", - Args: []*catalog.Argument{ - {{range .Args}}{ - {{- if .Name}} - Name: "{{.Name}}", - {{- end}} - {{- if .HasDefault}} - HasDefault: true, - {{- end}} - Type: &ast.TypeName{Name: "{{.TypeName}}"}, - {{- if ne .Mode "i" }} - Mode: {{ .GoMode }}, - {{- end}} - }, - {{end}} - }, - ReturnType: &ast.TypeName{Name: "{{.ReturnTypeName}}"}, - }, - {{- end}} -} - -func {{.GenFnName}}() *catalog.Schema { - s := &catalog.Schema{Name: "{{ .SchemaName }}"} - s.Funcs = funcs{{.GenFnName}} - {{- if .Relations }} - s.Tables = []*catalog.Table { - {{- range .Relations }} - { - Rel: &ast.TableName{ - Catalog: "{{.Catalog}}", - Schema: "{{.SchemaName}}", - Name: "{{.Name}}", - }, - Columns: []*catalog.Column{ - {{- range .Columns}} - { - Name: "{{.Name}}", - Type: ast.TypeName{Name: "{{.Type}}"}, - {{- if .IsNotNull}} - IsNotNull: true, - {{- end}} - {{- if .IsArray}} - IsArray: true, - {{- end}} - {{- if .Length }} - Length: toPointer({{ .Length }}), - {{- end}} - }, - {{- end}} - }, - }, - {{- end}} - } - {{- end }} - return s -} -` - -const loaderFuncTmpl = ` -// Code generated by sqlc-pg-gen. DO NOT EDIT. - -package postgresql - -import ( - "github.com/sqlc-dev/sqlc/internal/engine/postgresql/contrib" - "github.com/sqlc-dev/sqlc/internal/sql/catalog" -) - -func loadExtension(name string) *catalog.Schema { - switch name { - {{- range .}} - case "{{.Name}}": - return contrib.{{.Func}}() - {{- end}} - } - return nil -} -` - -type tmplCtx struct { - Pkg string - GenFnName string - SchemaName string - Procs []Proc - Relations []Relation -} - -func main() { - if err := run(context.Background()); err != nil { - log.Fatal(err) - } -} - -func clean(arg string) string { - arg = strings.TrimSpace(arg) - arg = strings.Replace(arg, "\"any\"", "any", -1) - arg = strings.Replace(arg, "\"char\"", "char", -1) - arg = strings.Replace(arg, "\"timestamp\"", "char", -1) - return arg -} - -// writeFormattedGo executes `tmpl` with `data` as its context to the file `destPath` -func writeFormattedGo(tmpl *template.Template, data any, destPath string) error { - out := bytes.NewBuffer([]byte{}) - err := tmpl.Execute(out, data) - if err != nil { - return err - } - code, err := format.Source(out.Bytes()) - if err != nil { - return err - } - - err = os.WriteFile(destPath, code, 0644) - if err != nil { - return err - } - - return nil -} - -// preserveLegacyCatalogBehavior maintain previous ordering and filtering -// that was manually done to the generated file pg_catalog.go. -// Some of the test depend on this ordering - in particular, function lookups -// where there might be multiple matching functions (due to type overloads) -// Until sqlc supports "smarter" looking up of these functions, -// preserveLegacyCatalogBehavior ensures there are no accidental test breakages -func preserveLegacyCatalogBehavior(allProcs []Proc) []Proc { - // Preserve the legacy sort order of the end-to-end tests - sort.SliceStable(allProcs, func(i, j int) bool { - fnA := allProcs[i] - fnB := allProcs[j] - - if fnA.Name == "lower" && fnB.Name == "lower" && len(fnA.ArgTypes) == 1 && fnA.ArgTypes[0] == "text" { - return true - } - - if fnA.Name == "generate_series" && fnB.Name == "generate_series" && len(fnA.ArgTypes) == 2 && fnA.ArgTypes[0] == "numeric" { - return true - } - - return false - }) - - procs := make([]Proc, 0, len(allProcs)) - for _, p := range allProcs { - // Skip generating pg_catalog.concat to preserve legacy behavior - if p.Name == "concat" { - continue - } - - procs = append(procs, p) - } - - return procs -} - -func databaseURL() string { - dburl := os.Getenv("DATABASE_URL") - if dburl != "" { - return dburl - } - pgUser := os.Getenv("PG_USER") - pgHost := os.Getenv("PG_HOST") - pgPort := os.Getenv("PG_PORT") - pgPass := os.Getenv("PG_PASSWORD") - pgDB := os.Getenv("PG_DATABASE") - if pgUser == "" { - pgUser = "postgres" - } - if pgPass == "" { - pgPass = "mysecretpassword" - } - if pgPort == "" { - pgPort = "5432" - } - if pgHost == "" { - pgHost = "127.0.0.1" - } - if pgDB == "" { - pgDB = "dinotest" - } - return fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable", pgUser, pgPass, pgHost, pgPort, pgDB) -} - -func run(ctx context.Context) error { - flag.Parse() - - dir := flag.Arg(0) - if dir == "" { - dir = filepath.Join("internal", "engine", "postgresql") - } - - tmpl, err := template.New("").Parse(catalogTmpl) - if err != nil { - return err - } - conn, err := pgx.Connect(ctx, databaseURL()) - if err != nil { - return err - } - defer conn.Close(ctx) - - schemas := []schemaToLoad{ - { - Name: "pg_catalog", - GenFnName: "genPGCatalog", - DestPath: filepath.Join(dir, "pg_catalog.go"), - }, - { - Name: "information_schema", - GenFnName: "genInformationSchema", - DestPath: filepath.Join(dir, "information_schema.go"), - }, - } - - for _, schema := range schemas { - procs, err := readProcs(ctx, conn, schema.Name) - if err != nil { - return err - } - - if schema.Name == "pg_catalog" { - procs = preserveLegacyCatalogBehavior(procs) - } - - relations, err := readRelations(ctx, conn, schema.Name) - if err != nil { - return err - } - - err = writeFormattedGo(tmpl, tmplCtx{ - Pkg: "postgresql", - SchemaName: schema.Name, - GenFnName: schema.GenFnName, - Procs: procs, - Relations: relations, - }, schema.DestPath) - - if err != nil { - return err - } - } - - loaded := []extensionPair{} - for _, extension := range extensions { - name := strings.Replace(extension, "-", "_", -1) - - var funcName string - for _, part := range strings.Split(name, "_") { - funcName += strings.Title(part) - } - - if _, err := conn.Exec(ctx, fmt.Sprintf("CREATE EXTENSION IF NOT EXISTS %q", extension)); err != nil { - return fmt.Errorf("error creating %s: %s", extension, err) - } - - rows, err := conn.Query(ctx, extensionFuncs, extension) - if err != nil { - return err - } - procs, err := scanProcs(rows) - if err != nil { - return err - } - if len(procs) == 0 { - log.Printf("no functions in %s, skipping", extension) - continue - } - - // Preserve the legacy sort order of the end-to-end tests - sort.SliceStable(procs, func(i, j int) bool { - fnA := procs[i] - fnB := procs[j] - - if extension == "pgcrypto" { - if fnA.Name == "digest" && fnB.Name == "digest" && len(fnA.ArgTypes) == 2 && fnA.ArgTypes[0] == "text" { - return true - } - } - - return false - }) - - extensionPath := filepath.Join(dir, "contrib", name+".go") - err = writeFormattedGo(tmpl, tmplCtx{ - Pkg: "contrib", - SchemaName: "pg_catalog", - GenFnName: funcName, - Procs: procs, - }, extensionPath) - if err != nil { - return fmt.Errorf("error generating extension %s: %w", extension, err) - } - - loaded = append(loaded, extensionPair{Name: extension, Func: funcName}) - } - - extensionTmpl, err := template.New("").Parse(loaderFuncTmpl) - if err != nil { - return err - } - - extensionLoaderPath := filepath.Join(dir, "extension.go") - err = writeFormattedGo(extensionTmpl, loaded, extensionLoaderPath) - if err != nil { - return err - } - - return nil -} - -type schemaToLoad struct { - // name is the name of a schema to load - Name string - // DestPath is the desination for the generate file - DestPath string - // The name of the function to generate for loading this schema - GenFnName string -} - -type extensionPair struct { - Name string - Func string -} - -// https://www.postgresql.org/docs/current/contrib.html -var extensions = []string{ - "adminpack", - "amcheck", - // "auth_delay", - // "auto_explain", - // "bloom", - "btree_gin", - "btree_gist", - "citext", - "cube", - "dblink", - // "dict_int", - // "dict_xsyn", - "earthdistance", - "file_fdw", - "fuzzystrmatch", - "hstore", - "intagg", - "intarray", - "isn", - "lo", - "ltree", - "pageinspect", - // "passwordcheck", - "pg_buffercache", - "pg_freespacemap", - "pg_prewarm", - "pg_stat_statements", - "pg_trgm", - "pg_visibility", - "pgcrypto", - "pgrowlocks", - "pgstattuple", - "postgres_fdw", - "seg", - // "sepgsql", - // "spi", - "sslinfo", - "tablefunc", - "tcn", - // "test_decoding", - // "tsm_system_rows", - // "tsm_system_time", - "unaccent", - "uuid-ossp", - "xml2", -} diff --git a/internal/tools/sqlc-pg-gen/proc.go b/internal/tools/sqlc-pg-gen/proc.go deleted file mode 100644 index 07629ed6ea..0000000000 --- a/internal/tools/sqlc-pg-gen/proc.go +++ /dev/null @@ -1,167 +0,0 @@ -package main - -import ( - "context" - "strings" - - pgx "github.com/jackc/pgx/v4" -) - -// https://stackoverflow.com/questions/25308765/postgresql-how-can-i-inspect-which-arguments-to-a-procedure-have-a-default-valu -const catalogFuncs = ` -SELECT p.proname as name, - format_type(p.prorettype, NULL), - array(select format_type(unnest(p.proargtypes), NULL)), - p.proargnames, - p.proargnames[p.pronargs-p.pronargdefaults+1:p.pronargs], - p.proargmodes::text[] -FROM pg_catalog.pg_proc p -LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace -WHERE n.nspname::text = $1 - AND pg_function_is_visible(p.oid) --- simply order all columns to keep subsequent runs stable -ORDER BY 1, 2, 3, 4, 5; -` - -type Proc struct { - Name string - ReturnType string - ArgTypes []string - ArgNames []string - HasDefault []string - ArgModes []string -} - -func (p *Proc) ReturnTypeName() string { - return clean(p.ReturnType) -} - -func (p *Proc) Args() []Arg { - var args []Arg - defaults := map[string]bool{} - for _, name := range p.HasDefault { - defaults[name] = true - } - - for i, argType := range p.ArgTypes { - mode := "i" - name := "" - if i < len(p.ArgModes) { - mode = p.ArgModes[i] - } - if i < len(p.ArgNames) { - name = p.ArgNames[i] - } - - args = append(args, Arg{ - Name: name, - Type: argType, - Mode: mode, - HasDefault: defaults[name], - }) - } - - // Some manual changes until https://github.com/sqlc-dev/sqlc/pull/1748 - // can be completely implmented - if p.Name == "mode" { - return nil - } - - if p.Name == "percentile_cont" && len(args) == 2 { - args = args[:1] - } - - if p.Name == "percentile_disc" && len(args) == 2 { - args = args[:1] - } - - return args -} - -type Arg struct { - Name string - Mode string - Type string - HasDefault bool -} - -func (a *Arg) TypeName() string { - return clean(a.Type) -} - -// GoMode returns Go's representation of the arguemnt's mode -func (a *Arg) GoMode() string { - switch a.Mode { - case "", "i": - return "ast.FuncParamIn" - case "o": - return "ast.FuncParamOut" - case "b": - return "ast.FuncParamInOut" - case "v": - return "ast.FuncParamVariadic" - case "t": - return "ast.FuncParamTable" - } - - return "" -} - -func scanProcs(rows pgx.Rows) ([]Proc, error) { - defer rows.Close() - // Iterate through the result set - var procs []Proc - for rows.Next() { - var p Proc - err := rows.Scan( - &p.Name, - &p.ReturnType, - &p.ArgTypes, - &p.ArgNames, - &p.HasDefault, - &p.ArgModes, - ) - if err != nil { - return nil, err - } - - // TODO: Filter these out in SQL - if strings.HasPrefix(p.ReturnType, "SETOF") { - continue - } - - // The internal pseudo-type is used to declare functions that are meant - // only to be called internally by the database system, and not by - // direct invocation in an SQL query. If a function has at least one - // internal-type argument then it cannot be called from SQL. To - // preserve the type safety of this restriction it is important to - // follow this coding rule: do not create any function that is declared - // to return internal unless it has at least one internal argument - // - // https://www.postgresql.org/docs/current/datatype-pseudo.html - var skip bool - for i := range p.ArgTypes { - if p.ArgTypes[i] == "internal" { - skip = true - } - } - if skip { - continue - } - if p.ReturnType == "internal" { - continue - } - - procs = append(procs, p) - } - return procs, rows.Err() -} - -func readProcs(ctx context.Context, conn *pgx.Conn, schemaName string) ([]Proc, error) { - rows, err := conn.Query(ctx, catalogFuncs, schemaName) - if err != nil { - return nil, err - } - - return scanProcs(rows) -} diff --git a/internal/tracer/trace.go b/internal/tracer/trace.go index 8252f49b38..ececc4b2e0 100644 --- a/internal/tracer/trace.go +++ b/internal/tracer/trace.go @@ -6,14 +6,26 @@ import ( "os" "runtime/trace" - "github.com/sqlc-dev/sqlc/internal/debug" + "github.com/sqlc-dev/sqlc/internal/sqlcdebug" ) -// Start starts Go's runtime tracing facility. -// Traces will be written to the file named by [debug.Debug.Trace]. -// It also starts a new [*trace.Task] that will be stopped when the cleanup is called. +var debugTrace = sqlcdebug.New("trace") + +// Path returns the file to which Go's runtime tracer should write its +// output, derived from SQLCDEBUG=trace=... +func Path() string { + v := debugTrace.Value() + if v == "1" { + return "trace.out" + } + return v +} + +// Start starts Go's runtime tracing facility. Traces are written to the +// path returned by [Path]. It also starts a new [*trace.Task] that will +// be stopped when the cleanup is called. func Start(base context.Context) (_ context.Context, cleanup func(), _ error) { - f, err := os.Create(debug.Debug.Trace) + f, err := os.Create(Path()) if err != nil { return base, cleanup, fmt.Errorf("failed to create trace output file: %v", err) } diff --git a/internal/x/expander/expander.go b/internal/x/expander/expander.go new file mode 100644 index 0000000000..af0cab26e8 --- /dev/null +++ b/internal/x/expander/expander.go @@ -0,0 +1,507 @@ +package expander + +import ( + "context" + "fmt" + "io" + "strings" + + "github.com/sqlc-dev/sqlc/internal/sql/ast" + "github.com/sqlc-dev/sqlc/internal/sql/astutils" + "github.com/sqlc-dev/sqlc/internal/sql/format" +) + +// Parser is an interface for SQL parsers that can parse SQL into AST statements. +type Parser interface { + Parse(r io.Reader) ([]ast.Statement, error) +} + +// ColumnGetter retrieves column names for a query by preparing it against a database. +type ColumnGetter interface { + GetColumnNames(ctx context.Context, query string) ([]string, error) +} + +// Expander expands SELECT * and RETURNING * queries by replacing * with explicit column names +// obtained from preparing the query against a database. +type Expander struct { + colGetter ColumnGetter + parser Parser + dialect format.Dialect +} + +// New creates a new Expander with the given column getter, parser, and dialect. +func New(colGetter ColumnGetter, parser Parser, dialect format.Dialect) *Expander { + return &Expander{ + colGetter: colGetter, + parser: parser, + dialect: dialect, + } +} + +// Expand takes a SQL query, and if it contains * in SELECT or RETURNING clause, +// expands it to use explicit column names. Returns the expanded query string. +func (e *Expander) Expand(ctx context.Context, query string) (string, error) { + // Parse the query + stmts, err := e.parser.Parse(strings.NewReader(query)) + if err != nil { + return "", fmt.Errorf("failed to parse query: %w", err) + } + + if len(stmts) == 0 { + return query, nil + } + + stmt := stmts[0].Raw.Stmt + + // Check if there's any star in the statement (including CTEs, subqueries, etc.) + if !hasStarAnywhere(stmt) { + return query, nil + } + + // Expand all stars in the statement recursively + if err := e.expandNode(ctx, stmt); err != nil { + return "", err + } + + // Format the modified AST back to SQL + expanded := ast.Format(stmts[0].Raw, e.dialect) + + return expanded, nil +} + +// expandNode recursively expands * in all parts of the statement +func (e *Expander) expandNode(ctx context.Context, node ast.Node) error { + if node == nil { + return nil + } + + switch n := node.(type) { + case *ast.SelectStmt: + return e.expandSelectStmt(ctx, n) + case *ast.InsertStmt: + return e.expandInsertStmt(ctx, n) + case *ast.UpdateStmt: + return e.expandUpdateStmt(ctx, n) + case *ast.DeleteStmt: + return e.expandDeleteStmt(ctx, n) + case *ast.CommonTableExpr: + return e.expandNode(ctx, n.Ctequery) + } + return nil +} + +// expandSelectStmt expands * in a SELECT statement including CTEs and subqueries +func (e *Expander) expandSelectStmt(ctx context.Context, stmt *ast.SelectStmt) error { + // First expand any CTEs - must be done in order since later CTEs may depend on earlier ones + if stmt.WithClause != nil && stmt.WithClause.Ctes != nil { + for _, cteNode := range stmt.WithClause.Ctes.Items { + cte, ok := cteNode.(*ast.CommonTableExpr) + if !ok { + continue + } + cteSelect, ok := cte.Ctequery.(*ast.SelectStmt) + if !ok { + continue + } + if hasStarInList(cteSelect.TargetList) { + // Get column names for this CTE + columns, err := e.getCTEColumnNames(ctx, stmt, cte) + if err != nil { + return err + } + cteSelect.TargetList = rewriteTargetList(cteSelect.TargetList, columns) + } + // Recursively handle nested CTEs/subqueries in this CTE + if err := e.expandSelectStmtInner(ctx, cteSelect); err != nil { + return err + } + } + } + + // Expand subqueries in FROM clause + if stmt.FromClause != nil { + for _, fromItem := range stmt.FromClause.Items { + if err := e.expandFromClause(ctx, fromItem); err != nil { + return err + } + } + } + + // Expand the target list if it has stars + if hasStarInList(stmt.TargetList) { + // Format the current state to get columns + tempRaw := &ast.RawStmt{Stmt: stmt} + tempQuery := ast.Format(tempRaw, e.dialect) + columns, err := e.getColumnNames(ctx, tempQuery) + if err != nil { + return fmt.Errorf("failed to get column names: %w", err) + } + stmt.TargetList = rewriteTargetList(stmt.TargetList, columns) + } + + return nil +} + +// expandSelectStmtInner expands nested structures without re-processing the target list +func (e *Expander) expandSelectStmtInner(ctx context.Context, stmt *ast.SelectStmt) error { + // Expand subqueries in FROM clause + if stmt.FromClause != nil { + for _, fromItem := range stmt.FromClause.Items { + if err := e.expandFromClause(ctx, fromItem); err != nil { + return err + } + } + } + return nil +} + +// getCTEColumnNames gets the column names for a CTE by constructing a query with proper context +func (e *Expander) getCTEColumnNames(ctx context.Context, stmt *ast.SelectStmt, targetCTE *ast.CommonTableExpr) ([]string, error) { + // Build a temporary query: WITH SELECT * FROM + var ctesToInclude []ast.Node + for _, cteNode := range stmt.WithClause.Ctes.Items { + ctesToInclude = append(ctesToInclude, cteNode) + cte, ok := cteNode.(*ast.CommonTableExpr) + if ok && cte.Ctename != nil && targetCTE.Ctename != nil && *cte.Ctename == *targetCTE.Ctename { + break + } + } + + // Create a SELECT * FROM with the relevant CTEs + cteName := "" + if targetCTE.Ctename != nil { + cteName = *targetCTE.Ctename + } + + tempStmt := &ast.SelectStmt{ + WithClause: &ast.WithClause{ + Ctes: &ast.List{Items: ctesToInclude}, + Recursive: stmt.WithClause.Recursive, + }, + TargetList: &ast.List{ + Items: []ast.Node{ + &ast.ResTarget{ + Val: &ast.ColumnRef{ + Fields: &ast.List{ + Items: []ast.Node{&ast.A_Star{}}, + }, + }, + }, + }, + }, + FromClause: &ast.List{ + Items: []ast.Node{ + &ast.RangeVar{ + Relname: &cteName, + }, + }, + }, + } + + tempRaw := &ast.RawStmt{Stmt: tempStmt} + tempQuery := ast.Format(tempRaw, e.dialect) + + return e.getColumnNames(ctx, tempQuery) +} + +// expandInsertStmt expands * in an INSERT statement's RETURNING clause +func (e *Expander) expandInsertStmt(ctx context.Context, stmt *ast.InsertStmt) error { + // Expand CTEs first + if stmt.WithClause != nil && stmt.WithClause.Ctes != nil { + for _, cte := range stmt.WithClause.Ctes.Items { + if err := e.expandNode(ctx, cte); err != nil { + return err + } + } + } + + // Expand the SELECT part if present + if stmt.SelectStmt != nil { + if err := e.expandNode(ctx, stmt.SelectStmt); err != nil { + return err + } + } + + // Expand RETURNING clause + if hasStarInList(stmt.ReturningList) { + tempRaw := &ast.RawStmt{Stmt: stmt} + tempQuery := ast.Format(tempRaw, e.dialect) + columns, err := e.getColumnNames(ctx, tempQuery) + if err != nil { + return fmt.Errorf("failed to get column names: %w", err) + } + stmt.ReturningList = rewriteTargetList(stmt.ReturningList, columns) + } + + return nil +} + +// expandUpdateStmt expands * in an UPDATE statement's RETURNING clause +func (e *Expander) expandUpdateStmt(ctx context.Context, stmt *ast.UpdateStmt) error { + // Expand CTEs first + if stmt.WithClause != nil && stmt.WithClause.Ctes != nil { + for _, cte := range stmt.WithClause.Ctes.Items { + if err := e.expandNode(ctx, cte); err != nil { + return err + } + } + } + + // Expand RETURNING clause + if hasStarInList(stmt.ReturningList) { + tempRaw := &ast.RawStmt{Stmt: stmt} + tempQuery := ast.Format(tempRaw, e.dialect) + columns, err := e.getColumnNames(ctx, tempQuery) + if err != nil { + return fmt.Errorf("failed to get column names: %w", err) + } + stmt.ReturningList = rewriteTargetList(stmt.ReturningList, columns) + } + + return nil +} + +// expandDeleteStmt expands * in a DELETE statement's RETURNING clause +func (e *Expander) expandDeleteStmt(ctx context.Context, stmt *ast.DeleteStmt) error { + // Expand CTEs first + if stmt.WithClause != nil && stmt.WithClause.Ctes != nil { + for _, cte := range stmt.WithClause.Ctes.Items { + if err := e.expandNode(ctx, cte); err != nil { + return err + } + } + } + + // Expand RETURNING clause + if hasStarInList(stmt.ReturningList) { + tempRaw := &ast.RawStmt{Stmt: stmt} + tempQuery := ast.Format(tempRaw, e.dialect) + columns, err := e.getColumnNames(ctx, tempQuery) + if err != nil { + return fmt.Errorf("failed to get column names: %w", err) + } + stmt.ReturningList = rewriteTargetList(stmt.ReturningList, columns) + } + + return nil +} + +// expandFromClause expands * in subqueries within FROM clause +func (e *Expander) expandFromClause(ctx context.Context, node ast.Node) error { + if node == nil { + return nil + } + + switch n := node.(type) { + case *ast.RangeSubselect: + if n.Subquery != nil { + return e.expandNode(ctx, n.Subquery) + } + case *ast.JoinExpr: + if err := e.expandFromClause(ctx, n.Larg); err != nil { + return err + } + if err := e.expandFromClause(ctx, n.Rarg); err != nil { + return err + } + } + return nil +} + +// hasStarAnywhere checks if there's a * anywhere in the statement using astutils.Search +func hasStarAnywhere(node ast.Node) bool { + if node == nil { + return false + } + // Use astutils.Search to find any A_Star node in the AST + stars := astutils.Search(node, func(n ast.Node) bool { + _, ok := n.(*ast.A_Star) + return ok + }) + return len(stars.Items) > 0 +} + +// hasStarInList checks if a target list contains a * expression using astutils.Search +func hasStarInList(targets *ast.List) bool { + if targets == nil { + return false + } + // Use astutils.Search to find any A_Star node in the target list + stars := astutils.Search(targets, func(n ast.Node) bool { + _, ok := n.(*ast.A_Star) + return ok + }) + return len(stars.Items) > 0 +} + +// getColumnNames prepares the query and returns the column names from the result +func (e *Expander) getColumnNames(ctx context.Context, query string) ([]string, error) { + return e.colGetter.GetColumnNames(ctx, query) +} + +// countStarsInList counts the number of * expressions in a target list +func countStarsInList(targets *ast.List) int { + if targets == nil { + return 0 + } + count := 0 + for _, target := range targets.Items { + resTarget, ok := target.(*ast.ResTarget) + if !ok { + continue + } + if resTarget.Val == nil { + continue + } + colRef, ok := resTarget.Val.(*ast.ColumnRef) + if !ok { + continue + } + if colRef.Fields == nil { + continue + } + for _, field := range colRef.Fields.Items { + if _, ok := field.(*ast.A_Star); ok { + count++ + break + } + } + } + return count +} + +// countNonStarsInList counts the number of non-* expressions in a target list +func countNonStarsInList(targets *ast.List) int { + if targets == nil { + return 0 + } + count := 0 + for _, target := range targets.Items { + resTarget, ok := target.(*ast.ResTarget) + if !ok { + count++ + continue + } + if resTarget.Val == nil { + count++ + continue + } + colRef, ok := resTarget.Val.(*ast.ColumnRef) + if !ok { + count++ + continue + } + if colRef.Fields == nil { + count++ + continue + } + isStar := false + for _, field := range colRef.Fields.Items { + if _, ok := field.(*ast.A_Star); ok { + isStar = true + break + } + } + if !isStar { + count++ + } + } + return count +} + +// rewriteTargetList replaces * in a target list with explicit column references +func rewriteTargetList(targets *ast.List, columns []string) *ast.List { + if targets == nil { + return nil + } + + starCount := countStarsInList(targets) + nonStarCount := countNonStarsInList(targets) + + // Calculate how many columns each * expands to + // Total columns = (columns per star * number of stars) + non-star columns + // So: columns per star = (total - non-star) / stars + columnsPerStar := 0 + if starCount > 0 { + columnsPerStar = (len(columns) - nonStarCount) / starCount + } + + newItems := make([]ast.Node, 0, len(columns)) + colIndex := 0 + + for _, target := range targets.Items { + resTarget, ok := target.(*ast.ResTarget) + if !ok { + newItems = append(newItems, target) + colIndex++ + continue + } + + if resTarget.Val == nil { + newItems = append(newItems, target) + colIndex++ + continue + } + + colRef, ok := resTarget.Val.(*ast.ColumnRef) + if !ok { + newItems = append(newItems, target) + colIndex++ + continue + } + + if colRef.Fields == nil { + newItems = append(newItems, target) + colIndex++ + continue + } + + // Check if this is a * (with or without table qualifier) + // and extract any table prefix + isStar := false + var tablePrefix []string + for _, field := range colRef.Fields.Items { + if _, ok := field.(*ast.A_Star); ok { + isStar = true + break + } + // Collect prefix parts (schema, table name) + if str, ok := field.(*ast.String); ok { + tablePrefix = append(tablePrefix, str.Str) + } + } + + if !isStar { + newItems = append(newItems, target) + colIndex++ + continue + } + + // Replace * with explicit column references + for i := 0; i < columnsPerStar && colIndex < len(columns); i++ { + newItems = append(newItems, makeColumnTargetWithPrefix(columns[colIndex], tablePrefix)) + colIndex++ + } + } + + return &ast.List{Items: newItems} +} + +// makeColumnTargetWithPrefix creates a ResTarget node for a column reference with optional table prefix +func makeColumnTargetWithPrefix(colName string, prefix []string) ast.Node { + fields := make([]ast.Node, 0, len(prefix)+1) + + // Add prefix parts (schema, table name) + for _, p := range prefix { + fields = append(fields, &ast.String{Str: p}) + } + + // Add column name + fields = append(fields, &ast.String{Str: colName}) + + return &ast.ResTarget{ + Val: &ast.ColumnRef{ + Fields: &ast.List{Items: fields}, + }, + } +} diff --git a/internal/x/expander/expander_test.go b/internal/x/expander/expander_test.go new file mode 100644 index 0000000000..07092ff22a --- /dev/null +++ b/internal/x/expander/expander_test.go @@ -0,0 +1,435 @@ +package expander + +import ( + "context" + "database/sql" + "os" + "testing" + + _ "github.com/go-sql-driver/mysql" + "github.com/jackc/pgx/v5/pgxpool" + "github.com/ncruces/go-sqlite3" + + "github.com/sqlc-dev/sqlc/internal/engine/dolphin" + "github.com/sqlc-dev/sqlc/internal/engine/postgresql" + "github.com/sqlc-dev/sqlc/internal/engine/sqlite" + "github.com/sqlc-dev/sqlc/internal/sqltest/docker" + "github.com/sqlc-dev/sqlc/internal/sqltest/native" +) + +// PostgreSQLColumnGetter implements ColumnGetter for PostgreSQL using pgxpool. +type PostgreSQLColumnGetter struct { + pool *pgxpool.Pool +} + +func (g *PostgreSQLColumnGetter) GetColumnNames(ctx context.Context, query string) ([]string, error) { + conn, err := g.pool.Acquire(ctx) + if err != nil { + return nil, err + } + defer conn.Release() + + desc, err := conn.Conn().Prepare(ctx, "", query) + if err != nil { + return nil, err + } + + columns := make([]string, len(desc.Fields)) + for i, field := range desc.Fields { + columns[i] = field.Name + } + + return columns, nil +} + +// MySQLColumnGetter implements ColumnGetter for MySQL. Column names are read +// from the result set metadata returned by executing the query; the test +// tables are empty, so no real rows are transferred. +// +// An earlier implementation pulled column metadata straight out of a prepared +// statement via a forked mysql driver exposing StmtMetadata. That fork +// required a `replace` directive in go.mod, which broke `go install +// github.com/sqlc-dev/sqlc/cmd/sqlc@latest` (see +// https://github.com/sqlc-dev/sqlc/issues/4397). Reading columns from sql.Rows +// works with the upstream driver and keeps the test covering the same +// behavior. +type MySQLColumnGetter struct { + db *sql.DB +} + +func (g *MySQLColumnGetter) GetColumnNames(ctx context.Context, query string) ([]string, error) { + rows, err := g.db.QueryContext(ctx, query) + if err != nil { + return nil, err + } + defer rows.Close() + return rows.Columns() +} + +// SQLiteColumnGetter implements ColumnGetter for SQLite using the native ncruces/go-sqlite3 API. +type SQLiteColumnGetter struct { + conn *sqlite3.Conn +} + +func (g *SQLiteColumnGetter) GetColumnNames(ctx context.Context, query string) ([]string, error) { + // Prepare the statement - this gives us column metadata without executing + stmt, _, err := g.conn.Prepare(query) + if err != nil { + return nil, err + } + defer stmt.Close() + + // Get column names from the prepared statement + count := stmt.ColumnCount() + columns := make([]string, count) + for i := range count { + columns[i] = stmt.ColumnName(i) + } + + return columns, nil +} + +func TestExpandPostgreSQL(t *testing.T) { + ctx := context.Background() + + uri := os.Getenv("POSTGRESQL_SERVER_URI") + if uri == "" { + if err := docker.Installed(); err == nil { + u, err := docker.StartPostgreSQLServer(ctx) + if err != nil { + t.Fatal(err) + } + uri = u + } else if err := native.Supported(); err == nil { + u, err := native.StartPostgreSQLServer(ctx) + if err != nil { + t.Fatal(err) + } + uri = u + } else { + t.Skip("POSTGRESQL_SERVER_URI is empty and neither Docker nor native installation is available") + } + } + + pool, err := pgxpool.New(ctx, uri) + if err != nil { + t.Skipf("could not connect to database: %v", err) + } + defer pool.Close() + + // Create a test table + _, err = pool.Exec(ctx, ` + DROP TABLE IF EXISTS authors; + CREATE TABLE authors ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + bio TEXT + ); + `) + if err != nil { + t.Fatalf("failed to create test table: %v", err) + } + defer pool.Exec(ctx, "DROP TABLE IF EXISTS authors") + + // Create the parser which also implements format.Dialect + parser := postgresql.NewParser() + + // Create the expander + colGetter := &PostgreSQLColumnGetter{pool: pool} + exp := New(colGetter, parser, parser) + + tests := []struct { + name string + query string + expected string + }{ + { + name: "simple select star", + query: "SELECT * FROM authors", + expected: "SELECT id, name, bio FROM authors;", + }, + { + name: "select with no star", + query: "SELECT id, name FROM authors", + expected: "SELECT id, name FROM authors", // No change, returns original + }, + { + name: "select star with where clause", + query: "SELECT * FROM authors WHERE id = 1", + expected: "SELECT id, name, bio FROM authors WHERE id = 1;", + }, + { + name: "double star", + query: "SELECT *, * FROM authors", + expected: "SELECT id, name, bio, id, name, bio FROM authors;", + }, + { + name: "table qualified star", + query: "SELECT authors.* FROM authors", + expected: "SELECT authors.id, authors.name, authors.bio FROM authors;", + }, + { + name: "star in middle of columns", + query: "SELECT id, *, name FROM authors", + expected: "SELECT id, id, name, bio, name FROM authors;", + }, + { + name: "insert returning star", + query: "INSERT INTO authors (name, bio) VALUES ('John', 'A writer') RETURNING *", + expected: "INSERT INTO authors (name, bio) VALUES ('John', 'A writer') RETURNING id, name, bio;", + }, + { + name: "insert returning mixed", + query: "INSERT INTO authors (name, bio) VALUES ('John', 'A writer') RETURNING id, *", + expected: "INSERT INTO authors (name, bio) VALUES ('John', 'A writer') RETURNING id, id, name, bio;", + }, + { + name: "update returning star", + query: "UPDATE authors SET name = 'Jane' WHERE id = 1 RETURNING *", + expected: "UPDATE authors SET name = 'Jane' WHERE id = 1 RETURNING id, name, bio;", + }, + { + name: "delete returning star", + query: "DELETE FROM authors WHERE id = 1 RETURNING *", + expected: "DELETE FROM authors WHERE id = 1 RETURNING id, name, bio;", + }, + { + name: "cte with select star", + query: "WITH a AS (SELECT * FROM authors) SELECT * FROM a", + expected: "WITH a AS (SELECT id, name, bio FROM authors) SELECT id, name, bio FROM a;", + }, + { + name: "multiple ctes with dependency", + query: "WITH a AS (SELECT * FROM authors), b AS (SELECT * FROM a) SELECT * FROM b", + expected: "WITH a AS (SELECT id, name, bio FROM authors), b AS (SELECT id, name, bio FROM a) SELECT id, name, bio FROM b;", + }, + { + name: "count star not expanded", + query: "SELECT COUNT(*) FROM authors", + expected: "SELECT COUNT(*) FROM authors", // No change - COUNT(*) should not be expanded + }, + { + name: "count star with other columns", + query: "SELECT COUNT(*), name FROM authors GROUP BY name", + expected: "SELECT COUNT(*), name FROM authors GROUP BY name", // No change + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + result, err := exp.Expand(ctx, tc.query) + if err != nil { + t.Fatalf("Expand failed: %v", err) + } + if result != tc.expected { + t.Errorf("expected %q, got %q", tc.expected, result) + } + }) + } +} + +func TestExpandMySQL(t *testing.T) { + ctx := context.Background() + + source := os.Getenv("MYSQL_SERVER_URI") + if source == "" { + if err := docker.Installed(); err == nil { + u, err := docker.StartMySQLServer(ctx) + if err != nil { + t.Fatal(err) + } + source = u + } else if err := native.Supported(); err == nil { + u, err := native.StartMySQLServer(ctx) + if err != nil { + t.Fatal(err) + } + source = u + } else { + t.Skip("MYSQL_SERVER_URI is empty and neither Docker nor native installation is available") + } + } + + db, err := sql.Open("mysql", source) + if err != nil { + t.Skipf("could not connect to MySQL: %v", err) + } + defer db.Close() + + // Verify connection + if err := db.Ping(); err != nil { + t.Skipf("could not ping MySQL: %v", err) + } + + // Create a test table + _, err = db.ExecContext(ctx, `DROP TABLE IF EXISTS authors`) + if err != nil { + t.Fatalf("failed to drop test table: %v", err) + } + _, err = db.ExecContext(ctx, ` + CREATE TABLE authors ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + bio TEXT + ) + `) + if err != nil { + t.Fatalf("failed to create test table: %v", err) + } + defer db.ExecContext(ctx, "DROP TABLE IF EXISTS authors") + + // Create the parser which also implements format.Dialect + parser := dolphin.NewParser() + + // Create the expander + colGetter := &MySQLColumnGetter{db: db} + exp := New(colGetter, parser, parser) + + tests := []struct { + name string + query string + expected string + }{ + { + name: "simple select star", + query: "SELECT * FROM authors", + expected: "SELECT id, name, bio FROM authors;", + }, + { + name: "select with no star", + query: "SELECT id, name FROM authors", + expected: "SELECT id, name FROM authors", // No change, returns original + }, + { + name: "select star with where clause", + query: "SELECT * FROM authors WHERE id = 1", + expected: "SELECT id, name, bio FROM authors WHERE id = 1;", + }, + { + name: "table qualified star", + query: "SELECT authors.* FROM authors", + expected: "SELECT authors.id, authors.name, authors.bio FROM authors;", + }, + { + name: "double table qualified star", + query: "SELECT authors.*, authors.* FROM authors", + expected: "SELECT authors.id, authors.name, authors.bio, authors.id, authors.name, authors.bio FROM authors;", + }, + { + name: "star in middle of columns table qualified", + query: "SELECT id, authors.*, name FROM authors", + expected: "SELECT id, authors.id, authors.name, authors.bio, name FROM authors;", + }, + { + name: "count star not expanded", + query: "SELECT COUNT(*) FROM authors", + expected: "SELECT COUNT(*) FROM authors", // No change - COUNT(*) should not be expanded + }, + { + name: "count star with other columns", + query: "SELECT COUNT(*), name FROM authors GROUP BY name", + expected: "SELECT COUNT(*), name FROM authors GROUP BY name", // No change + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + result, err := exp.Expand(ctx, tc.query) + if err != nil { + t.Fatalf("Expand failed: %v", err) + } + if result != tc.expected { + t.Errorf("expected %q, got %q", tc.expected, result) + } + }) + } +} + +func TestExpandSQLite(t *testing.T) { + ctx := context.Background() + + // Create an in-memory SQLite database using native API + conn, err := sqlite3.Open(":memory:") + if err != nil { + t.Fatalf("could not open SQLite: %v", err) + } + defer conn.Close() + + // Create a test table + err = conn.Exec(` + CREATE TABLE authors ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL, + bio TEXT + ) + `) + if err != nil { + t.Fatalf("failed to create test table: %v", err) + } + + // Create the parser which also implements format.Dialect + parser := sqlite.NewParser() + + // Create the expander using native SQLite column getter + colGetter := &SQLiteColumnGetter{conn: conn} + exp := New(colGetter, parser, parser) + + tests := []struct { + name string + query string + expected string + }{ + { + name: "simple select star", + query: "SELECT * FROM authors", + expected: "SELECT id, name, bio FROM authors;", + }, + { + name: "select with no star", + query: "SELECT id, name FROM authors", + expected: "SELECT id, name FROM authors", // No change, returns original + }, + { + name: "select star with where clause", + query: "SELECT * FROM authors WHERE id = 1", + expected: "SELECT id, name, bio FROM authors WHERE id = 1;", + }, + { + name: "double star", + query: "SELECT *, * FROM authors", + expected: "SELECT id, name, bio, id, name, bio FROM authors;", + }, + { + name: "table qualified star", + query: "SELECT authors.* FROM authors", + expected: "SELECT authors.id, authors.name, authors.bio FROM authors;", + }, + { + name: "star in middle of columns", + query: "SELECT id, *, name FROM authors", + expected: "SELECT id, id, name, bio, name FROM authors;", + }, + { + name: "count star not expanded", + query: "SELECT COUNT(*) FROM authors", + expected: "SELECT COUNT(*) FROM authors", // No change - COUNT(*) should not be expanded + }, + { + name: "count star with other columns", + query: "SELECT COUNT(*), name FROM authors GROUP BY name", + expected: "SELECT COUNT(*), name FROM authors GROUP BY name", // No change + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + result, err := exp.Expand(ctx, tc.query) + if err != nil { + t.Fatalf("Expand failed: %v", err) + } + if result != tc.expected { + t.Errorf("expected %q, got %q", tc.expected, result) + } + }) + } +} diff --git a/protos/analysis/analysis.proto b/protos/analysis/analysis.proto new file mode 100644 index 0000000000..60e53b56f1 --- /dev/null +++ b/protos/analysis/analysis.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; + +package analysis; + +message Identifier { + string catalog = 1; + string schema = 2; + string name = 3; +} + +message Column { + string name = 1; + string original_name = 2; + string data_type = 3; + bool not_null = 4; + bool unsigned = 5; + bool is_array = 6; + int32 array_dims = 7; + string comment = 8; + int32 length = 9; // *int + bool is_named_param = 10; + bool is_func_call = 11; + string scope = 12; + Identifier table = 13; + string table_alias = 14; + Identifier type = 15; + Identifier embed_table = 16; + bool is_sqlc_slice = 17; +} + +message Parameter { + int32 number = 1; + Column column = 2; +} + +message Analysis { + repeated Column columns = 1; + repeated Parameter params = 2; +} diff --git a/protos/buf.yaml b/protos/buf.yaml index d2120761b6..998cf114e8 100644 --- a/protos/buf.yaml +++ b/protos/buf.yaml @@ -1,8 +1,8 @@ version: v1 -name: github.com/sqlc-dev/sqlc +name: buf.build/sqlc/sqlc breaking: lint: use: - DEFAULT except: - - PACKAGE_VERSION_SUFFIX \ No newline at end of file + - PACKAGE_VERSION_SUFFIX diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index 380ecf2777..e62208ee95 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -2,60 +2,28 @@ syntax = "proto3"; package plugin; -option go_package = "github.com/sqlc-dev/sqlc/internal/plugin"; +service CodegenService { + rpc Generate (GenerateRequest) returns (GenerateResponse); +} message File { string name = 1 [json_name = "name"]; bytes contents = 2 [json_name = "contents"]; } -message Override { - // PythonType message was field 9 - reserved 9; - - // name of the type to use, e.g. `github.com/segmentio/ksuid.KSUID` or `mymodule.Type` - string code_type = 1 [json_name = "code_type"]; - - // name of the type to use, e.g. `text` - string db_type = 3 [json_name = "db_type"]; - - // True if the override should apply to a nullable database type - bool nullable = 5 [json_name = "nullable"]; - - // fully qualified name of the column, e.g. `accounts.id` - string column = 6 [json_name = "column"]; - - Identifier table = 7 [json_name = "table"]; - - string column_name = 8 [json_name = "column_name"]; - - ParsedGoType go_type = 10; - - // True if the override should apply to a unsigned database type - bool unsigned = 11 [json_name = "unsigned"]; -} - -message ParsedGoType { - string import_path = 1; - string package = 2; - string type_name = 3; - bool basic_type = 4; - map struct_tags = 5; -} - message Settings { + // Rename message was field 5 + // Overides message was field 6 // PythonCode message was field 8 // KotlinCode message was field 9 // GoCode message was field 10; // JSONCode message was field 11; - reserved 8, 9, 10, 11; + reserved 5, 8, 9, 10, 11; string version = 1 [json_name = "version"]; string engine = 2 [json_name = "engine"]; repeated string schema = 3 [json_name = "schema"]; repeated string queries = 4 [json_name = "queries"]; - map rename = 5 [json_name = "rename"]; - repeated Override overrides = 6 [json_name = "overrides"]; Codegen codegen = 12 [json_name = "codegen"]; } @@ -113,6 +81,34 @@ message Identifier { string name = 3; } +// TypeExpr is a column's type as an expression: its name, whether a value +// of it may be null, and its arguments — the (10, 2) of decimal(10, 2), the +// element of array(integer), the fields of struct(a: integer). It is set +// only when the analysis core typed the column; the flat description in +// Column (type, not_null, is_array, array_dims, length, unsigned) is set +// either way. +message TypeExpr { + string name = 1; + bool nullable = 2; + repeated TypeArg args = 3; +} + +// TypeArg is one argument of a TypeExpr. Exactly one of the values is set: +// a type for array(integer), an integer for varchar(20), a boolean or a +// string for a dialect that takes them, or an identifier for a bare word +// that is not a type, such as the max of nvarchar(max). A label names the +// argument, as the fields of struct(a: integer, b: varchar) are named. +message TypeArg { + string label = 1; + oneof value { + TypeExpr type = 2; + int64 int_value = 3; + bool bool_value = 4; + string string_value = 5; + string ident = 6; + } +} + message Column { string name = 1; bool not_null = 3; @@ -132,6 +128,7 @@ message Column { string original_name = 15; bool unsigned = 16; int32 array_dims = 17; + TypeExpr type_expr = 18; } message Query { @@ -148,16 +145,18 @@ message Query { message Parameter { int32 number = 1 [json_name = "number"]; Column column = 2 [json_name = "column"]; + string name = 3 [json_name = "name"]; } -message CodeGenRequest { +message GenerateRequest { Settings settings = 1 [json_name = "settings"]; Catalog catalog = 2 [json_name = "catalog"]; repeated Query queries = 3 [json_name = "queries"]; string sqlc_version = 4 [json_name = "sqlc_version"]; bytes plugin_options = 5 [json_name = "plugin_options"]; + bytes global_options = 6 [json_name = "global_options"]; } -message CodeGenResponse { +message GenerateResponse { repeated File files = 1 [json_name = "files"]; } diff --git a/protos/vet/vet.proto b/protos/vet/vet.proto index 198c724408..9a5ded68ea 100644 --- a/protos/vet/vet.proto +++ b/protos/vet/vet.proto @@ -2,8 +2,6 @@ syntax = "proto3"; package vet; -option go_package = "github.com/sqlc-dev/sqlc/internal/vet"; - message Parameter { int32 number = 1 [json_name = "number"]; } diff --git a/scripts/cleanup-test-dbs/main.go b/scripts/cleanup-test-dbs/main.go new file mode 100644 index 0000000000..51093db307 --- /dev/null +++ b/scripts/cleanup-test-dbs/main.go @@ -0,0 +1,55 @@ +package main + +import ( + "context" + "fmt" + "log" + "os" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgxpool" +) + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} + +const query = ` +SELECT datname +FROM pg_database +WHERE datname LIKE 'sqlc_test_%' +` + +func run() error { + ctx := context.Background() + dburi := os.Getenv("POSTGRESQL_SERVER_URI") + if dburi == "" { + return fmt.Errorf("POSTGRESQL_SERVER_URI is empty") + } + pool, err := pgxpool.New(ctx, dburi) + if err != nil { + return err + } + + rows, err := pool.Query(ctx, query) + if err != nil { + return err + } + + names, err := pgx.CollectRows(rows, pgx.RowTo[string]) + if err != nil { + return err + } + + for _, name := range names { + drop := fmt.Sprintf(`DROP DATABASE IF EXISTS "%s" WITH (FORCE)`, name) + if _, err := pool.Exec(ctx, drop); err != nil { + return err + } + log.Println("dropping database", name) + } + + return nil +} diff --git a/scripts/mirror-go-plugin/main.go b/scripts/mirror-go-plugin/main.go new file mode 100644 index 0000000000..48277dc373 --- /dev/null +++ b/scripts/mirror-go-plugin/main.go @@ -0,0 +1,88 @@ +package main + +import ( + "bytes" + "flag" + "fmt" + "io/fs" + "log" + "os" + "path/filepath" + "strings" +) + +func main() { + flag.Parse() + // Assume it exists + loc := flag.Arg(0) + + dir := filepath.Join("internal", "codegen", "golang") + err := filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + contents, err := os.ReadFile(path) + if err != nil { + return err + } + + newdir := filepath.Join(loc, "internal") + newpath := strings.Replace(path, dir, newdir, 1) + + os.MkdirAll(filepath.Dir(newpath), 0755) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/codegen/golang/opts"`), + []byte(`"github.com/sqlc-dev/sqlc-gen-go/internal/opts"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/plugin"`), + []byte(`"github.com/sqlc-dev/plugin-sdk-go/plugin"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/codegen/sdk"`), + []byte(`"github.com/sqlc-dev/plugin-sdk-go/sdk"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/metadata"`), + []byte(`"github.com/sqlc-dev/plugin-sdk-go/metadata"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/pattern"`), + []byte(`"github.com/sqlc-dev/plugin-sdk-go/pattern"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/debug"`), + []byte(`"github.com/sqlc-dev/sqlc-gen-go/internal/debug"`)) + + contents = bytes.ReplaceAll(contents, + []byte(`"github.com/sqlc-dev/sqlc/internal/inflection"`), + []byte(`"github.com/sqlc-dev/sqlc-gen-go/internal/inflection"`)) + + if err := os.WriteFile(newpath, contents, 0644); err != nil { + return err + } + return nil + }) + + if err != nil { + fmt.Printf("error walking the path: %v\n", err) + return + } + + { + path := filepath.Join("internal", "inflection", "singular.go") + contents, err := os.ReadFile(path) + if err != nil { + log.Fatal(err) + } + newpath := filepath.Join(loc, "internal", "inflection", "singular.go") + if err := os.WriteFile(newpath, contents, 0644); err != nil { + log.Fatal(err) + } + } + +} diff --git a/scripts/regenerate/main.go b/scripts/regenerate/main.go deleted file mode 100644 index c1a578b62d..0000000000 --- a/scripts/regenerate/main.go +++ /dev/null @@ -1,85 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "os" - "os/exec" - "path/filepath" - "strings" -) - -func parseExecCommand(path string) (string, error) { - var exec = struct { - Command string `json:"command"` - }{ - Command: "generate", - } - - execJsonPath := filepath.Join(path, "exec.json") - if _, err := os.Stat(execJsonPath); !os.IsNotExist(err) { - blob, err := os.ReadFile(execJsonPath) - if err != nil { - return "", err - } - if err := json.Unmarshal(blob, &exec); err != nil { - return "", err - } - } - - return exec.Command, nil -} - -func regenerate(dir string) error { - return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if info.IsDir() { - return nil - } - if strings.HasSuffix(path, "sqlc.json") || strings.HasSuffix(path, "sqlc.yaml") || strings.HasSuffix(path, "sqlc.yml") { - cwd := filepath.Dir(path) - command, err := parseExecCommand(cwd) - if err != nil { - return fmt.Errorf("failed to parse exec.json: %w", err) - } - - if command != "generate" { - return nil - } - - var expectFailure bool - if _, err := os.Stat(filepath.Join(cwd, "stderr.txt")); !os.IsNotExist(err) { - expectFailure = true - } - - cmd := exec.Command("sqlc-dev", "generate") - cmd.Env = append(cmd.Env, "SQLC_DUMMY_VALUE=true") - cmd.Dir = cwd - out, failed := cmd.CombinedOutput() - if failed != nil && !expectFailure { - return fmt.Errorf("%s: sqlc-dev generate failed\n%s", cwd, out) - } - if expectFailure { - if err := os.WriteFile(filepath.Join(cwd, "stderr.txt"), out, 0644); err != nil { - return fmt.Errorf("failed to update stderr.txt: %v", err) - } - } - } - return nil - }) -} - -func main() { - dirs := []string{ - filepath.Join("internal", "endtoend", "testdata"), - filepath.Join("examples"), - } - for _, d := range dirs { - if err := regenerate(d); err != nil { - log.Fatal(err) - } - } -} diff --git a/scripts/test-json-process-plugin/main.go b/scripts/test-json-process-plugin/main.go new file mode 100644 index 0000000000..471e0206ef --- /dev/null +++ b/scripts/test-json-process-plugin/main.go @@ -0,0 +1,39 @@ +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "os" +) + +type Out struct { + Files []File `json:"files"` +} + +type File struct { + Name string `json:"name"` + Contents []byte `json:"contents"` +} + +func main() { + in := make(map[string]any) + decoder := json.NewDecoder(os.Stdin) + err := decoder.Decode(&in) + if err != nil { + fmt.Fprintf(os.Stderr, "error generating JSON: %s", err) + os.Exit(2) + } + + buf := bytes.NewBuffer(nil) + queries := in["queries"].([]any) + for _, q := range queries { + text := q.(map[string]any)["text"].(string) + buf.WriteString(text) + buf.WriteString("\n") + } + + e := json.NewEncoder(os.Stdout) + e.SetIndent("", " ") + e.Encode(&Out{Files: []File{{Name: "hello.txt", Contents: buf.Bytes()}}}) +}